@fusion.dev/helix-headless 0.144.0 → 0.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +15195 -4240
- package/dist/accordion/item/accordion-item.d.ts +62 -12
- package/dist/accordion/item/accordion-item.js +41 -10
- package/dist/accordion/root/accordion-root.d.ts +14 -5
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +24 -3
- package/dist/announcement/root/announcement-root.js +39 -2
- package/dist/app-header/root/app-header-root.d.ts +12 -0
- package/dist/app-header/root/app-header-root.js +13 -1
- package/dist/app-header/sectioning.d.ts +9 -0
- package/dist/app-header/sectioning.js +27 -0
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/badge/root/badge-root.d.ts +3 -1
- package/dist/badge/root/badge-root.js +2 -2
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +52 -15
- package/dist/bar-chart/stack.d.ts +15 -0
- package/dist/bar-chart/stack.js +19 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +57 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +73 -3
- package/dist/button/root/button-root.d.ts +26 -0
- package/dist/button/root/button-root.js +38 -18
- package/dist/button-group/root/button-group-root.d.ts +2 -1
- package/dist/button-group/root/button-group-root.js +5 -1
- package/dist/canvas/node/canvas-node.d.ts +4 -3
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +123 -42
- package/dist/card/root/card-root.d.ts +24 -3
- package/dist/card/root/card-root.js +20 -8
- package/dist/carousel/root/carousel-root.d.ts +133 -4
- package/dist/carousel/root/carousel-root.js +174 -24
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +27 -10
- package/dist/chat/naming.d.ts +26 -0
- package/dist/chat/naming.js +14 -0
- package/dist/chat/root/chat-root.d.ts +58 -0
- package/dist/chat/root/chat-root.js +43 -3
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +14 -1
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
- package/dist/checkbox-group/select-all.d.ts +27 -0
- package/dist/checkbox-group/select-all.js +12 -0
- package/dist/code-block/highlight.d.ts +15 -0
- package/dist/code-block/highlight.js +4 -0
- package/dist/code-block/root/code-block-root.d.ts +57 -2
- package/dist/code-block/root/code-block-root.js +63 -8
- package/dist/color-input/root/color-input-root.d.ts +3 -0
- package/dist/color-input/root/color-input-root.js +6 -3
- package/dist/color-picker/root/color-picker-root.d.ts +33 -4
- package/dist/color-picker/root/color-picker-root.js +80 -21
- package/dist/color-picker/swatches.d.ts +12 -0
- package/dist/color-picker/swatches.js +26 -0
- package/dist/combobox/root/combobox-root.d.ts +43 -0
- package/dist/combobox/root/combobox-root.js +79 -15
- package/dist/command/root/command-root.d.ts +16 -1
- package/dist/command/root/command-root.js +22 -4
- package/dist/copy-button/root/copy-button-root.d.ts +26 -1
- package/dist/copy-button/root/copy-button-root.js +12 -5
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +24 -0
- package/dist/data-table/keys.js +24 -0
- package/dist/data-table/root/data-table-root.d.ts +170 -13
- package/dist/data-table/root/data-table-root.js +294 -52
- package/dist/data-table/tree.d.ts +55 -0
- package/dist/data-table/tree.js +54 -0
- package/dist/date-input/root/date-input-root.d.ts +3 -1
- package/dist/date-input/root/date-input-root.js +18 -7
- package/dist/date-picker/root/date-picker-root.js +12 -6
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.js +15 -1
- package/dist/dialog/root/dialog-root.d.ts +8 -2
- package/dist/dialog/root/dialog-root.js +16 -1
- package/dist/divider/root/divider-root.d.ts +3 -0
- package/dist/divider/root/divider-root.js +2 -1
- package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
- package/dist/donut-chart/root/donut-chart-root.js +48 -1
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +59 -0
- package/dist/drawer/root/drawer-root.js +63 -4
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +29 -0
- package/dist/drilldown/root/drilldown-root.js +28 -5
- package/dist/element-events.generated.js +83 -12
- package/dist/empty/root/empty-root.d.ts +3 -1
- package/dist/empty/root/empty-root.js +3 -2
- package/dist/file-input/root/file-input-root.d.ts +69 -6
- package/dist/file-input/root/file-input-root.js +82 -19
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +16 -4
- package/dist/filter-input/root/filter-input-root.d.ts +30 -6
- package/dist/filter-input/root/filter-input-root.js +1 -1
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/root/format-date-root.d.ts +9 -16
- package/dist/format-date/root/format-date-root.js +10 -27
- package/dist/heatmap/root/heatmap-root.d.ts +24 -13
- package/dist/heatmap/root/heatmap-root.js +34 -12
- package/dist/icon/root/icon-root.d.ts +12 -1
- package/dist/icon/root/icon-root.js +21 -10
- package/dist/icon/settle.d.ts +7 -0
- package/dist/icon/settle.js +10 -0
- package/dist/icon-button/root/icon-button-root.d.ts +2 -0
- package/dist/image/root/image-root.d.ts +5 -1
- package/dist/image/root/image-root.js +10 -2
- package/dist/input/root/input-root.d.ts +13 -3
- package/dist/input/root/input-root.js +12 -3
- package/dist/kbd/root/kbd-root.d.ts +35 -1
- package/dist/kbd/root/kbd-root.js +23 -4
- package/dist/legend/root/legend-root.d.ts +55 -8
- package/dist/legend/root/legend-root.js +55 -13
- package/dist/lightbox/root/lightbox-root.d.ts +49 -6
- package/dist/lightbox/root/lightbox-root.js +86 -19
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +22 -0
- package/dist/lightbox/zoom.js +16 -0
- package/dist/line-chart/root/line-chart-root.d.ts +22 -1
- package/dist/line-chart/root/line-chart-root.js +21 -1
- package/dist/list/item/list-item.d.ts +70 -1
- package/dist/list/item/list-item.js +77 -6
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +155 -9
- package/dist/list/root/list-root.js +246 -4
- package/dist/list/selection.d.ts +49 -0
- package/dist/list/selection.js +30 -0
- package/dist/listbox/root/listbox-root.d.ts +37 -1
- package/dist/listbox/root/listbox-root.js +49 -4
- package/dist/loader/busy.d.ts +10 -0
- package/dist/loader/busy.js +11 -0
- package/dist/loader/root/loader-root.d.ts +9 -2
- package/dist/loader/root/loader-root.js +23 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +62 -0
- package/dist/megamenu/root/megamenu-root.js +90 -5
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +87 -11
- package/dist/menu/item/menu-item.js +78 -22
- package/dist/menu/root/menu-root.d.ts +39 -1
- package/dist/menu/root/menu-root.js +65 -8
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +20 -1
- package/dist/meter/root/meter-root.js +11 -15
- package/dist/navigation/root/navigation-root.d.ts +18 -2
- package/dist/navigation/root/navigation-root.js +29 -3
- package/dist/notifications/root/notifications-root.d.ts +25 -0
- package/dist/notifications/root/notifications-root.js +33 -5
- package/dist/number-input/root/number-input-root.d.ts +17 -8
- package/dist/number-input/root/number-input-root.js +2 -7
- package/dist/object-inspector/root/object-inspector-root.d.ts +161 -32
- package/dist/object-inspector/root/object-inspector-root.js +264 -123
- package/dist/object-inspector/rows.d.ts +75 -0
- package/dist/object-inspector/rows.js +119 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +86 -3
- package/dist/outline/root/outline-root.js +95 -12
- package/dist/pagination/size/pagination-size.d.ts +12 -2
- package/dist/pagination/size/pagination-size.js +20 -5
- package/dist/pin-input/code.d.ts +10 -0
- package/dist/pin-input/code.js +13 -0
- package/dist/pin-input/root/pin-input-root.d.ts +25 -1
- package/dist/pin-input/root/pin-input-root.js +10 -11
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +41 -0
- package/dist/popover/root/popover-root.d.ts +57 -7
- package/dist/popover/root/popover-root.js +58 -3
- package/dist/progress/root/progress-root.d.ts +20 -0
- package/dist/progress/root/progress-root.js +15 -15
- package/dist/qr-code/export.d.ts +26 -1
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/root/qr-code-root.d.ts +19 -5
- package/dist/qr-code/root/qr-code-root.js +58 -9
- package/dist/quote/marks.d.ts +8 -0
- package/dist/quote/marks.js +5 -0
- package/dist/quote/root/quote-root.d.ts +14 -2
- package/dist/quote/root/quote-root.js +23 -1
- package/dist/radio/group/radio-group.d.ts +4 -10
- package/dist/radio/group/radio-group.js +5 -10
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +6 -1
- package/dist/rating/root/rating-root.d.ts +10 -5
- package/dist/rating/root/rating-root.js +32 -8
- package/dist/rating/steps.d.ts +7 -0
- package/dist/rating/steps.js +9 -0
- package/dist/scatter-chart/fit.d.ts +15 -0
- package/dist/scatter-chart/fit.js +35 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +21 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
- package/dist/scroll-area/root/scroll-area-root.d.ts +84 -0
- package/dist/scroll-area/root/scroll-area-root.js +106 -7
- package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
- package/dist/scroll-area/scrollbar-controller.js +172 -0
- package/dist/scroll-area/scrollbar.d.ts +92 -0
- package/dist/scroll-area/scrollbar.js +33 -0
- package/dist/select/root/select-root.d.ts +15 -0
- package/dist/select/root/select-root.js +18 -6
- package/dist/skeleton/root/skeleton-root.d.ts +3 -0
- package/dist/skeleton/root/skeleton-root.js +4 -2
- package/dist/skip-link/root/skip-link-root.js +2 -2
- package/dist/slider/root/slider-root.d.ts +41 -4
- package/dist/slider/root/slider-root.js +23 -3
- package/dist/sparkline/readings.d.ts +18 -0
- package/dist/sparkline/readings.js +19 -0
- package/dist/sparkline/root/sparkline-root.d.ts +78 -7
- package/dist/sparkline/root/sparkline-root.js +118 -23
- package/dist/speed-dial/root/speed-dial-root.js +2 -2
- package/dist/splitter/root/splitter-root.d.ts +20 -12
- package/dist/splitter/root/splitter-root.js +226 -203
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +14 -5
- package/dist/stat/root/stat-root.js +21 -5
- package/dist/steps/reach.d.ts +20 -0
- package/dist/steps/reach.js +15 -0
- package/dist/steps/root/steps-root.d.ts +76 -0
- package/dist/steps/root/steps-root.js +93 -1
- package/dist/steps/step/step.d.ts +45 -2
- package/dist/steps/step/step.js +33 -6
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +11 -10
- package/dist/table/column/table-column.js +8 -19
- package/dist/table/root/table-root.d.ts +126 -4
- package/dist/table/root/table-root.js +156 -6
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +22 -5
- package/dist/tabs/panel/tab-panel.js +34 -6
- package/dist/tabs/root/tabs-root.d.ts +37 -1
- package/dist/tabs/root/tabs-root.js +22 -4
- package/dist/tabs/tab/tab.d.ts +41 -4
- package/dist/tabs/tab/tab.js +49 -3
- package/dist/tag/group/tag-group.d.ts +31 -4
- package/dist/tag/group/tag-group.js +46 -7
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +28 -1
- package/dist/textarea/root/textarea-root.js +40 -1
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +16 -8
- package/dist/time-picker/root/time-picker-root.d.ts +18 -4
- package/dist/time-picker/root/time-picker-root.js +7 -10
- package/dist/time-picker/wheel-name.d.ts +9 -0
- package/dist/time-picker/wheel-name.js +15 -0
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/item/toast-item.d.ts +24 -18
- package/dist/toast/item/toast-item.js +36 -40
- package/dist/toast/root/toast-root.d.ts +6 -0
- package/dist/toast/root/toast-root.js +16 -1
- package/dist/toggle/group/toggle-group.d.ts +24 -3
- package/dist/toggle/group/toggle-group.js +34 -5
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/root/tooltip-root.d.ts +13 -2
- package/dist/tooltip/root/tooltip-root.js +9 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +30 -2
- package/dist/tour/root/tour-root.js +34 -8
- package/dist/tree/item/tree-item.d.ts +61 -4
- package/dist/tree/item/tree-item.js +92 -20
- package/dist/tree/root/tree-root.d.ts +58 -0
- package/dist/tree/root/tree-root.js +80 -16
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +13 -0
- package/dist/trend/root/trend-root.d.ts +43 -18
- package/dist/trend/root/trend-root.js +31 -6
- package/dist/video/media-events.d.ts +44 -0
- package/dist/video/media-events.js +35 -0
- package/dist/video/root/video-root.d.ts +117 -18
- package/dist/video/root/video-root.js +93 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +77 -3
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +22 -0
- package/dist/virtual-list/fill.js +23 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/plan.d.ts +49 -0
- package/dist/virtual-list/plan.js +16 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +259 -26
- package/dist/virtual-list/root/virtual-list-root.js +333 -49
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +8113 -1394
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +1678 -353
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/listbox/range.d.ts +0 -17
- package/dist/listbox/range.js +0 -5
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AriaForwardController, HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import '../../checkbox/index.js';
|
|
3
4
|
import { type HelixHeadlessTableColumn } from '../column/table-column.js';
|
|
4
5
|
declare const HelixHeadlessTable_base: (new (...args: any[]) => import("@fusion.dev/helix-core").CollectionElement) & typeof HelixElement;
|
|
5
6
|
/**
|
|
@@ -16,10 +17,42 @@ declare const HelixHeadlessTable_base: (new (...args: any[]) => import("@fusion.
|
|
|
16
17
|
* `rowheader` for a `header` cell in a row of values. Rows are
|
|
17
18
|
* `display: contents`, so their cells become items of the one grid.
|
|
18
19
|
*
|
|
19
|
-
* A column with `sortable` and a `field`
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* **Sorting.** A column with `sortable` and a `field` draws its heading as a
|
|
21
|
+
* button that sorts the rows by the text of its cells, numbers by their value.
|
|
22
|
+
* Your markup is not reordered: the table draws the rows in the sorted order.
|
|
23
|
+
*
|
|
24
|
+
* 1. Each press cycles the column through ascending, descending, and the
|
|
25
|
+
* order the rows were written in, which keeps a server's own ranking
|
|
26
|
+
* reachable.
|
|
27
|
+
* 2. `helix-sort` asks first, with `field:direction`, or empty for the written
|
|
28
|
+
* order. Refuse it to keep the order, or to sort the rows yourself and set
|
|
29
|
+
* `sort`.
|
|
30
|
+
* 3. `helix-sorted` follows once the order stands, and `sort` holds it.
|
|
31
|
+
* 4. The heading carries `aria-sort`, and a screen reader hears `sorted-label`
|
|
32
|
+
* ("Sorted by Name, ascending") or `unsorted-label` from a polite region.
|
|
33
|
+
*
|
|
34
|
+
* Tab reaches each sort button, and Enter or Space presses it.
|
|
35
|
+
*
|
|
36
|
+
* The `heading` slot names the table: slot a heading or a line of text into
|
|
37
|
+
* it, and the table is named by its words. An `aria-label` or `aria-labelledby` on the
|
|
38
|
+
* host wins over it.
|
|
39
|
+
*
|
|
40
|
+
* **Selecting.** `selectable` adds a column of checkboxes.
|
|
41
|
+
*
|
|
42
|
+
* 1. Each row is known by its `value`, or by its place among the rows where it
|
|
43
|
+
* has none, and `selected` holds the chosen keys, comma separated, the same
|
|
44
|
+
* shape `DataTable` uses. `default-selected` is where it starts.
|
|
45
|
+
* 2. A row's checkbox is named by `select-row-label` ("Select {row}") with the
|
|
46
|
+
* words of the row's first cell. The checkbox in the heading selects every
|
|
47
|
+
* row, and shows a dash while only some are chosen.
|
|
48
|
+
* 3. `helix-select` asks first, with every key the change would leave.
|
|
49
|
+
* Refuse it to keep the selection. `helix-selected` follows once it stands.
|
|
50
|
+
* 4. A chosen row takes `:state(selected)`, and a screen reader hears
|
|
51
|
+
* `selected-label` ("2 selected") from a polite region.
|
|
52
|
+
*
|
|
53
|
+
* Tab reaches each checkbox, and Space ticks it. For a grid a reader moves
|
|
54
|
+
* through with the arrow keys, with typeahead and range selection, use
|
|
55
|
+
* `DataTable`. To act on one row, put a link or a button in a cell.
|
|
23
56
|
*
|
|
24
57
|
* The CSS custom properties listed for this component are written by it and
|
|
25
58
|
* read by the stylesheet that draws it. Do not set them. Each holds a number
|
|
@@ -33,13 +66,29 @@ declare const HelixHeadlessTable_base: (new (...args: any[]) => import("@fusion.
|
|
|
33
66
|
* @documentation https://fusion.dev/helix/components/table
|
|
34
67
|
*
|
|
35
68
|
* @slot - The table's rows.
|
|
69
|
+
* @slot heading - Words that name the table, shown above it, such as a heading.
|
|
36
70
|
*
|
|
71
|
+
* @event {HelixSelectEvent} helix-select - The selection is about to change. The event carries every selected key, separated by commas. Cancelable: cancel it to keep the current selection.
|
|
72
|
+
* @event {HelixSelectedEvent} helix-selected - Fired after the selection changes, with every selected key, separated by commas.
|
|
37
73
|
* @event {HelixSortEvent} helix-sort - A different sort order was requested, as `field:direction`, or empty for the order the rows were written in. Cancelable: cancel it to keep the current order.
|
|
74
|
+
* @event {HelixSortedEvent} helix-sorted - Fired after the sort order changes, with the new order.
|
|
38
75
|
*
|
|
76
|
+
* @csspart checkbox - The checkbox in the heading that selects every row, in a `selectable` table.
|
|
77
|
+
* @csspart checkbox-box - The box drawn for the checkbox's input.
|
|
78
|
+
* @csspart checkbox-control - The checkbox's input.
|
|
79
|
+
* @csspart checkbox-feedback - Forwarded from the checkbox. Not shown in the table.
|
|
80
|
+
* @csspart checkbox-field - The row that holds the checkbox's box.
|
|
81
|
+
* @csspart checkbox-hint - Forwarded from the checkbox. Not shown in the table.
|
|
82
|
+
* @csspart checkbox-label - Forwarded from the checkbox. The label is read by screen readers only.
|
|
83
|
+
* @csspart checkbox-mark - The check mark, or the dash while some rows are selected.
|
|
84
|
+
* @csspart checkbox-mark-checked - Added to `checkbox-mark` while its box is checked.
|
|
85
|
+
* @csspart checkbox-mark-dash - Added to `checkbox-mark` while it draws the dash, which it keeps until its box is checked.
|
|
86
|
+
* @csspart checkbox-mark-indeterminate - Added to `checkbox-mark` while only some rows are selected.
|
|
39
87
|
* @csspart empty - The text shown when there are no rows.
|
|
40
88
|
* @csspart head - The row that holds the column headings. It has `display: contents`, so it takes no space of its own.
|
|
41
89
|
* @csspart live - A live region that repeats the empty and loading text, so screen readers announce it when it changes. Visually hidden in the styled tier.
|
|
42
90
|
* @csspart loading - The text shown while the rows are loading.
|
|
91
|
+
* @csspart select-all - The heading that holds the checkbox that selects every row.
|
|
43
92
|
* @csspart table - The grid.
|
|
44
93
|
*
|
|
45
94
|
* @cssproperty --table-template - The column track list the table works out from its columns. The component writes it inline on the element that reads it, so setting it has no effect. Set `columns` to change the tracks.
|
|
@@ -78,6 +127,11 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
|
78
127
|
* declared in it has nowhere else to be sized from.
|
|
79
128
|
*/
|
|
80
129
|
columns: string;
|
|
130
|
+
/**
|
|
131
|
+
* The keys selected at the start, separated by commas. Used until `selected`
|
|
132
|
+
* is set.
|
|
133
|
+
*/
|
|
134
|
+
defaultSelected: string;
|
|
81
135
|
/**
|
|
82
136
|
* The starting sort order, used until `sort` is set.
|
|
83
137
|
*/
|
|
@@ -91,6 +145,32 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
|
91
145
|
* wins over this.
|
|
92
146
|
*/
|
|
93
147
|
label: string;
|
|
148
|
+
/**
|
|
149
|
+
* Adds a column of checkboxes for selecting rows. Each row is known by its
|
|
150
|
+
* `value`, and by its place among the rows as written where it has none.
|
|
151
|
+
*/
|
|
152
|
+
selectable: boolean;
|
|
153
|
+
/** The name of the checkbox in the heading that selects every row. */
|
|
154
|
+
selectAllLabel: string;
|
|
155
|
+
/**
|
|
156
|
+
* The keys of the selected rows, separated by commas.
|
|
157
|
+
*
|
|
158
|
+
* A reader's press fires `helix-select` first, and refusing it leaves the
|
|
159
|
+
* selection as it was. `default-selected` seeds a selection this element
|
|
160
|
+
* then owns.
|
|
161
|
+
*/
|
|
162
|
+
get selected(): string;
|
|
163
|
+
set selected(next: string);
|
|
164
|
+
/**
|
|
165
|
+
* What screen readers hear when the chosen rows change. `{count}` is how many
|
|
166
|
+
* rows are chosen.
|
|
167
|
+
*/
|
|
168
|
+
selectedLabel: string;
|
|
169
|
+
/**
|
|
170
|
+
* The name of a row's checkbox. `{row}` is replaced with the words of the
|
|
171
|
+
* row's first cell.
|
|
172
|
+
*/
|
|
173
|
+
selectRowLabel: string;
|
|
94
174
|
/**
|
|
95
175
|
* The sort order, as `field:direction`, where `field` is a sortable column's
|
|
96
176
|
* `field`.
|
|
@@ -110,6 +190,9 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
|
110
190
|
/** What screen readers hear when the table stops being sorted. */
|
|
111
191
|
unsortedLabel: string;
|
|
112
192
|
private sortState;
|
|
193
|
+
private selectedState;
|
|
194
|
+
/** Whether the heading names the table, so taking it away clears only this element's own name. */
|
|
195
|
+
private headed;
|
|
113
196
|
/**
|
|
114
197
|
* Carries a host `aria-label` and `aria-labelledby` to the grid, which is
|
|
115
198
|
* the element with the `table` role.
|
|
@@ -148,6 +231,39 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
|
148
231
|
* new order is said. Not on the first render, which is the table arriving.
|
|
149
232
|
*/
|
|
150
233
|
private news;
|
|
234
|
+
/** The sort as the last render had it, so a selection said beside a sort waits. */
|
|
235
|
+
private heardSortBefore;
|
|
236
|
+
/** The selection last heard, so a render that changed nothing says nothing. */
|
|
237
|
+
private heardSelected;
|
|
238
|
+
/** The rows as written, each with the key `selected` lists it by. */
|
|
239
|
+
private get keyed();
|
|
240
|
+
/** The keys selected now. */
|
|
241
|
+
private get chosen();
|
|
242
|
+
/** Asks for a different set of selected rows, and reports whether the request stood. */
|
|
243
|
+
private requestSelected;
|
|
244
|
+
/**
|
|
245
|
+
* A checkbox this table drew asked to change: a row's, or the one in the
|
|
246
|
+
* heading. Refused, and asked of the selection instead, so a box shows only
|
|
247
|
+
* what `selected` says. A checkbox a consumer put in a cell is theirs and is
|
|
248
|
+
* left alone.
|
|
249
|
+
*/
|
|
250
|
+
private readonly handleToggle;
|
|
251
|
+
/**
|
|
252
|
+
* Tells each row whether it is selected and what its checkbox is called.
|
|
253
|
+
*
|
|
254
|
+
* Pushed down for the reason the sort is: the selection is the table's, and
|
|
255
|
+
* the checkbox is drawn by the row.
|
|
256
|
+
*/
|
|
257
|
+
private markSelected;
|
|
258
|
+
/**
|
|
259
|
+
* Names the table by its heading, where the host names it no other way.
|
|
260
|
+
*
|
|
261
|
+
* Through element reflection, because the heading is the consumer's markup
|
|
262
|
+
* and the table is in this shadow root, which an id cannot reach across.
|
|
263
|
+
*/
|
|
264
|
+
private nameByHeading;
|
|
265
|
+
/** What the heading slot is given. */
|
|
266
|
+
private get headings();
|
|
151
267
|
/**
|
|
152
268
|
* Tells each column which way it is ordered, if it is the one.
|
|
153
269
|
*
|
|
@@ -175,6 +291,8 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
|
175
291
|
* track for one that declares neither.
|
|
176
292
|
*/
|
|
177
293
|
private get template();
|
|
294
|
+
/** The tracks of the columns, before any checkbox column. */
|
|
295
|
+
private get tracks();
|
|
178
296
|
/**
|
|
179
297
|
* Tracks for the columns that set nothing, from how much text each holds.
|
|
180
298
|
*
|
|
@@ -195,6 +313,8 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
|
195
313
|
* after. Sampled, so a table of thousands of rows reads `SAMPLE` of them.
|
|
196
314
|
*/
|
|
197
315
|
private fitted;
|
|
316
|
+
/** Asks for the render a hydration put off, which reads the rows. */
|
|
317
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
198
318
|
private readonly handleSlotChange;
|
|
199
319
|
/**
|
|
200
320
|
* Watches the light DOM for rows and columns arriving, leaving and moving.
|
|
@@ -278,6 +398,8 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
|
|
|
278
398
|
private alignCells;
|
|
279
399
|
protected willUpdate(changed: PropertyValues): void;
|
|
280
400
|
protected updated(changed: PropertyValues): void;
|
|
401
|
+
/** The heading of the checkbox column, which selects every row. */
|
|
402
|
+
private renderSelectAll;
|
|
281
403
|
protected render(): TemplateResult;
|
|
282
404
|
}
|
|
283
405
|
declare global {
|
|
@@ -4,10 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, customElement, fillTemplate, HelixElement, HelixSortEvent, MixinCollection, requestChange, splitValues, } from '@fusion.dev/helix-core';
|
|
8
|
-
import {
|
|
7
|
+
import { AriaForwardController, commaList, customElement, cycle, fillTemplate, format, HelixElement, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, MixinCollection, parse, reflectElements, requestChange, sort, splitValues, toggleEvery, whenHydrated, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { nothing } from 'lit';
|
|
9
9
|
import { property, state } from 'lit/decorators.js';
|
|
10
|
-
import {
|
|
10
|
+
import { html } from 'lit/static-html.js';
|
|
11
|
+
import '../../checkbox/index.js';
|
|
11
12
|
import { edgeOf } from '../column/table-column.js';
|
|
12
13
|
const tracksOf = (list, wanted) => {
|
|
13
14
|
const words = splitValues(list, ' ');
|
|
@@ -47,17 +48,51 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
47
48
|
super(...arguments);
|
|
48
49
|
this.ascendingLabel = 'ascending';
|
|
49
50
|
this.columns = '';
|
|
51
|
+
this.defaultSelected = '';
|
|
50
52
|
this.defaultSort = '';
|
|
51
53
|
this.descendingLabel = 'descending';
|
|
52
54
|
this.label = '';
|
|
55
|
+
this.selectable = false;
|
|
56
|
+
this.selectAllLabel = 'Select every row';
|
|
57
|
+
this.selectedLabel = '{count} selected';
|
|
58
|
+
this.selectRowLabel = 'Select {row}';
|
|
53
59
|
this.sortedLabel = 'Sorted by {column}, {order}';
|
|
54
60
|
this.unsortedLabel = 'Not sorted';
|
|
55
61
|
this.sortState = undefined;
|
|
62
|
+
this.selectedState = undefined;
|
|
63
|
+
this.headed = false;
|
|
56
64
|
this.aria = new AriaForwardController(this, {
|
|
57
65
|
label: true,
|
|
58
66
|
target: () => this.partNamed('table'),
|
|
59
67
|
});
|
|
60
68
|
this.heardSort = undefined;
|
|
69
|
+
this.heardSortBefore = undefined;
|
|
70
|
+
this.heardSelected = undefined;
|
|
71
|
+
this.handleToggle = (event) => {
|
|
72
|
+
const origin = event.composedPath()[0];
|
|
73
|
+
if (!(origin instanceof Element) || origin.getAttribute('part') !== 'checkbox') {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const root = origin.getRootNode();
|
|
77
|
+
const keys = this.chosen;
|
|
78
|
+
if (root === this.renderRoot) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
this.requestSelected(new Set(toggleEvery(keys, this.keyed.map(({ key }) => key))));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const found = this.keyed.find(({ row }) => row.shadowRoot === root);
|
|
84
|
+
if (!found) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
if (event.detail.checked) {
|
|
89
|
+
keys.add(found.key);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
keys.delete(found.key);
|
|
93
|
+
}
|
|
94
|
+
this.requestSelected(keys);
|
|
95
|
+
};
|
|
61
96
|
this.handleHeadClick = (event) => {
|
|
62
97
|
const path = event.composedPath();
|
|
63
98
|
if (!path.some((node) => node instanceof Element && node.getAttribute('part') === 'sort')) {
|
|
@@ -76,6 +111,14 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
76
111
|
this.alignment = undefined;
|
|
77
112
|
this.aligned = '';
|
|
78
113
|
}
|
|
114
|
+
get selected() {
|
|
115
|
+
return this.selectedState ?? this.defaultSelected;
|
|
116
|
+
}
|
|
117
|
+
set selected(next) {
|
|
118
|
+
const previous = this.selected;
|
|
119
|
+
this.selectedState = next;
|
|
120
|
+
this.requestUpdate('selected', previous);
|
|
121
|
+
}
|
|
79
122
|
get sort() {
|
|
80
123
|
return this.sortState ?? this.defaultSort;
|
|
81
124
|
}
|
|
@@ -90,6 +133,7 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
90
133
|
const previous = this.sort;
|
|
91
134
|
this.sortState = value;
|
|
92
135
|
this.requestUpdate('sort', previous);
|
|
136
|
+
this.dispatchEvent(new HelixSortedEvent({ value }));
|
|
93
137
|
},
|
|
94
138
|
event: (value) => new HelixSortEvent({ value }),
|
|
95
139
|
host: this,
|
|
@@ -133,8 +177,57 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
133
177
|
: this.unsortedLabel;
|
|
134
178
|
}
|
|
135
179
|
this.heardSort = current;
|
|
180
|
+
const selected = this.selectable ? this.selected : '';
|
|
181
|
+
if (this.hasUpdated && current === this.heardSortBefore && selected !== this.heardSelected) {
|
|
182
|
+
said = fillTemplate(this.selectedLabel, { count: this.chosen.size });
|
|
183
|
+
}
|
|
184
|
+
this.heardSortBefore = current;
|
|
185
|
+
this.heardSelected = selected;
|
|
136
186
|
return said;
|
|
137
187
|
}
|
|
188
|
+
get keyed() {
|
|
189
|
+
return this.slotted.map((row, index) => ({
|
|
190
|
+
key: row.value || String(index),
|
|
191
|
+
row: row,
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
get chosen() {
|
|
195
|
+
return new Set(commaList(this.selected));
|
|
196
|
+
}
|
|
197
|
+
requestSelected(keys) {
|
|
198
|
+
return requestChange({
|
|
199
|
+
apply: (value) => {
|
|
200
|
+
const previous = this.selected;
|
|
201
|
+
this.selectedState = value;
|
|
202
|
+
this.requestUpdate('selected', previous);
|
|
203
|
+
this.dispatchEvent(new HelixSelectedEvent({ value }));
|
|
204
|
+
},
|
|
205
|
+
event: (value) => new HelixSelectEvent({ value }),
|
|
206
|
+
host: this,
|
|
207
|
+
next: [...keys].join(','),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
markSelected() {
|
|
211
|
+
const keys = this.chosen;
|
|
212
|
+
for (const { key, row } of this.keyed) {
|
|
213
|
+
if (!row.isTableRow) {
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
const label = fillTemplate(this.selectRowLabel, { row: textOf(row.children[0]) || key });
|
|
217
|
+
whenHydrated(row, () => {
|
|
218
|
+
row.selectable = this.selectable;
|
|
219
|
+
row.selected = keys.has(key);
|
|
220
|
+
row.selectLabel = label;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
nameByHeading() {
|
|
225
|
+
const named = this.hasAttribute('aria-label') || this.hasAttribute('aria-labelledby');
|
|
226
|
+
this.headed = reflectElements(this.partNamed('table'), 'ariaLabelledByElements', named ? [] : this.headings, this.headed);
|
|
227
|
+
}
|
|
228
|
+
get headings() {
|
|
229
|
+
return [...(this.children ?? [])].filter((child) => child.getAttribute('slot') === 'heading');
|
|
230
|
+
}
|
|
138
231
|
markSorted() {
|
|
139
232
|
const current = parse(this.sort);
|
|
140
233
|
for (const column of this.tableColumns) {
|
|
@@ -150,6 +243,10 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
150
243
|
return this.knownChildren.filter((child) => 'isTableColumn' in child && child.isTableColumn === true);
|
|
151
244
|
}
|
|
152
245
|
get template() {
|
|
246
|
+
const tracks = this.tracks;
|
|
247
|
+
return this.selectable && tracks ? `max-content ${tracks}` : tracks;
|
|
248
|
+
}
|
|
249
|
+
get tracks() {
|
|
153
250
|
const declared = this.tableColumns;
|
|
154
251
|
if (declared.length === 0) {
|
|
155
252
|
return this.columns;
|
|
@@ -187,17 +284,23 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
187
284
|
: 'max-content';
|
|
188
285
|
});
|
|
189
286
|
}
|
|
287
|
+
firstUpdated(changed) {
|
|
288
|
+
super.firstUpdated(changed);
|
|
289
|
+
this.finishHydration();
|
|
290
|
+
}
|
|
190
291
|
connectedCallback() {
|
|
191
292
|
super.connectedCallback();
|
|
192
293
|
this.watcher = new MutationObserver(() => this.requestUpdate());
|
|
193
294
|
this.watcher.observe(this, { characterData: true, childList: true, subtree: true });
|
|
194
295
|
this.addEventListener('click', this.handleHeadClick);
|
|
296
|
+
this.addEventListener('helix-before-toggle', this.handleToggle);
|
|
195
297
|
}
|
|
196
298
|
disconnectedCallback() {
|
|
197
299
|
super.disconnectedCallback();
|
|
198
300
|
this.watcher?.disconnect();
|
|
199
301
|
this.watcher = undefined;
|
|
200
302
|
this.removeEventListener('click', this.handleHeadClick);
|
|
303
|
+
this.removeEventListener('helix-before-toggle', this.handleToggle);
|
|
201
304
|
}
|
|
202
305
|
static { this.shadowRootOptions = {
|
|
203
306
|
...HelixElement.shadowRootOptions,
|
|
@@ -205,7 +308,7 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
205
308
|
}; }
|
|
206
309
|
get slotted() {
|
|
207
310
|
const columns = new Set(this.tableColumns);
|
|
208
|
-
return [...(this.children ?? [])].filter((child) => !columns.has(child));
|
|
311
|
+
return [...(this.children ?? [])].filter((child) => !columns.has(child) && child.getAttribute('slot') !== 'heading');
|
|
209
312
|
}
|
|
210
313
|
assign() {
|
|
211
314
|
if (this.assignsByName) {
|
|
@@ -221,6 +324,9 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
221
324
|
}
|
|
222
325
|
head.assign(...this.tableColumns);
|
|
223
326
|
body.assign(...this.arrangedRows);
|
|
327
|
+
this.renderRoot
|
|
328
|
+
?.querySelector('slot[name="heading"]')
|
|
329
|
+
?.assign(...this.headings);
|
|
224
330
|
}
|
|
225
331
|
alignCells() {
|
|
226
332
|
if (typeof CSSStyleSheet === 'undefined' || !('replaceSync' in CSSStyleSheet.prototype)) {
|
|
@@ -252,17 +358,40 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
|
|
|
252
358
|
this.assign();
|
|
253
359
|
this.alignCells();
|
|
254
360
|
this.markSorted();
|
|
361
|
+
this.markSelected();
|
|
362
|
+
this.nameByHeading();
|
|
363
|
+
}
|
|
364
|
+
renderSelectAll() {
|
|
365
|
+
if (!this.selectable) {
|
|
366
|
+
return nothing;
|
|
367
|
+
}
|
|
368
|
+
const every = this.childrenKnown ? this.keyed.map(({ key }) => key) : [];
|
|
369
|
+
const keys = this.chosen;
|
|
370
|
+
const count = every.filter((key) => keys.has(key)).length;
|
|
371
|
+
const checkbox = this.tag('checkbox');
|
|
372
|
+
return html `<span part="select-all" role="columnheader"
|
|
373
|
+
><${checkbox}
|
|
374
|
+
part="checkbox"
|
|
375
|
+
exportparts="box: checkbox-box, control: checkbox-control, feedback: checkbox-feedback,
|
|
376
|
+
field: checkbox-field, hint: checkbox-hint, label: checkbox-label, mark: checkbox-mark,
|
|
377
|
+
mark-checked: checkbox-mark-checked, mark-dash: checkbox-mark-dash,
|
|
378
|
+
mark-indeterminate: checkbox-mark-indeterminate"
|
|
379
|
+
aria-label=${this.selectAllLabel}
|
|
380
|
+
.checked=${every.length > 0 && count === every.length}
|
|
381
|
+
.indeterminate=${count > 0 && count < every.length}
|
|
382
|
+
></${checkbox}
|
|
383
|
+
></span>`;
|
|
255
384
|
}
|
|
256
385
|
render() {
|
|
257
386
|
const template = this.template;
|
|
258
|
-
return html `<div
|
|
387
|
+
return html `<slot name="heading"></slot><div
|
|
259
388
|
part="table"
|
|
260
389
|
role="table"
|
|
261
390
|
aria-busy=${this.loading ? 'true' : nothing}
|
|
262
391
|
aria-label=${this.label || 'Table'}
|
|
263
392
|
style=${template ? `--table-template: ${template}` : ''}
|
|
264
393
|
>
|
|
265
|
-
<div part="head" role="row"
|
|
394
|
+
<div part="head" role="row">${this.renderSelectAll()}<slot name="columns"></slot></div>
|
|
266
395
|
<slot
|
|
267
396
|
@slotchange=${(event) => {
|
|
268
397
|
this.countRows(event);
|
|
@@ -279,6 +408,9 @@ __decorate([
|
|
|
279
408
|
__decorate([
|
|
280
409
|
property()
|
|
281
410
|
], HelixHeadlessTable.prototype, "columns", void 0);
|
|
411
|
+
__decorate([
|
|
412
|
+
property({ attribute: 'default-selected' })
|
|
413
|
+
], HelixHeadlessTable.prototype, "defaultSelected", void 0);
|
|
282
414
|
__decorate([
|
|
283
415
|
property({ attribute: 'default-sort' })
|
|
284
416
|
], HelixHeadlessTable.prototype, "defaultSort", void 0);
|
|
@@ -288,6 +420,21 @@ __decorate([
|
|
|
288
420
|
__decorate([
|
|
289
421
|
property()
|
|
290
422
|
], HelixHeadlessTable.prototype, "label", void 0);
|
|
423
|
+
__decorate([
|
|
424
|
+
property({ type: Boolean })
|
|
425
|
+
], HelixHeadlessTable.prototype, "selectable", void 0);
|
|
426
|
+
__decorate([
|
|
427
|
+
property({ attribute: 'select-all-label' })
|
|
428
|
+
], HelixHeadlessTable.prototype, "selectAllLabel", void 0);
|
|
429
|
+
__decorate([
|
|
430
|
+
property()
|
|
431
|
+
], HelixHeadlessTable.prototype, "selected", null);
|
|
432
|
+
__decorate([
|
|
433
|
+
property({ attribute: 'selected-label' })
|
|
434
|
+
], HelixHeadlessTable.prototype, "selectedLabel", void 0);
|
|
435
|
+
__decorate([
|
|
436
|
+
property({ attribute: 'select-row-label' })
|
|
437
|
+
], HelixHeadlessTable.prototype, "selectRowLabel", void 0);
|
|
291
438
|
__decorate([
|
|
292
439
|
property()
|
|
293
440
|
], HelixHeadlessTable.prototype, "sort", null);
|
|
@@ -300,6 +447,9 @@ __decorate([
|
|
|
300
447
|
__decorate([
|
|
301
448
|
state()
|
|
302
449
|
], HelixHeadlessTable.prototype, "sortState", void 0);
|
|
450
|
+
__decorate([
|
|
451
|
+
state()
|
|
452
|
+
], HelixHeadlessTable.prototype, "selectedState", void 0);
|
|
303
453
|
HelixHeadlessTable = __decorate([
|
|
304
454
|
customElement('helix-headless-table')
|
|
305
455
|
], HelixHeadlessTable);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import '../../checkbox/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* @summary One row of a table.
|
|
5
6
|
*
|
|
@@ -9,12 +10,31 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
9
10
|
* across rows. The row still exists as an element, so you can style it, hide
|
|
10
11
|
* it, or make it interactive.
|
|
11
12
|
*
|
|
13
|
+
* In a `selectable` table the row draws a checkbox cell before its own cells,
|
|
14
|
+
* and `value` is the key the table's `selected` lists it by.
|
|
15
|
+
*
|
|
12
16
|
* @since 0.1.0
|
|
13
17
|
* @status stable
|
|
14
18
|
* @aliases Row, TableRow
|
|
15
19
|
* @documentation https://fusion.dev/helix/components/table
|
|
16
20
|
*
|
|
17
21
|
* @slot - The row's cells.
|
|
22
|
+
*
|
|
23
|
+
* @csspart checkbox - The row's checkbox, in a `selectable` table.
|
|
24
|
+
* @csspart checkbox-box - The box drawn for the checkbox's input.
|
|
25
|
+
* @csspart checkbox-control - The checkbox's input.
|
|
26
|
+
* @csspart checkbox-feedback - Forwarded from the checkbox. Not shown in the table.
|
|
27
|
+
* @csspart checkbox-field - The row that holds the checkbox's box.
|
|
28
|
+
* @csspart checkbox-hint - Forwarded from the checkbox. Not shown in the table.
|
|
29
|
+
* @csspart checkbox-label - Forwarded from the checkbox. The label is read by screen readers only.
|
|
30
|
+
* @csspart checkbox-mark - The check mark.
|
|
31
|
+
* @csspart checkbox-mark-checked - Added to `checkbox-mark` while its box is checked.
|
|
32
|
+
* @csspart checkbox-mark-dash - Added to `checkbox-mark` while it draws the dash, which it keeps until its box is checked.
|
|
33
|
+
* @csspart checkbox-mark-indeterminate - Added to `checkbox-mark` while only some rows are selected.
|
|
34
|
+
* @csspart select - The cell that holds the row's checkbox, in a `selectable` table.
|
|
35
|
+
* @csspart select-selected - Added to `select` while the row is selected.
|
|
36
|
+
*
|
|
37
|
+
* @cssstate selected - While the row is selected, in a `selectable` table.
|
|
18
38
|
*/
|
|
19
39
|
export declare class HelixHeadlessTableRow extends HelixElement {
|
|
20
40
|
/**
|
|
@@ -22,6 +42,23 @@ export declare class HelixHeadlessTableRow extends HelixElement {
|
|
|
22
42
|
* finds its columns. Not a consumer's to read or set.
|
|
23
43
|
*/
|
|
24
44
|
readonly isTableRow = true;
|
|
45
|
+
/**
|
|
46
|
+
* The key the table's `selected` lists this row by. Left empty, the row is
|
|
47
|
+
* known by its place among the rows as written.
|
|
48
|
+
*/
|
|
49
|
+
value: string;
|
|
50
|
+
/**
|
|
51
|
+
* @internal Whether the table this row sits in is `selectable`, written by
|
|
52
|
+
* that table. Not a consumer's to set: the selection is the table's.
|
|
53
|
+
*/
|
|
54
|
+
selectable: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* @internal Whether the row is selected, written by the table that owns the
|
|
57
|
+
* selection. Not a consumer's to set: write the table's `selected`.
|
|
58
|
+
*/
|
|
59
|
+
selected: boolean;
|
|
60
|
+
/** @internal The name of the row's checkbox, written by the table. Not a consumer's to set. */
|
|
61
|
+
selectLabel: string;
|
|
25
62
|
/** The table's rules this row holds, so the next ones replace them rather than pile up. */
|
|
26
63
|
private columnRules;
|
|
27
64
|
/**
|
|
@@ -39,6 +76,15 @@ export declare class HelixHeadlessTableRow extends HelixElement {
|
|
|
39
76
|
* upgrades while its row is still being parsed has no value beside it yet.
|
|
40
77
|
*/
|
|
41
78
|
private readonly handleSlotChange;
|
|
79
|
+
/**
|
|
80
|
+
* The checkbox cell, in a `selectable` table.
|
|
81
|
+
*
|
|
82
|
+
* A cell of the row's own, before the consumer's cells, so the table's grid
|
|
83
|
+
* gives it the first track. The table hears its `helix-before-toggle`,
|
|
84
|
+
* refuses it and asks for the new selection, so the box shows only what the
|
|
85
|
+
* table's `selected` says.
|
|
86
|
+
*/
|
|
87
|
+
protected renderSelect(): TemplateResult | typeof nothing;
|
|
42
88
|
protected render(): TemplateResult;
|
|
43
89
|
}
|
|
44
90
|
declare global {
|
|
@@ -5,11 +5,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { customElement, HelixElement, hostAria } from '@fusion.dev/helix-core';
|
|
8
|
-
import {
|
|
8
|
+
import { nothing } from 'lit';
|
|
9
|
+
import { property, state } from 'lit/decorators.js';
|
|
10
|
+
import { html } from 'lit/static-html.js';
|
|
11
|
+
import '../../checkbox/index.js';
|
|
9
12
|
let HelixHeadlessTableRow = class HelixHeadlessTableRow extends HelixElement {
|
|
10
13
|
constructor() {
|
|
11
14
|
super(...arguments);
|
|
12
15
|
this.isTableRow = true;
|
|
16
|
+
this.value = '';
|
|
17
|
+
this.selectable = false;
|
|
18
|
+
this.selected = false;
|
|
19
|
+
this.selectLabel = '';
|
|
13
20
|
this.columnRules = undefined;
|
|
14
21
|
this.handleSlotChange = () => {
|
|
15
22
|
for (const cell of this.children) {
|
|
@@ -34,11 +41,41 @@ let HelixHeadlessTableRow = class HelixHeadlessTableRow extends HelixElement {
|
|
|
34
41
|
willUpdate(changed) {
|
|
35
42
|
super.willUpdate(changed);
|
|
36
43
|
hostAria(this.internals, { role: 'row' });
|
|
44
|
+
this.toggleState('selected', this.selectable && this.selected);
|
|
45
|
+
}
|
|
46
|
+
renderSelect() {
|
|
47
|
+
if (!this.selectable) {
|
|
48
|
+
return nothing;
|
|
49
|
+
}
|
|
50
|
+
const checkbox = this.tag('checkbox');
|
|
51
|
+
return html `<span part="select${this.selected ? ' select-selected' : ''}" role="cell"
|
|
52
|
+
><${checkbox}
|
|
53
|
+
part="checkbox"
|
|
54
|
+
exportparts="box: checkbox-box, control: checkbox-control, feedback: checkbox-feedback,
|
|
55
|
+
field: checkbox-field, hint: checkbox-hint, label: checkbox-label, mark: checkbox-mark,
|
|
56
|
+
mark-checked: checkbox-mark-checked, mark-dash: checkbox-mark-dash,
|
|
57
|
+
mark-indeterminate: checkbox-mark-indeterminate"
|
|
58
|
+
aria-label=${this.selectLabel}
|
|
59
|
+
.checked=${this.selected}
|
|
60
|
+
></${checkbox}
|
|
61
|
+
></span>`;
|
|
37
62
|
}
|
|
38
63
|
render() {
|
|
39
|
-
return html
|
|
64
|
+
return html `${this.renderSelect()}<slot @slotchange=${this.handleSlotChange}></slot>`;
|
|
40
65
|
}
|
|
41
66
|
};
|
|
67
|
+
__decorate([
|
|
68
|
+
property()
|
|
69
|
+
], HelixHeadlessTableRow.prototype, "value", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
state()
|
|
72
|
+
], HelixHeadlessTableRow.prototype, "selectable", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
state()
|
|
75
|
+
], HelixHeadlessTableRow.prototype, "selected", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
state()
|
|
78
|
+
], HelixHeadlessTableRow.prototype, "selectLabel", void 0);
|
|
42
79
|
HelixHeadlessTableRow = __decorate([
|
|
43
80
|
customElement('helix-headless-table-row')
|
|
44
81
|
], HelixHeadlessTableRow);
|