@univerjs/sheets-data-validation 0.2.7 → 0.2.8
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/README.md +54 -4
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +392 -394
- package/lib/locale/en-US.json +10 -9
- package/lib/locale/ru-RU.json +2 -1
- package/lib/locale/vi-VN.json +2 -1
- package/lib/locale/zh-CN.json +10 -9
- package/lib/locale/zh-TW.json +2 -1
- package/lib/types/commands/commands/data-validation.command.d.ts +6 -1
- package/lib/types/commands/operations/data-validation.operation.d.ts +0 -1
- package/lib/types/common/date-text-map.d.ts +0 -1
- package/lib/types/controllers/dv-alert.controller.d.ts +0 -1
- package/lib/types/controllers/dv-auto-fill.controller.d.ts +0 -1
- package/lib/types/controllers/dv-copy-paste.controller.d.ts +0 -1
- package/lib/types/controllers/dv-formula.controller.d.ts +0 -1
- package/lib/types/controllers/dv-model.controller.d.ts +0 -1
- package/lib/types/controllers/dv-permission.controller.d.ts +0 -1
- package/lib/types/controllers/dv-ref-range.controller.d.ts +0 -1
- package/lib/types/controllers/dv-reject-input.controller.d.ts +0 -1
- package/lib/types/controllers/dv-render.controller.d.ts +0 -1
- package/lib/types/controllers/dv.controller.d.ts +1 -5
- package/lib/types/controllers/dv.menu.d.ts +0 -1
- package/lib/types/index.d.ts +4 -11
- package/lib/types/locale/en-US.d.ts +0 -1
- package/lib/types/locale/ru-RU.d.ts +0 -1
- package/lib/types/locale/vi-VN.d.ts +0 -1
- package/lib/types/locale/zh-CN.d.ts +1 -0
- package/lib/types/locale/zh-TW.d.ts +0 -1
- package/lib/types/mobile-plugin.d.ts +0 -1
- package/lib/types/models/rule-matrix.d.ts +0 -1
- package/lib/types/models/sheet-data-validation-manager.d.ts +2 -3
- package/lib/types/plugin.d.ts +0 -1
- package/lib/types/services/data-validation-panel.service.d.ts +0 -1
- package/lib/types/services/dropdown-manager.service.d.ts +0 -1
- package/lib/types/services/dv-cache.service.d.ts +0 -1
- package/lib/types/services/dv-custom-formula.service.d.ts +0 -1
- package/lib/types/services/dv-formula.service.d.ts +0 -1
- package/lib/types/services/dv-validator-service.d.ts +4 -2
- package/lib/types/types/const/operator-text-map.d.ts +0 -1
- package/lib/types/types/const/two-formula-operators.d.ts +0 -1
- package/lib/types/utils/formula.d.ts +0 -1
- package/lib/types/utils/get-cell-data-origin.d.ts +0 -1
- package/lib/types/validators/checkbox-validator.d.ts +0 -1
- package/lib/types/validators/custom-validator.d.ts +0 -1
- package/lib/types/validators/date-validator.d.ts +0 -1
- package/lib/types/validators/decimal-validator.d.ts +2 -1
- package/lib/types/validators/list-multiple-validator.d.ts +0 -1
- package/lib/types/validators/list-validator.d.ts +0 -1
- package/lib/types/validators/text-length-validator.d.ts +2 -1
- package/lib/types/validators/util.d.ts +0 -1
- package/lib/types/validators/whole-validator.d.ts +2 -1
- package/lib/types/views/date-dropdown/index.d.ts +0 -1
- package/lib/types/views/detail/index.d.ts +0 -1
- package/lib/types/views/drop-down/CellDropdown.d.ts +0 -1
- package/lib/types/views/formula-input/base-formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/checkbox-formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/custom-formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/formula-input.d.ts +0 -1
- package/lib/types/views/formula-input/index.d.ts +0 -1
- package/lib/types/views/formula-input/list-formula-input.d.ts +0 -1
- package/lib/types/views/item/index.d.ts +0 -1
- package/lib/types/views/list/index.d.ts +0 -1
- package/lib/types/views/list-dropdown/index.d.ts +0 -1
- package/lib/types/views/options/index.d.ts +0 -1
- package/lib/types/views/panel/index.d.ts +0 -1
- package/lib/types/views/render-mode/index.d.ts +0 -1
- package/lib/types/views/show-time/index.d.ts +0 -1
- package/lib/types/widgets/checkbox-widget.d.ts +0 -1
- package/lib/types/widgets/dropdown-multiple-widget.d.ts +0 -1
- package/lib/types/widgets/dropdown-widget.d.ts +1 -3
- package/lib/types/widgets/shape/dropdown.d.ts +0 -1
- package/lib/types/widgets/shape/layout.d.ts +0 -1
- package/lib/umd/index.js +2 -2
- package/package.json +25 -25
- package/lib/types/services/dv.service.d.ts +0 -20
- package/lib/types/services/dv.tips.d.ts +0 -17
package/README.md
CHANGED
|
@@ -25,8 +25,13 @@ pnpm add
|
|
|
25
25
|
### Register the plugin
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
|
+
import type { IWorkbookData } from '@univerjs/core';
|
|
29
|
+
import { DataValidationType, ICommandService, LocaleType, Univer, UniverInstanceType } from '@univerjs/core';
|
|
28
30
|
import { UniverDataValidationPlugin } from '@univerjs/data-validation';
|
|
29
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
DATA_VALIDATION_PLUGIN_NAME,
|
|
33
|
+
UniverSheetsDataValidationPlugin,
|
|
34
|
+
} from '@univerjs/sheets-data-validation';
|
|
30
35
|
|
|
31
36
|
univer.registerPlugin(UniverDataValidationPlugin);
|
|
32
37
|
univer.registerPlugin(UniverSheetsDataValidationPlugin);
|
|
@@ -50,19 +55,64 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
|
|
|
50
55
|
id: 'workbook-01',
|
|
51
56
|
locale: LocaleType.ZH_CN,
|
|
52
57
|
name: 'UniverSheet Demo',
|
|
53
|
-
|
|
58
|
+
resources: [{
|
|
54
59
|
name: DATA_VALIDATION_PLUGIN_NAME,
|
|
55
60
|
data: JSON.stringify({
|
|
56
61
|
'sheetId-1': dataValidation,
|
|
57
62
|
}),
|
|
58
|
-
}]
|
|
63
|
+
}],
|
|
59
64
|
// ...
|
|
60
|
-
}
|
|
65
|
+
};
|
|
61
66
|
|
|
62
67
|
// load initial snapshot
|
|
63
68
|
univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);
|
|
64
69
|
```
|
|
65
70
|
|
|
71
|
+
### API
|
|
72
|
+
```typescript
|
|
73
|
+
// Commands and Command params for sheet-data-validation management
|
|
74
|
+
import type {
|
|
75
|
+
IAddSheetDataValidationCommandParams,
|
|
76
|
+
IRemoveSheetDataValidationCommandParams,
|
|
77
|
+
IUpdateSheetDataValidationOptionsCommandParams,
|
|
78
|
+
IUpdateSheetDataValidationRangeCommandParams,
|
|
79
|
+
IUpdateSheetDataValidationSettingCommandParams,
|
|
80
|
+
} from '@univerjs/sheets-data-validation';
|
|
81
|
+
import {
|
|
82
|
+
AddSheetDataValidationCommand,
|
|
83
|
+
DATA_VALIDATION_PLUGIN_NAME,
|
|
84
|
+
RemoveSheetDataValidationCommand,
|
|
85
|
+
UniverSheetsDataValidationPlugin,
|
|
86
|
+
UpdateSheetDataValidationOptionsCommand,
|
|
87
|
+
UpdateSheetDataValidationRangeCommand,
|
|
88
|
+
UpdateSheetDataValidationSettingCommand,
|
|
89
|
+
// internal service
|
|
90
|
+
SheetsDataValidationValidatorService
|
|
91
|
+
} from '@univerjs/sheets-data-validation';
|
|
92
|
+
|
|
93
|
+
// eg. Add data validation from command
|
|
94
|
+
const commandService = univer.__getInjector().get(ICommandService);
|
|
95
|
+
|
|
96
|
+
commandService.executeCommand(AddSheetDataValidationCommand.id, {
|
|
97
|
+
unitId: 'unitId',
|
|
98
|
+
subUnitId: 'subUnitId',
|
|
99
|
+
rule: {
|
|
100
|
+
uid: 'xxx-2',
|
|
101
|
+
type: DataValidationType.CHECKBOX,
|
|
102
|
+
ranges: [{
|
|
103
|
+
startRow: 6,
|
|
104
|
+
endRow: 10,
|
|
105
|
+
startColumn: 0,
|
|
106
|
+
endColumn: 5,
|
|
107
|
+
}],
|
|
108
|
+
},
|
|
109
|
+
} as IAddSheetDataValidationCommandParams);
|
|
110
|
+
|
|
111
|
+
// Using internal service Such as validator
|
|
112
|
+
const sheetsDataValidationValidatorService = univer.__getInjector().get(SheetsDataValidationValidatorService);
|
|
113
|
+
sheetsDataValidationValidatorService.validatorWorksheet('unitId', 'sheetId')
|
|
114
|
+
```
|
|
115
|
+
|
|
66
116
|
<!-- Links -->
|
|
67
117
|
[npm-version-shield]: https://img.shields.io/npm/v/@univerjs/sheets-data-validation?style=flat-square
|
|
68
118
|
[npm-version-link]: https://npmjs.com/package/@univerjs/sheets-data-validation
|