@univerjs/sheets-data-validation 0.3.0-alpha.0 → 0.3.0-nightly.202410101606

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.
Files changed (69) hide show
  1. package/README.md +2 -2
  2. package/lib/cjs/index.js +1 -9
  3. package/lib/es/index.js +1 -5568
  4. package/lib/types/commands/commands/data-validation.command.d.ts +0 -1
  5. package/lib/types/common/const.d.ts +0 -1
  6. package/lib/types/controllers/dv-ref-range.controller.d.ts +1 -1
  7. package/lib/types/controllers/dv.controller.d.ts +1 -4
  8. package/lib/types/index.d.ts +10 -4
  9. package/lib/types/plugin.d.ts +4 -5
  10. package/lib/types/utils/create.d.ts +1 -1
  11. package/lib/types/validators/checkbox-validator.d.ts +2 -5
  12. package/lib/types/validators/custom-validator.d.ts +0 -1
  13. package/lib/types/validators/date-validator.d.ts +2 -5
  14. package/lib/types/validators/decimal-validator.d.ts +1 -3
  15. package/lib/types/validators/list-multiple-validator.d.ts +0 -2
  16. package/lib/types/validators/list-validator.d.ts +2 -6
  17. package/lib/types/validators/text-length-validator.d.ts +1 -2
  18. package/lib/types/validators/whole-validator.d.ts +1 -3
  19. package/lib/umd/index.js +1 -9
  20. package/package.json +20 -33
  21. package/LICENSE +0 -176
  22. package/lib/index.css +0 -1
  23. package/lib/locale/en-US.json +0 -167
  24. package/lib/locale/ru-RU.json +0 -167
  25. package/lib/locale/vi-VN.json +0 -167
  26. package/lib/locale/zh-CN.json +0 -167
  27. package/lib/locale/zh-TW.json +0 -167
  28. package/lib/types/commands/operations/data-validation.operation.d.ts +0 -17
  29. package/lib/types/controllers/config.schema.d.ts +0 -8
  30. package/lib/types/controllers/dv-alert.controller.d.ts +0 -14
  31. package/lib/types/controllers/dv-auto-fill.controller.d.ts +0 -10
  32. package/lib/types/controllers/dv-copy-paste.controller.d.ts +0 -13
  33. package/lib/types/controllers/dv-permission.controller.d.ts +0 -9
  34. package/lib/types/controllers/dv-reject-input.controller.d.ts +0 -15
  35. package/lib/types/controllers/dv-render.controller.d.ts +0 -39
  36. package/lib/types/controllers/dv.menu.d.ts +0 -7
  37. package/lib/types/controllers/menu.schema.d.ts +0 -2
  38. package/lib/types/locale/en-US.d.ts +0 -3
  39. package/lib/types/locale/ru-RU.d.ts +0 -3
  40. package/lib/types/locale/vi-VN.d.ts +0 -3
  41. package/lib/types/locale/zh-CN.d.ts +0 -183
  42. package/lib/types/locale/zh-TW.d.ts +0 -3
  43. package/lib/types/mobile-plugin.d.ts +0 -12
  44. package/lib/types/services/data-validation-panel.service.d.ts +0 -32
  45. package/lib/types/services/dropdown-manager.service.d.ts +0 -40
  46. package/lib/types/views/date-dropdown/index.d.ts +0 -3
  47. package/lib/types/views/detail/index.d.ts +0 -2
  48. package/lib/types/views/drop-down/CellDropdown.d.ts +0 -2
  49. package/lib/types/views/drop-down/index.d.ts +0 -18
  50. package/lib/types/views/formula-input/base-formula-input.d.ts +0 -3
  51. package/lib/types/views/formula-input/checkbox-formula-input.d.ts +0 -3
  52. package/lib/types/views/formula-input/custom-formula-input.d.ts +0 -3
  53. package/lib/types/views/formula-input/formula-input.d.ts +0 -4
  54. package/lib/types/views/formula-input/index.d.ts +0 -6
  55. package/lib/types/views/formula-input/list-formula-input.d.ts +0 -3
  56. package/lib/types/views/index.d.ts +0 -20
  57. package/lib/types/views/item/index.d.ts +0 -10
  58. package/lib/types/views/list/index.d.ts +0 -2
  59. package/lib/types/views/list-dropdown/index.d.ts +0 -3
  60. package/lib/types/views/options/index.d.ts +0 -8
  61. package/lib/types/views/panel/index.d.ts +0 -2
  62. package/lib/types/views/render-mode/index.d.ts +0 -10
  63. package/lib/types/views/show-time/index.d.ts +0 -10
  64. package/lib/types/widgets/checkbox-widget.d.ts +0 -19
  65. package/lib/types/widgets/dropdown-multiple-widget.d.ts +0 -19
  66. package/lib/types/widgets/dropdown-widget.d.ts +0 -28
  67. package/lib/types/widgets/shape/dropdown.d.ts +0 -12
  68. package/lib/types/widgets/shape/index.d.ts +0 -18
  69. package/lib/types/widgets/shape/layout.d.ts +0 -37
