@orangelogic/design-system 2.130.0 → 2.131.0

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 (23) hide show
  1. package/library/assets/validation.worker-Dc_pkZlD.js +1 -0
  2. package/library/chunks/{color-swatch-group.DPaKBfvX.js → color-swatch-group.Cy-M_lbx.js} +1 -1
  3. package/library/chunks/{list-editor.DfOsqO4y.js → list-editor.CdMU7vNF.js} +1 -1
  4. package/library/chunks/{table.Cf3C72Lv.js → table.C6YsaNOh.js} +2460 -2081
  5. package/library/components/atoms.js +1 -1
  6. package/library/components/color-swatch-group.js +2 -2
  7. package/library/components/list-editor.js +2 -2
  8. package/library/components/molecules.js +1 -1
  9. package/library/components/organisms.js +1 -1
  10. package/library/components/table.js +52 -50
  11. package/library/components/types.js +4 -4
  12. package/library/package.json +1 -1
  13. package/library/packages/atoms/src/components/table/table.d.ts +43 -0
  14. package/library/packages/events/src/cx-table-validation-change.d.ts +8 -0
  15. package/library/packages/events/src/events.d.ts +7 -6
  16. package/library/packages/hybrid/table-core/src/tabulator-tables/index.d.ts +1 -0
  17. package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/Validate.d.ts +81 -13
  18. package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/defaults/rule-functions.d.ts +20 -0
  19. package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/defaults/validators.d.ts +9 -18
  20. package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/validation-worker-client.d.ts +13 -0
  21. package/library/packages/types/src/table.d.ts +55 -1
  22. package/library/react-web-component.d.ts +11 -3
  23. package/package.json +1 -1
@@ -928,6 +928,11 @@ export interface ITabulatorFull extends ITabulator {
928
928
  createFilterFieldFunction: IFilter['createFilterFieldFunction'];
929
929
  clearFilter: IFilter['clearFilter'];
930
930
  setSort: (sortList: string | Sorter[], dir?: SortDirection) => void;
931
+ validate: () => true | ICellComponent[];
932
+ validateAsync: () => Promise<ValidationSummary>;
933
+ getValidationSummary: () => ValidationSummary;
934
+ getInvalidCells: () => ICellComponent[];
935
+ clearCellValidation: (cells?: ICellComponent | ICellComponent[]) => void;
931
936
  }
932
937
  /**
933
938
  * Table type
@@ -1769,6 +1774,19 @@ export interface OptionsGeneral {
1769
1774
  * manual - no validation is automatically performed on edit, but it can be triggered by calling the validate function on the table or any Component Object
1770
1775
  */
1771
1776
  validationMode?: 'blocking' | 'highlight' | 'manual';
1777
+ /**
1778
+ * When true, the whole dataset is validated automatically each time data is
1779
+ * loaded or replaced (`data-processed`). Defaults to false for backward
1780
+ * compatibility.
1781
+ */
1782
+ validateOnLoad?: boolean;
1783
+ /**
1784
+ * Row-count threshold above which table-wide validation passes
1785
+ * (`validateAsync` / `validateOnLoad`) are offloaded to a Web Worker instead
1786
+ * of running synchronously on the main thread. Set to `false` to always
1787
+ * validate synchronously. Defaults to 2000.
1788
+ */
1789
+ validationWorkerThreshold?: number | false;
1772
1790
  textDirection?: TextDirection;
1773
1791
  /**
1774
1792
  * Sometimes it can be useful to add a visual header to the start of a row.
@@ -2607,10 +2625,45 @@ export type JSONRecord = Record<string, string | number | boolean>;
2607
2625
  * {title:"Example", field:"example", validator:"regex:\\.com$"} \\allow strings that end in '.com'
2608
2626
  * ```
2609
2627
  */
2610
- export type StandardValidatorType = 'required' | 'unique' | 'integer' | 'float' | 'numeric' | 'string' | 'alphanumeric';
2628
+ export type StandardValidatorType = 'required' | 'unique' | 'integer' | 'float' | 'numeric' | 'string' | 'alphanumeric' | 'boolean' | 'date' | 'in' | 'regex';
2629
+ /** Range constraints accepted by the numeric-type validators (`numeric`, `integer`, `float`). */
2630
+ export interface NumericValidatorParameters {
2631
+ min?: number;
2632
+ max?: number;
2633
+ }
2634
+ /** Length constraints accepted by the `string` validator. */
2635
+ export interface StringValidatorParameters {
2636
+ minLength?: number;
2637
+ maxLength?: number;
2638
+ }
2639
+ /**
2640
+ * Range constraints accepted by the `date` validator. `starts` / `ends` are
2641
+ * inclusive bounds as ISO date strings (or anything `Date.parse` understands).
2642
+ */
2643
+ export interface DateValidatorParameters {
2644
+ starts?: string;
2645
+ ends?: string;
2646
+ }
2611
2647
  export interface Validator {
2612
2648
  type: StandardValidatorType | ((cell: ICellComponent, value: any, parameters?: any) => boolean);
2613
2649
  parameters?: any;
2650
+ /**
2651
+ * Optional human-readable error message attached to validation failures for
2652
+ * this rule. Propagated to cell validation state, the cell `title` tooltip,
2653
+ * and validation events. JSON-serializable.
2654
+ */
2655
+ message?: string;
2656
+ }
2657
+ /** A single failed validation rule on a cell. */
2658
+ export interface CellValidationFailure {
2659
+ type: string;
2660
+ parameters?: any;
2661
+ message?: string;
2662
+ }
2663
+ /** Aggregate result of a table-wide validation pass. */
2664
+ export interface ValidationSummary {
2665
+ invalidCellCount: number;
2666
+ invalidCells: ICellComponent[];
2614
2667
  }
2615
2668
  export type ColumnSorterParamLookupFunction = (column: IColumnComponent, dir: SortDirection) => Record<string, unknown>;
2616
2669
  export type ColumnLookup = IColumn | IColumnComponent | ColumnDefinition | HTMLElement | string;
@@ -2815,6 +2868,7 @@ export interface RangeComponent {
2815
2868
  }
2816
2869
  export interface EventCallBackMethods {
2817
2870
  validationFailed: (cell: ICellComponent, value: any, validators: Validator[]) => void;
2871
+ validationChanged: (summary: ValidationSummary) => void;
2818
2872
  scrollHorizontal: (left: number, leftDir: boolean) => void;
2819
2873
  scrollVertical: (top: number, topDir: boolean) => void;
2820
2874
  rowAdded: (row: IRowComponent) => void;