@univerjs/sheets-data-validation 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +29 -0
- package/lib/cjs/index.js +9 -0
- package/lib/es/index.js +6749 -0
- package/lib/index.css +1 -0
- package/lib/types/commands/commands/data-validation.command.d.ts +21 -0
- package/lib/types/commands/mutations/formula.mutation.d.ts +10 -0
- package/lib/types/commands/operations/data-validation.operation.d.ts +18 -0
- package/lib/types/common/const.d.ts +18 -0
- package/lib/types/common/date-text-map.d.ts +6 -0
- package/lib/types/controllers/dv-alert.controller.d.ts +14 -0
- package/lib/types/controllers/dv-auto-fill.controller.d.ts +10 -0
- package/lib/types/controllers/dv-copy-paste.controller.d.ts +13 -0
- package/lib/types/controllers/dv-ref-range.controller.d.ts +29 -0
- package/lib/types/controllers/dv-reject-input.controller.d.ts +14 -0
- package/lib/types/controllers/dv-render.controller.d.ts +29 -0
- package/lib/types/controllers/dv-resource.controller.d.ts +14 -0
- package/lib/types/controllers/dv-sheet.controller.d.ts +13 -0
- package/lib/types/controllers/dv.controller.d.ts +22 -0
- package/lib/types/controllers/dv.menu.d.ts +7 -0
- package/lib/types/index.d.ts +37 -0
- package/lib/types/locale/en-US.d.ts +4 -0
- package/lib/types/locale/index.d.ts +17 -0
- package/lib/types/locale/zh-CN.d.ts +160 -0
- package/lib/types/models/rule-matrix.d.ts +28 -0
- package/lib/types/models/sheet-data-validation-manager.d.ts +28 -0
- package/lib/types/plugin.d.ts +10 -0
- package/lib/types/services/data-validation-panel.service.d.ts +27 -0
- package/lib/types/services/dropdown-manager.service.d.ts +37 -0
- package/lib/types/services/dv-cache.service.d.ts +21 -0
- package/lib/types/services/dv-custom-formula.service.d.ts +41 -0
- package/lib/types/services/dv-formula.service.d.ts +21 -0
- package/lib/types/services/dv.service.d.ts +20 -0
- package/lib/types/services/dv.tips.d.ts +17 -0
- package/lib/types/services/formula-common.d.ts +19 -0
- package/lib/types/services/register-formula.service.d.ts +28 -0
- package/lib/types/types/const/index.d.ts +17 -0
- package/lib/types/types/const/operator-text-map.d.ts +5 -0
- package/lib/types/types/const/two-formula-operators.d.ts +3 -0
- package/lib/types/types/index.d.ts +17 -0
- package/lib/types/types/interface/i-update-rule-formula.d.ts +19 -0
- package/lib/types/types/interface/index.d.ts +16 -0
- package/lib/types/utils/date.d.ts +17 -0
- package/lib/types/utils/formula.d.ts +3 -0
- package/lib/types/utils/get-cell-data-origin.d.ts +3 -0
- package/lib/types/validators/checkbox-validator.d.ts +25 -0
- package/lib/types/validators/custom-validator.d.ts +15 -0
- package/lib/types/validators/date-validator.d.ts +31 -0
- package/lib/types/validators/decimal-validator.d.ts +36 -0
- package/lib/types/validators/index.d.ts +20 -0
- package/lib/types/validators/list-multiple-validator.d.ts +27 -0
- package/lib/types/validators/list-validator.d.ts +28 -0
- package/lib/types/validators/text-length-validator.d.ts +32 -0
- package/lib/types/validators/util.d.ts +6 -0
- package/lib/types/validators/whole-validator.d.ts +35 -0
- package/lib/types/views/date-dropdown/index.d.ts +4 -0
- package/lib/types/views/detail/index.d.ts +3 -0
- package/lib/types/views/drop-down/CellDropdown.d.ts +3 -0
- package/lib/types/views/drop-down/index.d.ts +18 -0
- package/lib/types/views/formula-input/base-formula-input.d.ts +4 -0
- package/lib/types/views/formula-input/checkbox-formula-input.d.ts +4 -0
- package/lib/types/views/formula-input/custom-formula-input.d.ts +4 -0
- package/lib/types/views/formula-input/formula-input.d.ts +5 -0
- package/lib/types/views/formula-input/index.d.ts +7 -0
- package/lib/types/views/formula-input/list-formula-input.d.ts +4 -0
- package/lib/types/views/index.d.ts +20 -0
- package/lib/types/views/item/index.d.ts +10 -0
- package/lib/types/views/list/index.d.ts +3 -0
- package/lib/types/views/list-dropdown/index.d.ts +4 -0
- package/lib/types/views/options/index.d.ts +9 -0
- package/lib/types/views/panel/index.d.ts +3 -0
- package/lib/types/views/render-mode/index.d.ts +11 -0
- package/lib/types/widgets/checkbox-widget.d.ts +20 -0
- package/lib/types/widgets/dropdown-multiple-widget.d.ts +20 -0
- package/lib/types/widgets/dropdown-widget.d.ts +32 -0
- package/lib/types/widgets/shape/dropdown.d.ts +13 -0
- package/lib/types/widgets/shape/index.d.ts +18 -0
- package/lib/types/widgets/shape/layout.d.ts +38 -0
- package/lib/umd/index.js +9 -0
- package/package.json +79 -0
package/lib/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.univer-data-validation-options-button{cursor:pointer;margin-bottom:12px;font-size:var(--font-size-sm);color:rgba(var(--color-black));display:flex;align-items:center}.univer-data-validation-options-button-icon{font-size:8px;margin-left:4px}.univer-data-validation-detail-form-item{width:100%}.univer-data-validation-detail-buttons{margin-top:20px;display:flex;flex-direction:row;justify-content:flex-end}.univer-data-validation-detail-button{margin-left:12px}.univer-data-validation-item-container{border-radius:var(--border-radius-base);background-color:rgba(var(--bg-color-secondary));padding:var(--padding-sm);padding-right:36px;margin-left:-8px;margin-right:-8px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:space-between;cursor:pointer;position:relative;border-radius:6px}.univer-data-validation-item-container:hover{background-color:#f5f5f5}.univer-data-validation-item-title{font-size:var(--font-size-sm);color:rgba(var(--color-black));line-height:22px;font-weight:500}.univer-data-validation-item-content{color:#7a7a7a;font-size:var(--font-size-xs);line-height:18px}.univer-data-validation-item-icon{position:absolute;top:19px;right:8px;width:20px;height:20px;display:flex;justify-content:center;align-items:center;border-radius:4px}.univer-data-validation-item-icon:hover{background:#e5e5e5}.univer-data-validation-list-buttons{margin-top:20px;display:flex;flex-direction:row;justify-content:flex-end}.univer-data-validation-list-button{margin-left:12px}.univer-dv-list-dropdown{border-radius:8px;border:1px solid rgba(var(--color-grey200));background:rgba(var(--color-white));box-shadow:var(--box-shadow-base);padding:8px;max-height:267px;display:flex;flex-direction:column;max-width:200px;box-sizing:border-box}.univer-dv-list-dropdown-title{padding:0 6px;color:var(--grey-500);font-size:12px;line-height:1.5;flex-shrink:0;flex-grow:0}.univer-dv-list-dropdown-list{flex:1;overflow-y:scroll;overflow-x:hidden;scrollbar-color:#73737366 transparent;scrollbar-gutter:stable;scrollbar-width:thin}.univer-dv-list-dropdown-selected-icon{width:16px;height:16px;font-size:16px;color:rgba(var(--blue-500));flex-shrink:0;flex-grow:0;margin-left:12px}.univer-dv-list-dropdown-item-container{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:4px 6px;border-radius:6px;margin-top:4px;cursor:pointer}.univer-dv-list-dropdown-item-container:hover{background-color:rgba(var(--grey-50))}.univer-dv-list-dropdown-item{padding:0 4px;font-size:12px;font-style:normal;font-weight:400;line-height:16px;border-radius:8px;height:16px;width:fit-content;flex:0 1 auto;text-overflow:ellipsis;overflow:hidden;color:rgba(var(--color-black));white-space:nowrap}.univer-dv-list-dropdown-split{height:1px;margin:4px 0;background:rgba(var(--grey-200));flex-shrink:0;flex-grow:0}.univer-dv-list-dropdown-edit{padding:3px 6px;margin-top:4px;font-size:12px;line-height:1.5;cursor:pointer;flex-shrink:0;flex-grow:0;border-radius:6px}.univer-dv-list-dropdown-edit:hover{background:#f5f5f5}.univer-dv-date-dropdown{background:#fff;border-radius:var(--border-radius-base);box-shadow:var(--box-shadow-lg);padding:var(--padding-sm)}.univer-data-validation-formula{width:100%}.univer-data-validation-formula-and{margin-top:-4px;font-size:var(--font-size-sm);color:rgba(var(--grey-400))}.univer-data-validation-formula-list-item{display:flex;padding-bottom:2px;align-items:center}.univer-data-validation-formula-list-item-icon{font-size:16px;cursor:pointer;margin-left:4px;border-radius:4px}.univer-data-validation-formula-list-item-icon:hover{background:rgba(var(--grey-100))}.univer-data-validation-formula-list-item-drag{cursor:move}.univer-data-validation-formula-list-add{color:#274fee;font-size:13px;font-weight:400;cursor:pointer;display:flex;flex-direction:row;align-items:center;border-radius:4px;padding:4px 8px;width:fit-content}.univer-data-validation-formula-list-add svg{margin-right:4px}.univer-data-validation-formula-list-add:hover{background:#274fee0d}.univer-data-validation-formula-color-select{width:92px;margin-left:4px;margin-right:8px;height:31px}.univer-data-validation-formula-color-select-panel{width:112px;display:flex;flex-direction:row;justify-content:space-between;padding:12px 4px 4px 12px;flex-wrap:wrap;box-sizing:border-box}.univer-data-validation-formula-color-select-panel .univer-data-validation-formula-color-item{margin-bottom:8px;margin-right:8px;box-sizing:border-box;cursor:pointer}.univer-data-validation-formula-color-item{border-radius:3px;border:1px solid rgba(var(--grey-400));width:16px;height:16px;box-sizing:border-box;font-size:16px;margin-top:2px}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RangeMutation } from '../../models/rule-matrix';
|
|
2
|
+
import { ICommand, IMutationInfo, IRange, ISheetDataValidationRule } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export interface IUpdateSheetDataValidationRangeCommandParams {
|
|
5
|
+
unitId: string;
|
|
6
|
+
subUnitId: string;
|
|
7
|
+
ruleId: string;
|
|
8
|
+
ranges: IRange[];
|
|
9
|
+
}
|
|
10
|
+
export declare function getDataValidationDiffMutations(unitId: string, subUnitId: string, diffs: RangeMutation[]): {
|
|
11
|
+
redoMutations: IMutationInfo<object>[];
|
|
12
|
+
undoMutations: IMutationInfo<object>[];
|
|
13
|
+
};
|
|
14
|
+
export declare const UpdateSheetDataValidationRangeCommand: ICommand<IUpdateSheetDataValidationRangeCommandParams>;
|
|
15
|
+
export interface IAddSheetDataValidationCommandParams {
|
|
16
|
+
unitId: string;
|
|
17
|
+
subUnitId: string;
|
|
18
|
+
rule: ISheetDataValidationRule;
|
|
19
|
+
}
|
|
20
|
+
export declare const AddSheetDataValidationCommand: ICommand<IAddSheetDataValidationCommandParams>;
|
|
21
|
+
export declare const AddSheetDataValidationAndOpenCommand: ICommand;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IMutation } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export interface IDataValidationFormulaMarkDirtyParams {
|
|
4
|
+
[unitId: string]: {
|
|
5
|
+
[sunUnitId: string]: {
|
|
6
|
+
[formulaId: string]: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare const DataValidationFormulaMarkDirty: IMutation<IDataValidationFormulaMarkDirtyParams>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare const DATA_VALIDATION_PANEL = "DataValidationPanel";
|
|
4
|
+
export interface IOpenValidationPanelOperationParams {
|
|
5
|
+
ruleId?: string;
|
|
6
|
+
isAdd?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const OpenValidationPanelOperation: ICommand<IOpenValidationPanelOperationParams>;
|
|
9
|
+
export declare const CloseValidationPanelOperation: ICommand;
|
|
10
|
+
export declare const ToggleValidationPanelOperation: ICommand;
|
|
11
|
+
export interface IShowDataValidationDropdownParams {
|
|
12
|
+
unitId: string;
|
|
13
|
+
subUnitId: string;
|
|
14
|
+
row: number;
|
|
15
|
+
column: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const ShowDataValidationDropdown: ICommand<IShowDataValidationDropdownParams>;
|
|
18
|
+
export declare const HideDataValidationDropdown: ICommand;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DATA_VALIDATION_PLUGIN_NAME = "SHEET_DATA_VALIDATION";
|
|
17
|
+
export declare const DROP_DOWN_DEFAULT_COLOR = "#ECECEC";
|
|
18
|
+
export declare const DROP_DOWN_COLORS: never[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataValidationOperator } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare const DateOperatorNameMap: Record<DataValidationOperator, string>;
|
|
4
|
+
export declare const DateOperatorTextMap: Record<DataValidationOperator, string>;
|
|
5
|
+
export declare const DateOperatorTitleMap: Record<DataValidationOperator, string>;
|
|
6
|
+
export declare const DateOperatorErrorTitleMap: Record<DataValidationOperator, string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SheetDataValidationService } from '../services/dv.service';
|
|
2
|
+
import { CellAlertManagerService, HoverManagerService } from '@univerjs/sheets-ui';
|
|
3
|
+
import { Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export declare class DataValidationAlertController extends Disposable {
|
|
6
|
+
private readonly _hoverManagerService;
|
|
7
|
+
private readonly _cellAlertManagerService;
|
|
8
|
+
private readonly _univerInstanceService;
|
|
9
|
+
private readonly _sheetDataValidationService;
|
|
10
|
+
private readonly _localeService;
|
|
11
|
+
constructor(_hoverManagerService: HoverManagerService, _cellAlertManagerService: CellAlertManagerService, _univerInstanceService: IUniverInstanceService, _sheetDataValidationService: SheetDataValidationService, _localeService: LocaleService);
|
|
12
|
+
private _init;
|
|
13
|
+
private _initCellAlertPopup;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataValidationModel } from '@univerjs/data-validation';
|
|
2
|
+
import { IAutoFillService } from '@univerjs/sheets-ui';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export declare class DataValidationAutoFillController extends Disposable {
|
|
6
|
+
private readonly _autoFillService;
|
|
7
|
+
private readonly _dataValidationModel;
|
|
8
|
+
constructor(_autoFillService: IAutoFillService, _dataValidationModel: DataValidationModel);
|
|
9
|
+
private _initAutoFill;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DataValidationModel } from '@univerjs/data-validation';
|
|
2
|
+
import { ISheetClipboardService } from '@univerjs/sheets-ui';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export declare class DataValidationCopyPasteController extends Disposable {
|
|
6
|
+
private _sheetClipboardService;
|
|
7
|
+
private _dataValidationModel;
|
|
8
|
+
private _copyInfo;
|
|
9
|
+
constructor(_sheetClipboardService: ISheetClipboardService, _dataValidationModel: DataValidationModel);
|
|
10
|
+
private _initCopyPaste;
|
|
11
|
+
private _collect;
|
|
12
|
+
private _generateMutations;
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DataValidationCacheService } from '../services/dv-cache.service';
|
|
2
|
+
import { DataValidationFormulaService } from '../services/dv-formula.service';
|
|
3
|
+
import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
|
|
4
|
+
import { FormulaRefRangeService } from '@univerjs/sheets-formula';
|
|
5
|
+
import { DataValidationModel } from '@univerjs/data-validation';
|
|
6
|
+
import { Injector } from '@wendellhu/redi';
|
|
7
|
+
import { RefRangeService } from '@univerjs/sheets';
|
|
8
|
+
import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
9
|
+
import { ISheetDataValidationRule, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
10
|
+
|
|
11
|
+
export declare class DataValidationRefRangeController extends Disposable {
|
|
12
|
+
private _dataValidationModel;
|
|
13
|
+
private _univerInstanceService;
|
|
14
|
+
private _injector;
|
|
15
|
+
private _sheetSkeletonManagerService;
|
|
16
|
+
private _refRangeService;
|
|
17
|
+
private _dataValidationCustomFormulaService;
|
|
18
|
+
private _dataValidationFormulaService;
|
|
19
|
+
private _formulaRefRangeService;
|
|
20
|
+
private readonly _commandService;
|
|
21
|
+
private readonly _dataValidationCacheService;
|
|
22
|
+
private _disposableMap;
|
|
23
|
+
constructor(_dataValidationModel: DataValidationModel, _univerInstanceService: IUniverInstanceService, _injector: Injector, _sheetSkeletonManagerService: SheetSkeletonManagerService, _refRangeService: RefRangeService, _dataValidationCustomFormulaService: DataValidationCustomFormulaService, _dataValidationFormulaService: DataValidationFormulaService, _formulaRefRangeService: FormulaRefRangeService, _commandService: ICommandService, _dataValidationCacheService: DataValidationCacheService);
|
|
24
|
+
private _getIdWithUnitId;
|
|
25
|
+
registerFormula(unitId: string, subUnitId: string, rule: ISheetDataValidationRule): void;
|
|
26
|
+
register(unitId: string, subUnitId: string, rule: ISheetDataValidationRule): void;
|
|
27
|
+
registerRange(propUnitId: string, propSubUnitId: string, rule: ISheetDataValidationRule): void;
|
|
28
|
+
private _initRefRange;
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IDialogService } from '@univerjs/ui';
|
|
2
|
+
import { IEditorBridgeService } from '@univerjs/sheets-ui';
|
|
3
|
+
import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
|
|
4
|
+
import { Disposable, LocaleService } from '@univerjs/core';
|
|
5
|
+
|
|
6
|
+
export declare class DataValidationRejectInputController extends Disposable {
|
|
7
|
+
private readonly _editorBridgeService;
|
|
8
|
+
private readonly _dataValidationModel;
|
|
9
|
+
private readonly _dataValidatorRegistryService;
|
|
10
|
+
private readonly _dialogService;
|
|
11
|
+
private readonly _localeService;
|
|
12
|
+
constructor(_editorBridgeService: IEditorBridgeService, _dataValidationModel: DataValidationModel, _dataValidatorRegistryService: DataValidatorRegistryService, _dialogService: IDialogService, _localeService: LocaleService);
|
|
13
|
+
private _initEditorBridgeInterceptor;
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DataValidationDropdownManagerService } from '../services/dropdown-manager.service';
|
|
2
|
+
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
|
+
import { IEditorBridgeService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
5
|
+
import { Injector } from '@wendellhu/redi';
|
|
6
|
+
import { ComponentManager, IMenuService } from '@univerjs/ui';
|
|
7
|
+
import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
|
|
8
|
+
import { IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
9
|
+
|
|
10
|
+
export declare class DataValidationRenderController extends RxDisposable {
|
|
11
|
+
private _componentManager;
|
|
12
|
+
private _menuService;
|
|
13
|
+
private readonly _dataValidationModel;
|
|
14
|
+
private readonly _sheetSkeletonManagerService;
|
|
15
|
+
private readonly _renderManagerService;
|
|
16
|
+
private readonly _univerInstanceService;
|
|
17
|
+
private readonly _dataValidatorRegistryService;
|
|
18
|
+
private readonly _editorBridgeService;
|
|
19
|
+
private readonly _dropdownManagerService;
|
|
20
|
+
private readonly _sheetInterceptorService;
|
|
21
|
+
private readonly _injector;
|
|
22
|
+
constructor(_componentManager: ComponentManager, _menuService: IMenuService, _dataValidationModel: DataValidationModel, _sheetSkeletonManagerService: SheetSkeletonManagerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _dataValidatorRegistryService: DataValidatorRegistryService, _editorBridgeService: IEditorBridgeService, _dropdownManagerService: DataValidationDropdownManagerService, _sheetInterceptorService: SheetInterceptorService, _injector: Injector);
|
|
23
|
+
private _init;
|
|
24
|
+
private _initMenu;
|
|
25
|
+
private _initComponents;
|
|
26
|
+
private _initDropdown;
|
|
27
|
+
private _initSkeletonChange;
|
|
28
|
+
private _initViewModelIntercept;
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
|
+
import { DataValidationModel } from '@univerjs/data-validation';
|
|
3
|
+
import { Disposable, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
|
|
4
|
+
|
|
5
|
+
export declare class DataValidationResourceController extends Disposable {
|
|
6
|
+
private readonly _resourceManagerService;
|
|
7
|
+
private readonly _univerInstanceService;
|
|
8
|
+
private readonly _dataValidationModel;
|
|
9
|
+
private readonly _injector;
|
|
10
|
+
constructor(_resourceManagerService: IResourceManagerService, _univerInstanceService: IUniverInstanceService, _dataValidationModel: DataValidationModel, _injector: Injector);
|
|
11
|
+
private _createSheetDataValidationManager;
|
|
12
|
+
private _initDataValidationDataSource;
|
|
13
|
+
private _initSnapshot;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
|
+
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
+
import { DataValidationModel } from '@univerjs/data-validation';
|
|
4
|
+
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
5
|
+
|
|
6
|
+
export declare class DataValidationSheetController extends Disposable {
|
|
7
|
+
private _sheetInterceptorService;
|
|
8
|
+
private _univerInstanceService;
|
|
9
|
+
private readonly _dataValidationModel;
|
|
10
|
+
private _injector;
|
|
11
|
+
constructor(_sheetInterceptorService: SheetInterceptorService, _univerInstanceService: IUniverInstanceService, _dataValidationModel: DataValidationModel, _injector: Injector);
|
|
12
|
+
private _initSheetChange;
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SheetDataValidationService } from '../services/dv.service';
|
|
2
|
+
import { SelectionManagerService, SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
+
import { ComponentManager } from '@univerjs/ui';
|
|
4
|
+
import { Injector } from '@wendellhu/redi';
|
|
5
|
+
import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
|
|
6
|
+
import { IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
7
|
+
|
|
8
|
+
export declare class DataValidationController extends RxDisposable {
|
|
9
|
+
private readonly _univerInstanceService;
|
|
10
|
+
private readonly _sheetDataValidationService;
|
|
11
|
+
private readonly _dataValidatorRegistryService;
|
|
12
|
+
private readonly _injector;
|
|
13
|
+
private readonly _componentManger;
|
|
14
|
+
private _selectionManagerService;
|
|
15
|
+
private readonly _sheetInterceptorService;
|
|
16
|
+
private readonly _dataValidationModel;
|
|
17
|
+
constructor(_univerInstanceService: IUniverInstanceService, _sheetDataValidationService: SheetDataValidationService, _dataValidatorRegistryService: DataValidatorRegistryService, _injector: Injector, _componentManger: ComponentManager, _selectionManagerService: SelectionManagerService, _sheetInterceptorService: SheetInterceptorService, _dataValidationModel: DataValidationModel);
|
|
18
|
+
private _init;
|
|
19
|
+
private _registerValidators;
|
|
20
|
+
private _initInstanceChange;
|
|
21
|
+
private _initCommandInterceptor;
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IAccessor } from '@wendellhu/redi';
|
|
2
|
+
import { IMenuItem } from '@univerjs/ui';
|
|
3
|
+
|
|
4
|
+
export declare const DataValidationIcon = "data-validation-single";
|
|
5
|
+
export declare function dataValidationMenuFactory(accessor: IAccessor): IMenuItem;
|
|
6
|
+
export declare function openDataValidationMenuFactory(_accessor: IAccessor): IMenuItem;
|
|
7
|
+
export declare function addDataValidationMenuFactory(_accessor: IAccessor): IMenuItem;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { UniverSheetsDataValidationPlugin } from './plugin';
|
|
17
|
+
export type { IAddSheetDataValidationCommandParams, IUpdateSheetDataValidationRangeCommandParams } from './commands/commands/data-validation.command';
|
|
18
|
+
export { ICommandService, LocaleService, Plugin } from '@univerjs/core';
|
|
19
|
+
export { DataValidationRenderController } from './controllers/dv-render.controller';
|
|
20
|
+
export { DataValidationController } from './controllers/dv.controller';
|
|
21
|
+
export { SheetDataValidationService } from './services/dv.service';
|
|
22
|
+
export { DataValidationAlertController } from './controllers/dv-alert.controller';
|
|
23
|
+
export { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, UpdateSheetDataValidationRangeCommand } from './commands/commands/data-validation.command';
|
|
24
|
+
export { DataValidationCacheService } from './services/dv-cache.service';
|
|
25
|
+
export { DataValidationFormulaService } from './services/dv-formula.service';
|
|
26
|
+
export { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
|
|
27
|
+
export { RegisterOtherFormulaService } from './services/register-formula.service';
|
|
28
|
+
export { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
|
|
29
|
+
export { DataValidationFormulaMarkDirty } from './commands/mutations/formula.mutation';
|
|
30
|
+
export { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
|
|
31
|
+
export { DataValidationAutoFillController } from './controllers/dv-auto-fill.controller';
|
|
32
|
+
export { DataValidationSheetController } from './controllers/dv-sheet.controller';
|
|
33
|
+
export { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
|
|
34
|
+
export { DataValidationResourceController } from './controllers/dv-resource.controller';
|
|
35
|
+
export { HideDataValidationDropdown, ShowDataValidationDropdown } from './commands/operations/data-validation.operation';
|
|
36
|
+
export { DataValidationRejectInputController } from './controllers/dv-reject-input.controller';
|
|
37
|
+
export { enUS, zhCN } from './locale';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { default as enUS } from './en-US';
|
|
17
|
+
export { default as zhCN } from './zh-CN';
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
declare const locale: {
|
|
17
|
+
dataValidation: {
|
|
18
|
+
title: string;
|
|
19
|
+
validFail: {
|
|
20
|
+
common: string;
|
|
21
|
+
number: string;
|
|
22
|
+
formula: string;
|
|
23
|
+
integer: string;
|
|
24
|
+
date: string;
|
|
25
|
+
list: string;
|
|
26
|
+
};
|
|
27
|
+
panel: {
|
|
28
|
+
title: string;
|
|
29
|
+
addTitle: string;
|
|
30
|
+
removeAll: string;
|
|
31
|
+
add: string;
|
|
32
|
+
range: string;
|
|
33
|
+
type: string;
|
|
34
|
+
options: string;
|
|
35
|
+
operator: string;
|
|
36
|
+
removeRule: string;
|
|
37
|
+
done: string;
|
|
38
|
+
formulaPlaceholder: string;
|
|
39
|
+
formulaAnd: string;
|
|
40
|
+
invalid: string;
|
|
41
|
+
showWarning: string;
|
|
42
|
+
rejectInput: string;
|
|
43
|
+
messageInfo: string;
|
|
44
|
+
showInfo: string;
|
|
45
|
+
};
|
|
46
|
+
operators: {
|
|
47
|
+
between: string;
|
|
48
|
+
greaterThan: string;
|
|
49
|
+
greaterThanOrEqual: string;
|
|
50
|
+
lessThan: string;
|
|
51
|
+
lessThanOrEqual: string;
|
|
52
|
+
equal: string;
|
|
53
|
+
notEqual: string;
|
|
54
|
+
notBetween: string;
|
|
55
|
+
};
|
|
56
|
+
ruleName: {
|
|
57
|
+
between: string;
|
|
58
|
+
greaterThan: string;
|
|
59
|
+
greaterThanOrEqual: string;
|
|
60
|
+
lessThan: string;
|
|
61
|
+
lessThanOrEqual: string;
|
|
62
|
+
equal: string;
|
|
63
|
+
notEqual: string;
|
|
64
|
+
notBetween: string;
|
|
65
|
+
};
|
|
66
|
+
errorMsg: {
|
|
67
|
+
between: string;
|
|
68
|
+
greaterThan: string;
|
|
69
|
+
greaterThanOrEqual: string;
|
|
70
|
+
lessThan: string;
|
|
71
|
+
lessThanOrEqual: string;
|
|
72
|
+
equal: string;
|
|
73
|
+
notEqual: string;
|
|
74
|
+
notBetween: string;
|
|
75
|
+
};
|
|
76
|
+
date: {
|
|
77
|
+
title: string;
|
|
78
|
+
operators: {
|
|
79
|
+
between: string;
|
|
80
|
+
greaterThan: string;
|
|
81
|
+
greaterThanOrEqual: string;
|
|
82
|
+
lessThan: string;
|
|
83
|
+
lessThanOrEqual: string;
|
|
84
|
+
equal: string;
|
|
85
|
+
notEqual: string;
|
|
86
|
+
notBetween: string;
|
|
87
|
+
};
|
|
88
|
+
ruleName: {
|
|
89
|
+
between: string;
|
|
90
|
+
greaterThan: string;
|
|
91
|
+
greaterThanOrEqual: string;
|
|
92
|
+
lessThan: string;
|
|
93
|
+
lessThanOrEqual: string;
|
|
94
|
+
equal: string;
|
|
95
|
+
notEqual: string;
|
|
96
|
+
notBetween: string;
|
|
97
|
+
};
|
|
98
|
+
errorMsg: {
|
|
99
|
+
between: string;
|
|
100
|
+
greaterThan: string;
|
|
101
|
+
greaterThanOrEqual: string;
|
|
102
|
+
lessThan: string;
|
|
103
|
+
lessThanOrEqual: string;
|
|
104
|
+
equal: string;
|
|
105
|
+
notEqual: string;
|
|
106
|
+
notBetween: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
list: {
|
|
110
|
+
title: string;
|
|
111
|
+
name: string;
|
|
112
|
+
error: string;
|
|
113
|
+
emptyError: string;
|
|
114
|
+
add: string;
|
|
115
|
+
dropdown: string;
|
|
116
|
+
options: string;
|
|
117
|
+
customOptions: string;
|
|
118
|
+
refOptions: string;
|
|
119
|
+
};
|
|
120
|
+
listMultiple: {
|
|
121
|
+
title: string;
|
|
122
|
+
dropdown: string;
|
|
123
|
+
};
|
|
124
|
+
textLength: {
|
|
125
|
+
title: string;
|
|
126
|
+
};
|
|
127
|
+
decimal: {
|
|
128
|
+
title: string;
|
|
129
|
+
};
|
|
130
|
+
whole: {
|
|
131
|
+
title: string;
|
|
132
|
+
};
|
|
133
|
+
checkbox: {
|
|
134
|
+
title: string;
|
|
135
|
+
error: string;
|
|
136
|
+
tips: string;
|
|
137
|
+
checked: string;
|
|
138
|
+
unchecked: string;
|
|
139
|
+
};
|
|
140
|
+
custom: {
|
|
141
|
+
title: string;
|
|
142
|
+
error: string;
|
|
143
|
+
validFail: string;
|
|
144
|
+
};
|
|
145
|
+
alert: {
|
|
146
|
+
title: string;
|
|
147
|
+
ok: string;
|
|
148
|
+
};
|
|
149
|
+
error: {
|
|
150
|
+
title: string;
|
|
151
|
+
};
|
|
152
|
+
renderMode: {
|
|
153
|
+
arrow: string;
|
|
154
|
+
chip: string;
|
|
155
|
+
text: string;
|
|
156
|
+
label: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export default locale;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IRange, ISheetDataValidationRule, ObjectMatrix } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export type RangeMutation = {
|
|
4
|
+
type: 'update';
|
|
5
|
+
ruleId: string;
|
|
6
|
+
oldRanges: IRange[];
|
|
7
|
+
newRanges: IRange[];
|
|
8
|
+
} | {
|
|
9
|
+
type: 'delete';
|
|
10
|
+
rule: ISheetDataValidationRule;
|
|
11
|
+
index: number;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'add';
|
|
14
|
+
rule: ISheetDataValidationRule;
|
|
15
|
+
};
|
|
16
|
+
export declare class RuleMatrix {
|
|
17
|
+
readonly value: ObjectMatrix<string>;
|
|
18
|
+
constructor(value: ObjectMatrix<string>);
|
|
19
|
+
addRule(rule: ISheetDataValidationRule): void;
|
|
20
|
+
removeRange(ranges: IRange[]): void;
|
|
21
|
+
removeRule(rule: ISheetDataValidationRule): void;
|
|
22
|
+
updateRange(ruleId: string, oldRanges: IRange[], newRanges: IRange[]): void;
|
|
23
|
+
diff(rules: ISheetDataValidationRule[]): RangeMutation[];
|
|
24
|
+
diffWithAddition(rules: ISheetDataValidationRule[], additionRules: IterableIterator<ISheetDataValidationRule>): RangeMutation[];
|
|
25
|
+
clone(): RuleMatrix;
|
|
26
|
+
getValue(row: number, col: number): string;
|
|
27
|
+
setValue(row: number, col: number, value: string): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RuleMatrix } from './rule-matrix';
|
|
2
|
+
import { Injector } from '@wendellhu/redi';
|
|
3
|
+
import { ISheetLocation } from '@univerjs/sheets';
|
|
4
|
+
import { DataValidationManager, IUpdateRulePayload } from '@univerjs/data-validation';
|
|
5
|
+
import { CellValue, ISheetDataValidationRule, Nullable, DataValidationStatus } from '@univerjs/core';
|
|
6
|
+
|
|
7
|
+
export declare class SheetDataValidationManager extends DataValidationManager<ISheetDataValidationRule> {
|
|
8
|
+
private readonly _injector;
|
|
9
|
+
/**
|
|
10
|
+
* save cell's ruleId
|
|
11
|
+
*/
|
|
12
|
+
private _ruleMatrix;
|
|
13
|
+
private _dataValidatorRegistryService;
|
|
14
|
+
private _dataValidationCacheService;
|
|
15
|
+
private _dataValidationFormulaService;
|
|
16
|
+
private _dataValidationCustomFormulaService;
|
|
17
|
+
private _cache;
|
|
18
|
+
private _dataValidationRefRangeController;
|
|
19
|
+
constructor(unitId: string, subUnitId: string, rules: ISheetDataValidationRule[] | undefined, _injector: Injector);
|
|
20
|
+
addRule(rule: ISheetDataValidationRule, index?: number): void;
|
|
21
|
+
updateRule(ruleId: string, payload: IUpdateRulePayload): ISheetDataValidationRule;
|
|
22
|
+
removeRule(ruleId: string): void;
|
|
23
|
+
getRuleIdByLocation(row: number, col: number): string | undefined;
|
|
24
|
+
getRuleByLocation(row: number, col: number): ISheetDataValidationRule | undefined;
|
|
25
|
+
validator(cellValue: Nullable<CellValue>, rule: ISheetDataValidationRule, pos: ISheetLocation, onCompete: (status: DataValidationStatus) => void): DataValidationStatus;
|
|
26
|
+
getRuleErrorMsg(ruleId: string): string;
|
|
27
|
+
getRuleObjectMatrix(): RuleMatrix;
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
|
+
import { ICommandService, LocaleService, Plugin } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
export declare class UniverSheetsDataValidationPlugin extends Plugin {
|
|
5
|
+
protected _injector: Injector;
|
|
6
|
+
private readonly _commandService;
|
|
7
|
+
private readonly _localeService;
|
|
8
|
+
constructor(_injector: Injector, _commandService: ICommandService, _localeService: LocaleService);
|
|
9
|
+
onStarting(injector: Injector): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IDataValidationRule, Nullable, Disposable } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare class DataValidationPanelService extends Disposable {
|
|
4
|
+
private _open$;
|
|
5
|
+
private _activeRule;
|
|
6
|
+
private _activeRule$;
|
|
7
|
+
open$: import('rxjs').Observable<boolean>;
|
|
8
|
+
activeRule$: import('rxjs').Observable<Nullable<{
|
|
9
|
+
unitId: string;
|
|
10
|
+
subUnitId: string;
|
|
11
|
+
rule: IDataValidationRule;
|
|
12
|
+
}>>;
|
|
13
|
+
get activeRule(): Nullable<{
|
|
14
|
+
unitId: string;
|
|
15
|
+
subUnitId: string;
|
|
16
|
+
rule: IDataValidationRule;
|
|
17
|
+
}>;
|
|
18
|
+
get isOpen(): boolean;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
open(): void;
|
|
21
|
+
close(): void;
|
|
22
|
+
setActiveRule(rule: Nullable<{
|
|
23
|
+
unitId: string;
|
|
24
|
+
subUnitId: string;
|
|
25
|
+
rule: IDataValidationRule;
|
|
26
|
+
}>): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
2
|
+
import { IZenZoneService } from '@univerjs/ui';
|
|
3
|
+
import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
|
|
4
|
+
import { SheetCanvasPopManagerService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
5
|
+
import { ISheetLocation } from '@univerjs/sheets';
|
|
6
|
+
import { Disposable, IUniverInstanceService, Nullable } from '@univerjs/core';
|
|
7
|
+
|
|
8
|
+
export interface IDropdownParam {
|
|
9
|
+
location: ISheetLocation;
|
|
10
|
+
onHide?: () => void;
|
|
11
|
+
componentKey: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IDropdownComponentProps {
|
|
14
|
+
componentKey: string;
|
|
15
|
+
location: ISheetLocation;
|
|
16
|
+
hideFn: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class DataValidationDropdownManagerService extends Disposable {
|
|
19
|
+
private readonly _canvasPopupManagerService;
|
|
20
|
+
private readonly _univerInstanceService;
|
|
21
|
+
private readonly _sheetSkeletonManagerService;
|
|
22
|
+
private readonly _dataValidatorRegistryService;
|
|
23
|
+
private readonly _zenZoneService;
|
|
24
|
+
private readonly _renderManagerService;
|
|
25
|
+
private readonly _dataValidationModel;
|
|
26
|
+
private _activeDropdown;
|
|
27
|
+
private _activeDropdown$;
|
|
28
|
+
private _currentPopup;
|
|
29
|
+
activeDropdown$: import('rxjs').Observable<Nullable<IDropdownParam>>;
|
|
30
|
+
private _zenVisible;
|
|
31
|
+
get activeDropdown(): Nullable<IDropdownParam>;
|
|
32
|
+
constructor(_canvasPopupManagerService: SheetCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _dataValidatorRegistryService: DataValidatorRegistryService, _zenZoneService: IZenZoneService, _renderManagerService: IRenderManagerService, _dataValidationModel: DataValidationModel);
|
|
33
|
+
private _init;
|
|
34
|
+
showDropdown(param: IDropdownParam): void;
|
|
35
|
+
hideDropdown(): void;
|
|
36
|
+
showDataValidationDropdown(unitId: string, subUnitId: string, row: number, col: number, onHide?: () => void): void;
|
|
37
|
+
}
|