@fusion.dev/helix-headless 0.147.0 → 0.149.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 +11222 -2332
- package/dist/accordion/item/accordion-item.d.ts +5 -2
- package/dist/accordion/item/accordion-item.js +11 -7
- package/dist/accordion/root/accordion-root.js +4 -6
- package/dist/announcement/root/announcement-root.d.ts +61 -5
- package/dist/announcement/root/announcement-root.js +126 -20
- package/dist/area-chart/root/area-chart-root.d.ts +11 -0
- package/dist/area-chart/root/area-chart-root.js +21 -9
- package/dist/avatar/group/avatar-group.d.ts +10 -2
- package/dist/avatar/group/avatar-group.js +10 -5
- package/dist/badge/count.d.ts +19 -0
- package/dist/badge/count.js +20 -0
- package/dist/badge/root/badge-root.d.ts +6 -2
- package/dist/badge/root/badge-root.js +8 -22
- package/dist/bar-chart/root/bar-chart-root.d.ts +13 -1
- package/dist/bar-chart/root/bar-chart-root.js +17 -4
- package/dist/blockquote/root/blockquote-root.d.ts +66 -8
- package/dist/blockquote/root/blockquote-root.js +85 -8
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +2 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +8 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +5 -2
- package/dist/button/root/button-root.d.ts +10 -1
- package/dist/button/root/button-root.js +3 -2
- package/dist/button-group/arrows.d.ts +14 -0
- package/dist/button-group/arrows.js +10 -0
- package/dist/button-group/root/button-group-root.d.ts +144 -3
- package/dist/button-group/root/button-group-root.js +142 -2
- package/dist/callout/root/callout-root.d.ts +16 -2
- package/dist/callout/root/callout-root.js +16 -4
- package/dist/canvas/describe.d.ts +10 -0
- package/dist/canvas/describe.js +9 -0
- package/dist/canvas/edge-pan.d.ts +61 -0
- package/dist/canvas/edge-pan.js +63 -0
- package/dist/canvas/neighbor.d.ts +17 -0
- package/dist/canvas/neighbor.js +1 -0
- package/dist/canvas/node/canvas-node.d.ts +12 -2
- package/dist/canvas/node/canvas-node.js +8 -3
- package/dist/canvas/root/canvas-document.d.ts +10 -0
- package/dist/canvas/root/canvas-document.js +1 -0
- package/dist/canvas/root/canvas-root.d.ts +168 -9
- package/dist/canvas/root/canvas-root.js +239 -69
- package/dist/canvas/snap.d.ts +42 -0
- package/dist/canvas/snap.js +32 -0
- package/dist/carousel/root/carousel-root.d.ts +9 -3
- package/dist/carousel/root/carousel-root.js +17 -10
- package/dist/chat/composer/chat-composer.d.ts +5 -0
- package/dist/chat/composer/chat-composer.js +4 -1
- package/dist/chat/message/chat-message.d.ts +9 -5
- package/dist/chat/message/chat-message.js +8 -4
- package/dist/chat/naming.js +2 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +38 -14
- package/dist/checkbox/root/checkbox-root.d.ts +11 -0
- package/dist/checkbox/root/checkbox-root.js +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +24 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +28 -12
- package/dist/checkbox-group/select-all.d.ts +11 -0
- package/dist/checkbox-group/select-all.js +5 -0
- package/dist/code-block/root/code-block-root.d.ts +20 -8
- package/dist/code-block/root/code-block-root.js +16 -5
- package/dist/color-input/root/color-input-root.d.ts +13 -0
- package/dist/color-input/root/color-input-root.js +18 -5
- package/dist/color-picker/root/color-picker-root.d.ts +19 -3
- package/dist/color-picker/root/color-picker-root.js +52 -24
- package/dist/color-picker/wheel.d.ts +11 -0
- package/dist/color-picker/wheel.js +9 -0
- package/dist/combobox/root/combobox-root.d.ts +106 -18
- package/dist/combobox/root/combobox-root.js +101 -26
- package/dist/command/root/command-root.d.ts +19 -9
- package/dist/command/root/command-root.js +9 -4
- package/dist/copy-button/root/copy-button-root.d.ts +5 -0
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/root/data-table-root.d.ts +171 -29
- package/dist/data-table/root/data-table-root.js +284 -161
- package/dist/date-input/root/date-input-root.d.ts +32 -9
- package/dist/date-input/root/date-input-root.js +66 -44
- package/dist/date-picker/root/date-picker-root.d.ts +38 -15
- package/dist/date-picker/root/date-picker-root.js +52 -33
- package/dist/description-list/item/description-list-item.d.ts +4 -0
- package/dist/description-list/item/description-list-item.js +7 -1
- package/dist/dialog/root/dialog-root.d.ts +12 -1
- package/dist/dialog/root/dialog-root.js +11 -4
- package/dist/divider/root/divider-root.d.ts +45 -16
- package/dist/divider/root/divider-root.js +28 -4
- package/dist/donut-chart/root/donut-chart-root.d.ts +5 -0
- package/dist/donut-chart/root/donut-chart-root.js +8 -5
- package/dist/drawer/root/drawer-root.d.ts +12 -1
- package/dist/drawer/root/drawer-root.js +9 -2
- package/dist/drilldown/item/drilldown-item.js +3 -4
- package/dist/drilldown/root/drilldown-root.d.ts +5 -0
- package/dist/drilldown/root/drilldown-root.js +4 -1
- package/dist/element-events.generated.js +26 -3
- package/dist/empty/root/empty-root.d.ts +17 -3
- package/dist/empty/root/empty-root.js +29 -5
- package/dist/file-input/root/file-input-root.d.ts +18 -3
- package/dist/file-input/root/file-input-root.js +34 -18
- package/dist/file-input/status.js +2 -1
- package/dist/filter-input/chip/filter-chip.d.ts +13 -0
- package/dist/filter-input/chip/filter-chip.js +7 -3
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +3 -1
- package/dist/filter-input/root/filter-input-root.d.ts +20 -3
- package/dist/filter-input/root/filter-input-root.js +8 -4
- package/dist/format-date/fields.d.ts +20 -0
- package/dist/format-date/fields.js +14 -0
- package/dist/format-date/options.d.ts +2 -1
- package/dist/format-date/options.js +9 -38
- package/dist/format-date/root/format-date-root.d.ts +55 -5
- package/dist/format-date/root/format-date-root.js +29 -34
- package/dist/graph/root/graph-model.d.ts +11 -0
- package/dist/graph/root/graph-model.js +4 -0
- package/dist/graph/root/graph-root.d.ts +101 -14
- package/dist/graph/root/graph-root.js +140 -46
- package/dist/heatmap/root/heatmap-root.d.ts +37 -4
- package/dist/heatmap/root/heatmap-root.js +51 -16
- package/dist/icon-button/root/icon-button-root.d.ts +5 -0
- package/dist/icon-button/root/icon-button-root.js +1 -0
- package/dist/image/root/image-root.d.ts +11 -0
- package/dist/input/root/input-root.d.ts +5 -0
- package/dist/input/root/input-root.js +4 -1
- package/dist/kbd/root/kbd-root.js +1 -2
- package/dist/legend/root/legend-root.js +4 -17
- package/dist/lightbox/root/lightbox-root.d.ts +14 -4
- package/dist/lightbox/root/lightbox-root.js +25 -7
- package/dist/line-chart/root/line-chart-root.d.ts +5 -0
- package/dist/line-chart/root/line-chart-root.js +4 -2
- package/dist/list/item/list-item.d.ts +32 -0
- package/dist/list/item/list-item.js +34 -7
- package/dist/list/root/list-root.d.ts +87 -0
- package/dist/list/root/list-root.js +119 -23
- package/dist/listbox/reorder/index.d.ts +1 -0
- package/dist/listbox/reorder/index.js +4 -0
- package/dist/listbox/reorder/listbox-reorder.d.ts +83 -0
- package/dist/listbox/reorder/listbox-reorder.js +151 -0
- package/dist/listbox/root/listbox-root.d.ts +185 -33
- package/dist/listbox/root/listbox-root.js +166 -136
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/loader/root/loader-root.js +3 -1
- package/dist/map/area/map-area.d.ts +5 -0
- package/dist/map/area/map-area.js +3 -1
- package/dist/map/buildings/map-buildings.d.ts +5 -0
- package/dist/map/buildings/map-buildings.js +3 -1
- package/dist/map/contours/map-contours.d.ts +5 -0
- package/dist/map/contours/map-contours.js +3 -1
- package/dist/map/landcover/map-landcover.d.ts +5 -0
- package/dist/map/landcover/map-landcover.js +3 -1
- package/dist/map/marker/map-marker.d.ts +18 -2
- package/dist/map/marker/map-marker.js +13 -5
- package/dist/map/points/map-points.d.ts +5 -0
- package/dist/map/points/map-points.js +6 -4
- package/dist/map/position/map-position.d.ts +5 -0
- package/dist/map/position/map-position.js +3 -1
- package/dist/map/raster/map-raster.d.ts +5 -0
- package/dist/map/raster/map-raster.js +3 -1
- package/dist/map/root/map-root.d.ts +73 -16
- package/dist/map/root/map-root.js +122 -44
- package/dist/map/route/map-route.d.ts +5 -0
- package/dist/map/route/map-route.js +3 -1
- package/dist/map/terrain/map-terrain.d.ts +5 -0
- package/dist/map/terrain/map-terrain.js +3 -1
- package/dist/megamenu/root/megamenu-root.js +4 -11
- package/dist/menu/root/menu-root.d.ts +7 -2
- package/dist/menu/root/menu-root.js +3 -1
- package/dist/meter/root/meter-root.d.ts +16 -3
- package/dist/meter/root/meter-root.js +12 -5
- package/dist/navigation/root/navigation-root.d.ts +5 -0
- package/dist/navigation/root/navigation-root.js +7 -8
- package/dist/notifications/group/notification-group.d.ts +8 -1
- package/dist/notifications/group/notification-group.js +12 -6
- package/dist/notifications/notification/notification.d.ts +17 -1
- package/dist/notifications/notification/notification.js +6 -2
- package/dist/notifications/root/notifications-root.d.ts +49 -5
- package/dist/notifications/root/notifications-root.js +36 -8
- package/dist/number-input/root/number-input-root.d.ts +21 -8
- package/dist/number-input/root/number-input-root.js +26 -11
- package/dist/object-inspector/root/object-inspector-root.d.ts +56 -13
- package/dist/object-inspector/root/object-inspector-root.js +41 -30
- package/dist/outline/root/outline-root.d.ts +5 -0
- package/dist/outline/root/outline-root.js +3 -1
- package/dist/pagination/root/pagination-root.d.ts +7 -1
- package/dist/pagination/root/pagination-root.js +16 -7
- package/dist/pagination/size/pagination-size.d.ts +8 -3
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pagination/summary/pagination-summary.d.ts +8 -6
- package/dist/pagination/summary/pagination-summary.js +4 -9
- package/dist/pin-input/code.d.ts +23 -0
- package/dist/pin-input/code.js +21 -0
- package/dist/pin-input/root/pin-input-root.d.ts +9 -3
- package/dist/pin-input/root/pin-input-root.js +13 -23
- package/dist/popover/root/popover-root.d.ts +12 -2
- package/dist/popover/root/popover-root.js +10 -4
- package/dist/progress/root/progress-root.d.ts +7 -2
- package/dist/progress/root/progress-root.js +5 -2
- package/dist/qr-code/name.d.ts +3 -2
- package/dist/qr-code/name.js +2 -2
- package/dist/qr-code/root/qr-code-root.d.ts +26 -5
- package/dist/qr-code/root/qr-code-root.js +27 -6
- package/dist/radio/group/radio-group.d.ts +11 -0
- package/dist/radio/group/radio-group.js +8 -2
- package/dist/rating/root/rating-root.d.ts +12 -1
- package/dist/rating/root/rating-root.js +10 -3
- package/dist/scatter-chart/measures.d.ts +22 -0
- package/dist/scatter-chart/measures.js +11 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +22 -8
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -23
- package/dist/select/root/select-root.d.ts +67 -8
- package/dist/select/root/select-root.js +45 -11
- package/dist/skip-link/root/skip-link-root.d.ts +5 -0
- package/dist/skip-link/root/skip-link-root.js +3 -1
- package/dist/slider/root/slider-root.d.ts +7 -2
- package/dist/slider/root/slider-root.js +11 -5
- package/dist/sparkline/readings.d.ts +15 -5
- package/dist/sparkline/readings.js +3 -3
- package/dist/sparkline/root/sparkline-root.d.ts +9 -4
- package/dist/sparkline/root/sparkline-root.js +9 -3
- package/dist/speed-dial/group/speed-dial-group.d.ts +48 -0
- package/dist/speed-dial/group/speed-dial-group.js +43 -0
- package/dist/speed-dial/index.d.ts +1 -0
- package/dist/speed-dial/index.js +1 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +26 -1
- package/dist/speed-dial/item/speed-dial-item.js +41 -3
- package/dist/speed-dial/long-press.d.ts +50 -0
- package/dist/speed-dial/long-press.js +48 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +85 -1
- package/dist/speed-dial/root/speed-dial-root.js +117 -5
- package/dist/splitter/root/splitter-root.d.ts +12 -3
- package/dist/splitter/root/splitter-root.js +22 -4
- package/dist/steps/root/steps-root.d.ts +9 -2
- package/dist/steps/root/steps-root.js +6 -3
- package/dist/steps/step/step.d.ts +12 -0
- package/dist/steps/step/step.js +11 -2
- package/dist/switch/root/switch-root.d.ts +11 -0
- package/dist/switch/root/switch-root.js +8 -2
- package/dist/table/cell/table-cell.d.ts +8 -1
- package/dist/table/cell/table-cell.js +6 -2
- package/dist/table/column/table-column.d.ts +11 -4
- package/dist/table/column/table-column.js +15 -10
- package/dist/table/grid-controller.d.ts +122 -0
- package/dist/table/grid-controller.js +299 -0
- package/dist/table/root/table-root.d.ts +154 -8
- package/dist/table/root/table-root.js +197 -38
- package/dist/table/row/table-row.d.ts +55 -1
- package/dist/table/row/table-row.js +60 -7
- package/dist/tabs/root/tabs-root.d.ts +5 -0
- package/dist/tabs/root/tabs-root.js +3 -1
- package/dist/tag/group/tag-group.d.ts +5 -0
- package/dist/tag/group/tag-group.js +8 -15
- package/dist/tag/root/tag-root.d.ts +14 -1
- package/dist/tag/root/tag-root.js +11 -8
- package/dist/textarea/root/textarea-root.d.ts +5 -0
- package/dist/textarea/root/textarea-root.js +3 -1
- package/dist/time-input/root/time-input-root.d.ts +14 -7
- package/dist/time-input/root/time-input-root.js +43 -32
- package/dist/time-picker/root/time-picker-root.d.ts +16 -7
- package/dist/time-picker/root/time-picker-root.js +28 -12
- package/dist/toast/item/toast-item.d.ts +13 -3
- package/dist/toast/item/toast-item.js +2 -0
- package/dist/toast/root/toast-root.d.ts +22 -2
- package/dist/toast/root/toast-root.js +24 -17
- package/dist/toggle/group/toggle-group.js +3 -5
- package/dist/toolbar/root/toolbar-root.d.ts +36 -0
- package/dist/toolbar/root/toolbar-root.js +43 -9
- package/dist/tooltip/root/tooltip-root.d.ts +27 -17
- package/dist/tooltip/root/tooltip-root.js +1 -2
- package/dist/tour/root/tour-root.d.ts +8 -2
- package/dist/tour/root/tour-root.js +4 -2
- package/dist/tour/stop/tour-stop.d.ts +5 -0
- package/dist/tour/stop/tour-stop.js +6 -1
- package/dist/tree/grip.d.ts +5 -0
- package/dist/tree/grip.js +1 -0
- package/dist/tree/item/tree-item.d.ts +24 -0
- package/dist/tree/item/tree-item.js +27 -5
- package/dist/tree/root/tree-root.d.ts +66 -1
- package/dist/tree/root/tree-root.js +77 -5
- package/dist/trend/root/trend-root.d.ts +20 -4
- package/dist/trend/root/trend-root.js +20 -5
- package/dist/video/root/video-root.d.ts +23 -3
- package/dist/video/root/video-root.js +56 -15
- 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/root/video-playlist-root.d.ts +5 -0
- package/dist/video-playlist/root/video-playlist-root.js +3 -1
- package/dist/virtual-list/root/virtual-list-root.d.ts +19 -3
- package/dist/virtual-list/root/virtual-list-root.js +10 -19
- package/lint.json +1 -1
- package/package.json +7 -6
- package/types/jsx.d.ts +6005 -2114
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1594 -676
- package/types/words.d.ts +3280 -0
- package/dist/kbd/keys.d.ts +0 -29
- package/dist/kbd/keys.js +0 -52
- package/dist/toast/hotkey.d.ts +0 -22
- package/dist/toast/hotkey.js +0 -23
- package/dist/tooltip/focus-target.d.ts +0 -6
- package/dist/tooltip/focus-target.js +0 -9
|
@@ -5,8 +5,8 @@ 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 { anchorAt, arranged, commaList, countLabel, customElement, cycle, deepActiveElement, deepContains, everyState,
|
|
9
|
-
import { caretDown, caretRight } from '@fusion.dev/helix-icons';
|
|
8
|
+
import { anchorAt, arranged, commaList, countLabel, customElement, cycle, deepActiveElement, deepContains, everyState, format, formatWords, gridMove, HelixActivateEvent, HelixElement, HelixExpandEvent, HelixFilterEvent, HelixFilteredEvent, HelixLoadMoreEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, handedLocale, hostAria, inlineStep, inRowOrder, MixinCollection, markRegion, onAndroid, ordered, pageRows, parse, placeKey, ReorderController, rangeAdd, reportRuntime, requestChange, requestReorder, scrollingAncestor, scrollRoom, selectsAll, Typeahead, toggleEvery, treeArrow, typesCharacter, VirtualizeController, valueAt, window_, words, wordsLocale, writtenList, } from '@fusion.dev/helix-core';
|
|
9
|
+
import { caretDown, caretRight, dotsSixVertical } from '@fusion.dev/helix-icons';
|
|
10
10
|
import { nothing } from 'lit';
|
|
11
11
|
import { property, state } from 'lit/decorators.js';
|
|
12
12
|
import { repeat } from 'lit/directives/repeat.js';
|
|
@@ -31,6 +31,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
|
33
33
|
this.ascendingLabel = 'ascending';
|
|
34
|
+
this.canceledLabel = 'Canceled';
|
|
34
35
|
this.defaultExpanded = '';
|
|
35
36
|
this.defaultFilter = '';
|
|
36
37
|
this.defaultOrder = '';
|
|
@@ -39,26 +40,32 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
39
40
|
this.defaultSelected = '';
|
|
40
41
|
this.defaultSort = '';
|
|
41
42
|
this.descendingLabel = 'descending';
|
|
43
|
+
this.droppedLabel = 'Dropped';
|
|
42
44
|
this.estimate = 32;
|
|
43
45
|
this.gapLabel = 'Skip to page {page}';
|
|
44
46
|
this.label = '';
|
|
45
47
|
this.loadMore = false;
|
|
46
48
|
this.loadMoreLabel = 'Load more';
|
|
49
|
+
this.locale = '';
|
|
47
50
|
this.mode = 'client';
|
|
51
|
+
this.movedLabel = '{name} moved to position {position} of {count}';
|
|
52
|
+
this.moveRowLabel = 'Move {row}';
|
|
48
53
|
this.nextLabel = 'Next page';
|
|
49
54
|
this.pageLabel = 'Page {page}';
|
|
50
55
|
this.paginationLabel = 'Pagination';
|
|
56
|
+
this.pickedUpLabel = 'Picked up {name}';
|
|
51
57
|
this.previousLabel = 'Previous page';
|
|
52
58
|
this.reorderable = false;
|
|
53
|
-
this.
|
|
54
|
-
this.resultsLabel = '{count} results';
|
|
59
|
+
this.reorderableRows = false;
|
|
60
|
+
this.resultsLabel = '{count, plural, one {# result} other {# results}}';
|
|
61
|
+
this.rowGripsLabel = 'Move rows';
|
|
55
62
|
this.rowKey = '';
|
|
56
63
|
this.rows = [];
|
|
57
64
|
this.selectable = false;
|
|
58
65
|
this.selectAllLabel = 'Select every row';
|
|
59
66
|
this.selectedLabel = '{count} selected';
|
|
60
67
|
this.selectRowLabel = 'Select {row}';
|
|
61
|
-
this.sortedLabel = 'Sorted by {column}, {
|
|
68
|
+
this.sortedLabel = '{direction, select, ascending {Sorted by {column}, ascending} descending {Sorted by {column}, descending} other {Sorted by {column}}}';
|
|
62
69
|
this.total = 0;
|
|
63
70
|
this.unsortedLabel = 'Not sorted';
|
|
64
71
|
this.windowed = false;
|
|
@@ -83,7 +90,56 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
83
90
|
columns: undefined,
|
|
84
91
|
rows: undefined,
|
|
85
92
|
};
|
|
86
|
-
this.
|
|
93
|
+
this.columnMoves = new ReorderController(this, {
|
|
94
|
+
axis: 'inline',
|
|
95
|
+
box: (field) => this.tableColumns
|
|
96
|
+
.find((column) => column.field === field)
|
|
97
|
+
?.shadowRoot?.querySelector('[part="column"]')
|
|
98
|
+
?.getBoundingClientRect(),
|
|
99
|
+
drop: ({ key, to }) => {
|
|
100
|
+
const shown = this.shownFields;
|
|
101
|
+
const wanted = placeKey(this.fields, shown, key, to);
|
|
102
|
+
return wanted.join(' ') === this.fields.join(' ') || this.requestOrder(wanted, key);
|
|
103
|
+
},
|
|
104
|
+
enabled: () => this.reorderable,
|
|
105
|
+
grip: (event) => {
|
|
106
|
+
const column = this.partIn(event, 'grip') ? this.columnFrom(event) : undefined;
|
|
107
|
+
return column?.field ? { element: column, key: column.field } : undefined;
|
|
108
|
+
},
|
|
109
|
+
holds: false,
|
|
110
|
+
keys: () => this.shownFields,
|
|
111
|
+
});
|
|
112
|
+
this.rowMoves = new ReorderController(this, {
|
|
113
|
+
axis: 'block',
|
|
114
|
+
box: (key) => this.lineOf(key)?.firstElementChild?.getBoundingClientRect(),
|
|
115
|
+
drop: (move) => this.requestRowMove(move),
|
|
116
|
+
enabled: () => this.rowGrips && !parse(this.sort),
|
|
117
|
+
grip: (event) => {
|
|
118
|
+
const cell = event
|
|
119
|
+
.composedPath()
|
|
120
|
+
.find((node) => node instanceof HTMLElement && node.getAttribute('part') === 'row-grip');
|
|
121
|
+
const row = cell ? this.drawnPage[Number(cell.parentElement?.dataset.row)] : undefined;
|
|
122
|
+
return cell && row ? { element: cell, key: this.moveKeyOf(row) } : undefined;
|
|
123
|
+
},
|
|
124
|
+
item: (event) => {
|
|
125
|
+
const place = this.placeOf(event);
|
|
126
|
+
const row = place && place.row >= 0 ? this.drawnPage[place.row] : undefined;
|
|
127
|
+
return row ? this.moveKeyOf(row) : undefined;
|
|
128
|
+
},
|
|
129
|
+
keys: () => this.drawnPage.map((row) => this.moveKeyOf(row)),
|
|
130
|
+
name: (key) => {
|
|
131
|
+
const row = this.drawnPage[this.pagePlaces().get(key) ?? -1];
|
|
132
|
+
return row ? this.rowName(row, key) : key;
|
|
133
|
+
},
|
|
134
|
+
preview: (key) => this.lineOf(key),
|
|
135
|
+
say: (said) => this.say(said),
|
|
136
|
+
scroller: () => {
|
|
137
|
+
const table = this.partNamed('table');
|
|
138
|
+
return table && table.scrollHeight > table.clientHeight + 1
|
|
139
|
+
? table
|
|
140
|
+
: scrollingAncestor(this, { axis: 'y', overflowing: true });
|
|
141
|
+
},
|
|
142
|
+
});
|
|
87
143
|
this.warnedAboutKey = false;
|
|
88
144
|
this.virtualize = new VirtualizeController(this, {
|
|
89
145
|
container: () => (this.windowed ? this.partNamed('table') : null),
|
|
@@ -165,8 +221,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
165
221
|
return;
|
|
166
222
|
}
|
|
167
223
|
const last = this.drawnPage.length - 1 + (this.moreDrawn ? 1 : 0);
|
|
168
|
-
const edge = this.width - 1;
|
|
169
|
-
const control = event.ctrlKey || event.metaKey;
|
|
170
224
|
if (!event.shiftKey && selectsAll(event) && this.selectable) {
|
|
171
225
|
event.preventDefault();
|
|
172
226
|
this.requestSelected(new Set([...this.chosen, ...this.everyKey]));
|
|
@@ -180,43 +234,22 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
180
234
|
}
|
|
181
235
|
return;
|
|
182
236
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
row = Math.max(-1, row - 1);
|
|
187
|
-
break;
|
|
188
|
-
case 'ArrowDown':
|
|
189
|
-
row = Math.min(last, row + 1);
|
|
190
|
-
break;
|
|
191
|
-
case 'ArrowLeft':
|
|
192
|
-
case 'ArrowRight':
|
|
193
|
-
if (this.treeKey(event, place)) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
column = Math.max(0, Math.min(edge, column + inlineStep(this, event.key)));
|
|
197
|
-
break;
|
|
198
|
-
case 'Home':
|
|
199
|
-
row = control ? -1 : row;
|
|
200
|
-
column = 0;
|
|
201
|
-
break;
|
|
202
|
-
case 'End':
|
|
203
|
-
row = control ? Math.max(row, last) : row;
|
|
204
|
-
column = edge;
|
|
205
|
-
break;
|
|
206
|
-
case 'PageUp':
|
|
207
|
-
row = Math.max(-1, row - this.pageStep(place.cell));
|
|
208
|
-
break;
|
|
209
|
-
case 'PageDown':
|
|
210
|
-
row = Math.min(last, row + this.pageStep(place.cell));
|
|
211
|
-
break;
|
|
212
|
-
case 'Enter':
|
|
213
|
-
case ' ':
|
|
214
|
-
case 'F2':
|
|
215
|
-
this.activate(event, place);
|
|
216
|
-
return;
|
|
217
|
-
default:
|
|
218
|
-
return;
|
|
237
|
+
if (event.key === 'Enter' || event.key === ' ' || event.key === 'F2') {
|
|
238
|
+
this.activate(event, place);
|
|
239
|
+
return;
|
|
219
240
|
}
|
|
241
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight') && this.treeKey(event, place)) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const to = gridMove(event.key, place, { last, top: -1, width: this.width }, {
|
|
245
|
+
control: event.ctrlKey || event.metaKey,
|
|
246
|
+
page: event.key.startsWith('Page') ? this.pageStep(place.cell) : 1,
|
|
247
|
+
step: inlineStep(this, event.key),
|
|
248
|
+
});
|
|
249
|
+
if (!to) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const { column, row } = to;
|
|
220
253
|
event.preventDefault();
|
|
221
254
|
if (event.shiftKey &&
|
|
222
255
|
this.selectable &&
|
|
@@ -241,54 +274,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
241
274
|
this.moveColumn(column.field, by);
|
|
242
275
|
}
|
|
243
276
|
};
|
|
244
|
-
this.handleGripDown = (event) => {
|
|
245
|
-
if (event.button !== 0 || !this.partIn(event, 'grip')) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
const column = this.columnFrom(event);
|
|
249
|
-
if (!column?.field) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
this.dragging = { field: column.field, pointer: event.pointerId };
|
|
253
|
-
this.dragOrder = this.fields;
|
|
254
|
-
window.addEventListener('pointermove', this.handleGripMove);
|
|
255
|
-
window.addEventListener('pointerup', this.handleGripUp);
|
|
256
|
-
window.addEventListener('pointercancel', this.handleGripCancel);
|
|
257
|
-
};
|
|
258
|
-
this.handleGripMove = (event) => {
|
|
259
|
-
const dragging = this.dragging;
|
|
260
|
-
if (!dragging || event.pointerId !== dragging.pointer || !this.dragOrder) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
const rtl = isRtl(this);
|
|
264
|
-
const others = this.shownColumns.filter((column) => column.field !== '' && column.field !== dragging.field);
|
|
265
|
-
const place = others.filter((column) => {
|
|
266
|
-
const box = column.shadowRoot?.querySelector('[part="column"]')?.getBoundingClientRect();
|
|
267
|
-
if (!box) {
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
const middle = box.left + box.width / 2;
|
|
271
|
-
return rtl ? event.clientX < middle : event.clientX > middle;
|
|
272
|
-
}).length;
|
|
273
|
-
const beside = others[place - 1] ?? others[0];
|
|
274
|
-
if (!beside) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
const next = this.placed(dragging.field, beside.field, place > 0);
|
|
278
|
-
if (next.join(' ') !== this.dragOrder.join(' ')) {
|
|
279
|
-
this.dragOrder = next;
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
this.handleGripUp = () => {
|
|
283
|
-
const wanted = this.dragOrder;
|
|
284
|
-
this.stopDrag();
|
|
285
|
-
if (wanted && wanted.join(' ') !== this.fields.join(' ')) {
|
|
286
|
-
this.requestOrder(wanted);
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
this.handleGripCancel = () => {
|
|
290
|
-
this.stopDrag();
|
|
291
|
-
};
|
|
292
277
|
this.handleResize = () => {
|
|
293
278
|
queueMicrotask(() => this.requestUpdate());
|
|
294
279
|
};
|
|
@@ -308,6 +293,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
308
293
|
...HelixElement.shadowRootOptions,
|
|
309
294
|
slotAssignment: 'manual',
|
|
310
295
|
}; }
|
|
296
|
+
static { this.words = 'helix-data-table'; }
|
|
311
297
|
get expanded() {
|
|
312
298
|
return this.expandedState ?? this.defaultExpanded;
|
|
313
299
|
}
|
|
@@ -373,8 +359,15 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
373
359
|
this.sortState = next;
|
|
374
360
|
this.requestUpdate('sort', previous);
|
|
375
361
|
}
|
|
362
|
+
lineOf(key) {
|
|
363
|
+
const index = this.pagePlaces().get(key);
|
|
364
|
+
const { first, last } = this.virtualize.window;
|
|
365
|
+
return index === undefined || (this.windowed && (index < first || index >= last))
|
|
366
|
+
? undefined
|
|
367
|
+
: this.renderRoot?.querySelector?.(`[part~="row"][data-row="${index}"]`);
|
|
368
|
+
}
|
|
376
369
|
drawn() {
|
|
377
|
-
return [...this.renderRoot.querySelectorAll('[part
|
|
370
|
+
return [...this.renderRoot.querySelectorAll('[part~="row"][data-index]')].flatMap((row) => {
|
|
378
371
|
const cell = row.firstElementChild;
|
|
379
372
|
return cell instanceof HTMLElement
|
|
380
373
|
? [{ element: cell, index: Number(row.dataset.index) }]
|
|
@@ -489,7 +482,16 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
489
482
|
return Math.min(asked, rows.length - 1 + (this.moreDrawn ? 1 : 0));
|
|
490
483
|
}
|
|
491
484
|
get width() {
|
|
492
|
-
return this.shownColumns.length +
|
|
485
|
+
return this.shownColumns.length + this.lead;
|
|
486
|
+
}
|
|
487
|
+
get rowGrips() {
|
|
488
|
+
return this.reorderableRows && !this.childField;
|
|
489
|
+
}
|
|
490
|
+
get selectAt() {
|
|
491
|
+
return this.rowGrips ? 1 : 0;
|
|
492
|
+
}
|
|
493
|
+
get lead() {
|
|
494
|
+
return (this.rowGrips ? 1 : 0) + (this.selectable ? 1 : 0);
|
|
493
495
|
}
|
|
494
496
|
get currentColumn() {
|
|
495
497
|
return Math.max(0, Math.min(this.activeColumn, this.width - 1));
|
|
@@ -498,8 +500,18 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
498
500
|
return this.knownChildren.filter((child) => 'isTableColumn' in child && child.isTableColumn === true);
|
|
499
501
|
}
|
|
500
502
|
get orderedColumns() {
|
|
503
|
+
const columns = this.arrangeColumns(writtenList(this.order));
|
|
504
|
+
const held = this.columnMoves.held;
|
|
505
|
+
if (held?.by !== 'pointer') {
|
|
506
|
+
return columns;
|
|
507
|
+
}
|
|
508
|
+
const fields = columns.filter((column) => column.field !== '');
|
|
509
|
+
const shown = fields.filter((column) => column.shown).map((column) => column.field);
|
|
510
|
+
const all = fields.map((column) => column.field);
|
|
511
|
+
return this.arrangeColumns(placeKey(all, shown, held.key, held.to));
|
|
512
|
+
}
|
|
513
|
+
arrangeColumns(wanted) {
|
|
501
514
|
const columns = this.tableColumns;
|
|
502
|
-
const wanted = this.dragOrder ?? writtenList(this.order);
|
|
503
515
|
if (wanted.length === 0) {
|
|
504
516
|
return columns;
|
|
505
517
|
}
|
|
@@ -517,6 +529,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
517
529
|
get fields() {
|
|
518
530
|
return this.orderedColumns.filter((column) => column.field !== '').map((column) => column.field);
|
|
519
531
|
}
|
|
532
|
+
get shownFields() {
|
|
533
|
+
return this.shownColumns.filter((column) => column.field !== '').map((column) => column.field);
|
|
534
|
+
}
|
|
520
535
|
get axes() {
|
|
521
536
|
return this.tableColumns
|
|
522
537
|
.filter((column) => column.field !== '')
|
|
@@ -528,7 +543,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
528
543
|
return '';
|
|
529
544
|
}
|
|
530
545
|
const tracks = declared.map((column) => column.track).join(' ');
|
|
531
|
-
return this.
|
|
546
|
+
return [...Array.from({ length: this.lead }, () => 'max-content'), tracks].join(' ');
|
|
532
547
|
}
|
|
533
548
|
static { this.COMFORTABLE = 2_000; }
|
|
534
549
|
warnIfCrowded(drawn) {
|
|
@@ -624,15 +639,27 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
624
639
|
next,
|
|
625
640
|
});
|
|
626
641
|
}
|
|
627
|
-
requestOrder(fields) {
|
|
642
|
+
requestOrder(fields, field) {
|
|
643
|
+
const detail = (value) => {
|
|
644
|
+
const keys = writtenList(value);
|
|
645
|
+
return {
|
|
646
|
+
from: this.fields.indexOf(field),
|
|
647
|
+
key: field,
|
|
648
|
+
keys,
|
|
649
|
+
kind: 'column',
|
|
650
|
+
to: keys.indexOf(field),
|
|
651
|
+
value,
|
|
652
|
+
};
|
|
653
|
+
};
|
|
628
654
|
return requestChange({
|
|
629
655
|
apply: (value) => {
|
|
656
|
+
const moved = detail(value);
|
|
630
657
|
const previous = this.order;
|
|
631
658
|
this.orderState = value;
|
|
632
659
|
this.requestUpdate('order', previous);
|
|
633
|
-
this.dispatchEvent(new HelixReorderedEvent(
|
|
660
|
+
this.dispatchEvent(new HelixReorderedEvent(moved));
|
|
634
661
|
},
|
|
635
|
-
event: (value) => new HelixReorderEvent(
|
|
662
|
+
event: (value) => new HelixReorderEvent(detail(value)),
|
|
636
663
|
host: this,
|
|
637
664
|
next: fields.join(' '),
|
|
638
665
|
});
|
|
@@ -675,6 +702,49 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
675
702
|
const rows = this.mode === 'server' ? this.rows : this.arrange().rows;
|
|
676
703
|
return rows.map((row, place) => this.keyOf(row, place));
|
|
677
704
|
}
|
|
705
|
+
moveKeyOf(row) {
|
|
706
|
+
const value = this.rowKey ? valueAt(row, this.rowKey) : undefined;
|
|
707
|
+
if (value !== undefined && value !== null) {
|
|
708
|
+
return String(value);
|
|
709
|
+
}
|
|
710
|
+
if (this.rowPlaces?.rows !== this.rows) {
|
|
711
|
+
this.rowPlaces = { places: new Map(this.rows.map((one, at) => [one, at])), rows: this.rows };
|
|
712
|
+
}
|
|
713
|
+
return String(this.rowPlaces.places.get(row) ?? -1);
|
|
714
|
+
}
|
|
715
|
+
pagePlaces() {
|
|
716
|
+
if (this.pageKeyed?.page !== this.drawnPage) {
|
|
717
|
+
this.pageKeyed = {
|
|
718
|
+
page: this.drawnPage,
|
|
719
|
+
places: new Map(this.drawnPage.map((row, at) => [this.moveKeyOf(row), at])),
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
return this.pageKeyed.places;
|
|
723
|
+
}
|
|
724
|
+
rowName(row, key) {
|
|
725
|
+
const value = this.headerColumn?.order(row);
|
|
726
|
+
return value === undefined || value === null ? key : String(value);
|
|
727
|
+
}
|
|
728
|
+
requestRowMove({ key, to }) {
|
|
729
|
+
const all = this.rows.map((row) => this.moveKeyOf(row));
|
|
730
|
+
const keys = placeKey(all, this.drawnPage.map((row) => this.moveKeyOf(row)), key, to);
|
|
731
|
+
return requestReorder(this, {
|
|
732
|
+
from: all.indexOf(key),
|
|
733
|
+
key,
|
|
734
|
+
keys,
|
|
735
|
+
kind: 'row',
|
|
736
|
+
to: keys.indexOf(key),
|
|
737
|
+
value: keys.join(','),
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
say(words) {
|
|
741
|
+
this.announced = '';
|
|
742
|
+
this.requestUpdate();
|
|
743
|
+
requestAnimationFrame(() => {
|
|
744
|
+
this.announced = words;
|
|
745
|
+
this.requestUpdate();
|
|
746
|
+
});
|
|
747
|
+
}
|
|
678
748
|
get pageKeys() {
|
|
679
749
|
return this.drawnPage.map((row, index) => this.keyOf(row, this.rowIndex(index) - 2));
|
|
680
750
|
}
|
|
@@ -724,18 +794,15 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
724
794
|
this.requestSelected(new Set(toggleEvery(this.chosen, this.everyKey)));
|
|
725
795
|
}
|
|
726
796
|
moveColumn(field, by) {
|
|
727
|
-
const drawn = this.
|
|
728
|
-
const from = drawn.
|
|
797
|
+
const drawn = this.shownFields;
|
|
798
|
+
const from = drawn.indexOf(field);
|
|
729
799
|
const past = drawn[from + by];
|
|
730
|
-
if (from < 0 ||
|
|
800
|
+
if (from < 0 || past === undefined) {
|
|
731
801
|
return false;
|
|
732
802
|
}
|
|
733
|
-
return this.requestOrder(this.placed(field, past.field, by > 0));
|
|
734
|
-
}
|
|
735
|
-
placed(field, beside, after) {
|
|
736
803
|
const fields = this.fields.filter((one) => one !== field);
|
|
737
|
-
fields.splice(fields.indexOf(
|
|
738
|
-
return fields;
|
|
804
|
+
fields.splice(fields.indexOf(past) + (by > 0 ? 1 : 0), 0, field);
|
|
805
|
+
return this.requestOrder(fields, field);
|
|
739
806
|
}
|
|
740
807
|
csv() {
|
|
741
808
|
const columns = this.shownColumns.filter((column) => column.field !== '');
|
|
@@ -818,6 +885,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
818
885
|
}
|
|
819
886
|
}
|
|
820
887
|
}
|
|
888
|
+
sortSaid(column, direction) {
|
|
889
|
+
return formatWords(this, 'sortedLabel', {
|
|
890
|
+
column,
|
|
891
|
+
direction,
|
|
892
|
+
order: direction === 'ascending' ? this.ascendingLabel : this.descendingLabel,
|
|
893
|
+
});
|
|
894
|
+
}
|
|
821
895
|
news() {
|
|
822
896
|
const sort = this.sort;
|
|
823
897
|
const selected = this.selectable ? this.selected : '';
|
|
@@ -828,20 +902,17 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
828
902
|
? this.tableColumns.find((one) => one.field === parsed.field)
|
|
829
903
|
: undefined;
|
|
830
904
|
said = parsed
|
|
831
|
-
?
|
|
832
|
-
column: column?.textContent?.trim() || parsed.field,
|
|
833
|
-
order: parsed.direction === 'asc' ? this.ascendingLabel : this.descendingLabel,
|
|
834
|
-
})
|
|
905
|
+
? this.sortSaid(column?.textContent?.trim() || parsed.field, parsed.direction === 'asc' ? 'ascending' : 'descending')
|
|
835
906
|
: this.unsortedLabel;
|
|
836
907
|
}
|
|
837
908
|
else if (this.hasUpdated && selected !== this.heardSelected) {
|
|
838
|
-
said =
|
|
839
|
-
count: formatNumbers(this.lang)(this.chosen.size),
|
|
840
|
-
});
|
|
909
|
+
said = formatWords(this, 'selectedLabel', { count: this.chosen.size });
|
|
841
910
|
}
|
|
842
911
|
else if (this.hasUpdated && this.filter !== this.heardFilter) {
|
|
843
912
|
const count = this.mode === 'server' ? Math.max(this.total, this.rows.length) : this.matched;
|
|
844
|
-
said =
|
|
913
|
+
said = this.resultLabel
|
|
914
|
+
? countLabel(count, this.resultLabel, this.resultsLabel, wordsLocale(this))
|
|
915
|
+
: formatWords(this, 'resultsLabel', { count });
|
|
845
916
|
}
|
|
846
917
|
this.heardSort = sort;
|
|
847
918
|
this.heardSelected = selected;
|
|
@@ -885,7 +956,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
885
956
|
announceSort() {
|
|
886
957
|
const current = parse(this.sort);
|
|
887
958
|
const stop = this.currentRow(this.drawnPage) === -1 ? this.currentColumn : -1;
|
|
888
|
-
const offset = this.
|
|
959
|
+
const offset = this.lead;
|
|
889
960
|
const shown = this.shownColumns;
|
|
890
961
|
const android = onAndroid();
|
|
891
962
|
for (const column of this.tableColumns) {
|
|
@@ -900,10 +971,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
900
971
|
: undefined;
|
|
901
972
|
column.sortWords =
|
|
902
973
|
android && column.sorted
|
|
903
|
-
?
|
|
904
|
-
column: column.textContent?.trim() || column.field,
|
|
905
|
-
order: column.sorted === 'ascending' ? this.ascendingLabel : this.descendingLabel,
|
|
906
|
-
})
|
|
974
|
+
? this.sortSaid(column.textContent?.trim() || column.field, column.sorted)
|
|
907
975
|
: '';
|
|
908
976
|
}
|
|
909
977
|
}
|
|
@@ -963,14 +1031,20 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
963
1031
|
const named = this.headerColumn;
|
|
964
1032
|
const stopRow = this.currentRow(page);
|
|
965
1033
|
const stopColumn = this.currentColumn;
|
|
966
|
-
const offset = this.
|
|
1034
|
+
const offset = this.lead;
|
|
1035
|
+
const grips = this.rowGrips;
|
|
1036
|
+
const held = grips ? this.rowMoves.held : undefined;
|
|
1037
|
+
const mark = held ? this.rowMoves.mark : undefined;
|
|
1038
|
+
const still = grips && Boolean(parse(this.sort));
|
|
967
1039
|
return html `${repeat(rows, ({ index, row }) => this.rowKeyOf(row, index), ({ index, row }) => {
|
|
968
1040
|
const key = chosen ? this.keyOf(row, this.rowIndex(index) - 2) : '';
|
|
969
1041
|
const picked = chosen?.has(key) ?? false;
|
|
970
1042
|
const placed = this.childField ? this.tree().placed.get(row) : undefined;
|
|
971
1043
|
const stop = (place) => index === stopRow && place === stopColumn;
|
|
1044
|
+
const moveKey = grips ? this.moveKeyOf(row) : '';
|
|
1045
|
+
const marked = mark?.key === moveKey ? mark.edge : undefined;
|
|
972
1046
|
return html `<div
|
|
973
|
-
part="row"
|
|
1047
|
+
part="row${held?.key === moveKey ? ' row-dragging' : ''}${marked === 'before' ? ' row-drop-before' : ''}${marked === 'after' ? ' row-drop-after' : ''}"
|
|
974
1048
|
role="row"
|
|
975
1049
|
aria-rowindex=${this.rowIndex(index)}
|
|
976
1050
|
aria-selected=${chosen ? String(picked) : nothing}
|
|
@@ -981,15 +1055,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
981
1055
|
data-index=${this.windowed ? index : nothing}
|
|
982
1056
|
data-row=${index}
|
|
983
1057
|
>
|
|
984
|
-
${chosen
|
|
1058
|
+
${grips ? this.renderGrip(this.rowName(row, moveKey), stop(0), still) : nothing}${chosen
|
|
985
1059
|
? html `<span
|
|
986
1060
|
part="select${picked ? ' select-selected' : ''}"
|
|
987
1061
|
role="gridcell"
|
|
988
|
-
tabindex=${stop(
|
|
989
|
-
data-column
|
|
990
|
-
>${this.renderCheckbox(
|
|
991
|
-
row: named ? String(named.order(row) ?? key) : key,
|
|
992
|
-
}), picked, false, (event) => this.toggleRow(key, event))}</span
|
|
1062
|
+
tabindex=${stop(this.selectAt) ? '0' : '-1'}
|
|
1063
|
+
data-column=${this.selectAt}
|
|
1064
|
+
>${this.renderCheckbox(formatWords(this, 'selectRowLabel', { row: this.rowName(row, key) }), picked, false, (event) => this.toggleRow(key, event))}</span
|
|
993
1065
|
>`
|
|
994
1066
|
: nothing}${columns.map((column, place) => this.renderCell(column, row, picked, place + offset, stop(place + offset), column === named))}
|
|
995
1067
|
</div>`;
|
|
@@ -1020,13 +1092,33 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1020
1092
|
? html `<div part="before" role="presentation" style="block-size: ${before}px"></div>`
|
|
1021
1093
|
: html `<div part="after" role="presentation" style="block-size: ${after}px"></div>`;
|
|
1022
1094
|
}
|
|
1095
|
+
renderGrip(name, stop, still) {
|
|
1096
|
+
return html `<span part="row-grip" role="gridcell" tabindex=${stop ? '0' : '-1'} data-column="0"
|
|
1097
|
+
><button
|
|
1098
|
+
part="row-grip-button"
|
|
1099
|
+
type="button"
|
|
1100
|
+
tabindex="-1"
|
|
1101
|
+
aria-label=${formatWords(this, 'moveRowLabel', { row: name })}
|
|
1102
|
+
aria-disabled=${still ? 'true' : nothing}
|
|
1103
|
+
><svg aria-hidden="true" fill="currentColor" part="row-grip-mark" viewBox=${dotsSixVertical.viewBox}>${unsafeSVG(dotsSixVertical.content)}</svg></button
|
|
1104
|
+
></span>`;
|
|
1105
|
+
}
|
|
1106
|
+
renderGripHead(stop) {
|
|
1107
|
+
return html `<span
|
|
1108
|
+
part="grip-head"
|
|
1109
|
+
role="columnheader"
|
|
1110
|
+
tabindex=${stop ? '0' : '-1'}
|
|
1111
|
+
aria-label=${this.rowGripsLabel}
|
|
1112
|
+
data-column="0"
|
|
1113
|
+
></span>`;
|
|
1114
|
+
}
|
|
1023
1115
|
renderSelectAll(stop) {
|
|
1024
1116
|
const { checked, indeterminate } = everyState(this.chosen, this.everyKey);
|
|
1025
1117
|
return html `<span
|
|
1026
1118
|
part="select-all"
|
|
1027
1119
|
role="columnheader"
|
|
1028
1120
|
tabindex=${stop ? '0' : '-1'}
|
|
1029
|
-
data-column
|
|
1121
|
+
data-column=${this.selectAt}
|
|
1030
1122
|
>${this.renderCheckbox(this.selectAllLabel, checked, indeterminate, this.toggleAll)}</span>`;
|
|
1031
1123
|
}
|
|
1032
1124
|
renderMore(page) {
|
|
@@ -1059,7 +1151,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1059
1151
|
const counted = this.mode === 'server' ? Math.max(this.total, available) : matched;
|
|
1060
1152
|
const countKnown = counted > 0 || this.sourceKnown;
|
|
1061
1153
|
this.counts = {
|
|
1062
|
-
columns: columns.length ? columns.length +
|
|
1154
|
+
columns: columns.length ? columns.length + this.lead : undefined,
|
|
1063
1155
|
rows: countKnown ? counted + 1 + (this.moreDrawn ? 1 : 0) : undefined,
|
|
1064
1156
|
};
|
|
1065
1157
|
return html `<div part="toolbar"><slot name="toolbar"></slot></div>
|
|
@@ -1071,7 +1163,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1071
1163
|
@scroll=${this.handleScroll}
|
|
1072
1164
|
>
|
|
1073
1165
|
<div part="head" role="row" aria-rowindex="1">
|
|
1074
|
-
${this.
|
|
1166
|
+
${this.rowGrips ? this.renderGripHead(headStop && this.currentColumn === 0) : nothing}${this.selectable
|
|
1167
|
+
? this.renderSelectAll(headStop && this.currentColumn === this.selectAt)
|
|
1168
|
+
: nothing}${this.assignsByName && !this.hydrating
|
|
1075
1169
|
? this.orderedColumns.map((_, index) => html `<slot name=${`column-${index + 1}`} @slotchange=${this.handleSlotChange}></slot>`)
|
|
1076
1170
|
: html `<slot name="columns" @slotchange=${this.handleSlotChange}></slot>`}
|
|
1077
1171
|
</div>
|
|
@@ -1093,6 +1187,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1093
1187
|
page-size=${this.pageSize || 1}
|
|
1094
1188
|
total=${countKnown ? matched : nothing}
|
|
1095
1189
|
label=${this.paginationLabel}
|
|
1190
|
+
locale=${handedLocale(this) || nothing}
|
|
1096
1191
|
gap-label=${this.gapLabel}
|
|
1097
1192
|
next-label=${this.nextLabel}
|
|
1098
1193
|
page-label=${this.pageLabel}
|
|
@@ -1101,7 +1196,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1101
1196
|
@helix-activate=${this.stopPageNotification}
|
|
1102
1197
|
></${pagination}>`
|
|
1103
1198
|
: nothing}
|
|
1104
|
-
</div
|
|
1199
|
+
</div>${this.rowMoves.drawDragPreview()}`;
|
|
1105
1200
|
}
|
|
1106
1201
|
connectedCallback() {
|
|
1107
1202
|
super.connectedCallback();
|
|
@@ -1112,7 +1207,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1112
1207
|
this.renderRoot.addEventListener('focusin', this.handleFocusIn);
|
|
1113
1208
|
this.addEventListener('keydown', this.handleGridKey);
|
|
1114
1209
|
this.addEventListener('keydown', this.handleGripKey);
|
|
1115
|
-
this.addEventListener('pointerdown', this.handleGripDown);
|
|
1116
1210
|
this.addEventListener('helix-before-resize', this.handleResize);
|
|
1117
1211
|
}
|
|
1118
1212
|
disconnectedCallback() {
|
|
@@ -1124,26 +1218,25 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1124
1218
|
this.renderRoot.removeEventListener('focusin', this.handleFocusIn);
|
|
1125
1219
|
this.removeEventListener('keydown', this.handleGridKey);
|
|
1126
1220
|
this.removeEventListener('keydown', this.handleGripKey);
|
|
1127
|
-
this.removeEventListener('pointerdown', this.handleGripDown);
|
|
1128
1221
|
this.removeEventListener('helix-before-resize', this.handleResize);
|
|
1129
|
-
this.stopDrag();
|
|
1130
1222
|
}
|
|
1131
1223
|
cellAt(row, column) {
|
|
1132
|
-
const offset = this.
|
|
1224
|
+
const offset = this.lead;
|
|
1133
1225
|
if (row === -1) {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1226
|
+
if (column >= offset) {
|
|
1227
|
+
return this.shownColumns[column - offset]?.cellBox ?? null;
|
|
1228
|
+
}
|
|
1229
|
+
return this.partNamed(this.rowGrips && column === 0 ? 'grip-head' : 'select-all');
|
|
1137
1230
|
}
|
|
1138
1231
|
if (this.moreDrawn && row === this.drawnPage.length) {
|
|
1139
1232
|
return this.partNamed('more-cell');
|
|
1140
1233
|
}
|
|
1141
|
-
const line = this.renderRoot.querySelector(`[part
|
|
1234
|
+
const line = this.renderRoot.querySelector(`[part~="row"][data-row="${row}"]`);
|
|
1142
1235
|
return line?.querySelector(`:scope > [data-column="${column}"]`) ?? null;
|
|
1143
1236
|
}
|
|
1144
1237
|
placeOf(event) {
|
|
1145
1238
|
const columns = this.shownColumns;
|
|
1146
|
-
const offset = this.
|
|
1239
|
+
const offset = this.lead;
|
|
1147
1240
|
for (const node of event.composedPath()) {
|
|
1148
1241
|
if (node === this) {
|
|
1149
1242
|
break;
|
|
@@ -1171,14 +1264,14 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1171
1264
|
return undefined;
|
|
1172
1265
|
}
|
|
1173
1266
|
controlsIn(place) {
|
|
1174
|
-
const offset = this.
|
|
1267
|
+
const offset = this.lead;
|
|
1175
1268
|
if (place.row === -1 && place.column >= offset) {
|
|
1176
1269
|
return this.shownColumns[place.column - offset]?.controls ?? [];
|
|
1177
1270
|
}
|
|
1178
1271
|
return [...place.cell.querySelectorAll('*')].filter(isControl);
|
|
1179
1272
|
}
|
|
1180
1273
|
quietControls() {
|
|
1181
|
-
const offset = this.
|
|
1274
|
+
const offset = this.lead;
|
|
1182
1275
|
const drawn = this.shownColumns;
|
|
1183
1276
|
const read = new Set(drawn.flatMap((column, place) => (column.cell ? [place + offset] : [])));
|
|
1184
1277
|
if (read.size === 0) {
|
|
@@ -1204,11 +1297,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1204
1297
|
this.focusWanted = true;
|
|
1205
1298
|
}
|
|
1206
1299
|
pageStep(cell) {
|
|
1207
|
-
|
|
1208
|
-
const tall = cell.getBoundingClientRect().height || this.estimate;
|
|
1209
|
-
const scrolls = box !== null && box.scrollHeight > box.clientHeight + 1;
|
|
1210
|
-
const room = scrolls ? box.clientHeight - this.headHeight() : window.innerHeight;
|
|
1211
|
-
return Math.max(1, Math.floor(room / tall) - 1);
|
|
1300
|
+
return pageRows(scrollRoom(this.partNamed('table'), { covered: this.headHeight() }), cell.getBoundingClientRect().height || this.estimate);
|
|
1212
1301
|
}
|
|
1213
1302
|
headHeight() {
|
|
1214
1303
|
return this.cellAt(-1, 0)?.getBoundingClientRect().height ?? 0;
|
|
@@ -1270,7 +1359,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1270
1359
|
if (!this.childField || !row || !header) {
|
|
1271
1360
|
return false;
|
|
1272
1361
|
}
|
|
1273
|
-
if (place.column !== this.shownColumns.indexOf(header) +
|
|
1362
|
+
if (place.column !== this.shownColumns.indexOf(header) + this.lead) {
|
|
1274
1363
|
return false;
|
|
1275
1364
|
}
|
|
1276
1365
|
const placed = this.tree().placed.get(row);
|
|
@@ -1289,7 +1378,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1289
1378
|
return false;
|
|
1290
1379
|
}
|
|
1291
1380
|
activate(event, place) {
|
|
1292
|
-
const offset = this.
|
|
1381
|
+
const offset = this.lead;
|
|
1293
1382
|
const heading = place.row === -1 ? this.shownColumns[place.column - offset] : undefined;
|
|
1294
1383
|
if (this.moreDrawn && place.row === this.drawnPage.length && event.key !== 'F2') {
|
|
1295
1384
|
event.preventDefault();
|
|
@@ -1302,7 +1391,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1302
1391
|
this.toggleSort(heading.field);
|
|
1303
1392
|
return;
|
|
1304
1393
|
}
|
|
1305
|
-
if (this.selectable && place.column ===
|
|
1394
|
+
if (this.selectable && place.column === this.selectAt && place.row === -1) {
|
|
1306
1395
|
event.preventDefault();
|
|
1307
1396
|
this.chooseAll();
|
|
1308
1397
|
return;
|
|
@@ -1350,13 +1439,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1350
1439
|
.composedPath()
|
|
1351
1440
|
.some((node) => node instanceof Element && node.getAttribute('part') === name);
|
|
1352
1441
|
}
|
|
1353
|
-
stopDrag() {
|
|
1354
|
-
this.dragging = undefined;
|
|
1355
|
-
this.dragOrder = undefined;
|
|
1356
|
-
window.removeEventListener('pointermove', this.handleGripMove);
|
|
1357
|
-
window.removeEventListener('pointerup', this.handleGripUp);
|
|
1358
|
-
window.removeEventListener('pointercancel', this.handleGripCancel);
|
|
1359
|
-
}
|
|
1360
1442
|
columnFrom(event) {
|
|
1361
1443
|
const columns = this.tableColumns;
|
|
1362
1444
|
for (const node of event.composedPath()) {
|
|
@@ -1368,8 +1450,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1368
1450
|
}
|
|
1369
1451
|
};
|
|
1370
1452
|
__decorate([
|
|
1453
|
+
words,
|
|
1371
1454
|
property({ attribute: 'ascending-label' })
|
|
1372
1455
|
], HelixHeadlessDataTable.prototype, "ascendingLabel", void 0);
|
|
1456
|
+
__decorate([
|
|
1457
|
+
words,
|
|
1458
|
+
property({ attribute: 'canceled-label' })
|
|
1459
|
+
], HelixHeadlessDataTable.prototype, "canceledLabel", void 0);
|
|
1373
1460
|
__decorate([
|
|
1374
1461
|
property({ attribute: 'child-field', reflect: true })
|
|
1375
1462
|
], HelixHeadlessDataTable.prototype, "childField", void 0);
|
|
@@ -1395,8 +1482,13 @@ __decorate([
|
|
|
1395
1482
|
property({ attribute: 'default-sort' })
|
|
1396
1483
|
], HelixHeadlessDataTable.prototype, "defaultSort", void 0);
|
|
1397
1484
|
__decorate([
|
|
1485
|
+
words,
|
|
1398
1486
|
property({ attribute: 'descending-label' })
|
|
1399
1487
|
], HelixHeadlessDataTable.prototype, "descendingLabel", void 0);
|
|
1488
|
+
__decorate([
|
|
1489
|
+
words,
|
|
1490
|
+
property({ attribute: 'dropped-label' })
|
|
1491
|
+
], HelixHeadlessDataTable.prototype, "droppedLabel", void 0);
|
|
1400
1492
|
__decorate([
|
|
1401
1493
|
property({ type: Number })
|
|
1402
1494
|
], HelixHeadlessDataTable.prototype, "estimate", void 0);
|
|
@@ -1407,6 +1499,7 @@ __decorate([
|
|
|
1407
1499
|
property()
|
|
1408
1500
|
], HelixHeadlessDataTable.prototype, "filter", null);
|
|
1409
1501
|
__decorate([
|
|
1502
|
+
words,
|
|
1410
1503
|
property({ attribute: 'gap-label' })
|
|
1411
1504
|
], HelixHeadlessDataTable.prototype, "gapLabel", void 0);
|
|
1412
1505
|
__decorate([
|
|
@@ -1416,12 +1509,25 @@ __decorate([
|
|
|
1416
1509
|
property({ attribute: 'load-more', type: Boolean })
|
|
1417
1510
|
], HelixHeadlessDataTable.prototype, "loadMore", void 0);
|
|
1418
1511
|
__decorate([
|
|
1512
|
+
words,
|
|
1419
1513
|
property({ attribute: 'load-more-label' })
|
|
1420
1514
|
], HelixHeadlessDataTable.prototype, "loadMoreLabel", void 0);
|
|
1515
|
+
__decorate([
|
|
1516
|
+
property()
|
|
1517
|
+
], HelixHeadlessDataTable.prototype, "locale", void 0);
|
|
1421
1518
|
__decorate([
|
|
1422
1519
|
property()
|
|
1423
1520
|
], HelixHeadlessDataTable.prototype, "mode", void 0);
|
|
1424
1521
|
__decorate([
|
|
1522
|
+
words,
|
|
1523
|
+
property({ attribute: 'moved-label' })
|
|
1524
|
+
], HelixHeadlessDataTable.prototype, "movedLabel", void 0);
|
|
1525
|
+
__decorate([
|
|
1526
|
+
words,
|
|
1527
|
+
property({ attribute: 'move-row-label' })
|
|
1528
|
+
], HelixHeadlessDataTable.prototype, "moveRowLabel", void 0);
|
|
1529
|
+
__decorate([
|
|
1530
|
+
words,
|
|
1425
1531
|
property({ attribute: 'next-label' })
|
|
1426
1532
|
], HelixHeadlessDataTable.prototype, "nextLabel", void 0);
|
|
1427
1533
|
__decorate([
|
|
@@ -1431,6 +1537,7 @@ __decorate([
|
|
|
1431
1537
|
property({ type: Number })
|
|
1432
1538
|
], HelixHeadlessDataTable.prototype, "page", null);
|
|
1433
1539
|
__decorate([
|
|
1540
|
+
words,
|
|
1434
1541
|
property({ attribute: 'page-label' })
|
|
1435
1542
|
], HelixHeadlessDataTable.prototype, "pageLabel", void 0);
|
|
1436
1543
|
__decorate([
|
|
@@ -1440,20 +1547,34 @@ __decorate([
|
|
|
1440
1547
|
property({ type: Boolean })
|
|
1441
1548
|
], HelixHeadlessDataTable.prototype, "paginated", null);
|
|
1442
1549
|
__decorate([
|
|
1550
|
+
words,
|
|
1443
1551
|
property({ attribute: 'pagination-label' })
|
|
1444
1552
|
], HelixHeadlessDataTable.prototype, "paginationLabel", void 0);
|
|
1445
1553
|
__decorate([
|
|
1554
|
+
words,
|
|
1555
|
+
property({ attribute: 'picked-up-label' })
|
|
1556
|
+
], HelixHeadlessDataTable.prototype, "pickedUpLabel", void 0);
|
|
1557
|
+
__decorate([
|
|
1558
|
+
words,
|
|
1446
1559
|
property({ attribute: 'previous-label' })
|
|
1447
1560
|
], HelixHeadlessDataTable.prototype, "previousLabel", void 0);
|
|
1448
1561
|
__decorate([
|
|
1449
1562
|
property({ type: Boolean })
|
|
1450
1563
|
], HelixHeadlessDataTable.prototype, "reorderable", void 0);
|
|
1564
|
+
__decorate([
|
|
1565
|
+
property({ attribute: 'reorderable-rows', type: Boolean })
|
|
1566
|
+
], HelixHeadlessDataTable.prototype, "reorderableRows", void 0);
|
|
1451
1567
|
__decorate([
|
|
1452
1568
|
property({ attribute: 'result-label' })
|
|
1453
1569
|
], HelixHeadlessDataTable.prototype, "resultLabel", void 0);
|
|
1454
1570
|
__decorate([
|
|
1571
|
+
words,
|
|
1455
1572
|
property({ attribute: 'results-label' })
|
|
1456
1573
|
], HelixHeadlessDataTable.prototype, "resultsLabel", void 0);
|
|
1574
|
+
__decorate([
|
|
1575
|
+
words,
|
|
1576
|
+
property({ attribute: 'row-grips-label' })
|
|
1577
|
+
], HelixHeadlessDataTable.prototype, "rowGripsLabel", void 0);
|
|
1457
1578
|
__decorate([
|
|
1458
1579
|
property({ attribute: 'row-key' })
|
|
1459
1580
|
], HelixHeadlessDataTable.prototype, "rowKey", void 0);
|
|
@@ -1464,27 +1585,32 @@ __decorate([
|
|
|
1464
1585
|
property({ type: Boolean })
|
|
1465
1586
|
], HelixHeadlessDataTable.prototype, "selectable", void 0);
|
|
1466
1587
|
__decorate([
|
|
1588
|
+
words,
|
|
1467
1589
|
property({ attribute: 'select-all-label' })
|
|
1468
1590
|
], HelixHeadlessDataTable.prototype, "selectAllLabel", void 0);
|
|
1469
1591
|
__decorate([
|
|
1470
1592
|
property()
|
|
1471
1593
|
], HelixHeadlessDataTable.prototype, "selected", null);
|
|
1472
1594
|
__decorate([
|
|
1595
|
+
words,
|
|
1473
1596
|
property({ attribute: 'selected-label' })
|
|
1474
1597
|
], HelixHeadlessDataTable.prototype, "selectedLabel", void 0);
|
|
1475
1598
|
__decorate([
|
|
1599
|
+
words,
|
|
1476
1600
|
property({ attribute: 'select-row-label' })
|
|
1477
1601
|
], HelixHeadlessDataTable.prototype, "selectRowLabel", void 0);
|
|
1478
1602
|
__decorate([
|
|
1479
1603
|
property()
|
|
1480
1604
|
], HelixHeadlessDataTable.prototype, "sort", null);
|
|
1481
1605
|
__decorate([
|
|
1606
|
+
words,
|
|
1482
1607
|
property({ attribute: 'sorted-label' })
|
|
1483
1608
|
], HelixHeadlessDataTable.prototype, "sortedLabel", void 0);
|
|
1484
1609
|
__decorate([
|
|
1485
1610
|
property({ type: Number })
|
|
1486
1611
|
], HelixHeadlessDataTable.prototype, "total", void 0);
|
|
1487
1612
|
__decorate([
|
|
1613
|
+
words,
|
|
1488
1614
|
property({ attribute: 'unsorted-label' })
|
|
1489
1615
|
], HelixHeadlessDataTable.prototype, "unsortedLabel", void 0);
|
|
1490
1616
|
__decorate([
|
|
@@ -1520,9 +1646,6 @@ __decorate([
|
|
|
1520
1646
|
__decorate([
|
|
1521
1647
|
state()
|
|
1522
1648
|
], HelixHeadlessDataTable.prototype, "activeColumn", void 0);
|
|
1523
|
-
__decorate([
|
|
1524
|
-
state()
|
|
1525
|
-
], HelixHeadlessDataTable.prototype, "dragOrder", void 0);
|
|
1526
1649
|
HelixHeadlessDataTable = HelixHeadlessDataTable_1 = __decorate([
|
|
1527
1650
|
customElement('helix-headless-data-table')
|
|
1528
1651
|
], HelixHeadlessDataTable);
|