@zeyos/zx 2.3.0 → 4.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 +138 -0
- package/DESIGN-SYSTEM.md +96 -0
- package/README.md +29 -39
- package/dist/types/components/account-menu/account-menu.d.ts +144 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +243 -0
- package/dist/types/components/avatar/avatar.d.ts +100 -0
- package/dist/types/components/card/card.d.ts +128 -0
- package/dist/types/components/chart/chart.d.ts +322 -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 +359 -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 +7 -1
- 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 +51 -0
- 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/table/table.d.ts +223 -15
- 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 +122 -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 +13 -2
- package/dist/types/internal/app-rail.d.ts +265 -0
- package/dist/types/zeyos/icons.d.ts +5 -0
- package/dist/types/zeyos/index.d.ts +2 -1
- package/dist/types/zeyos/launcher.d.ts +147 -0
- package/dist/types/zeyos/select.d.ts +39 -0
- package/dist/zx-zeyos.esm.js +1870 -133
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +2006 -267
- package/dist/zx.esm.js +8987 -2757
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +8987 -2757
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +4396 -2344
- package/docs/llms.md +463 -86
- package/docs/llms.txt +32 -19
- package/package.json +10 -17
- 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-sidebar/app-sidebar.css +80 -0
- package/src/components/app-sidebar/app-sidebar.js +588 -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/card/card.css +149 -0
- package/src/components/card/card.js +285 -0
- package/src/components/chart/chart.css +61 -0
- package/src/components/chart/chart.js +523 -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/form/form.js +6 -3
- package/src/components/grid/grid.css +6 -0
- package/src/components/grid/grid.js +220 -0
- package/src/components/launcher/launcher.css +210 -0
- package/src/components/launcher/launcher.js +765 -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.js +2 -1
- 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/select/field-adapter.js +9 -4
- package/src/components/select/select.css +144 -11
- package/src/components/select/select.js +259 -27
- 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/table/table.css +43 -0
- package/src/components/table/table.js +531 -52
- package/src/components/tooltip/tooltip.js +5 -2
- package/src/components/value-list/value-list.js +6 -3
- package/src/core/dom.js +322 -0
- package/src/core/drag-axis.js +203 -0
- package/src/core/position.js +68 -22
- package/src/index.js +20 -2
- package/src/internal/app-rail.js +718 -0
- package/src/zeyos/icons.js +8 -3
- package/src/zeyos/index.js +7 -1
- package/src/zeyos/launcher.js +338 -0
- package/src/zeyos/modules.js +1 -0
- package/src/zeyos/select.js +115 -1
- package/styles/tokens/dark.css +2 -3
- package/styles/tokens/global.css +6 -6
- package/styles/tokens/modules.css +1 -0
- package/styles/tokens/semantic.css +5 -3
- package/styles/tokens/themes.css +1 -1
- package/styles/zx.css +11 -1
- package/MIGRATION.md +0 -598
- package/dist/types/compat/base.d.ts +0 -156
- package/dist/types/compat/globals.d.ts +0 -20
- package/dist/types/compat/index.d.ts +0 -128
- package/dist/types/compat/map/basic.d.ts +0 -175
- package/dist/types/compat/map/data.d.ts +0 -102
- package/dist/types/compat/map/date-time.d.ts +0 -80
- package/dist/types/compat/map/factory.d.ts +0 -9
- package/dist/types/compat/map/form.d.ts +0 -98
- package/dist/types/compat/map/helpers.d.ts +0 -12
- package/dist/types/compat/map/http.d.ts +0 -36
- package/dist/types/compat/map/layout.d.ts +0 -106
- package/dist/types/compat/map/options.d.ts +0 -80
- package/dist/types/compat/map/select.d.ts +0 -95
- package/dist/types/compat/map/stubs.d.ts +0 -32
- package/dist/types/compat/map/utilities.d.ts +0 -37
- package/dist/types/compat-entry.d.ts +0 -5
- package/dist/types/components/permission/permission.d.ts +0 -96
- package/dist/zx-compat.esm.js +0 -17484
- package/dist/zx-compat.esm.min.js +0 -1
- package/dist/zx-compat.global.js +0 -23635
- package/dist/zx-compat.global.min.js +0 -3
- package/src/compat/base.js +0 -291
- package/src/compat/globals.js +0 -165
- package/src/compat/index.js +0 -84
- package/src/compat/map/basic.js +0 -464
- package/src/compat/map/data.js +0 -232
- package/src/compat/map/date-time.js +0 -177
- package/src/compat/map/factory.js +0 -45
- package/src/compat/map/form.js +0 -330
- package/src/compat/map/helpers.js +0 -46
- package/src/compat/map/http.js +0 -117
- package/src/compat/map/layout.js +0 -256
- package/src/compat/map/options.js +0 -267
- package/src/compat/map/select.js +0 -198
- package/src/compat/map/stubs.js +0 -26
- package/src/compat/map/utilities.js +0 -113
- package/src/compat-entry.js +0 -11
- package/src/components/permission/permission.css +0 -47
- package/src/components/permission/permission.js +0 -201
|
@@ -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,10 +438,14 @@ 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> {
|
|
369
|
-
|
|
447
|
+
_createdRoot: boolean;
|
|
448
|
+
_original: import("../../core/dom.js").TargetSnapshot;
|
|
370
449
|
_columns: {
|
|
371
450
|
id: string;
|
|
372
451
|
label: string;
|
|
@@ -376,6 +455,11 @@ export declare class Table extends Component<TableOptions> {
|
|
|
376
455
|
render?: (row: TableRow, rowIndex: number) => Node | string | number | null | undefined;
|
|
377
456
|
sortValue?: (row: TableRow) => unknown;
|
|
378
457
|
headerTitle?: string;
|
|
458
|
+
type?: TableColumnType;
|
|
459
|
+
locale?: string | ((row: TableRow) => string | null | undefined);
|
|
460
|
+
decimals?: number | ((row: TableRow) => number | null | undefined);
|
|
461
|
+
currency?: string | ((row: TableRow) => string | null | undefined);
|
|
462
|
+
unit?: string | ((row: TableRow) => string | null | undefined);
|
|
379
463
|
popin?: boolean;
|
|
380
464
|
editable?: boolean | TableEditorType | ((row: TableRow) => boolean | TableEditorType);
|
|
381
465
|
options?: TableEditorOption[] | Record<string, string> | ((row: TableRow) => TableEditorOption[] | Record<string, string>);
|
|
@@ -415,6 +499,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
415
499
|
};
|
|
416
500
|
_rovingCell: any;
|
|
417
501
|
_rovingMatched: boolean;
|
|
502
|
+
_hierarchy: TableHierarchyOptions & {
|
|
503
|
+
column: string;
|
|
504
|
+
};
|
|
505
|
+
_expanded: Set<unknown>;
|
|
418
506
|
_table: HTMLElement;
|
|
419
507
|
_colgroup: HTMLElement;
|
|
420
508
|
_thead: HTMLElement;
|
|
@@ -422,6 +510,7 @@ export declare class Table extends Component<TableOptions> {
|
|
|
422
510
|
_scroll: HTMLElement;
|
|
423
511
|
_selectAll: HTMLElement;
|
|
424
512
|
_headers: Map<any, any>;
|
|
513
|
+
_hierarchyMeta: Map<unknown, TableHierarchyEntry>;
|
|
425
514
|
static cssName: string;
|
|
426
515
|
/** @type {TableOptions} */
|
|
427
516
|
static defaults: TableOptions;
|
|
@@ -435,8 +524,8 @@ export declare class Table extends Component<TableOptions> {
|
|
|
435
524
|
render(): HTMLElement;
|
|
436
525
|
/**
|
|
437
526
|
* Toggles a loading state. While loading, the body is dimmed, an indeterminate progress bar is
|
|
438
|
-
* shown, and `aria-busy` is set — a lightweight
|
|
439
|
-
*
|
|
527
|
+
* shown, and `aria-busy` is set — a lightweight enterprise-table busy and skeleton pattern.
|
|
528
|
+
* Call `setLoading(false)` (or `setData`) when done.
|
|
440
529
|
* @param {boolean} [loading=true] Whether the table is loading.
|
|
441
530
|
* @returns {this}
|
|
442
531
|
*/
|
|
@@ -481,7 +570,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
481
570
|
* @returns {TableRow|null} Matching row or null.
|
|
482
571
|
*/
|
|
483
572
|
getRow(id: unknown): TableRow | null;
|
|
484
|
-
/**
|
|
573
|
+
/**
|
|
574
|
+
* Returns a shallow copy of the current rows in display order.
|
|
575
|
+
* @returns {TableRow[]} Current table rows.
|
|
576
|
+
*/
|
|
485
577
|
getData(): TableRow[];
|
|
486
578
|
/**
|
|
487
579
|
* Removes all rows.
|
|
@@ -504,7 +596,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
504
596
|
setSort(id: string, dir?: TableSortDirection, options?: {
|
|
505
597
|
silent?: boolean;
|
|
506
598
|
}): this;
|
|
507
|
-
/**
|
|
599
|
+
/**
|
|
600
|
+
* Returns selected rows in current display order.
|
|
601
|
+
* @returns {TableRow[]} Selected rows.
|
|
602
|
+
*/
|
|
508
603
|
getSelection(): TableRow[];
|
|
509
604
|
/**
|
|
510
605
|
* Replaces selected ids, ignoring ids absent from the current data.
|
|
@@ -519,6 +614,58 @@ export declare class Table extends Component<TableOptions> {
|
|
|
519
614
|
* @fires Table#selectionchange
|
|
520
615
|
*/
|
|
521
616
|
clearSelection(): this;
|
|
617
|
+
/**
|
|
618
|
+
* Toggles one hierarchy branch. A leaf or an id absent from the table is a no-op.
|
|
619
|
+
* @param {unknown} id Row id.
|
|
620
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
621
|
+
* @returns {this}
|
|
622
|
+
* @fires Table#rowtoggle
|
|
623
|
+
*/
|
|
624
|
+
toggleRow(id: unknown, options?: {
|
|
625
|
+
silent?: boolean;
|
|
626
|
+
}): this;
|
|
627
|
+
/**
|
|
628
|
+
* Expands one hierarchy branch.
|
|
629
|
+
* @param {unknown} id Row id.
|
|
630
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
631
|
+
* @returns {this}
|
|
632
|
+
* @fires Table#rowtoggle
|
|
633
|
+
*/
|
|
634
|
+
expandRow(id: unknown, options?: {
|
|
635
|
+
silent?: boolean;
|
|
636
|
+
}): this;
|
|
637
|
+
/**
|
|
638
|
+
* Collapses one hierarchy branch without discarding its descendants or their expansion state.
|
|
639
|
+
* @param {unknown} id Row id.
|
|
640
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
641
|
+
* @returns {this}
|
|
642
|
+
* @fires Table#rowtoggle
|
|
643
|
+
*/
|
|
644
|
+
collapseRow(id: unknown, options?: {
|
|
645
|
+
silent?: boolean;
|
|
646
|
+
}): this;
|
|
647
|
+
/**
|
|
648
|
+
* Expands every row that currently has children.
|
|
649
|
+
* @param {{silent?: boolean}} [options={}] Event behavior. When not silent, one `rowtoggle`
|
|
650
|
+
* event is emitted per branch whose state changed.
|
|
651
|
+
* @returns {this}
|
|
652
|
+
*/
|
|
653
|
+
expandAll(options?: {
|
|
654
|
+
silent?: boolean;
|
|
655
|
+
}): this;
|
|
656
|
+
/**
|
|
657
|
+
* Collapses every hierarchy branch.
|
|
658
|
+
* @param {{silent?: boolean}} [options={}] Event behavior.
|
|
659
|
+
* @returns {this}
|
|
660
|
+
*/
|
|
661
|
+
collapseAll(options?: {
|
|
662
|
+
silent?: boolean;
|
|
663
|
+
}): this;
|
|
664
|
+
/**
|
|
665
|
+
* Returns expanded branch ids in current flat-data order.
|
|
666
|
+
* @returns {unknown[]} Expanded branch ids.
|
|
667
|
+
*/
|
|
668
|
+
getExpanded(): unknown[];
|
|
522
669
|
/**
|
|
523
670
|
* Opens the editor for a cell. No-op unless the table runs with `editMode` and the column
|
|
524
671
|
* resolves to an editable type for that row. In `'row'` mode every editable cell of the row is
|
|
@@ -548,9 +695,15 @@ export declare class Table extends Component<TableOptions> {
|
|
|
548
695
|
* @fires Table#editcancel
|
|
549
696
|
*/
|
|
550
697
|
cancelEdit(): this;
|
|
551
|
-
/**
|
|
698
|
+
/**
|
|
699
|
+
* Reports whether a cell or row is currently open for editing.
|
|
700
|
+
* @returns {boolean} Whether an edit is open.
|
|
701
|
+
*/
|
|
552
702
|
isEditing(): boolean;
|
|
553
|
-
/**
|
|
703
|
+
/**
|
|
704
|
+
* Returns the row id and focused column id for the open edit.
|
|
705
|
+
* @returns {{id: unknown, columnId: string}|null} Editing location, or null.
|
|
706
|
+
*/
|
|
554
707
|
getEditing(): {
|
|
555
708
|
id: unknown;
|
|
556
709
|
columnId: string;
|
|
@@ -560,6 +713,10 @@ export declare class Table extends Component<TableOptions> {
|
|
|
560
713
|
* @returns {TableRow[]}
|
|
561
714
|
*/
|
|
562
715
|
_visibleData(): TableRow[];
|
|
716
|
+
/** @returns {TableHierarchyEntry[]} Rows visible after hierarchy expansion, before growing. */
|
|
717
|
+
_projectedData(): TableHierarchyEntry[];
|
|
718
|
+
/** @returns {TableHierarchyEntry[]} Rows that currently have DOM entries. */
|
|
719
|
+
_visibleEntries(): TableHierarchyEntry[];
|
|
563
720
|
/**
|
|
564
721
|
* Renders the next batch of rows.
|
|
565
722
|
* @param {number} [count] How many to add; defaults to the configured batch size.
|
|
@@ -645,17 +802,25 @@ export declare class Table extends Component<TableOptions> {
|
|
|
645
802
|
* @returns {Node|string}
|
|
646
803
|
*/
|
|
647
804
|
_emptyContent(): Node | string;
|
|
648
|
-
/**
|
|
649
|
-
|
|
805
|
+
/**
|
|
806
|
+
* @param {TableRow} row
|
|
807
|
+
* @param {number} index
|
|
808
|
+
* @param {TableHierarchyEntry & {visibleIndex: number}} tree
|
|
809
|
+
* @returns {HTMLTableRowElement}
|
|
810
|
+
*/
|
|
811
|
+
_createRow(row: TableRow, index: number, tree: TableHierarchyEntry & {
|
|
812
|
+
visibleIndex: number;
|
|
813
|
+
}): HTMLTableRowElement;
|
|
650
814
|
/**
|
|
651
815
|
* Fills a cell with the column's rendered value, replacing anything already in it.
|
|
652
816
|
* @param {HTMLTableCellElement} cell Target cell.
|
|
653
817
|
* @param {TableColumn} column Column definition.
|
|
654
818
|
* @param {TableRow} row Row data.
|
|
655
819
|
* @param {number} index Row index.
|
|
820
|
+
* @param {TableHierarchyEntry} [tree] Hierarchy metadata for the row.
|
|
656
821
|
* @returns {void}
|
|
657
822
|
*/
|
|
658
|
-
_renderCellContent(cell: HTMLTableCellElement, column: TableColumn, row: TableRow, index: number): void;
|
|
823
|
+
_renderCellContent(cell: HTMLTableCellElement, column: TableColumn, row: TableRow, index: number, tree?: TableHierarchyEntry): void;
|
|
659
824
|
/** @param {MouseEvent} event @returns {void} */
|
|
660
825
|
_handleBodyClick(event: MouseEvent): void;
|
|
661
826
|
/** @param {MouseEvent} event @returns {void} @fires Table#editstart */
|
|
@@ -749,11 +914,12 @@ export declare class Table extends Component<TableOptions> {
|
|
|
749
914
|
* @returns {string}
|
|
750
915
|
*/
|
|
751
916
|
_msgOr(key: string, fallback: string): string;
|
|
752
|
-
/** @param {{row: TableRow, id: unknown, index: number}} meta @param {boolean} checked @param {boolean} shiftKey @returns {void} */
|
|
917
|
+
/** @param {{row: TableRow, id: unknown, index: number, visibleIndex?: number}} meta @param {boolean} checked @param {boolean} shiftKey @returns {void} */
|
|
753
918
|
_toggleMultiSelection(meta: {
|
|
754
919
|
row: TableRow;
|
|
755
920
|
id: unknown;
|
|
756
921
|
index: number;
|
|
922
|
+
visibleIndex?: number;
|
|
757
923
|
}, checked: boolean, shiftKey: boolean): void;
|
|
758
924
|
/** @returns {void} */
|
|
759
925
|
_syncSelection(): void;
|
|
@@ -763,6 +929,14 @@ export declare class Table extends Component<TableOptions> {
|
|
|
763
929
|
_syncSortHeader(): void;
|
|
764
930
|
/** @returns {void} */
|
|
765
931
|
_sortData(): void;
|
|
932
|
+
/** @param {unknown} id @param {boolean} expanded @param {{silent?: boolean}} options @returns {this} */
|
|
933
|
+
_setRowExpanded(id: unknown, expanded: boolean, options: {
|
|
934
|
+
silent?: boolean;
|
|
935
|
+
}): this;
|
|
936
|
+
/** @param {unknown} id @param {boolean} expanded @returns {void} */
|
|
937
|
+
_emitRowToggle(id: unknown, expanded: boolean): void;
|
|
938
|
+
/** Keeps the reader's current expansion state limited to branches still present in the data. */
|
|
939
|
+
_reconcileExpanded(): void;
|
|
766
940
|
/** @returns {boolean} Whether selection changed. */
|
|
767
941
|
_pruneSelection(): boolean;
|
|
768
942
|
/** @param {TableRow} row @returns {unknown} */
|
|
@@ -785,6 +959,9 @@ export declare class Table extends Component<TableOptions> {
|
|
|
785
959
|
/** @event Table#sort @type {CustomEvent<TableSortDetail>} */
|
|
786
960
|
/** @event Table#selectionchange @type {CustomEvent<TableSelectionDetail>} */
|
|
787
961
|
/** @event Table#datachange @type {CustomEvent<TableDataDetail>} */
|
|
962
|
+
/** @event Table#rowtoggle @type {CustomEvent<TableRowToggleDetail>} */
|
|
963
|
+
/** @event Table#stackedchange @type {CustomEvent<{stacked: boolean}>} */
|
|
964
|
+
/** @event Table#grow @type {CustomEvent<{rendered: number, total: number}>} */
|
|
788
965
|
/**
|
|
789
966
|
* Editor opened for a cell (or, in row mode, for the row).
|
|
790
967
|
* @event Table#editstart
|
|
@@ -807,12 +984,43 @@ export declare class Table extends Component<TableOptions> {
|
|
|
807
984
|
* @event Table#editinvalid
|
|
808
985
|
* @type {CustomEvent<TableEditInvalidDetail>}
|
|
809
986
|
*/
|
|
987
|
+
/**
|
|
988
|
+
* Applies a column's built-in display type. A custom renderer always wins and may still return a
|
|
989
|
+
* Node; all built-in results are strings so `_renderCellContent` can insert them as text.
|
|
990
|
+
* @param {TableColumn} column Column definition.
|
|
991
|
+
* @param {TableRow} row Source row.
|
|
992
|
+
* @param {number} [index=0] Flat row index.
|
|
993
|
+
* @returns {Node|string|number|null|undefined} Rendered cell value.
|
|
994
|
+
*/
|
|
995
|
+
export declare function formatTableCell(column: TableColumn, row: TableRow, index?: number): Node | string | number | null | undefined;
|
|
996
|
+
/**
|
|
997
|
+
* Projects flat parent references into the currently visible stable depth-first order. Orphans
|
|
998
|
+
* become roots. A cycle is broken at its first source row, so every row is emitted once and the
|
|
999
|
+
* traversal can never recurse forever.
|
|
1000
|
+
* @param {TableRow[]} rows Flat source rows.
|
|
1001
|
+
* @param {string|((row: TableRow) => unknown)} rowId Row id accessor.
|
|
1002
|
+
* @param {string|((row: TableRow) => unknown)} parentId Parent id accessor.
|
|
1003
|
+
* @param {Set<unknown>|unknown[]} [expanded=[]] Expanded branch ids.
|
|
1004
|
+
* @returns {TableHierarchyEntry[]} Visible hierarchy entries.
|
|
1005
|
+
*/
|
|
1006
|
+
export declare function projectHierarchyRows(rows: TableRow[], rowId: string | ((row: TableRow) => unknown), parentId: string | ((row: TableRow) => unknown), expanded?: Set<unknown> | unknown[]): TableHierarchyEntry[];
|
|
1007
|
+
/**
|
|
1008
|
+
* Sorts roots and each sibling set independently, returning all rows in depth-first order. Parent
|
|
1009
|
+
* and child rows never cross levels merely because their cell values compare differently.
|
|
1010
|
+
* @param {TableRow[]} rows Flat source rows.
|
|
1011
|
+
* @param {string|((row: TableRow) => unknown)} rowId Row id accessor.
|
|
1012
|
+
* @param {string|((row: TableRow) => unknown)} parentId Parent id accessor.
|
|
1013
|
+
* @param {(row: TableRow) => unknown} getValue Sort accessor.
|
|
1014
|
+
* @param {TableSortDirection} direction Sort direction.
|
|
1015
|
+
* @returns {TableRow[]} Sorted flat rows.
|
|
1016
|
+
*/
|
|
1017
|
+
export declare function sortHierarchyRows(rows: TableRow[], rowId: string | ((row: TableRow) => unknown), parentId: string | ((row: TableRow) => unknown), getValue: (row: TableRow) => unknown, direction: TableSortDirection): TableRow[];
|
|
810
1018
|
/**
|
|
811
1019
|
* Resolves the editor type of a column for one row.
|
|
812
1020
|
*
|
|
813
1021
|
* `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.
|
|
1022
|
+
* `false` still marks the cell read-only. `editable: true` infers `'number'` for number, currency,
|
|
1023
|
+
* percent, and unit columns and `'text'` otherwise; unknown type names are treated as not editable.
|
|
816
1024
|
* @param {TableColumn} column Column definition.
|
|
817
1025
|
* @param {TableRow} row Row the cell belongs to.
|
|
818
1026
|
* @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,99 @@ 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
|
+
* Returns a trimmed native-link destination unless its parsed scheme can execute document code.
|
|
69
|
+
* Relative URLs, fragments, and ordinary application protocols remain valid; malformed and
|
|
70
|
+
* control-obfuscated script/data schemes are rejected.
|
|
71
|
+
* @param {unknown} value Candidate href.
|
|
72
|
+
* @returns {string|null}
|
|
73
|
+
*/
|
|
74
|
+
export declare function safeHref(value: unknown): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Applies the established ZeyOS property rules to an existing element:
|
|
77
|
+
* `Dname` → `data-name`, `SfontSize` → `style.fontSize`, `on*` → a legacy-compatible listener,
|
|
78
|
+
* booleans/built-ins → DOM properties, and everything else → attributes.
|
|
79
|
+
* @param {HTMLElement} element Target element.
|
|
80
|
+
* @param {DomBuilderProperties} properties Properties to apply.
|
|
81
|
+
* @returns {HTMLElement} The target, for chaining.
|
|
82
|
+
*/
|
|
83
|
+
export declare function applyCompactProperties(element: HTMLElement, properties: DomBuilderProperties): HTMLElement;
|
|
84
|
+
/**
|
|
85
|
+
* Appends one child and returns the parent: the pure-function equivalent of `parent._(child)`.
|
|
86
|
+
* Primitive values become text; a component exposing `toElement()` is accepted additively.
|
|
87
|
+
* @param {Node} parent Parent node.
|
|
88
|
+
* @param {unknown} child Child content.
|
|
89
|
+
* @returns {Node}
|
|
90
|
+
*/
|
|
91
|
+
export declare function appendContent(parent: Node, child: unknown): Node;
|
|
92
|
+
/**
|
|
93
|
+
* Creates and appends a compact element, returning the parent: the pure equivalent of `parent.__`.
|
|
94
|
+
* @param {Node} parent Parent node.
|
|
95
|
+
* @param {string} compact Compact element description.
|
|
96
|
+
* @param {DomBuilderProperties|null} [properties=null] Builder properties.
|
|
97
|
+
* @param {unknown} [content=null] Text-safe content.
|
|
98
|
+
* @returns {Node}
|
|
99
|
+
*/
|
|
100
|
+
export declare function appendCompact(parent: Node, compact: string, properties?: DomBuilderProperties | null, content?: unknown): Node;
|
|
101
|
+
/**
|
|
102
|
+
* Creates and appends a compact element, returning the child: the pure equivalent of `parent.$__`.
|
|
103
|
+
* @param {Node} parent Parent node.
|
|
104
|
+
* @param {string} compact Compact element description.
|
|
105
|
+
* @param {DomBuilderProperties|null} [properties=null] Builder properties.
|
|
106
|
+
* @param {unknown} [content=null] Text-safe content.
|
|
107
|
+
* @returns {HTMLElement}
|
|
108
|
+
*/
|
|
109
|
+
export declare function appendCompactChild(parent: Node, compact: string, properties?: DomBuilderProperties | null, content?: unknown): HTMLElement;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a document fragment with normalized modern Zx children. Unlike the exact compact
|
|
112
|
+
* builder, this convenience accepts arrays and flattens them like `h()`.
|
|
113
|
+
* @param {...(DomChild|boolean)} children Fragment children.
|
|
114
|
+
* @returns {DocumentFragment}
|
|
115
|
+
*/
|
|
116
|
+
export declare function fragment(...children: (DomChild | boolean)[]): DocumentFragment;
|
|
23
117
|
/**
|
|
24
118
|
* Creates an element and appends normalized children.
|
|
25
119
|
* @param {string} tag Element tag name.
|
|
@@ -84,3 +178,31 @@ export declare function highlightMatch(text: unknown, query: unknown, options?:
|
|
|
84
178
|
* @returns {Element|null}
|
|
85
179
|
*/
|
|
86
180
|
export declare function resolveElement(target: Element | string | ElementProvider | null | undefined): Element | null;
|
|
181
|
+
/**
|
|
182
|
+
* Registers an event with the established ZeyOS callback contract: handlers run newest-first,
|
|
183
|
+
* receive `(event, event.target)` (or the key code for keyboard events), and may return false to
|
|
184
|
+
* prevent the default action. This exported registry is shared by compact properties, removal,
|
|
185
|
+
* and synthetic firing so the legacy `DOM` facade can delegate all three operations to it.
|
|
186
|
+
* @param {EventTarget} target Event target.
|
|
187
|
+
* @param {string} type Event name.
|
|
188
|
+
* @param {Function} handler Listener.
|
|
189
|
+
* @param {boolean} [passive=false] Native passive-listener hint.
|
|
190
|
+
* @returns {EventTarget}
|
|
191
|
+
*/
|
|
192
|
+
export declare function onCompactEvent(target: EventTarget, type: string, handler: Function, passive?: boolean): EventTarget;
|
|
193
|
+
/**
|
|
194
|
+
* Removes one registered handler, matching the established duplicate-registration behavior.
|
|
195
|
+
* @param {EventTarget} target Event target.
|
|
196
|
+
* @param {string} type Event name.
|
|
197
|
+
* @param {Function} handler Handler to remove.
|
|
198
|
+
* @returns {EventTarget}
|
|
199
|
+
*/
|
|
200
|
+
export declare function offCompactEvent(target: EventTarget, type: string, handler: Function): EventTarget;
|
|
201
|
+
/**
|
|
202
|
+
* Invokes compact handlers without dispatching unrelated native listeners.
|
|
203
|
+
* @param {EventTarget} target Event target.
|
|
204
|
+
* @param {string} type Event name.
|
|
205
|
+
* @param {Event|Record<string, any>|null} [event=null] Event-like object.
|
|
206
|
+
* @returns {EventTarget}
|
|
207
|
+
*/
|
|
208
|
+
export declare function fireCompactEvent(target: EventTarget, type: string, event?: Event | Record<string, any> | null): EventTarget;
|