snice 4.8.0 → 4.9.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/adapters/react/camera-annotate.d.ts +27 -0
- package/adapters/react/camera-annotate.d.ts.map +1 -0
- package/adapters/react/camera-annotate.js +24 -0
- package/adapters/react/camera-annotate.js.map +1 -0
- package/adapters/react/camera-annotate.tsx +35 -0
- package/adapters/react/candlestick.d.ts +34 -0
- package/adapters/react/candlestick.d.ts.map +1 -0
- package/adapters/react/candlestick.js +24 -0
- package/adapters/react/candlestick.js.map +1 -0
- package/adapters/react/candlestick.tsx +42 -0
- package/adapters/react/components.d.ts +14 -0
- package/adapters/react/components.d.ts.map +1 -1
- package/adapters/react/components.js +7 -0
- package/adapters/react/components.js.map +1 -1
- package/adapters/react/components.ts +14 -0
- package/adapters/react/funnel.d.ts +31 -0
- package/adapters/react/funnel.d.ts.map +1 -0
- package/adapters/react/funnel.js +24 -0
- package/adapters/react/funnel.js.map +1 -0
- package/adapters/react/funnel.tsx +39 -0
- package/adapters/react/network-graph.d.ts +32 -0
- package/adapters/react/network-graph.d.ts.map +1 -0
- package/adapters/react/network-graph.js +24 -0
- package/adapters/react/network-graph.js.map +1 -0
- package/adapters/react/network-graph.tsx +40 -0
- package/adapters/react/sankey.d.ts +31 -0
- package/adapters/react/sankey.d.ts.map +1 -0
- package/adapters/react/sankey.js +24 -0
- package/adapters/react/sankey.js.map +1 -0
- package/adapters/react/sankey.tsx +39 -0
- package/adapters/react/time-range-picker.d.ts +33 -0
- package/adapters/react/time-range-picker.d.ts.map +1 -0
- package/adapters/react/time-range-picker.js +24 -0
- package/adapters/react/time-range-picker.js.map +1 -0
- package/adapters/react/time-range-picker.tsx +41 -0
- package/adapters/react/treemap.d.ts +30 -0
- package/adapters/react/treemap.d.ts.map +1 -0
- package/adapters/react/treemap.js +24 -0
- package/adapters/react/treemap.js.map +1 -0
- package/adapters/react/treemap.tsx +38 -0
- package/adapters/react/virtual-scroller.d.ts +1 -0
- package/adapters/react/virtual-scroller.d.ts.map +1 -1
- package/adapters/react/virtual-scroller.js +1 -1
- package/adapters/react/virtual-scroller.js.map +1 -1
- package/adapters/react/virtual-scroller.tsx +2 -1
- package/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/accordion/snice-accordion.min.js +1 -1
- package/dist/cdn/alert/snice-alert.js +1 -1
- package/dist/cdn/alert/snice-alert.min.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
- package/dist/cdn/avatar/snice-avatar.js +1 -1
- package/dist/cdn/avatar/snice-avatar.min.js +1 -1
- package/dist/cdn/badge/snice-badge.js +1 -1
- package/dist/cdn/badge/snice-badge.min.js +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/banner/snice-banner.min.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +2 -2
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +13 -13
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js.map +1 -1
- package/dist/cdn/button/snice-button.js +1 -1
- package/dist/cdn/button/snice-button.min.js +1 -1
- package/dist/cdn/calendar/snice-calendar.js +1 -1
- package/dist/cdn/calendar/snice-calendar.min.js +1 -1
- package/dist/cdn/camera/snice-camera.js +1 -1
- package/dist/cdn/camera/snice-camera.min.js +1 -1
- package/dist/cdn/camera-annotate/README.md +27 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +730 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.js.map +1 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +144 -0
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js.map +1 -0
- package/dist/cdn/candlestick/README.md +27 -0
- package/dist/cdn/candlestick/snice-candlestick.js +717 -0
- package/dist/cdn/candlestick/snice-candlestick.js.map +1 -0
- package/dist/cdn/candlestick/snice-candlestick.min.js +22 -0
- package/dist/cdn/candlestick/snice-candlestick.min.js.map +1 -0
- package/dist/cdn/card/snice-card.js +1 -1
- package/dist/cdn/card/snice-card.min.js +1 -1
- package/dist/cdn/carousel/snice-carousel.js +1 -1
- package/dist/cdn/carousel/snice-carousel.min.js +1 -1
- package/dist/cdn/chart/snice-chart.js +1 -1
- package/dist/cdn/chart/snice-chart.min.js +1 -1
- package/dist/cdn/chat/snice-chat.js +1 -1
- package/dist/cdn/chat/snice-chat.min.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
- package/dist/cdn/chip/snice-chip.js +1 -1
- package/dist/cdn/chip/snice-chip.min.js +1 -1
- package/dist/cdn/code-block/snice-code-block.js +1 -1
- package/dist/cdn/code-block/snice-code-block.min.js +1 -1
- package/dist/cdn/color-display/snice-color-display.js +1 -1
- package/dist/cdn/color-display/snice-color-display.min.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.min.js +1 -1
- package/dist/cdn/divider/snice-divider.js +1 -1
- package/dist/cdn/divider/snice-divider.min.js +1 -1
- package/dist/cdn/doc/snice-doc.js +1 -1
- package/dist/cdn/doc/snice-doc.min.js +1 -1
- package/dist/cdn/draw/snice-draw.js +1 -1
- package/dist/cdn/draw/snice-draw.min.js +1 -1
- package/dist/cdn/drawer/snice-drawer.js +1 -1
- package/dist/cdn/drawer/snice-drawer.min.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
- package/dist/cdn/funnel/README.md +27 -0
- package/dist/cdn/funnel/snice-funnel.js +424 -0
- package/dist/cdn/funnel/snice-funnel.js.map +1 -0
- package/dist/cdn/funnel/snice-funnel.min.js +20 -0
- package/dist/cdn/funnel/snice-funnel.min.js.map +1 -0
- package/dist/cdn/gauge/snice-gauge.js +1 -1
- package/dist/cdn/gauge/snice-gauge.min.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
- package/dist/cdn/image/snice-image.js +1 -1
- package/dist/cdn/image/snice-image.min.js +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/input/snice-input.min.js +1 -1
- package/dist/cdn/kanban/snice-kanban.js +1 -1
- package/dist/cdn/kanban/snice-kanban.min.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js +1 -1
- package/dist/cdn/kpi/snice-kpi.min.js +1 -1
- package/dist/cdn/layout/README.md +2 -2
- package/dist/cdn/layout/snice-layout.js +23 -6
- package/dist/cdn/layout/snice-layout.js.map +1 -1
- package/dist/cdn/layout/snice-layout.min.js +2 -2
- package/dist/cdn/layout/snice-layout.min.js.map +1 -1
- package/dist/cdn/link/snice-link.js +1 -1
- package/dist/cdn/link/snice-link.min.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
- package/dist/cdn/list/README.md +6 -2
- package/dist/cdn/list/snice-list.js +87 -10
- package/dist/cdn/list/snice-list.js.map +1 -1
- package/dist/cdn/list/snice-list.min.js +20 -6
- package/dist/cdn/list/snice-list.min.js.map +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/location/snice-location.min.js +1 -1
- package/dist/cdn/login/snice-login.js +1 -1
- package/dist/cdn/login/snice-login.min.js +1 -1
- package/dist/cdn/masonry/snice-masonry.js +1 -1
- package/dist/cdn/masonry/snice-masonry.min.js +1 -1
- package/dist/cdn/menu/snice-menu.js +1 -1
- package/dist/cdn/menu/snice-menu.min.js +1 -1
- package/dist/cdn/modal/snice-modal.js +1 -1
- package/dist/cdn/modal/snice-modal.min.js +1 -1
- package/dist/cdn/music-player/snice-music-player.js +1 -1
- package/dist/cdn/music-player/snice-music-player.min.js +1 -1
- package/dist/cdn/nav/README.md +2 -2
- package/dist/cdn/nav/snice-nav.js +23 -6
- package/dist/cdn/nav/snice-nav.js.map +1 -1
- package/dist/cdn/nav/snice-nav.min.js +2 -2
- package/dist/cdn/nav/snice-nav.min.js.map +1 -1
- package/dist/cdn/network-graph/README.md +27 -0
- package/dist/cdn/network-graph/snice-network-graph.js +788 -0
- package/dist/cdn/network-graph/snice-network-graph.js.map +1 -0
- package/dist/cdn/network-graph/snice-network-graph.min.js +13 -0
- package/dist/cdn/network-graph/snice-network-graph.min.js.map +1 -0
- package/dist/cdn/pagination/README.md +2 -2
- package/dist/cdn/pagination/snice-pagination.js +13 -13
- package/dist/cdn/pagination/snice-pagination.js.map +1 -1
- package/dist/cdn/pagination/snice-pagination.min.js +14 -14
- package/dist/cdn/pagination/snice-pagination.min.js.map +1 -1
- package/dist/cdn/paint/snice-paint.js +1 -1
- package/dist/cdn/paint/snice-paint.min.js +1 -1
- package/dist/cdn/progress/snice-progress.js +1 -1
- package/dist/cdn/progress/snice-progress.min.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
- package/dist/cdn/radio/snice-radio.js +1 -1
- package/dist/cdn/radio/snice-radio.min.js +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.js +3 -3
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js +3 -3
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +3 -3
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js +3 -3
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/README.md +27 -0
- package/dist/cdn/sankey/snice-sankey.js +679 -0
- package/dist/cdn/sankey/snice-sankey.js.map +1 -0
- package/dist/cdn/sankey/snice-sankey.min.js +21 -0
- package/dist/cdn/sankey/snice-sankey.min.js.map +1 -0
- package/dist/cdn/select/snice-select.js +1 -1
- package/dist/cdn/select/snice-select.min.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
- package/dist/cdn/slider/snice-slider.js +1 -1
- package/dist/cdn/slider/snice-slider.min.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
- package/dist/cdn/spinner/snice-spinner.js +1 -1
- package/dist/cdn/spinner/snice-spinner.min.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
- package/dist/cdn/stepper/README.md +6 -2
- package/dist/cdn/stepper/snice-stepper.js +77 -10
- package/dist/cdn/stepper/snice-stepper.js.map +1 -1
- package/dist/cdn/stepper/snice-stepper.min.js +13 -9
- package/dist/cdn/stepper/snice-stepper.min.js.map +1 -1
- package/dist/cdn/switch/snice-switch.js +1 -1
- package/dist/cdn/switch/snice-switch.min.js +1 -1
- package/dist/cdn/table/snice-table.js +1 -1
- package/dist/cdn/table/snice-table.min.js +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tabs/snice-tabs.min.js +1 -1
- package/dist/cdn/terminal/snice-terminal.js +1 -1
- package/dist/cdn/terminal/snice-terminal.min.js +1 -1
- package/dist/cdn/textarea/snice-textarea.js +1 -1
- package/dist/cdn/textarea/snice-textarea.min.js +1 -1
- package/dist/cdn/time-range-picker/README.md +27 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +635 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.js.map +1 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +34 -0
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js.map +1 -0
- package/dist/cdn/timeline/snice-timeline.js +1 -1
- package/dist/cdn/timeline/snice-timeline.min.js +1 -1
- package/dist/cdn/timer/snice-timer.js +1 -1
- package/dist/cdn/timer/snice-timer.min.js +1 -1
- package/dist/cdn/toast/snice-toast.js +1 -1
- package/dist/cdn/toast/snice-toast.min.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
- package/dist/cdn/tree/README.md +5 -1
- package/dist/cdn/tree/snice-tree.js +4 -8
- package/dist/cdn/tree/snice-tree.js.map +1 -1
- package/dist/cdn/tree/snice-tree.min.js +5 -5
- package/dist/cdn/tree/snice-tree.min.js.map +1 -1
- package/dist/cdn/treemap/README.md +27 -0
- package/dist/cdn/treemap/snice-treemap.js +522 -0
- package/dist/cdn/treemap/snice-treemap.js.map +1 -0
- package/dist/cdn/treemap/snice-treemap.min.js +14 -0
- package/dist/cdn/treemap/snice-treemap.min.js.map +1 -0
- package/dist/cdn/virtual-scroller/README.md +2 -2
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +47 -16
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js.map +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +9 -9
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js.map +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/camera-annotate/snice-camera-annotate.d.ts +68 -0
- package/dist/components/camera-annotate/snice-camera-annotate.js +663 -0
- package/dist/components/camera-annotate/snice-camera-annotate.js.map +1 -0
- package/dist/components/camera-annotate/snice-camera-annotate.types.d.ts +50 -0
- package/dist/components/candlestick/snice-candlestick.d.ts +78 -0
- package/dist/components/candlestick/snice-candlestick.js +650 -0
- package/dist/components/candlestick/snice-candlestick.js.map +1 -0
- package/dist/components/candlestick/snice-candlestick.types.d.ts +40 -0
- package/dist/components/funnel/snice-funnel.d.ts +37 -0
- package/dist/components/funnel/snice-funnel.js +357 -0
- package/dist/components/funnel/snice-funnel.js.map +1 -0
- package/dist/components/funnel/snice-funnel.types.d.ts +28 -0
- package/dist/components/list/snice-list-item.d.ts +2 -0
- package/dist/components/list/snice-list-item.js +20 -2
- package/dist/components/list/snice-list-item.js.map +1 -1
- package/dist/components/nav/snice-nav.js +22 -5
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/network-graph/snice-network-graph.d.ts +80 -0
- package/dist/components/network-graph/snice-network-graph.js +721 -0
- package/dist/components/network-graph/snice-network-graph.js.map +1 -0
- package/dist/components/network-graph/snice-network-graph.types.d.ts +49 -0
- package/dist/components/pagination/snice-pagination.js +12 -12
- package/dist/components/sankey/snice-sankey.d.ts +46 -0
- package/dist/components/sankey/snice-sankey.js +612 -0
- package/dist/components/sankey/snice-sankey.js.map +1 -0
- package/dist/components/sankey/snice-sankey.types.d.ts +59 -0
- package/dist/components/stepper/snice-stepper.js +9 -3
- package/dist/components/stepper/snice-stepper.js.map +1 -1
- package/dist/components/time-range-picker/snice-time-range-picker.d.ts +67 -0
- package/dist/components/time-range-picker/snice-time-range-picker.js +568 -0
- package/dist/components/time-range-picker/snice-time-range-picker.js.map +1 -0
- package/dist/components/time-range-picker/snice-time-range-picker.types.d.ts +39 -0
- package/dist/components/treemap/snice-treemap.d.ts +49 -0
- package/dist/components/treemap/snice-treemap.js +455 -0
- package/dist/components/treemap/snice-treemap.js.map +1 -0
- package/dist/components/treemap/snice-treemap.types.d.ts +42 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.d.ts +5 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js +47 -16
- package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/components/camera-annotate.md +82 -0
- package/docs/ai/components/candlestick.md +79 -0
- package/docs/ai/components/funnel.md +86 -0
- package/docs/ai/components/network-graph.md +87 -0
- package/docs/ai/components/sankey.md +63 -0
- package/docs/ai/components/time-range-picker.md +78 -0
- package/docs/ai/components/treemap.md +78 -0
- package/docs/components/camera-annotate.md +186 -0
- package/docs/components/candlestick.md +196 -0
- package/docs/components/funnel.md +191 -0
- package/docs/components/network-graph.md +215 -0
- package/docs/components/sankey.md +201 -0
- package/docs/components/time-range-picker.md +213 -0
- package/docs/components/treemap.md +198 -0
- package/package.json +1 -1
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* snice v4.8.0
|
|
3
|
+
* Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
|
|
4
|
+
* (c) 2024
|
|
5
|
+
* Released under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
if(typeof globalThis.Snice==="undefined"){console.warn("[snice] snice-runtime.min.js must be loaded before snice-time-range-picker.min.js");}
|
|
8
|
+
var SniceTimeRangePicker = (function (exports, snice) {
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
/******************************************************************************
|
|
12
|
+
Copyright (c) Microsoft Corporation.
|
|
13
|
+
|
|
14
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
15
|
+
purpose with or without fee is hereby granted.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
18
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
22
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
24
|
+
***************************************************************************** */
|
|
25
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
29
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
30
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
31
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
32
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
33
|
+
var _, done = false;
|
|
34
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
35
|
+
var context = {};
|
|
36
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
37
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
38
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
39
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
40
|
+
if (kind === "accessor") {
|
|
41
|
+
if (result === void 0) continue;
|
|
42
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
43
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
44
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
45
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
46
|
+
}
|
|
47
|
+
else if (_ = accept(result)) {
|
|
48
|
+
if (kind === "field") initializers.unshift(_);
|
|
49
|
+
else descriptor[key] = _;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
53
|
+
done = true;
|
|
54
|
+
}
|
|
55
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
56
|
+
var useValue = arguments.length > 2;
|
|
57
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
58
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
59
|
+
}
|
|
60
|
+
return useValue ? value : void 0;
|
|
61
|
+
}
|
|
62
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
63
|
+
var e = new Error(message);
|
|
64
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
var cssContent = ":host{display:block;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);contain:layout style paint;width:100%;--trp-bg:var(--snice-color-background, rgb(255 255 255));--trp-text:var(--snice-color-text, rgb(23 23 23));--trp-text-secondary:var(--snice-color-text-secondary, rgb(82 82 82));--trp-border:var(--snice-color-border, rgb(226 226 226));--trp-primary:var(--snice-color-primary, rgb(37 99 235));--trp-primary-hover:var(--snice-color-primary-hover, rgb(29 78 216));--trp-slot-hover:var(--snice-color-background-element, rgb(252 251 249));--trp-disabled-bg:var(--snice-color-background-element, rgb(252 251 249));--trp-disabled-text:var(--snice-color-text-tertiary, rgb(115 115 115));--trp-selected-bg:var(--snice-color-primary, rgb(37 99 235));--trp-selected-text:var(--snice-color-text-inverse, rgb(250 250 250))}:host([disabled]){opacity:.6;pointer-events:none}:host([readonly]) .slot:not(.slot--selected){cursor:default}.wrapper{border:1px solid var(--trp-border);border-radius:var(--snice-border-radius-lg,.5rem);overflow:hidden;background:var(--trp-bg)}.header{display:flex;align-items:center;justify-content:space-between;padding:var(--snice-spacing-sm,.75rem) var(--snice-spacing-md,1rem);border-bottom:1px solid var(--trp-border);background:var(--trp-bg);min-height:2.5rem}.header-label{font-size:var(--snice-font-size-md, 1rem);font-weight:var(--snice-font-weight-medium,500);color:var(--trp-text)}.header-value{font-size:var(--snice-font-size-md, 1rem);color:var(--trp-primary);font-weight:var(--snice-font-weight-semibold,600)}.header-value--empty{color:var(--trp-text-secondary);font-weight:var(--snice-font-weight-medium,500);font-style:italic}.slots-container{max-height:25rem;overflow-y:auto;overscroll-behavior:contain}.slots-container::-webkit-scrollbar{width:6px}.slots-container::-webkit-scrollbar-track{background:0 0}.slots-container::-webkit-scrollbar-thumb{background:var(--trp-border);border-radius:3px}.slot{display:flex;align-items:center;padding:var(--snice-spacing-xs,.5rem) var(--snice-spacing-md,1rem);border-bottom:1px solid var(--trp-border);cursor:pointer;transition:background-color var(--snice-transition-fast, 150ms) ease;user-select:none;-webkit-user-select:none;position:relative;min-height:2.25rem}.slot:last-child{border-bottom:none}.slot:hover:not(.slot--disabled):not(.slot--selected){background:var(--trp-slot-hover)}.slot--selected{background:var(--trp-selected-bg);color:var(--trp-selected-text)}.slot--selected:hover{background:var(--trp-primary-hover)}.slot--disabled{background:var(--trp-disabled-bg);color:var(--trp-disabled-text);cursor:not-allowed;text-decoration:line-through;opacity:.65}.slot--dragging{background:color-mix(in srgb,var(--trp-selected-bg) 80%,transparent);color:var(--trp-selected-text)}.slot--range-start{border-top-left-radius:4px;border-top-right-radius:4px}.slot--range-end{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.slot-time{font-size:var(--snice-font-size-md, 1rem);font-weight:var(--snice-font-weight-medium,500);min-width:5rem;font-variant-numeric:tabular-nums}.slot-separator{flex:1;height:1px;background:var(--trp-border);margin:0 var(--snice-spacing-sm,.75rem);opacity:.5}.slot--dragging .slot-separator,.slot--selected .slot-separator{background:var(--trp-selected-text);opacity:.3}.slot--hour-start{border-top:2px solid var(--trp-border)}.slot--hour-start.slot--dragging,.slot--hour-start.slot--selected{border-top-color:color-mix(in srgb,var(--trp-selected-text) 30%,transparent)}.slot:focus-visible{outline:var(--snice-focus-ring-width,2px) solid var(--snice-focus-ring-color,rgb(59 130 246 / .5));outline-offset:-2px;z-index:1}@media (max-width:480px){.slot{padding:var(--snice-spacing-2xs,.25rem) var(--snice-spacing-sm,.75rem);min-height:2rem}.slot-time{font-size:var(--snice-font-size-sm, .875rem);min-width:4rem}}";
|
|
68
|
+
|
|
69
|
+
let SniceTimeRangePicker = (() => {
|
|
70
|
+
let _classDecorators = [snice.element('snice-time-range-picker')];
|
|
71
|
+
let _classDescriptor;
|
|
72
|
+
let _classExtraInitializers = [];
|
|
73
|
+
let _classThis;
|
|
74
|
+
let _classSuper = HTMLElement;
|
|
75
|
+
let _instanceExtraInitializers = [];
|
|
76
|
+
let _granularity_decorators;
|
|
77
|
+
let _granularity_initializers = [];
|
|
78
|
+
let _granularity_extraInitializers = [];
|
|
79
|
+
let _startTime_decorators;
|
|
80
|
+
let _startTime_initializers = [];
|
|
81
|
+
let _startTime_extraInitializers = [];
|
|
82
|
+
let _endTime_decorators;
|
|
83
|
+
let _endTime_initializers = [];
|
|
84
|
+
let _endTime_extraInitializers = [];
|
|
85
|
+
let _value_decorators;
|
|
86
|
+
let _value_initializers = [];
|
|
87
|
+
let _value_extraInitializers = [];
|
|
88
|
+
let _disabledRanges_decorators;
|
|
89
|
+
let _disabledRanges_initializers = [];
|
|
90
|
+
let _disabledRanges_extraInitializers = [];
|
|
91
|
+
let _format_decorators;
|
|
92
|
+
let _format_initializers = [];
|
|
93
|
+
let _format_extraInitializers = [];
|
|
94
|
+
let _multiple_decorators;
|
|
95
|
+
let _multiple_initializers = [];
|
|
96
|
+
let _multiple_extraInitializers = [];
|
|
97
|
+
let _readonly_decorators;
|
|
98
|
+
let _readonly_initializers = [];
|
|
99
|
+
let _readonly_extraInitializers = [];
|
|
100
|
+
let _disabled_decorators;
|
|
101
|
+
let _disabled_initializers = [];
|
|
102
|
+
let _disabled_extraInitializers = [];
|
|
103
|
+
let _slotsContainer_decorators;
|
|
104
|
+
let _slotsContainer_initializers = [];
|
|
105
|
+
let _slotsContainer_extraInitializers = [];
|
|
106
|
+
let _componentStyles_decorators;
|
|
107
|
+
let _renderContent_decorators;
|
|
108
|
+
let _init_decorators;
|
|
109
|
+
let _cleanup_decorators;
|
|
110
|
+
let _handleValueChange_decorators;
|
|
111
|
+
let _handleDisabledRangesChange_decorators;
|
|
112
|
+
let _handleGranularityChange_decorators;
|
|
113
|
+
let _handleStartTimeChange_decorators;
|
|
114
|
+
let _handleEndTimeChange_decorators;
|
|
115
|
+
let _emitChange_decorators;
|
|
116
|
+
let _emitSelect_decorators;
|
|
117
|
+
let _emitComplete_decorators;
|
|
118
|
+
(class extends _classSuper {
|
|
119
|
+
static { _classThis = this; }
|
|
120
|
+
static {
|
|
121
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
122
|
+
_granularity_decorators = [snice.property({ type: Number })];
|
|
123
|
+
_startTime_decorators = [snice.property({ attribute: 'start-time' })];
|
|
124
|
+
_endTime_decorators = [snice.property({ attribute: 'end-time' })];
|
|
125
|
+
_value_decorators = [snice.property()];
|
|
126
|
+
_disabledRanges_decorators = [snice.property({ attribute: 'disabled-ranges' })];
|
|
127
|
+
_format_decorators = [snice.property()];
|
|
128
|
+
_multiple_decorators = [snice.property({ type: Boolean })];
|
|
129
|
+
_readonly_decorators = [snice.property({ type: Boolean })];
|
|
130
|
+
_disabled_decorators = [snice.property({ type: Boolean })];
|
|
131
|
+
_slotsContainer_decorators = [snice.query('.slots-container')];
|
|
132
|
+
_componentStyles_decorators = [snice.styles()];
|
|
133
|
+
_renderContent_decorators = [snice.render()];
|
|
134
|
+
_init_decorators = [snice.ready()];
|
|
135
|
+
_cleanup_decorators = [snice.dispose()];
|
|
136
|
+
_handleValueChange_decorators = [snice.watch('value')];
|
|
137
|
+
_handleDisabledRangesChange_decorators = [snice.watch('disabled-ranges')];
|
|
138
|
+
_handleGranularityChange_decorators = [snice.watch('granularity')];
|
|
139
|
+
_handleStartTimeChange_decorators = [snice.watch('start-time')];
|
|
140
|
+
_handleEndTimeChange_decorators = [snice.watch('end-time')];
|
|
141
|
+
_emitChange_decorators = [snice.dispatch('time-range-change', { bubbles: true, composed: true })];
|
|
142
|
+
_emitSelect_decorators = [snice.dispatch('time-range-select', { bubbles: true, composed: true })];
|
|
143
|
+
_emitComplete_decorators = [snice.dispatch('time-range-complete', { bubbles: true, composed: true })];
|
|
144
|
+
__esDecorate(this, null, _componentStyles_decorators, { kind: "method", name: "componentStyles", static: false, private: false, access: { has: obj => "componentStyles" in obj, get: obj => obj.componentStyles }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
145
|
+
__esDecorate(this, null, _renderContent_decorators, { kind: "method", name: "renderContent", static: false, private: false, access: { has: obj => "renderContent" in obj, get: obj => obj.renderContent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
146
|
+
__esDecorate(this, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: obj => "init" in obj, get: obj => obj.init }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
147
|
+
__esDecorate(this, null, _cleanup_decorators, { kind: "method", name: "cleanup", static: false, private: false, access: { has: obj => "cleanup" in obj, get: obj => obj.cleanup }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
148
|
+
__esDecorate(this, null, _handleValueChange_decorators, { kind: "method", name: "handleValueChange", static: false, private: false, access: { has: obj => "handleValueChange" in obj, get: obj => obj.handleValueChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
149
|
+
__esDecorate(this, null, _handleDisabledRangesChange_decorators, { kind: "method", name: "handleDisabledRangesChange", static: false, private: false, access: { has: obj => "handleDisabledRangesChange" in obj, get: obj => obj.handleDisabledRangesChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
150
|
+
__esDecorate(this, null, _handleGranularityChange_decorators, { kind: "method", name: "handleGranularityChange", static: false, private: false, access: { has: obj => "handleGranularityChange" in obj, get: obj => obj.handleGranularityChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
151
|
+
__esDecorate(this, null, _handleStartTimeChange_decorators, { kind: "method", name: "handleStartTimeChange", static: false, private: false, access: { has: obj => "handleStartTimeChange" in obj, get: obj => obj.handleStartTimeChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
152
|
+
__esDecorate(this, null, _handleEndTimeChange_decorators, { kind: "method", name: "handleEndTimeChange", static: false, private: false, access: { has: obj => "handleEndTimeChange" in obj, get: obj => obj.handleEndTimeChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
153
|
+
__esDecorate(this, null, _emitChange_decorators, { kind: "method", name: "emitChange", static: false, private: false, access: { has: obj => "emitChange" in obj, get: obj => obj.emitChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
154
|
+
__esDecorate(this, null, _emitSelect_decorators, { kind: "method", name: "emitSelect", static: false, private: false, access: { has: obj => "emitSelect" in obj, get: obj => obj.emitSelect }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
155
|
+
__esDecorate(this, null, _emitComplete_decorators, { kind: "method", name: "emitComplete", static: false, private: false, access: { has: obj => "emitComplete" in obj, get: obj => obj.emitComplete }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
156
|
+
__esDecorate(null, null, _granularity_decorators, { kind: "field", name: "granularity", static: false, private: false, access: { has: obj => "granularity" in obj, get: obj => obj.granularity, set: (obj, value) => { obj.granularity = value; } }, metadata: _metadata }, _granularity_initializers, _granularity_extraInitializers);
|
|
157
|
+
__esDecorate(null, null, _startTime_decorators, { kind: "field", name: "startTime", static: false, private: false, access: { has: obj => "startTime" in obj, get: obj => obj.startTime, set: (obj, value) => { obj.startTime = value; } }, metadata: _metadata }, _startTime_initializers, _startTime_extraInitializers);
|
|
158
|
+
__esDecorate(null, null, _endTime_decorators, { kind: "field", name: "endTime", static: false, private: false, access: { has: obj => "endTime" in obj, get: obj => obj.endTime, set: (obj, value) => { obj.endTime = value; } }, metadata: _metadata }, _endTime_initializers, _endTime_extraInitializers);
|
|
159
|
+
__esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
160
|
+
__esDecorate(null, null, _disabledRanges_decorators, { kind: "field", name: "disabledRanges", static: false, private: false, access: { has: obj => "disabledRanges" in obj, get: obj => obj.disabledRanges, set: (obj, value) => { obj.disabledRanges = value; } }, metadata: _metadata }, _disabledRanges_initializers, _disabledRanges_extraInitializers);
|
|
161
|
+
__esDecorate(null, null, _format_decorators, { kind: "field", name: "format", static: false, private: false, access: { has: obj => "format" in obj, get: obj => obj.format, set: (obj, value) => { obj.format = value; } }, metadata: _metadata }, _format_initializers, _format_extraInitializers);
|
|
162
|
+
__esDecorate(null, null, _multiple_decorators, { kind: "field", name: "multiple", static: false, private: false, access: { has: obj => "multiple" in obj, get: obj => obj.multiple, set: (obj, value) => { obj.multiple = value; } }, metadata: _metadata }, _multiple_initializers, _multiple_extraInitializers);
|
|
163
|
+
__esDecorate(null, null, _readonly_decorators, { kind: "field", name: "readonly", static: false, private: false, access: { has: obj => "readonly" in obj, get: obj => obj.readonly, set: (obj, value) => { obj.readonly = value; } }, metadata: _metadata }, _readonly_initializers, _readonly_extraInitializers);
|
|
164
|
+
__esDecorate(null, null, _disabled_decorators, { kind: "field", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
|
|
165
|
+
__esDecorate(null, null, _slotsContainer_decorators, { kind: "field", name: "slotsContainer", static: false, private: false, access: { has: obj => "slotsContainer" in obj, get: obj => obj.slotsContainer, set: (obj, value) => { obj.slotsContainer = value; } }, metadata: _metadata }, _slotsContainer_initializers, _slotsContainer_extraInitializers);
|
|
166
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
167
|
+
_classThis = _classDescriptor.value;
|
|
168
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
169
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
170
|
+
}
|
|
171
|
+
constructor() {
|
|
172
|
+
super();
|
|
173
|
+
this.granularity = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _granularity_initializers, 15));
|
|
174
|
+
this.startTime = (__runInitializers(this, _granularity_extraInitializers), __runInitializers(this, _startTime_initializers, '00:00'));
|
|
175
|
+
this.endTime = (__runInitializers(this, _startTime_extraInitializers), __runInitializers(this, _endTime_initializers, '23:59'));
|
|
176
|
+
this.value = (__runInitializers(this, _endTime_extraInitializers), __runInitializers(this, _value_initializers, ''));
|
|
177
|
+
this.disabledRanges = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _disabledRanges_initializers, ''));
|
|
178
|
+
this.format = (__runInitializers(this, _disabledRanges_extraInitializers), __runInitializers(this, _format_initializers, '24h'));
|
|
179
|
+
this.multiple = (__runInitializers(this, _format_extraInitializers), __runInitializers(this, _multiple_initializers, false));
|
|
180
|
+
this.readonly = (__runInitializers(this, _multiple_extraInitializers), __runInitializers(this, _readonly_initializers, false));
|
|
181
|
+
this.disabled = (__runInitializers(this, _readonly_extraInitializers), __runInitializers(this, _disabled_initializers, false));
|
|
182
|
+
this.slotsContainer = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _slotsContainer_initializers, void 0));
|
|
183
|
+
this.slots = (__runInitializers(this, _slotsContainer_extraInitializers), []);
|
|
184
|
+
this.selectedIndices = new Set();
|
|
185
|
+
this.disabledIndices = new Set();
|
|
186
|
+
this.isDragging = false;
|
|
187
|
+
this.dragStartIndex = -1;
|
|
188
|
+
this.dragEndIndex = -1;
|
|
189
|
+
this.boundHandleMouseMove = this.handleMouseMove.bind(this);
|
|
190
|
+
this.boundHandleMouseUp = this.handleMouseUp.bind(this);
|
|
191
|
+
this.boundHandleTouchMove = this.handleTouchMove.bind(this);
|
|
192
|
+
this.boundHandleTouchEnd = this.handleTouchEnd.bind(this);
|
|
193
|
+
}
|
|
194
|
+
componentStyles() {
|
|
195
|
+
return snice.css /*css*/ `${cssContent}`;
|
|
196
|
+
}
|
|
197
|
+
renderContent() {
|
|
198
|
+
this.buildSlots();
|
|
199
|
+
this.parseDisabledRanges();
|
|
200
|
+
this.parseValue();
|
|
201
|
+
const displayValue = this.getDisplayValue();
|
|
202
|
+
return snice.html `
|
|
203
|
+
<div class="wrapper">
|
|
204
|
+
<div class="header">
|
|
205
|
+
<span class="header-label">Time</span>
|
|
206
|
+
<span class="${displayValue ? 'header-value' : 'header-value header-value--empty'}">
|
|
207
|
+
${displayValue || 'No selection'}
|
|
208
|
+
</span>
|
|
209
|
+
</div>
|
|
210
|
+
<div class="slots-container"
|
|
211
|
+
@mousedown=${(e) => this.handleMouseDown(e)}
|
|
212
|
+
@touchstart=${(e) => this.handleTouchStart(e)}>
|
|
213
|
+
${this.slots.map((time, index) => {
|
|
214
|
+
const isSelected = this.selectedIndices.has(index);
|
|
215
|
+
const isDisabled = this.disabledIndices.has(index);
|
|
216
|
+
const isDragging = this.isDragging && this.isInDragRange(index) && !isDisabled;
|
|
217
|
+
const isHourStart = this.isHourBoundary(time);
|
|
218
|
+
const ranges = this.getSelectedRanges();
|
|
219
|
+
const isRangeStart = this.isRangeStart(index, ranges);
|
|
220
|
+
const isRangeEnd = this.isRangeEnd(index, ranges);
|
|
221
|
+
const classes = [
|
|
222
|
+
'slot',
|
|
223
|
+
isSelected ? 'slot--selected' : '',
|
|
224
|
+
isDisabled ? 'slot--disabled' : '',
|
|
225
|
+
isDragging ? 'slot--dragging' : '',
|
|
226
|
+
isHourStart ? 'slot--hour-start' : '',
|
|
227
|
+
isRangeStart ? 'slot--range-start' : '',
|
|
228
|
+
isRangeEnd ? 'slot--range-end' : '',
|
|
229
|
+
].filter(Boolean).join(' ');
|
|
230
|
+
return snice.html `
|
|
231
|
+
<div class="${classes}"
|
|
232
|
+
data-index="${index}"
|
|
233
|
+
data-time="${time}"
|
|
234
|
+
tabindex="${isDisabled ? '-1' : '0'}"
|
|
235
|
+
role="option"
|
|
236
|
+
aria-selected="${isSelected || isDragging ? 'true' : 'false'}"
|
|
237
|
+
aria-disabled="${isDisabled ? 'true' : 'false'}"
|
|
238
|
+
@keydown=${(e) => this.handleSlotKeydown(e, index)}>
|
|
239
|
+
<span class="slot-time">${this.formatTime(time)}</span>
|
|
240
|
+
<span class="slot-separator"></span>
|
|
241
|
+
</div>
|
|
242
|
+
`;
|
|
243
|
+
})}
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
init() {
|
|
249
|
+
this.buildSlots();
|
|
250
|
+
this.parseDisabledRanges();
|
|
251
|
+
this.parseValue();
|
|
252
|
+
}
|
|
253
|
+
cleanup() {
|
|
254
|
+
document.removeEventListener('mousemove', this.boundHandleMouseMove);
|
|
255
|
+
document.removeEventListener('mouseup', this.boundHandleMouseUp);
|
|
256
|
+
document.removeEventListener('touchmove', this.boundHandleTouchMove);
|
|
257
|
+
document.removeEventListener('touchend', this.boundHandleTouchEnd);
|
|
258
|
+
}
|
|
259
|
+
// --- Slot generation ---
|
|
260
|
+
buildSlots() {
|
|
261
|
+
const slots = [];
|
|
262
|
+
const startMinutes = this.timeToMinutes(this.startTime);
|
|
263
|
+
const endMinutes = this.timeToMinutes(this.endTime);
|
|
264
|
+
const gran = this.granularity;
|
|
265
|
+
for (let m = startMinutes; m <= endMinutes; m += gran) {
|
|
266
|
+
slots.push(this.minutesToTime(m));
|
|
267
|
+
}
|
|
268
|
+
this.slots = slots;
|
|
269
|
+
}
|
|
270
|
+
// --- Parsing ---
|
|
271
|
+
parseDisabledRanges() {
|
|
272
|
+
this.disabledIndices.clear();
|
|
273
|
+
if (!this.disabledRanges)
|
|
274
|
+
return;
|
|
275
|
+
try {
|
|
276
|
+
const ranges = JSON.parse(this.disabledRanges);
|
|
277
|
+
for (const range of ranges) {
|
|
278
|
+
const startIdx = this.getSlotIndex(range.start);
|
|
279
|
+
const endIdx = this.getSlotIndex(range.end);
|
|
280
|
+
if (startIdx >= 0 && endIdx >= 0) {
|
|
281
|
+
for (let i = startIdx; i <= endIdx; i++) {
|
|
282
|
+
this.disabledIndices.add(i);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
// Invalid JSON - ignore
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
parseValue() {
|
|
292
|
+
this.selectedIndices.clear();
|
|
293
|
+
if (!this.value)
|
|
294
|
+
return;
|
|
295
|
+
try {
|
|
296
|
+
const ranges = JSON.parse(this.value);
|
|
297
|
+
for (const range of ranges) {
|
|
298
|
+
const startIdx = this.getSlotIndex(range.start);
|
|
299
|
+
const endIdx = this.getSlotIndex(range.end);
|
|
300
|
+
if (startIdx >= 0 && endIdx >= 0) {
|
|
301
|
+
for (let i = startIdx; i <= endIdx; i++) {
|
|
302
|
+
if (!this.disabledIndices.has(i)) {
|
|
303
|
+
this.selectedIndices.add(i);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch {
|
|
310
|
+
// Invalid JSON - ignore
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
// --- Time utilities ---
|
|
314
|
+
timeToMinutes(time) {
|
|
315
|
+
const [h, m] = time.split(':').map(Number);
|
|
316
|
+
return (h || 0) * 60 + (m || 0);
|
|
317
|
+
}
|
|
318
|
+
minutesToTime(minutes) {
|
|
319
|
+
const h = Math.floor(minutes / 60);
|
|
320
|
+
const m = minutes % 60;
|
|
321
|
+
return `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`;
|
|
322
|
+
}
|
|
323
|
+
formatTime(time) {
|
|
324
|
+
if (this.format === '24h')
|
|
325
|
+
return time;
|
|
326
|
+
const [h, m] = time.split(':').map(Number);
|
|
327
|
+
const period = h >= 12 ? 'PM' : 'AM';
|
|
328
|
+
const hour12 = h === 0 ? 12 : h > 12 ? h - 12 : h;
|
|
329
|
+
return `${hour12}:${m.toString().padStart(2, '0')} ${period}`;
|
|
330
|
+
}
|
|
331
|
+
getSlotIndex(time) {
|
|
332
|
+
return this.slots.indexOf(time);
|
|
333
|
+
}
|
|
334
|
+
getSlotEndTime(index) {
|
|
335
|
+
const startMinutes = this.timeToMinutes(this.slots[index]);
|
|
336
|
+
return this.minutesToTime(startMinutes + this.granularity);
|
|
337
|
+
}
|
|
338
|
+
isHourBoundary(time) {
|
|
339
|
+
return time.endsWith(':00') && time !== this.slots[0];
|
|
340
|
+
}
|
|
341
|
+
// --- Range helpers ---
|
|
342
|
+
isRangeStart(index, ranges) {
|
|
343
|
+
for (const range of ranges) {
|
|
344
|
+
const startIdx = this.getSlotIndex(range.start);
|
|
345
|
+
if (startIdx === index)
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
isRangeEnd(index, ranges) {
|
|
351
|
+
for (const range of ranges) {
|
|
352
|
+
const endIdx = this.getSlotIndex(range.end);
|
|
353
|
+
if (endIdx === index)
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
isInDragRange(index) {
|
|
359
|
+
if (this.dragStartIndex < 0)
|
|
360
|
+
return false;
|
|
361
|
+
const low = Math.min(this.dragStartIndex, this.dragEndIndex);
|
|
362
|
+
const high = Math.max(this.dragStartIndex, this.dragEndIndex);
|
|
363
|
+
return index >= low && index <= high;
|
|
364
|
+
}
|
|
365
|
+
// --- Mouse/touch handling ---
|
|
366
|
+
getSlotIndexFromEvent(e) {
|
|
367
|
+
const target = e.target.closest('[data-index]');
|
|
368
|
+
if (target) {
|
|
369
|
+
return parseInt(target.getAttribute('data-index') || '-1', 10);
|
|
370
|
+
}
|
|
371
|
+
return -1;
|
|
372
|
+
}
|
|
373
|
+
getSlotIndexFromPoint(x, y) {
|
|
374
|
+
const el = this.shadowRoot?.elementFromPoint(x, y);
|
|
375
|
+
if (!el)
|
|
376
|
+
return -1;
|
|
377
|
+
const slot = el.closest('[data-index]');
|
|
378
|
+
if (slot) {
|
|
379
|
+
return parseInt(slot.getAttribute('data-index') || '-1', 10);
|
|
380
|
+
}
|
|
381
|
+
return -1;
|
|
382
|
+
}
|
|
383
|
+
handleMouseDown(e) {
|
|
384
|
+
if (this.disabled || this.readonly)
|
|
385
|
+
return;
|
|
386
|
+
const index = this.getSlotIndexFromEvent(e);
|
|
387
|
+
if (index < 0 || this.disabledIndices.has(index))
|
|
388
|
+
return;
|
|
389
|
+
e.preventDefault();
|
|
390
|
+
this.startDrag(index);
|
|
391
|
+
document.addEventListener('mousemove', this.boundHandleMouseMove);
|
|
392
|
+
document.addEventListener('mouseup', this.boundHandleMouseUp);
|
|
393
|
+
}
|
|
394
|
+
handleMouseMove(e) {
|
|
395
|
+
if (!this.isDragging)
|
|
396
|
+
return;
|
|
397
|
+
const index = this.getSlotIndexFromPoint(e.clientX, e.clientY);
|
|
398
|
+
if (index >= 0) {
|
|
399
|
+
this.updateDrag(index);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
handleMouseUp(_e) {
|
|
403
|
+
document.removeEventListener('mousemove', this.boundHandleMouseMove);
|
|
404
|
+
document.removeEventListener('mouseup', this.boundHandleMouseUp);
|
|
405
|
+
if (this.isDragging) {
|
|
406
|
+
this.endDrag();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
handleTouchStart(e) {
|
|
410
|
+
if (this.disabled || this.readonly)
|
|
411
|
+
return;
|
|
412
|
+
const touch = e.touches[0];
|
|
413
|
+
const index = this.getSlotIndexFromEvent(touch);
|
|
414
|
+
if (index < 0 || this.disabledIndices.has(index))
|
|
415
|
+
return;
|
|
416
|
+
e.preventDefault();
|
|
417
|
+
this.startDrag(index);
|
|
418
|
+
document.addEventListener('touchmove', this.boundHandleTouchMove, { passive: false });
|
|
419
|
+
document.addEventListener('touchend', this.boundHandleTouchEnd);
|
|
420
|
+
}
|
|
421
|
+
handleTouchMove(e) {
|
|
422
|
+
if (!this.isDragging)
|
|
423
|
+
return;
|
|
424
|
+
e.preventDefault();
|
|
425
|
+
const touch = e.touches[0];
|
|
426
|
+
const index = this.getSlotIndexFromPoint(touch.clientX, touch.clientY);
|
|
427
|
+
if (index >= 0) {
|
|
428
|
+
this.updateDrag(index);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
handleTouchEnd(_e) {
|
|
432
|
+
document.removeEventListener('touchmove', this.boundHandleTouchMove);
|
|
433
|
+
document.removeEventListener('touchend', this.boundHandleTouchEnd);
|
|
434
|
+
if (this.isDragging) {
|
|
435
|
+
this.endDrag();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
startDrag(index) {
|
|
439
|
+
this.isDragging = true;
|
|
440
|
+
this.dragStartIndex = index;
|
|
441
|
+
this.dragEndIndex = index;
|
|
442
|
+
this.emitSelect();
|
|
443
|
+
this.renderContent();
|
|
444
|
+
}
|
|
445
|
+
updateDrag(index) {
|
|
446
|
+
if (index !== this.dragEndIndex) {
|
|
447
|
+
this.dragEndIndex = index;
|
|
448
|
+
this.renderContent();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
endDrag() {
|
|
452
|
+
const low = Math.min(this.dragStartIndex, this.dragEndIndex);
|
|
453
|
+
const high = Math.max(this.dragStartIndex, this.dragEndIndex);
|
|
454
|
+
// Collect new indices, skipping disabled
|
|
455
|
+
const newIndices = [];
|
|
456
|
+
for (let i = low; i <= high; i++) {
|
|
457
|
+
if (!this.disabledIndices.has(i)) {
|
|
458
|
+
newIndices.push(i);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (this.multiple) {
|
|
462
|
+
// Toggle: if all in range are already selected, deselect; else select
|
|
463
|
+
const allSelected = newIndices.every(i => this.selectedIndices.has(i));
|
|
464
|
+
if (allSelected) {
|
|
465
|
+
for (const i of newIndices) {
|
|
466
|
+
this.selectedIndices.delete(i);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
for (const i of newIndices) {
|
|
471
|
+
this.selectedIndices.add(i);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
// Single range mode: replace selection
|
|
477
|
+
this.selectedIndices.clear();
|
|
478
|
+
for (const i of newIndices) {
|
|
479
|
+
this.selectedIndices.add(i);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
const completedRange = {
|
|
483
|
+
start: this.slots[low],
|
|
484
|
+
end: this.slots[high],
|
|
485
|
+
};
|
|
486
|
+
this.isDragging = false;
|
|
487
|
+
this.dragStartIndex = -1;
|
|
488
|
+
this.dragEndIndex = -1;
|
|
489
|
+
this.syncValueFromSelection();
|
|
490
|
+
this.emitComplete(completedRange);
|
|
491
|
+
this.emitChange();
|
|
492
|
+
this.renderContent();
|
|
493
|
+
}
|
|
494
|
+
// --- Keyboard handling ---
|
|
495
|
+
handleSlotKeydown(e, index) {
|
|
496
|
+
if (this.disabled || this.readonly)
|
|
497
|
+
return;
|
|
498
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
499
|
+
e.preventDefault();
|
|
500
|
+
if (this.disabledIndices.has(index))
|
|
501
|
+
return;
|
|
502
|
+
if (this.multiple) {
|
|
503
|
+
if (this.selectedIndices.has(index)) {
|
|
504
|
+
this.selectedIndices.delete(index);
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
this.selectedIndices.add(index);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this.selectedIndices.clear();
|
|
512
|
+
this.selectedIndices.add(index);
|
|
513
|
+
}
|
|
514
|
+
const range = { start: this.slots[index], end: this.slots[index] };
|
|
515
|
+
this.syncValueFromSelection();
|
|
516
|
+
this.emitComplete(range);
|
|
517
|
+
this.emitChange();
|
|
518
|
+
this.renderContent();
|
|
519
|
+
}
|
|
520
|
+
else if (e.key === 'ArrowDown') {
|
|
521
|
+
e.preventDefault();
|
|
522
|
+
this.focusSlot(index + 1);
|
|
523
|
+
}
|
|
524
|
+
else if (e.key === 'ArrowUp') {
|
|
525
|
+
e.preventDefault();
|
|
526
|
+
this.focusSlot(index - 1);
|
|
527
|
+
}
|
|
528
|
+
else if (e.key === 'Escape') {
|
|
529
|
+
this.clearSelection();
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
focusSlot(index) {
|
|
533
|
+
if (index < 0 || index >= this.slots.length)
|
|
534
|
+
return;
|
|
535
|
+
const slotEl = this.shadowRoot?.querySelector(`[data-index="${index}"]`);
|
|
536
|
+
slotEl?.focus();
|
|
537
|
+
}
|
|
538
|
+
// --- Value synchronization ---
|
|
539
|
+
syncValueFromSelection() {
|
|
540
|
+
const ranges = this.getSelectedRanges();
|
|
541
|
+
this.value = JSON.stringify(ranges);
|
|
542
|
+
}
|
|
543
|
+
getDisplayValue() {
|
|
544
|
+
const ranges = this.getSelectedRanges();
|
|
545
|
+
if (ranges.length === 0)
|
|
546
|
+
return '';
|
|
547
|
+
return ranges.map(r => {
|
|
548
|
+
const startDisplay = this.formatTime(r.start);
|
|
549
|
+
const endTime = this.minutesToTime(this.timeToMinutes(r.end) + this.granularity);
|
|
550
|
+
const endDisplay = this.formatTime(endTime);
|
|
551
|
+
return `${startDisplay} - ${endDisplay}`;
|
|
552
|
+
}).join(', ');
|
|
553
|
+
}
|
|
554
|
+
// --- Public API ---
|
|
555
|
+
getSelectedRanges() {
|
|
556
|
+
const sorted = [...this.selectedIndices].sort((a, b) => a - b);
|
|
557
|
+
if (sorted.length === 0)
|
|
558
|
+
return [];
|
|
559
|
+
const ranges = [];
|
|
560
|
+
let rangeStart = sorted[0];
|
|
561
|
+
let prev = sorted[0];
|
|
562
|
+
for (let i = 1; i < sorted.length; i++) {
|
|
563
|
+
if (sorted[i] !== prev + 1) {
|
|
564
|
+
ranges.push({
|
|
565
|
+
start: this.slots[rangeStart],
|
|
566
|
+
end: this.slots[prev],
|
|
567
|
+
});
|
|
568
|
+
rangeStart = sorted[i];
|
|
569
|
+
}
|
|
570
|
+
prev = sorted[i];
|
|
571
|
+
}
|
|
572
|
+
ranges.push({
|
|
573
|
+
start: this.slots[rangeStart],
|
|
574
|
+
end: this.slots[prev],
|
|
575
|
+
});
|
|
576
|
+
return ranges;
|
|
577
|
+
}
|
|
578
|
+
setSelectedRanges(ranges) {
|
|
579
|
+
this.value = JSON.stringify(ranges);
|
|
580
|
+
this.parseValue();
|
|
581
|
+
this.emitChange();
|
|
582
|
+
this.renderContent();
|
|
583
|
+
}
|
|
584
|
+
clearSelection() {
|
|
585
|
+
this.selectedIndices.clear();
|
|
586
|
+
this.value = '';
|
|
587
|
+
this.emitChange();
|
|
588
|
+
this.renderContent();
|
|
589
|
+
}
|
|
590
|
+
isSlotDisabled(time) {
|
|
591
|
+
const index = this.getSlotIndex(time);
|
|
592
|
+
return index >= 0 && this.disabledIndices.has(index);
|
|
593
|
+
}
|
|
594
|
+
// --- Watchers ---
|
|
595
|
+
handleValueChange() {
|
|
596
|
+
this.parseValue();
|
|
597
|
+
}
|
|
598
|
+
handleDisabledRangesChange() {
|
|
599
|
+
this.parseDisabledRanges();
|
|
600
|
+
}
|
|
601
|
+
handleGranularityChange() {
|
|
602
|
+
this.buildSlots();
|
|
603
|
+
this.parseDisabledRanges();
|
|
604
|
+
this.parseValue();
|
|
605
|
+
}
|
|
606
|
+
handleStartTimeChange() {
|
|
607
|
+
this.buildSlots();
|
|
608
|
+
this.parseDisabledRanges();
|
|
609
|
+
this.parseValue();
|
|
610
|
+
}
|
|
611
|
+
handleEndTimeChange() {
|
|
612
|
+
this.buildSlots();
|
|
613
|
+
this.parseDisabledRanges();
|
|
614
|
+
this.parseValue();
|
|
615
|
+
}
|
|
616
|
+
// --- Event dispatchers ---
|
|
617
|
+
emitChange() {
|
|
618
|
+
return { ranges: this.getSelectedRanges(), component: this };
|
|
619
|
+
}
|
|
620
|
+
emitSelect() {
|
|
621
|
+
return { start: this.slots[this.dragStartIndex], component: this };
|
|
622
|
+
}
|
|
623
|
+
emitComplete(range) {
|
|
624
|
+
return { range, ranges: this.getSelectedRanges(), component: this };
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
return _classThis;
|
|
628
|
+
})();
|
|
629
|
+
|
|
630
|
+
exports.SniceTimeRangePicker = SniceTimeRangePicker;
|
|
631
|
+
|
|
632
|
+
return exports;
|
|
633
|
+
|
|
634
|
+
})({}, Snice);
|
|
635
|
+
//# sourceMappingURL=snice-time-range-picker.js.map
|