mirror of
https://github.com/dream-num/univer.git
synced 2026-09-24 15:32:18 +08:00
refactor: standardize file naming convention for type suffixes (#6935)
This commit is contained in:
@@ -129,7 +129,7 @@ export { DocAutoFormatService } from './services/doc-auto-format.service';
|
||||
export { DocEventManagerService } from './services/doc-event-manager.service';
|
||||
export { DocIMEInputManagerService } from './services/doc-ime-input-manager.service';
|
||||
export { calcDocRangePositions, DocCanvasPopManagerService } from './services/doc-popup-manager.service';
|
||||
export { DocPrintInterceptorService, type IDocPrintComponentContext, type IDocPrintContext } from './services/doc-print-interceptor-service';
|
||||
export { DocPrintInterceptorService, type IDocPrintComponentContext, type IDocPrintContext } from './services/doc-print-interceptor.service';
|
||||
export { DocStateChangeManagerService } from './services/doc-state-change-manager.service';
|
||||
export { DocsRenderService } from './services/docs-render.service';
|
||||
export { Editor } from './services/editor/editor';
|
||||
|
||||
@@ -120,7 +120,7 @@ import { DocMenuStyleService } from './services/doc-menu-style.service';
|
||||
import { DocPageLayoutService } from './services/doc-page-layout.service';
|
||||
import { DocParagraphMenuService } from './services/doc-paragraph-menu.service';
|
||||
import { DocCanvasPopManagerService } from './services/doc-popup-manager.service';
|
||||
import { DocPrintInterceptorService } from './services/doc-print-interceptor-service';
|
||||
import { DocPrintInterceptorService } from './services/doc-print-interceptor.service';
|
||||
import { DocStateChangeManagerService } from './services/doc-state-change-manager.service';
|
||||
import { DocsRenderService } from './services/docs-render.service';
|
||||
import { EditorService, IEditorService } from './services/editor/editor-manager.service';
|
||||
|
||||
@@ -23,7 +23,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { createCommandTestBed } from '../../commands/commands/__tests__/create-command-test-bed';
|
||||
import { DocAutoFormatService } from '../doc-auto-format.service';
|
||||
import { DocMenuStyleService } from '../doc-menu-style.service';
|
||||
import { DocPrintInterceptorService } from '../doc-print-interceptor-service';
|
||||
import { DocPrintInterceptorService } from '../doc-print-interceptor.service';
|
||||
import { DocsRenderService } from '../docs-render.service';
|
||||
|
||||
function createDocData(): IDocumentData {
|
||||
|
||||
@@ -1,296 +0,0 @@
|
||||
/**
|
||||
* Copyright 2023-present DreamNum Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { IDataValidationRule, IRange, Nullable, ObjectMatrix, Workbook, Worksheet } from '@univerjs/core';
|
||||
import {
|
||||
bufferDebounceTime,
|
||||
DataValidationStatus,
|
||||
Disposable,
|
||||
getIntersectRange,
|
||||
Inject,
|
||||
IUniverInstanceService,
|
||||
LifecycleService,
|
||||
LifecycleStages,
|
||||
Range,
|
||||
Tools,
|
||||
UniverInstanceType,
|
||||
} from '@univerjs/core';
|
||||
import { bufferWhen, filter, skip } from 'rxjs';
|
||||
import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
|
||||
import { DataValidationCacheService } from './dv-cache.service';
|
||||
|
||||
export class SheetsDataValidationValidatorService extends Disposable {
|
||||
constructor(
|
||||
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
|
||||
@Inject(SheetDataValidationModel) private readonly _sheetDataValidationModel: SheetDataValidationModel,
|
||||
@Inject(DataValidationCacheService) private readonly _dataValidationCacheService: DataValidationCacheService,
|
||||
@Inject(LifecycleService) private readonly _lifecycleService: LifecycleService
|
||||
) {
|
||||
super();
|
||||
this._initRecalculate();
|
||||
}
|
||||
|
||||
private _initRecalculate() {
|
||||
const handleDirtyRanges = (ranges: { unitId: string; subUnitId: string; ranges: IRange[] }[]) => {
|
||||
if (ranges.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);
|
||||
const worksheet = workbook?.getActiveSheet();
|
||||
|
||||
const map: Record<string, Record<string, IRange[]>> = {};
|
||||
|
||||
ranges.flat().forEach((range) => {
|
||||
if (!map[range.unitId]) {
|
||||
map[range.unitId] = {};
|
||||
}
|
||||
if (!map[range.unitId][range.subUnitId]) {
|
||||
map[range.unitId][range.subUnitId] = [];
|
||||
}
|
||||
const workbook = this._univerInstanceService.getUnit<Workbook>(range.unitId, UniverInstanceType.UNIVER_SHEET);
|
||||
const worksheet = workbook?.getSheetBySheetId(range.subUnitId);
|
||||
if (!worksheet) {
|
||||
return;
|
||||
}
|
||||
map[range.unitId][range.subUnitId].push(...range.ranges.map((range) => Range.transformRange(range, worksheet)));
|
||||
});
|
||||
|
||||
Object.entries(map).forEach(([unitId, subUnitMap]) => {
|
||||
Object.entries(subUnitMap).forEach(([subUnitId, ranges]) => {
|
||||
if (workbook?.getUnitId() === unitId && worksheet?.getSheetId() === subUnitId) {
|
||||
this.validatorRanges(unitId, subUnitId, ranges);
|
||||
} else {
|
||||
requestIdleCallback(() => {
|
||||
this.validatorRanges(unitId, subUnitId, ranges);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.disposeWithMe(
|
||||
this._dataValidationCacheService.dirtyRanges$.pipe(
|
||||
bufferWhen(() => this._lifecycleService.lifecycle$.pipe(
|
||||
skip(1),
|
||||
filter((stage) => stage === LifecycleStages.Rendered)
|
||||
))
|
||||
).subscribe(handleDirtyRanges)
|
||||
);
|
||||
this.disposeWithMe(
|
||||
this._dataValidationCacheService.dirtyRanges$.pipe(
|
||||
filter(() => this._lifecycleService.stage >= LifecycleStages.Rendered),
|
||||
bufferDebounceTime(20)
|
||||
).subscribe(handleDirtyRanges)
|
||||
);
|
||||
}
|
||||
|
||||
private async _validatorByCell(workbook: Workbook, worksheet: Worksheet, row: number, col: number) {
|
||||
const unitId = workbook.getUnitId();
|
||||
const subUnitId = worksheet.getSheetId();
|
||||
if (!Tools.isDefine(row) || !Tools.isDefine(col)) {
|
||||
throw new Error(`row or col is not defined, row: ${row}, col: ${col}`);
|
||||
}
|
||||
|
||||
let _row = row;
|
||||
let _col = col;
|
||||
|
||||
const mergedCell = worksheet.getMergedCell(row, col);
|
||||
if (mergedCell) {
|
||||
_row = mergedCell.startRow;
|
||||
_col = mergedCell.startColumn;
|
||||
}
|
||||
|
||||
const rule = this._sheetDataValidationModel.getRuleByLocation(unitId, subUnitId, _row, _col);
|
||||
if (!rule) {
|
||||
return DataValidationStatus.VALID;
|
||||
}
|
||||
|
||||
return new Promise<DataValidationStatus>((resolve) => {
|
||||
this._sheetDataValidationModel.validator(rule, {
|
||||
unitId,
|
||||
subUnitId,
|
||||
row: _row,
|
||||
col: _col,
|
||||
worksheet,
|
||||
workbook,
|
||||
}, (status) => {
|
||||
resolve(status);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async validatorCell(unitId: string, subUnitId: string, row: number, col: number) {
|
||||
const workbook = this._univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET);
|
||||
if (!workbook) {
|
||||
throw new Error(`cannot find current workbook, unitId: ${unitId}`);
|
||||
}
|
||||
|
||||
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
||||
if (!worksheet) {
|
||||
throw new Error(`cannot find current worksheet, sheetId: ${subUnitId}`);
|
||||
}
|
||||
|
||||
return this._validatorByCell(workbook, worksheet, row, col);
|
||||
}
|
||||
|
||||
async validatorRanges(unitId: string, subUnitId: string, ranges: IRange[]) {
|
||||
if (!ranges.length) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
const workbook = this._univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET);
|
||||
if (!workbook) {
|
||||
throw new Error(`cannot find current workbook, unitId: ${unitId}`);
|
||||
}
|
||||
|
||||
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
||||
if (!worksheet) {
|
||||
throw new Error(`cannot find current worksheet, sheetId: ${subUnitId}`);
|
||||
}
|
||||
|
||||
const allRules = this._sheetDataValidationModel.getRules(unitId, subUnitId);
|
||||
const ruleRanges: IRange[] = [];
|
||||
for (const rule of allRules) {
|
||||
ruleRanges.push(...rule.ranges);
|
||||
}
|
||||
|
||||
const intersectRanges: IRange[] = [];
|
||||
for (const range of ranges) {
|
||||
for (const ruleRange of ruleRanges) {
|
||||
const intersect = getIntersectRange(range, ruleRange);
|
||||
if (intersect) {
|
||||
intersectRanges.push(intersect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const mergeCells: Array<{
|
||||
resultRowIndex: number;
|
||||
resultColIndex: number;
|
||||
row: number;
|
||||
col: number;
|
||||
}> = [];
|
||||
|
||||
const result = await Promise.all(
|
||||
intersectRanges.map((range, resultRowIndex) => {
|
||||
const promises: Promise<DataValidationStatus>[] = [];
|
||||
for (let row = range.startRow; row <= range.endRow; row++) {
|
||||
for (let col = range.startColumn; col <= range.endColumn; col++) {
|
||||
promises.push(this._validatorByCell(workbook, worksheet, row, col));
|
||||
|
||||
const mergedCell = worksheet.getMergedCell(row, col);
|
||||
if (mergedCell) {
|
||||
mergeCells.push({
|
||||
resultRowIndex,
|
||||
resultColIndex: promises.length - 1,
|
||||
row: mergedCell.startRow,
|
||||
col: mergedCell.startColumn,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return Promise.all(promises);
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* If this range has merged cells, the validation status of merged cells should be the same as the main cell, so we need to update the status of merged cells here after all validations are done.
|
||||
* Because during the validation process, merged cells are all marked as VALIDATING status in cache.
|
||||
*/
|
||||
if (mergeCells.length) {
|
||||
mergeCells.forEach(({ resultRowIndex, resultColIndex, row, col }) => {
|
||||
if (result[resultRowIndex][resultColIndex] === DataValidationStatus.VALIDATING) {
|
||||
result[resultRowIndex][resultColIndex] = this._dataValidationCacheService.getValue(
|
||||
unitId,
|
||||
subUnitId,
|
||||
row,
|
||||
col
|
||||
) ?? DataValidationStatus.VALID;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async validatorWorksheet(unitId: string, subUnitId: string) {
|
||||
const workbook = this._univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET);
|
||||
if (!workbook) {
|
||||
throw new Error(`cannot find current workbook, unitId: ${unitId}`);
|
||||
}
|
||||
|
||||
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
||||
if (!worksheet) {
|
||||
throw new Error(`cannot find current worksheet, sheetId: ${subUnitId}`);
|
||||
}
|
||||
const rules = this._sheetDataValidationModel.getRules(unitId, subUnitId);
|
||||
await Promise.all(
|
||||
rules.map((rule) => {
|
||||
return Promise.all(
|
||||
rule.ranges.map((range) => {
|
||||
const promises: Promise<DataValidationStatus>[] = [];
|
||||
Range.foreach(range, (row, col) => {
|
||||
promises.push(this._validatorByCell(workbook, worksheet, row, col));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
return this._dataValidationCacheService.ensureCache(unitId, subUnitId);
|
||||
}
|
||||
|
||||
async validatorWorkbook(unitId: string) {
|
||||
const sheetIds = this._sheetDataValidationModel.getSubUnitIds(unitId);
|
||||
const results = await Promise.all(sheetIds.map((id) => this.validatorWorksheet(unitId, id)));
|
||||
|
||||
const map: Record<string, ObjectMatrix<Nullable<DataValidationStatus>>> = {};
|
||||
|
||||
results.forEach((result, i) => {
|
||||
map[sheetIds[i]] = result;
|
||||
});
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
getDataValidations(unitId: string, subUnitId: string, ranges: IRange[]): IDataValidationRule[] {
|
||||
const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId);
|
||||
const ruleIdSet = new Set<string>();
|
||||
ranges.forEach((range) => {
|
||||
Range.foreach(range, (row, col) => {
|
||||
const ruleId = ruleMatrix.getValue(row, col);
|
||||
if (ruleId) {
|
||||
ruleIdSet.add(ruleId);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const rules: IDataValidationRule[] = [];
|
||||
for (const id of ruleIdSet) {
|
||||
const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, id);
|
||||
if (rule) {
|
||||
rules.push(rule);
|
||||
}
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
getDataValidation(unitId: string, subUnitId: string, ranges: IRange[]): Nullable<IDataValidationRule> {
|
||||
return this.getDataValidations(unitId, subUnitId, ranges)[0];
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,6 @@ export { FormulaReorderController } from './controllers/formula-reorder.controll
|
||||
export { UniverSheetsFormulaUIPlugin } from './plugin';
|
||||
export { FORMULA_PROMPT_ACTIVATED } from './services/prompt.service';
|
||||
export { GlobalRangeSelectorService, type IShowRangeSelectorDialogOptions } from './services/range-selector.service';
|
||||
export { RefSelectionsRenderService } from './services/render-services/ref-selections.render-service';
|
||||
export { RefSelectionsRenderService } from './services/render-services/ref-selections.render.service';
|
||||
export { FormulaEditor, type IFormulaEditorRef } from './views/formula-editor/index';
|
||||
export { type IRangeSelectorInstance, type IRangeSelectorProps, RangeSelector } from './views/range-selector/index';
|
||||
|
||||
@@ -36,7 +36,7 @@ import { FormulaUIController } from './controllers/formula-ui.controller';
|
||||
import { ImageFormulaRenderController } from './controllers/image-formula-render.controller';
|
||||
import { FormulaPromptService, IFormulaPromptService } from './services/prompt.service';
|
||||
import { GlobalRangeSelectorService } from './services/range-selector.service';
|
||||
import { RefSelectionsRenderService } from './services/render-services/ref-selections.render-service';
|
||||
import { RefSelectionsRenderService } from './services/render-services/ref-selections.render.service';
|
||||
import { FormulaEditor } from './views/formula-editor/index';
|
||||
import { RangeSelector } from './views/range-selector';
|
||||
import { GlobalRangeSelector } from './views/range-selector/Global';
|
||||
|
||||
@@ -24,7 +24,7 @@ import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { useDependency, useEvent } from '@univerjs/ui';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { filter } from 'rxjs';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render-service';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render.service';
|
||||
import { useStateRef } from './use-state-ref';
|
||||
|
||||
function getCurrentBodyDataStreamAndOffset(accssor: IAccessor) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
||||
import { useDependency, useEvent, useObservable } from '@univerjs/ui';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { genFormulaRefSelectionStyle } from '../../../common/selection';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render-service';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render.service';
|
||||
|
||||
export interface IRefSelection {
|
||||
refIndex: number;
|
||||
|
||||
@@ -21,7 +21,7 @@ import { IRefSelectionsService, REF_SELECTIONS_ENABLED } from '@univerjs/sheets'
|
||||
import { IContextMenuService, useDependency, useObservable } from '@univerjs/ui';
|
||||
|
||||
import { useEffect, useLayoutEffect, useMemo } from 'react';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render-service';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render.service';
|
||||
|
||||
export const useRefactorEffect = (isNeed: boolean, selecting: boolean, unitId: string, editorId: string, disableContextMenu = true) => {
|
||||
const renderManagerService = useDependency(IRenderManagerService);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ import { useDependency, useEvent, useObservable } from '@univerjs/ui';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { merge } from 'rxjs';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render-service';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render.service';
|
||||
import { findIndexFromSequenceNodes, findRefSequenceIndex } from '../../range-selector/utils/find-index-from-sequence-nodes';
|
||||
import { getOffsetFromSequenceNodes } from '../../range-selector/utils/get-offset-from-sequence-nodes';
|
||||
import { sequenceNodeToText } from '../../range-selector/utils/sequence-node-to-text';
|
||||
|
||||
@@ -20,7 +20,7 @@ import { IRenderManagerService } from '@univerjs/engine-render';
|
||||
import { SetWorksheetActiveOperation } from '@univerjs/sheets';
|
||||
import { useDependency } from '@univerjs/ui';
|
||||
import { useEffect } from 'react';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render-service';
|
||||
import { RefSelectionsRenderService } from '../../../services/render-services/ref-selections.render.service';
|
||||
|
||||
export const useSwitchSheet = (
|
||||
isNeed: boolean,
|
||||
|
||||
@@ -23,7 +23,7 @@ import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
|
||||
import pkg from '../package.json';
|
||||
import { defaultPluginConfig } from './config/config';
|
||||
import { NumfmtAlertRenderController } from './controllers/numfmt-alert-render.controller';
|
||||
import { NumfmtRepeatLastActionController } from './controllers/numfmt-repeat-last-action-controller';
|
||||
import { NumfmtRepeatLastActionController } from './controllers/numfmt-repeat-last-action.controller';
|
||||
import { SheetNumfmtUIController } from './controllers/numfmt.controller';
|
||||
import { NumfmtEditorController } from './controllers/numfmt.editor.controller';
|
||||
import { UserHabitController } from './controllers/user-habit.controller';
|
||||
|
||||
@@ -24,14 +24,14 @@ import { OpenTableFilterPanelOperation } from './commands/operations/open-table-
|
||||
import { OpenTableSelectorOperation } from './commands/operations/open-table-selector.operation';
|
||||
import { defaultPluginConfig, SHEETS_TABLE_UI_PLUGIN_CONFIG_KEY } from './config/config';
|
||||
import { PLUGIN_NAME } from './const';
|
||||
import { SheetTableControlsRenderController } from './controllers/sheet-table-controls-render.controller';
|
||||
import { SheetsTableComponentController } from './controllers/sheet-table-component.controller';
|
||||
import { SheetTableControlsRenderController } from './controllers/sheet-table-controls-render.controller';
|
||||
import { SheetsTableFilterButtonRenderController } from './controllers/sheet-table-filter-button-render.controller';
|
||||
import { SheetsTableRenderController } from './controllers/sheet-table-render.controller';
|
||||
import { SheetTableSelectionController } from './controllers/sheet-table-selection.controller';
|
||||
import { SheetTableThemeUIController } from './controllers/sheet-table-theme-ui.controller';
|
||||
import { SheetTableMenuController } from './menu/sheet-table-menu.controller';
|
||||
import { SheetsTableUiService } from './services/sheets-table-ui-service';
|
||||
import { SheetsTableUiService } from './services/sheets-table-ui.service';
|
||||
|
||||
@DependentOn(UniverSheetsTablePlugin)
|
||||
export class UniverSheetsTableUIPlugin extends Plugin {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { SetRangeValuesMutation } from '@univerjs/sheets';
|
||||
import { SetSheetTableFilterCommand, TableColumnFilterTypeEnum } from '@univerjs/sheets-table';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { FilterByEnum } from '../../types';
|
||||
import { SheetsTableUiService } from '../sheets-table-ui-service';
|
||||
import { SheetsTableUiService } from '../sheets-table-ui.service';
|
||||
|
||||
describe('SheetsTableUiService', () => {
|
||||
it('should build panel props, compute cached filter items and clear cache on related commands', () => {
|
||||
@@ -26,7 +26,7 @@ import { SheetsTableSortStateEnum, SheetTableInsertColumnAtCommand, SheetTableRe
|
||||
import { useDependency } from '@univerjs/ui';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { SheetsTableComponentController } from '../../controllers/sheet-table-component.controller';
|
||||
import { SheetsTableUiService } from '../../services/sheets-table-ui-service';
|
||||
import { SheetsTableUiService } from '../../services/sheets-table-ui.service';
|
||||
import { FilterByEnum } from '../../types';
|
||||
import { SheetTableConditionPanel } from './SheetTableConditionPanel';
|
||||
import { SheetTableItemsFilterPanel } from './SheetTableItemsFilterPanel';
|
||||
|
||||
@@ -20,7 +20,7 @@ import { LocaleService } from '@univerjs/core';
|
||||
import { borderClassName, Checkbox, clsx, Input, scrollbarClassName } from '@univerjs/design';
|
||||
import { useDependency } from '@univerjs/ui';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { SheetsTableUiService } from '../../services/sheets-table-ui-service';
|
||||
import { SheetsTableUiService } from '../../services/sheets-table-ui.service';
|
||||
|
||||
interface ISheetTableItemsFilterPanelProps {
|
||||
unitId: string;
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import { SheetsTableSortStateEnum, SheetTableInsertColumnAtCommand, SheetTableRe
|
||||
import { createElement } from 'react';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { SheetsTableComponentController } from '../../../controllers/sheet-table-component.controller';
|
||||
import { SheetsTableUiService } from '../../../services/sheets-table-ui-service';
|
||||
import { SheetsTableUiService } from '../../../services/sheets-table-ui.service';
|
||||
import { FilterByEnum } from '../../../types';
|
||||
import { SheetTableFilterPanel } from '../SheetTableFilterPanel';
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
|
||||
import { LocaleService } from '@univerjs/core';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { SheetsTableUiService } from '../../../services/sheets-table-ui-service';
|
||||
import { SheetsTableUiService } from '../../../services/sheets-table-ui.service';
|
||||
import { SheetTableItemsFilterPanel } from '../SheetTableItemsFilterPanel';
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { TableManager } from '../../../model/table-manager';
|
||||
import { SheetTableService } from '../../../services/table-service';
|
||||
import { SheetTableService } from '../../../services/table.service';
|
||||
import { AddSheetTableMutation } from '../add-sheet-table.mutation';
|
||||
import { DeleteSheetTableMutation } from '../delete-sheet-table.mutation';
|
||||
import { SetSheetTableMutation } from '../set-sheet-table.mutation';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import type { IMutation } from '@univerjs/core';
|
||||
import type { ITableOptions, ITableRange } from '../../types/type';
|
||||
import { CommandType } from '@univerjs/core';
|
||||
import { SheetTableService } from '../../services/table-service';
|
||||
import { SheetTableService } from '../../services/table.service';
|
||||
|
||||
export interface IAddSheetTableParams {
|
||||
unitId: string;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import type { IMutation } from '@univerjs/core';
|
||||
import { CommandType } from '@univerjs/core';
|
||||
import { SheetTableService } from '../../services/table-service';
|
||||
import { SheetTableService } from '../../services/table.service';
|
||||
|
||||
export interface IDeleteSheetTableParams {
|
||||
unitId: string;
|
||||
|
||||
@@ -38,7 +38,7 @@ export { SheetsTableController } from './controllers/sheets-table.controller';
|
||||
export { customEmptyThemeWithBorderStyle, processStyleWithBorderStyle } from './controllers/table-theme.factory';
|
||||
export { TableManager } from './model/table-manager';
|
||||
export { UniverSheetsTablePlugin } from './plugin';
|
||||
export { SheetTableService } from './services/table-service';
|
||||
export { SheetTableService } from './services/table.service';
|
||||
export { SheetsTableButtonStateEnum, SheetsTableSortStateEnum, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from './types/enum';
|
||||
export type { ITableColumnJson, ITableConditionFilterItem, ITableData, ITableFilterItem, ITableInfo, ITableInfoWithUnitId, ITableManualFilterItem, ITableOptions, ITableRange, ITableRangeWithState, TableMetaType, TableRelationTupleType } from './types/type';
|
||||
export type { ITableJson, ITableSetConfig } from './types/type';
|
||||
|
||||
@@ -37,7 +37,7 @@ import { SheetsTableThemeController } from './controllers/sheet-table-theme.cont
|
||||
import { SheetsTableController } from './controllers/sheets-table.controller';
|
||||
import { TableFilterController } from './controllers/table-filter.controller';
|
||||
import { TableManager } from './model/table-manager';
|
||||
import { SheetTableService } from './services/table-service';
|
||||
import { SheetTableService } from './services/table.service';
|
||||
|
||||
export class UniverSheetsTablePlugin extends Plugin {
|
||||
static override pluginName = PLUGIN_NAME;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import * as conditionUtil from '../../model/filter-util/condition';
|
||||
import { TableConditionTypeEnum } from '../../types/enum';
|
||||
import { SheetTableService } from '../table-service';
|
||||
import { SheetTableService } from '../table.service';
|
||||
|
||||
describe('SheetTableService', () => {
|
||||
it('should proxy table CRUD and metadata calls to table manager', () => {
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
SetBorderCommand,
|
||||
SetBorderPositionCommand,
|
||||
SetBorderStyleCommand,
|
||||
} from '../set-border-command';
|
||||
} from '../set-border.command';
|
||||
import { createCommandTestBed } from './create-command-test-bed';
|
||||
|
||||
describe('Test style commands', () => {
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
} from '@univerjs/core';
|
||||
import { SheetsSelectionsService } from '../../services/selections/selection.service';
|
||||
import { SheetInterceptorService } from '../../services/sheet-interceptor/sheet-interceptor.service';
|
||||
import { getRemoveRangeMutations } from '../utils/handle-range-mutation';
|
||||
import { getRemoveRangeMutations } from '../utils/handle-range.mutation';
|
||||
import { followSelectionOperation } from './utils/selection-utils';
|
||||
import { getSheetCommandTarget } from './utils/target-util';
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
} from '@univerjs/core';
|
||||
import { SheetsSelectionsService } from '../../services/selections/selection.service';
|
||||
import { SheetInterceptorService } from '../../services/sheet-interceptor/sheet-interceptor.service';
|
||||
import { getRemoveRangeMutations } from '../utils/handle-range-mutation';
|
||||
import { getRemoveRangeMutations } from '../utils/handle-range.mutation';
|
||||
import { followSelectionOperation } from './utils/selection-utils';
|
||||
import { getSheetCommandTarget } from './utils/target-util';
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import { SheetsSelectionsService } from '../../services/selections/selection.ser
|
||||
import { SheetInterceptorService } from '../../services/sheet-interceptor/sheet-interceptor.service';
|
||||
import { InsertRowMutation, InsertRowMutationUndoFactory } from '../mutations/insert-row-col.mutation';
|
||||
import { RemoveRowMutation } from '../mutations/remove-row-col.mutation';
|
||||
import { getInsertRangeMutations } from '../utils/handle-range-mutation';
|
||||
import { getInsertRangeMutations } from '../utils/handle-range.mutation';
|
||||
import { followSelectionOperation } from './utils/selection-utils';
|
||||
import { getSheetCommandTarget } from './utils/target-util';
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import { SheetsSelectionsService } from '../../services/selections/selection.ser
|
||||
import { SheetInterceptorService } from '../../services/sheet-interceptor/sheet-interceptor.service';
|
||||
import { InsertColMutation, InsertColMutationUndoFactory } from '../mutations/insert-row-col.mutation';
|
||||
import { RemoveColMutation } from '../mutations/remove-row-col.mutation';
|
||||
import { getInsertRangeMutations } from '../utils/handle-range-mutation';
|
||||
import { getInsertRangeMutations } from '../utils/handle-range.mutation';
|
||||
import { followSelectionOperation } from './utils/selection-utils';
|
||||
import { getSheetCommandTarget } from './utils/target-util';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import type { IAccessor, ICellData, ICommand, IRange } from '@univerjs/core';
|
||||
import type { IRemoveNumfmtMutationParams } from '../mutations/numfmt-mutation';
|
||||
import type { IRemoveNumfmtMutationParams } from '../mutations/numfmt.mutation';
|
||||
import type { ISetRangeValuesMutationParams } from '../mutations/set-range-values.mutation';
|
||||
import type { ISheetCommandSharedParams } from '../utils/interface';
|
||||
import {
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
sequenceExecute,
|
||||
} from '@univerjs/core';
|
||||
import { SheetsSelectionsService } from '../../services/selections/selection.service';
|
||||
import { factoryRemoveNumfmtUndoMutation, RemoveNumfmtMutation } from '../mutations/numfmt-mutation';
|
||||
import { factoryRemoveNumfmtUndoMutation, RemoveNumfmtMutation } from '../mutations/numfmt.mutation';
|
||||
import { SetRangeValuesMutation, SetRangeValuesUndoMutationFactory } from '../mutations/set-range-values.mutation';
|
||||
import { getSheetCommandTarget } from './utils/target-util';
|
||||
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import type { IAccessor } from '@univerjs/core';
|
||||
import type { IRemoveNumfmtMutationParams, ISetNumfmtMutationParams } from '../numfmt-mutation';
|
||||
import type { IRemoveNumfmtMutationParams, ISetNumfmtMutationParams } from '../numfmt.mutation';
|
||||
import { cellToRange } from '@univerjs/core';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { INumfmtService } from '../../../services/numfmt/type';
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
RemoveNumfmtMutation,
|
||||
SetNumfmtMutation,
|
||||
transformCellsToRange,
|
||||
} from '../numfmt-mutation';
|
||||
} from '../numfmt.mutation';
|
||||
|
||||
function createAccessor(numfmtService: {
|
||||
getValue: ReturnType<typeof vi.fn>;
|
||||
@@ -45,7 +45,7 @@ function createAccessor(numfmtService: {
|
||||
} as unknown as IAccessor;
|
||||
}
|
||||
|
||||
describe('numfmt-mutation', () => {
|
||||
describe('numfmt.mutation', () => {
|
||||
it('transformCellsToRange groups cells by pattern', () => {
|
||||
const result = transformCellsToRange('unit-1', 'sheet-1', [
|
||||
{ pattern: '0%', row: 1, col: 1 },
|
||||
@@ -65,7 +65,7 @@ import {
|
||||
SetBorderCommand,
|
||||
SetBorderPositionCommand,
|
||||
SetBorderStyleCommand,
|
||||
} from '../commands/commands/set-border-command';
|
||||
} from '../commands/commands/set-border.command';
|
||||
import { SetColDataCommand } from '../commands/commands/set-col-data.command';
|
||||
import {
|
||||
SetColHiddenCommand,
|
||||
@@ -133,7 +133,7 @@ import { InsertSheetMutation } from '../commands/mutations/insert-sheet.mutation
|
||||
import { MarkDirtyFilterChangeMutation } from '../commands/mutations/mark-dirty-filter-change.mutation';
|
||||
import { MoveRangeMutation } from '../commands/mutations/move-range.mutation';
|
||||
import { MoveColsMutation, MoveRowsMutation } from '../commands/mutations/move-rows-cols.mutation';
|
||||
import { RemoveNumfmtMutation, SetNumfmtMutation } from '../commands/mutations/numfmt-mutation';
|
||||
import { RemoveNumfmtMutation, SetNumfmtMutation } from '../commands/mutations/numfmt.mutation';
|
||||
import { RegisterWorksheetRangeThemeStyleMutation } from '../commands/mutations/register-range-theme.mutation';
|
||||
import { RemoveRangeThemeMutation } from '../commands/mutations/remove-range-theme.mutation';
|
||||
import { RemoveColMutation, RemoveRowMutation } from '../commands/mutations/remove-row-col.mutation';
|
||||
|
||||
@@ -28,7 +28,7 @@ import type { IInsertColCommandParams, IInsertRowCommandParams } from '../../com
|
||||
import type { IMoveRangeCommandParams } from '../../commands/commands/move-range.command';
|
||||
import type { IMoveColsCommandParams, IMoveRowsCommandParams } from '../../commands/commands/move-rows-cols.command';
|
||||
import type { IRemoveColByRangeCommandParams, IRemoveRowByRangeCommandParams } from '../../commands/commands/remove-row-col.command';
|
||||
import type { ISetBorderCommandParams } from '../../commands/commands/set-border-command';
|
||||
import type { ISetBorderCommandParams } from '../../commands/commands/set-border.command';
|
||||
import type { ISetSpecificColsVisibleCommandParams } from '../../commands/commands/set-col-visible.command';
|
||||
import type { ISetRangeValuesCommandParams } from '../../commands/commands/set-range-values.command';
|
||||
import type { ISetSpecificRowsVisibleCommandParams } from '../../commands/commands/set-row-visible.command';
|
||||
@@ -71,7 +71,7 @@ import { MoveRangeCommand } from '../../commands/commands/move-range.command';
|
||||
import { MoveColsCommand, MoveRowsCommand } from '../../commands/commands/move-rows-cols.command';
|
||||
import { RemoveDefinedNameCommand } from '../../commands/commands/remove-defined-name.command';
|
||||
import { RemoveColByRangeCommand, RemoveRowByRangeCommand } from '../../commands/commands/remove-row-col.command';
|
||||
import { SetBorderCommand } from '../../commands/commands/set-border-command';
|
||||
import { SetBorderCommand } from '../../commands/commands/set-border.command';
|
||||
import { SetSelectedColsVisibleCommand, SetSpecificColsVisibleCommand } from '../../commands/commands/set-col-visible.command';
|
||||
import { SetDefinedNameCommand } from '../../commands/commands/set-defined-name.command';
|
||||
import { SetRangeValuesCommand } from '../../commands/commands/set-range-values.command';
|
||||
|
||||
@@ -129,7 +129,7 @@ export {
|
||||
SetBorderCommand,
|
||||
SetBorderPositionCommand,
|
||||
SetBorderStyleCommand,
|
||||
} from './commands/commands/set-border-command';
|
||||
} from './commands/commands/set-border.command';
|
||||
export { type ISetColDataCommandParams, SetColDataCommand } from './commands/commands/set-col-data.command';
|
||||
export {
|
||||
type ISetColHiddenCommandParams,
|
||||
@@ -250,7 +250,7 @@ export {
|
||||
RemoveNumfmtMutation,
|
||||
SetNumfmtMutation,
|
||||
transformCellsToRange,
|
||||
} from './commands/mutations/numfmt-mutation';
|
||||
} from './commands/mutations/numfmt.mutation';
|
||||
export { type IRegisterWorksheetRangeThemeStyleMutationParams, RegisterWorksheetRangeThemeStyleMutation } from './commands/mutations/register-range-theme.mutation';
|
||||
export { RemoveRangeThemeMutation } from './commands/mutations/remove-range-theme.mutation';
|
||||
export type { IRemoveRangeThemeMutationParams } from './commands/mutations/remove-range-theme.mutation';
|
||||
@@ -328,9 +328,9 @@ export { type IScrollToCellOperationParams, ScrollToCellOperation } from './comm
|
||||
export { type ISelectRangeCommandParams, type ISetSelectionsOperationParams, SelectRangeCommand, SetSelectionsOperation } from './commands/operations/selection.operation';
|
||||
export { type ISetWorksheetActiveOperationParams, SetWorksheetActiveOperation } from './commands/operations/set-worksheet-active.operation';
|
||||
export { AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory } from './commands/utils/handle-merge-operation';
|
||||
export { handleDeleteRangeMutation } from './commands/utils/handle-range-mutation';
|
||||
export { getInsertRangeMutations, getRemoveRangeMutations } from './commands/utils/handle-range-mutation';
|
||||
export { handleInsertRangeMutation } from './commands/utils/handle-range-mutation';
|
||||
export { handleDeleteRangeMutation } from './commands/utils/handle-range.mutation';
|
||||
export { getInsertRangeMutations, getRemoveRangeMutations } from './commands/utils/handle-range.mutation';
|
||||
export { handleInsertRangeMutation } from './commands/utils/handle-range.mutation';
|
||||
export { type ISheetCommandSharedParams } from './commands/utils/interface';
|
||||
export { getSelectionsService } from './commands/utils/selection-command-util';
|
||||
export { defaultLargeSheetOperationConfig, type ILargeSheetOperationConfig, type IUniverSheetsConfig, SHEETS_PLUGIN_CONFIG_KEY } from './config/config';
|
||||
@@ -369,7 +369,7 @@ export {
|
||||
type ISheetAutoFillHook,
|
||||
} from './services/auto-fill/type';
|
||||
export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
|
||||
export { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range-service';
|
||||
export { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range.service';
|
||||
export { SheetLazyExecuteScheduleService } from './services/lazy-execute-schedule.service';
|
||||
export { NumfmtService } from './services/numfmt/numfmt.service';
|
||||
export type { INumfmtItem, INumfmtItemWithCache } from './services/numfmt/type';
|
||||
@@ -436,7 +436,7 @@ export { WorkbookPermissionService } from './services/permission/workbook-permis
|
||||
export { WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from './services/permission/worksheet-permission';
|
||||
export type { IWorksheetProtectionRenderCellData } from './services/permission/worksheet-permission/type';
|
||||
export { WorksheetPermissionService } from './services/permission/worksheet-permission/worksheet-permission.service';
|
||||
export { SheetRangeThemeService } from './services/range-theme-service';
|
||||
export { SheetRangeThemeService } from './services/range-theme.service';
|
||||
export { RefRangeService } from './services/ref-range/ref-range.service';
|
||||
export type { EffectRefRangeParams, IOperator } from './services/ref-range/type';
|
||||
export { EffectRefRangId, OperatorType } from './services/ref-range/type';
|
||||
|
||||
@@ -39,7 +39,7 @@ import { RangeProtectionCache } from './model/range-protection.cache';
|
||||
import { SheetRangeThemeModel } from './model/range-theme-model';
|
||||
import { AutoFillService, IAutoFillService } from './services/auto-fill/auto-fill.service';
|
||||
import { BorderStyleManagerService } from './services/border-style-manager.service';
|
||||
import { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range-service';
|
||||
import { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range.service';
|
||||
import { SheetLazyExecuteScheduleService } from './services/lazy-execute-schedule.service';
|
||||
import { NumfmtService } from './services/numfmt/numfmt.service';
|
||||
import { INumfmtService } from './services/numfmt/type';
|
||||
@@ -47,7 +47,7 @@ import { RangeProtectionRefRangeService } from './services/permission/range-perm
|
||||
import { RangeProtectionService } from './services/permission/range-permission/range-protection.service';
|
||||
import { WorkbookPermissionService } from './services/permission/workbook-permission/workbook-permission.service';
|
||||
import { WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from './services/permission/worksheet-permission';
|
||||
import { SheetRangeThemeService } from './services/range-theme-service';
|
||||
import { SheetRangeThemeService } from './services/range-theme.service';
|
||||
import { RefRangeService } from './services/ref-range/ref-range.service';
|
||||
import { SheetsSelectionsService } from './services/selections/selection.service';
|
||||
import { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
|
||||
|
||||
@@ -18,7 +18,7 @@ import type { Injector, Styles, Univer, Workbook, Worksheet } from '@univerjs/co
|
||||
import type { IRemoveNumfmtMutationParams, ISetNumfmtMutationParams } from '@univerjs/sheets';
|
||||
import { cellToRange, CellValueType, DEFAULT_TEXT_FORMAT_EXCEL, ICommandService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { RemoveNumfmtMutation, SetNumfmtMutation } from '../../commands/mutations/numfmt-mutation';
|
||||
import { RemoveNumfmtMutation, SetNumfmtMutation } from '../../commands/mutations/numfmt.mutation';
|
||||
import { NumfmtService } from '../numfmt/numfmt.service';
|
||||
import { INumfmtService } from '../numfmt/type';
|
||||
import { createTestBase } from './util';
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ export interface IExclusiveRangeService {
|
||||
*/
|
||||
getInterestGroupId(selections: ISelectionWithStyle[]): string[];
|
||||
}
|
||||
export const IExclusiveRangeService = createIdentifier<IExclusiveRangeService>('univer.exclusive-range-service');
|
||||
export const IExclusiveRangeService = createIdentifier<IExclusiveRangeService>('univer.exclusive-range.service');
|
||||
|
||||
export class ExclusiveRangeService extends Disposable implements IExclusiveRangeService {
|
||||
/**
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import * as indexModule from './index';
|
||||
import { ITelemetryService } from './services/telemetry-service';
|
||||
import { ITelemetryService } from './services/telemetry.service';
|
||||
|
||||
describe('telemetry exports', () => {
|
||||
it('should re-export ITelemetryService identifier from index', () => {
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './services/telemetry-service';
|
||||
export * from './services/telemetry.service';
|
||||
|
||||
Reference in New Issue
Block a user