@zeyos/zx 2.2.1 → 3.0.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/CHANGELOG.md +197 -0
- package/DESIGN-SYSTEM.md +136 -0
- package/MIGRATION.md +155 -4
- package/README.md +51 -14
- package/dist/types/compat/map/data.d.ts +3 -2
- package/dist/types/components/account-menu/account-menu.d.ts +144 -0
- package/dist/types/components/app-rail/app-rail.d.ts +250 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +169 -0
- package/dist/types/components/avatar/avatar.d.ts +100 -0
- package/dist/types/components/chart/chart.d.ts +321 -0
- package/dist/types/components/date-picker/month-picker.d.ts +6 -0
- package/dist/types/components/dialog/dialog.d.ts +9 -0
- package/dist/types/components/dock/dock.d.ts +495 -0
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +14 -0
- package/dist/types/components/field-upload/field-upload.d.ts +37 -4
- package/dist/types/components/form/form.d.ts +25 -3
- package/dist/types/components/grid/grid.d.ts +172 -0
- package/dist/types/components/launcher/launcher.d.ts +300 -0
- package/dist/types/components/layout/layout.d.ts +4 -4
- package/dist/types/components/menu-button/menu-button.d.ts +10 -2
- package/dist/types/components/modal/modal.d.ts +25 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +74 -9
- package/dist/types/components/questionnaire/items.d.ts +327 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +449 -0
- package/dist/types/components/select/select.d.ts +36 -1
- package/dist/types/components/sheet/sheet-stack.d.ts +167 -0
- package/dist/types/components/sheet/sheet.d.ts +294 -0
- package/dist/types/components/split-view/split-view.d.ts +2 -21
- package/dist/types/components/tabbox/tabbox.d.ts +12 -3
- package/dist/types/components/table/table.d.ts +219 -12
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/value-list/value-list.d.ts +24 -3
- package/dist/types/core/dom.d.ts +114 -0
- package/dist/types/core/drag-axis.d.ts +111 -0
- package/dist/types/core/position.d.ts +4 -2
- package/dist/types/index.d.ts +12 -2
- package/dist/zx-compat.esm.js +943 -311
- package/dist/zx-compat.esm.min.js +1 -1
- package/dist/zx-compat.global.js +7893 -2252
- package/dist/zx-compat.global.min.js +3 -3
- package/dist/zx-zeyos.esm.js +826 -114
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +1720 -243
- package/dist/zx.esm.js +8227 -2599
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +8227 -2599
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +2597 -255
- package/docs/llms.md +475 -37
- package/docs/llms.txt +21 -9
- package/package.json +4 -2
- package/src/compat/globals.js +3 -1
- package/src/compat/map/data.js +31 -9
- package/src/components/account-menu/account-menu.css +70 -0
- package/src/components/account-menu/account-menu.js +208 -0
- package/src/components/app-rail/app-rail.css +107 -0
- package/src/components/app-rail/app-rail.js +668 -0
- package/src/components/app-sidebar/app-sidebar.css +68 -0
- package/src/components/app-sidebar/app-sidebar.js +388 -0
- package/src/components/avatar/avatar.css +61 -0
- package/src/components/avatar/avatar.js +222 -0
- package/src/components/button/button.css +0 -1
- package/src/components/chart/chart.css +61 -0
- package/src/components/chart/chart.js +518 -0
- package/src/components/date-picker/date-range-picker.css +7 -0
- package/src/components/date-picker/month-picker.js +9 -0
- package/src/components/dialog/dialog.js +11 -4
- package/src/components/dock/dock.css +228 -0
- package/src/components/dock/dock.js +977 -0
- package/src/components/dropdown/dropdown.js +1 -1
- package/src/components/field/field.js +2 -0
- package/src/components/field-upload/field-upload.js +9 -4
- package/src/components/fieldset/fieldset.css +7 -0
- package/src/components/form/form.css +7 -0
- package/src/components/form/form.js +6 -3
- package/src/components/grid/grid.css +6 -0
- package/src/components/grid/grid.js +213 -0
- package/src/components/launcher/launcher.css +100 -0
- package/src/components/launcher/launcher.js +557 -0
- package/src/components/layout/layout.js +2 -2
- package/src/components/menu-button/menu-button.js +27 -2
- package/src/components/modal/modal.css +5 -1
- package/src/components/modal/modal.js +37 -2
- package/src/components/multi-value-editor/multi-value-editor.css +99 -15
- package/src/components/multi-value-editor/multi-value-editor.js +237 -19
- package/src/components/navigation-bar/navigation-bar.css +7 -0
- package/src/components/questionnaire/items.js +370 -0
- package/src/components/questionnaire/questionnaire.css +387 -0
- package/src/components/questionnaire/questionnaire.js +1033 -0
- package/src/components/search/search.css +10 -2
- package/src/components/select/select.css +6 -1
- package/src/components/select/select.js +99 -11
- package/src/components/sheet/sheet-stack.js +304 -0
- package/src/components/sheet/sheet.css +351 -0
- package/src/components/sheet/sheet.js +551 -0
- package/src/components/split-view/split-view.js +76 -161
- package/src/components/stepper/stepper.css +12 -2
- package/src/components/tabbox/tabbox.css +13 -3
- package/src/components/tabbox/tabbox.js +34 -10
- package/src/components/table/table.css +43 -0
- package/src/components/table/table.js +523 -45
- package/src/components/tooltip/tooltip.js +5 -2
- package/src/components/value-list/value-list.js +6 -3
- package/src/core/dom.js +302 -0
- package/src/core/drag-axis.js +203 -0
- package/src/core/position.js +68 -22
- package/src/index.js +19 -2
- package/styles/tokens/dark.css +15 -13
- package/styles/tokens/global.css +17 -5
- package/styles/tokens/semantic.css +14 -8
- package/styles/tokens/themes.css +72 -0
- package/styles/zx.css +11 -1
- package/dist/types/components/permission/permission.d.ts +0 -93
- package/src/components/permission/permission.css +0 -47
- package/src/components/permission/permission.js +0 -198
|
@@ -4,10 +4,27 @@ export type TableSortDirection = 'asc' | 'desc';
|
|
|
4
4
|
export type TableSelectionMode = false | 'single' | 'multi';
|
|
5
5
|
export type TableEditMode = false | 'cell' | 'row';
|
|
6
6
|
export type TableEditorType = 'text' | 'number' | 'select' | 'date' | 'checkbox' | 'textarea' | 'custom';
|
|
7
|
+
export type TableColumnType = 'text' | 'number' | 'currency' | 'percent' | 'unit';
|
|
7
8
|
export type TableEditorOption = {
|
|
8
9
|
value: unknown;
|
|
9
10
|
label: string;
|
|
10
11
|
};
|
|
12
|
+
export type TableHierarchyOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Row property or callback returning its
|
|
15
|
+
* parent row id. Null and undefined identify a root row.
|
|
16
|
+
*/
|
|
17
|
+
parentId: string | ((row: TableRow) => unknown);
|
|
18
|
+
/**
|
|
19
|
+
* Column that receives indentation and the disclosure control; the
|
|
20
|
+
* first column is used when omitted.
|
|
21
|
+
*/
|
|
22
|
+
column?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Initially expanded branches: all, none, or ids.
|
|
25
|
+
*/
|
|
26
|
+
expanded?: boolean | unknown[];
|
|
27
|
+
};
|
|
11
28
|
export type TableEditorApi = {
|
|
12
29
|
/**
|
|
13
30
|
* Value the cell holds when the editor opens.
|
|
@@ -65,14 +82,37 @@ export type TableColumn = {
|
|
|
65
82
|
* Header tooltip.
|
|
66
83
|
*/
|
|
67
84
|
headerTitle?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Built-in display formatter used when `render` is absent.
|
|
87
|
+
*/
|
|
88
|
+
type?: TableColumnType;
|
|
89
|
+
/**
|
|
90
|
+
* BCP 47 formatting locale.
|
|
91
|
+
*/
|
|
92
|
+
locale?: string | ((row: TableRow) => string | null | undefined);
|
|
93
|
+
/**
|
|
94
|
+
* Fraction digits.
|
|
95
|
+
*/
|
|
96
|
+
decimals?: number | ((row: TableRow) => number | null | undefined);
|
|
97
|
+
/**
|
|
98
|
+
* ISO 4217 code used by a
|
|
99
|
+
* `currency` column.
|
|
100
|
+
*/
|
|
101
|
+
currency?: string | ((row: TableRow) => string | null | undefined);
|
|
102
|
+
/**
|
|
103
|
+
* Suffix used by a `unit`
|
|
104
|
+
* column. Row callbacks support mixed units in one transaction table.
|
|
105
|
+
*/
|
|
106
|
+
unit?: string | ((row: TableRow) => string | null | undefined);
|
|
68
107
|
/**
|
|
69
108
|
* While stacked, whether this column becomes a labelled line.
|
|
70
109
|
* `false` keeps it in the card's headline — the identifying columns usually want that.
|
|
71
110
|
*/
|
|
72
111
|
popin?: boolean;
|
|
73
112
|
/**
|
|
74
|
-
* Editor for this column while the table runs with `editMode`. `true`
|
|
75
|
-
* evaluated per row so individual rows stay
|
|
113
|
+
* Editor for this column while the table runs with `editMode`. `true` infers `'number'` for numeric
|
|
114
|
+
* display types and `'text'` otherwise; a function is evaluated per row so individual rows stay
|
|
115
|
+
* read-only.
|
|
76
116
|
*/
|
|
77
117
|
editable?: boolean | TableEditorType | ((row: TableRow) => boolean | TableEditorType);
|
|
78
118
|
/**
|
|
@@ -177,6 +217,11 @@ export type TableOptions = {
|
|
|
177
217
|
* inert while this is `false`.
|
|
178
218
|
*/
|
|
179
219
|
editMode?: TableEditMode;
|
|
220
|
+
/**
|
|
221
|
+
* Flat parent references projected as an
|
|
222
|
+
* expandable treegrid. Row data and mutation APIs remain flat.
|
|
223
|
+
*/
|
|
224
|
+
hierarchy?: false | TableHierarchyOptions;
|
|
180
225
|
onrowclick?: (event: CustomEvent<TableRowClickDetail>) => void;
|
|
181
226
|
onrowdblclick?: (event: CustomEvent<TableRowClickDetail>) => void;
|
|
182
227
|
onsort?: (event: CustomEvent<TableSortDetail>) => void;
|
|
@@ -201,6 +246,7 @@ export type TableOptions = {
|
|
|
201
246
|
oneditcommit?: (event: CustomEvent<TableEditCommitDetail>) => void;
|
|
202
247
|
oneditcancel?: (event: CustomEvent<TableEditCancelDetail>) => void;
|
|
203
248
|
oneditinvalid?: (event: CustomEvent<TableEditInvalidDetail>) => void;
|
|
249
|
+
onrowtoggle?: (event: CustomEvent<TableRowToggleDetail>) => void;
|
|
204
250
|
};
|
|
205
251
|
export type TableRowClickDetail = {
|
|
206
252
|
row: TableRow;
|
|
@@ -219,6 +265,35 @@ export type TableSelectionDetail = {
|
|
|
219
265
|
export type TableDataDetail = {
|
|
220
266
|
rows: TableRow[];
|
|
221
267
|
};
|
|
268
|
+
export type TableRowToggleDetail = {
|
|
269
|
+
row: TableRow;
|
|
270
|
+
id: unknown;
|
|
271
|
+
expanded: boolean;
|
|
272
|
+
};
|
|
273
|
+
export type TableHierarchyEntry = {
|
|
274
|
+
row: TableRow;
|
|
275
|
+
id: unknown;
|
|
276
|
+
/**
|
|
277
|
+
* Index in the flat input data.
|
|
278
|
+
*/
|
|
279
|
+
index: number;
|
|
280
|
+
/**
|
|
281
|
+
* Zero-based visual depth.
|
|
282
|
+
*/
|
|
283
|
+
depth: number;
|
|
284
|
+
hasChildren: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Canonical parent id, or null for a root.
|
|
287
|
+
*/
|
|
288
|
+
parentId: unknown;
|
|
289
|
+
};
|
|
290
|
+
export type TableHierarchyNode = {
|
|
291
|
+
row: TableRow;
|
|
292
|
+
id: unknown;
|
|
293
|
+
index: number;
|
|
294
|
+
parent: TableHierarchyNode | null;
|
|
295
|
+
children: TableHierarchyNode[];
|
|
296
|
+
};
|
|
222
297
|
export type TableEditStartDetail = {
|
|
223
298
|
/**
|
|
224
299
|
* Row being edited.
|
|
@@ -363,6 +438,9 @@ export type TableEditorEntry = {
|
|
|
363
438
|
* @fires Table#editcommit
|
|
364
439
|
* @fires Table#editcancel
|
|
365
440
|
* @fires Table#editinvalid
|
|
441
|
+
* @fires Table#rowtoggle
|
|
442
|
+
* @fires Table#stackedchange
|
|
443
|
+
* @fires Table#grow
|
|
366
444
|
* @extends {Component<TableOptions>}
|
|
367
445
|
*/
|
|
368
446
|
export declare class Table extends Component<TableOptions> {
|
|
@@ -376,6 +454,11 @@ export declare class Table extends Component<TableOptions> {
|
|
|
376
454
|
render?: (row: TableRow, rowIndex: number) => Node | string | number | null | undefined;
|
|
377
455
|
sortValue?: (row: TableRow) => unknown;
|
|
378
456
|
headerTitle?: string;
|
|
457
|
+
type?: TableColumnType;
|
|
458
|
+
locale?: string | ((row: TableRow) => string | null | undefined);
|
|
459
|
+
decimals?: number | ((row: TableRow) => number | null | undefined);
|
|
460
|
+
currency?: string | ((row: TableRow) => string | null | undefined);
|
|
461
|
+
unit?: string | ((row: TableRow) => string | null | undefined);
|
|
379
462
|
popin?: boolean;
|
|
380
463
|
editable?: boolean | TableEditorType | ((row: TableRow) => boolean | TableEditorType);
|
|
381
464
|
options?: TableEditorOption[] | Record<string, string> | ((row: TableRow) => TableEditorOption[] | Record<string, string>);
|
|
@@ -415,6 +498,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
415
498
|
};
|
|
416
499
|
_rovingCell: any;
|
|
417
500
|
_rovingMatched: boolean;
|
|
501
|
+
_hierarchy: TableHierarchyOptions & {
|
|
502
|
+
column: string;
|
|
503
|
+
};
|
|
504
|
+
_expanded: Set<unknown>;
|
|
418
505
|
_table: HTMLElement;
|
|
419
506
|
_colgroup: HTMLElement;
|
|
420
507
|
_thead: HTMLElement;
|
|
@@ -422,6 +509,7 @@ export declare class Table extends Component<TableOptions> {
|
|
|
422
509
|
_scroll: HTMLElement;
|
|
423
510
|
_selectAll: HTMLElement;
|
|
424
511
|
_headers: Map<any, any>;
|
|
512
|
+
_hierarchyMeta: Map<unknown, TableHierarchyEntry>;
|
|
425
513
|
static cssName: string;
|
|
426
514
|
/** @type {TableOptions} */
|
|
427
515
|
static defaults: TableOptions;
|
|
@@ -481,7 +569,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
481
569
|
* @returns {TableRow|null} Matching row or null.
|
|
482
570
|
*/
|
|
483
571
|
getRow(id: unknown): TableRow | null;
|
|
484
|
-
/**
|
|
572
|
+
/**
|
|
573
|
+
* Returns a shallow copy of the current rows in display order.
|
|
574
|
+
* @returns {TableRow[]} Current table rows.
|
|
575
|
+
*/
|
|
485
576
|
getData(): TableRow[];
|
|
486
577
|
/**
|
|
487
578
|
* Removes all rows.
|
|
@@ -504,7 +595,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
504
595
|
setSort(id: string, dir?: TableSortDirection, options?: {
|
|
505
596
|
silent?: boolean;
|
|
506
597
|
}): this;
|
|
507
|
-
/**
|
|
598
|
+
/**
|
|
599
|
+
* Returns selected rows in current display order.
|
|
600
|
+
* @returns {TableRow[]} Selected rows.
|
|
601
|
+
*/
|
|
508
602
|
getSelection(): TableRow[];
|
|
509
603
|
/**
|
|
510
604
|
* Replaces selected ids, ignoring ids absent from the current data.
|
|
@@ -519,6 +613,58 @@ export declare class Table extends Component<TableOptions> {
|
|
|
519
613
|
* @fires Table#selectionchange
|
|
520
614
|
*/
|
|
521
615
|
clearSelection(): this;
|
|
616
|
+
/**
|
|
617
|
+
* Toggles one hierarchy branch. A leaf or an id absent from the table is a no-op.
|
|
618
|
+
* @param {unknown} id Row id.
|
|
619
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
620
|
+
* @returns {this}
|
|
621
|
+
* @fires Table#rowtoggle
|
|
622
|
+
*/
|
|
623
|
+
toggleRow(id: unknown, options?: {
|
|
624
|
+
silent?: boolean;
|
|
625
|
+
}): this;
|
|
626
|
+
/**
|
|
627
|
+
* Expands one hierarchy branch.
|
|
628
|
+
* @param {unknown} id Row id.
|
|
629
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
630
|
+
* @returns {this}
|
|
631
|
+
* @fires Table#rowtoggle
|
|
632
|
+
*/
|
|
633
|
+
expandRow(id: unknown, options?: {
|
|
634
|
+
silent?: boolean;
|
|
635
|
+
}): this;
|
|
636
|
+
/**
|
|
637
|
+
* Collapses one hierarchy branch without discarding its descendants or their expansion state.
|
|
638
|
+
* @param {unknown} id Row id.
|
|
639
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
640
|
+
* @returns {this}
|
|
641
|
+
* @fires Table#rowtoggle
|
|
642
|
+
*/
|
|
643
|
+
collapseRow(id: unknown, options?: {
|
|
644
|
+
silent?: boolean;
|
|
645
|
+
}): this;
|
|
646
|
+
/**
|
|
647
|
+
* Expands every row that currently has children.
|
|
648
|
+
* @param {{silent?: boolean}} [options={}] Event behavior. When not silent, one `rowtoggle`
|
|
649
|
+
* event is emitted per branch whose state changed.
|
|
650
|
+
* @returns {this}
|
|
651
|
+
*/
|
|
652
|
+
expandAll(options?: {
|
|
653
|
+
silent?: boolean;
|
|
654
|
+
}): this;
|
|
655
|
+
/**
|
|
656
|
+
* Collapses every hierarchy branch.
|
|
657
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
658
|
+
* @returns {this}
|
|
659
|
+
*/
|
|
660
|
+
collapseAll(options?: {
|
|
661
|
+
silent?: boolean;
|
|
662
|
+
}): this;
|
|
663
|
+
/**
|
|
664
|
+
* Returns expanded branch ids in current flat-data order.
|
|
665
|
+
* @returns {unknown[]} Expanded branch ids.
|
|
666
|
+
*/
|
|
667
|
+
getExpanded(): unknown[];
|
|
522
668
|
/**
|
|
523
669
|
* Opens the editor for a cell. No-op unless the table runs with `editMode` and the column
|
|
524
670
|
* resolves to an editable type for that row. In `'row'` mode every editable cell of the row is
|
|
@@ -548,9 +694,15 @@ export declare class Table extends Component<TableOptions> {
|
|
|
548
694
|
* @fires Table#editcancel
|
|
549
695
|
*/
|
|
550
696
|
cancelEdit(): this;
|
|
551
|
-
/**
|
|
697
|
+
/**
|
|
698
|
+
* Reports whether a cell or row is currently open for editing.
|
|
699
|
+
* @returns {boolean} Whether an edit is open.
|
|
700
|
+
*/
|
|
552
701
|
isEditing(): boolean;
|
|
553
|
-
/**
|
|
702
|
+
/**
|
|
703
|
+
* Returns the row id and focused column id for the open edit.
|
|
704
|
+
* @returns {{id: unknown, columnId: string}|null} Editing location, or null.
|
|
705
|
+
*/
|
|
554
706
|
getEditing(): {
|
|
555
707
|
id: unknown;
|
|
556
708
|
columnId: string;
|
|
@@ -560,6 +712,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
560
712
|
* @returns {TableRow[]}
|
|
561
713
|
*/
|
|
562
714
|
_visibleData(): TableRow[];
|
|
715
|
+
/** @returns {TableHierarchyEntry[]} Rows visible after hierarchy expansion, before growing. */
|
|
716
|
+
_projectedData(): TableHierarchyEntry[];
|
|
717
|
+
/** @returns {TableHierarchyEntry[]} Rows that currently have DOM entries. */
|
|
718
|
+
_visibleEntries(): TableHierarchyEntry[];
|
|
563
719
|
/**
|
|
564
720
|
* Renders the next batch of rows.
|
|
565
721
|
* @param {number} [count] How many to add; defaults to the configured batch size.
|
|
@@ -645,17 +801,25 @@ export declare class Table extends Component<TableOptions> {
|
|
|
645
801
|
* @returns {Node|string}
|
|
646
802
|
*/
|
|
647
803
|
_emptyContent(): Node | string;
|
|
648
|
-
/**
|
|
649
|
-
|
|
804
|
+
/**
|
|
805
|
+
* @param {TableRow} row
|
|
806
|
+
* @param {number} index
|
|
807
|
+
* @param {TableHierarchyEntry & {visibleIndex: number}} tree
|
|
808
|
+
* @returns {HTMLTableRowElement}
|
|
809
|
+
*/
|
|
810
|
+
_createRow(row: TableRow, index: number, tree: TableHierarchyEntry & {
|
|
811
|
+
visibleIndex: number;
|
|
812
|
+
}): HTMLTableRowElement;
|
|
650
813
|
/**
|
|
651
814
|
* Fills a cell with the column's rendered value, replacing anything already in it.
|
|
652
815
|
* @param {HTMLTableCellElement} cell Target cell.
|
|
653
816
|
* @param {TableColumn} column Column definition.
|
|
654
817
|
* @param {TableRow} row Row data.
|
|
655
818
|
* @param {number} index Row index.
|
|
819
|
+
* @param {TableHierarchyEntry} [tree] Hierarchy metadata for the row.
|
|
656
820
|
* @returns {void}
|
|
657
821
|
*/
|
|
658
|
-
_renderCellContent(cell: HTMLTableCellElement, column: TableColumn, row: TableRow, index: number): void;
|
|
822
|
+
_renderCellContent(cell: HTMLTableCellElement, column: TableColumn, row: TableRow, index: number, tree?: TableHierarchyEntry): void;
|
|
659
823
|
/** @param {MouseEvent} event @returns {void} */
|
|
660
824
|
_handleBodyClick(event: MouseEvent): void;
|
|
661
825
|
/** @param {MouseEvent} event @returns {void} @fires Table#editstart */
|
|
@@ -749,11 +913,12 @@ export declare class Table extends Component<TableOptions> {
|
|
|
749
913
|
* @returns {string}
|
|
750
914
|
*/
|
|
751
915
|
_msgOr(key: string, fallback: string): string;
|
|
752
|
-
/** @param {{row: TableRow, id: unknown, index: number}} meta @param {boolean} checked @param {boolean} shiftKey @returns {void} */
|
|
916
|
+
/** @param {{row: TableRow, id: unknown, index: number, visibleIndex?: number}} meta @param {boolean} checked @param {boolean} shiftKey @returns {void} */
|
|
753
917
|
_toggleMultiSelection(meta: {
|
|
754
918
|
row: TableRow;
|
|
755
919
|
id: unknown;
|
|
756
920
|
index: number;
|
|
921
|
+
visibleIndex?: number;
|
|
757
922
|
}, checked: boolean, shiftKey: boolean): void;
|
|
758
923
|
/** @returns {void} */
|
|
759
924
|
_syncSelection(): void;
|
|
@@ -763,6 +928,14 @@ export declare class Table extends Component<TableOptions> {
|
|
|
763
928
|
_syncSortHeader(): void;
|
|
764
929
|
/** @returns {void} */
|
|
765
930
|
_sortData(): void;
|
|
931
|
+
/** @param {unknown} id @param {boolean} expanded @param {{silent?: boolean}} options @returns {this} */
|
|
932
|
+
_setRowExpanded(id: unknown, expanded: boolean, options: {
|
|
933
|
+
silent?: boolean;
|
|
934
|
+
}): this;
|
|
935
|
+
/** @param {unknown} id @param {boolean} expanded @returns {void} */
|
|
936
|
+
_emitRowToggle(id: unknown, expanded: boolean): void;
|
|
937
|
+
/** Keeps the reader's current expansion state limited to branches still present in the data. */
|
|
938
|
+
_reconcileExpanded(): void;
|
|
766
939
|
/** @returns {boolean} Whether selection changed. */
|
|
767
940
|
_pruneSelection(): boolean;
|
|
768
941
|
/** @param {TableRow} row @returns {unknown} */
|
|
@@ -785,6 +958,9 @@ export declare class Table extends Component<TableOptions> {
|
|
|
785
958
|
/** @event Table#sort @type {CustomEvent<TableSortDetail>} */
|
|
786
959
|
/** @event Table#selectionchange @type {CustomEvent<TableSelectionDetail>} */
|
|
787
960
|
/** @event Table#datachange @type {CustomEvent<TableDataDetail>} */
|
|
961
|
+
/** @event Table#rowtoggle @type {CustomEvent<TableRowToggleDetail>} */
|
|
962
|
+
/** @event Table#stackedchange @type {CustomEvent<{stacked: boolean}>} */
|
|
963
|
+
/** @event Table#grow @type {CustomEvent<{rendered: number, total: number}>} */
|
|
788
964
|
/**
|
|
789
965
|
* Editor opened for a cell (or, in row mode, for the row).
|
|
790
966
|
* @event Table#editstart
|
|
@@ -807,12 +983,43 @@ export declare class Table extends Component<TableOptions> {
|
|
|
807
983
|
* @event Table#editinvalid
|
|
808
984
|
* @type {CustomEvent<TableEditInvalidDetail>}
|
|
809
985
|
*/
|
|
986
|
+
/**
|
|
987
|
+
* Applies a column's built-in display type. A custom renderer always wins and may still return a
|
|
988
|
+
* Node; all built-in results are strings so `_renderCellContent` can insert them as text.
|
|
989
|
+
* @param {TableColumn} column Column definition.
|
|
990
|
+
* @param {TableRow} row Source row.
|
|
991
|
+
* @param {number} [index=0] Flat row index.
|
|
992
|
+
* @returns {Node|string|number|null|undefined} Rendered cell value.
|
|
993
|
+
*/
|
|
994
|
+
export declare function formatTableCell(column: TableColumn, row: TableRow, index?: number): Node | string | number | null | undefined;
|
|
995
|
+
/**
|
|
996
|
+
* Projects flat parent references into the currently visible stable depth-first order. Orphans
|
|
997
|
+
* become roots. A cycle is broken at its first source row, so every row is emitted once and the
|
|
998
|
+
* traversal can never recurse forever.
|
|
999
|
+
* @param {TableRow[]} rows Flat source rows.
|
|
1000
|
+
* @param {string|((row: TableRow) => unknown)} rowId Row id accessor.
|
|
1001
|
+
* @param {string|((row: TableRow) => unknown)} parentId Parent id accessor.
|
|
1002
|
+
* @param {Set<unknown>|unknown[]} [expanded=[]] Expanded branch ids.
|
|
1003
|
+
* @returns {TableHierarchyEntry[]} Visible hierarchy entries.
|
|
1004
|
+
*/
|
|
1005
|
+
export declare function projectHierarchyRows(rows: TableRow[], rowId: string | ((row: TableRow) => unknown), parentId: string | ((row: TableRow) => unknown), expanded?: Set<unknown> | unknown[]): TableHierarchyEntry[];
|
|
1006
|
+
/**
|
|
1007
|
+
* Sorts roots and each sibling set independently, returning all rows in depth-first order. Parent
|
|
1008
|
+
* and child rows never cross levels merely because their cell values compare differently.
|
|
1009
|
+
* @param {TableRow[]} rows Flat source rows.
|
|
1010
|
+
* @param {string|((row: TableRow) => unknown)} rowId Row id accessor.
|
|
1011
|
+
* @param {string|((row: TableRow) => unknown)} parentId Parent id accessor.
|
|
1012
|
+
* @param {(row: TableRow) => unknown} getValue Sort accessor.
|
|
1013
|
+
* @param {TableSortDirection} direction Sort direction.
|
|
1014
|
+
* @returns {TableRow[]} Sorted flat rows.
|
|
1015
|
+
*/
|
|
1016
|
+
export declare function sortHierarchyRows(rows: TableRow[], rowId: string | ((row: TableRow) => unknown), parentId: string | ((row: TableRow) => unknown), getValue: (row: TableRow) => unknown, direction: TableSortDirection): TableRow[];
|
|
810
1017
|
/**
|
|
811
1018
|
* Resolves the editor type of a column for one row.
|
|
812
1019
|
*
|
|
813
1020
|
* `column.editor` wins over `column.editable`, except that a per-row `editable` function returning
|
|
814
|
-
* `false` still marks the cell read-only. `editable: true`
|
|
815
|
-
* treated as not editable.
|
|
1021
|
+
* `false` still marks the cell read-only. `editable: true` infers `'number'` for number, currency,
|
|
1022
|
+
* percent, and unit columns and `'text'` otherwise; unknown type names are treated as not editable.
|
|
816
1023
|
* @param {TableColumn} column Column definition.
|
|
817
1024
|
* @param {TableRow} row Row the cell belongs to.
|
|
818
1025
|
* @returns {TableEditorType|false} Editor type, or false when the cell is read-only.
|
|
@@ -11,7 +11,7 @@ export type TooltipOptions = {
|
|
|
11
11
|
/**
|
|
12
12
|
* Preferred side; flips when it would overflow.
|
|
13
13
|
*/
|
|
14
|
-
placement?: 'top' | 'bottom' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
14
|
+
placement?: 'top' | 'bottom' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left' | 'right' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
|
|
15
15
|
/**
|
|
16
16
|
* Gap between anchor and bubble in pixels.
|
|
17
17
|
*/
|
|
@@ -57,7 +57,7 @@ export type TooltipOptions = {
|
|
|
57
57
|
/**
|
|
58
58
|
* @typedef {Object} TooltipOptions
|
|
59
59
|
* @property {TooltipContent} [content=''] Bubble content, re-evaluated on each open when a function.
|
|
60
|
-
* @property {'top'|'bottom'|'top-start'|'top-end'|'bottom-start'|'bottom-end'} [placement='top'] Preferred side; flips when it would overflow.
|
|
60
|
+
* @property {'top'|'bottom'|'top-start'|'top-end'|'bottom-start'|'bottom-end'|'left'|'right'|'left-start'|'left-end'|'right-start'|'right-end'} [placement='top'] Preferred side; flips when it would overflow.
|
|
61
61
|
* @property {number} [offset=6] Gap between anchor and bubble in pixels.
|
|
62
62
|
* @property {number} [delay=400] Delay before a hover opens the tooltip, in milliseconds.
|
|
63
63
|
* @property {number} [hideDelay=80] Delay before a leave or blur closes it, in milliseconds.
|
|
@@ -24,6 +24,24 @@ export type ValueListOptions = {
|
|
|
24
24
|
* Value validator.
|
|
25
25
|
*/
|
|
26
26
|
validate?: ((value: string) => boolean | string) | null;
|
|
27
|
+
/**
|
|
28
|
+
* Values change listener.
|
|
29
|
+
*/
|
|
30
|
+
onchange?: (event: CustomEvent<{
|
|
31
|
+
values: string[];
|
|
32
|
+
}>) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Value added listener.
|
|
35
|
+
*/
|
|
36
|
+
onadd?: (event: CustomEvent<{
|
|
37
|
+
value: string;
|
|
38
|
+
}>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Value removed listener.
|
|
41
|
+
*/
|
|
42
|
+
onremove?: (event: CustomEvent<{
|
|
43
|
+
value: string;
|
|
44
|
+
}>) => void;
|
|
27
45
|
};
|
|
28
46
|
/**
|
|
29
47
|
* @typedef {Object} ValueListOptions
|
|
@@ -33,6 +51,9 @@ export type ValueListOptions = {
|
|
|
33
51
|
* @property {boolean} [sortable=true] Whether values can be reordered.
|
|
34
52
|
* @property {boolean} [unique=true] Whether duplicate strings are rejected.
|
|
35
53
|
* @property {((value: string) => boolean|string)|null} [validate=null] Value validator.
|
|
54
|
+
* @property {(event: CustomEvent<{values: string[]}>) => void} [onchange] Values change listener.
|
|
55
|
+
* @property {(event: CustomEvent<{value: string}>) => void} [onadd] Value added listener.
|
|
56
|
+
* @property {(event: CustomEvent<{value: string}>) => void} [onremove] Value removed listener.
|
|
36
57
|
*/
|
|
37
58
|
/**
|
|
38
59
|
* Tag/chip editor. It uses the APG listbox/option focus model: each chip is an option, arrow keys
|
|
@@ -129,15 +150,15 @@ export declare class ValueList extends Component<ValueListOptions> {
|
|
|
129
150
|
/**
|
|
130
151
|
* Values changed event.
|
|
131
152
|
* @event ValueList#change
|
|
132
|
-
* @type {CustomEvent<{values: string[]}>
|
|
153
|
+
* @type {CustomEvent<{values: string[]}>}
|
|
133
154
|
*/
|
|
134
155
|
/**
|
|
135
156
|
* Value added event.
|
|
136
157
|
* @event ValueList#add
|
|
137
|
-
* @type {CustomEvent<{value: string}>
|
|
158
|
+
* @type {CustomEvent<{value: string}>}
|
|
138
159
|
*/
|
|
139
160
|
/**
|
|
140
161
|
* Value removed event.
|
|
141
162
|
* @event ValueList#remove
|
|
142
|
-
* @type {CustomEvent<{value: string}>
|
|
163
|
+
* @type {CustomEvent<{value: string}>}
|
|
143
164
|
*/
|
package/dist/types/core/dom.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type ElementProvider = {
|
|
|
2
2
|
toElement: () => Node | null;
|
|
3
3
|
};
|
|
4
4
|
export type DomChild = Node | string | number | ElementProvider | null | undefined | Array<DomChild>;
|
|
5
|
+
export type DomBuilderProperties = Record<string, any>;
|
|
5
6
|
export type HProps = {
|
|
6
7
|
/**
|
|
7
8
|
* Class name or names.
|
|
@@ -20,6 +21,91 @@ export type HProps = {
|
|
|
20
21
|
*/
|
|
21
22
|
ref?: string;
|
|
22
23
|
};
|
|
24
|
+
export type CompactTag = {
|
|
25
|
+
/**
|
|
26
|
+
* Element tag, defaulting to `div`.
|
|
27
|
+
*/
|
|
28
|
+
tag: string;
|
|
29
|
+
/**
|
|
30
|
+
* Element id.
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* Space-delimited class string.
|
|
35
|
+
*/
|
|
36
|
+
className: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @typedef {Object} CompactTag
|
|
40
|
+
* @property {string} tag Element tag, defaulting to `div`.
|
|
41
|
+
* @property {string} id Element id.
|
|
42
|
+
* @property {string} className Space-delimited class string.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Parses the compact ZeyOS builder grammar: `tag#id.class names`. The order intentionally matches
|
|
46
|
+
* the established function—class text begins at the first dot, then id is read from the remaining
|
|
47
|
+
* tag portion—so thousands of existing call sites retain the same meaning.
|
|
48
|
+
* @param {string} compact Compact element description.
|
|
49
|
+
* @returns {CompactTag}
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseCompactTag(compact: string): CompactTag;
|
|
52
|
+
/**
|
|
53
|
+
* ZeyOS's compact DOM builder, now a first-class Zx primitive. Primitive content is assigned as
|
|
54
|
+
* text and object content is appended as a Node; HTML strings are never parsed.
|
|
55
|
+
*
|
|
56
|
+
* Existing syntax is preserved (`__('button.primary', {Daction: 'save'}, 'Save')`). Zx components
|
|
57
|
+
* exposing `toElement()` are the one additive extension, so a component may replace a UI factory
|
|
58
|
+
* without changing the surrounding builder call.
|
|
59
|
+
* @param {string} compact `tag#id.class names`; an omitted tag creates a `div`.
|
|
60
|
+
* @param {DomBuilderProperties|null} [properties=null] ZeyOS builder properties.
|
|
61
|
+
* @param {unknown} [content=null] Text-safe content.
|
|
62
|
+
* @returns {HTMLElement}
|
|
63
|
+
*/
|
|
64
|
+
export declare function compactElement(compact: string, properties?: DomBuilderProperties | null, content?: unknown): HTMLElement;
|
|
65
|
+
/** Exact migration-facing alias retained for existing ZeyOS builder calls. */
|
|
66
|
+
export declare const __: typeof compactElement;
|
|
67
|
+
/**
|
|
68
|
+
* Applies the established ZeyOS property rules to an existing element:
|
|
69
|
+
* `Dname` → `data-name`, `SfontSize` → `style.fontSize`, `on*` → a legacy-compatible listener,
|
|
70
|
+
* booleans/built-ins → DOM properties, and everything else → attributes.
|
|
71
|
+
* @param {HTMLElement} element Target element.
|
|
72
|
+
* @param {DomBuilderProperties} properties Properties to apply.
|
|
73
|
+
* @returns {HTMLElement} The target, for chaining.
|
|
74
|
+
*/
|
|
75
|
+
export declare function applyCompactProperties(element: HTMLElement, properties: DomBuilderProperties): HTMLElement;
|
|
76
|
+
/**
|
|
77
|
+
* Appends one child and returns the parent: the pure-function equivalent of `parent._(child)`.
|
|
78
|
+
* Primitive values become text; a component exposing `toElement()` is accepted additively.
|
|
79
|
+
* @param {Node} parent Parent node.
|
|
80
|
+
* @param {unknown} child Child content.
|
|
81
|
+
* @returns {Node}
|
|
82
|
+
*/
|
|
83
|
+
export declare function appendContent(parent: Node, child: unknown): Node;
|
|
84
|
+
/**
|
|
85
|
+
* Creates and appends a compact element, returning the parent: the pure equivalent of `parent.__`.
|
|
86
|
+
* @param {Node} parent Parent node.
|
|
87
|
+
* @param {string} compact Compact element description.
|
|
88
|
+
* @param {DomBuilderProperties|null} [properties=null] Builder properties.
|
|
89
|
+
* @param {unknown} [content=null] Text-safe content.
|
|
90
|
+
* @returns {Node}
|
|
91
|
+
*/
|
|
92
|
+
export declare function appendCompact(parent: Node, compact: string, properties?: DomBuilderProperties | null, content?: unknown): Node;
|
|
93
|
+
/**
|
|
94
|
+
* Creates and appends a compact element, returning the child: the pure equivalent of `parent.$__`.
|
|
95
|
+
* @param {Node} parent Parent node.
|
|
96
|
+
* @param {string} compact Compact element description.
|
|
97
|
+
* @param {DomBuilderProperties|null} [properties=null] Builder properties.
|
|
98
|
+
* @param {unknown} [content=null] Text-safe content.
|
|
99
|
+
* @returns {HTMLElement}
|
|
100
|
+
*/
|
|
101
|
+
export declare function appendCompactChild(parent: Node, compact: string, properties?: DomBuilderProperties | null, content?: unknown): HTMLElement;
|
|
102
|
+
/**
|
|
103
|
+
* Creates a document fragment with normalized modern Zx children. Unlike the exact compact
|
|
104
|
+
* builder, this convenience accepts arrays and flattens them like `h()`.
|
|
105
|
+
* @param {...(DomChild|boolean)} children Fragment children.
|
|
106
|
+
* @returns {DocumentFragment}
|
|
107
|
+
*/
|
|
108
|
+
export declare function fragment(...children: (DomChild | boolean)[]): DocumentFragment;
|
|
23
109
|
/**
|
|
24
110
|
* Creates an element and appends normalized children.
|
|
25
111
|
* @param {string} tag Element tag name.
|
|
@@ -84,3 +170,31 @@ export declare function highlightMatch(text: unknown, query: unknown, options?:
|
|
|
84
170
|
* @returns {Element|null}
|
|
85
171
|
*/
|
|
86
172
|
export declare function resolveElement(target: Element | string | ElementProvider | null | undefined): Element | null;
|
|
173
|
+
/**
|
|
174
|
+
* Registers an event with the established ZeyOS callback contract: handlers run newest-first,
|
|
175
|
+
* receive `(event, event.target)` (or the key code for keyboard events), and may return false to
|
|
176
|
+
* prevent the default action. This exported registry is shared by compact properties, removal,
|
|
177
|
+
* and synthetic firing so the legacy `DOM` facade can delegate all three operations to it.
|
|
178
|
+
* @param {EventTarget} target Event target.
|
|
179
|
+
* @param {string} type Event name.
|
|
180
|
+
* @param {Function} handler Listener.
|
|
181
|
+
* @param {boolean} [passive=false] Native passive-listener hint.
|
|
182
|
+
* @returns {EventTarget}
|
|
183
|
+
*/
|
|
184
|
+
export declare function onCompactEvent(target: EventTarget, type: string, handler: Function, passive?: boolean): EventTarget;
|
|
185
|
+
/**
|
|
186
|
+
* Removes one registered handler, matching the established duplicate-registration behavior.
|
|
187
|
+
* @param {EventTarget} target Event target.
|
|
188
|
+
* @param {string} type Event name.
|
|
189
|
+
* @param {Function} handler Handler to remove.
|
|
190
|
+
* @returns {EventTarget}
|
|
191
|
+
*/
|
|
192
|
+
export declare function offCompactEvent(target: EventTarget, type: string, handler: Function): EventTarget;
|
|
193
|
+
/**
|
|
194
|
+
* Invokes compact handlers without dispatching unrelated native listeners.
|
|
195
|
+
* @param {EventTarget} target Event target.
|
|
196
|
+
* @param {string} type Event name.
|
|
197
|
+
* @param {Event|Record<string, any>|null} [event=null] Event-like object.
|
|
198
|
+
* @returns {EventTarget}
|
|
199
|
+
*/
|
|
200
|
+
export declare function fireCompactEvent(target: EventTarget, type: string, event?: Event | Record<string, any> | null): EventTarget;
|