@fusion.dev/helix-headless 0.144.0 → 0.146.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/custom-elements.json +15195 -4240
- package/dist/accordion/item/accordion-item.d.ts +62 -12
- package/dist/accordion/item/accordion-item.js +41 -10
- package/dist/accordion/root/accordion-root.d.ts +14 -5
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +24 -3
- package/dist/announcement/root/announcement-root.js +39 -2
- package/dist/app-header/root/app-header-root.d.ts +12 -0
- package/dist/app-header/root/app-header-root.js +13 -1
- package/dist/app-header/sectioning.d.ts +9 -0
- package/dist/app-header/sectioning.js +27 -0
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/badge/root/badge-root.d.ts +3 -1
- package/dist/badge/root/badge-root.js +2 -2
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +52 -15
- package/dist/bar-chart/stack.d.ts +15 -0
- package/dist/bar-chart/stack.js +19 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +57 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +73 -3
- package/dist/button/root/button-root.d.ts +26 -0
- package/dist/button/root/button-root.js +38 -18
- package/dist/button-group/root/button-group-root.d.ts +2 -1
- package/dist/button-group/root/button-group-root.js +5 -1
- package/dist/canvas/node/canvas-node.d.ts +4 -3
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +123 -42
- package/dist/card/root/card-root.d.ts +24 -3
- package/dist/card/root/card-root.js +20 -8
- package/dist/carousel/root/carousel-root.d.ts +133 -4
- package/dist/carousel/root/carousel-root.js +174 -24
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +27 -10
- package/dist/chat/naming.d.ts +26 -0
- package/dist/chat/naming.js +14 -0
- package/dist/chat/root/chat-root.d.ts +58 -0
- package/dist/chat/root/chat-root.js +43 -3
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +14 -1
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
- package/dist/checkbox-group/select-all.d.ts +27 -0
- package/dist/checkbox-group/select-all.js +12 -0
- package/dist/code-block/highlight.d.ts +15 -0
- package/dist/code-block/highlight.js +4 -0
- package/dist/code-block/root/code-block-root.d.ts +57 -2
- package/dist/code-block/root/code-block-root.js +63 -8
- package/dist/color-input/root/color-input-root.d.ts +3 -0
- package/dist/color-input/root/color-input-root.js +6 -3
- package/dist/color-picker/root/color-picker-root.d.ts +33 -4
- package/dist/color-picker/root/color-picker-root.js +80 -21
- package/dist/color-picker/swatches.d.ts +12 -0
- package/dist/color-picker/swatches.js +26 -0
- package/dist/combobox/root/combobox-root.d.ts +43 -0
- package/dist/combobox/root/combobox-root.js +79 -15
- package/dist/command/root/command-root.d.ts +16 -1
- package/dist/command/root/command-root.js +22 -4
- package/dist/copy-button/root/copy-button-root.d.ts +26 -1
- package/dist/copy-button/root/copy-button-root.js +12 -5
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +24 -0
- package/dist/data-table/keys.js +24 -0
- package/dist/data-table/root/data-table-root.d.ts +170 -13
- package/dist/data-table/root/data-table-root.js +294 -52
- package/dist/data-table/tree.d.ts +55 -0
- package/dist/data-table/tree.js +54 -0
- package/dist/date-input/root/date-input-root.d.ts +3 -1
- package/dist/date-input/root/date-input-root.js +18 -7
- package/dist/date-picker/root/date-picker-root.js +12 -6
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.js +15 -1
- package/dist/dialog/root/dialog-root.d.ts +8 -2
- package/dist/dialog/root/dialog-root.js +16 -1
- package/dist/divider/root/divider-root.d.ts +3 -0
- package/dist/divider/root/divider-root.js +2 -1
- package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
- package/dist/donut-chart/root/donut-chart-root.js +48 -1
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +59 -0
- package/dist/drawer/root/drawer-root.js +63 -4
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +29 -0
- package/dist/drilldown/root/drilldown-root.js +28 -5
- package/dist/element-events.generated.js +83 -12
- package/dist/empty/root/empty-root.d.ts +3 -1
- package/dist/empty/root/empty-root.js +3 -2
- package/dist/file-input/root/file-input-root.d.ts +69 -6
- package/dist/file-input/root/file-input-root.js +82 -19
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +16 -4
- package/dist/filter-input/root/filter-input-root.d.ts +30 -6
- package/dist/filter-input/root/filter-input-root.js +1 -1
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/root/format-date-root.d.ts +9 -16
- package/dist/format-date/root/format-date-root.js +10 -27
- package/dist/heatmap/root/heatmap-root.d.ts +24 -13
- package/dist/heatmap/root/heatmap-root.js +34 -12
- package/dist/icon/root/icon-root.d.ts +12 -1
- package/dist/icon/root/icon-root.js +21 -10
- package/dist/icon/settle.d.ts +7 -0
- package/dist/icon/settle.js +10 -0
- package/dist/icon-button/root/icon-button-root.d.ts +2 -0
- package/dist/image/root/image-root.d.ts +5 -1
- package/dist/image/root/image-root.js +10 -2
- package/dist/input/root/input-root.d.ts +13 -3
- package/dist/input/root/input-root.js +12 -3
- package/dist/kbd/root/kbd-root.d.ts +35 -1
- package/dist/kbd/root/kbd-root.js +23 -4
- package/dist/legend/root/legend-root.d.ts +55 -8
- package/dist/legend/root/legend-root.js +55 -13
- package/dist/lightbox/root/lightbox-root.d.ts +49 -6
- package/dist/lightbox/root/lightbox-root.js +86 -19
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +22 -0
- package/dist/lightbox/zoom.js +16 -0
- package/dist/line-chart/root/line-chart-root.d.ts +22 -1
- package/dist/line-chart/root/line-chart-root.js +21 -1
- package/dist/list/item/list-item.d.ts +70 -1
- package/dist/list/item/list-item.js +77 -6
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +155 -9
- package/dist/list/root/list-root.js +246 -4
- package/dist/list/selection.d.ts +49 -0
- package/dist/list/selection.js +30 -0
- package/dist/listbox/root/listbox-root.d.ts +37 -1
- package/dist/listbox/root/listbox-root.js +49 -4
- package/dist/loader/busy.d.ts +10 -0
- package/dist/loader/busy.js +11 -0
- package/dist/loader/root/loader-root.d.ts +9 -2
- package/dist/loader/root/loader-root.js +23 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +62 -0
- package/dist/megamenu/root/megamenu-root.js +90 -5
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +87 -11
- package/dist/menu/item/menu-item.js +78 -22
- package/dist/menu/root/menu-root.d.ts +39 -1
- package/dist/menu/root/menu-root.js +65 -8
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +20 -1
- package/dist/meter/root/meter-root.js +11 -15
- package/dist/navigation/root/navigation-root.d.ts +18 -2
- package/dist/navigation/root/navigation-root.js +29 -3
- package/dist/notifications/root/notifications-root.d.ts +25 -0
- package/dist/notifications/root/notifications-root.js +33 -5
- package/dist/number-input/root/number-input-root.d.ts +17 -8
- package/dist/number-input/root/number-input-root.js +2 -7
- package/dist/object-inspector/root/object-inspector-root.d.ts +161 -32
- package/dist/object-inspector/root/object-inspector-root.js +264 -123
- package/dist/object-inspector/rows.d.ts +75 -0
- package/dist/object-inspector/rows.js +119 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +86 -3
- package/dist/outline/root/outline-root.js +95 -12
- package/dist/pagination/size/pagination-size.d.ts +12 -2
- package/dist/pagination/size/pagination-size.js +20 -5
- package/dist/pin-input/code.d.ts +10 -0
- package/dist/pin-input/code.js +13 -0
- package/dist/pin-input/root/pin-input-root.d.ts +25 -1
- package/dist/pin-input/root/pin-input-root.js +10 -11
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +41 -0
- package/dist/popover/root/popover-root.d.ts +57 -7
- package/dist/popover/root/popover-root.js +58 -3
- package/dist/progress/root/progress-root.d.ts +20 -0
- package/dist/progress/root/progress-root.js +15 -15
- package/dist/qr-code/export.d.ts +26 -1
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/root/qr-code-root.d.ts +19 -5
- package/dist/qr-code/root/qr-code-root.js +58 -9
- package/dist/quote/marks.d.ts +8 -0
- package/dist/quote/marks.js +5 -0
- package/dist/quote/root/quote-root.d.ts +14 -2
- package/dist/quote/root/quote-root.js +23 -1
- package/dist/radio/group/radio-group.d.ts +4 -10
- package/dist/radio/group/radio-group.js +5 -10
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +6 -1
- package/dist/rating/root/rating-root.d.ts +10 -5
- package/dist/rating/root/rating-root.js +32 -8
- package/dist/rating/steps.d.ts +7 -0
- package/dist/rating/steps.js +9 -0
- package/dist/scatter-chart/fit.d.ts +15 -0
- package/dist/scatter-chart/fit.js +35 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +21 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
- package/dist/scroll-area/root/scroll-area-root.d.ts +84 -0
- package/dist/scroll-area/root/scroll-area-root.js +106 -7
- package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
- package/dist/scroll-area/scrollbar-controller.js +172 -0
- package/dist/scroll-area/scrollbar.d.ts +92 -0
- package/dist/scroll-area/scrollbar.js +33 -0
- package/dist/select/root/select-root.d.ts +15 -0
- package/dist/select/root/select-root.js +18 -6
- package/dist/skeleton/root/skeleton-root.d.ts +3 -0
- package/dist/skeleton/root/skeleton-root.js +4 -2
- package/dist/skip-link/root/skip-link-root.js +2 -2
- package/dist/slider/root/slider-root.d.ts +41 -4
- package/dist/slider/root/slider-root.js +23 -3
- package/dist/sparkline/readings.d.ts +18 -0
- package/dist/sparkline/readings.js +19 -0
- package/dist/sparkline/root/sparkline-root.d.ts +78 -7
- package/dist/sparkline/root/sparkline-root.js +118 -23
- package/dist/speed-dial/root/speed-dial-root.js +2 -2
- package/dist/splitter/root/splitter-root.d.ts +20 -12
- package/dist/splitter/root/splitter-root.js +226 -203
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +14 -5
- package/dist/stat/root/stat-root.js +21 -5
- package/dist/steps/reach.d.ts +20 -0
- package/dist/steps/reach.js +15 -0
- package/dist/steps/root/steps-root.d.ts +76 -0
- package/dist/steps/root/steps-root.js +93 -1
- package/dist/steps/step/step.d.ts +45 -2
- package/dist/steps/step/step.js +33 -6
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +11 -10
- package/dist/table/column/table-column.js +8 -19
- package/dist/table/root/table-root.d.ts +126 -4
- package/dist/table/root/table-root.js +156 -6
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +22 -5
- package/dist/tabs/panel/tab-panel.js +34 -6
- package/dist/tabs/root/tabs-root.d.ts +37 -1
- package/dist/tabs/root/tabs-root.js +22 -4
- package/dist/tabs/tab/tab.d.ts +41 -4
- package/dist/tabs/tab/tab.js +49 -3
- package/dist/tag/group/tag-group.d.ts +31 -4
- package/dist/tag/group/tag-group.js +46 -7
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +28 -1
- package/dist/textarea/root/textarea-root.js +40 -1
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +16 -8
- package/dist/time-picker/root/time-picker-root.d.ts +18 -4
- package/dist/time-picker/root/time-picker-root.js +7 -10
- package/dist/time-picker/wheel-name.d.ts +9 -0
- package/dist/time-picker/wheel-name.js +15 -0
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/item/toast-item.d.ts +24 -18
- package/dist/toast/item/toast-item.js +36 -40
- package/dist/toast/root/toast-root.d.ts +6 -0
- package/dist/toast/root/toast-root.js +16 -1
- package/dist/toggle/group/toggle-group.d.ts +24 -3
- package/dist/toggle/group/toggle-group.js +34 -5
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/root/tooltip-root.d.ts +13 -2
- package/dist/tooltip/root/tooltip-root.js +9 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +30 -2
- package/dist/tour/root/tour-root.js +34 -8
- package/dist/tree/item/tree-item.d.ts +61 -4
- package/dist/tree/item/tree-item.js +92 -20
- package/dist/tree/root/tree-root.d.ts +58 -0
- package/dist/tree/root/tree-root.js +80 -16
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +13 -0
- package/dist/trend/root/trend-root.d.ts +43 -18
- package/dist/trend/root/trend-root.js +31 -6
- package/dist/video/media-events.d.ts +44 -0
- package/dist/video/media-events.js +35 -0
- package/dist/video/root/video-root.d.ts +117 -18
- package/dist/video/root/video-root.js +93 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +77 -3
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +22 -0
- package/dist/virtual-list/fill.js +23 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/plan.d.ts +49 -0
- package/dist/virtual-list/plan.js +16 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +259 -26
- package/dist/virtual-list/root/virtual-list-root.js +333 -49
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +8113 -1394
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +1678 -353
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/listbox/range.d.ts +0 -17
- package/dist/listbox/range.js +0 -5
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -5,15 +5,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var HelixHeadlessDataTable_1;
|
|
8
|
-
import { customElement, deepActiveElement, deepContains, fillTemplate, formatNumbers, HelixActivateEvent, HelixElement, HelixFilterEvent, HelixFilteredEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, hostAria, inlineStep, isRtl, MixinCollection, markRegion, reportRuntime, requestChange, VirtualizeController, writtenList, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { arranged, commaList, countLabel, customElement, cycle, deepActiveElement, deepContains, fillTemplate, format, formatNumbers, HelixActivateEvent, HelixElement, HelixExpandEvent, HelixFilterEvent, HelixFilteredEvent, HelixLoadMoreEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, hostAria, inlineStep, isRtl, MixinCollection, markRegion, ordered, parse, rangeAdd, reportRuntime, requestChange, Typeahead, toggleEvery, treeArrow, typesCharacter, VirtualizeController, valueAt, window_, writtenList, } from '@fusion.dev/helix-core';
|
|
9
|
+
import { caretDown, caretRight } from '@fusion.dev/helix-icons';
|
|
9
10
|
import { nothing } from 'lit';
|
|
10
11
|
import { property, state } from 'lit/decorators.js';
|
|
11
12
|
import { repeat } from 'lit/directives/repeat.js';
|
|
13
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
12
14
|
import { html } from 'lit/static-html.js';
|
|
13
|
-
import {
|
|
15
|
+
import { edgeOf } from '../../table/column/table-column.js';
|
|
14
16
|
import '../../checkbox/index.js';
|
|
15
17
|
import '../../pagination/index.js';
|
|
16
|
-
import {
|
|
18
|
+
import { anchorAt, inRowOrder, toggledOpen } from '../keys.js';
|
|
19
|
+
import { grow } from '../tree.js';
|
|
17
20
|
const CONTROL = [
|
|
18
21
|
'a[href]',
|
|
19
22
|
'button:not([disabled])',
|
|
@@ -28,6 +31,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
28
31
|
constructor() {
|
|
29
32
|
super(...arguments);
|
|
30
33
|
this.ascendingLabel = 'ascending';
|
|
34
|
+
this.defaultExpanded = '';
|
|
31
35
|
this.defaultFilter = '';
|
|
32
36
|
this.defaultOrder = '';
|
|
33
37
|
this.defaultPage = 1;
|
|
@@ -38,6 +42,8 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
38
42
|
this.estimate = 32;
|
|
39
43
|
this.gapLabel = 'Skip to page {page}';
|
|
40
44
|
this.label = '';
|
|
45
|
+
this.loadMore = false;
|
|
46
|
+
this.loadMoreLabel = 'Load more';
|
|
41
47
|
this.mode = 'client';
|
|
42
48
|
this.nextLabel = 'Next page';
|
|
43
49
|
this.pageLabel = 'Page {page}';
|
|
@@ -63,11 +69,16 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
63
69
|
this.paginatedState = undefined;
|
|
64
70
|
this.orderState = undefined;
|
|
65
71
|
this.selectedState = undefined;
|
|
72
|
+
this.expandedState = undefined;
|
|
66
73
|
this.activeRow = undefined;
|
|
67
74
|
this.activeColumn = 0;
|
|
68
75
|
this.activeKey = undefined;
|
|
69
76
|
this.focusWanted = false;
|
|
70
77
|
this.drawnPage = [];
|
|
78
|
+
this.moreDrawn = false;
|
|
79
|
+
this.typeahead = new Typeahead();
|
|
80
|
+
this.anchorKey = undefined;
|
|
81
|
+
this.shiftPressed = false;
|
|
71
82
|
this.counts = {
|
|
72
83
|
columns: undefined,
|
|
73
84
|
rows: undefined,
|
|
@@ -84,6 +95,11 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
84
95
|
this.warnedAboutSize = false;
|
|
85
96
|
this.toggleRow = (key, event) => {
|
|
86
97
|
event.preventDefault();
|
|
98
|
+
const to = this.pageKeys.indexOf(key);
|
|
99
|
+
if (this.shiftPressed && this.anchorKey !== undefined && to >= 0) {
|
|
100
|
+
this.selectRange(to);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
87
103
|
this.chooseRow(key, event.detail.checked);
|
|
88
104
|
};
|
|
89
105
|
this.toggleAll = (event) => {
|
|
@@ -100,8 +116,12 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
100
116
|
this.handleScroll = () => {
|
|
101
117
|
if (this.windowed) {
|
|
102
118
|
this.virtualize.measure();
|
|
119
|
+
this.askNearEnd();
|
|
103
120
|
}
|
|
104
121
|
};
|
|
122
|
+
this.notePress = (event) => {
|
|
123
|
+
this.shiftPressed = event.shiftKey;
|
|
124
|
+
};
|
|
105
125
|
this.handleHeadClick = (event) => {
|
|
106
126
|
if (this.partIn(event, 'grip') || this.partIn(event, 'resizer')) {
|
|
107
127
|
return;
|
|
@@ -144,9 +164,22 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
144
164
|
this.handleControlKey(event, place);
|
|
145
165
|
return;
|
|
146
166
|
}
|
|
147
|
-
const last = this.drawnPage.length - 1;
|
|
167
|
+
const last = this.drawnPage.length - 1 + (this.moreDrawn ? 1 : 0);
|
|
148
168
|
const edge = this.width - 1;
|
|
149
169
|
const control = event.ctrlKey || event.metaKey;
|
|
170
|
+
if (control && !event.shiftKey && event.key.toLowerCase() === 'a' && this.selectable) {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
this.requestSelected(new Set([...this.chosen, ...this.everyKey]));
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (typesCharacter(event) && (event.key !== ' ' || this.typeahead.typing())) {
|
|
176
|
+
const found = this.typeahead.match(event.key, this.rowWords, place.row);
|
|
177
|
+
if (found >= 0) {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
this.moveTo(found, place.column);
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
150
183
|
let { column, row } = place;
|
|
151
184
|
switch (event.key) {
|
|
152
185
|
case 'ArrowUp':
|
|
@@ -157,6 +190,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
157
190
|
break;
|
|
158
191
|
case 'ArrowLeft':
|
|
159
192
|
case 'ArrowRight':
|
|
193
|
+
if (this.treeKey(event, place)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
160
196
|
column = Math.max(0, Math.min(edge, column + inlineStep(this, event.key)));
|
|
161
197
|
break;
|
|
162
198
|
case 'Home':
|
|
@@ -182,6 +218,14 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
182
218
|
return;
|
|
183
219
|
}
|
|
184
220
|
event.preventDefault();
|
|
221
|
+
if (event.shiftKey &&
|
|
222
|
+
this.selectable &&
|
|
223
|
+
(event.key === 'ArrowUp' || event.key === 'ArrowDown') &&
|
|
224
|
+
place.row >= 0 &&
|
|
225
|
+
row >= 0 &&
|
|
226
|
+
row < this.drawnPage.length) {
|
|
227
|
+
this.selectRange(row, place.row);
|
|
228
|
+
}
|
|
185
229
|
if (row !== place.row || column !== place.column) {
|
|
186
230
|
this.moveTo(row, column);
|
|
187
231
|
}
|
|
@@ -264,6 +308,14 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
264
308
|
...HelixElement.shadowRootOptions,
|
|
265
309
|
slotAssignment: 'manual',
|
|
266
310
|
}; }
|
|
311
|
+
get expanded() {
|
|
312
|
+
return this.expandedState ?? this.defaultExpanded;
|
|
313
|
+
}
|
|
314
|
+
set expanded(next) {
|
|
315
|
+
const previous = this.expanded;
|
|
316
|
+
this.expandedState = next;
|
|
317
|
+
this.requestUpdate('expanded', previous);
|
|
318
|
+
}
|
|
267
319
|
get filter() {
|
|
268
320
|
return this.filterState ?? this.defaultFilter;
|
|
269
321
|
}
|
|
@@ -331,15 +383,58 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
331
383
|
}
|
|
332
384
|
get available() {
|
|
333
385
|
if (this.mode === 'server') {
|
|
334
|
-
return this.rows.length;
|
|
386
|
+
return this.childField ? this.tree().rows.length : this.rows.length;
|
|
335
387
|
}
|
|
336
|
-
const matched = this.windowed ? this.
|
|
388
|
+
const matched = this.windowed ? this.flat().rows.length : this.matched;
|
|
337
389
|
const size = this.pageSize;
|
|
338
390
|
if (size <= 0) {
|
|
339
391
|
return matched;
|
|
340
392
|
}
|
|
341
393
|
return Math.max(0, Math.min(size, matched - (this.page - 1) * size));
|
|
342
394
|
}
|
|
395
|
+
tree() {
|
|
396
|
+
const axes = this.axes;
|
|
397
|
+
const server = this.mode === 'server';
|
|
398
|
+
const query = server ? '' : this.filter;
|
|
399
|
+
const spec = server ? '' : this.sort;
|
|
400
|
+
const key = [
|
|
401
|
+
query,
|
|
402
|
+
spec,
|
|
403
|
+
this.childField,
|
|
404
|
+
this.expanded,
|
|
405
|
+
axes.map((axis) => axis.field).join('\u0001'),
|
|
406
|
+
].join('\u0000');
|
|
407
|
+
if (this.grown?.key === key && this.grown.source === this.rows) {
|
|
408
|
+
return this.grown.value;
|
|
409
|
+
}
|
|
410
|
+
if (!this.rowKey && !this.warnedAboutKey && typeof window !== 'undefined') {
|
|
411
|
+
this.warnedAboutKey = true;
|
|
412
|
+
reportRuntime({
|
|
413
|
+
kind: 'missing-row-key',
|
|
414
|
+
message: `<${this.localName} child-field> has no \`row-key\`, so it cannot tell which rows are open. Set \`row-key\` to the field that identifies a row.`,
|
|
415
|
+
tag: this.localName,
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
const open = this.opened;
|
|
419
|
+
const value = grow(this.rows, axes, {
|
|
420
|
+
field: this.childField ?? '',
|
|
421
|
+
isOpen: (row) => open.has(this.rowKeyOf(row, -1)),
|
|
422
|
+
query,
|
|
423
|
+
spec,
|
|
424
|
+
});
|
|
425
|
+
this.grown = { key, source: this.rows, value };
|
|
426
|
+
return value;
|
|
427
|
+
}
|
|
428
|
+
get opened() {
|
|
429
|
+
return new Set(commaList(this.expanded));
|
|
430
|
+
}
|
|
431
|
+
flat() {
|
|
432
|
+
if (this.childField) {
|
|
433
|
+
const { rows, total } = this.tree();
|
|
434
|
+
return { rows, total };
|
|
435
|
+
}
|
|
436
|
+
return this.arrange();
|
|
437
|
+
}
|
|
343
438
|
arrange() {
|
|
344
439
|
const axes = this.axes;
|
|
345
440
|
const key = `${this.filter}\u0000${this.sort}\u0000${axes.map((axis) => axis.field).join('\u0001')}`;
|
|
@@ -370,13 +465,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
370
465
|
}
|
|
371
466
|
const row = this.currentRow(rows);
|
|
372
467
|
const { first, last } = this.virtualize.window;
|
|
373
|
-
return row >= 0 && (row < first || row >= last) ? row : undefined;
|
|
468
|
+
return row >= 0 && row < rows.length && (row < first || row >= last) ? row : undefined;
|
|
374
469
|
}
|
|
375
470
|
rowKeyOf(row, index) {
|
|
376
471
|
if (!this.rowKey) {
|
|
377
472
|
return String(index);
|
|
378
473
|
}
|
|
379
|
-
const value =
|
|
474
|
+
const value = valueAt(row, this.rowKey);
|
|
380
475
|
return value === undefined || value === null ? String(index) : String(value);
|
|
381
476
|
}
|
|
382
477
|
currentRow(rows) {
|
|
@@ -391,7 +486,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
391
486
|
return found;
|
|
392
487
|
}
|
|
393
488
|
}
|
|
394
|
-
return Math.min(asked, rows.length - 1);
|
|
489
|
+
return Math.min(asked, rows.length - 1 + (this.moreDrawn ? 1 : 0));
|
|
395
490
|
}
|
|
396
491
|
get width() {
|
|
397
492
|
return this.shownColumns.length + (this.selectable ? 1 : 0);
|
|
@@ -455,7 +550,16 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
455
550
|
get view() {
|
|
456
551
|
if (this.mode === 'server') {
|
|
457
552
|
const total = Math.max(this.total, this.rows.length);
|
|
458
|
-
|
|
553
|
+
const page = this.childField ? this.tree().rows : this.rows;
|
|
554
|
+
return { available: page.length, matched: total, page, total };
|
|
555
|
+
}
|
|
556
|
+
if (this.childField) {
|
|
557
|
+
const { rows: inOrder, total } = this.tree();
|
|
558
|
+
const page = window_(inOrder, this.page, this.pageSize);
|
|
559
|
+
if (!this.windowed) {
|
|
560
|
+
this.warnIfCrowded(page.length);
|
|
561
|
+
}
|
|
562
|
+
return { available: page.length, matched: inOrder.length, page, total };
|
|
459
563
|
}
|
|
460
564
|
if (!this.windowed) {
|
|
461
565
|
const view = ordered(this.rows, this.axes, {
|
|
@@ -485,6 +589,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
485
589
|
return Math.max(1, Math.ceil(count / size));
|
|
486
590
|
}
|
|
487
591
|
get matched() {
|
|
592
|
+
if (this.childField) {
|
|
593
|
+
return this.tree().rows.length;
|
|
594
|
+
}
|
|
488
595
|
const query = this.filter.trim();
|
|
489
596
|
if (query === '') {
|
|
490
597
|
return this.rows.length;
|
|
@@ -540,18 +647,15 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
540
647
|
},
|
|
541
648
|
event: (value) => new HelixSelectEvent({ value }),
|
|
542
649
|
host: this,
|
|
543
|
-
next:
|
|
650
|
+
next: inRowOrder(keys, this.everyKey).join(','),
|
|
544
651
|
});
|
|
545
652
|
}
|
|
546
653
|
get chosen() {
|
|
547
|
-
return new Set(this.selected
|
|
548
|
-
.split(',')
|
|
549
|
-
.map((key) => key.trim())
|
|
550
|
-
.filter(Boolean));
|
|
654
|
+
return new Set(commaList(this.selected));
|
|
551
655
|
}
|
|
552
656
|
keyOf(row, place) {
|
|
553
657
|
if (this.rowKey) {
|
|
554
|
-
const value =
|
|
658
|
+
const value = valueAt(row, this.rowKey);
|
|
555
659
|
return value === undefined || value === null ? String(place) : String(value);
|
|
556
660
|
}
|
|
557
661
|
if (this.selectable && !this.warnedAboutKey && typeof window !== 'undefined') {
|
|
@@ -565,10 +669,48 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
565
669
|
return String(place);
|
|
566
670
|
}
|
|
567
671
|
get everyKey() {
|
|
672
|
+
if (this.childField) {
|
|
673
|
+
return this.tree().every.map((row, place) => this.keyOf(row, place));
|
|
674
|
+
}
|
|
568
675
|
const rows = this.mode === 'server' ? this.rows : this.arrange().rows;
|
|
569
676
|
return rows.map((row, place) => this.keyOf(row, place));
|
|
570
677
|
}
|
|
678
|
+
get pageKeys() {
|
|
679
|
+
return this.drawnPage.map((row, index) => this.keyOf(row, this.rowIndex(index) - 2));
|
|
680
|
+
}
|
|
681
|
+
selectRange(to, from = to) {
|
|
682
|
+
const keys = this.pageKeys;
|
|
683
|
+
const { anchor, anchorKey } = anchorAt(keys, this.anchorKey, from);
|
|
684
|
+
this.anchorKey = anchorKey;
|
|
685
|
+
const next = rangeAdd([...this.chosen], keys, anchor, to);
|
|
686
|
+
if (next) {
|
|
687
|
+
this.requestSelected(new Set(next));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
get rowWords() {
|
|
691
|
+
const header = this.headerColumn;
|
|
692
|
+
return this.drawnPage.map((row) => {
|
|
693
|
+
const value = header?.order(row);
|
|
694
|
+
return value === undefined || value === null ? '' : String(value);
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
get headerColumn() {
|
|
698
|
+
const columns = this.shownColumns;
|
|
699
|
+
return (columns.find((column) => column.rowHeader) ?? columns.find((column) => column.field !== ''));
|
|
700
|
+
}
|
|
701
|
+
askForMore() {
|
|
702
|
+
this.dispatchEvent(new HelixLoadMoreEvent());
|
|
703
|
+
}
|
|
704
|
+
askNearEnd() {
|
|
705
|
+
if (!this.windowed || !this.loadMore || this.loading) {
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
if (this.virtualize.endInSight(this.rows.length)) {
|
|
709
|
+
this.askForMore();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
571
712
|
chooseRow(key, checked) {
|
|
713
|
+
this.anchorKey = key;
|
|
572
714
|
const keys = this.chosen;
|
|
573
715
|
if (checked) {
|
|
574
716
|
keys.add(key);
|
|
@@ -579,19 +721,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
579
721
|
this.requestSelected(keys);
|
|
580
722
|
}
|
|
581
723
|
chooseAll() {
|
|
582
|
-
|
|
583
|
-
const keys = this.chosen;
|
|
584
|
-
if (every.length > 0 && every.every((key) => keys.has(key))) {
|
|
585
|
-
for (const key of every) {
|
|
586
|
-
keys.delete(key);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
else {
|
|
590
|
-
for (const key of every) {
|
|
591
|
-
keys.add(key);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
this.requestSelected(keys);
|
|
724
|
+
this.requestSelected(new Set(toggleEvery(this.chosen, this.everyKey)));
|
|
595
725
|
}
|
|
596
726
|
moveColumn(field, by) {
|
|
597
727
|
const drawn = this.shownColumns.filter((column) => column.field !== '');
|
|
@@ -609,7 +739,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
609
739
|
}
|
|
610
740
|
csv() {
|
|
611
741
|
const columns = this.shownColumns.filter((column) => column.field !== '');
|
|
612
|
-
const rows = this.mode === 'server' ? this.rows : this.
|
|
742
|
+
const rows = this.mode === 'server' && !this.childField ? this.rows : this.flat().rows;
|
|
613
743
|
const quote = (value) => {
|
|
614
744
|
if (value === undefined || value === null) {
|
|
615
745
|
return '';
|
|
@@ -621,7 +751,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
621
751
|
return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
|
|
622
752
|
};
|
|
623
753
|
const head = columns.map((column) => quote(column.textContent?.trim() || column.field));
|
|
624
|
-
const body = rows.map((row) => columns.map((column) => quote(
|
|
754
|
+
const body = rows.map((row) => columns.map((column) => quote(valueAt(row, column.field))));
|
|
625
755
|
return [head, ...body].map((line) => line.join(',')).join('\r\n');
|
|
626
756
|
}
|
|
627
757
|
requestFilter(next) {
|
|
@@ -711,10 +841,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
711
841
|
}
|
|
712
842
|
else if (this.hasUpdated && this.filter !== this.heardFilter) {
|
|
713
843
|
const count = this.mode === 'server' ? Math.max(this.total, this.rows.length) : this.matched;
|
|
714
|
-
|
|
715
|
-
said = fillTemplate(one ? this.resultLabel : this.resultsLabel, {
|
|
716
|
-
count: formatNumbers(this.lang)(count),
|
|
717
|
-
});
|
|
844
|
+
said = countLabel(count, this.resultLabel, this.resultsLabel, this.lang);
|
|
718
845
|
}
|
|
719
846
|
this.heardSort = sort;
|
|
720
847
|
this.heardSelected = selected;
|
|
@@ -725,7 +852,10 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
725
852
|
super.willUpdate(changed);
|
|
726
853
|
this.hadFocus = this.hasUpdated && this.gridHasFocus();
|
|
727
854
|
this.announced = this.news();
|
|
728
|
-
hostAria(this.internals, {
|
|
855
|
+
hostAria(this.internals, {
|
|
856
|
+
label: this.label || 'Table',
|
|
857
|
+
role: this.childField ? 'treegrid' : 'grid',
|
|
858
|
+
});
|
|
729
859
|
this.internals.ariaMultiSelectable = this.selectable ? 'true' : null;
|
|
730
860
|
const placement = this.placement;
|
|
731
861
|
if (changed.has('rows') || placement !== this.measuredAgainst) {
|
|
@@ -750,6 +880,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
750
880
|
if (this.windowed) {
|
|
751
881
|
this.virtualize.measure();
|
|
752
882
|
}
|
|
883
|
+
this.askNearEnd();
|
|
753
884
|
}
|
|
754
885
|
announceSort() {
|
|
755
886
|
const current = parse(this.sort);
|
|
@@ -768,17 +899,41 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
768
899
|
: undefined;
|
|
769
900
|
}
|
|
770
901
|
}
|
|
771
|
-
renderCell(column, row, picked, place, stop) {
|
|
902
|
+
renderCell(column, row, picked, place, stop, header) {
|
|
772
903
|
const edge = edgeOf(column.textAlign);
|
|
904
|
+
const placed = header && this.childField ? this.tree().placed.get(row) : undefined;
|
|
905
|
+
const style = [
|
|
906
|
+
edge ? `--data-table-cell-align: ${edge}` : '',
|
|
907
|
+
placed ? `--data-table-level: ${placed.level}` : '',
|
|
908
|
+
]
|
|
909
|
+
.filter(Boolean)
|
|
910
|
+
.join('; ');
|
|
773
911
|
return html `<span
|
|
774
|
-
part="cell${picked ? ' cell-selected' : ''}"
|
|
775
|
-
role
|
|
912
|
+
part="cell${picked ? ' cell-selected' : ''}${header ? ' cell-header' : ''}"
|
|
913
|
+
role=${header ? 'rowheader' : 'gridcell'}
|
|
776
914
|
tabindex=${stop ? '0' : '-1'}
|
|
777
915
|
data-column=${place}
|
|
778
|
-
style=${
|
|
779
|
-
>${column.read(row)}</span
|
|
916
|
+
style=${style || nothing}
|
|
917
|
+
>${placed?.branch ? this.renderToggle(row, placed.open) : nothing}${column.read(row)}</span
|
|
780
918
|
>`;
|
|
781
919
|
}
|
|
920
|
+
renderToggle(row, open) {
|
|
921
|
+
const glyph = open ? caretDown : caretRight;
|
|
922
|
+
return html `<span
|
|
923
|
+
part="toggle${open ? ' toggle-open' : ''}"
|
|
924
|
+
aria-hidden="true"
|
|
925
|
+
@click=${() => this.toggleOpen(row, !open)}
|
|
926
|
+
><svg part="toggle-mark" ?data-mirror=${!open} fill="currentColor" viewBox=${glyph.viewBox}>${unsafeSVG(glyph.content)}</svg></span>`;
|
|
927
|
+
}
|
|
928
|
+
toggleOpen(row, open) {
|
|
929
|
+
const next = toggledOpen(this.expanded, this.rowKeyOf(row, -1), open, this.everyKey);
|
|
930
|
+
if (next === undefined) {
|
|
931
|
+
return false;
|
|
932
|
+
}
|
|
933
|
+
this.expanded = next;
|
|
934
|
+
this.dispatchEvent(new HelixExpandEvent({ value: this.expanded }));
|
|
935
|
+
return true;
|
|
936
|
+
}
|
|
782
937
|
renderCheckbox(name, checked, indeterminate, toggle) {
|
|
783
938
|
const checkbox = this.tag('checkbox');
|
|
784
939
|
return html `<${checkbox}
|
|
@@ -797,19 +952,24 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
797
952
|
renderRows(rows, page) {
|
|
798
953
|
const columns = this.shownColumns;
|
|
799
954
|
const chosen = this.selectable ? this.chosen : undefined;
|
|
800
|
-
const named =
|
|
955
|
+
const named = this.headerColumn;
|
|
801
956
|
const stopRow = this.currentRow(page);
|
|
802
957
|
const stopColumn = this.currentColumn;
|
|
803
958
|
const offset = this.selectable ? 1 : 0;
|
|
804
959
|
return html `${repeat(rows, ({ index, row }) => this.rowKeyOf(row, index), ({ index, row }) => {
|
|
805
960
|
const key = chosen ? this.keyOf(row, this.rowIndex(index) - 2) : '';
|
|
806
961
|
const picked = chosen?.has(key) ?? false;
|
|
962
|
+
const placed = this.childField ? this.tree().placed.get(row) : undefined;
|
|
807
963
|
const stop = (place) => index === stopRow && place === stopColumn;
|
|
808
964
|
return html `<div
|
|
809
965
|
part="row"
|
|
810
966
|
role="row"
|
|
811
967
|
aria-rowindex=${this.rowIndex(index)}
|
|
812
968
|
aria-selected=${chosen ? String(picked) : nothing}
|
|
969
|
+
aria-level=${placed ? placed.level : nothing}
|
|
970
|
+
aria-posinset=${placed ? placed.position : nothing}
|
|
971
|
+
aria-setsize=${placed ? placed.siblings : nothing}
|
|
972
|
+
aria-expanded=${placed?.branch ? String(placed.open) : nothing}
|
|
813
973
|
data-index=${this.windowed ? index : nothing}
|
|
814
974
|
data-row=${index}
|
|
815
975
|
>
|
|
@@ -823,7 +983,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
823
983
|
row: named ? String(named.order(row) ?? key) : key,
|
|
824
984
|
}), picked, false, (event) => this.toggleRow(key, event))}</span
|
|
825
985
|
>`
|
|
826
|
-
: nothing}${columns.map((column, place) => this.renderCell(column, row, picked, place + offset, stop(place + offset)))}
|
|
986
|
+
: nothing}${columns.map((column, place) => this.renderCell(column, row, picked, place + offset, stop(place + offset), column === named))}
|
|
827
987
|
</div>`;
|
|
828
988
|
})}`;
|
|
829
989
|
}
|
|
@@ -833,16 +993,21 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
833
993
|
return page + within + 2;
|
|
834
994
|
}
|
|
835
995
|
get placement() {
|
|
836
|
-
return [
|
|
996
|
+
return [
|
|
997
|
+
this.mode,
|
|
998
|
+
this.filter,
|
|
999
|
+
this.sort,
|
|
1000
|
+
this.page,
|
|
1001
|
+
this.pageSize,
|
|
1002
|
+
this.childField,
|
|
1003
|
+
this.expanded,
|
|
1004
|
+
].join('\u0000');
|
|
837
1005
|
}
|
|
838
1006
|
renderSpacer(end, kept) {
|
|
839
1007
|
if (!this.windowed) {
|
|
840
1008
|
return nothing;
|
|
841
1009
|
}
|
|
842
|
-
const
|
|
843
|
-
const room = kept === undefined ? 0 : this.virtualize.sizeOf(kept);
|
|
844
|
-
const before = Math.max(0, window.before - (kept !== undefined && kept < window.first ? room : 0));
|
|
845
|
-
const after = Math.max(0, window.after - (kept !== undefined && kept >= window.last ? room : 0));
|
|
1010
|
+
const { after, before } = this.virtualize.spacers(kept);
|
|
846
1011
|
return end === 'before'
|
|
847
1012
|
? html `<div part="before" role="presentation" style="block-size: ${before}px"></div>`
|
|
848
1013
|
: html `<div part="after" role="presentation" style="block-size: ${after}px"></div>`;
|
|
@@ -858,9 +1023,26 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
858
1023
|
data-column="0"
|
|
859
1024
|
>${this.renderCheckbox(this.selectAllLabel, every.length > 0 && count === every.length, count > 0 && count < every.length, this.toggleAll)}</span>`;
|
|
860
1025
|
}
|
|
1026
|
+
renderMore(page) {
|
|
1027
|
+
if (!this.moreDrawn) {
|
|
1028
|
+
return nothing;
|
|
1029
|
+
}
|
|
1030
|
+
const stop = this.currentRow(page) === page.length;
|
|
1031
|
+
return html `<div part="more" role="row" aria-rowindex=${this.rowIndex(page.length)} data-row=${page.length}>
|
|
1032
|
+
<span
|
|
1033
|
+
part="more-cell"
|
|
1034
|
+
role="gridcell"
|
|
1035
|
+
aria-colspan=${this.width}
|
|
1036
|
+
tabindex=${stop ? '0' : '-1'}
|
|
1037
|
+
data-column="0"
|
|
1038
|
+
><button part="more-button" type="button" tabindex="-1" @click=${this.askForMore}>${this.loadMoreLabel}</button></span
|
|
1039
|
+
>
|
|
1040
|
+
</div>`;
|
|
1041
|
+
}
|
|
861
1042
|
render() {
|
|
862
1043
|
const { available, matched, page } = this.view;
|
|
863
1044
|
this.drawnPage = page;
|
|
1045
|
+
this.moreDrawn = this.loadMore && !this.loading && page.length > 0;
|
|
864
1046
|
const rows = this.windowOf(page);
|
|
865
1047
|
const kept = this.keptRow(page);
|
|
866
1048
|
const headStop = this.currentRow(page) === -1;
|
|
@@ -872,7 +1054,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
872
1054
|
const countKnown = counted > 0 || this.sourceKnown;
|
|
873
1055
|
this.counts = {
|
|
874
1056
|
columns: columns.length ? columns.length + (this.selectable ? 1 : 0) : undefined,
|
|
875
|
-
rows: countKnown ? counted + 1 : undefined,
|
|
1057
|
+
rows: countKnown ? counted + 1 + (this.moreDrawn ? 1 : 0) : undefined,
|
|
876
1058
|
};
|
|
877
1059
|
return html `<div part="toolbar"><slot name="toolbar"></slot></div>
|
|
878
1060
|
<div
|
|
@@ -888,7 +1070,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
888
1070
|
: html `<slot name="columns" @slotchange=${this.handleSlotChange}></slot>`}
|
|
889
1071
|
</div>
|
|
890
1072
|
${this.renderSpacer('before', kept)}${this.renderRows(rows, page)}${this.renderSpacer('after', kept)}
|
|
891
|
-
${this.renderStatus(filled, 'gridcell')}
|
|
1073
|
+
${this.renderMore(page)}${this.renderStatus(filled, 'gridcell')}
|
|
892
1074
|
</div>
|
|
893
1075
|
${this.renderLive(filled)}
|
|
894
1076
|
<div part="footer">
|
|
@@ -918,7 +1100,10 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
918
1100
|
connectedCallback() {
|
|
919
1101
|
super.connectedCallback();
|
|
920
1102
|
this.addEventListener('click', this.handleHeadClick);
|
|
1103
|
+
this.addEventListener('pointerdown', this.notePress, true);
|
|
1104
|
+
this.addEventListener('keydown', this.notePress, true);
|
|
921
1105
|
this.addEventListener('focusin', this.handleFocusIn);
|
|
1106
|
+
this.renderRoot.addEventListener('focusin', this.handleFocusIn);
|
|
922
1107
|
this.addEventListener('keydown', this.handleGridKey);
|
|
923
1108
|
this.addEventListener('keydown', this.handleGripKey);
|
|
924
1109
|
this.addEventListener('pointerdown', this.handleGripDown);
|
|
@@ -927,7 +1112,10 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
927
1112
|
disconnectedCallback() {
|
|
928
1113
|
super.disconnectedCallback();
|
|
929
1114
|
this.removeEventListener('click', this.handleHeadClick);
|
|
1115
|
+
this.removeEventListener('pointerdown', this.notePress, true);
|
|
1116
|
+
this.removeEventListener('keydown', this.notePress, true);
|
|
930
1117
|
this.removeEventListener('focusin', this.handleFocusIn);
|
|
1118
|
+
this.renderRoot.removeEventListener('focusin', this.handleFocusIn);
|
|
931
1119
|
this.removeEventListener('keydown', this.handleGridKey);
|
|
932
1120
|
this.removeEventListener('keydown', this.handleGripKey);
|
|
933
1121
|
this.removeEventListener('pointerdown', this.handleGripDown);
|
|
@@ -941,6 +1129,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
941
1129
|
? this.partNamed('select-all')
|
|
942
1130
|
: (this.shownColumns[column - offset]?.cellBox ?? null);
|
|
943
1131
|
}
|
|
1132
|
+
if (this.moreDrawn && row === this.drawnPage.length) {
|
|
1133
|
+
return this.partNamed('more-cell');
|
|
1134
|
+
}
|
|
944
1135
|
const line = this.renderRoot.querySelector(`[part="row"][data-row="${row}"]`);
|
|
945
1136
|
return line?.querySelector(`:scope > [data-column="${column}"]`) ?? null;
|
|
946
1137
|
}
|
|
@@ -961,7 +1152,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
961
1152
|
}
|
|
962
1153
|
const role = node.getAttribute('role');
|
|
963
1154
|
if (node.dataset.column !== undefined &&
|
|
964
|
-
(role === 'gridcell' || role === 'columnheader') &&
|
|
1155
|
+
(role === 'gridcell' || role === 'columnheader' || role === 'rowheader') &&
|
|
965
1156
|
node.getRootNode() === this.renderRoot) {
|
|
966
1157
|
const line = node.parentElement?.dataset.row;
|
|
967
1158
|
return {
|
|
@@ -1067,9 +1258,38 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1067
1258
|
box.scrollLeft += rect.right - frame.right;
|
|
1068
1259
|
}
|
|
1069
1260
|
}
|
|
1261
|
+
treeKey(event, place) {
|
|
1262
|
+
const row = this.drawnPage[place.row];
|
|
1263
|
+
const header = this.headerColumn;
|
|
1264
|
+
if (!this.childField || !row || !header) {
|
|
1265
|
+
return false;
|
|
1266
|
+
}
|
|
1267
|
+
if (place.column !== this.shownColumns.indexOf(header) + (this.selectable ? 1 : 0)) {
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
const placed = this.tree().placed.get(row);
|
|
1271
|
+
const arrow = treeArrow({ branch: placed?.branch ?? false, open: placed?.open ?? false }, inlineStep(this, event.key) > 0 ? 1 : -1);
|
|
1272
|
+
if (arrow === 'open' || arrow === 'close') {
|
|
1273
|
+
event.preventDefault();
|
|
1274
|
+
this.toggleOpen(row, arrow === 'open');
|
|
1275
|
+
return true;
|
|
1276
|
+
}
|
|
1277
|
+
const parent = placed?.parent ? this.drawnPage.indexOf(placed.parent) : -1;
|
|
1278
|
+
if (arrow === 'parent' && parent >= 0) {
|
|
1279
|
+
event.preventDefault();
|
|
1280
|
+
this.moveTo(parent, place.column);
|
|
1281
|
+
return true;
|
|
1282
|
+
}
|
|
1283
|
+
return false;
|
|
1284
|
+
}
|
|
1070
1285
|
activate(event, place) {
|
|
1071
1286
|
const offset = this.selectable ? 1 : 0;
|
|
1072
1287
|
const heading = place.row === -1 ? this.shownColumns[place.column - offset] : undefined;
|
|
1288
|
+
if (this.moreDrawn && place.row === this.drawnPage.length && event.key !== 'F2') {
|
|
1289
|
+
event.preventDefault();
|
|
1290
|
+
this.askForMore();
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1073
1293
|
if (event.key !== 'F2') {
|
|
1074
1294
|
if (heading?.canSort) {
|
|
1075
1295
|
event.preventDefault();
|
|
@@ -1083,7 +1303,11 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1083
1303
|
}
|
|
1084
1304
|
if (event.key === ' ') {
|
|
1085
1305
|
const row = this.drawnPage[place.row];
|
|
1086
|
-
if (this.selectable && row) {
|
|
1306
|
+
if (this.selectable && row && event.shiftKey && this.anchorKey !== undefined) {
|
|
1307
|
+
event.preventDefault();
|
|
1308
|
+
this.selectRange(place.row);
|
|
1309
|
+
}
|
|
1310
|
+
else if (this.selectable && row) {
|
|
1087
1311
|
event.preventDefault();
|
|
1088
1312
|
const key = this.keyOf(row, this.rowIndex(place.row) - 2);
|
|
1089
1313
|
this.chooseRow(key, !this.chosen.has(key));
|
|
@@ -1140,6 +1364,12 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1140
1364
|
__decorate([
|
|
1141
1365
|
property({ attribute: 'ascending-label' })
|
|
1142
1366
|
], HelixHeadlessDataTable.prototype, "ascendingLabel", void 0);
|
|
1367
|
+
__decorate([
|
|
1368
|
+
property({ attribute: 'child-field', reflect: true })
|
|
1369
|
+
], HelixHeadlessDataTable.prototype, "childField", void 0);
|
|
1370
|
+
__decorate([
|
|
1371
|
+
property({ attribute: 'default-expanded' })
|
|
1372
|
+
], HelixHeadlessDataTable.prototype, "defaultExpanded", void 0);
|
|
1143
1373
|
__decorate([
|
|
1144
1374
|
property({ attribute: 'default-filter' })
|
|
1145
1375
|
], HelixHeadlessDataTable.prototype, "defaultFilter", void 0);
|
|
@@ -1164,6 +1394,9 @@ __decorate([
|
|
|
1164
1394
|
__decorate([
|
|
1165
1395
|
property({ type: Number })
|
|
1166
1396
|
], HelixHeadlessDataTable.prototype, "estimate", void 0);
|
|
1397
|
+
__decorate([
|
|
1398
|
+
property()
|
|
1399
|
+
], HelixHeadlessDataTable.prototype, "expanded", null);
|
|
1167
1400
|
__decorate([
|
|
1168
1401
|
property()
|
|
1169
1402
|
], HelixHeadlessDataTable.prototype, "filter", null);
|
|
@@ -1173,6 +1406,12 @@ __decorate([
|
|
|
1173
1406
|
__decorate([
|
|
1174
1407
|
property()
|
|
1175
1408
|
], HelixHeadlessDataTable.prototype, "label", void 0);
|
|
1409
|
+
__decorate([
|
|
1410
|
+
property({ attribute: 'load-more', type: Boolean })
|
|
1411
|
+
], HelixHeadlessDataTable.prototype, "loadMore", void 0);
|
|
1412
|
+
__decorate([
|
|
1413
|
+
property({ attribute: 'load-more-label' })
|
|
1414
|
+
], HelixHeadlessDataTable.prototype, "loadMoreLabel", void 0);
|
|
1176
1415
|
__decorate([
|
|
1177
1416
|
property()
|
|
1178
1417
|
], HelixHeadlessDataTable.prototype, "mode", void 0);
|
|
@@ -1266,6 +1505,9 @@ __decorate([
|
|
|
1266
1505
|
__decorate([
|
|
1267
1506
|
state()
|
|
1268
1507
|
], HelixHeadlessDataTable.prototype, "selectedState", void 0);
|
|
1508
|
+
__decorate([
|
|
1509
|
+
state()
|
|
1510
|
+
], HelixHeadlessDataTable.prototype, "expandedState", void 0);
|
|
1269
1511
|
__decorate([
|
|
1270
1512
|
state()
|
|
1271
1513
|
], HelixHeadlessDataTable.prototype, "activeRow", void 0);
|