@univerjs/sheets-data-validation 0.1.7 → 0.1.9

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 CHANGED
@@ -23,7 +23,40 @@ pnpm add
23
23
  ### Register the plugin
24
24
 
25
25
  ```typescript
26
+ import { UniverDataValidationPlugin } from '@univerjs/data-validation';
26
27
  import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
27
28
 
29
+ univer.registerPlugin(UniverDataValidationPlugin);
28
30
  univer.registerPlugin(UniverSheetsDataValidationPlugin);
31
+
32
+ // initial data validation
33
+ // dentation: https://github.com/dream-num/univer/blob/dev/packages/core/src/types/interfaces/i-data-validation.ts#L48
34
+ const dataValidation = [
35
+ {
36
+ uid: 'xxx-2',
37
+ type: DataValidationType.CHECKBOX,
38
+ ranges: [{
39
+ startRow: 6,
40
+ endRow: 10,
41
+ startColumn: 0,
42
+ endColumn: 5,
43
+ }],
44
+ },
45
+ ];
46
+
47
+ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
48
+ id: 'workbook-01',
49
+ locale: LocaleType.ZH_CN,
50
+ name: 'UniverSheet Demo',
51
+ resource: [{
52
+ name: DATA_VALIDATION_PLUGIN_NAME,
53
+ data: JSON.stringify({
54
+ 'sheetId-1': dataValidation,
55
+ }),
56
+ }]
57
+ // ...
58
+ }
59
+
60
+ // load initial snapshot
61
+ univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);
29
62
  ```