@@ -19,7 +19,6 @@ export interface IAddSheetDataValidationCommandParams {
19
19
  rule: ISheetDataValidationRule;
20
20
  }
21
21
  export declare const AddSheetDataValidationCommand: ICommand<IAddSheetDataValidationCommandParams>;
22
- export declare const AddSheetDataValidationAndOpenCommand: ICommand;
23
22
  export interface IUpdateSheetDataValidationSettingCommandParams extends ISheetCommandSharedParams {
24
23
  ruleId: string;
25
24
  setting: IDataValidationRuleBase;
@@ -14,5 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare const DATA_VALIDATION_PLUGIN_NAME = "SHEET_DATA_VALIDATION_PLUGIN";
17
- export declare const DROP_DOWN_DEFAULT_COLOR = "#ECECEC";
18
17
  export declare const DROP_DOWN_COLORS: never[];
@@ -1,4 +1,4 @@
1
- import { Disposable, Injector, ISheetDataValidationRule } from '@univerjs/core';
1
+ import { ISheetDataValidationRule, Disposable, Injector } from '@univerjs/core';
2
2
  import { RefRangeService } from '@univerjs/sheets';
3
3
  import { FormulaRefRangeService } from '@univerjs/sheets-formula';
4
4
  import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
@@ -1,19 +1,16 @@
1
1
  import { Injector, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
2
  import { DataValidatorRegistryService } from '@univerjs/data-validation';
3
3
  import { SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
4
- import { ComponentManager } from '@univerjs/ui';
5
4
  import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
6
5
  export declare class DataValidationController extends RxDisposable {
7
6
  private readonly _univerInstanceService;
8
7
  private readonly _dataValidatorRegistryService;
9
8
  private readonly _injector;
10
- private readonly _componentManger;
11
9
  private _selectionManagerService;
12
10
  private readonly _sheetInterceptorService;
13
11
  private readonly _sheetDataValidationModel;
14
- constructor(_univerInstanceService: IUniverInstanceService, _dataValidatorRegistryService: DataValidatorRegistryService, _injector: Injector, _componentManger: ComponentManager, _selectionManagerService: SheetsSelectionsService, _sheetInterceptorService: SheetInterceptorService, _sheetDataValidationModel: SheetDataValidationModel);
12
+ constructor(_univerInstanceService: IUniverInstanceService, _dataValidatorRegistryService: DataValidatorRegistryService, _injector: Injector, _selectionManagerService: SheetsSelectionsService, _sheetInterceptorService: SheetInterceptorService, _sheetDataValidationModel: SheetDataValidationModel);
15
13
  private _init;
16
14
  private _registerValidators;
17
15
  private _initCommandInterceptor;
18
- private _initComponents;
19
16
  }
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
17
- export { UniverSheetsDataValidationMobilePlugin } from './mobile-plugin';
18
17
  export { SheetDataValidationModel } from './models/sheet-data-validation-model';
19
18
  export { UniverSheetsDataValidationPlugin } from './plugin';
20
19
  export { DataValidationCacheService } from './services/dv-cache.service';
@@ -22,7 +21,14 @@ export type { IDataValidationResCache } from './services/dv-cache.service';
22
21
  export { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
23
22
  export { DataValidationFormulaService } from './services/dv-formula.service';
24
23
  export { SheetsDataValidationValidatorService } from './services/dv-validator-service';
25
- export { DATE_DROPDOWN_KEY, LIST_DROPDOWN_KEY } from './views';
24
+ export { createDefaultNewRule } from './utils/create';
25
+ export { DataValidationFormulaController } from './controllers/dv-formula.controller';
26
+ export { getFormulaCellData, getFormulaResult } from './utils/formula';
27
+ export { getCellValueOrigin } from './utils/get-cell-data-origin';
28
+ export { ListValidator } from './validators/list-validator';
29
+ export { DateValidator } from './validators/date-validator';
30
+ export { CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, CheckboxValidator, transformCheckboxValue } from './validators/checkbox-validator';
31
+ export { ListMultipleValidator } from './validators/list-multiple-validator';
32
+ export { deserializeListOptions, getDataValidationCellValue, serializeListOptions } from './validators/util';
26
33
  export { DataValidationModel } from '@univerjs/data-validation';
27
- export { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, ClearRangeDataValidationCommand, type IAddSheetDataValidationCommandParams, type IClearRangeDataValidationCommandParams, type IRemoveSheetAllDataValidationCommandParams, type IRemoveSheetDataValidationCommandParams, type IUpdateSheetDataValidationOptionsCommandParams, type IUpdateSheetDataValidationRangeCommandParams, type IUpdateSheetDataValidationSettingCommandParams, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, } from './commands/commands/data-validation.command';
28
- export { CloseValidationPanelOperation, HideDataValidationDropdown, OpenValidationPanelOperation, ShowDataValidationDropdown, ToggleValidationPanelOperation, } from './commands/operations/data-validation.operation';
34
+ export { AddSheetDataValidationCommand, ClearRangeDataValidationCommand, getDataValidationDiffMutations, type IAddSheetDataValidationCommandParams, type IClearRangeDataValidationCommandParams, type IRemoveSheetAllDataValidationCommandParams, type IRemoveSheetDataValidationCommandParams, type IUpdateSheetDataValidationOptionsCommandParams, type IUpdateSheetDataValidationRangeCommandParams, type IUpdateSheetDataValidationSettingCommandParams, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, } from './commands/commands/data-validation.command';
@@ -1,12 +1,11 @@
1
- import { ICommandService, IConfigService, Plugin, UniverInstanceType, Injector } from '@univerjs/core';
2
- import { IUniverSheetsDataValidationConfig } from './controllers/config.schema';
1
+ import { ICommandService, Plugin, UniverInstanceType, Injector } from '@univerjs/core';
3
2
  export declare class UniverSheetsDataValidationPlugin extends Plugin {
4
- private readonly _config;
5
3
  protected _injector: Injector;
6
4
  private readonly _commandService;
7
- private readonly _configService;
8
5
  static pluginName: string;
9
6
  static type: UniverInstanceType;
10
- constructor(_config: Partial<IUniverSheetsDataValidationConfig> | undefined, _injector: Injector, _commandService: ICommandService, _configService: IConfigService);
7
+ constructor(_config: undefined, _injector: Injector, _commandService: ICommandService);
11
8
  onStarting(): void;
9
+ onReady(): void;
10
+ onRendered(): void;
12
11
  }
@@ -1,4 +1,4 @@
1
- import { DataValidationOperator, DataValidationType, IAccessor } from '@univerjs/core';
1
+ import { IAccessor, DataValidationOperator, DataValidationType } from '@univerjs/core';
2
2
  export declare function createDefaultNewRule(accessor: IAccessor): {
3
3
  uid: string;
4
4
  type: DataValidationType;
@@ -1,6 +1,5 @@
1
- import { WrapStrategy, CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable } from '@univerjs/core';
2
- import { BaseDataValidator, IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
3
- import { CheckboxRender } from '../widgets/checkbox-widget';
1
+ import { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable, WrapStrategy } from '@univerjs/core';
2
+ import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
4
3
  export declare const CHECKBOX_FORMULA_1 = 1;
5
4
  export declare const CHECKBOX_FORMULA_2 = 0;
6
5
  interface ICheckboxFormulaResult extends IFormulaResult {
@@ -13,8 +12,6 @@ export declare class CheckboxValidator extends BaseDataValidator {
13
12
  title: string;
14
13
  operators: DataValidationOperator[];
15
14
  scopes: string | string[];
16
- formulaInput: string;
17
- canvasRender: CheckboxRender;
18
15
  private _formulaService;
19
16
  skipDefaultFontRender: (rule: ISheetDataValidationRule, cellValue: Nullable<CellValue>, pos: {
20
17
  unitId: string;
@@ -5,7 +5,6 @@ export declare class CustomFormulaValidator extends BaseDataValidator {
5
5
  title: string;
6
6
  operators: DataValidationOperator[];
7
7
  scopes: string | string[];
8
- formulaInput: string;
9
8
  private _customFormulaService;
10
9
  validatorFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): IFormulaValidResult;
11
10
  parseFormula(_rule: IDataValidationRule, _unitId: string, _subUnitId: string): Promise<IFormulaResult>;
@@ -1,13 +1,10 @@
1
- import { DataValidationOperator, CellValue, IDataValidationRule, IDataValidationRuleBase } from '@univerjs/core';
2
- import { BaseDataValidator, IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
1
+ import { CellValue, IDataValidationRule, IDataValidationRuleBase, DataValidationOperator } from '@univerjs/core';
2
+ import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
3
  export declare class DateValidator extends BaseDataValidator<number> {
4
4
  id: string;
5
5
  title: string;
6
6
  operators: DataValidationOperator[];
7
7
  scopes: string | string[];
8
- formulaInput: string;
9
- optionsInput: string;
10
- dropdown: string;
11
8
  private _formulaService;
12
9
  parseFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): Promise<IFormulaResult<number | undefined>>;
13
10
  parseFormulaSync(rule: IDataValidationRule, unitId: string, subUnitId: string): {
@@ -1,4 +1,4 @@
1
- import { DataValidationOperator, CellValue, IDataValidationRule, Nullable } from '@univerjs/core';
1
+ import { CellValue, IDataValidationRule, Nullable, DataValidationOperator } from '@univerjs/core';
2
2
  import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
3
  export declare function getCellValueNumber(cellValue: CellValue): number;
4
4
  export declare class DecimalValidator extends BaseDataValidator<number> {
@@ -7,8 +7,6 @@ export declare class DecimalValidator extends BaseDataValidator<number> {
7
7
  title: string;
8
8
  operators: DataValidationOperator[];
9
9
  scopes: string | string[];
10
- formulaInput: string;
11
- dropDownInput?: string;
12
10
  private _isFormulaOrNumber;
13
11
  isValidType(cellInfo: IValidatorCellInfo<CellValue>, formula: IFormulaResult, rule: IDataValidationRule): Promise<boolean>;
14
12
  transform(cellInfo: IValidatorCellInfo<CellValue>, formula: IFormulaResult, rule: IDataValidationRule): {
@@ -1,8 +1,6 @@
1
- import { DropdownMultipleWidget } from '../widgets/dropdown-multiple-widget';
2
1
  import { ListValidator } from './list-validator';
3
2
  export declare class ListMultipleValidator extends ListValidator {
4
3
  id: string;
5
4
  title: string;
6
- canvasRender: DropdownMultipleWidget;
7
5
  skipDefaultFontRender: () => boolean;
8
6
  }
@@ -1,6 +1,6 @@
1
- import { BaseDataValidator, IBaseDataValidationWidget, IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
2
- import { LexerTreeBuilder } from '@univerjs/engine-formula';
3
1
  import { CellValue, DataValidationOperator, ICellData, IDataValidationRule, ISheetDataValidationRule, IStyleData, Nullable } from '@univerjs/core';
2
+ import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
+ import { LexerTreeBuilder } from '@univerjs/engine-formula';
4
4
  import { DataValidationFormulaService } from '../services/dv-formula.service';
5
5
  export declare function getRuleFormulaResultSet(result: Nullable<Nullable<ICellData>[][]>): string[];
6
6
  export declare function isValidListFormula(formula: string, lexer: LexerTreeBuilder): boolean | undefined;
@@ -12,10 +12,6 @@ export declare class ListValidator extends BaseDataValidator {
12
12
  title: string;
13
13
  operators: DataValidationOperator[];
14
14
  scopes: string | string[];
15
- formulaInput: string;
16
- canvasRender: Nullable<IBaseDataValidationWidget>;
17
- dropdown: string | undefined;
18
- optionsInput: string | undefined;
19
15
  skipDefaultFontRender: (rule: ISheetDataValidationRule) => boolean;
20
16
  validatorFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): IFormulaValidResult;
21
17
  getExtraStyle(rule: IDataValidationRule, value: Nullable<CellValue>, { style: defaultStyle }: {
@@ -1,11 +1,10 @@
1
- import { DataValidationOperator, CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable } from '@univerjs/core';
1
+ import { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable, DataValidationOperator } from '@univerjs/core';
2
2
  import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
3
  export declare class TextLengthValidator extends BaseDataValidator<number> {
4
4
  id: string;
5
5
  title: string;
6
6
  operators: DataValidationOperator[];
7
7
  scopes: string | string[];
8
- formulaInput: string;
9
8
  private _formulaService;
10
9
  private _isFormulaOrInt;
11
10
  validatorFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): IFormulaValidResult;
@@ -1,4 +1,4 @@
1
- import { DataValidationOperator, CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable } from '@univerjs/core';
1
+ import { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable, DataValidationOperator } from '@univerjs/core';
2
2
  import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
3
  export declare class WholeValidator extends BaseDataValidator<number> {
4
4
  private _formulaService;
@@ -6,8 +6,6 @@ export declare class WholeValidator extends BaseDataValidator<number> {
6
6
  title: string;
7
7
  operators: DataValidationOperator[];
8
8
  scopes: string | string[];
9
- formulaInput: string;
10
- dropDownInput?: string;
11
9
  private _isFormulaOrInt;
12
10
  isValidType(cellInfo: IValidatorCellInfo<CellValue>, formula: IFormulaResult, rule: IDataValidationRule): Promise<boolean>;
13
11
  transform(cellInfo: IValidatorCellInfo<CellValue>, formula: IFormulaResult, rule: IDataValidationRule): {