@fusion.dev/helix-headless 0.145.0 → 0.147.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 +12286 -4281
- package/dist/accordion/item/accordion-item.d.ts +51 -18
- package/dist/accordion/item/accordion-item.js +45 -13
- package/dist/accordion/root/accordion-root.d.ts +16 -7
- package/dist/accordion/root/accordion-root.js +3 -3
- package/dist/announcement/root/announcement-root.d.ts +16 -6
- package/dist/announcement/root/announcement-root.js +37 -7
- package/dist/app-header/root/app-header-root.d.ts +7 -2
- package/dist/app-header/root/app-header-root.js +9 -1
- package/dist/app-header/sectioning.d.ts +3 -1
- package/dist/app-header/sectioning.js +3 -2
- package/dist/area-chart/root/area-chart-root.d.ts +18 -1
- package/dist/area-chart/root/area-chart-root.js +11 -3
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/avatar/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/root/badge-root.d.ts +60 -7
- package/dist/badge/root/badge-root.js +89 -6
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +48 -20
- package/dist/bar-chart/stack.d.ts +25 -0
- package/dist/bar-chart/stack.js +27 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +25 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +51 -4
- package/dist/button/root/button-root.d.ts +50 -38
- package/dist/button/root/button-root.js +42 -53
- package/dist/button/submitter.d.ts +27 -0
- package/dist/button/submitter.js +25 -0
- 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.js +2 -2
- package/dist/card/root/card-root.d.ts +36 -4
- package/dist/card/root/card-root.js +29 -10
- package/dist/carousel/root/carousel-root.d.ts +43 -4
- package/dist/carousel/root/carousel-root.js +40 -12
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/message/chat-message.js +5 -4
- package/dist/chat/naming.d.ts +5 -1
- package/dist/chat/naming.js +4 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +32 -6
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +18 -7
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +14 -11
- package/dist/checkbox-group/select-all.d.ts +21 -0
- package/dist/checkbox-group/select-all.js +7 -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 +79 -10
- package/dist/code-block/root/code-block-root.js +74 -5
- package/dist/color-input/root/color-input-root.d.ts +14 -0
- package/dist/color-input/root/color-input-root.js +17 -7
- package/dist/color-picker/channels.js +1 -2
- package/dist/color-picker/root/color-picker-root.d.ts +53 -16
- package/dist/color-picker/root/color-picker-root.js +155 -46
- package/dist/color-picker/wheel.d.ts +17 -0
- package/dist/color-picker/wheel.js +6 -0
- package/dist/combobox/root/combobox-root.d.ts +56 -0
- package/dist/combobox/root/combobox-root.js +92 -15
- package/dist/command/root/command-root.d.ts +19 -2
- package/dist/command/root/command-root.js +24 -23
- package/dist/copy-button/root/copy-button-root.d.ts +21 -1
- package/dist/copy-button/root/copy-button-root.js +16 -4
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +6 -0
- package/dist/data-table/keys.js +14 -0
- package/dist/data-table/root/data-table-root.d.ts +27 -18
- package/dist/data-table/root/data-table-root.js +31 -57
- package/dist/data-table/tree.d.ts +16 -1
- package/dist/data-table/tree.js +2 -3
- package/dist/date-input/root/date-input-root.d.ts +11 -2
- package/dist/date-input/root/date-input-root.js +26 -12
- package/dist/date-picker/root/date-picker-root.d.ts +14 -9
- package/dist/date-picker/root/date-picker-root.js +33 -22
- package/dist/description-list/item/description-list-item.d.ts +18 -4
- package/dist/description-list/item/description-list-item.js +8 -4
- 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 +55 -1
- package/dist/donut-chart/slice-label.d.ts +35 -0
- package/dist/donut-chart/slice-label.js +11 -0
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +75 -4
- package/dist/drilldown/item/drilldown-item.d.ts +21 -1
- package/dist/drilldown/item/drilldown-item.js +40 -5
- package/dist/drilldown/root/drilldown-root.d.ts +21 -3
- package/dist/drilldown/root/drilldown-root.js +22 -3
- package/dist/element-events.generated.js +35 -6
- package/dist/empty/root/empty-root.d.ts +34 -2
- package/dist/empty/root/empty-root.js +26 -4
- package/dist/file-input/root/file-input-root.d.ts +99 -8
- package/dist/file-input/root/file-input-root.js +120 -22
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/file-input/status.d.ts +24 -0
- package/dist/file-input/status.js +10 -0
- package/dist/filter-input/chip/filter-chip.d.ts +23 -0
- package/dist/filter-input/chip/filter-chip.js +11 -2
- package/dist/filter-input/menu/filter-menu.d.ts +2 -0
- package/dist/filter-input/menu/filter-menu.js +12 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -6
- package/dist/filter-input/root/filter-input-root.js +18 -28
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/options.d.ts +3 -4
- package/dist/format-date/options.js +2 -2
- package/dist/format-date/root/format-date-root.d.ts +27 -17
- package/dist/format-date/root/format-date-root.js +27 -48
- package/dist/heatmap/root/buckets.d.ts +21 -0
- package/dist/heatmap/root/buckets.js +34 -0
- package/dist/heatmap/root/heatmap-root.d.ts +83 -11
- package/dist/heatmap/root/heatmap-root.js +104 -12
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/registry.d.ts +26 -1
- package/dist/icon/registry.js +12 -1
- package/dist/icon/root/icon-root.d.ts +25 -1
- package/dist/icon/root/icon-root.js +44 -12
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon/root/index.js +1 -1
- 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 +14 -1
- package/dist/image/root/image-root.js +7 -2
- package/dist/input/root/input-root.d.ts +34 -3
- package/dist/input/root/input-root.js +17 -4
- package/dist/kbd/keys.d.ts +29 -0
- package/dist/kbd/keys.js +52 -0
- package/dist/kbd/root/kbd-root.d.ts +52 -1
- package/dist/kbd/root/kbd-root.js +40 -47
- package/dist/legend/hidden-series.d.ts +10 -2
- package/dist/legend/hidden-series.js +5 -2
- package/dist/legend/root/legend-root.d.ts +77 -12
- package/dist/legend/root/legend-root.js +71 -17
- package/dist/lightbox/root/lightbox-root.d.ts +98 -10
- package/dist/lightbox/root/lightbox-root.js +153 -18
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +24 -0
- package/dist/lightbox/zoom.js +18 -0
- package/dist/line-chart/root/line-chart-root.d.ts +38 -1
- package/dist/line-chart/root/line-chart-root.js +31 -3
- package/dist/list/item/list-item.d.ts +2 -0
- package/dist/list/item/list-item.js +11 -2
- package/dist/list/root/list-root.d.ts +70 -13
- package/dist/list/root/list-root.js +91 -13
- package/dist/list/selection.d.ts +54 -7
- package/dist/list/selection.js +32 -7
- package/dist/listbox/root/listbox-root.d.ts +44 -4
- package/dist/listbox/root/listbox-root.js +72 -34
- 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/megamenu/hand-over.d.ts +75 -0
- package/dist/megamenu/hand-over.js +67 -0
- package/dist/megamenu/root/megamenu-root.d.ts +80 -15
- package/dist/megamenu/root/megamenu-root.js +76 -19
- package/dist/menu/item/menu-item.d.ts +51 -2
- package/dist/menu/item/menu-item.js +50 -26
- package/dist/menu/root/menu-root.d.ts +17 -0
- package/dist/menu/root/menu-root.js +2 -2
- package/dist/meter/root/meter-root.d.ts +62 -1
- package/dist/meter/root/meter-root.js +38 -16
- package/dist/navigation/root/navigation-root.d.ts +2 -1
- package/dist/navigation/root/navigation-root.js +2 -2
- package/dist/notifications/root/notifications-root.d.ts +20 -4
- package/dist/notifications/root/notifications-root.js +30 -8
- package/dist/number-input/grain.d.ts +28 -0
- package/dist/number-input/grain.js +14 -0
- package/dist/number-input/root/number-input-root.d.ts +34 -9
- package/dist/number-input/root/number-input-root.js +31 -25
- package/dist/object-inspector/root/object-inspector-root.d.ts +88 -33
- package/dist/object-inspector/root/object-inspector-root.js +134 -92
- package/dist/object-inspector/rows.d.ts +18 -0
- package/dist/object-inspector/rows.js +33 -0
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/option/separator/option-separator.d.ts +30 -0
- package/dist/option/separator/option-separator.js +21 -0
- package/dist/outline/root/outline-root.d.ts +30 -0
- package/dist/outline/root/outline-root.js +17 -13
- package/dist/pagination/size/pagination-size.d.ts +6 -0
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pin-input/code.d.ts +37 -0
- package/dist/pin-input/code.js +25 -0
- package/dist/pin-input/root/pin-input-root.d.ts +116 -115
- package/dist/pin-input/root/pin-input-root.js +163 -155
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +34 -0
- package/dist/popover/root/popover-root.d.ts +64 -8
- package/dist/popover/root/popover-root.js +67 -4
- package/dist/progress/root/progress-root.d.ts +47 -0
- package/dist/progress/root/progress-root.js +34 -16
- package/dist/qr-code/export.d.ts +45 -1
- package/dist/qr-code/export.js +28 -0
- package/dist/qr-code/name.d.ts +11 -0
- package/dist/qr-code/name.js +7 -0
- package/dist/qr-code/root/qr-code-root.d.ts +36 -11
- package/dist/qr-code/root/qr-code-root.js +58 -11
- 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 +15 -0
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +7 -2
- package/dist/rating/root/rating-root.d.ts +30 -12
- package/dist/rating/root/rating-root.js +27 -27
- 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 +51 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +64 -24
- package/dist/scroll-area/root/scroll-area-root.d.ts +22 -51
- package/dist/scroll-area/root/scroll-area-root.js +57 -173
- 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 +27 -8
- package/dist/scroll-area/scrollbar.js +10 -1
- package/dist/select/align.d.ts +47 -0
- package/dist/select/align.js +7 -0
- package/dist/select/root/select-root.d.ts +71 -0
- package/dist/select/root/select-root.js +78 -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 +59 -5
- package/dist/slider/root/slider-root.js +45 -3
- package/dist/sparkline/readings.d.ts +36 -0
- package/dist/sparkline/readings.js +36 -0
- package/dist/sparkline/root/sparkline-root.d.ts +121 -7
- package/dist/sparkline/root/sparkline-root.js +160 -26
- package/dist/speed-dial/item/speed-dial-item.d.ts +1 -1
- package/dist/speed-dial/item/speed-dial-item.js +2 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +6 -0
- package/dist/speed-dial/root/speed-dial-root.js +11 -3
- package/dist/splitter/root/splitter-root.d.ts +10 -12
- package/dist/splitter/root/splitter-root.js +211 -204
- 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 +5 -0
- package/dist/steps/reach.js +3 -0
- package/dist/steps/root/steps-root.d.ts +56 -3
- package/dist/steps/root/steps-root.js +50 -6
- package/dist/steps/step/step.d.ts +8 -0
- package/dist/steps/step/step.js +8 -3
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +6 -10
- package/dist/table/column/table-column.js +8 -20
- package/dist/table/root/table-root.d.ts +31 -10
- package/dist/table/root/table-root.js +14 -18
- package/dist/table/row/table-row.d.ts +24 -0
- package/dist/table/row/table-row.js +37 -1
- package/dist/tabs/panel/tab-panel.d.ts +16 -3
- package/dist/tabs/panel/tab-panel.js +34 -5
- package/dist/tabs/root/tabs-root.d.ts +17 -3
- package/dist/tabs/root/tabs-root.js +1 -1
- package/dist/tabs/tab/tab.d.ts +5 -0
- package/dist/tabs/tab/tab.js +5 -2
- package/dist/tag/group/tag-group.d.ts +44 -5
- package/dist/tag/group/tag-group.js +60 -9
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +41 -2
- package/dist/textarea/root/textarea-root.js +39 -1
- package/dist/time-input/root/time-input-root.d.ts +10 -2
- package/dist/time-input/root/time-input-root.js +24 -13
- package/dist/time-picker/root/time-picker-root.d.ts +28 -17
- package/dist/time-picker/root/time-picker-root.js +18 -29
- 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.js +2 -2
- package/dist/toast/item/toast-item.d.ts +16 -3
- package/dist/toast/item/toast-item.js +22 -6
- package/dist/toast/root/toast-root.d.ts +34 -4
- package/dist/toast/root/toast-root.js +74 -13
- package/dist/toast/words.d.ts +12 -0
- package/dist/toast/words.js +25 -0
- package/dist/toggle/group/toggle-group.d.ts +52 -7
- package/dist/toggle/group/toggle-group.js +58 -44
- package/dist/toggle/root/toggle-root.js +2 -4
- package/dist/toolbar/root/toolbar-root.d.ts +21 -5
- package/dist/toolbar/root/toolbar-root.js +52 -8
- package/dist/tooltip/root/tooltip-root.d.ts +20 -3
- package/dist/tooltip/root/tooltip-root.js +18 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +45 -2
- package/dist/tour/root/tour-root.js +53 -8
- package/dist/tour/stop/tour-stop.d.ts +3 -0
- package/dist/tour/stop/tour-stop.js +3 -3
- package/dist/tree/item/tree-item.d.ts +7 -3
- package/dist/tree/item/tree-item.js +3 -0
- package/dist/tree/root/tree-root.d.ts +24 -3
- package/dist/tree/root/tree-root.js +32 -13
- package/dist/tree/selection.js +2 -15
- package/dist/trend/figure.d.ts +16 -0
- package/dist/trend/figure.js +8 -0
- package/dist/trend/root/trend-root.d.ts +83 -19
- package/dist/trend/root/trend-root.js +59 -8
- package/dist/video/media-events.d.ts +13 -18
- package/dist/video/media-events.js +1 -5
- package/dist/video/root/extra-controls.d.ts +12 -0
- package/dist/video/root/extra-controls.js +6 -2
- package/dist/video/root/video-root.d.ts +23 -6
- package/dist/video/root/video-root.js +19 -10
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +2 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +17 -1
- package/dist/video-playlist/root/video-playlist-root.js +3 -0
- package/dist/virtual-list/fill.d.ts +11 -8
- package/dist/virtual-list/fill.js +10 -17
- package/dist/virtual-list/keys.d.ts +16 -7
- package/dist/virtual-list/keys.js +17 -6
- package/dist/virtual-list/plan.d.ts +65 -0
- package/dist/virtual-list/plan.js +27 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +136 -13
- package/dist/virtual-list/root/virtual-list-root.js +218 -51
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +7441 -1458
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1501 -326
- package/dist/chat/relative-clock.d.ts +0 -39
- package/dist/chat/relative-clock.js +0 -31
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -5,18 +5,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var HelixHeadlessDataTable_1;
|
|
8
|
-
import { countLabel, customElement, deepActiveElement, deepContains, fillTemplate, formatNumbers, HelixActivateEvent, HelixElement, HelixExpandEvent, HelixFilterEvent, HelixFilteredEvent, HelixLoadMoreEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, hostAria, inlineStep, isRtl, MixinCollection, markRegion, rangeAdd, reportRuntime, requestChange, Typeahead, typesCharacter, VirtualizeController, writtenList, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { anchorAt, arranged, commaList, countLabel, customElement, cycle, deepActiveElement, deepContains, everyState, fillTemplate, format, formatNumbers, HelixActivateEvent, HelixElement, HelixExpandEvent, HelixFilterEvent, HelixFilteredEvent, HelixLoadMoreEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, hostAria, inlineStep, inRowOrder, isRtl, MixinCollection, markRegion, onAndroid, ordered, parse, rangeAdd, reportRuntime, requestChange, selectsAll, Typeahead, toggleEvery, treeArrow, typesCharacter, VirtualizeController, valueAt, window_, writtenList, } from '@fusion.dev/helix-core';
|
|
9
9
|
import { caretDown, caretRight } 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';
|
|
13
13
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
14
14
|
import { html } from 'lit/static-html.js';
|
|
15
|
-
import {
|
|
15
|
+
import { edgeOf } from '../../table/column/table-column.js';
|
|
16
16
|
import '../../checkbox/index.js';
|
|
17
17
|
import '../../pagination/index.js';
|
|
18
|
+
import { toggledOpen } from '../keys.js';
|
|
18
19
|
import { grow } from '../tree.js';
|
|
19
|
-
import { arranged, cycle, format, ordered, parse, window_, } from './order.js';
|
|
20
20
|
const CONTROL = [
|
|
21
21
|
'a[href]',
|
|
22
22
|
'button:not([disabled])',
|
|
@@ -79,7 +79,6 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
79
79
|
this.typeahead = new Typeahead();
|
|
80
80
|
this.anchorKey = undefined;
|
|
81
81
|
this.shiftPressed = false;
|
|
82
|
-
this.askedAt = -1;
|
|
83
82
|
this.counts = {
|
|
84
83
|
columns: undefined,
|
|
85
84
|
rows: undefined,
|
|
@@ -168,7 +167,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
168
167
|
const last = this.drawnPage.length - 1 + (this.moreDrawn ? 1 : 0);
|
|
169
168
|
const edge = this.width - 1;
|
|
170
169
|
const control = event.ctrlKey || event.metaKey;
|
|
171
|
-
if (
|
|
170
|
+
if (!event.shiftKey && selectsAll(event) && this.selectable) {
|
|
172
171
|
event.preventDefault();
|
|
173
172
|
this.requestSelected(new Set([...this.chosen, ...this.everyKey]));
|
|
174
173
|
return;
|
|
@@ -427,7 +426,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
427
426
|
return value;
|
|
428
427
|
}
|
|
429
428
|
get opened() {
|
|
430
|
-
return new Set(
|
|
429
|
+
return new Set(commaList(this.expanded));
|
|
431
430
|
}
|
|
432
431
|
flat() {
|
|
433
432
|
if (this.childField) {
|
|
@@ -472,7 +471,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
472
471
|
if (!this.rowKey) {
|
|
473
472
|
return String(index);
|
|
474
473
|
}
|
|
475
|
-
const value =
|
|
474
|
+
const value = valueAt(row, this.rowKey);
|
|
476
475
|
return value === undefined || value === null ? String(index) : String(value);
|
|
477
476
|
}
|
|
478
477
|
currentRow(rows) {
|
|
@@ -648,18 +647,15 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
648
647
|
},
|
|
649
648
|
event: (value) => new HelixSelectEvent({ value }),
|
|
650
649
|
host: this,
|
|
651
|
-
next:
|
|
650
|
+
next: inRowOrder(keys, this.everyKey).join(','),
|
|
652
651
|
});
|
|
653
652
|
}
|
|
654
653
|
get chosen() {
|
|
655
|
-
return new Set(this.selected
|
|
656
|
-
.split(',')
|
|
657
|
-
.map((key) => key.trim())
|
|
658
|
-
.filter(Boolean));
|
|
654
|
+
return new Set(commaList(this.selected));
|
|
659
655
|
}
|
|
660
656
|
keyOf(row, place) {
|
|
661
657
|
if (this.rowKey) {
|
|
662
|
-
const value =
|
|
658
|
+
const value = valueAt(row, this.rowKey);
|
|
663
659
|
return value === undefined || value === null ? String(place) : String(value);
|
|
664
660
|
}
|
|
665
661
|
if (this.selectable && !this.warnedAboutKey && typeof window !== 'undefined') {
|
|
@@ -684,11 +680,8 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
684
680
|
}
|
|
685
681
|
selectRange(to, from = to) {
|
|
686
682
|
const keys = this.pageKeys;
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
anchor = from;
|
|
690
|
-
this.anchorKey = keys[from];
|
|
691
|
-
}
|
|
683
|
+
const { anchor, anchorKey } = anchorAt(keys, this.anchorKey, from);
|
|
684
|
+
this.anchorKey = anchorKey;
|
|
692
685
|
const next = rangeAdd([...this.chosen], keys, anchor, to);
|
|
693
686
|
if (next) {
|
|
694
687
|
this.requestSelected(new Set(next));
|
|
@@ -712,13 +705,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
712
705
|
if (!this.windowed || !this.loadMore || this.loading) {
|
|
713
706
|
return;
|
|
714
707
|
}
|
|
715
|
-
|
|
716
|
-
const count = this.rows.length;
|
|
717
|
-
if (screen > 0 &&
|
|
718
|
-
count > 0 &&
|
|
719
|
-
this.askedAt !== count &&
|
|
720
|
-
this.virtualize.remaining() <= screen) {
|
|
721
|
-
this.askedAt = count;
|
|
708
|
+
if (this.virtualize.endInSight(this.rows.length)) {
|
|
722
709
|
this.askForMore();
|
|
723
710
|
}
|
|
724
711
|
}
|
|
@@ -734,19 +721,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
734
721
|
this.requestSelected(keys);
|
|
735
722
|
}
|
|
736
723
|
chooseAll() {
|
|
737
|
-
|
|
738
|
-
const keys = this.chosen;
|
|
739
|
-
if (every.length > 0 && every.every((key) => keys.has(key))) {
|
|
740
|
-
for (const key of every) {
|
|
741
|
-
keys.delete(key);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
else {
|
|
745
|
-
for (const key of every) {
|
|
746
|
-
keys.add(key);
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
this.requestSelected(keys);
|
|
724
|
+
this.requestSelected(new Set(toggleEvery(this.chosen, this.everyKey)));
|
|
750
725
|
}
|
|
751
726
|
moveColumn(field, by) {
|
|
752
727
|
const drawn = this.shownColumns.filter((column) => column.field !== '');
|
|
@@ -776,7 +751,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
776
751
|
return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
|
|
777
752
|
};
|
|
778
753
|
const head = columns.map((column) => quote(column.textContent?.trim() || column.field));
|
|
779
|
-
const body = rows.map((row) => columns.map((column) => quote(
|
|
754
|
+
const body = rows.map((row) => columns.map((column) => quote(valueAt(row, column.field))));
|
|
780
755
|
return [head, ...body].map((line) => line.join(',')).join('\r\n');
|
|
781
756
|
}
|
|
782
757
|
requestFilter(next) {
|
|
@@ -912,6 +887,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
912
887
|
const stop = this.currentRow(this.drawnPage) === -1 ? this.currentColumn : -1;
|
|
913
888
|
const offset = this.selectable ? 1 : 0;
|
|
914
889
|
const shown = this.shownColumns;
|
|
890
|
+
const android = onAndroid();
|
|
915
891
|
for (const column of this.tableColumns) {
|
|
916
892
|
column.movable = this.reorderable && column.field !== '';
|
|
917
893
|
column.gridCell = true;
|
|
@@ -922,6 +898,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
922
898
|
? 'ascending'
|
|
923
899
|
: 'descending'
|
|
924
900
|
: undefined;
|
|
901
|
+
column.sortWords =
|
|
902
|
+
android && column.sorted
|
|
903
|
+
? fillTemplate(this.sortedLabel, {
|
|
904
|
+
column: column.textContent?.trim() || column.field,
|
|
905
|
+
order: column.sorted === 'ascending' ? this.ascendingLabel : this.descendingLabel,
|
|
906
|
+
})
|
|
907
|
+
: '';
|
|
925
908
|
}
|
|
926
909
|
}
|
|
927
910
|
renderCell(column, row, picked, place, stop, header) {
|
|
@@ -951,18 +934,11 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
951
934
|
><svg part="toggle-mark" ?data-mirror=${!open} fill="currentColor" viewBox=${glyph.viewBox}>${unsafeSVG(glyph.content)}</svg></span>`;
|
|
952
935
|
}
|
|
953
936
|
toggleOpen(row, open) {
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
if (keys.has(key) === open) {
|
|
937
|
+
const next = toggledOpen(this.expanded, this.rowKeyOf(row, -1), open, this.everyKey);
|
|
938
|
+
if (next === undefined) {
|
|
957
939
|
return false;
|
|
958
940
|
}
|
|
959
|
-
|
|
960
|
-
keys.add(key);
|
|
961
|
-
}
|
|
962
|
-
else {
|
|
963
|
-
keys.delete(key);
|
|
964
|
-
}
|
|
965
|
-
this.expanded = [...keys].join(',');
|
|
941
|
+
this.expanded = next;
|
|
966
942
|
this.dispatchEvent(new HelixExpandEvent({ value: this.expanded }));
|
|
967
943
|
return true;
|
|
968
944
|
}
|
|
@@ -1045,15 +1021,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1045
1021
|
: html `<div part="after" role="presentation" style="block-size: ${after}px"></div>`;
|
|
1046
1022
|
}
|
|
1047
1023
|
renderSelectAll(stop) {
|
|
1048
|
-
const
|
|
1049
|
-
const keys = this.chosen;
|
|
1050
|
-
const count = every.filter((key) => keys.has(key)).length;
|
|
1024
|
+
const { checked, indeterminate } = everyState(this.chosen, this.everyKey);
|
|
1051
1025
|
return html `<span
|
|
1052
1026
|
part="select-all"
|
|
1053
1027
|
role="columnheader"
|
|
1054
1028
|
tabindex=${stop ? '0' : '-1'}
|
|
1055
1029
|
data-column="0"
|
|
1056
|
-
>${this.renderCheckbox(this.selectAllLabel,
|
|
1030
|
+
>${this.renderCheckbox(this.selectAllLabel, checked, indeterminate, this.toggleAll)}</span>`;
|
|
1057
1031
|
}
|
|
1058
1032
|
renderMore(page) {
|
|
1059
1033
|
if (!this.moreDrawn) {
|
|
@@ -1300,14 +1274,14 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1300
1274
|
return false;
|
|
1301
1275
|
}
|
|
1302
1276
|
const placed = this.tree().placed.get(row);
|
|
1303
|
-
const
|
|
1304
|
-
if (
|
|
1277
|
+
const arrow = treeArrow({ branch: placed?.branch ?? false, open: placed?.open ?? false }, inlineStep(this, event.key) > 0 ? 1 : -1);
|
|
1278
|
+
if (arrow === 'open' || arrow === 'close') {
|
|
1305
1279
|
event.preventDefault();
|
|
1306
|
-
this.toggleOpen(row,
|
|
1280
|
+
this.toggleOpen(row, arrow === 'open');
|
|
1307
1281
|
return true;
|
|
1308
1282
|
}
|
|
1309
1283
|
const parent = placed?.parent ? this.drawnPage.indexOf(placed.parent) : -1;
|
|
1310
|
-
if (
|
|
1284
|
+
if (arrow === 'parent' && parent >= 0) {
|
|
1311
1285
|
event.preventDefault();
|
|
1312
1286
|
this.moveTo(parent, place.column);
|
|
1313
1287
|
return true;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Rows that hold rows, arranged for a tree grid: filtered, sorted within each
|
|
3
|
+
* parent, and laid out flat in reading order with the open rows' children under
|
|
4
|
+
* them.
|
|
5
|
+
*
|
|
6
|
+
* Pure and beside the family's `index.ts`, because which rows show and at what
|
|
7
|
+
* depth is a fact about the data, and a spec can hold it without a page.
|
|
8
|
+
*
|
|
9
|
+
* **Filtered by descent.** A row stays when it matches the query or any row
|
|
10
|
+
* under it does, so a match deep in the tree is shown with the rows that lead to
|
|
11
|
+
* it, and while a query is on every row with a match under it is open.
|
|
12
|
+
*
|
|
13
|
+
* **Sorted among siblings.** A sort orders each parent's rows and leaves every
|
|
14
|
+
* row under its parent, which is the only order a tree can be read in.
|
|
15
|
+
*/
|
|
16
|
+
import { type Axis, type DataRow } from '@fusion.dev/helix-core';
|
|
2
17
|
/** Where a row sits in the tree. */
|
|
3
18
|
export interface Placement {
|
|
4
19
|
/** Whether it has children to show. */
|
package/dist/data-table/tree.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { filter, parse, sort } from './root/order.js';
|
|
1
|
+
import { filter, parse, sort, valueAt } from '@fusion.dev/helix-core';
|
|
3
2
|
export const childrenOf = (row, field) => {
|
|
4
|
-
const value =
|
|
3
|
+
const value = valueAt(row, field);
|
|
5
4
|
return Array.isArray(value) ? value : [];
|
|
6
5
|
};
|
|
7
6
|
export const grow = (rows, axes, { field, isOpen, query, spec, }) => {
|
|
@@ -36,6 +36,8 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
|
|
|
36
36
|
* @slot feedback - The error message under the field.
|
|
37
37
|
* @slot hint - The help text under the field.
|
|
38
38
|
* @slot next-icon - The icon on the calendar's next month control.
|
|
39
|
+
* @slot panel-footer - Content in the panel under the calendar, such as a note or an action.
|
|
40
|
+
* @slot panel-header - Content in the panel above the calendar, such as a heading or a shortcut.
|
|
39
41
|
* @slot previous-icon - The icon on the calendar's previous month control.
|
|
40
42
|
* @slot trigger - The icon on the button that opens the calendar.
|
|
41
43
|
*
|
|
@@ -69,6 +71,7 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
|
|
|
69
71
|
* @csspart picker-day-outside - A day from a neighboring month. Applied with `picker-day`.
|
|
70
72
|
* @csspart picker-day-selected - The chosen day, or either end of a chosen range. Applied with `picker-day`.
|
|
71
73
|
* @csspart picker-day-today - Today. Applied with `picker-day`.
|
|
74
|
+
* @csspart picker-feedback - The calendar's own message, under it, while the calendar's `feedback` is set.
|
|
72
75
|
* @csspart picker-grid - The grid of days.
|
|
73
76
|
* @csspart picker-header - The month name and its controls.
|
|
74
77
|
* @csspart picker-heading - The month and year being shown.
|
|
@@ -171,9 +174,15 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
|
|
|
171
174
|
*/
|
|
172
175
|
isDateUnavailable?: ((date: string) => boolean) | undefined;
|
|
173
176
|
/**
|
|
174
|
-
* The language tag for the
|
|
177
|
+
* The language tag for the field's order and words, and for the names of
|
|
178
|
+
* months and days in the calendar.
|
|
179
|
+
*
|
|
180
|
+
* Absent is the page's: the `lang` of the nearest element with one, as
|
|
181
|
+
* Shoelace and Web Awesome read it, then the runtime's own.
|
|
175
182
|
*/
|
|
176
183
|
locale: string;
|
|
184
|
+
/** The locale the words are written in: `locale`, or the page's `lang`. */
|
|
185
|
+
private get language();
|
|
177
186
|
/**
|
|
178
187
|
* The latest date that can be chosen, as `YYYY-MM-DD`.
|
|
179
188
|
*/
|
|
@@ -355,7 +364,7 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
|
|
|
355
364
|
/** Each date, where `mode` holds several, sent one entry each. */
|
|
356
365
|
protected get answers(): readonly string[] | undefined;
|
|
357
366
|
/** What is wrong with the dates, which the text input cannot say. */
|
|
358
|
-
protected validate(): string;
|
|
367
|
+
protected validate(): string | readonly [keyof ValidityStateFlags, string];
|
|
359
368
|
/**
|
|
360
369
|
* The message shown when `disable-dates` or `disable-days` bars a date.
|
|
361
370
|
*/
|
|
@@ -4,7 +4,7 @@ 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, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, isDateValue, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, isDateValue, localeOf, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { calendarBlank } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -100,6 +100,9 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
100
100
|
this.requestUpdate();
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
get language() {
|
|
104
|
+
return localeOf(this, this.locale);
|
|
105
|
+
}
|
|
103
106
|
placed(room) {
|
|
104
107
|
const all = Math.max(1, Math.floor(this.months) || 1);
|
|
105
108
|
const surface = this.partNamed('surface');
|
|
@@ -132,7 +135,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
132
135
|
return 'date';
|
|
133
136
|
}
|
|
134
137
|
get segmentLocale() {
|
|
135
|
-
return this.
|
|
138
|
+
return this.language;
|
|
136
139
|
}
|
|
137
140
|
written(date) {
|
|
138
141
|
if (this.dateStyle === 'iso' || !isDateValue(date)) {
|
|
@@ -141,7 +144,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
141
144
|
const at = new Date(`${date}T00:00:00Z`);
|
|
142
145
|
return Number.isNaN(at.getTime())
|
|
143
146
|
? date
|
|
144
|
-
: new Intl.DateTimeFormat(this.
|
|
147
|
+
: new Intl.DateTimeFormat(this.language || undefined, {
|
|
145
148
|
dateStyle: this.dateStyle,
|
|
146
149
|
timeZone: 'UTC',
|
|
147
150
|
}).format(at);
|
|
@@ -176,14 +179,20 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
176
179
|
: 'Enter dates as YYYY-MM-DD, separated by commas.'));
|
|
177
180
|
}
|
|
178
181
|
if (this.min !== '' && held.some((one) => one < this.min)) {
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
return [
|
|
183
|
+
'rangeUnderflow',
|
|
184
|
+
fillTemplate(this.rangeUnderflowMessage || 'Choose a date on or after {min}.', {
|
|
185
|
+
min: this.written(this.min),
|
|
186
|
+
}),
|
|
187
|
+
];
|
|
182
188
|
}
|
|
183
189
|
if (this.max !== '' && held.some((one) => one > this.max)) {
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
|
|
190
|
+
return [
|
|
191
|
+
'rangeOverflow',
|
|
192
|
+
fillTemplate(this.rangeOverflowMessage || 'Choose a date on or before {max}.', {
|
|
193
|
+
max: this.written(this.max),
|
|
194
|
+
}),
|
|
195
|
+
];
|
|
187
196
|
}
|
|
188
197
|
const why = held.map((one) => {
|
|
189
198
|
const date = asDate(one);
|
|
@@ -193,7 +202,10 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
193
202
|
return this.unavailableMessage || 'Choose a date that is available.';
|
|
194
203
|
}
|
|
195
204
|
if (why.includes('step')) {
|
|
196
|
-
return
|
|
205
|
+
return [
|
|
206
|
+
'stepMismatch',
|
|
207
|
+
this.stepMismatchMessage || 'Choose one of the dates the calendar offers.',
|
|
208
|
+
];
|
|
197
209
|
}
|
|
198
210
|
if (this.mode === 'range' && held.length > 2) {
|
|
199
211
|
return this.rangeLengthMessage || 'A range is two dates.';
|
|
@@ -206,7 +218,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
206
218
|
exportparts="cell: picker-cell, cell-range-end: picker-cell-range-end,
|
|
207
219
|
cell-range-middle: picker-cell-range-middle, cell-range-start: picker-cell-range-start,
|
|
208
220
|
day: picker-day, day-disabled: picker-day-disabled, day-outside: picker-day-outside,
|
|
209
|
-
day-selected: picker-day-selected, day-today: picker-day-today, grid: picker-grid,
|
|
221
|
+
day-selected: picker-day-selected, day-today: picker-day-today, feedback: picker-feedback, grid: picker-grid,
|
|
210
222
|
header: picker-header, heading: picker-heading, heading-button: picker-heading-button,
|
|
211
223
|
month: picker-month, months: picker-months, next: picker-next,
|
|
212
224
|
next-mark: picker-next-mark, period: picker-period, period-current: picker-period-current,
|
|
@@ -222,7 +234,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
222
234
|
disable-days=${this.disableDays || nothing}
|
|
223
235
|
first-day-of-week=${this.firstDayOfWeek ?? nothing}
|
|
224
236
|
label=${this.calendarLabel}
|
|
225
|
-
locale=${this.
|
|
237
|
+
locale=${this.language || nothing}
|
|
226
238
|
max=${this.max || nothing}
|
|
227
239
|
max-view=${this.maxView ?? nothing}
|
|
228
240
|
min=${this.min || nothing}
|
|
@@ -327,7 +339,9 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
327
339
|
popover="manual"
|
|
328
340
|
?hidden=${!this.open}
|
|
329
341
|
>
|
|
342
|
+
<slot name="panel-header"></slot>
|
|
330
343
|
${this.renderPicker()}
|
|
344
|
+
<slot name="panel-footer"></slot>
|
|
331
345
|
</div>
|
|
332
346
|
${this.renderHint()}${this.renderFeedback()}`;
|
|
333
347
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CalendarView, HelixFormElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
-
declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & typeof HelixFormElement;
|
|
3
|
+
declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFeedbackInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & typeof HelixFormElement;
|
|
4
4
|
/**
|
|
5
5
|
* @summary A month calendar for choosing one or more dates.
|
|
6
6
|
*
|
|
@@ -60,6 +60,7 @@ declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fu
|
|
|
60
60
|
* @csspart day-outside - A day from a neighboring month, filling the grid out, beside `day`.
|
|
61
61
|
* @csspart day-selected - The chosen day, or either end of a chosen range, beside `day`.
|
|
62
62
|
* @csspart day-today - Today, beside `day`.
|
|
63
|
+
* @csspart feedback - The message under the calendar, while `feedback` is set.
|
|
63
64
|
* @csspart grid - The grid of days.
|
|
64
65
|
* @csspart header - The month name and its controls.
|
|
65
66
|
* @csspart heading - The month and year being shown.
|
|
@@ -80,6 +81,8 @@ declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fu
|
|
|
80
81
|
* @csspart weekday - A column header naming a day of the week.
|
|
81
82
|
*
|
|
82
83
|
* @cssproperty --date-picker-column-count - How many month columns are drawn, capped at two. `--date-picker-columns` overrides it.
|
|
84
|
+
*
|
|
85
|
+
* @cssstate invalid - While `invalid` is set or `feedback` says what is wrong.
|
|
83
86
|
*/
|
|
84
87
|
export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_base {
|
|
85
88
|
/**
|
|
@@ -123,10 +126,6 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
123
126
|
* (Firefox does not), and is Sunday otherwise.
|
|
124
127
|
*/
|
|
125
128
|
firstDayOfWeek?: number;
|
|
126
|
-
/**
|
|
127
|
-
* Whether the current selection fails validation.
|
|
128
|
-
*/
|
|
129
|
-
invalid: boolean;
|
|
130
129
|
/**
|
|
131
130
|
* A rule for which dates cannot be chosen: a function given the date as
|
|
132
131
|
* `YYYY-MM-DD` that returns `true` to bar it.
|
|
@@ -142,11 +141,14 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
142
141
|
*/
|
|
143
142
|
label: string;
|
|
144
143
|
/**
|
|
145
|
-
* Locale for month and day names.
|
|
144
|
+
* Locale for month and day names, and the day a week starts on.
|
|
146
145
|
*
|
|
147
|
-
* Absent
|
|
146
|
+
* Absent is the page's: the `lang` of the nearest element with one, as
|
|
147
|
+
* Shoelace and Web Awesome read it, then the runtime's own.
|
|
148
148
|
*/
|
|
149
149
|
locale: string;
|
|
150
|
+
/** The locale the words are written in: `locale`, or the page's `lang`. */
|
|
151
|
+
private get language();
|
|
150
152
|
/**
|
|
151
153
|
* Latest selectable date, as `YYYY-MM-DD`.
|
|
152
154
|
*/
|
|
@@ -267,8 +269,11 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
267
269
|
*
|
|
268
270
|
* Each candidate is tested in turn rather than the first one winning
|
|
269
271
|
* outright. Where the last date focused is in some other month, the selected
|
|
270
|
-
* date still holds the stop,
|
|
271
|
-
*
|
|
272
|
+
* date still holds the stop, then today, as the APG date picker and React
|
|
273
|
+
* Aria's calendar put it, and only with none of them in view does it fall
|
|
274
|
+
* to the first of the month. Measured before today was a candidate: a
|
|
275
|
+
* calendar with no value opened on October 5 with its stop on "Thursday,
|
|
276
|
+
* October 1".
|
|
272
277
|
*/
|
|
273
278
|
private get anchor();
|
|
274
279
|
/** Six weeks of dates, so a grid does not change height between months. */
|
|
@@ -4,7 +4,7 @@ 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 { addDays, addMonths, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, HelixNavigateEvent, hostAria, inlineStep, commaList as list, localToday, MixinControllerValue, monthOf, monthOut, periodCells, periodKey, reportValues, requestChange, sameMonth, weekStartOf, YEARS_SHOWN, yearOut, yearPageOf, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { addDays, addMonths, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, HelixNavigateEvent, hostAria, inlineStep, commaList as list, localeOf, localToday, MixinControllerValue, MixinPickerFeedback, monthOf, monthOut, periodCells, periodKey, reportValues, requestChange, sameMonth, weekStartOf, YEARS_SHOWN, yearOut, yearPageOf, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretLeft, caretRight } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -21,13 +21,13 @@ const KEYS = new Set([
|
|
|
21
21
|
'PageUp',
|
|
22
22
|
' ',
|
|
23
23
|
]);
|
|
24
|
-
|
|
24
|
+
const firstOf = (year, month) => addMonths(asDate('2000-01-01'), (year - 2000) * 12 + month);
|
|
25
|
+
let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerFeedback(MixinControllerValue(HelixFormElement)) {
|
|
25
26
|
constructor() {
|
|
26
27
|
super(...arguments);
|
|
27
28
|
this.defaultMonth = '';
|
|
28
29
|
this.disableDates = '';
|
|
29
30
|
this.disableDays = '';
|
|
30
|
-
this.invalid = false;
|
|
31
31
|
this.label = 'Date Picker';
|
|
32
32
|
this.locale = '';
|
|
33
33
|
this.max = '';
|
|
@@ -104,6 +104,9 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
104
104
|
this.view = 'day';
|
|
105
105
|
this.yearViewLabel = '{heading}. Choose a year';
|
|
106
106
|
}
|
|
107
|
+
get language() {
|
|
108
|
+
return localeOf(this, this.locale);
|
|
109
|
+
}
|
|
107
110
|
get month() {
|
|
108
111
|
return this.monthState ?? (this.defaultMonth || fromDate(this.derivedMonth).slice(0, 7));
|
|
109
112
|
}
|
|
@@ -119,7 +122,8 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
119
122
|
if (this.firstDayOfWeek !== undefined && Number.isFinite(this.firstDayOfWeek)) {
|
|
120
123
|
return ((Math.floor(this.firstDayOfWeek) % 7) + 7) % 7;
|
|
121
124
|
}
|
|
122
|
-
|
|
125
|
+
const language = this.language;
|
|
126
|
+
return language === '' ? 0 : weekStartOf(language);
|
|
123
127
|
}
|
|
124
128
|
get range() {
|
|
125
129
|
const dates = this.selected;
|
|
@@ -139,17 +143,21 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
139
143
|
get shown() {
|
|
140
144
|
const explicit = /^(\d{4})-(\d{2})$/.exec(this.monthState ?? this.defaultMonth);
|
|
141
145
|
if (explicit) {
|
|
142
|
-
return
|
|
146
|
+
return firstOf(Number(explicit[1]), Number(explicit[2]) - 1);
|
|
143
147
|
}
|
|
144
148
|
return this.derivedMonth;
|
|
145
149
|
}
|
|
146
150
|
get derivedMonth() {
|
|
147
|
-
const from = asDate(this.selected[0] ?? '') ?? new Date();
|
|
148
|
-
return
|
|
151
|
+
const from = asDate(this.selected[0] ?? '') ?? asDate(localToday()) ?? new Date();
|
|
152
|
+
return firstOf(from.getUTCFullYear(), from.getUTCMonth());
|
|
149
153
|
}
|
|
150
154
|
get anchor() {
|
|
151
155
|
const shown = this.shown;
|
|
152
|
-
for (const candidate of [
|
|
156
|
+
for (const candidate of [
|
|
157
|
+
asDate(this.focused),
|
|
158
|
+
asDate(this.selected[0] ?? ''),
|
|
159
|
+
asDate(localToday()),
|
|
160
|
+
]) {
|
|
153
161
|
if (candidate && sameMonth(candidate, shown)) {
|
|
154
162
|
return candidate;
|
|
155
163
|
}
|
|
@@ -268,11 +276,16 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
268
276
|
return;
|
|
269
277
|
}
|
|
270
278
|
this.pageYear = at;
|
|
271
|
-
|
|
279
|
+
const month = this.shown.getUTCMonth();
|
|
280
|
+
const open = Array.from({ length: 12 }, (_, index) => index).filter((index) => !this.monthOut(firstOf(at, index)));
|
|
281
|
+
this.periodFocus = open.includes(month)
|
|
282
|
+
? month
|
|
283
|
+
: ([...open].sort((left, right) => Math.abs(left - month) - Math.abs(right - month))[0] ??
|
|
284
|
+
month);
|
|
272
285
|
this.zoom('month');
|
|
273
286
|
return;
|
|
274
287
|
}
|
|
275
|
-
const first =
|
|
288
|
+
const first = firstOf(this.periodYear, at);
|
|
276
289
|
if (this.monthOut(first)) {
|
|
277
290
|
return;
|
|
278
291
|
}
|
|
@@ -408,7 +421,6 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
408
421
|
role: 'group',
|
|
409
422
|
});
|
|
410
423
|
this.internals.ariaDisabled = this.isDisabled ? 'true' : null;
|
|
411
|
-
this.internals.ariaInvalid = this.invalid ? 'true' : null;
|
|
412
424
|
this.report();
|
|
413
425
|
}
|
|
414
426
|
updated(changed) {
|
|
@@ -426,14 +438,15 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
426
438
|
return Math.max(1, Math.floor(this.months) || 1);
|
|
427
439
|
}
|
|
428
440
|
get formats() {
|
|
429
|
-
|
|
441
|
+
const language = this.language;
|
|
442
|
+
if (this.cachedFormats?.locale === language) {
|
|
430
443
|
return this.cachedFormats;
|
|
431
444
|
}
|
|
432
|
-
const locale =
|
|
445
|
+
const locale = language || undefined;
|
|
433
446
|
const built = {
|
|
434
447
|
full: new Intl.DateTimeFormat(locale, { dateStyle: 'full', timeZone: 'UTC' }),
|
|
435
448
|
heading: new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC', year: 'numeric' }),
|
|
436
|
-
locale:
|
|
449
|
+
locale: language,
|
|
437
450
|
long: new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' }),
|
|
438
451
|
monthName: new Intl.DateTimeFormat(locale, { month: 'short', timeZone: 'UTC' }),
|
|
439
452
|
weekday: new Intl.DateTimeFormat(locale, { timeZone: 'UTC', weekday: 'short' }),
|
|
@@ -558,8 +571,8 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
558
571
|
const years = this.view === 'year';
|
|
559
572
|
const page = years ? yearPageOf(this.periodYear) : this.periodYear;
|
|
560
573
|
const heading = years
|
|
561
|
-
? `${yearName.format(
|
|
562
|
-
: yearName.format(
|
|
574
|
+
? `${yearName.format(firstOf(page, 0))} – ${yearName.format(firstOf(page + YEARS_SHOWN - 1, 0))}`
|
|
575
|
+
: yearName.format(firstOf(page, 0));
|
|
563
576
|
const stop = this.periodStop;
|
|
564
577
|
const cells = periodCells({
|
|
565
578
|
max: this.max,
|
|
@@ -613,14 +626,15 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
613
626
|
render() {
|
|
614
627
|
if (this.view !== 'day') {
|
|
615
628
|
return html `<div part="months" style="--date-picker-column-count: 1">
|
|
616
|
-
|
|
617
|
-
|
|
629
|
+
${this.renderPeriods()}
|
|
630
|
+
</div>
|
|
631
|
+
${this.renderPickerFeedback()}`;
|
|
618
632
|
}
|
|
619
633
|
const shown = this.shown;
|
|
620
634
|
const count = this.monthCount;
|
|
621
635
|
return html `<div part="months" style="--date-picker-column-count: ${Math.min(count, 2)}">
|
|
622
636
|
${Array.from({ length: count }, (_, index) => this.renderMonth(addMonths(shown, index), index))}
|
|
623
|
-
</div
|
|
637
|
+
</div>${this.renderPickerFeedback()}`;
|
|
624
638
|
}
|
|
625
639
|
get valueAsDate() {
|
|
626
640
|
return asDate(this.value);
|
|
@@ -653,9 +667,6 @@ __decorate([
|
|
|
653
667
|
__decorate([
|
|
654
668
|
property({ attribute: 'first-day-of-week', type: Number })
|
|
655
669
|
], HelixHeadlessDatePicker.prototype, "firstDayOfWeek", void 0);
|
|
656
|
-
__decorate([
|
|
657
|
-
property({ reflect: true, type: Boolean })
|
|
658
|
-
], HelixHeadlessDatePicker.prototype, "invalid", void 0);
|
|
659
670
|
__decorate([
|
|
660
671
|
property({ attribute: false })
|
|
661
672
|
], HelixHeadlessDatePicker.prototype, "isDateUnavailable", void 0);
|