jspreadsheet 9.2.7 → 9.2.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/dist/index.d.ts CHANGED
@@ -55,6 +55,54 @@ declare namespace jspreadsheet {
55
55
  /** Get the current version */
56
56
  function version(): object;
57
57
 
58
+ /** Only available with the Validations extension */
59
+ interface Validation {
60
+ /** Excel-like range format Sheet1!A1:A6 */
61
+ range: string;
62
+ /** Validation type */
63
+ type: 'number' | 'text' | 'date' | 'list' | 'textLength' | 'empty' | 'notEmpty';
64
+ /** Validation action can be a warning or reject when the condition are not match or a format when the condition matches */
65
+ action: 'warning' | 'reject' | 'format';
66
+ /** Criteria to be match */
67
+ criteria:
68
+ | '='
69
+ | '!='
70
+ | '>='
71
+ | '>'
72
+ | '<='
73
+ | '<'
74
+ | 'between'
75
+ | 'not between'
76
+ | 'valid date'
77
+ | 'valid email'
78
+ | 'valid url'
79
+ | 'contains'
80
+ | 'not contains'
81
+ | 'begins with'
82
+ | 'ends with'
83
+ /** Custom message to the user */
84
+ text?: string;
85
+ /** Ignore blank cells */
86
+ allowBlank?: boolean;
87
+ /** For type: format you can apply some CSS when condition is matched */
88
+ format?: {
89
+ color: string;
90
+ 'background-color': string;
91
+ 'font-weight': number;
92
+ 'font-style': string;
93
+ }
94
+ /** For type: format you can add a class when condition is matched */
95
+ className?: string;
96
+ }
97
+
98
+ /** Only available with the Validations extension */
99
+ interface Validations {
100
+ // Index position in the array of validations
101
+ index?: number | null;
102
+ // The validation definition object
103
+ value: Validation;
104
+ }
105
+
58
106
  /** Native editors */
59
107
  interface Editors {
60
108
  // Create a DOM element for a cell edition
@@ -638,7 +686,7 @@ declare namespace jspreadsheet {
638
686
  /** Worksheets */
639
687
  worksheets?: Array<Worksheet>;
640
688
  /** Validations */
641
- validations?: any;
689
+ validations?: Validation[];
642
690
  /** Plugins */
643
691
  plugins?: Record<string, Function>
644
692
  }
@@ -1319,6 +1367,12 @@ declare namespace jspreadsheet {
1319
1367
  getWorksheetActive: () => number;
1320
1368
  /** Delete an existing worksheet by its position */
1321
1369
  deleteWorksheet: (position: number) => void;
1370
+ /** Get a validation object. Require the extension Validations. */
1371
+ getValidations: (validationIndex: number | null) => Validation | Validation[];
1372
+ /** Insert or update existing validations by index. Require the extension Validations. */
1373
+ setValidations: (validations: Validations[]) => void;
1374
+ /** Reset validations by validation indexes. Require the extension Validations. */
1375
+ resetValidations: (validationIndex: number | number[]) => void;
1322
1376
  }
1323
1377
  }
1324
1378