@fusion.dev/helix-headless 0.148.0 → 0.149.1
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 +6966 -1798
- package/dist/announcement/root/announcement-root.d.ts +5 -0
- package/dist/announcement/root/announcement-root.js +5 -2
- package/dist/area-chart/root/area-chart-root.d.ts +11 -0
- package/dist/area-chart/root/area-chart-root.js +20 -7
- 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 +6 -1
- package/dist/badge/count.js +3 -3
- package/dist/badge/root/badge-root.d.ts +6 -2
- package/dist/badge/root/badge-root.js +3 -3
- 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/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/root/button-group-root.d.ts +3 -0
- package/dist/button-group/root/button-group-root.js +2 -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/neighbor.d.ts +17 -0
- package/dist/canvas/neighbor.js +1 -0
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.d.ts +65 -8
- package/dist/canvas/root/canvas-root.js +115 -49
- package/dist/carousel/root/carousel-root.d.ts +5 -0
- package/dist/carousel/root/carousel-root.js +16 -5
- 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 +27 -1
- package/dist/chat/root/chat-root.js +37 -9
- 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 +11 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +11 -3
- package/dist/code-block/root/code-block-root.d.ts +12 -2
- package/dist/code-block/root/code-block-root.js +12 -2
- 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 +47 -13
- package/dist/combobox/root/combobox-root.d.ts +36 -7
- package/dist/combobox/root/combobox-root.js +37 -12
- package/dist/command/root/command-root.d.ts +15 -6
- 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 +268 -118
- 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/dialog/root/dialog-root.d.ts +12 -1
- package/dist/dialog/root/dialog-root.js +11 -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/root/drilldown-root.d.ts +5 -0
- package/dist/drilldown/root/drilldown-root.js +4 -1
- package/dist/element-events.generated.js +25 -3
- package/dist/file-input/root/file-input-root.d.ts +18 -3
- package/dist/file-input/root/file-input-root.js +34 -17
- package/dist/filter-input/chip/filter-chip.d.ts +13 -0
- package/dist/filter-input/chip/filter-chip.js +6 -1
- 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/root/format-date-root.d.ts +20 -2
- package/dist/format-date/root/format-date-root.js +5 -2
- 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 +78 -9
- package/dist/graph/root/graph-root.js +124 -27
- package/dist/heatmap/root/heatmap-root.d.ts +25 -4
- package/dist/heatmap/root/heatmap-root.js +27 -7
- 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/input/root/input-root.d.ts +5 -0
- package/dist/input/root/input-root.js +4 -1
- 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 +112 -2
- 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 +68 -11
- package/dist/listbox/root/listbox-root.js +41 -9
- 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 +16 -1
- 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 +33 -14
- package/dist/map/root/map-root.js +59 -22
- 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/menu/root/menu-root.d.ts +5 -0
- 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 +3 -1
- package/dist/notifications/notification/notification.d.ts +5 -0
- package/dist/notifications/notification/notification.js +3 -1
- package/dist/notifications/root/notifications-root.d.ts +8 -0
- package/dist/notifications/root/notifications-root.js +10 -2
- 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 +51 -12
- package/dist/object-inspector/root/object-inspector-root.js +21 -20
- 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 +7 -3
- package/dist/pagination/size/pagination-size.js +4 -2
- 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 +6 -6
- package/dist/pin-input/code.js +1 -5
- package/dist/pin-input/root/pin-input-root.d.ts +9 -3
- package/dist/pin-input/root/pin-input-root.js +6 -2
- 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 +12 -2
- package/dist/qr-code/root/qr-code-root.js +9 -2
- 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/root/scatter-chart-root.d.ts +20 -2
- package/dist/scatter-chart/root/scatter-chart-root.js +20 -5
- package/dist/select/root/select-root.d.ts +11 -0
- package/dist/select/root/select-root.js +13 -3
- 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/root/speed-dial-root.d.ts +5 -0
- package/dist/speed-dial/root/speed-dial-root.js +4 -1
- package/dist/splitter/root/splitter-root.d.ts +6 -1
- package/dist/splitter/root/splitter-root.js +9 -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/column/table-column.d.ts +11 -4
- package/dist/table/column/table-column.js +15 -10
- package/dist/table/grid-controller.d.ts +8 -3
- package/dist/table/grid-controller.js +17 -11
- package/dist/table/root/table-root.d.ts +107 -5
- package/dist/table/root/table-root.js +122 -20
- package/dist/table/row/table-row.d.ts +42 -0
- package/dist/table/row/table-row.js +40 -1
- 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 +3 -1
- 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 +15 -7
- package/dist/time-picker/root/time-picker-root.js +25 -12
- package/dist/toast/item/toast-item.d.ts +7 -0
- package/dist/toast/item/toast-item.js +1 -0
- package/dist/toast/root/toast-root.d.ts +9 -1
- package/dist/toast/root/toast-root.js +5 -4
- package/dist/toolbar/root/toolbar-root.d.ts +5 -0
- package/dist/toolbar/root/toolbar-root.js +5 -2
- package/dist/tooltip/root/tooltip-root.d.ts +27 -17
- 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 +12 -3
- package/dist/video/root/video-root.js +41 -14
- 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 +5 -2
- package/lint.json +1 -1
- package/package.json +9 -8
- package/types/jsx.d.ts +4014 -1862
- package/types/vue.d.ts +1266 -624
- package/types/words.d.ts +3280 -0
- package/dist/toast/hotkey.d.ts +0 -22
- package/dist/toast/hotkey.js +0 -23
|
@@ -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),
|
|
@@ -218,54 +274,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
218
274
|
this.moveColumn(column.field, by);
|
|
219
275
|
}
|
|
220
276
|
};
|
|
221
|
-
this.handleGripDown = (event) => {
|
|
222
|
-
if (event.button !== 0 || !this.partIn(event, 'grip')) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const column = this.columnFrom(event);
|
|
226
|
-
if (!column?.field) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
this.dragging = { field: column.field, pointer: event.pointerId };
|
|
230
|
-
this.dragOrder = this.fields;
|
|
231
|
-
window.addEventListener('pointermove', this.handleGripMove);
|
|
232
|
-
window.addEventListener('pointerup', this.handleGripUp);
|
|
233
|
-
window.addEventListener('pointercancel', this.handleGripCancel);
|
|
234
|
-
};
|
|
235
|
-
this.handleGripMove = (event) => {
|
|
236
|
-
const dragging = this.dragging;
|
|
237
|
-
if (!dragging || event.pointerId !== dragging.pointer || !this.dragOrder) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
const rtl = isRtl(this);
|
|
241
|
-
const others = this.shownColumns.filter((column) => column.field !== '' && column.field !== dragging.field);
|
|
242
|
-
const place = others.filter((column) => {
|
|
243
|
-
const box = column.shadowRoot?.querySelector('[part="column"]')?.getBoundingClientRect();
|
|
244
|
-
if (!box) {
|
|
245
|
-
return false;
|
|
246
|
-
}
|
|
247
|
-
const middle = box.left + box.width / 2;
|
|
248
|
-
return rtl ? event.clientX < middle : event.clientX > middle;
|
|
249
|
-
}).length;
|
|
250
|
-
const beside = others[place - 1] ?? others[0];
|
|
251
|
-
if (!beside) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
const next = this.placed(dragging.field, beside.field, place > 0);
|
|
255
|
-
if (next.join(' ') !== this.dragOrder.join(' ')) {
|
|
256
|
-
this.dragOrder = next;
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
this.handleGripUp = () => {
|
|
260
|
-
const wanted = this.dragOrder;
|
|
261
|
-
this.stopDrag();
|
|
262
|
-
if (wanted && wanted.join(' ') !== this.fields.join(' ')) {
|
|
263
|
-
this.requestOrder(wanted);
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
this.handleGripCancel = () => {
|
|
267
|
-
this.stopDrag();
|
|
268
|
-
};
|
|
269
277
|
this.handleResize = () => {
|
|
270
278
|
queueMicrotask(() => this.requestUpdate());
|
|
271
279
|
};
|
|
@@ -285,6 +293,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
285
293
|
...HelixElement.shadowRootOptions,
|
|
286
294
|
slotAssignment: 'manual',
|
|
287
295
|
}; }
|
|
296
|
+
static { this.words = 'helix-data-table'; }
|
|
288
297
|
get expanded() {
|
|
289
298
|
return this.expandedState ?? this.defaultExpanded;
|
|
290
299
|
}
|
|
@@ -350,8 +359,15 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
350
359
|
this.sortState = next;
|
|
351
360
|
this.requestUpdate('sort', previous);
|
|
352
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
|
+
}
|
|
353
369
|
drawn() {
|
|
354
|
-
return [...this.renderRoot.querySelectorAll('[part
|
|
370
|
+
return [...this.renderRoot.querySelectorAll('[part~="row"][data-index]')].flatMap((row) => {
|
|
355
371
|
const cell = row.firstElementChild;
|
|
356
372
|
return cell instanceof HTMLElement
|
|
357
373
|
? [{ element: cell, index: Number(row.dataset.index) }]
|
|
@@ -466,7 +482,16 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
466
482
|
return Math.min(asked, rows.length - 1 + (this.moreDrawn ? 1 : 0));
|
|
467
483
|
}
|
|
468
484
|
get width() {
|
|
469
|
-
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);
|
|
470
495
|
}
|
|
471
496
|
get currentColumn() {
|
|
472
497
|
return Math.max(0, Math.min(this.activeColumn, this.width - 1));
|
|
@@ -475,8 +500,18 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
475
500
|
return this.knownChildren.filter((child) => 'isTableColumn' in child && child.isTableColumn === true);
|
|
476
501
|
}
|
|
477
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) {
|
|
478
514
|
const columns = this.tableColumns;
|
|
479
|
-
const wanted = this.dragOrder ?? writtenList(this.order);
|
|
480
515
|
if (wanted.length === 0) {
|
|
481
516
|
return columns;
|
|
482
517
|
}
|
|
@@ -494,6 +529,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
494
529
|
get fields() {
|
|
495
530
|
return this.orderedColumns.filter((column) => column.field !== '').map((column) => column.field);
|
|
496
531
|
}
|
|
532
|
+
get shownFields() {
|
|
533
|
+
return this.shownColumns.filter((column) => column.field !== '').map((column) => column.field);
|
|
534
|
+
}
|
|
497
535
|
get axes() {
|
|
498
536
|
return this.tableColumns
|
|
499
537
|
.filter((column) => column.field !== '')
|
|
@@ -505,7 +543,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
505
543
|
return '';
|
|
506
544
|
}
|
|
507
545
|
const tracks = declared.map((column) => column.track).join(' ');
|
|
508
|
-
return this.
|
|
546
|
+
return [...Array.from({ length: this.lead }, () => 'max-content'), tracks].join(' ');
|
|
509
547
|
}
|
|
510
548
|
static { this.COMFORTABLE = 2_000; }
|
|
511
549
|
warnIfCrowded(drawn) {
|
|
@@ -601,15 +639,27 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
601
639
|
next,
|
|
602
640
|
});
|
|
603
641
|
}
|
|
604
|
-
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
|
+
};
|
|
605
654
|
return requestChange({
|
|
606
655
|
apply: (value) => {
|
|
656
|
+
const moved = detail(value);
|
|
607
657
|
const previous = this.order;
|
|
608
658
|
this.orderState = value;
|
|
609
659
|
this.requestUpdate('order', previous);
|
|
610
|
-
this.dispatchEvent(new HelixReorderedEvent(
|
|
660
|
+
this.dispatchEvent(new HelixReorderedEvent(moved));
|
|
611
661
|
},
|
|
612
|
-
event: (value) => new HelixReorderEvent(
|
|
662
|
+
event: (value) => new HelixReorderEvent(detail(value)),
|
|
613
663
|
host: this,
|
|
614
664
|
next: fields.join(' '),
|
|
615
665
|
});
|
|
@@ -652,6 +702,49 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
652
702
|
const rows = this.mode === 'server' ? this.rows : this.arrange().rows;
|
|
653
703
|
return rows.map((row, place) => this.keyOf(row, place));
|
|
654
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
|
+
}
|
|
655
748
|
get pageKeys() {
|
|
656
749
|
return this.drawnPage.map((row, index) => this.keyOf(row, this.rowIndex(index) - 2));
|
|
657
750
|
}
|
|
@@ -701,18 +794,15 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
701
794
|
this.requestSelected(new Set(toggleEvery(this.chosen, this.everyKey)));
|
|
702
795
|
}
|
|
703
796
|
moveColumn(field, by) {
|
|
704
|
-
const drawn = this.
|
|
705
|
-
const from = drawn.
|
|
797
|
+
const drawn = this.shownFields;
|
|
798
|
+
const from = drawn.indexOf(field);
|
|
706
799
|
const past = drawn[from + by];
|
|
707
|
-
if (from < 0 ||
|
|
800
|
+
if (from < 0 || past === undefined) {
|
|
708
801
|
return false;
|
|
709
802
|
}
|
|
710
|
-
return this.requestOrder(this.placed(field, past.field, by > 0));
|
|
711
|
-
}
|
|
712
|
-
placed(field, beside, after) {
|
|
713
803
|
const fields = this.fields.filter((one) => one !== field);
|
|
714
|
-
fields.splice(fields.indexOf(
|
|
715
|
-
return fields;
|
|
804
|
+
fields.splice(fields.indexOf(past) + (by > 0 ? 1 : 0), 0, field);
|
|
805
|
+
return this.requestOrder(fields, field);
|
|
716
806
|
}
|
|
717
807
|
csv() {
|
|
718
808
|
const columns = this.shownColumns.filter((column) => column.field !== '');
|
|
@@ -795,6 +885,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
795
885
|
}
|
|
796
886
|
}
|
|
797
887
|
}
|
|
888
|
+
sortSaid(column, direction) {
|
|
889
|
+
return formatWords(this, 'sortedLabel', {
|
|
890
|
+
column,
|
|
891
|
+
direction,
|
|
892
|
+
order: direction === 'ascending' ? this.ascendingLabel : this.descendingLabel,
|
|
893
|
+
});
|
|
894
|
+
}
|
|
798
895
|
news() {
|
|
799
896
|
const sort = this.sort;
|
|
800
897
|
const selected = this.selectable ? this.selected : '';
|
|
@@ -805,20 +902,17 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
805
902
|
? this.tableColumns.find((one) => one.field === parsed.field)
|
|
806
903
|
: undefined;
|
|
807
904
|
said = parsed
|
|
808
|
-
?
|
|
809
|
-
column: column?.textContent?.trim() || parsed.field,
|
|
810
|
-
order: parsed.direction === 'asc' ? this.ascendingLabel : this.descendingLabel,
|
|
811
|
-
})
|
|
905
|
+
? this.sortSaid(column?.textContent?.trim() || parsed.field, parsed.direction === 'asc' ? 'ascending' : 'descending')
|
|
812
906
|
: this.unsortedLabel;
|
|
813
907
|
}
|
|
814
908
|
else if (this.hasUpdated && selected !== this.heardSelected) {
|
|
815
|
-
said =
|
|
816
|
-
count: formatNumbers(this.lang)(this.chosen.size),
|
|
817
|
-
});
|
|
909
|
+
said = formatWords(this, 'selectedLabel', { count: this.chosen.size });
|
|
818
910
|
}
|
|
819
911
|
else if (this.hasUpdated && this.filter !== this.heardFilter) {
|
|
820
912
|
const count = this.mode === 'server' ? Math.max(this.total, this.rows.length) : this.matched;
|
|
821
|
-
said =
|
|
913
|
+
said = this.resultLabel
|
|
914
|
+
? countLabel(count, this.resultLabel, this.resultsLabel, wordsLocale(this))
|
|
915
|
+
: formatWords(this, 'resultsLabel', { count });
|
|
822
916
|
}
|
|
823
917
|
this.heardSort = sort;
|
|
824
918
|
this.heardSelected = selected;
|
|
@@ -862,7 +956,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
862
956
|
announceSort() {
|
|
863
957
|
const current = parse(this.sort);
|
|
864
958
|
const stop = this.currentRow(this.drawnPage) === -1 ? this.currentColumn : -1;
|
|
865
|
-
const offset = this.
|
|
959
|
+
const offset = this.lead;
|
|
866
960
|
const shown = this.shownColumns;
|
|
867
961
|
const android = onAndroid();
|
|
868
962
|
for (const column of this.tableColumns) {
|
|
@@ -877,10 +971,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
877
971
|
: undefined;
|
|
878
972
|
column.sortWords =
|
|
879
973
|
android && column.sorted
|
|
880
|
-
?
|
|
881
|
-
column: column.textContent?.trim() || column.field,
|
|
882
|
-
order: column.sorted === 'ascending' ? this.ascendingLabel : this.descendingLabel,
|
|
883
|
-
})
|
|
974
|
+
? this.sortSaid(column.textContent?.trim() || column.field, column.sorted)
|
|
884
975
|
: '';
|
|
885
976
|
}
|
|
886
977
|
}
|
|
@@ -940,14 +1031,20 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
940
1031
|
const named = this.headerColumn;
|
|
941
1032
|
const stopRow = this.currentRow(page);
|
|
942
1033
|
const stopColumn = this.currentColumn;
|
|
943
|
-
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));
|
|
944
1039
|
return html `${repeat(rows, ({ index, row }) => this.rowKeyOf(row, index), ({ index, row }) => {
|
|
945
1040
|
const key = chosen ? this.keyOf(row, this.rowIndex(index) - 2) : '';
|
|
946
1041
|
const picked = chosen?.has(key) ?? false;
|
|
947
1042
|
const placed = this.childField ? this.tree().placed.get(row) : undefined;
|
|
948
1043
|
const stop = (place) => index === stopRow && place === stopColumn;
|
|
1044
|
+
const moveKey = grips ? this.moveKeyOf(row) : '';
|
|
1045
|
+
const marked = mark?.key === moveKey ? mark.edge : undefined;
|
|
949
1046
|
return html `<div
|
|
950
|
-
part="row"
|
|
1047
|
+
part="row${held?.key === moveKey ? ' row-dragging' : ''}${marked === 'before' ? ' row-drop-before' : ''}${marked === 'after' ? ' row-drop-after' : ''}"
|
|
951
1048
|
role="row"
|
|
952
1049
|
aria-rowindex=${this.rowIndex(index)}
|
|
953
1050
|
aria-selected=${chosen ? String(picked) : nothing}
|
|
@@ -958,15 +1055,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
958
1055
|
data-index=${this.windowed ? index : nothing}
|
|
959
1056
|
data-row=${index}
|
|
960
1057
|
>
|
|
961
|
-
${chosen
|
|
1058
|
+
${grips ? this.renderGrip(this.rowName(row, moveKey), stop(0), still) : nothing}${chosen
|
|
962
1059
|
? html `<span
|
|
963
1060
|
part="select${picked ? ' select-selected' : ''}"
|
|
964
1061
|
role="gridcell"
|
|
965
|
-
tabindex=${stop(
|
|
966
|
-
data-column
|
|
967
|
-
>${this.renderCheckbox(
|
|
968
|
-
row: named ? String(named.order(row) ?? key) : key,
|
|
969
|
-
}), 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
|
|
970
1065
|
>`
|
|
971
1066
|
: nothing}${columns.map((column, place) => this.renderCell(column, row, picked, place + offset, stop(place + offset), column === named))}
|
|
972
1067
|
</div>`;
|
|
@@ -997,13 +1092,33 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
997
1092
|
? html `<div part="before" role="presentation" style="block-size: ${before}px"></div>`
|
|
998
1093
|
: html `<div part="after" role="presentation" style="block-size: ${after}px"></div>`;
|
|
999
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
|
+
}
|
|
1000
1115
|
renderSelectAll(stop) {
|
|
1001
1116
|
const { checked, indeterminate } = everyState(this.chosen, this.everyKey);
|
|
1002
1117
|
return html `<span
|
|
1003
1118
|
part="select-all"
|
|
1004
1119
|
role="columnheader"
|
|
1005
1120
|
tabindex=${stop ? '0' : '-1'}
|
|
1006
|
-
data-column
|
|
1121
|
+
data-column=${this.selectAt}
|
|
1007
1122
|
>${this.renderCheckbox(this.selectAllLabel, checked, indeterminate, this.toggleAll)}</span>`;
|
|
1008
1123
|
}
|
|
1009
1124
|
renderMore(page) {
|
|
@@ -1036,7 +1151,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1036
1151
|
const counted = this.mode === 'server' ? Math.max(this.total, available) : matched;
|
|
1037
1152
|
const countKnown = counted > 0 || this.sourceKnown;
|
|
1038
1153
|
this.counts = {
|
|
1039
|
-
columns: columns.length ? columns.length +
|
|
1154
|
+
columns: columns.length ? columns.length + this.lead : undefined,
|
|
1040
1155
|
rows: countKnown ? counted + 1 + (this.moreDrawn ? 1 : 0) : undefined,
|
|
1041
1156
|
};
|
|
1042
1157
|
return html `<div part="toolbar"><slot name="toolbar"></slot></div>
|
|
@@ -1048,7 +1163,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1048
1163
|
@scroll=${this.handleScroll}
|
|
1049
1164
|
>
|
|
1050
1165
|
<div part="head" role="row" aria-rowindex="1">
|
|
1051
|
-
${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
|
|
1052
1169
|
? this.orderedColumns.map((_, index) => html `<slot name=${`column-${index + 1}`} @slotchange=${this.handleSlotChange}></slot>`)
|
|
1053
1170
|
: html `<slot name="columns" @slotchange=${this.handleSlotChange}></slot>`}
|
|
1054
1171
|
</div>
|
|
@@ -1070,6 +1187,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1070
1187
|
page-size=${this.pageSize || 1}
|
|
1071
1188
|
total=${countKnown ? matched : nothing}
|
|
1072
1189
|
label=${this.paginationLabel}
|
|
1190
|
+
locale=${handedLocale(this) || nothing}
|
|
1073
1191
|
gap-label=${this.gapLabel}
|
|
1074
1192
|
next-label=${this.nextLabel}
|
|
1075
1193
|
page-label=${this.pageLabel}
|
|
@@ -1078,7 +1196,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1078
1196
|
@helix-activate=${this.stopPageNotification}
|
|
1079
1197
|
></${pagination}>`
|
|
1080
1198
|
: nothing}
|
|
1081
|
-
</div
|
|
1199
|
+
</div>${this.rowMoves.drawDragPreview()}`;
|
|
1082
1200
|
}
|
|
1083
1201
|
connectedCallback() {
|
|
1084
1202
|
super.connectedCallback();
|
|
@@ -1089,7 +1207,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1089
1207
|
this.renderRoot.addEventListener('focusin', this.handleFocusIn);
|
|
1090
1208
|
this.addEventListener('keydown', this.handleGridKey);
|
|
1091
1209
|
this.addEventListener('keydown', this.handleGripKey);
|
|
1092
|
-
this.addEventListener('pointerdown', this.handleGripDown);
|
|
1093
1210
|
this.addEventListener('helix-before-resize', this.handleResize);
|
|
1094
1211
|
}
|
|
1095
1212
|
disconnectedCallback() {
|
|
@@ -1101,26 +1218,25 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1101
1218
|
this.renderRoot.removeEventListener('focusin', this.handleFocusIn);
|
|
1102
1219
|
this.removeEventListener('keydown', this.handleGridKey);
|
|
1103
1220
|
this.removeEventListener('keydown', this.handleGripKey);
|
|
1104
|
-
this.removeEventListener('pointerdown', this.handleGripDown);
|
|
1105
1221
|
this.removeEventListener('helix-before-resize', this.handleResize);
|
|
1106
|
-
this.stopDrag();
|
|
1107
1222
|
}
|
|
1108
1223
|
cellAt(row, column) {
|
|
1109
|
-
const offset = this.
|
|
1224
|
+
const offset = this.lead;
|
|
1110
1225
|
if (row === -1) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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');
|
|
1114
1230
|
}
|
|
1115
1231
|
if (this.moreDrawn && row === this.drawnPage.length) {
|
|
1116
1232
|
return this.partNamed('more-cell');
|
|
1117
1233
|
}
|
|
1118
|
-
const line = this.renderRoot.querySelector(`[part
|
|
1234
|
+
const line = this.renderRoot.querySelector(`[part~="row"][data-row="${row}"]`);
|
|
1119
1235
|
return line?.querySelector(`:scope > [data-column="${column}"]`) ?? null;
|
|
1120
1236
|
}
|
|
1121
1237
|
placeOf(event) {
|
|
1122
1238
|
const columns = this.shownColumns;
|
|
1123
|
-
const offset = this.
|
|
1239
|
+
const offset = this.lead;
|
|
1124
1240
|
for (const node of event.composedPath()) {
|
|
1125
1241
|
if (node === this) {
|
|
1126
1242
|
break;
|
|
@@ -1148,14 +1264,14 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1148
1264
|
return undefined;
|
|
1149
1265
|
}
|
|
1150
1266
|
controlsIn(place) {
|
|
1151
|
-
const offset = this.
|
|
1267
|
+
const offset = this.lead;
|
|
1152
1268
|
if (place.row === -1 && place.column >= offset) {
|
|
1153
1269
|
return this.shownColumns[place.column - offset]?.controls ?? [];
|
|
1154
1270
|
}
|
|
1155
1271
|
return [...place.cell.querySelectorAll('*')].filter(isControl);
|
|
1156
1272
|
}
|
|
1157
1273
|
quietControls() {
|
|
1158
|
-
const offset = this.
|
|
1274
|
+
const offset = this.lead;
|
|
1159
1275
|
const drawn = this.shownColumns;
|
|
1160
1276
|
const read = new Set(drawn.flatMap((column, place) => (column.cell ? [place + offset] : [])));
|
|
1161
1277
|
if (read.size === 0) {
|
|
@@ -1243,7 +1359,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1243
1359
|
if (!this.childField || !row || !header) {
|
|
1244
1360
|
return false;
|
|
1245
1361
|
}
|
|
1246
|
-
if (place.column !== this.shownColumns.indexOf(header) +
|
|
1362
|
+
if (place.column !== this.shownColumns.indexOf(header) + this.lead) {
|
|
1247
1363
|
return false;
|
|
1248
1364
|
}
|
|
1249
1365
|
const placed = this.tree().placed.get(row);
|
|
@@ -1262,7 +1378,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1262
1378
|
return false;
|
|
1263
1379
|
}
|
|
1264
1380
|
activate(event, place) {
|
|
1265
|
-
const offset = this.
|
|
1381
|
+
const offset = this.lead;
|
|
1266
1382
|
const heading = place.row === -1 ? this.shownColumns[place.column - offset] : undefined;
|
|
1267
1383
|
if (this.moreDrawn && place.row === this.drawnPage.length && event.key !== 'F2') {
|
|
1268
1384
|
event.preventDefault();
|
|
@@ -1275,7 +1391,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1275
1391
|
this.toggleSort(heading.field);
|
|
1276
1392
|
return;
|
|
1277
1393
|
}
|
|
1278
|
-
if (this.selectable && place.column ===
|
|
1394
|
+
if (this.selectable && place.column === this.selectAt && place.row === -1) {
|
|
1279
1395
|
event.preventDefault();
|
|
1280
1396
|
this.chooseAll();
|
|
1281
1397
|
return;
|
|
@@ -1323,13 +1439,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1323
1439
|
.composedPath()
|
|
1324
1440
|
.some((node) => node instanceof Element && node.getAttribute('part') === name);
|
|
1325
1441
|
}
|
|
1326
|
-
stopDrag() {
|
|
1327
|
-
this.dragging = undefined;
|
|
1328
|
-
this.dragOrder = undefined;
|
|
1329
|
-
window.removeEventListener('pointermove', this.handleGripMove);
|
|
1330
|
-
window.removeEventListener('pointerup', this.handleGripUp);
|
|
1331
|
-
window.removeEventListener('pointercancel', this.handleGripCancel);
|
|
1332
|
-
}
|
|
1333
1442
|
columnFrom(event) {
|
|
1334
1443
|
const columns = this.tableColumns;
|
|
1335
1444
|
for (const node of event.composedPath()) {
|
|
@@ -1341,8 +1450,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1341
1450
|
}
|
|
1342
1451
|
};
|
|
1343
1452
|
__decorate([
|
|
1453
|
+
words,
|
|
1344
1454
|
property({ attribute: 'ascending-label' })
|
|
1345
1455
|
], HelixHeadlessDataTable.prototype, "ascendingLabel", void 0);
|
|
1456
|
+
__decorate([
|
|
1457
|
+
words,
|
|
1458
|
+
property({ attribute: 'canceled-label' })
|
|
1459
|
+
], HelixHeadlessDataTable.prototype, "canceledLabel", void 0);
|
|
1346
1460
|
__decorate([
|
|
1347
1461
|
property({ attribute: 'child-field', reflect: true })
|
|
1348
1462
|
], HelixHeadlessDataTable.prototype, "childField", void 0);
|
|
@@ -1368,8 +1482,13 @@ __decorate([
|
|
|
1368
1482
|
property({ attribute: 'default-sort' })
|
|
1369
1483
|
], HelixHeadlessDataTable.prototype, "defaultSort", void 0);
|
|
1370
1484
|
__decorate([
|
|
1485
|
+
words,
|
|
1371
1486
|
property({ attribute: 'descending-label' })
|
|
1372
1487
|
], HelixHeadlessDataTable.prototype, "descendingLabel", void 0);
|
|
1488
|
+
__decorate([
|
|
1489
|
+
words,
|
|
1490
|
+
property({ attribute: 'dropped-label' })
|
|
1491
|
+
], HelixHeadlessDataTable.prototype, "droppedLabel", void 0);
|
|
1373
1492
|
__decorate([
|
|
1374
1493
|
property({ type: Number })
|
|
1375
1494
|
], HelixHeadlessDataTable.prototype, "estimate", void 0);
|
|
@@ -1380,6 +1499,7 @@ __decorate([
|
|
|
1380
1499
|
property()
|
|
1381
1500
|
], HelixHeadlessDataTable.prototype, "filter", null);
|
|
1382
1501
|
__decorate([
|
|
1502
|
+
words,
|
|
1383
1503
|
property({ attribute: 'gap-label' })
|
|
1384
1504
|
], HelixHeadlessDataTable.prototype, "gapLabel", void 0);
|
|
1385
1505
|
__decorate([
|
|
@@ -1389,12 +1509,25 @@ __decorate([
|
|
|
1389
1509
|
property({ attribute: 'load-more', type: Boolean })
|
|
1390
1510
|
], HelixHeadlessDataTable.prototype, "loadMore", void 0);
|
|
1391
1511
|
__decorate([
|
|
1512
|
+
words,
|
|
1392
1513
|
property({ attribute: 'load-more-label' })
|
|
1393
1514
|
], HelixHeadlessDataTable.prototype, "loadMoreLabel", void 0);
|
|
1515
|
+
__decorate([
|
|
1516
|
+
property()
|
|
1517
|
+
], HelixHeadlessDataTable.prototype, "locale", void 0);
|
|
1394
1518
|
__decorate([
|
|
1395
1519
|
property()
|
|
1396
1520
|
], HelixHeadlessDataTable.prototype, "mode", void 0);
|
|
1397
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,
|
|
1398
1531
|
property({ attribute: 'next-label' })
|
|
1399
1532
|
], HelixHeadlessDataTable.prototype, "nextLabel", void 0);
|
|
1400
1533
|
__decorate([
|
|
@@ -1404,6 +1537,7 @@ __decorate([
|
|
|
1404
1537
|
property({ type: Number })
|
|
1405
1538
|
], HelixHeadlessDataTable.prototype, "page", null);
|
|
1406
1539
|
__decorate([
|
|
1540
|
+
words,
|
|
1407
1541
|
property({ attribute: 'page-label' })
|
|
1408
1542
|
], HelixHeadlessDataTable.prototype, "pageLabel", void 0);
|
|
1409
1543
|
__decorate([
|
|
@@ -1413,20 +1547,34 @@ __decorate([
|
|
|
1413
1547
|
property({ type: Boolean })
|
|
1414
1548
|
], HelixHeadlessDataTable.prototype, "paginated", null);
|
|
1415
1549
|
__decorate([
|
|
1550
|
+
words,
|
|
1416
1551
|
property({ attribute: 'pagination-label' })
|
|
1417
1552
|
], HelixHeadlessDataTable.prototype, "paginationLabel", void 0);
|
|
1418
1553
|
__decorate([
|
|
1554
|
+
words,
|
|
1555
|
+
property({ attribute: 'picked-up-label' })
|
|
1556
|
+
], HelixHeadlessDataTable.prototype, "pickedUpLabel", void 0);
|
|
1557
|
+
__decorate([
|
|
1558
|
+
words,
|
|
1419
1559
|
property({ attribute: 'previous-label' })
|
|
1420
1560
|
], HelixHeadlessDataTable.prototype, "previousLabel", void 0);
|
|
1421
1561
|
__decorate([
|
|
1422
1562
|
property({ type: Boolean })
|
|
1423
1563
|
], HelixHeadlessDataTable.prototype, "reorderable", void 0);
|
|
1564
|
+
__decorate([
|
|
1565
|
+
property({ attribute: 'reorderable-rows', type: Boolean })
|
|
1566
|
+
], HelixHeadlessDataTable.prototype, "reorderableRows", void 0);
|
|
1424
1567
|
__decorate([
|
|
1425
1568
|
property({ attribute: 'result-label' })
|
|
1426
1569
|
], HelixHeadlessDataTable.prototype, "resultLabel", void 0);
|
|
1427
1570
|
__decorate([
|
|
1571
|
+
words,
|
|
1428
1572
|
property({ attribute: 'results-label' })
|
|
1429
1573
|
], HelixHeadlessDataTable.prototype, "resultsLabel", void 0);
|
|
1574
|
+
__decorate([
|
|
1575
|
+
words,
|
|
1576
|
+
property({ attribute: 'row-grips-label' })
|
|
1577
|
+
], HelixHeadlessDataTable.prototype, "rowGripsLabel", void 0);
|
|
1430
1578
|
__decorate([
|
|
1431
1579
|
property({ attribute: 'row-key' })
|
|
1432
1580
|
], HelixHeadlessDataTable.prototype, "rowKey", void 0);
|
|
@@ -1437,27 +1585,32 @@ __decorate([
|
|
|
1437
1585
|
property({ type: Boolean })
|
|
1438
1586
|
], HelixHeadlessDataTable.prototype, "selectable", void 0);
|
|
1439
1587
|
__decorate([
|
|
1588
|
+
words,
|
|
1440
1589
|
property({ attribute: 'select-all-label' })
|
|
1441
1590
|
], HelixHeadlessDataTable.prototype, "selectAllLabel", void 0);
|
|
1442
1591
|
__decorate([
|
|
1443
1592
|
property()
|
|
1444
1593
|
], HelixHeadlessDataTable.prototype, "selected", null);
|
|
1445
1594
|
__decorate([
|
|
1595
|
+
words,
|
|
1446
1596
|
property({ attribute: 'selected-label' })
|
|
1447
1597
|
], HelixHeadlessDataTable.prototype, "selectedLabel", void 0);
|
|
1448
1598
|
__decorate([
|
|
1599
|
+
words,
|
|
1449
1600
|
property({ attribute: 'select-row-label' })
|
|
1450
1601
|
], HelixHeadlessDataTable.prototype, "selectRowLabel", void 0);
|
|
1451
1602
|
__decorate([
|
|
1452
1603
|
property()
|
|
1453
1604
|
], HelixHeadlessDataTable.prototype, "sort", null);
|
|
1454
1605
|
__decorate([
|
|
1606
|
+
words,
|
|
1455
1607
|
property({ attribute: 'sorted-label' })
|
|
1456
1608
|
], HelixHeadlessDataTable.prototype, "sortedLabel", void 0);
|
|
1457
1609
|
__decorate([
|
|
1458
1610
|
property({ type: Number })
|
|
1459
1611
|
], HelixHeadlessDataTable.prototype, "total", void 0);
|
|
1460
1612
|
__decorate([
|
|
1613
|
+
words,
|
|
1461
1614
|
property({ attribute: 'unsorted-label' })
|
|
1462
1615
|
], HelixHeadlessDataTable.prototype, "unsortedLabel", void 0);
|
|
1463
1616
|
__decorate([
|
|
@@ -1493,9 +1646,6 @@ __decorate([
|
|
|
1493
1646
|
__decorate([
|
|
1494
1647
|
state()
|
|
1495
1648
|
], HelixHeadlessDataTable.prototype, "activeColumn", void 0);
|
|
1496
|
-
__decorate([
|
|
1497
|
-
state()
|
|
1498
|
-
], HelixHeadlessDataTable.prototype, "dragOrder", void 0);
|
|
1499
1649
|
HelixHeadlessDataTable = HelixHeadlessDataTable_1 = __decorate([
|
|
1500
1650
|
customElement('helix-headless-data-table')
|
|
1501
1651
|
], HelixHeadlessDataTable);
|