@orangelogic/design-system 2.129.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.
- package/library/assets/validation.worker-Dc_pkZlD.js +1 -0
- package/library/chunks/{color-swatch-group.DPaKBfvX.js → color-swatch-group.Cy-M_lbx.js} +1 -1
- package/library/chunks/{document-viewer.VVTf0dxG.js → document-viewer.Dn_vUYCW.js} +2 -2
- package/library/chunks/{image.CDrKFe1H.js → image.BC_hwk-b.js} +246 -215
- package/library/chunks/{list-editor.C8SaStOE.js → list-editor.CdMU7vNF.js} +8 -7
- package/library/chunks/{resizable-component.styles.DpK0TTP5.js → resizable-component.styles.BVhOesNE.js} +2 -1
- package/library/chunks/{table.Cf3C72Lv.js → table.C6YsaNOh.js} +2460 -2081
- package/library/components/atoms.js +3 -3
- package/library/components/audio.js +1 -1
- package/library/components/color-swatch-group.js +2 -2
- package/library/components/document-viewer.js +3 -3
- package/library/components/image.js +4 -3
- package/library/components/list-editor.js +2 -2
- package/library/components/masonry.js +1 -1
- package/library/components/molecules.js +1 -1
- package/library/components/organisms.js +1 -1
- package/library/components/table.js +52 -50
- package/library/components/types.js +5941 -5918
- package/library/components/video.js +2 -2
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/image/image.d.ts +16 -8
- package/library/packages/atoms/src/components/table/table.d.ts +43 -0
- package/library/packages/base/src/highlightable-element.d.ts +2 -1
- package/library/packages/events/src/cx-table-validation-change.d.ts +8 -0
- package/library/packages/events/src/events.d.ts +7 -6
- package/library/packages/hybrid/table-core/src/tabulator-tables/index.d.ts +1 -0
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/Validate.d.ts +81 -13
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/defaults/rule-functions.d.ts +20 -0
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/defaults/validators.d.ts +9 -18
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/validation-worker-client.d.ts +13 -0
- package/library/packages/molecules/src/asset-picker/asset-picker.d.ts +3 -2
- package/library/packages/organisms/src/bento-grid/bento-grid.d.ts +1 -1
- package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +6 -0
- package/library/packages/types/src/table.d.ts +55 -1
- package/library/react-web-component.d.ts +13 -5
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { _ as kd, a as Sa, b as Be, c as Je } from "../chunks/inheritsLoose.BuSn_CvZ.js";
|
|
2
2
|
import { c as ps, a as Bn } from "../chunks/_commonjsHelpers.DQNKXVTB.js";
|
|
3
3
|
import { r as Sb } from "../chunks/___vite-browser-external_commonjs-proxy.C2tf3HsQ.js";
|
|
4
|
-
import { C as Cb } from "../chunks/image.
|
|
4
|
+
import { C as Cb } from "../chunks/image.BC_hwk-b.js";
|
|
5
5
|
import Mb from "./resize-observer.js";
|
|
6
|
-
import { r as Db, R as Pb, a as Rp, b as Lb } from "../chunks/resizable-component.styles.
|
|
6
|
+
import { r as Db, R as Pb, a as Rp, b as Lb } from "../chunks/resizable-component.styles.BVhOesNE.js";
|
|
7
7
|
import { c as Rb } from "../chunks/component.styles.CRO4Odto.js";
|
|
8
8
|
import { b as Ib } from "../chunks/browser.BHOCIF_A.js";
|
|
9
9
|
import { c as Ob } from "../chunks/custom-element.L4WJXn1j.js";
|
package/library/package.json
CHANGED
|
@@ -2,13 +2,14 @@ import { default as ResizableElement } from '../../../../base/src/resizable-elem
|
|
|
2
2
|
import { ObjectFit } from '../../../../types/src/index.ts';
|
|
3
3
|
import { ClickHandlerType } from '../../../../types/src/image';
|
|
4
4
|
import { LocalizeController } from '../../../../utils/src/custom-element/i18n';
|
|
5
|
-
import { TemplateResult } from 'lit';
|
|
5
|
+
import { nothing, TemplateResult } from 'lit';
|
|
6
6
|
import { Zoom } from 'medium-zoom';
|
|
7
7
|
import { default as CxIcon } from '../icon/icon';
|
|
8
8
|
import { default as CxPopup } from '../popup/popup';
|
|
9
9
|
import { default as CxResizeObserver } from '../resize-observer/resize-observer';
|
|
10
10
|
import { default as CxSkeleton } from '../skeleton/skeleton';
|
|
11
11
|
import { default as CxSpace } from '../space/space';
|
|
12
|
+
import { default as CxSpinner } from '../spinner/spinner';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @summary Images are wrappers for img elements with built-in lazy loading, skeleton, and fallback support.
|
|
@@ -16,7 +17,8 @@ import { default as CxSpace } from '../space/space';
|
|
|
16
17
|
*
|
|
17
18
|
* @csspart image - The `img` element.
|
|
18
19
|
* @csspart skeleton - The skeleton element, will be shown while the image is loading and the `skeleton` property is set.
|
|
19
|
-
* @csspart
|
|
20
|
+
* @csspart retry-spinner - The spinner overlay shown while a failed load is being retried (when `retry-on-error` is enabled).
|
|
21
|
+
* @csspart fallback - The fallback element, always shown when the image fails to load (after retries, when applicable).
|
|
20
22
|
* @csspart base - The component’s outer wrapper.
|
|
21
23
|
* @csspart fallback-icon - The icon rendered inside the fallback slot.
|
|
22
24
|
*
|
|
@@ -27,6 +29,7 @@ import { default as CxSpace } from '../space/space';
|
|
|
27
29
|
* @cssproperty --padding-bottom - The padding-bottom of the image (this will override the `--padding` property).
|
|
28
30
|
* @cssproperty --border-radius - The border-radius of the image.
|
|
29
31
|
* @cssproperty --border - The border of the image.
|
|
32
|
+
* @cssproperty [--fallback-icon-color=var(--cx-input-icon-color)] - The color of the icon shown when the image fails to load.
|
|
30
33
|
*
|
|
31
34
|
* @event cx-load - Emitted when the image has loaded.
|
|
32
35
|
* @event cx-error - Emitted when the image has failed to load (after all retry attempts when `retry-on-error` is enabled).
|
|
@@ -34,7 +37,7 @@ import { default as CxSpace } from '../space/space';
|
|
|
34
37
|
* @event cx-image-zoom-close - Emitted when the image zoom is closed.
|
|
35
38
|
*
|
|
36
39
|
* @slot skeleton - The skeleton element, will be shown while the image is loading and the `skeleton` property is set.
|
|
37
|
-
* @slot fallback - The fallback element,
|
|
40
|
+
* @slot fallback - The fallback element, always shown when the image fails to load; override this slot to customize the broken-image UI.
|
|
38
41
|
*/
|
|
39
42
|
export default class CxImage extends ResizableElement {
|
|
40
43
|
static readonly styles: import('lit').CSSResult[];
|
|
@@ -44,17 +47,20 @@ export default class CxImage extends ResizableElement {
|
|
|
44
47
|
'cx-resize-observer': typeof CxResizeObserver;
|
|
45
48
|
'cx-skeleton': typeof CxSkeleton;
|
|
46
49
|
'cx-space': typeof CxSpace;
|
|
50
|
+
'cx-spinner': typeof CxSpinner;
|
|
47
51
|
};
|
|
48
52
|
readonly localize: LocalizeController;
|
|
49
53
|
imageElement?: HTMLImageElement;
|
|
50
54
|
zoomImageElement: HTMLImageElement;
|
|
51
55
|
highlighterElement: HTMLDivElement;
|
|
52
|
-
private
|
|
53
|
-
private
|
|
56
|
+
private retryCount;
|
|
57
|
+
private retryTimer;
|
|
54
58
|
isLoaded: boolean;
|
|
55
59
|
isError: boolean;
|
|
60
|
+
/** True while a load has failed and a retry is scheduled or in-flight (retry-on-error only). */
|
|
61
|
+
isRetrying: boolean;
|
|
56
62
|
/** Incremented on each retry attempt to force the img element to remount via keyed(). */
|
|
57
|
-
private
|
|
63
|
+
private retryIndex;
|
|
58
64
|
/**
|
|
59
65
|
* The path to the image to load.
|
|
60
66
|
*/
|
|
@@ -76,7 +82,9 @@ export default class CxImage extends ResizableElement {
|
|
|
76
82
|
*/
|
|
77
83
|
skeleton: boolean;
|
|
78
84
|
/**
|
|
79
|
-
*
|
|
85
|
+
* @deprecated No longer required: the broken-image UI now always renders when the image
|
|
86
|
+
* fails to load, regardless of this property's value. Kept only for backward compatibility
|
|
87
|
+
* with existing markup that sets the `fallback` attribute.
|
|
80
88
|
*/
|
|
81
89
|
fallback: boolean;
|
|
82
90
|
/**
|
|
@@ -177,7 +185,7 @@ export default class CxImage extends ResizableElement {
|
|
|
177
185
|
protected handleClickAction(event: MouseEvent): void;
|
|
178
186
|
updated(changedProps: Map<string, unknown>): void;
|
|
179
187
|
openZoom(): void;
|
|
180
|
-
protected renderContent(): TemplateResult;
|
|
188
|
+
protected renderContent(): TemplateResult | typeof nothing;
|
|
181
189
|
render(): TemplateResult;
|
|
182
190
|
}
|
|
183
191
|
declare global {
|
|
@@ -6,6 +6,7 @@ import { default as CxIconButton } from '../icon-button/icon-button.ts';
|
|
|
6
6
|
import { default as CxSelect } from '../select/select.ts';
|
|
7
7
|
import { default as CxSpace } from '../space/space.ts';
|
|
8
8
|
import { default as CxSpinner } from '../spinner/spinner.ts';
|
|
9
|
+
import { default as CxTooltip } from '../tooltip/tooltip.ts';
|
|
9
10
|
import { default as CortexElement } from '../../../../base/src/cortex-element.ts';
|
|
10
11
|
import { RowComponent, TabulatorFull as Tabulator } from '../../../../hybrid/table-core/src/index.ts';
|
|
11
12
|
import { PaginationCounter } from '../../../../types/src/pagination';
|
|
@@ -65,6 +66,7 @@ import { CxTableFooter, CxTableRowActions, CxTableToolbar } from './components';
|
|
|
65
66
|
* E.g: `cx-table.rowMoved` will fire when `rowMoved` event is emitted.
|
|
66
67
|
* @event {{ url: string, format: string, rowCount: number }} cx-table-data-load - Emitted when data is successfully loaded from dataUrl.
|
|
67
68
|
* @event {{ url: string, error: unknown }} cx-table-data-load-error - Emitted when fetching or parsing data from dataUrl fails.
|
|
69
|
+
* @event {{ invalidCellCount: number, invalidCells: ICellComponent[] }} cx-table-validation-change - Emitted when the set of cells failing column `validator` rules changes (edit, load validation, or programmatic validate).
|
|
68
70
|
*/
|
|
69
71
|
export default class CxTable extends CortexElement {
|
|
70
72
|
#private;
|
|
@@ -82,6 +84,7 @@ export default class CxTable extends CortexElement {
|
|
|
82
84
|
'cx-table-footer': typeof CxTableFooter;
|
|
83
85
|
'cx-table-row-actions': typeof CxTableRowActions;
|
|
84
86
|
'cx-table-toolbar': typeof CxTableToolbar;
|
|
87
|
+
'cx-tooltip': typeof CxTooltip;
|
|
85
88
|
};
|
|
86
89
|
private verticalOsInstance;
|
|
87
90
|
private horizontalOsInstance;
|
|
@@ -94,6 +97,18 @@ export default class CxTable extends CortexElement {
|
|
|
94
97
|
private readonly table;
|
|
95
98
|
private readonly tableToolbar;
|
|
96
99
|
private readonly tableFooter;
|
|
100
|
+
private readonly validationTooltip;
|
|
101
|
+
/** Cell element the shared validation tooltip is currently anchored to. */
|
|
102
|
+
private validationTooltipAnchor;
|
|
103
|
+
/** Pending delayed hide of the shared validation tooltip. */
|
|
104
|
+
private validationTooltipHideTimeout?;
|
|
105
|
+
/**
|
|
106
|
+
* In-flight hide transition of the shared validation tooltip. Calling
|
|
107
|
+
* show() while a hide animation is still running would race its tail
|
|
108
|
+
* (which deactivates the popup after the animation), leaving `open` true
|
|
109
|
+
* but the tooltip invisible — show waits for this to settle instead.
|
|
110
|
+
*/
|
|
111
|
+
private validationTooltipHidePromise;
|
|
97
112
|
movableRows: boolean;
|
|
98
113
|
movableColumns: boolean;
|
|
99
114
|
data: Options['data'];
|
|
@@ -175,6 +190,16 @@ export default class CxTable extends CortexElement {
|
|
|
175
190
|
* If 'basic', virtual DOM is disabled.
|
|
176
191
|
*/
|
|
177
192
|
renderVertical: Options['renderVertical'];
|
|
193
|
+
/**
|
|
194
|
+
* When true, the whole dataset is validated against the column `validator`
|
|
195
|
+
* definitions each time data is loaded or replaced.
|
|
196
|
+
*/
|
|
197
|
+
validateOnLoad: Options['validateOnLoad'];
|
|
198
|
+
/**
|
|
199
|
+
* Row-count threshold above which table-wide validation passes are offloaded
|
|
200
|
+
* to a Web Worker to keep the main thread responsive.
|
|
201
|
+
*/
|
|
202
|
+
validationWorkerThreshold: Options['validationWorkerThreshold'];
|
|
178
203
|
/**
|
|
179
204
|
* The columnDefaults option allows you to set default configs for all columns in the table.
|
|
180
205
|
*/
|
|
@@ -717,6 +742,24 @@ export default class CxTable extends CortexElement {
|
|
|
717
742
|
* All logic that needs to run when the table is built should be placed here.
|
|
718
743
|
*/
|
|
719
744
|
private readonly handleTableBuilt;
|
|
745
|
+
/** Re-emits table-core validation summaries as a typed Cortex event. */
|
|
746
|
+
private readonly handleValidationChanged;
|
|
747
|
+
/**
|
|
748
|
+
* One shared tooltip serves every invalid cell: on hover it is re-anchored
|
|
749
|
+
* to the hovered cell and filled with that cell's failure messages, instead
|
|
750
|
+
* of rendering a tooltip per cell.
|
|
751
|
+
*/
|
|
752
|
+
private handleValidationMouseOver;
|
|
753
|
+
private showValidationTooltip;
|
|
754
|
+
private hideValidationTooltip;
|
|
755
|
+
/**
|
|
756
|
+
* cx-popup restarts its positioner with a debounce after an anchor change,
|
|
757
|
+
* which would leave a re-anchored (still open) tooltip hovering over the
|
|
758
|
+
* previous cell while already showing the new cell's content — force an
|
|
759
|
+
* immediate reposition once the popup has adopted the new anchor.
|
|
760
|
+
*/
|
|
761
|
+
private repositionValidationTooltipNow;
|
|
762
|
+
private handleValidationMouseOut;
|
|
720
763
|
disconnectedCallback(): void;
|
|
721
764
|
private initVerticalScrollbar;
|
|
722
765
|
private initHorizontalScrollbar;
|
|
@@ -60,11 +60,12 @@ export default class HighlightableElement extends CortexElement {
|
|
|
60
60
|
*/
|
|
61
61
|
isHovering: boolean;
|
|
62
62
|
get easeCSSVariable(): string;
|
|
63
|
-
getHighlighterClass(): {
|
|
63
|
+
getHighlighterClass(isError?: boolean): {
|
|
64
64
|
[x: string]: boolean;
|
|
65
65
|
highlighter: boolean;
|
|
66
66
|
'highlighter--background': boolean;
|
|
67
67
|
'highlighter--border': boolean;
|
|
68
|
+
'highlighter--centered': boolean;
|
|
68
69
|
'highlighter--color-overlay': boolean;
|
|
69
70
|
'highlighter--drop-shadow': boolean;
|
|
70
71
|
'highlighter--opacity': boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ValidationSummary } from '../../types/src/table';
|
|
2
|
+
|
|
3
|
+
export type CxTableValidationChangeEvent = CustomEvent<ValidationSummary>;
|
|
4
|
+
declare global {
|
|
5
|
+
interface GlobalEventHandlersEventMap {
|
|
6
|
+
'cx-table-validation-change': CxTableValidationChangeEvent;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -11,6 +11,7 @@ export * from './cx-after-expand';
|
|
|
11
11
|
export * from './cx-after-hide';
|
|
12
12
|
export * from './cx-after-show';
|
|
13
13
|
export * from './cx-asset-data-display-slot-change';
|
|
14
|
+
export * from './cx-asset-format-picker-select';
|
|
14
15
|
export * from './cx-asset-picker-delete';
|
|
15
16
|
export * from './cx-asset-picker-select';
|
|
16
17
|
export * from './cx-asset-request-status';
|
|
@@ -63,7 +64,6 @@ export * from './cx-dot-status-click';
|
|
|
63
64
|
export * from './cx-download-format-picker-delete';
|
|
64
65
|
export * from './cx-download-format-picker-select';
|
|
65
66
|
export * from './cx-download-format-request-status';
|
|
66
|
-
export * from './cx-asset-format-picker-select';
|
|
67
67
|
export * from './cx-drag-end';
|
|
68
68
|
export * from './cx-drag-start';
|
|
69
69
|
export * from './cx-e-chart-drill-down';
|
|
@@ -79,8 +79,8 @@ export * from './cx-file-on-demand-unpin';
|
|
|
79
79
|
export * from './cx-find-and-replace';
|
|
80
80
|
export * from './cx-finish';
|
|
81
81
|
export * from './cx-focus';
|
|
82
|
-
export * from './cx-folder-select-search-term-change';
|
|
83
82
|
export * from './cx-folder-select-children-loaded';
|
|
83
|
+
export * from './cx-folder-select-search-term-change';
|
|
84
84
|
export * from './cx-gallery-chunk-request';
|
|
85
85
|
export * from './cx-gallery-config-save';
|
|
86
86
|
export * from './cx-gallery-item-click';
|
|
@@ -162,7 +162,6 @@ export * from './cx-save';
|
|
|
162
162
|
export * from './cx-save-settings';
|
|
163
163
|
export * from './cx-sb-button-click';
|
|
164
164
|
export * from './cx-sb-dam-view-config-change';
|
|
165
|
-
export * from './cx-video-thumbnail-resolved';
|
|
166
165
|
export * from './cx-search';
|
|
167
166
|
export * from './cx-select';
|
|
168
167
|
export * from './cx-selected-change';
|
|
@@ -170,8 +169,8 @@ export * from './cx-selection-change';
|
|
|
170
169
|
export * from './cx-shadow-input-group-change';
|
|
171
170
|
export * from './cx-share-option-list-item-selected';
|
|
172
171
|
export * from './cx-show';
|
|
173
|
-
export * from './cx-special-characters-insert';
|
|
174
172
|
export * from './cx-slide-change';
|
|
173
|
+
export * from './cx-special-characters-insert';
|
|
175
174
|
export * from './cx-start';
|
|
176
175
|
export * from './cx-swatch-add';
|
|
177
176
|
export * from './cx-tab-hide';
|
|
@@ -183,9 +182,10 @@ export * from './cx-table-export';
|
|
|
183
182
|
export * from './cx-table-row-action-click';
|
|
184
183
|
export * from './cx-table-save-search-select';
|
|
185
184
|
export * from './cx-table-switch-change';
|
|
185
|
+
export * from './cx-table-validation-change';
|
|
186
186
|
export * from './cx-time-based-change';
|
|
187
|
-
export * from './cx-timeline-data-resolved';
|
|
188
187
|
export * from './cx-time-update';
|
|
188
|
+
export * from './cx-timeline-data-resolved';
|
|
189
189
|
export * from './cx-tiptap-code-block-doc-request';
|
|
190
190
|
export * from './cx-tiptap-image-doc-request';
|
|
191
191
|
export * from './cx-tiptap-image-host-feedback';
|
|
@@ -193,11 +193,12 @@ export * from './cx-tiptap-video-doc-request';
|
|
|
193
193
|
export * from './cx-tiptap-video-host-feedback';
|
|
194
194
|
export * from './cx-typeface-change';
|
|
195
195
|
export * from './cx-typeface-download';
|
|
196
|
-
export * from './cx-undo';
|
|
197
196
|
export * from './cx-unauthorized';
|
|
197
|
+
export * from './cx-undo';
|
|
198
198
|
export * from './cx-unmark-favorite';
|
|
199
199
|
export * from './cx-video-click';
|
|
200
200
|
export * from './cx-video-editor-track-canvas-ready';
|
|
201
201
|
export * from './cx-video-editor-track-click';
|
|
202
202
|
export * from './cx-video-editor-transition-click';
|
|
203
|
+
export * from './cx-video-thumbnail-resolved';
|
|
203
204
|
export * from './cx-view-logs';
|
|
@@ -13,3 +13,4 @@ export { default as Row } from './core/row/Row';
|
|
|
13
13
|
export { default as Cell } from './core/cell/Cell';
|
|
14
14
|
export { default as Module } from './core/Module';
|
|
15
15
|
export { default as Renderer } from './core/rendering/Renderer';
|
|
16
|
+
export { VALIDATION_MESSAGE_ATTRIBUTE } from './modules/Validate/Validate';
|
package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Validate/Validate.d.ts
CHANGED
|
@@ -1,36 +1,104 @@
|
|
|
1
|
+
import { CellValidationFailure, ICellComponent, StandardValidatorType, ValidationSummary, Validator } from '../../../../../../types/src/table';
|
|
1
2
|
import { default as Cell } from '../../core/cell/Cell';
|
|
2
3
|
import { default as Column } from '../../core/column/Column';
|
|
3
4
|
import { default as Module } from '../../core/Module';
|
|
4
5
|
import { default as Row } from '../../core/row/Row';
|
|
5
6
|
import { default as Tabulator } from '../../core/Tabulator';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Attribute carrying the joined failure messages of an invalid cell.
|
|
10
|
+
* Consumers (e.g. cx-table) read it to display a tooltip — a data attribute
|
|
11
|
+
* instead of `title` so the native browser tooltip does not compete with it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const VALIDATION_MESSAGE_ATTRIBUTE = "data-validation-message";
|
|
14
|
+
type ValidatorFunction = (cell: ICellComponent, value: unknown, parameters?: unknown) => boolean;
|
|
8
15
|
type ValidatorConfig = {
|
|
9
16
|
func: ValidatorFunction;
|
|
10
|
-
|
|
17
|
+
message?: string;
|
|
18
|
+
params: unknown;
|
|
11
19
|
type: string;
|
|
12
20
|
};
|
|
13
21
|
export default class Validate extends Module {
|
|
14
22
|
static readonly moduleName = "validate";
|
|
15
23
|
static readonly validators: Record<string, ValidatorFunction>;
|
|
16
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Validation results keyed by row → column. Virtual renderers delete and
|
|
26
|
+
* recreate Cell objects as rows scroll in and out of the render window,
|
|
27
|
+
* while Row and Column objects persist — so keying by row/column keeps
|
|
28
|
+
* invalid state (and counts) stable across scrolling. Cells without a
|
|
29
|
+
* row/column (detached mocks) key by the cell itself.
|
|
30
|
+
*/
|
|
31
|
+
private readonly invalidState;
|
|
32
|
+
get invalidCells(): Cell[];
|
|
33
|
+
set invalidCells(cells: Cell[]);
|
|
34
|
+
/**
|
|
35
|
+
* Bumped whenever data is replaced or a new table-wide validation starts, so
|
|
36
|
+
* results of superseded async validations are discarded instead of applied.
|
|
37
|
+
*/
|
|
38
|
+
private validationGeneration;
|
|
39
|
+
/** Batch operations set this to emit one validationChanged instead of one per cell. */
|
|
40
|
+
private suppressValidationChanged;
|
|
17
41
|
constructor(table: Tabulator);
|
|
18
42
|
initialize(): void;
|
|
19
|
-
editValidate(cell: Cell, value:
|
|
43
|
+
editValidate(cell: Cell, value: unknown, _previousValue: unknown): boolean | CellValidationFailure[];
|
|
20
44
|
editorClear(cell: Cell, cancelled: boolean): void;
|
|
21
45
|
editedClear(cell: Cell): void;
|
|
46
|
+
/**
|
|
47
|
+
* A deleted cell must NOT drop its validation state: virtual renderers
|
|
48
|
+
* delete and recreate Cell objects as rows scroll in and out of the render
|
|
49
|
+
* window, and the row-keyed record is restored by layoutCell when the cell
|
|
50
|
+
* is rebuilt. True removals are handled by rowDeleted/columnDeleted.
|
|
51
|
+
*/
|
|
52
|
+
cellDeleted(cell: Cell): void;
|
|
53
|
+
rowDeleted(row: Row): void;
|
|
54
|
+
columnDeleted(column: Column): void;
|
|
55
|
+
/**
|
|
56
|
+
* Cells are recycled by the virtual renderers, so persisted validation state
|
|
57
|
+
* must be restored onto the freshly built cell whenever its DOM is (re)built.
|
|
58
|
+
*/
|
|
59
|
+
layoutCell(cell: Cell): void;
|
|
60
|
+
dataProcessed(): void;
|
|
22
61
|
cellIsValid(cell: Cell): boolean;
|
|
23
|
-
cellValidate(cell: Cell):
|
|
24
|
-
columnValidate(column: Column):
|
|
25
|
-
rowValidate(row: Row):
|
|
26
|
-
userClearCellValidation(cells?:
|
|
27
|
-
userValidate(_cells?:
|
|
62
|
+
cellValidate(cell: Cell): CellValidationFailure[] | boolean;
|
|
63
|
+
columnValidate(column: Column): ICellComponent[] | boolean;
|
|
64
|
+
rowValidate(row: Row): ICellComponent[] | boolean;
|
|
65
|
+
userClearCellValidation(cells?: ICellComponent | ICellComponent[]): void;
|
|
66
|
+
userValidate(_cells?: unknown): ICellComponent[] | boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Validates the whole dataset without blocking the main thread on large
|
|
69
|
+
* tables: below `validationWorkerThreshold` rows it runs synchronously,
|
|
70
|
+
* above it JSON rules are offloaded to a shared Web Worker (columns with
|
|
71
|
+
* function validators stay on the main thread, processed in yielding
|
|
72
|
+
* chunks). Superseded runs (new validation or data reload) are discarded.
|
|
73
|
+
*/
|
|
74
|
+
validateAsync(): Promise<ValidationSummary>;
|
|
75
|
+
getValidationSummary(): ValidationSummary;
|
|
28
76
|
initializeColumnCheck(column: Column): void;
|
|
29
77
|
initializeColumn(column: Column): void;
|
|
30
|
-
_extractValidator(value:
|
|
31
|
-
_buildValidator(type: string | ValidatorFunction, params?:
|
|
32
|
-
validate(validators: ValidatorConfig[] | false | undefined, cell: Cell, value:
|
|
33
|
-
getInvalidCells():
|
|
78
|
+
_extractValidator(value: StandardValidatorType | Validator | ValidatorFunction | string): ValidatorConfig | false;
|
|
79
|
+
_buildValidator(type: string | ValidatorFunction, params?: unknown, message?: string): ValidatorConfig | false;
|
|
80
|
+
validate(validators: ValidatorConfig[] | false | undefined, cell: Cell, value: unknown): CellValidationFailure[] | boolean;
|
|
81
|
+
getInvalidCells(): ICellComponent[];
|
|
34
82
|
clearValidation(cell: Cell): void;
|
|
83
|
+
private rowKeyOf;
|
|
84
|
+
private columnKeyOf;
|
|
85
|
+
private getInvalidRecord;
|
|
86
|
+
private registerInvalidCell;
|
|
87
|
+
private unregisterInvalidCell;
|
|
88
|
+
private countInvalidCells;
|
|
89
|
+
private getValidatedColumns;
|
|
90
|
+
private validateColumnsOnWorker;
|
|
91
|
+
private applyWorkerResults;
|
|
92
|
+
private applyBatchFailures;
|
|
93
|
+
/**
|
|
94
|
+
* Columns with function validators cannot run in the worker; validate them
|
|
95
|
+
* on the main thread in chunks, yielding between chunks to keep the UI
|
|
96
|
+
* responsive.
|
|
97
|
+
*/
|
|
98
|
+
private validateColumnsOnMainThread;
|
|
99
|
+
private applyCellInvalidState;
|
|
100
|
+
private clearCellInvalidState;
|
|
101
|
+
private runSuppressed;
|
|
102
|
+
private dispatchValidationChanged;
|
|
35
103
|
}
|
|
36
104
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure validation rule functions shared by the main-thread Validate module and
|
|
3
|
+
* the validation Web Worker.
|
|
4
|
+
*
|
|
5
|
+
* Every function is side-effect free and depends only on its arguments — no
|
|
6
|
+
* cell, DOM, or table access — so the same code can run inside a worker where
|
|
7
|
+
* only JSON-serializable data is available. Cell/table-dependent inputs (e.g.
|
|
8
|
+
* the column values needed by `unique`) are passed in through `RuleContext`.
|
|
9
|
+
*
|
|
10
|
+
* Semantics preserved from the original validators: an empty value
|
|
11
|
+
* (`''`, `null`, `undefined`) passes every rule except `required`.
|
|
12
|
+
*/
|
|
13
|
+
/** Extra inputs a rule may need that are not part of the cell value itself. */
|
|
14
|
+
export interface RuleContext {
|
|
15
|
+
/** All values of the cell's column (used by `unique`), excluding the cell's own row. */
|
|
16
|
+
columnValues?: unknown[];
|
|
17
|
+
}
|
|
18
|
+
export type RuleFunction = (value: unknown, parameters?: any, context?: RuleContext) => boolean;
|
|
19
|
+
declare const ruleFunctions: Record<string, RuleFunction>;
|
|
20
|
+
export default ruleFunctions;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
minLength: (_cell: any, value: any, parameters: any) => boolean;
|
|
11
|
-
numeric: (_cell: any, value: any, _parameters: any) => boolean;
|
|
12
|
-
regex: (_cell: any, value: any, parameters: any) => boolean;
|
|
13
|
-
required: (_cell: any, value: any, _parameters: any) => boolean;
|
|
14
|
-
starts: (_cell: any, value: any, parameters: any) => boolean;
|
|
15
|
-
string: (_cell: any, value: any, _parameters: any) => boolean;
|
|
16
|
-
unique: (this: any, cell: any, value: any, _parameters: any) => boolean;
|
|
17
|
-
};
|
|
18
|
-
export default _default;
|
|
1
|
+
import { ICellComponent } from '../../../../../../../types/src/table';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cell-facing validator signature expected by the Validate module and custom
|
|
5
|
+
* consumer validators. Mirrors `ValidatorFunction` in `Validate.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export type CellValidator = (cell: ICellComponent, value: unknown, parameters?: unknown) => boolean;
|
|
8
|
+
declare const validators: Record<string, CellValidator>;
|
|
9
|
+
export default validators;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ValidationWorkerFailureEntry, ValidationWorkerField } from './validation.worker';
|
|
2
|
+
|
|
3
|
+
export type { ValidationWorkerFailureEntry, ValidationWorkerField };
|
|
4
|
+
/**
|
|
5
|
+
* Validates pre-extracted column values against JSON rules on the shared
|
|
6
|
+
* validation worker.
|
|
7
|
+
*
|
|
8
|
+
* Resolves with every failure entry once the worker finishes; `onChunk` fires
|
|
9
|
+
* per processed row chunk for progressive application. Rejects if the worker
|
|
10
|
+
* crashes or cannot start — callers should fall back to synchronous
|
|
11
|
+
* validation.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateBatch(fields: ValidationWorkerField[], onChunk?: (results: ValidationWorkerFailureEntry[]) => void): Promise<ValidationWorkerFailureEntry[]>;
|
|
@@ -63,8 +63,9 @@ export default class CxAssetPicker extends CortexElement {
|
|
|
63
63
|
*/
|
|
64
64
|
onRequestAsset: ((type: AssetTypeString, multiple?: boolean, accepts?: string[], restrictType?: AssetTypeString) => Promise<Asset | Record<string, Asset>>) | undefined;
|
|
65
65
|
/**
|
|
66
|
-
* An optional record ID
|
|
67
|
-
*
|
|
66
|
+
* An optional record ID (or space-separated list of record IDs, for `multiple`
|
|
67
|
+
* pickers) used to fetch a clean preview image and title, bypassing any stored
|
|
68
|
+
* URL/name that may be stale or have transformations applied.
|
|
68
69
|
*/
|
|
69
70
|
recordId: string;
|
|
70
71
|
/** When true, uses the Site Builder search endpoint for asset fetching. */
|
|
@@ -224,7 +224,7 @@ export default class CxBentoGrid extends CortexElement {
|
|
|
224
224
|
private getItemSize;
|
|
225
225
|
/**
|
|
226
226
|
* Determines the number of columns for the grid based on the current
|
|
227
|
-
*
|
|
227
|
+
* window width and breakpoints. Also builds filledData when filler is active.
|
|
228
228
|
*/
|
|
229
229
|
private setupGrid;
|
|
230
230
|
/**
|
|
@@ -10,6 +10,12 @@ export declare class ConfigFormController implements ReactiveController {
|
|
|
10
10
|
private readonly pendingGalleryPickerSaves;
|
|
11
11
|
constructor(host: ReactiveControllerHost & CxConfigForm);
|
|
12
12
|
hostConnected(): void;
|
|
13
|
+
/**
|
|
14
|
+
* `TRX` proxies preserve the asset's original extension. When that extension is not a
|
|
15
|
+
* browser-displayable image format, fall back to the `TR1` transformation proxy, which is
|
|
16
|
+
* always transcoded to a raster format. Mirrors the same fallback in `FetchImageController`
|
|
17
|
+
* (used by the gallery/timeline blocks) and `cx-asset-transformation-dialog`.
|
|
18
|
+
*/
|
|
13
19
|
private resolveAssetFormatSrc;
|
|
14
20
|
private handleStyleChange;
|
|
15
21
|
private handleAttributeChange;
|
|
@@ -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;
|