@zeyos/zx 5.5.0 → 5.7.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 +210 -0
- package/README.md +73 -7
- package/bin/zx-css.js +328 -0
- package/dist/types/components/account-menu/account-menu.d.ts +4 -2
- package/dist/types/components/activity-list/activity-list.d.ts +14 -8
- package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
- package/dist/types/components/agent-thread/agent-thread.d.ts +711 -0
- package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
- package/dist/types/components/approval-card/approval-card.d.ts +596 -0
- package/dist/types/components/avatar/avatar.d.ts +91 -4
- package/dist/types/components/block-view/block-view.d.ts +205 -0
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
- package/dist/types/components/calendar/calendar-model.d.ts +9 -2
- package/dist/types/components/calendar/calendar.d.ts +12 -4
- package/dist/types/components/chart/chart.d.ts +25 -13
- package/dist/types/components/code-editor/code-editor.d.ts +7 -2
- package/dist/types/components/composer/composer.d.ts +938 -0
- package/dist/types/components/composer/queue.d.ts +76 -0
- package/dist/types/components/copy/copy-button.d.ts +6 -4
- package/dist/types/components/copy/copy-input.d.ts +10 -6
- package/dist/types/components/datebox/date-range-box.d.ts +33 -0
- package/dist/types/components/datebox/placeholder.d.ts +7 -0
- package/dist/types/components/dock/dock.d.ts +12 -3
- package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
- package/dist/types/components/field-upload/field-upload.d.ts +3 -2
- package/dist/types/components/file-item/file-item.d.ts +3 -2
- package/dist/types/components/file-list/file-list.d.ts +14 -8
- package/dist/types/components/filter/filter-model.d.ts +31 -1
- package/dist/types/components/filter/filter.d.ts +20 -2
- package/dist/types/components/finder/finder.d.ts +14 -6
- package/dist/types/components/flag/flag.d.ts +99 -0
- package/dist/types/components/grid/grid.d.ts +1 -1
- package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
- package/dist/types/components/launcher/launcher.d.ts +2 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
- package/dist/types/components/number-field/number-field.d.ts +17 -6
- package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
- package/dist/types/components/prose/prose.d.ts +9 -6
- package/dist/types/components/questionnaire/conditions.d.ts +270 -0
- package/dist/types/components/questionnaire/items.d.ts +52 -30
- package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
- package/dist/types/components/rating/rating.d.ts +5 -3
- package/dist/types/components/run-status/run-status.d.ts +393 -0
- package/dist/types/components/run-trace/run-trace.d.ts +624 -0
- package/dist/types/components/select/country.d.ts +106 -0
- package/dist/types/components/select/field-adapter.d.ts +2 -1
- package/dist/types/components/select/locale.d.ts +102 -0
- package/dist/types/components/select/select.d.ts +41 -2
- package/dist/types/components/slider/slider.d.ts +1 -0
- package/dist/types/components/sort-control/sort-control.d.ts +7 -3
- package/dist/types/components/source-list/source-list.d.ts +179 -0
- package/dist/types/components/split-view/split-view.d.ts +5 -3
- package/dist/types/components/surface/catalog.d.ts +260 -0
- package/dist/types/components/surface/elicit.d.ts +81 -0
- package/dist/types/components/surface/mcp.d.ts +165 -0
- package/dist/types/components/surface/schema.d.ts +314 -0
- package/dist/types/components/surface/stream.d.ts +118 -0
- package/dist/types/components/surface/surface.d.ts +718 -0
- package/dist/types/components/surface/text.d.ts +277 -0
- package/dist/types/components/surface/validate.d.ts +339 -0
- package/dist/types/components/table/table.d.ts +55 -3
- package/dist/types/components/table/window.d.ts +203 -0
- package/dist/types/components/toolbar/toolbar.d.ts +10 -6
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree/tree.d.ts +20 -13
- package/dist/types/core/component.d.ts +10 -0
- package/dist/types/core/date.d.ts +8 -1
- package/dist/types/core/dom.d.ts +1 -0
- package/dist/types/core/http.d.ts +10 -0
- package/dist/types/core/i18n.d.ts +38 -0
- package/dist/types/core/messages.d.ts +479 -1
- package/dist/types/core/storage.d.ts +7 -2
- package/dist/types/elements/define.d.ts +21 -46
- package/dist/types/elements/definitions.d.ts +147 -0
- package/dist/types/elements/kit.d.ts +7 -0
- package/dist/types/elements/reflect.d.ts +6 -3
- package/dist/types/index.d.ts +18 -1
- package/dist/types/internal/agent-model.d.ts +587 -0
- package/dist/types/internal/date-locale.d.ts +7 -0
- package/dist/types/internal/highlight.d.ts +24 -0
- package/dist/types/internal/json-patch.d.ts +146 -0
- package/dist/types/internal/presence-loop.d.ts +148 -0
- package/dist/types/locales/de.d.ts +13 -0
- package/dist/types/locales/en.d.ts +2 -0
- package/dist/types/locales/index.d.ts +823 -0
- package/dist/types/zeyos/view.d.ts +8 -1
- package/dist/zx-zeyos.esm.js +20505 -18748
- package/dist/zx-zeyos.esm.min.js +5 -5
- package/dist/zx.core.css +1276 -0
- package/dist/zx.core.min.css +1 -0
- package/dist/zx.css +2424 -134
- package/dist/zx.esm.js +46167 -28468
- package/dist/zx.esm.min.js +40 -8
- package/dist/zx.global.js +46167 -28468
- package/dist/zx.global.min.js +40 -8
- package/dist/zx.layered.css +17302 -0
- package/dist/zx.layered.min.css +1 -0
- package/dist/zx.min.css +1 -1
- package/docs/agent-catalog.json +12501 -0
- package/docs/agent-surfaces.md +340 -0
- package/docs/api.json +2057 -166
- package/docs/llms.md +1458 -58
- package/docs/llms.txt +38 -8
- package/package.json +29 -6
- package/src/components/account-menu/account-menu.js +6 -3
- package/src/components/activity-item/activity-item.js +2 -1
- package/src/components/activity-list/activity-list.js +16 -10
- package/src/components/agent-thread/ag-ui.js +1439 -0
- package/src/components/agent-thread/agent-thread.css +417 -0
- package/src/components/agent-thread/agent-thread.js +1670 -0
- package/src/components/agent-thread/ui-message-stream.js +1281 -0
- package/src/components/app-sidebar/app-sidebar.js +18 -8
- package/src/components/approval-card/approval-card.css +289 -0
- package/src/components/approval-card/approval-card.js +1378 -0
- package/src/components/avatar/avatar.css +56 -1
- package/src/components/avatar/avatar.js +148 -26
- package/src/components/block-view/block-view.css +300 -0
- package/src/components/block-view/block-view.js +524 -0
- package/src/components/breadcrumb/breadcrumb.js +8 -5
- package/src/components/calendar/calendar-model.js +8 -2
- package/src/components/calendar/calendar.js +53 -18
- package/src/components/chart/chart.js +54 -23
- package/src/components/code-editor/code-editor.js +45 -8
- package/src/components/code-editor/field-adapter.js +1 -1
- package/src/components/composer/composer.css +482 -0
- package/src/components/composer/composer.js +1815 -0
- package/src/components/composer/queue.js +78 -0
- package/src/components/context-menu/context-menu.js +12 -1
- package/src/components/copy/copy-button.js +9 -7
- package/src/components/copy/copy-input.js +10 -6
- package/src/components/date-picker/date-picker.js +2 -1
- package/src/components/date-picker/date-range-picker.js +8 -7
- package/src/components/datebox/date-range-box.js +3 -9
- package/src/components/datebox/datebox.js +18 -21
- package/src/components/datebox/placeholder.js +18 -0
- package/src/components/dialog/dialog.js +1 -1
- package/src/components/dock/dock.js +34 -13
- package/src/components/entity-ref/entity-ref.js +16 -5
- package/src/components/field-upload/field-upload.js +81 -38
- package/src/components/file-item/file-item.js +70 -40
- package/src/components/file-list/file-list.js +15 -9
- package/src/components/filter/filter-model.js +46 -8
- package/src/components/filter/filter.css +3 -3
- package/src/components/filter/filter.js +29 -10
- package/src/components/filter-panel/filter-panel.js +13 -5
- package/src/components/finder/finder.js +50 -26
- package/src/components/flag/flag.css +40 -0
- package/src/components/flag/flag.js +177 -0
- package/src/components/form/form.js +1 -1
- package/src/components/grid/grid.js +22 -8
- package/src/components/kanban-view/kanban-view.js +51 -81
- package/src/components/launcher/launcher.js +17 -2
- package/src/components/list-toolbar/list-toolbar.js +2 -1
- package/src/components/master-panel/master-panel.js +1 -1
- package/src/components/menu-button/menu-button.js +4 -0
- package/src/components/message/message.js +3 -0
- package/src/components/multi-value-editor/multi-value-editor.js +10 -9
- package/src/components/navigation-bar/navigation-bar.js +3 -3
- package/src/components/number-field/number-field.js +29 -13
- package/src/components/prompt-starters/prompt-starters.css +91 -0
- package/src/components/prompt-starters/prompt-starters.js +206 -0
- package/src/components/prose/prose.js +14 -10
- package/src/components/questionnaire/conditions.js +666 -0
- package/src/components/questionnaire/items.js +150 -41
- package/src/components/questionnaire/questionnaire.js +126 -32
- package/src/components/rating/rating.js +5 -4
- package/src/components/run-status/run-status.css +208 -0
- package/src/components/run-status/run-status.js +782 -0
- package/src/components/run-trace/run-trace.css +443 -0
- package/src/components/run-trace/run-trace.js +1209 -0
- package/src/components/select/country.js +136 -0
- package/src/components/select/field-adapter.js +7 -2
- package/src/components/select/locale.js +219 -0
- package/src/components/select/select.css +20 -22
- package/src/components/select/select.js +94 -12
- package/src/components/sheet/sheet-stack.js +10 -1
- package/src/components/slider/slider.js +7 -2
- package/src/components/sort-control/sort-control.js +15 -5
- package/src/components/source-list/source-list.css +208 -0
- package/src/components/source-list/source-list.js +358 -0
- package/src/components/split-view/split-view.js +5 -3
- package/src/components/surface/catalog.js +1334 -0
- package/src/components/surface/elicit.js +107 -0
- package/src/components/surface/mcp.js +243 -0
- package/src/components/surface/schema.js +644 -0
- package/src/components/surface/stream.js +245 -0
- package/src/components/surface/surface.css +308 -0
- package/src/components/surface/surface.js +2291 -0
- package/src/components/surface/text.js +513 -0
- package/src/components/surface/validate.js +2218 -0
- package/src/components/tabbox/tabbox.js +9 -0
- package/src/components/table/table.css +63 -3
- package/src/components/table/table.js +167 -28
- package/src/components/table/window.js +317 -0
- package/src/components/toolbar/toolbar.js +12 -7
- package/src/components/tooltip/tooltip.css +2 -3
- package/src/components/tooltip/tooltip.js +32 -5
- package/src/components/tree/tree.js +53 -23
- package/src/core/component.js +25 -1
- package/src/core/date.js +62 -16
- package/src/core/dom.js +22 -2
- package/src/core/format.js +15 -13
- package/src/core/http.js +29 -20
- package/src/core/i18n.js +83 -10
- package/src/core/keyboard.js +79 -8
- package/src/core/messages.js +519 -2
- package/src/core/overlay-host.js +1 -0
- package/src/core/storage.js +59 -6
- package/src/elements/define.js +178 -130
- package/src/elements/definitions.js +229 -0
- package/src/elements/kit.js +444 -0
- package/src/elements/reflect.js +8 -3
- package/src/index.js +18 -1
- package/src/internal/agent-model.js +488 -0
- package/src/internal/date-locale.js +11 -0
- package/src/internal/highlight.js +104 -0
- package/src/internal/json-patch.js +405 -0
- package/src/internal/presence-loop.js +343 -0
- package/src/locales/de.js +911 -0
- package/src/locales/en.js +2 -0
- package/src/locales/index.js +7 -0
- package/src/zeyos/calendar.js +2 -1
- package/src/zeyos/form.js +2 -1
- package/src/zeyos/launcher.js +7 -6
- package/src/zeyos/module-bar.js +2 -1
- package/src/zeyos/schema.js +37 -23
- package/src/zeyos/select.js +4 -3
- package/src/zeyos/table.js +2 -13
- package/src/zeyos/view.js +57 -17
- package/styles/core.css +11 -0
- package/styles/tokens/semantic.css +1 -0
- package/styles/zeyos.css +2 -0
- package/styles/zx.css +11 -8
- package/styles/zx.layered.css +1 -0
|
@@ -311,6 +311,8 @@ export class Tabbox extends Component {
|
|
|
311
311
|
disableTab(name) {
|
|
312
312
|
const record = this._require(name);
|
|
313
313
|
if (record.definition.disabled) return this;
|
|
314
|
+
const held = record.tab.contains(document.activeElement);
|
|
315
|
+
const wasStop = record.tab.tabIndex === 0;
|
|
314
316
|
if (record === this._active) {
|
|
315
317
|
const replacement = this._enabledTabs().find((item) => item !== record) ?? null;
|
|
316
318
|
if (replacement) {
|
|
@@ -327,6 +329,10 @@ export class Tabbox extends Component {
|
|
|
327
329
|
record.definition.disabled = true;
|
|
328
330
|
record.tab.setAttribute('aria-disabled', 'true');
|
|
329
331
|
record.tab.tabIndex = -1;
|
|
332
|
+
if (held || wasStop) {
|
|
333
|
+
const replacement = this._active ?? this._enabledTabs()[0];
|
|
334
|
+
if (replacement) this._setFocused(replacement, held);
|
|
335
|
+
}
|
|
330
336
|
return this;
|
|
331
337
|
}
|
|
332
338
|
|
|
@@ -393,6 +399,8 @@ export class Tabbox extends Component {
|
|
|
393
399
|
const record = this._find(name);
|
|
394
400
|
if (!record) return false;
|
|
395
401
|
const index = this._tabs.indexOf(record);
|
|
402
|
+
const held = record.tab.contains(document.activeElement);
|
|
403
|
+
const wasStop = record.tab.tabIndex === 0;
|
|
396
404
|
const remaining = this._tabs.filter((item) => item !== record);
|
|
397
405
|
const enabled = remaining.filter((item) => !item.definition.disabled);
|
|
398
406
|
const replacement = enabled.find((item) => this._tabs.indexOf(item) > index) ?? enabled.at(-1) ?? null;
|
|
@@ -411,6 +419,7 @@ export class Tabbox extends Component {
|
|
|
411
419
|
this._active = null;
|
|
412
420
|
if (replacement) this._applyActive(replacement);
|
|
413
421
|
}
|
|
422
|
+
if ((held || wasStop) && replacement) this._setFocused(replacement, held);
|
|
414
423
|
if (emitClose) this.emit('close', { name: record.definition.name });
|
|
415
424
|
return true;
|
|
416
425
|
}
|
|
@@ -377,7 +377,8 @@
|
|
|
377
377
|
border-block-end: 0;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
.zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"])
|
|
380
|
+
.zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"]),
|
|
381
|
+
.zx-table__scroll[data-zebra="index"] .zx-table__body tr[data-stripe]:not([aria-selected="true"]) {
|
|
381
382
|
--zx-table-row-fill: var(--zx-color-bg-page);
|
|
382
383
|
background: var(--zx-table-row-fill);
|
|
383
384
|
}
|
|
@@ -401,7 +402,8 @@
|
|
|
401
402
|
/* State is never lost under the pointer: a selected, current or striped row lays the hover step
|
|
402
403
|
over its own fill instead of trading it for the hover fill. */
|
|
403
404
|
.zx-table__body tr[data-row][aria-selected="true"]:hover,
|
|
404
|
-
.zx-table__scroll[data-zebra="true"] .zx-table__body tr[data-row]:nth-child(even):not([aria-selected="true"]):hover
|
|
405
|
+
.zx-table__scroll[data-zebra="true"] .zx-table__body tr[data-row]:nth-child(even):not([aria-selected="true"]):hover,
|
|
406
|
+
.zx-table__scroll[data-zebra="index"] .zx-table__body tr[data-stripe]:not([aria-selected="true"]):hover {
|
|
405
407
|
background: linear-gradient(var(--zx-table-row-hover-bg, var(--zx-color-bg-hover)),
|
|
406
408
|
var(--zx-table-row-hover-bg, var(--zx-color-bg-hover))), var(--zx-table-row-fill);
|
|
407
409
|
}
|
|
@@ -433,7 +435,8 @@
|
|
|
433
435
|
}
|
|
434
436
|
|
|
435
437
|
/* The stripe's own rule paints this fill, and the hover step lays over it, so nothing more. */
|
|
436
|
-
.zx-table[data-variant="plain"] .zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"])
|
|
438
|
+
.zx-table[data-variant="plain"] .zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"]),
|
|
439
|
+
.zx-table[data-variant="plain"] .zx-table__scroll[data-zebra="index"] .zx-table__body tr[data-stripe]:not([aria-selected="true"]) {
|
|
437
440
|
--zx-table-row-fill: transparent;
|
|
438
441
|
}
|
|
439
442
|
|
|
@@ -803,3 +806,60 @@
|
|
|
803
806
|
background: var(--zx-color-bg-hover);
|
|
804
807
|
color: var(--zx-color-text);
|
|
805
808
|
}
|
|
809
|
+
|
|
810
|
+
/* --- Windowed rendering (Table virtual) ----------------------------------------------------- */
|
|
811
|
+
|
|
812
|
+
/* A windowed table cannot grow with its rows, so the window height is the most it takes unless
|
|
813
|
+
`height` says otherwise. Scroll anchoring stays off: the rows it would anchor to are the ones
|
|
814
|
+
the window replaces, and the spacers already keep everything in place. */
|
|
815
|
+
.zx-table[data-virtual] .zx-table__scroll {
|
|
816
|
+
max-block-size: 100dvh;
|
|
817
|
+
overflow-anchor: none;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/* One height for every row: text is cut short rather than wrapped into a taller row. */
|
|
821
|
+
.zx-table[data-virtual]:not([data-stacked]) .zx-table__body > tr[data-row] > :is(td[data-column]:not([data-editing]), .zx-table__section-cell) {
|
|
822
|
+
overflow: hidden;
|
|
823
|
+
text-overflow: ellipsis;
|
|
824
|
+
white-space: nowrap;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/* After the row, stacked, and empty rules above, which a spacer must take nothing from. Its height
|
|
828
|
+
is set inline from the rows it stands in for. */
|
|
829
|
+
.zx-table .zx-table__body > tr.zx-table__spacer {
|
|
830
|
+
padding: 0;
|
|
831
|
+
border: 0;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
.zx-table .zx-table__body > tr.zx-table__spacer > td {
|
|
835
|
+
padding: 0;
|
|
836
|
+
border: 0;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/* What a row is tall in this table, in a box the window can watch. */
|
|
840
|
+
.zx-table__row-probe {
|
|
841
|
+
position: absolute;
|
|
842
|
+
inset-block-start: 0;
|
|
843
|
+
inline-size: 0;
|
|
844
|
+
block-size: var(--zx-row-height);
|
|
845
|
+
visibility: hidden;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
.zx-table[data-edit-mode] .zx-table__row-probe {
|
|
849
|
+
block-size: max(var(--zx-row-height), calc(var(--zx-control-height) + 1px));
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/* Paper has no scroll position to keep: the drawn rows print without the height of the others. */
|
|
853
|
+
@media print {
|
|
854
|
+
.zx-table .zx-table__body > tr.zx-table__spacer {
|
|
855
|
+
display: none;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.zx-table[data-virtual] .zx-table__scroll {
|
|
859
|
+
max-block-size: none;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
.zx-scope .zx-table__scroll[data-zebra="index"] .zx-table__body tr[data-stripe]:not([aria-selected="true"]) {
|
|
863
|
+
background: transparent;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
@@ -10,6 +10,7 @@ import { NumberField } from '../number-field/number-field.js';
|
|
|
10
10
|
import { Select } from '../select/select.js';
|
|
11
11
|
import { Toggle } from '../toggle/toggle.js';
|
|
12
12
|
import { sortRows } from './sort.js';
|
|
13
|
+
import { RowWindow } from './window.js';
|
|
13
14
|
|
|
14
15
|
/** @typedef {Record<string, any>} TableRow */
|
|
15
16
|
/** @typedef {'asc'|'desc'} TableSortDirection */
|
|
@@ -114,6 +115,15 @@ import { sortRows } from './sort.js';
|
|
|
114
115
|
* @property {false|number} [growing=false] Number of rows to render at first, with a control that
|
|
115
116
|
* appends the next batch on demand. A result set an ERP query returns happily — tens of thousands
|
|
116
117
|
* of rows — costs more to lay out than anyone will ever scroll through.
|
|
118
|
+
* @property {boolean} [virtual=false] Windowed rendering: only the rows in view and one viewport of
|
|
119
|
+
* overscan above and below are in the DOM, with spacer rows keeping the scroll height. The table
|
|
120
|
+
* stays one grid over all of its rows, so this implies `interactive`, the header checkbox and
|
|
121
|
+
* Ctrl/Cmd+A take every row, drawn or not, and the row that has focus or is being edited stays drawn
|
|
122
|
+
* wherever it is. It needs a bounded scroll region: give it `height`,
|
|
123
|
+
* or the region stops at the height of the window. Every row takes the height of one measured row,
|
|
124
|
+
* rows of differing height are not supported, and column widths cannot follow content that is not
|
|
125
|
+
* drawn, so `auto` columns share the width evenly. Find-in-page does not see rows that are not
|
|
126
|
+
* drawn. Wins over `growing`.
|
|
117
127
|
* @property {false|'sm'|'md'|'lg'|'xl'} [responsive=false] Width below which each row stacks into a
|
|
118
128
|
* card of label/value pairs instead of scrolling sideways. Measured on the table's own container,
|
|
119
129
|
* not the viewport, so a table inside a split pane stacks when *it* is narrow.
|
|
@@ -281,7 +291,9 @@ const FOCUSABLE = 'input, textarea, select, button, [tabindex]:not([tabindex="-1
|
|
|
281
291
|
* does not scroll). Enter activates the row exactly as a click does (`rowclick`), Space toggles the
|
|
282
292
|
* row's selection when `selectable` (and activates otherwise), Shift+Arrow extends a `multi`
|
|
283
293
|
* selection, and Ctrl/Cmd+A selects every rendered row. The focused row survives `setData`, sorting,
|
|
284
|
-
* expansion, and `updateRow`. Column headers keep their sort buttons in the Tab order.
|
|
294
|
+
* expansion, and `updateRow`. Column headers keep their sort buttons in the Tab order. With `virtual`
|
|
295
|
+
* all of this runs over every row, drawn or not: the keys draw the row they move to, and a selection
|
|
296
|
+
* reaches rows that are not in the DOM.
|
|
285
297
|
* @fires Table#rowclick
|
|
286
298
|
* @fires Table#rowdblclick
|
|
287
299
|
* @fires Table#sort
|
|
@@ -313,6 +325,7 @@ export class Table extends Component {
|
|
|
313
325
|
stickyHeader: true,
|
|
314
326
|
responsive: false,
|
|
315
327
|
growing: false,
|
|
328
|
+
virtual: false,
|
|
316
329
|
height: null,
|
|
317
330
|
emptyText: null,
|
|
318
331
|
rowClass: null,
|
|
@@ -373,7 +386,13 @@ export class Table extends Component {
|
|
|
373
386
|
this._editMessage = null;
|
|
374
387
|
this._stacked = false;
|
|
375
388
|
this._width = null;
|
|
376
|
-
this.
|
|
389
|
+
this._virtual = Boolean(this.options.virtual);
|
|
390
|
+
if (this._virtual && growStep(this.options.growing)) {
|
|
391
|
+
console.warn('[zx.Table] `growing` is ignored: `virtual` already decides which rows are drawn.');
|
|
392
|
+
}
|
|
393
|
+
this._growStep = this._virtual ? null : growStep(this.options.growing);
|
|
394
|
+
// Both keep only part of the rows in the DOM, so both have to say where each row really is.
|
|
395
|
+
this._indexed = Boolean(this._growStep || this._virtual);
|
|
377
396
|
this._rendered = this._growStep ?? Infinity;
|
|
378
397
|
this._more = null;
|
|
379
398
|
// Keyboard focus. `_current` is the row (and, with cell focus, the column) holding the grid's
|
|
@@ -381,7 +400,7 @@ export class Table extends Component {
|
|
|
381
400
|
this._focusMode = this._editMode === false ? 'row' : 'cell';
|
|
382
401
|
// `_clickListened` is set by `addEventListener()`, which the base constructor runs for `on…`
|
|
383
402
|
// options before this method; it is deliberately not reset here.
|
|
384
|
-
this._interactive = Boolean(this.options.interactive || this.options.selectable
|
|
403
|
+
this._interactive = Boolean(this.options.interactive || this.options.selectable || this._virtual
|
|
385
404
|
|| this._editMode !== false || normalizeHierarchy(this.options.hierarchy, this._columns)
|
|
386
405
|
|| this._clickListened);
|
|
387
406
|
this._current = null;
|
|
@@ -418,9 +437,26 @@ export class Table extends Component {
|
|
|
418
437
|
class: 'zx-table__scroll',
|
|
419
438
|
dataset: {
|
|
420
439
|
stickyHeader: String(Boolean(this.options.stickyHeader)),
|
|
421
|
-
|
|
440
|
+
// Stripes follow the row's place in the data while windowed: `:nth-child` would count the
|
|
441
|
+
// spacers, and the stripes would swap as the window moved.
|
|
442
|
+
zebra: this._virtual && this.options.zebra ? 'index' : String(Boolean(this.options.zebra))
|
|
422
443
|
}
|
|
423
444
|
}, this._table);
|
|
445
|
+
this._window = null;
|
|
446
|
+
if (this._virtual) {
|
|
447
|
+
root.dataset.virtual = '';
|
|
448
|
+
this._window = new RowWindow({
|
|
449
|
+
scroller: this._scroll,
|
|
450
|
+
body: this._tbody,
|
|
451
|
+
head: this._thead,
|
|
452
|
+
sticky: Boolean(this.options.stickyHeader),
|
|
453
|
+
draw: (entry) => this._createRow(entry.row, entry.index, entry),
|
|
454
|
+
release: (row) => this._releaseRow(row),
|
|
455
|
+
pins: () => this._windowPins(),
|
|
456
|
+
colspan: () => this._spanColspan(),
|
|
457
|
+
changed: () => { if (this._stacked) this._applyStackedRoles(true); }
|
|
458
|
+
});
|
|
459
|
+
}
|
|
424
460
|
this._rowMoveMessage = this.options.rowReorder ? h('div', {
|
|
425
461
|
class: 'zx-table__reorder-status', role: 'status', ariaLive: 'polite'
|
|
426
462
|
}) : null;
|
|
@@ -449,6 +485,10 @@ export class Table extends Component {
|
|
|
449
485
|
this._renderHeader();
|
|
450
486
|
this._renderBody();
|
|
451
487
|
this._watchWidth();
|
|
488
|
+
if (this._window) {
|
|
489
|
+
this._window.start();
|
|
490
|
+
this.listen(this._scroll, 'scroll', () => this._window.update(), { passive: true });
|
|
491
|
+
}
|
|
452
492
|
this.listen(this._tbody, 'click', (event) => this._handleBodyClick(event));
|
|
453
493
|
this.listen(this._tbody, 'dblclick', (event) => this._handleBodyDoubleClick(event));
|
|
454
494
|
if (this.options.rowReorder) {
|
|
@@ -688,7 +728,8 @@ export class Table extends Component {
|
|
|
688
728
|
const column = this._columns.find((candidate) => candidate.id === String(id));
|
|
689
729
|
const index = this.getColumnOrder().indexOf(String(id));
|
|
690
730
|
if (column && index >= 0) {
|
|
691
|
-
this._columnStatus.textContent =
|
|
731
|
+
this._columnStatus.textContent = this._message('table.columnMoved', 'Moved %1 to position %2 of %3.',
|
|
732
|
+
[tableColumnName(column), index + 1, this._columns.length]);
|
|
692
733
|
}
|
|
693
734
|
}
|
|
694
735
|
return this;
|
|
@@ -762,7 +803,8 @@ export class Table extends Component {
|
|
|
762
803
|
if (this._rowMoveMessage) {
|
|
763
804
|
const siblings = this._siblingIds(id);
|
|
764
805
|
const index = siblings.findIndex((candidate) => Object.is(candidate, id));
|
|
765
|
-
this._rowMoveMessage.textContent =
|
|
806
|
+
this._rowMoveMessage.textContent = this._message('table.rowMoved', 'Moved row to position %1 of %2.',
|
|
807
|
+
[index + 1, siblings.length]);
|
|
766
808
|
}
|
|
767
809
|
this._emitDataChange();
|
|
768
810
|
queueMicrotask(() => this._rowHandle(id)?.focus());
|
|
@@ -1014,7 +1056,7 @@ export class Table extends Component {
|
|
|
1014
1056
|
const index = this._data.findIndex((candidate) => Object.is(this._idFor(candidate), rowId));
|
|
1015
1057
|
if (index < 0) return this;
|
|
1016
1058
|
const row = this._data[index];
|
|
1017
|
-
const tr = this.
|
|
1059
|
+
const tr = this._rowById(rowId);
|
|
1018
1060
|
if (!tr) return this;
|
|
1019
1061
|
const targets = this._editMode === 'row'
|
|
1020
1062
|
? this._visibleColumns().filter((candidate) => resolveEditable(candidate, row) !== false)
|
|
@@ -1179,9 +1221,87 @@ export class Table extends Component {
|
|
|
1179
1221
|
* @returns {number}
|
|
1180
1222
|
*/
|
|
1181
1223
|
getRenderedCount() {
|
|
1224
|
+
if (this._window) return this._window.drawn.size;
|
|
1182
1225
|
return Math.min(this._rendered, this._projectedData().length);
|
|
1183
1226
|
}
|
|
1184
1227
|
|
|
1228
|
+
/**
|
|
1229
|
+
* Scrolls a row into view. A windowed table draws it first, so a row that is not in the DOM can
|
|
1230
|
+
* be reached by id; rows outside the data, in a collapsed branch, or held back by `growing` cannot.
|
|
1231
|
+
* @param {unknown} id Row id.
|
|
1232
|
+
* @returns {boolean} Whether the row is in view now.
|
|
1233
|
+
*/
|
|
1234
|
+
reveal(id) {
|
|
1235
|
+
if (this._window) return Boolean(this._rowById(id, true));
|
|
1236
|
+
const tr = this._rowElements.get(id)?.[0];
|
|
1237
|
+
tr?.scrollIntoView({ block: 'nearest' });
|
|
1238
|
+
return Boolean(tr);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* The element of a row, drawing it first when a windowed table has not.
|
|
1243
|
+
* @param {unknown} id Row id.
|
|
1244
|
+
* @param {boolean} [scroll=false] Whether a row that is already drawn is scrolled into view too.
|
|
1245
|
+
* @returns {HTMLTableRowElement|undefined}
|
|
1246
|
+
*/
|
|
1247
|
+
_rowById(id, scroll = false) {
|
|
1248
|
+
const drawn = this._rowElements.get(id)?.[0];
|
|
1249
|
+
if (!this._window || drawn && !scroll) return drawn;
|
|
1250
|
+
const position = this._hierarchyMeta?.get(id)?.visibleIndex;
|
|
1251
|
+
if (position === undefined) return undefined;
|
|
1252
|
+
return /** @type {HTMLTableRowElement|undefined} */ (this._window.reveal(position) ?? undefined);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Rows a windowed table keeps drawn wherever the scroll position is: the one holding the Tab stop,
|
|
1257
|
+
* which is the first row until something takes it, the one being edited, and the one being
|
|
1258
|
+
* dragged, whose removal would end the drag.
|
|
1259
|
+
* @returns {Array<number|undefined>} Row positions.
|
|
1260
|
+
*/
|
|
1261
|
+
_windowPins() {
|
|
1262
|
+
const position = (id) => this._hierarchyMeta?.get(id)?.visibleIndex;
|
|
1263
|
+
return [
|
|
1264
|
+
this._currentPosition(),
|
|
1265
|
+
this._edit ? position(this._edit.id) : undefined,
|
|
1266
|
+
this._dragId == null ? undefined : position(this._dragId)
|
|
1267
|
+
];
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* Where the row holding the Tab stop is in a windowed table. A row a collapsed branch hides hands
|
|
1272
|
+
* over to its nearest visible ancestor, and a row that is gone to whichever row took its place.
|
|
1273
|
+
* @returns {number} Row position.
|
|
1274
|
+
*/
|
|
1275
|
+
_currentPosition() {
|
|
1276
|
+
if (!this._current) return 0;
|
|
1277
|
+
const meta = this._hierarchyMeta;
|
|
1278
|
+
const position = meta?.get(this._current.id)?.visibleIndex;
|
|
1279
|
+
if (position !== undefined) return position;
|
|
1280
|
+
const seen = new Set();
|
|
1281
|
+
let row = this._hierarchy ? this.getRow(this._current.id) : null;
|
|
1282
|
+
while (row) {
|
|
1283
|
+
const parentId = readRowValue(this._hierarchy.parentId, row);
|
|
1284
|
+
if (parentId == null || seen.has(parentId)) break;
|
|
1285
|
+
seen.add(parentId);
|
|
1286
|
+
const ancestor = meta?.get(parentId)?.visibleIndex;
|
|
1287
|
+
if (ancestor !== undefined) return ancestor;
|
|
1288
|
+
row = this.getRow(parentId);
|
|
1289
|
+
}
|
|
1290
|
+
return Math.min(Math.max(this._current.visibleIndex ?? 0, 0), Math.max(0, this._window.total - 1));
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Forgets a row the window removed from the DOM.
|
|
1295
|
+
* @param {HTMLElement} tr Removed row.
|
|
1296
|
+
* @returns {void}
|
|
1297
|
+
*/
|
|
1298
|
+
_releaseRow(tr) {
|
|
1299
|
+
const id = this._rowMeta.get(tr)?.id;
|
|
1300
|
+
const others = this._rowElements.get(id)?.filter((element) => element !== tr);
|
|
1301
|
+
if (others?.length) this._rowElements.set(id, others);
|
|
1302
|
+
else this._rowElements.delete(id);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1185
1305
|
/**
|
|
1186
1306
|
* Keeps the "show more" control in step with what is rendered.
|
|
1187
1307
|
*
|
|
@@ -1255,6 +1375,8 @@ export class Table extends Component {
|
|
|
1255
1375
|
this._stacked = stacked;
|
|
1256
1376
|
this.el.toggleAttribute('data-stacked', stacked);
|
|
1257
1377
|
this._applyStackedRoles(stacked);
|
|
1378
|
+
// A card is taller than a row, and no size the window watches changes when a table stacks.
|
|
1379
|
+
this._window?.schedule();
|
|
1258
1380
|
this.emit('stackedchange', { stacked });
|
|
1259
1381
|
}
|
|
1260
1382
|
|
|
@@ -1337,6 +1459,7 @@ export class Table extends Component {
|
|
|
1337
1459
|
/** Restores an enhanced target and releases all component listeners. @returns {void} */
|
|
1338
1460
|
destroy() {
|
|
1339
1461
|
this._teardownEdit();
|
|
1462
|
+
this._window?.stop();
|
|
1340
1463
|
this._width?.destroy();
|
|
1341
1464
|
this._width = null;
|
|
1342
1465
|
if (!this._restored && !this._createdRoot) {
|
|
@@ -1436,12 +1559,12 @@ export class Table extends Component {
|
|
|
1436
1559
|
},
|
|
1437
1560
|
h('button', {
|
|
1438
1561
|
class: 'zx-table__column-move', type: 'button', disabled: index === 0,
|
|
1439
|
-
ariaLabel:
|
|
1562
|
+
ariaLabel: this._message('table.moveColumnEarlier', 'Move %1 earlier', [name]),
|
|
1440
1563
|
dataset: { columnId: column.id, columnAction: 'up' }
|
|
1441
1564
|
}, icon('chevron-up', { size: ICON_SIZE.chevron })),
|
|
1442
1565
|
h('button', {
|
|
1443
1566
|
class: 'zx-table__column-move', type: 'button', disabled: index === this._columns.length - 1,
|
|
1444
|
-
ariaLabel:
|
|
1567
|
+
ariaLabel: this._message('table.moveColumnLater', 'Move %1 later', [name]),
|
|
1445
1568
|
dataset: { columnId: column.id, columnAction: 'down' }
|
|
1446
1569
|
}, icon('chevron-down', { size: ICON_SIZE.chevron }))) : null;
|
|
1447
1570
|
return h('div', { class: 'zx-table__column-option', dataset: { columnId: column.id } }, label, order);
|
|
@@ -1578,7 +1701,8 @@ export class Table extends Component {
|
|
|
1578
1701
|
// message would make a successful drop look like a red editing error on editable grids.
|
|
1579
1702
|
const status = this._rowMoveMessage ?? this._editMessage;
|
|
1580
1703
|
if (status) status.textContent = this._grabbedId == null
|
|
1581
|
-
? '
|
|
1704
|
+
? this._message('table.rowDropped', 'Row dropped', [])
|
|
1705
|
+
: this._message('table.rowGrabbed', 'Row grabbed. Use the arrow keys to move it.', []);
|
|
1582
1706
|
return;
|
|
1583
1707
|
}
|
|
1584
1708
|
if (event.key === 'Escape' && this._grabbedId != null) {
|
|
@@ -1648,7 +1772,9 @@ export class Table extends Component {
|
|
|
1648
1772
|
const columns = this._visibleColumns();
|
|
1649
1773
|
const fractions = columns.map((column) => parseFraction(column.width));
|
|
1650
1774
|
const total = fractions.reduce((sum, value) => sum + value, 0);
|
|
1651
|
-
|
|
1775
|
+
// A windowed table cannot size a column by content that is mostly not drawn: the widths would
|
|
1776
|
+
// move under the reader on every scroll.
|
|
1777
|
+
this._table.dataset.layout = total > 0 || this._virtual ? 'fixed' : 'auto';
|
|
1652
1778
|
columns.forEach((column, index) => {
|
|
1653
1779
|
const col = h('col');
|
|
1654
1780
|
if (fractions[index] > 0) col.style.width = `${fractions[index] / total * 100}%`;
|
|
@@ -1661,9 +1787,9 @@ export class Table extends Component {
|
|
|
1661
1787
|
/** @returns {void} */
|
|
1662
1788
|
_renderHeader() {
|
|
1663
1789
|
const row = h('tr', { class: 'zx-table__header-row' });
|
|
1664
|
-
if (this.
|
|
1790
|
+
if (this._indexed) row.setAttribute('aria-rowindex', '1');
|
|
1665
1791
|
if (this.options.rowReorder) row.append(h('th', {
|
|
1666
|
-
class: 'zx-table__reorder-header', scope: 'col', ariaLabel: 'Row order'
|
|
1792
|
+
class: 'zx-table__reorder-header', scope: 'col', ariaLabel: this._message('table.rowOrder', 'Row order', [])
|
|
1667
1793
|
}));
|
|
1668
1794
|
if (this.options.selectable === 'multi') {
|
|
1669
1795
|
this._selectAll = h('input', {
|
|
@@ -1767,9 +1893,13 @@ export class Table extends Component {
|
|
|
1767
1893
|
const projected = this._projectedData();
|
|
1768
1894
|
this._hierarchyMeta = new Map(projected.map((entry) => [entry.id, entry]));
|
|
1769
1895
|
if (this._data.length === 0) {
|
|
1896
|
+
this._window?.clear();
|
|
1770
1897
|
fragment.append(h('tr', { class: 'zx-table__empty-row' },
|
|
1771
1898
|
h('td', { class: 'zx-table__empty', colspan: this._spanColspan() }, this._emptyContent())
|
|
1772
1899
|
));
|
|
1900
|
+
} else if (this._window) {
|
|
1901
|
+
projected.forEach((entry, visibleIndex) => { entry.visibleIndex = visibleIndex; });
|
|
1902
|
+
this._window.fill(projected, fragment);
|
|
1773
1903
|
} else {
|
|
1774
1904
|
// Indices stay absolute: a row's index is its place in the data, not in what is on screen.
|
|
1775
1905
|
this._visibleEntries().forEach((entry, visibleIndex) => {
|
|
@@ -1780,13 +1910,14 @@ export class Table extends Component {
|
|
|
1780
1910
|
this._table.setAttribute('aria-colcount', String(this._visibleColumns().length
|
|
1781
1911
|
+ (this.options.selectable === 'multi' ? 1 : 0) + (this.options.rowReorder ? 1 : 0)));
|
|
1782
1912
|
/*
|
|
1783
|
-
* With `growing` on, the DOM holds
|
|
1784
|
-
* announces "row 3 of 10" for a table of ten thousand. The header counts as a row.
|
|
1913
|
+
* With `growing` or `virtual` on, the DOM holds part of the data — so without this a screen
|
|
1914
|
+
* reader announces "row 3 of 10" for a table of ten thousand. The header counts as a row.
|
|
1785
1915
|
*/
|
|
1786
|
-
if (this.
|
|
1916
|
+
if (this._indexed) this._table.setAttribute('aria-rowcount', String(projected.length + 1));
|
|
1787
1917
|
this._syncSelectAll();
|
|
1788
1918
|
this._syncGrowing();
|
|
1789
1919
|
if (this._stacked) this._applyStackedRoles(true);
|
|
1920
|
+
this._window?.settle();
|
|
1790
1921
|
this._syncRoving(focus);
|
|
1791
1922
|
}
|
|
1792
1923
|
|
|
@@ -1814,8 +1945,9 @@ export class Table extends Component {
|
|
|
1814
1945
|
_createRow(row, index, tree) {
|
|
1815
1946
|
const id = this._idFor(row);
|
|
1816
1947
|
const tr = /** @type {HTMLTableRowElement} */ (h('tr', { dataset: { row: '' } }));
|
|
1817
|
-
// Only
|
|
1818
|
-
if (this.
|
|
1948
|
+
// Only part of the rows is in the DOM, so each drawn row states where it really is.
|
|
1949
|
+
if (this._indexed) tr.setAttribute('aria-rowindex', String(tree.visibleIndex + 2));
|
|
1950
|
+
if (this._virtual && tree.visibleIndex % 2 === 1) tr.dataset.stripe = '';
|
|
1819
1951
|
const rowClass = typeof this.options.rowClass === 'function' ? this.options.rowClass(row) : '';
|
|
1820
1952
|
if (rowClass) tr.classList.add(...String(rowClass).split(/\s+/).filter(Boolean));
|
|
1821
1953
|
const kind = this._rowKind === null ? null : resolveRowKind(row, this._rowKind);
|
|
@@ -1866,7 +1998,8 @@ export class Table extends Component {
|
|
|
1866
1998
|
dataset: { rowHandle: '' },
|
|
1867
1999
|
ariaPressed: String(Object.is(this._grabbedId, id)),
|
|
1868
2000
|
disabled: Boolean(this._sort && this.options.sortMode === 'local'),
|
|
1869
|
-
title: this._sort && this.options.sortMode === 'local'
|
|
2001
|
+
title: this._sort && this.options.sortMode === 'local'
|
|
2002
|
+
? this._message('table.reorderBlocked', 'Clear sorting to reorder rows', []) : null
|
|
1870
2003
|
}, icon('drag', { size: 14 }));
|
|
1871
2004
|
tr.append(h('td', { class: 'zx-table__reorder-cell' }, handle));
|
|
1872
2005
|
}
|
|
@@ -2188,7 +2321,7 @@ export class Table extends Component {
|
|
|
2188
2321
|
...props,
|
|
2189
2322
|
class: textarea ? 'zx-table__editor-input zx-table__editor-textarea' : 'zx-table__editor-input',
|
|
2190
2323
|
...(textarea ? {} : { type: 'text' }),
|
|
2191
|
-
ariaLabel: props.ariaLabel ??
|
|
2324
|
+
ariaLabel: props.ariaLabel ?? this._message('table.cellInput', '%1 row %2', [tableColumnName(column), index + 1]),
|
|
2192
2325
|
value: formatCellValue(column, value, row)
|
|
2193
2326
|
}));
|
|
2194
2327
|
host.append(input);
|
|
@@ -2220,7 +2353,7 @@ export class Table extends Component {
|
|
|
2220
2353
|
* @returns {void}
|
|
2221
2354
|
*/
|
|
2222
2355
|
_focusCell(id, columnId) {
|
|
2223
|
-
const tr = this.
|
|
2356
|
+
const tr = this._rowById(id);
|
|
2224
2357
|
const td = tr ? cellIn(tr, columnId) : null;
|
|
2225
2358
|
td?.focus();
|
|
2226
2359
|
}
|
|
@@ -2500,7 +2633,8 @@ export class Table extends Component {
|
|
|
2500
2633
|
}
|
|
2501
2634
|
}
|
|
2502
2635
|
if (!tr) {
|
|
2503
|
-
tr =
|
|
2636
|
+
tr = this._window ? this._window.drawn.get(this._currentPosition())
|
|
2637
|
+
: rows[Math.min(Math.max(this._current?.visibleIndex ?? 0, 0), rows.length - 1)];
|
|
2504
2638
|
if (this._current) {
|
|
2505
2639
|
const meta = this._rowMeta.get(tr);
|
|
2506
2640
|
this._current = { ...this._current, id: meta.id, visibleIndex: meta.visibleIndex };
|
|
@@ -2656,16 +2790,21 @@ export class Table extends Component {
|
|
|
2656
2790
|
}
|
|
2657
2791
|
|
|
2658
2792
|
const rows = this._navRows();
|
|
2659
|
-
const rowIndex = rows.indexOf(tr);
|
|
2793
|
+
const rowIndex = this._window ? meta.visibleIndex : rows.indexOf(tr);
|
|
2660
2794
|
const byCell = cellMode && !onRow;
|
|
2661
2795
|
const column = onCell ? cells.indexOf(/** @type {HTMLTableCellElement} */ (target))
|
|
2662
2796
|
: Math.max(0, cells.indexOf(/** @type {HTMLTableCellElement} */ (this._cellFor(tr))));
|
|
2663
2797
|
const next = tableGridTarget({ row: rowIndex, column }, key, {
|
|
2664
|
-
rows:
|
|
2798
|
+
rows: this._window?.total ?? rows.length,
|
|
2799
|
+
columns: byCell ? cells.length : 1,
|
|
2800
|
+
page: this._pageSize(rows),
|
|
2801
|
+
ctrl: mod,
|
|
2802
|
+
cells: byCell
|
|
2665
2803
|
});
|
|
2666
2804
|
if (!next) return;
|
|
2667
2805
|
event.preventDefault();
|
|
2668
|
-
const targetRow =
|
|
2806
|
+
const targetRow = /** @type {HTMLTableRowElement} */ (this._window
|
|
2807
|
+
? this._window.reveal(next.row) : rows[next.row]);
|
|
2669
2808
|
if (!byCell) {
|
|
2670
2809
|
targetRow.focus();
|
|
2671
2810
|
} else if (next.row === rowIndex || key === 'Home' || key === 'End') {
|
|
@@ -2685,7 +2824,7 @@ export class Table extends Component {
|
|
|
2685
2824
|
* Carries out one treegrid arrow-key action on a row.
|
|
2686
2825
|
* @param {{action: string, column?: number}} action What `treegridArrowAction()` decided.
|
|
2687
2826
|
* @param {HTMLTableRowElement} tr Focused row.
|
|
2688
|
-
* @param {{id: unknown}} meta Row metadata.
|
|
2827
|
+
* @param {{id: unknown, visibleIndex?: number}} meta Row metadata.
|
|
2689
2828
|
* @param {unknown} parentId Parent row id, or null at the root.
|
|
2690
2829
|
* @returns {void}
|
|
2691
2830
|
* @fires Table#rowtoggle
|
|
@@ -2693,10 +2832,10 @@ export class Table extends Component {
|
|
|
2693
2832
|
_applyTreeAction(action, tr, meta, parentId) {
|
|
2694
2833
|
if (action.action === 'expand') this.expandRow(meta.id);
|
|
2695
2834
|
else if (action.action === 'collapse') this.collapseRow(meta.id);
|
|
2696
|
-
else if (action.action === 'parent') this.
|
|
2835
|
+
else if (action.action === 'parent') this._rowById(parentId)?.focus();
|
|
2697
2836
|
else if (action.action === 'child') {
|
|
2698
2837
|
const rows = this._navRows();
|
|
2699
|
-
rows[rows.indexOf(tr) + 1]?.focus();
|
|
2838
|
+
(this._window ? this._window.reveal(meta.visibleIndex + 1) : rows[rows.indexOf(tr) + 1])?.focus();
|
|
2700
2839
|
} else if (action.action === 'row') tr.focus();
|
|
2701
2840
|
else if (action.action === 'cell') this._navCells(tr)[action.column ?? 0]?.focus();
|
|
2702
2841
|
}
|