@hina-ui/vue 1.7.5 → 1.7.6
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/README.md +37 -0
- package/dist/index.js +2222 -987
- package/dist/index.js.map +1 -1
- package/dist/shared/behavior/anchor-follow.ts +95 -0
- package/dist/shared/behavior/form.ts +187 -0
- package/dist/shared/behavior/ripple.ts +222 -0
- package/dist/shared/behavior/spoiler/painter.ts +197 -0
- package/dist/shared/behavior/spoiler/worklet.ts +199 -0
- package/dist/shared/behavior/toast.ts +243 -0
- package/dist/shared/lib/anchor.ts +83 -0
- package/dist/shared/lib/banner.ts +10 -0
- package/dist/shared/lib/calendar/format.ts +23 -0
- package/dist/shared/lib/caret.ts +48 -0
- package/dist/shared/lib/collapse.ts +29 -0
- package/dist/shared/lib/command-palette/hotkey.ts +27 -0
- package/dist/shared/lib/command-palette/match.ts +92 -0
- package/dist/shared/lib/data-list.ts +40 -0
- package/dist/shared/lib/data-table/column-sizing-styles.ts +41 -0
- package/dist/shared/lib/data-table/column-sizing.ts +101 -0
- package/dist/shared/lib/data-table/csv.ts +51 -0
- package/dist/shared/lib/data-table/layout.ts +199 -0
- package/dist/shared/lib/data-table/resize.ts +66 -0
- package/dist/shared/lib/data-table/state.ts +226 -0
- package/dist/shared/lib/data-table/utils.ts +80 -0
- package/dist/shared/lib/date-range-field/validity.ts +21 -0
- package/dist/shared/lib/date.ts +111 -0
- package/dist/shared/lib/field-focus.ts +36 -0
- package/dist/shared/lib/file-upload/select.ts +58 -0
- package/dist/shared/lib/file-upload/size.ts +16 -0
- package/dist/shared/lib/form/errors.ts +48 -0
- package/dist/shared/lib/form/focus.ts +10 -0
- package/dist/shared/lib/form/standard-schema.ts +26 -0
- package/dist/shared/lib/form/values.ts +23 -0
- package/dist/shared/lib/highlighter.ts +98 -0
- package/dist/shared/lib/iris-origin.ts +40 -0
- package/dist/shared/lib/lightbox/clip.ts +117 -0
- package/dist/shared/lib/lightbox/download.ts +29 -0
- package/dist/shared/lib/lightbox/gesture.ts +54 -0
- package/dist/shared/lib/lightbox/paging.ts +33 -0
- package/dist/shared/lib/lightbox/pose.ts +142 -0
- package/dist/shared/lib/lightbox/source.ts +17 -0
- package/dist/shared/lib/lightbox/types.ts +14 -0
- package/dist/shared/lib/lightbox/zoom.ts +127 -0
- package/dist/shared/lib/meter-group.ts +16 -0
- package/dist/shared/lib/overlay-anchor.ts +42 -0
- package/dist/shared/lib/pagination.ts +16 -0
- package/dist/shared/lib/pointer-corridor.ts +26 -0
- package/dist/shared/lib/qr-code-export.ts +68 -0
- package/dist/shared/lib/range-calendar/limit.ts +11 -0
- package/dist/shared/lib/rating.ts +4 -0
- package/dist/shared/lib/relative-time.ts +20 -0
- package/dist/shared/lib/scroll-area.ts +77 -0
- package/dist/shared/lib/scroll-restore.ts +148 -0
- package/dist/shared/lib/toast-layout.ts +42 -0
- package/dist/shared/lib/tree/selection.ts +131 -0
- package/dist/shared/lib/tree-select/filter.ts +19 -0
- package/dist/shared/lib/virtual/choices.ts +193 -0
- package/dist/shared/lib/virtual/collection.ts +71 -0
- package/dist/shared/lib/virtual/filter.ts +26 -0
- package/dist/shared/lib/virtual/flow.ts +32 -0
- package/dist/shared/lib/virtual/list.ts +63 -0
- package/dist/shared/lib/virtual/navigation.ts +26 -0
- package/dist/shared/lib/virtual/tree.ts +98 -0
- package/dist/shared/locale/en-US.ts +220 -0
- package/dist/shared/locale/index.ts +52 -0
- package/dist/shared/locale/types.ts +225 -0
- package/dist/shared/locale/zh-CN.ts +215 -0
- package/dist/shared/primitives/number-field/LICENSE +21 -0
- package/dist/shared/primitives/number-field/index.ts +407 -0
- package/dist/shared/styles/semantic.css +10 -2
- package/dist/shared/types/autocomplete.ts +16 -0
- package/dist/shared/types/data-table.ts +170 -0
- package/dist/shared/types/pagination.ts +19 -0
- package/dist/shared/types/select.ts +23 -0
- package/dist/shared/types/tree-select.ts +34 -0
- package/dist/shared/types/tree.ts +20 -0
- package/dist/types/shared/src/behavior/anchor-follow.d.ts +13 -0
- package/dist/types/shared/src/behavior/anchor-follow.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/form.d.ts +24 -0
- package/dist/types/shared/src/behavior/form.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/ripple.d.ts +11 -0
- package/dist/types/shared/src/behavior/ripple.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/spoiler/painter.d.ts +35 -0
- package/dist/types/shared/src/behavior/spoiler/painter.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/spoiler/worklet.d.ts +2 -0
- package/dist/types/shared/src/behavior/spoiler/worklet.d.ts.map +1 -0
- package/dist/types/shared/src/behavior/toast.d.ts +72 -0
- package/dist/types/shared/src/behavior/toast.d.ts.map +1 -0
- package/dist/types/shared/src/lib/anchor.d.ts +31 -0
- package/dist/types/shared/src/lib/anchor.d.ts.map +1 -0
- package/dist/types/shared/src/lib/banner.d.ts +3 -0
- package/dist/types/shared/src/lib/banner.d.ts.map +1 -0
- package/dist/types/shared/src/lib/calendar/format.d.ts +7 -0
- package/dist/types/shared/src/lib/calendar/format.d.ts.map +1 -0
- package/dist/types/shared/src/lib/caret.d.ts +2 -0
- package/dist/types/shared/src/lib/caret.d.ts.map +1 -0
- package/dist/types/shared/src/lib/collapse.d.ts +9 -0
- package/dist/types/shared/src/lib/collapse.d.ts.map +1 -0
- package/dist/types/shared/src/lib/command-palette/hotkey.d.ts +9 -0
- package/dist/types/shared/src/lib/command-palette/hotkey.d.ts.map +1 -0
- package/dist/types/shared/src/lib/command-palette/match.d.ts +21 -0
- package/dist/types/shared/src/lib/command-palette/match.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-list.d.ts +7 -0
- package/dist/types/shared/src/lib/data-list.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/column-sizing-styles.d.ts +8 -0
- package/dist/types/shared/src/lib/data-table/column-sizing-styles.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/column-sizing.d.ts +22 -0
- package/dist/types/shared/src/lib/data-table/column-sizing.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/csv.d.ts +5 -0
- package/dist/types/shared/src/lib/data-table/csv.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/layout.d.ts +28 -0
- package/dist/types/shared/src/lib/data-table/layout.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/resize.d.ts +15 -0
- package/dist/types/shared/src/lib/data-table/resize.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/state.d.ts +103 -0
- package/dist/types/shared/src/lib/data-table/state.d.ts.map +1 -0
- package/dist/types/shared/src/lib/data-table/utils.d.ts +11 -0
- package/dist/types/shared/src/lib/data-table/utils.d.ts.map +1 -0
- package/dist/types/shared/src/lib/date-range-field/validity.d.ts +12 -0
- package/dist/types/shared/src/lib/date-range-field/validity.d.ts.map +1 -0
- package/dist/types/shared/src/lib/date.d.ts +28 -0
- package/dist/types/shared/src/lib/date.d.ts.map +1 -0
- package/dist/types/shared/src/lib/field-focus.d.ts +2 -0
- package/dist/types/shared/src/lib/field-focus.d.ts.map +1 -0
- package/dist/types/shared/src/lib/file-upload/select.d.ts +17 -0
- package/dist/types/shared/src/lib/file-upload/select.d.ts.map +1 -0
- package/dist/types/shared/src/lib/file-upload/size.d.ts +2 -0
- package/dist/types/shared/src/lib/file-upload/size.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/errors.d.ts +7 -0
- package/dist/types/shared/src/lib/form/errors.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/focus.d.ts +2 -0
- package/dist/types/shared/src/lib/form/focus.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/standard-schema.d.ts +23 -0
- package/dist/types/shared/src/lib/form/standard-schema.d.ts.map +1 -0
- package/dist/types/shared/src/lib/form/values.d.ts +3 -0
- package/dist/types/shared/src/lib/form/values.d.ts.map +1 -0
- package/dist/types/shared/src/lib/highlighter.d.ts +4 -0
- package/dist/types/shared/src/lib/highlighter.d.ts.map +1 -0
- package/dist/types/shared/src/lib/iris-origin.d.ts +6 -0
- package/dist/types/shared/src/lib/iris-origin.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/clip.d.ts +16 -0
- package/dist/types/shared/src/lib/lightbox/clip.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/download.d.ts +3 -0
- package/dist/types/shared/src/lib/lightbox/download.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/gesture.d.ts +26 -0
- package/dist/types/shared/src/lib/lightbox/gesture.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/paging.d.ts +9 -0
- package/dist/types/shared/src/lib/lightbox/paging.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/pose.d.ts +38 -0
- package/dist/types/shared/src/lib/lightbox/pose.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/source.d.ts +4 -0
- package/dist/types/shared/src/lib/lightbox/source.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/types.d.ts +16 -0
- package/dist/types/shared/src/lib/lightbox/types.d.ts.map +1 -0
- package/dist/types/shared/src/lib/lightbox/zoom.d.ts +40 -0
- package/dist/types/shared/src/lib/lightbox/zoom.d.ts.map +1 -0
- package/dist/types/shared/src/lib/meter-group.d.ts +5 -0
- package/dist/types/shared/src/lib/meter-group.d.ts.map +1 -0
- package/dist/types/shared/src/lib/overlay-anchor.d.ts +10 -0
- package/dist/types/shared/src/lib/overlay-anchor.d.ts.map +1 -0
- package/dist/types/shared/src/lib/pagination.d.ts +4 -0
- package/dist/types/shared/src/lib/pagination.d.ts.map +1 -0
- package/dist/types/shared/src/lib/pointer-corridor.d.ts +7 -0
- package/dist/types/shared/src/lib/pointer-corridor.d.ts.map +1 -0
- package/dist/types/shared/src/lib/qr-code-export.d.ts +6 -0
- package/dist/types/shared/src/lib/qr-code-export.d.ts.map +1 -0
- package/dist/types/shared/src/lib/range-calendar/limit.d.ts +3 -0
- package/dist/types/shared/src/lib/range-calendar/limit.d.ts.map +1 -0
- package/dist/types/shared/src/lib/rating.d.ts +2 -0
- package/dist/types/shared/src/lib/rating.d.ts.map +1 -0
- package/dist/types/shared/src/lib/relative-time.d.ts +2 -0
- package/dist/types/shared/src/lib/relative-time.d.ts.map +1 -0
- package/dist/types/shared/src/lib/scroll-area.d.ts +50 -0
- package/dist/types/shared/src/lib/scroll-area.d.ts.map +1 -0
- package/dist/types/shared/src/lib/scroll-restore.d.ts +34 -0
- package/dist/types/shared/src/lib/scroll-restore.d.ts.map +1 -0
- package/dist/types/shared/src/lib/toast-layout.d.ts +13 -0
- package/dist/types/shared/src/lib/toast-layout.d.ts.map +1 -0
- package/dist/types/shared/src/lib/tree/selection.d.ts +23 -0
- package/dist/types/shared/src/lib/tree/selection.d.ts.map +1 -0
- package/dist/types/shared/src/lib/tree-select/filter.d.ts +7 -0
- package/dist/types/shared/src/lib/tree-select/filter.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/choices.d.ts +59 -0
- package/dist/types/shared/src/lib/virtual/choices.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/collection.d.ts +25 -0
- package/dist/types/shared/src/lib/virtual/collection.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/flow.d.ts +18 -0
- package/dist/types/shared/src/lib/virtual/flow.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/list.d.ts +46 -0
- package/dist/types/shared/src/lib/virtual/list.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/navigation.d.ts +3 -0
- package/dist/types/shared/src/lib/virtual/navigation.d.ts.map +1 -0
- package/dist/types/shared/src/lib/virtual/tree.d.ts +31 -0
- package/dist/types/shared/src/lib/virtual/tree.d.ts.map +1 -0
- package/dist/types/shared/src/locale/en-US.d.ts +3 -0
- package/dist/types/shared/src/locale/en-US.d.ts.map +1 -0
- package/dist/types/shared/src/locale/index.d.ts +6 -0
- package/dist/types/shared/src/locale/index.d.ts.map +1 -0
- package/dist/types/shared/src/locale/types.d.ts +235 -0
- package/dist/types/shared/src/locale/types.d.ts.map +1 -0
- package/dist/types/shared/src/locale/zh-CN.d.ts +3 -0
- package/dist/types/shared/src/locale/zh-CN.d.ts.map +1 -0
- package/dist/types/shared/src/primitives/number-field/index.d.ts +155 -0
- package/dist/types/shared/src/primitives/number-field/index.d.ts.map +1 -0
- package/dist/types/shared/src/types/autocomplete.d.ts +14 -0
- package/dist/types/shared/src/types/autocomplete.d.ts.map +1 -0
- package/dist/types/shared/src/types/data-table.d.ts +169 -0
- package/dist/types/shared/src/types/data-table.d.ts.map +1 -0
- package/dist/types/shared/src/types/pagination.d.ts +23 -0
- package/dist/types/shared/src/types/pagination.d.ts.map +1 -0
- package/dist/types/shared/src/types/select.d.ts +14 -0
- package/dist/types/shared/src/types/select.d.ts.map +1 -0
- package/dist/types/shared/src/types/tree-select.d.ts +10 -0
- package/dist/types/shared/src/types/tree-select.d.ts.map +1 -0
- package/dist/types/shared/src/types/tree.d.ts +18 -0
- package/dist/types/shared/src/types/tree.d.ts.map +1 -0
- package/dist/types/shared/src/variants/autocomplete.d.ts +3 -0
- package/dist/types/shared/src/variants/autocomplete.d.ts.map +1 -0
- package/dist/types/shared/src/variants/editable.d.ts +52 -0
- package/dist/types/shared/src/variants/editable.d.ts.map +1 -0
- package/dist/types/shared/src/variants/float-button.d.ts +74 -0
- package/dist/types/shared/src/variants/float-button.d.ts.map +1 -0
- package/dist/types/shared/src/variants/split-button.d.ts +18 -0
- package/dist/types/shared/src/variants/split-button.d.ts.map +1 -0
- package/dist/types/vue/src/components/accordion/AccordionTrigger.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/composables/useAnchor.d.ts +2 -7
- package/dist/types/vue/src/components/anchor/composables/useAnchor.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/composables/useAnchorFollow.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/composables/useScrollSpy.d.ts +2 -5
- package/dist/types/vue/src/components/anchor/composables/useScrollSpy.d.ts.map +1 -1
- package/dist/types/vue/src/components/anchor/types.d.ts +1 -8
- package/dist/types/vue/src/components/anchor/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/autocomplete/autocomplete.variants.d.ts +1 -1
- package/dist/types/vue/src/components/autocomplete/autocomplete.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/autocomplete/types.d.ts +1 -13
- package/dist/types/vue/src/components/autocomplete/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/banner/utils/direction.d.ts +1 -2
- package/dist/types/vue/src/components/banner/utils/direction.d.ts.map +1 -1
- package/dist/types/vue/src/components/calendar/utils/format.d.ts +1 -6
- package/dist/types/vue/src/components/calendar/utils/format.d.ts.map +1 -1
- package/dist/types/vue/src/components/code-block/highlighter.d.ts +1 -3
- package/dist/types/vue/src/components/code-block/highlighter.d.ts.map +1 -1
- package/dist/types/vue/src/components/collapsible/CollapsibleTrigger.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/composables/useCommandItems.d.ts +1 -1
- package/dist/types/vue/src/components/command-palette/utils/hotkey.d.ts +1 -8
- package/dist/types/vue/src/components/command-palette/utils/hotkey.d.ts.map +1 -1
- package/dist/types/vue/src/components/command-palette/utils/match.d.ts +5 -12
- package/dist/types/vue/src/components/command-palette/utils/match.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-list/composables/useDataList.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-list/utils/scroll.d.ts +1 -2
- package/dist/types/vue/src/components/data-list/utils/scroll.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/column-sizing-styles.d.ts +1 -3
- package/dist/types/vue/src/components/data-table/column-sizing-styles.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/column-sizing.d.ts +1 -21
- package/dist/types/vue/src/components/data-table/column-sizing.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useDataTable.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableColumns.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableDrag.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableExport.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableResize.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableResizeHandles.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/composables/useTableVirtual.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/types.d.ts +3 -153
- package/dist/types/vue/src/components/data-table/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/data-table/utils.d.ts +1 -9
- package/dist/types/vue/src/components/data-table/utils.d.ts.map +1 -1
- package/dist/types/vue/src/components/date-range-field/utils/validity.d.ts +1 -11
- package/dist/types/vue/src/components/date-range-field/utils/validity.d.ts.map +1 -1
- package/dist/types/vue/src/components/editable/editable.variants.d.ts +1 -1
- package/dist/types/vue/src/components/editable/editable.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/file-upload/utils/select.d.ts +1 -16
- package/dist/types/vue/src/components/file-upload/utils/select.d.ts.map +1 -1
- package/dist/types/vue/src/components/file-upload/utils/size.d.ts +1 -1
- package/dist/types/vue/src/components/file-upload/utils/size.d.ts.map +1 -1
- package/dist/types/vue/src/components/float-button/float-button.variants.d.ts +1 -1
- package/dist/types/vue/src/components/float-button/float-button.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/Form.vue.d.ts +1 -1
- package/dist/types/vue/src/components/form/composables/useForm.d.ts +9 -15
- package/dist/types/vue/src/components/form/composables/useForm.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/standard-schema.d.ts +1 -22
- package/dist/types/vue/src/components/form/standard-schema.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/utils/errors.d.ts +1 -6
- package/dist/types/vue/src/components/form/utils/errors.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/utils/focus.d.ts +1 -1
- package/dist/types/vue/src/components/form/utils/focus.d.ts.map +1 -1
- package/dist/types/vue/src/components/form/utils/values.d.ts +1 -2
- package/dist/types/vue/src/components/form/utils/values.d.ts.map +1 -1
- package/dist/types/vue/src/components/form-field/FormField.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/types.d.ts +1 -15
- package/dist/types/vue/src/components/lightbox/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/clip.d.ts +1 -15
- package/dist/types/vue/src/components/lightbox/utils/clip.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/download.d.ts +1 -2
- package/dist/types/vue/src/components/lightbox/utils/download.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/gesture.d.ts +1 -25
- package/dist/types/vue/src/components/lightbox/utils/gesture.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/paging.d.ts +1 -8
- package/dist/types/vue/src/components/lightbox/utils/paging.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/pose.d.ts +1 -37
- package/dist/types/vue/src/components/lightbox/utils/pose.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/source.d.ts +1 -3
- package/dist/types/vue/src/components/lightbox/utils/source.d.ts.map +1 -1
- package/dist/types/vue/src/components/lightbox/utils/zoom.d.ts +1 -39
- package/dist/types/vue/src/components/lightbox/utils/zoom.d.ts.map +1 -1
- package/dist/types/vue/src/components/meter-group/utils/tones.d.ts +1 -3
- package/dist/types/vue/src/components/meter-group/utils/tones.d.ts.map +1 -1
- package/dist/types/vue/src/components/month-grid/MonthGrid.vue.d.ts +1 -1
- package/dist/types/vue/src/components/multi-select/MultiSelect.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/pagination/composables/usePagination.d.ts +2 -2
- package/dist/types/vue/src/components/pagination/composables/usePagination.d.ts.map +1 -1
- package/dist/types/vue/src/components/pagination/types.d.ts +1 -22
- package/dist/types/vue/src/components/pagination/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/pagination/utils/ranges.d.ts +1 -2
- package/dist/types/vue/src/components/pagination/utils/ranges.d.ts.map +1 -1
- package/dist/types/vue/src/components/password-input/PasswordInput.vue.d.ts +4 -1
- package/dist/types/vue/src/components/password-input/PasswordInput.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/qr-code/export.d.ts +1 -2
- package/dist/types/vue/src/components/qr-code/export.d.ts.map +1 -1
- package/dist/types/vue/src/components/range-calendar/utils/limit.d.ts +1 -2
- package/dist/types/vue/src/components/range-calendar/utils/limit.d.ts.map +1 -1
- package/dist/types/vue/src/components/range-slider/RangeSlider.vue.d.ts +2 -2
- package/dist/types/vue/src/components/rating/utils/fill.d.ts +1 -1
- package/dist/types/vue/src/components/rating/utils/fill.d.ts.map +1 -1
- package/dist/types/vue/src/components/ripple/useRipple.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/ScrollArea.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/composables/useEdgeShadow.d.ts +2 -1
- package/dist/types/vue/src/components/scroll-area/composables/useEdgeShadow.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/composables/useLayerLock.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/composables/useWheelRedirect.d.ts.map +1 -1
- package/dist/types/vue/src/components/scroll-area/scroll-restore.d.ts +1 -33
- package/dist/types/vue/src/components/scroll-area/scroll-restore.d.ts.map +1 -1
- package/dist/types/vue/src/components/search-input/SearchInput.vue.d.ts +4 -1
- package/dist/types/vue/src/components/search-input/SearchInput.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/select/types.d.ts +1 -13
- package/dist/types/vue/src/components/select/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/slider/Slider.vue.d.ts +2 -2
- package/dist/types/vue/src/components/split-button/split-button.variants.d.ts +1 -1
- package/dist/types/vue/src/components/split-button/split-button.variants.d.ts.map +1 -1
- package/dist/types/vue/src/components/spoiler/SpoilerPainter.d.ts +1 -34
- package/dist/types/vue/src/components/spoiler/SpoilerPainter.d.ts.map +1 -1
- package/dist/types/vue/src/components/spoiler/utils/irisOrigin.d.ts +1 -5
- package/dist/types/vue/src/components/spoiler/utils/irisOrigin.d.ts.map +1 -1
- package/dist/types/vue/src/components/spoiler/worklet.d.ts +1 -1
- package/dist/types/vue/src/components/spoiler/worklet.d.ts.map +1 -1
- package/dist/types/vue/src/components/table/Table.vue.d.ts +6 -3
- package/dist/types/vue/src/components/table/Table.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/tabs/TabsList.vue.d.ts +6 -3
- package/dist/types/vue/src/components/tabs/TabsList.vue.d.ts.map +1 -1
- package/dist/types/vue/src/components/time/utils/relativeTime.d.ts +1 -1
- package/dist/types/vue/src/components/time/utils/relativeTime.d.ts.map +1 -1
- package/dist/types/vue/src/components/toast/composables/useToastLayout.d.ts +4 -11
- package/dist/types/vue/src/components/toast/composables/useToastLayout.d.ts.map +1 -1
- package/dist/types/vue/src/components/toast/store.d.ts +14 -62
- package/dist/types/vue/src/components/toast/store.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree/composables/useTree.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree/types.d.ts +1 -17
- package/dist/types/vue/src/components/tree/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree/utils/selection.d.ts +1 -15
- package/dist/types/vue/src/components/tree/utils/selection.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree-select/types.d.ts +1 -9
- package/dist/types/vue/src/components/tree-select/types.d.ts.map +1 -1
- package/dist/types/vue/src/components/tree-select/utils/filterTree.d.ts +1 -6
- package/dist/types/vue/src/components/tree-select/utils/filterTree.d.ts.map +1 -1
- package/dist/types/vue/src/components/virtual-list/composables/useVirtualList.d.ts +1 -1
- package/dist/types/vue/src/components/virtual-list/composables/useVirtualList.d.ts.map +1 -1
- package/dist/types/vue/src/components/visually-hidden/VisuallyHidden.vue.d.ts +4 -1
- package/dist/types/vue/src/components/visually-hidden/VisuallyHidden.vue.d.ts.map +1 -1
- package/dist/types/vue/src/lib/caret.d.ts +1 -1
- package/dist/types/vue/src/lib/caret.d.ts.map +1 -1
- package/dist/types/vue/src/lib/collapse.d.ts +2 -8
- package/dist/types/vue/src/lib/collapse.d.ts.map +1 -1
- package/dist/types/vue/src/lib/date.d.ts +1 -27
- package/dist/types/vue/src/lib/date.d.ts.map +1 -1
- package/dist/types/vue/src/lib/field-focus.d.ts +1 -1
- package/dist/types/vue/src/lib/field-focus.d.ts.map +1 -1
- package/dist/types/vue/src/lib/overlay-anchor.d.ts +2 -7
- package/dist/types/vue/src/lib/overlay-anchor.d.ts.map +1 -1
- package/dist/types/vue/src/lib/pointer-corridor.d.ts +1 -6
- package/dist/types/vue/src/lib/pointer-corridor.d.ts.map +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts +3 -11
- package/dist/types/vue/src/lib/reka/useVirtualChoices.d.ts.map +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts +1 -1
- package/dist/types/vue/src/lib/reka/useVirtualTree.d.ts.map +1 -1
- package/dist/types/vue/src/lib/virtual/navigation.d.ts +1 -2
- package/dist/types/vue/src/lib/virtual/navigation.d.ts.map +1 -1
- package/dist/types/vue/src/lib/virtual/useVirtualCollection.d.ts +1 -1
- package/dist/types/vue/src/lib/virtual/useVirtualCollection.d.ts.map +1 -1
- package/dist/types/vue/src/lib/virtual/useVirtualWindow.d.ts +2 -15
- package/dist/types/vue/src/lib/virtual/useVirtualWindow.d.ts.map +1 -1
- package/dist/types/vue/src/locale/en-US.d.ts +1 -2
- package/dist/types/vue/src/locale/en-US.d.ts.map +1 -1
- package/dist/types/vue/src/locale/index.d.ts +3 -4
- package/dist/types/vue/src/locale/index.d.ts.map +1 -1
- package/dist/types/vue/src/locale/types.d.ts +1 -234
- package/dist/types/vue/src/locale/types.d.ts.map +1 -1
- package/dist/types/vue/src/locale/zh-CN.d.ts +1 -2
- package/dist/types/vue/src/locale/zh-CN.d.ts.map +1 -1
- package/dist/types/vue/src/primitives/number-field/NumberFieldDecrement.vue.d.ts +17 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldDecrement.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldIncrement.vue.d.ts +17 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldIncrement.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldInput.vue.d.ts +16 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldInput.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts +47 -0
- package/dist/types/vue/src/primitives/number-field/NumberFieldRoot.vue.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/context.d.ts +41 -0
- package/dist/types/vue/src/primitives/number-field/context.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/number-field/index.d.ts +5 -0
- package/dist/types/vue/src/primitives/number-field/index.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/timers.d.ts +6 -0
- package/dist/types/vue/src/primitives/utils/timers.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/usePrimitiveElement.d.ts +6 -0
- package/dist/types/vue/src/primitives/utils/usePrimitiveElement.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/utils/useVModel.d.ts +7 -0
- package/dist/types/vue/src/primitives/utils/useVModel.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInput.d.ts +66 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInput.d.ts.map +1 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue.d.ts +28 -0
- package/dist/types/vue/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/components/accordion/AccordionTrigger.vue +9 -1
- package/src/components/anchor/composables/useAnchor.ts +3 -12
- package/src/components/anchor/composables/useAnchorFollow.ts +8 -76
- package/src/components/anchor/composables/useScrollSpy.ts +22 -38
- package/src/components/anchor/types.ts +1 -8
- package/src/components/autocomplete/autocomplete.variants.ts +1 -1
- package/src/components/autocomplete/composables/useAutocomplete.ts +1 -1
- package/src/components/autocomplete/types.ts +1 -16
- package/src/components/banner/utils/direction.ts +1 -10
- package/src/components/calendar/utils/format.ts +1 -23
- package/src/components/code-block/highlighter.ts +1 -98
- package/src/components/collapsible/CollapsibleTrigger.vue +8 -1
- package/src/components/command-palette/utils/hotkey.ts +1 -27
- package/src/components/command-palette/utils/match.ts +5 -75
- package/src/components/data-list/composables/useDataList.ts +2 -4
- package/src/components/data-list/utils/scroll.ts +1 -26
- package/src/components/data-table/column-sizing-styles.ts +1 -40
- package/src/components/data-table/column-sizing.ts +1 -101
- package/src/components/data-table/composables/useDataTable.ts +103 -123
- package/src/components/data-table/composables/useTableColumns.ts +38 -113
- package/src/components/data-table/composables/useTableDrag.ts +21 -11
- package/src/components/data-table/composables/useTableExport.ts +8 -32
- package/src/components/data-table/composables/useTableResize.ts +13 -17
- package/src/components/data-table/composables/useTableResizeHandles.ts +6 -21
- package/src/components/data-table/types.ts +15 -155
- package/src/components/data-table/utils.ts +1 -75
- package/src/components/date-range-field/utils/validity.ts +1 -21
- package/src/components/editable/editable.variants.ts +1 -1
- package/src/components/file-upload/utils/select.ts +1 -58
- package/src/components/file-upload/utils/size.ts +1 -16
- package/src/components/float-button/float-button.variants.ts +1 -1
- package/src/components/form/composables/useForm.ts +24 -135
- package/src/components/form/standard-schema.ts +1 -26
- package/src/components/form/utils/errors.ts +1 -48
- package/src/components/form/utils/focus.ts +1 -10
- package/src/components/form/utils/values.ts +1 -23
- package/src/components/form-field/FormField.vue +3 -2
- package/src/components/lightbox/types.ts +1 -14
- package/src/components/lightbox/utils/clip.ts +1 -117
- package/src/components/lightbox/utils/download.ts +1 -29
- package/src/components/lightbox/utils/gesture.ts +1 -54
- package/src/components/lightbox/utils/paging.ts +1 -33
- package/src/components/lightbox/utils/pose.ts +1 -142
- package/src/components/lightbox/utils/source.ts +1 -17
- package/src/components/lightbox/utils/zoom.ts +1 -127
- package/src/components/meter-group/utils/tones.ts +1 -14
- package/src/components/multi-select/MultiSelect.vue +1 -2
- package/src/components/number-input/NumberInput.vue +2 -2
- package/src/components/pagination/composables/usePagination.ts +2 -3
- package/src/components/pagination/types.ts +1 -19
- package/src/components/pagination/utils/ranges.ts +1 -12
- package/src/components/password-input/PasswordInput.vue +6 -0
- package/src/components/qr-code/export.ts +1 -65
- package/src/components/range-calendar/utils/limit.ts +1 -11
- package/src/components/rating/utils/fill.ts +1 -4
- package/src/components/ripple/useRipple.ts +10 -198
- package/src/components/scroll-area/ScrollArea.vue +6 -18
- package/src/components/scroll-area/composables/useEdgeShadow.ts +7 -16
- package/src/components/scroll-area/composables/useLayerLock.ts +2 -9
- package/src/components/scroll-area/composables/useWheelRedirect.ts +2 -10
- package/src/components/scroll-area/scroll-restore.ts +1 -148
- package/src/components/search-input/SearchInput.vue +6 -0
- package/src/components/select/types.ts +1 -23
- package/src/components/split-button/split-button.variants.ts +1 -1
- package/src/components/spoiler/SpoilerPainter.ts +1 -197
- package/src/components/spoiler/utils/irisOrigin.ts +1 -40
- package/src/components/spoiler/worklet.ts +1 -199
- package/src/components/table/Table.vue +9 -0
- package/src/components/tabs/TabsList.vue +9 -0
- package/src/components/time/utils/relativeTime.ts +1 -20
- package/src/components/toast/composables/useToastLayout.ts +12 -24
- package/src/components/toast/store.ts +16 -228
- package/src/components/tree/composables/useTree.ts +17 -33
- package/src/components/tree/types.ts +1 -20
- package/src/components/tree/utils/selection.ts +1 -78
- package/src/components/tree-select/types.ts +1 -34
- package/src/components/tree-select/utils/filterTree.ts +1 -19
- package/src/components/virtual-list/composables/useVirtualList.ts +16 -42
- package/src/components/visually-hidden/VisuallyHidden.vue +21 -3
- package/src/lib/caret.ts +1 -48
- package/src/lib/collapse.ts +6 -29
- package/src/lib/date.ts +1 -111
- package/src/lib/field-focus.ts +1 -36
- package/src/lib/overlay-anchor.ts +11 -37
- package/src/lib/pointer-corridor.ts +1 -26
- package/src/lib/reka/useVirtualChoices.ts +55 -133
- package/src/lib/reka/useVirtualTree.ts +22 -65
- package/src/lib/virtual/navigation.ts +1 -26
- package/src/lib/virtual/useVirtualCollection.ts +28 -47
- package/src/lib/virtual/useVirtualWindow.ts +15 -25
- package/src/locale/en-US.ts +1 -220
- package/src/locale/index.ts +9 -53
- package/src/locale/types.ts +1 -225
- package/src/locale/zh-CN.ts +1 -215
- package/src/primitives/number-field/LICENSE +21 -0
- package/src/primitives/number-field/NumberFieldDecrement.vue +21 -0
- package/src/primitives/number-field/NumberFieldIncrement.vue +21 -0
- package/src/primitives/number-field/NumberFieldInput.vue +114 -0
- package/src/primitives/number-field/NumberFieldRoot.vue +169 -0
- package/src/primitives/number-field/context.ts +111 -0
- package/src/primitives/number-field/index.ts +14 -0
- package/src/primitives/utils/LICENSE +44 -0
- package/src/primitives/utils/timers.ts +6 -0
- package/src/primitives/utils/usePrimitiveElement.ts +12 -0
- package/src/primitives/utils/useVModel.ts +37 -0
- package/src/primitives/visually-hidden/LICENSE +21 -0
- package/src/primitives/visually-hidden/VisuallyHiddenInput.ts +97 -0
- package/src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue +49 -0
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { clsx } from "clsx";
|
|
2
2
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
3
3
|
import { createTV } from "tailwind-variants";
|
|
4
|
-
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, openBlock, provide, reactive, ref, render, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toRaw, toRef, toValue, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, vModelDynamic, vModelSelect, vModelText, vShow, watch, watchEffect, watchPostEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
5
|
-
import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogPortal, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, AspectRatio, CalendarCell, CalendarCellTrigger, CalendarGrid, CalendarGridBody, CalendarGridHead, CalendarGridRow, CalendarHeadCell, CalendarNext, CalendarPrev, CalendarRoot, CheckboxGroupRoot, CheckboxRoot, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ComboboxAnchor, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxPortal, ComboboxRoot, ComboboxTrigger, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuItemIndicator, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuRoot, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateFieldInput, DateFieldRoot, DateRangeFieldInput, DateRangeFieldRoot, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCardContent, HoverCardPortal, HoverCardRoot, HoverCardTrigger, ListboxContent, ListboxFilter, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, ListboxRoot, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarItemIndicator, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarRoot, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthPickerCell, MonthPickerCellTrigger, MonthPickerGrid, MonthPickerGridBody, MonthPickerGridRow, MonthPickerNext, MonthPickerPrev, MonthPickerRoot, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport,
|
|
4
|
+
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, openBlock, provide, reactive, ref, render, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toRaw, toRef, toRefs, toValue, unref, useAttrs, useId, useModel, useSlots, useTemplateRef, vModelDynamic, vModelSelect, vModelText, vShow, watch, watchEffect, watchPostEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
5
|
+
import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogPortal, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, AspectRatio, CalendarCell, CalendarCellTrigger, CalendarGrid, CalendarGridBody, CalendarGridHead, CalendarGridRow, CalendarHeadCell, CalendarNext, CalendarPrev, CalendarRoot, CheckboxGroupRoot, CheckboxRoot, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ComboboxAnchor, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxPortal, ComboboxRoot, ComboboxTrigger, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuItemIndicator, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuRoot, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateFieldInput, DateFieldRoot, DateRangeFieldInput, DateRangeFieldRoot, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCardContent, HoverCardPortal, HoverCardRoot, HoverCardTrigger, ListboxContent, ListboxFilter, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, ListboxRoot, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarItemIndicator, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarRoot, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthPickerCell, MonthPickerCellTrigger, MonthPickerGrid, MonthPickerGridBody, MonthPickerGridRow, MonthPickerNext, MonthPickerPrev, MonthPickerRoot, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, PaginationFirst, PaginationLast, PaginationList, PaginationListItem, PaginationNext, PaginationPrev, PaginationRoot, PinInputInput, PinInputRoot, PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, Primitive, ProgressIndicator, ProgressRoot, RadioGroupItem, RadioGroupRoot, RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, RangeCalendarGridBody, RangeCalendarGridHead, RangeCalendarGridRow, RangeCalendarHeadCell, RangeCalendarNext, RangeCalendarPrev, RangeCalendarRoot, RatingItem, RatingItemIndicator, RatingRoot, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectTrigger, Separator, SliderRoot, SliderThumb, SliderTrack, SplitterGroup, SplitterPanel, SplitterResizeHandle, StepperDescription, StepperIndicator, StepperItem, StepperRoot, StepperSeparator, StepperTitle, StepperTrigger, SwitchRoot, TabsContent, TabsList, TabsRoot, TabsTrigger, TagsInputInput, TagsInputItem, TagsInputItemText, TagsInputRoot, TimeFieldInput, TimeFieldRoot, ToastClose, ToastDescription, ToastPortal, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Toggle, ToggleGroupItem, ToggleGroupRoot, ToolbarButton, ToolbarRoot, ToolbarToggleGroup, ToolbarToggleItem, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TreeItem, TreeRoot, VisuallyHidden, YearPickerCell, YearPickerCellTrigger, YearPickerGrid, YearPickerGridBody, YearPickerGridRow, YearPickerNext, YearPickerPrev, YearPickerRoot, injectCollapsibleRootContext, injectComboboxRootContext, injectConfigProviderContext, injectDialogRootContext, injectHoverCardRootContext, injectListboxItemContext, injectListboxRootContext, injectPopoverRootContext, injectSelectRootContext, injectTabsRootContext, injectTooltipProviderContext, injectTooltipRootContext, injectTreeRootContext, useBodyScrollLock, useDirection, useFilter, useForwardExpose, useForwardPropsEmits, useId as useId$1 } from "reka-ui";
|
|
6
6
|
import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, CalendarClock, CalendarDays, CalendarRange, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, CircleAlert, CircleCheck, CircleX, Copy, Download, Eye, EyeOff, File, GripVertical, Inbox, Info, LayoutGrid, Lightbulb, List, Megaphone, Minus, MoreHorizontal, PanelLeft, Pause, Pencil, Play, QrCode, RefreshCw, RotateCw, Scan, Search, Shrink, Star, TrendingDown, TrendingUp, TriangleAlert, Upload, User, X, ZoomIn, ZoomOut } from "@lucide/vue";
|
|
7
7
|
import { createSharedComposable, defaultDocument, useDocumentVisibility, useElementBounding, useEventListener, useIntersectionObserver, useIntervalFn, useMediaQuery, useMutationObserver, usePreferredReducedMotion, useRafFn, useResizeObserver, useVModel, useWindowSize } from "@vueuse/core";
|
|
8
8
|
import { Motion, animate, useMotionValue, useTransform } from "motion-v";
|
|
9
9
|
import { defaultRangeExtractor, measureElement, observeElementRect, useVirtualizer } from "@tanstack/vue-virtual";
|
|
10
|
+
import { NumberFormatter, NumberParser } from "@internationalized/number";
|
|
10
11
|
import { CalendarDate, CalendarDateTime, Time, getLocalTimeZone, parseDate, parseDateTime, parseTime, today } from "@internationalized/date";
|
|
11
12
|
import { columnFilteringFeature, columnGroupingFeature, columnVisibilityFeature, createExpandedRowModel, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, globalFilteringFeature, rowExpandingFeature, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, tableFeatures, useTable } from "@tanstack/vue-table";
|
|
12
13
|
import { encode } from "uqr";
|
|
@@ -128,7 +129,7 @@ function prefersReducedMotion() {
|
|
|
128
129
|
return typeof window !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
129
130
|
}
|
|
130
131
|
//#endregion
|
|
131
|
-
//#region src/locale/zh-CN.ts
|
|
132
|
+
//#region ../shared/src/locale/zh-CN.ts
|
|
132
133
|
var zhCN = {
|
|
133
134
|
qrCode: {
|
|
134
135
|
label: "二维码",
|
|
@@ -329,7 +330,7 @@ var zhCN = {
|
|
|
329
330
|
}
|
|
330
331
|
};
|
|
331
332
|
//#endregion
|
|
332
|
-
//#region src/locale/en-US.ts
|
|
333
|
+
//#region ../shared/src/locale/en-US.ts
|
|
333
334
|
var enUS = {
|
|
334
335
|
qrCode: {
|
|
335
336
|
label: "QR code",
|
|
@@ -530,10 +531,8 @@ var enUS = {
|
|
|
530
531
|
}
|
|
531
532
|
};
|
|
532
533
|
//#endregion
|
|
533
|
-
//#region src/locale/index.ts
|
|
534
|
-
|
|
535
|
-
var fallbackLocale = computed(() => zhCN);
|
|
536
|
-
function merge(base, patch) {
|
|
534
|
+
//#region ../shared/src/locale/index.ts
|
|
535
|
+
function mergeUiMessages(base, patch) {
|
|
537
536
|
return {
|
|
538
537
|
qrCode: {
|
|
539
538
|
...base.qrCode,
|
|
@@ -702,8 +701,12 @@ function merge(base, patch) {
|
|
|
702
701
|
}
|
|
703
702
|
};
|
|
704
703
|
}
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region src/locale/index.ts
|
|
706
|
+
var UI_LOCALE_KEY = Symbol("hn-ui-locale");
|
|
707
|
+
var fallbackLocale = computed(() => zhCN);
|
|
705
708
|
function provideUiLocale(messages) {
|
|
706
|
-
const resolved = computed(() =>
|
|
709
|
+
const resolved = computed(() => mergeUiMessages(zhCN, toValue(messages)));
|
|
707
710
|
provide(UI_LOCALE_KEY, resolved);
|
|
708
711
|
return resolved;
|
|
709
712
|
}
|
|
@@ -920,7 +923,7 @@ var IconSlot_default$1 = /* @__PURE__ */ defineComponent({
|
|
|
920
923
|
}
|
|
921
924
|
});
|
|
922
925
|
//#endregion
|
|
923
|
-
//#region src/
|
|
926
|
+
//#region ../shared/src/behavior/ripple.ts
|
|
924
927
|
var INITIAL_ORIGIN_SCALE = .2;
|
|
925
928
|
var PADDING = 12;
|
|
926
929
|
var SOFT_EDGE_MINIMUM_SIZE = 75;
|
|
@@ -934,8 +937,7 @@ var STATE = {
|
|
|
934
937
|
holding: 2,
|
|
935
938
|
waitingForClick: 3
|
|
936
939
|
};
|
|
937
|
-
function
|
|
938
|
-
const pressed = ref(false);
|
|
940
|
+
function createRipple(options) {
|
|
939
941
|
let host = null;
|
|
940
942
|
let state = STATE.inactive;
|
|
941
943
|
let startEvent;
|
|
@@ -944,20 +946,28 @@ function useRipple(container, surface, isDisabled) {
|
|
|
944
946
|
let initialSize = 0;
|
|
945
947
|
let rippleScale = "";
|
|
946
948
|
let rippleSize = "";
|
|
949
|
+
const timers = /* @__PURE__ */ new Set();
|
|
950
|
+
function later(callback, ms) {
|
|
951
|
+
const timer = window.setTimeout(() => {
|
|
952
|
+
timers.delete(timer);
|
|
953
|
+
callback();
|
|
954
|
+
}, ms);
|
|
955
|
+
timers.add(timer);
|
|
956
|
+
}
|
|
947
957
|
const isTouch = ({ pointerType }) => pointerType === "touch";
|
|
948
958
|
function shouldReact(event) {
|
|
949
|
-
if (
|
|
959
|
+
if (options.disabled() || !event.isPrimary) return false;
|
|
950
960
|
if (startEvent && startEvent.pointerId !== event.pointerId) return false;
|
|
951
961
|
if (event.type === "pointerenter" || event.type === "pointerleave") return !isTouch(event);
|
|
952
962
|
return isTouch(event) || event.buttons === 1;
|
|
953
963
|
}
|
|
954
964
|
function inBounds({ x, y }) {
|
|
955
|
-
const rect = container
|
|
965
|
+
const rect = options.container()?.getBoundingClientRect();
|
|
956
966
|
if (!rect) return false;
|
|
957
967
|
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
|
958
968
|
}
|
|
959
969
|
function determineRippleSize() {
|
|
960
|
-
const rect = container
|
|
970
|
+
const rect = options.container()?.getBoundingClientRect();
|
|
961
971
|
if (!rect) return;
|
|
962
972
|
const maxDim = Math.max(rect.height, rect.width);
|
|
963
973
|
const softEdgeSize = Math.max(SOFT_EDGE_CONTAINER_RATIO * maxDim, SOFT_EDGE_MINIMUM_SIZE);
|
|
@@ -966,7 +976,7 @@ function useRipple(container, surface, isDisabled) {
|
|
|
966
976
|
rippleSize = `${initialSize}px`;
|
|
967
977
|
}
|
|
968
978
|
function normalizedCoords(event) {
|
|
969
|
-
const rect = container
|
|
979
|
+
const rect = options.container()?.getBoundingClientRect();
|
|
970
980
|
if (!rect) return {
|
|
971
981
|
x: 0,
|
|
972
982
|
y: 0
|
|
@@ -977,7 +987,7 @@ function useRipple(container, surface, isDisabled) {
|
|
|
977
987
|
};
|
|
978
988
|
}
|
|
979
989
|
function translationCoords(positionEvent) {
|
|
980
|
-
const rect = container
|
|
990
|
+
const rect = options.container()?.getBoundingClientRect();
|
|
981
991
|
if (!rect) return {
|
|
982
992
|
startPoint: {
|
|
983
993
|
x: 0,
|
|
@@ -998,9 +1008,9 @@ function useRipple(container, surface, isDisabled) {
|
|
|
998
1008
|
};
|
|
999
1009
|
}
|
|
1000
1010
|
function startPress(positionEvent) {
|
|
1001
|
-
const el = surface
|
|
1011
|
+
const el = options.surface();
|
|
1002
1012
|
if (!el) return;
|
|
1003
|
-
|
|
1013
|
+
options.onPressedChange(true);
|
|
1004
1014
|
growAnimation?.cancel();
|
|
1005
1015
|
growAnimation = void 0;
|
|
1006
1016
|
determineRippleSize();
|
|
@@ -1027,12 +1037,12 @@ function useRipple(container, surface, isDisabled) {
|
|
|
1027
1037
|
if (typeof animation?.currentTime === "number") playedMs = animation.currentTime;
|
|
1028
1038
|
else if (animation?.currentTime) playedMs = animation.currentTime.to("ms").value;
|
|
1029
1039
|
if (playedMs >= MINIMUM_PRESS_MS) {
|
|
1030
|
-
|
|
1040
|
+
options.onPressedChange(false);
|
|
1031
1041
|
return;
|
|
1032
1042
|
}
|
|
1033
|
-
|
|
1043
|
+
later(() => {
|
|
1034
1044
|
if (growAnimation !== animation) return;
|
|
1035
|
-
|
|
1045
|
+
options.onPressedChange(false);
|
|
1036
1046
|
}, MINIMUM_PRESS_MS - playedMs);
|
|
1037
1047
|
}
|
|
1038
1048
|
function onPointerDown(event) {
|
|
@@ -1046,7 +1056,7 @@ function useRipple(container, surface, isDisabled) {
|
|
|
1046
1056
|
if (checkBoundsAfterContextMenu && !inBounds(event)) return;
|
|
1047
1057
|
checkBoundsAfterContextMenu = false;
|
|
1048
1058
|
state = STATE.touchDelay;
|
|
1049
|
-
|
|
1059
|
+
later(() => {
|
|
1050
1060
|
if (state !== STATE.touchDelay) return;
|
|
1051
1061
|
state = STATE.holding;
|
|
1052
1062
|
startPress(event);
|
|
@@ -1072,7 +1082,7 @@ function useRipple(container, surface, isDisabled) {
|
|
|
1072
1082
|
endPress();
|
|
1073
1083
|
}
|
|
1074
1084
|
function onClick() {
|
|
1075
|
-
if (
|
|
1085
|
+
if (options.disabled()) return;
|
|
1076
1086
|
if (state === STATE.waitingForClick) {
|
|
1077
1087
|
endPress();
|
|
1078
1088
|
return;
|
|
@@ -1083,7 +1093,7 @@ function useRipple(container, surface, isDisabled) {
|
|
|
1083
1093
|
}
|
|
1084
1094
|
}
|
|
1085
1095
|
function onContextMenu() {
|
|
1086
|
-
if (
|
|
1096
|
+
if (options.disabled()) return;
|
|
1087
1097
|
checkBoundsAfterContextMenu = true;
|
|
1088
1098
|
endPress();
|
|
1089
1099
|
}
|
|
@@ -1095,16 +1105,37 @@ function useRipple(container, surface, isDisabled) {
|
|
|
1095
1105
|
["pointerleave", onPointerLeave],
|
|
1096
1106
|
["pointerup", onPointerUp]
|
|
1097
1107
|
];
|
|
1098
|
-
|
|
1099
|
-
host = container
|
|
1108
|
+
function connect() {
|
|
1109
|
+
host = options.container()?.parentElement ?? null;
|
|
1100
1110
|
if (!host) return;
|
|
1101
1111
|
for (const [name, fn] of listeners) host.addEventListener(name, fn, true);
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1112
|
+
}
|
|
1113
|
+
function disconnect() {
|
|
1114
|
+
for (const timer of timers) window.clearTimeout(timer);
|
|
1115
|
+
timers.clear();
|
|
1104
1116
|
if (!host) return;
|
|
1105
1117
|
for (const [name, fn] of listeners) host.removeEventListener(name, fn, true);
|
|
1106
1118
|
host = null;
|
|
1119
|
+
}
|
|
1120
|
+
return {
|
|
1121
|
+
connect,
|
|
1122
|
+
disconnect
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
//#endregion
|
|
1126
|
+
//#region src/components/ripple/useRipple.ts
|
|
1127
|
+
function useRipple(container, surface, isDisabled) {
|
|
1128
|
+
const pressed = ref(false);
|
|
1129
|
+
const ripple = createRipple({
|
|
1130
|
+
container: () => container.value,
|
|
1131
|
+
surface: () => surface.value,
|
|
1132
|
+
disabled: isDisabled,
|
|
1133
|
+
onPressedChange: (value) => {
|
|
1134
|
+
pressed.value = value;
|
|
1135
|
+
}
|
|
1107
1136
|
});
|
|
1137
|
+
onMounted(ripple.connect);
|
|
1138
|
+
onBeforeUnmount(ripple.disconnect);
|
|
1108
1139
|
return { pressed };
|
|
1109
1140
|
}
|
|
1110
1141
|
//#endregion
|
|
@@ -2244,13 +2275,40 @@ function useOverlayPortal(open) {
|
|
|
2244
2275
|
};
|
|
2245
2276
|
}
|
|
2246
2277
|
//#endregion
|
|
2247
|
-
//#region src/lib/overlay-anchor.ts
|
|
2278
|
+
//#region ../shared/src/lib/overlay-anchor.ts
|
|
2248
2279
|
function overlayAnchorElement(anchor) {
|
|
2249
2280
|
return anchor && "nodeType" in anchor ? anchor : void 0;
|
|
2250
2281
|
}
|
|
2251
2282
|
function overlayAnchorContext(anchor) {
|
|
2252
2283
|
return overlayAnchorElement(anchor) ?? (anchor && "contextElement" in anchor ? anchor.contextElement : void 0);
|
|
2253
2284
|
}
|
|
2285
|
+
function createOverlayReference(anchor, current) {
|
|
2286
|
+
const contextElement = overlayAnchorContext(anchor);
|
|
2287
|
+
if (contextElement && !contextElement.isConnected) return void 0;
|
|
2288
|
+
const measure = () => {
|
|
2289
|
+
const { x, y, width, height, top, right, bottom, left } = anchor.getBoundingClientRect();
|
|
2290
|
+
return {
|
|
2291
|
+
x,
|
|
2292
|
+
y,
|
|
2293
|
+
width,
|
|
2294
|
+
height,
|
|
2295
|
+
top,
|
|
2296
|
+
right,
|
|
2297
|
+
bottom,
|
|
2298
|
+
left
|
|
2299
|
+
};
|
|
2300
|
+
};
|
|
2301
|
+
let rect = measure();
|
|
2302
|
+
return {
|
|
2303
|
+
contextElement,
|
|
2304
|
+
getBoundingClientRect: () => {
|
|
2305
|
+
if (current() && (!contextElement || contextElement.isConnected)) rect = measure();
|
|
2306
|
+
return rect;
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
}
|
|
2310
|
+
//#endregion
|
|
2311
|
+
//#region src/lib/overlay-anchor.ts
|
|
2254
2312
|
function useOverlayAnchor(source, open, present, strategy, direction = () => void 0) {
|
|
2255
2313
|
const reference = shallowRef();
|
|
2256
2314
|
let current;
|
|
@@ -2267,30 +2325,10 @@ function useOverlayAnchor(source, open, present, strategy, direction = () => voi
|
|
|
2267
2325
|
return;
|
|
2268
2326
|
}
|
|
2269
2327
|
if (!anchor || !active && reference.value && anchor !== current) return;
|
|
2270
|
-
const
|
|
2271
|
-
if (
|
|
2328
|
+
const next = createOverlayReference(anchor, () => source() === anchor);
|
|
2329
|
+
if (!next) return;
|
|
2272
2330
|
current = anchor;
|
|
2273
|
-
|
|
2274
|
-
const { x, y, width, height, top, right, bottom, left } = anchor.getBoundingClientRect();
|
|
2275
|
-
return {
|
|
2276
|
-
x,
|
|
2277
|
-
y,
|
|
2278
|
-
width,
|
|
2279
|
-
height,
|
|
2280
|
-
top,
|
|
2281
|
-
right,
|
|
2282
|
-
bottom,
|
|
2283
|
-
left
|
|
2284
|
-
};
|
|
2285
|
-
};
|
|
2286
|
-
let rect = measure();
|
|
2287
|
-
reference.value = {
|
|
2288
|
-
contextElement,
|
|
2289
|
-
getBoundingClientRect: () => {
|
|
2290
|
-
if (source() === anchor && (!contextElement || contextElement.isConnected)) rect = measure();
|
|
2291
|
-
return rect;
|
|
2292
|
-
}
|
|
2293
|
-
};
|
|
2331
|
+
reference.value = next;
|
|
2294
2332
|
}, {
|
|
2295
2333
|
immediate: true,
|
|
2296
2334
|
flush: "post"
|
|
@@ -3159,12 +3197,36 @@ var Skeleton_default = /* @__PURE__ */ defineComponent({
|
|
|
3159
3197
|
var VisuallyHidden_default = /* @__PURE__ */ defineComponent({
|
|
3160
3198
|
name: "HnVisuallyHidden",
|
|
3161
3199
|
__name: "VisuallyHidden",
|
|
3200
|
+
props: {
|
|
3201
|
+
asChild: { type: Boolean },
|
|
3202
|
+
as: { default: "span" }
|
|
3203
|
+
},
|
|
3162
3204
|
setup(__props) {
|
|
3205
|
+
const props = __props;
|
|
3206
|
+
const hidden = {
|
|
3207
|
+
position: "absolute",
|
|
3208
|
+
border: 0,
|
|
3209
|
+
width: "1px",
|
|
3210
|
+
height: "1px",
|
|
3211
|
+
padding: 0,
|
|
3212
|
+
margin: "-1px",
|
|
3213
|
+
overflow: "hidden",
|
|
3214
|
+
clip: "rect(0, 0, 0, 0)",
|
|
3215
|
+
clipPath: "inset(50%)",
|
|
3216
|
+
whiteSpace: "nowrap",
|
|
3217
|
+
wordWrap: "normal",
|
|
3218
|
+
top: "-1px",
|
|
3219
|
+
left: "-1px"
|
|
3220
|
+
};
|
|
3163
3221
|
return (_ctx, _cache) => {
|
|
3164
|
-
return openBlock(), createBlock(unref(
|
|
3222
|
+
return openBlock(), createBlock(unref(Primitive), {
|
|
3223
|
+
as: props.as,
|
|
3224
|
+
"as-child": props.asChild,
|
|
3225
|
+
style: hidden
|
|
3226
|
+
}, {
|
|
3165
3227
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
3166
3228
|
_: 3
|
|
3167
|
-
});
|
|
3229
|
+
}, 8, ["as", "as-child"]);
|
|
3168
3230
|
};
|
|
3169
3231
|
}
|
|
3170
3232
|
});
|
|
@@ -3349,7 +3411,7 @@ var d = getApi("ResizeObserver");
|
|
|
3349
3411
|
var p = getApi("ScrollTimeline");
|
|
3350
3412
|
var isUndefined = (t) => t === void 0;
|
|
3351
3413
|
var isNull = (t) => t === null;
|
|
3352
|
-
var isNumber = (t) => typeof t === "number";
|
|
3414
|
+
var isNumber$1 = (t) => typeof t === "number";
|
|
3353
3415
|
var isString = (t) => typeof t === "string";
|
|
3354
3416
|
var isBoolean = (t) => typeof t === "boolean";
|
|
3355
3417
|
var isFunction = (t) => typeof t === "function";
|
|
@@ -3357,7 +3419,7 @@ var isArray = (t) => Array.isArray(t);
|
|
|
3357
3419
|
var isObject = (t) => typeof t === "object" && !isArray(t) && !isNull(t);
|
|
3358
3420
|
var isArrayLike = (t) => {
|
|
3359
3421
|
const n = !!t && t.length;
|
|
3360
|
-
const o = isNumber(n) && n > -1 && n % 1 == 0;
|
|
3422
|
+
const o = isNumber$1(n) && n > -1 && n % 1 == 0;
|
|
3361
3423
|
return isArray(t) || !isFunction(t) && o ? n > 0 && isObject(t) ? n - 1 in t : true : false;
|
|
3362
3424
|
};
|
|
3363
3425
|
var isPlainObject = (t) => !!t && t.constructor === Object;
|
|
@@ -3371,7 +3433,7 @@ function each(t, n) {
|
|
|
3371
3433
|
}
|
|
3372
3434
|
var inArray = (t, n) => t.indexOf(n) >= 0;
|
|
3373
3435
|
var concat = (t, n) => t.concat(n);
|
|
3374
|
-
var push
|
|
3436
|
+
var push = (t, n, o) => {
|
|
3375
3437
|
if (!isString(n) && isArrayLike(n)) Array.prototype.push.apply(t, n);
|
|
3376
3438
|
else t.push(n);
|
|
3377
3439
|
return t;
|
|
@@ -3436,7 +3498,7 @@ var selfClearTimeout = (t) => {
|
|
|
3436
3498
|
};
|
|
3437
3499
|
var getDebouncer = (t) => {
|
|
3438
3500
|
const n = isFunction(t) ? t() : t;
|
|
3439
|
-
if (isNumber(n)) {
|
|
3501
|
+
if (isNumber$1(n)) {
|
|
3440
3502
|
const t = n ? a : l;
|
|
3441
3503
|
const o = n ? u : i;
|
|
3442
3504
|
return (s) => {
|
|
@@ -3628,7 +3690,7 @@ function setStyles(t, n) {
|
|
|
3628
3690
|
t && n && each(n, ((n, o) => {
|
|
3629
3691
|
try {
|
|
3630
3692
|
const s = t.style;
|
|
3631
|
-
const e = isNull(n) || isBoolean(n) ? "" : isNumber(n) ? numberToCssPx(n) : n;
|
|
3693
|
+
const e = isNull(n) || isBoolean(n) ? "" : isNumber$1(n) ? numberToCssPx(n) : n;
|
|
3632
3694
|
if (o.indexOf("--") === 0) s.setProperty(o, e);
|
|
3633
3695
|
else s[o] = e;
|
|
3634
3696
|
} catch (s) {}
|
|
@@ -3722,12 +3784,12 @@ var stopPropagation = (t) => t.stopPropagation();
|
|
|
3722
3784
|
var preventDefault = (t) => t.preventDefault();
|
|
3723
3785
|
var stopAndPrevent = (t) => stopPropagation(t) || preventDefault(t);
|
|
3724
3786
|
var scrollElementTo = (t, n) => {
|
|
3725
|
-
const { x: o, y: s } = isNumber(n) ? {
|
|
3787
|
+
const { x: o, y: s } = isNumber$1(n) ? {
|
|
3726
3788
|
x: n,
|
|
3727
3789
|
y: n
|
|
3728
3790
|
} : n || {};
|
|
3729
|
-
isNumber(o) && (t.scrollLeft = o);
|
|
3730
|
-
isNumber(s) && (t.scrollTop = s);
|
|
3791
|
+
isNumber$1(o) && (t.scrollLeft = o);
|
|
3792
|
+
isNumber$1(s) && (t.scrollTop = s);
|
|
3731
3793
|
};
|
|
3732
3794
|
var getElementScroll = (t) => ({
|
|
3733
3795
|
x: t.scrollLeft,
|
|
@@ -3823,7 +3885,7 @@ var createEventListenerHub = (t) => {
|
|
|
3823
3885
|
const e = [];
|
|
3824
3886
|
each(s, ((n) => {
|
|
3825
3887
|
const o = t[n];
|
|
3826
|
-
if (o) push
|
|
3888
|
+
if (o) push(e, addEvent(n, o));
|
|
3827
3889
|
}));
|
|
3828
3890
|
return bind(runEachAndClear, e);
|
|
3829
3891
|
};
|
|
@@ -4107,7 +4169,7 @@ var createEventContentChange = (t, n, o) => {
|
|
|
4107
4169
|
e.delete(c);
|
|
4108
4170
|
} else n(o);
|
|
4109
4171
|
}));
|
|
4110
|
-
e.set(c, push
|
|
4172
|
+
e.set(c, push(i, t));
|
|
4111
4173
|
} else {
|
|
4112
4174
|
runEachAndClear(i);
|
|
4113
4175
|
e.delete(c);
|
|
@@ -4146,18 +4208,18 @@ var createDOMObserver = (t, n, o, s) => {
|
|
|
4146
4208
|
const n = b && C;
|
|
4147
4209
|
const a = n && l && is(c, l);
|
|
4148
4210
|
const p = (a ? !r(c, e, u, O) : !b || n) && !i(o, !!a, t, s);
|
|
4149
|
-
each(d, ((t) => push
|
|
4150
|
-
each(h, ((t) => push
|
|
4211
|
+
each(d, ((t) => push(f, t)));
|
|
4212
|
+
each(h, ((t) => push(f, t)));
|
|
4151
4213
|
g = g || p;
|
|
4152
4214
|
}
|
|
4153
4215
|
if (!n && w && C && !r(c, e, u, O)) {
|
|
4154
|
-
push
|
|
4216
|
+
push(_, e);
|
|
4155
4217
|
p = p || $;
|
|
4156
4218
|
}
|
|
4157
4219
|
}));
|
|
4158
4220
|
d(((t) => deduplicateArray(f).reduce(((n, o) => {
|
|
4159
|
-
push
|
|
4160
|
-
return is(o, t) ? push
|
|
4221
|
+
push(n, find(t, o));
|
|
4222
|
+
return is(o, t) ? push(n, o) : n;
|
|
4161
4223
|
}), [])));
|
|
4162
4224
|
if (n) {
|
|
4163
4225
|
if (!e && g) o(false);
|
|
@@ -4236,17 +4298,17 @@ var createSizeObserver = (t, n, o) => {
|
|
|
4236
4298
|
const resizeObserverCallback = (t) => n(t);
|
|
4237
4299
|
const s = new d(resizeObserverCallback);
|
|
4238
4300
|
s.observe(Rt ? t : l);
|
|
4239
|
-
push
|
|
4301
|
+
push(o, [() => {
|
|
4240
4302
|
s.disconnect();
|
|
4241
4303
|
}, !Rt && appendChildren(t, i)]);
|
|
4242
4304
|
if (Rt) {
|
|
4243
4305
|
const n = new d(resizeObserverCallback);
|
|
4244
4306
|
n.observe(t, { box: "border-box" });
|
|
4245
|
-
push
|
|
4307
|
+
push(o, (() => n.disconnect()));
|
|
4246
4308
|
}
|
|
4247
4309
|
} else if (e) {
|
|
4248
4310
|
const [n, c] = e(l, onSizeChangedCallbackProxy, s);
|
|
4249
|
-
push
|
|
4311
|
+
push(o, concat([
|
|
4250
4312
|
addClass(i, ot),
|
|
4251
4313
|
addEventListener(i, "animationstart", n),
|
|
4252
4314
|
appendChildren(t, i)
|
|
@@ -4273,7 +4335,7 @@ var createTrinsicObserver = (t, n) => {
|
|
|
4273
4335
|
if (_) {
|
|
4274
4336
|
o = new _(bind(intersectionObserverCallback, false), { root: t });
|
|
4275
4337
|
o.observe(s);
|
|
4276
|
-
push
|
|
4338
|
+
push(n, (() => {
|
|
4277
4339
|
o.disconnect();
|
|
4278
4340
|
}));
|
|
4279
4341
|
} else {
|
|
@@ -4281,10 +4343,10 @@ var createTrinsicObserver = (t, n) => {
|
|
|
4281
4343
|
const t = I(s);
|
|
4282
4344
|
triggerOnTrinsicChangedCallback(t);
|
|
4283
4345
|
};
|
|
4284
|
-
push
|
|
4346
|
+
push(n, createSizeObserver(s, onSizeChanged)());
|
|
4285
4347
|
onSizeChanged();
|
|
4286
4348
|
}
|
|
4287
|
-
return bind(runEachAndClear, push
|
|
4349
|
+
return bind(runEachAndClear, push(n, appendChildren(t, s)));
|
|
4288
4350
|
}, () => o && intersectionObserverCallback(true, o.takeRecords())];
|
|
4289
4351
|
};
|
|
4290
4352
|
var createObserversSetup = (t, n, o, s, sleeping) => {
|
|
@@ -4332,7 +4394,7 @@ var createObserversSetup = (t, n, o, s, sleeping) => {
|
|
|
4332
4394
|
t = s;
|
|
4333
4395
|
n = e;
|
|
4334
4396
|
o = r;
|
|
4335
|
-
} else if (isNumber(c)) {
|
|
4397
|
+
} else if (isNumber$1(c)) {
|
|
4336
4398
|
t = c;
|
|
4337
4399
|
n = false;
|
|
4338
4400
|
o = false;
|
|
@@ -4479,7 +4541,7 @@ var createObserversSetup = (t, n, o, s, sleeping) => {
|
|
|
4479
4541
|
}
|
|
4480
4542
|
if (m) {
|
|
4481
4543
|
z.O();
|
|
4482
|
-
if (isArray(y) || isNumber(y)) {
|
|
4544
|
+
if (isArray(y) || isNumber$1(y)) {
|
|
4483
4545
|
e = y;
|
|
4484
4546
|
c = false;
|
|
4485
4547
|
r = It;
|
|
@@ -4665,8 +4727,8 @@ var createScrollbarsSetupElements = (t, n, o, s) => {
|
|
|
4665
4727
|
kt: r
|
|
4666
4728
|
};
|
|
4667
4729
|
const l = C[n];
|
|
4668
|
-
push
|
|
4669
|
-
push
|
|
4730
|
+
push(t ? S : m, i);
|
|
4731
|
+
push(w, [
|
|
4670
4732
|
appendChildren(e, c),
|
|
4671
4733
|
appendChildren(c, r),
|
|
4672
4734
|
bind(removeElements, e),
|
|
@@ -4789,10 +4851,10 @@ var createScrollbarsSetupEvents = (t, n, o, s, r) => (i, l, u) => {
|
|
|
4789
4851
|
const { Vt: n } = o;
|
|
4790
4852
|
const s = t(scrollRelative, moveHandleRelative, bind(getHandleOffset), k, n[f], S, !!u, ((t) => {
|
|
4791
4853
|
if (t) V();
|
|
4792
|
-
else push
|
|
4854
|
+
else push(L, V);
|
|
4793
4855
|
}));
|
|
4794
|
-
push
|
|
4795
|
-
push
|
|
4856
|
+
push(L, s);
|
|
4857
|
+
push(_, bind(s, true));
|
|
4796
4858
|
}
|
|
4797
4859
|
}
|
|
4798
4860
|
}
|
|
@@ -4933,7 +4995,7 @@ var createScrollbarsSetup = (t, n, o, s, e, c, r) => {
|
|
|
4933
4995
|
];
|
|
4934
4996
|
const R = getStaticPluginModuleInstance(xt);
|
|
4935
4997
|
return [
|
|
4936
|
-
() => bind(runEachAndClear, push
|
|
4998
|
+
() => bind(runEachAndClear, push(M, C())),
|
|
4937
4999
|
({ Dt: t, It: n, Zt: o, tn: c }) => {
|
|
4938
5000
|
const { nn: r, sn: i, en: p, cn: v } = c || {};
|
|
4939
5001
|
const { Ct: g, ft: h } = o || {};
|
|
@@ -5107,7 +5169,7 @@ var createStructureSetupElements = (t) => {
|
|
|
5107
5169
|
appendChildren(W, J);
|
|
5108
5170
|
appendChildren(J || W, !H && Q);
|
|
5109
5171
|
appendChildren(Q, nt);
|
|
5110
|
-
push
|
|
5172
|
+
push(ot, [c, () => {
|
|
5111
5173
|
const t = getFocusedElement();
|
|
5112
5174
|
const n = elementIsGenerated(Q);
|
|
5113
5175
|
const e = n && t === Q ? Y : t;
|
|
@@ -5126,7 +5188,7 @@ var createStructureSetupElements = (t) => {
|
|
|
5126
5188
|
}]);
|
|
5127
5189
|
if (e && !H) {
|
|
5128
5190
|
addAttrClass(Q, j, K);
|
|
5129
|
-
push
|
|
5191
|
+
push(ot, bind(removeAttrs, Q, j));
|
|
5130
5192
|
}
|
|
5131
5193
|
focusElement(!H && g && n === Y && t.top === t ? Q : n);
|
|
5132
5194
|
c();
|
|
@@ -5699,7 +5761,7 @@ var OverlayScrollbars = (t, n, o) => {
|
|
|
5699
5761
|
sleep: h,
|
|
5700
5762
|
plugin: (t) => i[keys(t)[0]]
|
|
5701
5763
|
};
|
|
5702
|
-
push
|
|
5764
|
+
push(r, [S]);
|
|
5703
5765
|
addInstance(c, m);
|
|
5704
5766
|
registerPluginModuleInstances(k, OverlayScrollbars, [
|
|
5705
5767
|
m,
|
|
@@ -5710,7 +5772,7 @@ var OverlayScrollbars = (t, n, o) => {
|
|
|
5710
5772
|
destroy(true);
|
|
5711
5773
|
return m;
|
|
5712
5774
|
}
|
|
5713
|
-
push
|
|
5775
|
+
push(r, v());
|
|
5714
5776
|
triggerEvent("initialized", [m]);
|
|
5715
5777
|
m.update();
|
|
5716
5778
|
return m;
|
|
@@ -5805,6 +5867,81 @@ function useOverlayScrollbars(host, content, options) {
|
|
|
5805
5867
|
};
|
|
5806
5868
|
}
|
|
5807
5869
|
//#endregion
|
|
5870
|
+
//#region ../shared/src/lib/scroll-area.ts
|
|
5871
|
+
var NONE = {
|
|
5872
|
+
xStart: false,
|
|
5873
|
+
xEnd: false,
|
|
5874
|
+
yStart: false,
|
|
5875
|
+
yEnd: false
|
|
5876
|
+
};
|
|
5877
|
+
function scrollEdges(element, direction, shadow) {
|
|
5878
|
+
if (!element || !shadow) return NONE;
|
|
5879
|
+
const room = 1;
|
|
5880
|
+
const x = direction !== "vertical";
|
|
5881
|
+
const y = direction !== "horizontal";
|
|
5882
|
+
return {
|
|
5883
|
+
xStart: x && Math.abs(element.scrollLeft) > room,
|
|
5884
|
+
xEnd: x && Math.abs(element.scrollLeft) + element.clientWidth < element.scrollWidth - room,
|
|
5885
|
+
yStart: y && element.scrollTop > room,
|
|
5886
|
+
yEnd: y && element.scrollTop + element.clientHeight < element.scrollHeight - room
|
|
5887
|
+
};
|
|
5888
|
+
}
|
|
5889
|
+
function redirectWheel(element, event) {
|
|
5890
|
+
if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) return;
|
|
5891
|
+
const max = element.scrollWidth - element.clientWidth;
|
|
5892
|
+
if (max <= 0) return;
|
|
5893
|
+
const sign = getComputedStyle(element).direction === "rtl" ? -1 : 1;
|
|
5894
|
+
const offset = Math.max(0, Math.min(max, element.scrollLeft * sign));
|
|
5895
|
+
const atStart = offset <= 1 && event.deltaY < 0;
|
|
5896
|
+
const atEnd = offset >= max - 1 && event.deltaY > 0;
|
|
5897
|
+
if (atStart || atEnd) return;
|
|
5898
|
+
event.preventDefault();
|
|
5899
|
+
element.scrollLeft = (offset + event.deltaY) * sign;
|
|
5900
|
+
}
|
|
5901
|
+
function blockWhenInert(element) {
|
|
5902
|
+
const block = (event) => {
|
|
5903
|
+
if (getComputedStyle(element).pointerEvents === "none") event.preventDefault();
|
|
5904
|
+
};
|
|
5905
|
+
element.addEventListener("wheel", block, {
|
|
5906
|
+
passive: false,
|
|
5907
|
+
capture: true
|
|
5908
|
+
});
|
|
5909
|
+
element.addEventListener("touchmove", block, {
|
|
5910
|
+
passive: false,
|
|
5911
|
+
capture: true
|
|
5912
|
+
});
|
|
5913
|
+
return () => {
|
|
5914
|
+
element.removeEventListener("wheel", block, true);
|
|
5915
|
+
element.removeEventListener("touchmove", block, true);
|
|
5916
|
+
};
|
|
5917
|
+
}
|
|
5918
|
+
var SCROLL_AREA_OVERFLOW = {
|
|
5919
|
+
vertical: {
|
|
5920
|
+
x: "hidden",
|
|
5921
|
+
y: "scroll"
|
|
5922
|
+
},
|
|
5923
|
+
horizontal: {
|
|
5924
|
+
x: "scroll",
|
|
5925
|
+
y: "hidden"
|
|
5926
|
+
},
|
|
5927
|
+
both: {
|
|
5928
|
+
x: "scroll",
|
|
5929
|
+
y: "scroll"
|
|
5930
|
+
}
|
|
5931
|
+
};
|
|
5932
|
+
function scrollAreaOptions(options) {
|
|
5933
|
+
return {
|
|
5934
|
+
scrollbars: {
|
|
5935
|
+
theme: "os-theme-dark",
|
|
5936
|
+
visibility: options.scrollbar ? "auto" : "hidden",
|
|
5937
|
+
autoHide: options.autoHide,
|
|
5938
|
+
autoHideDelay: 800
|
|
5939
|
+
},
|
|
5940
|
+
overflow: SCROLL_AREA_OVERFLOW[options.direction],
|
|
5941
|
+
update: { elementEvents: [["img", "load"]] }
|
|
5942
|
+
};
|
|
5943
|
+
}
|
|
5944
|
+
//#endregion
|
|
5808
5945
|
//#region src/components/scroll-area/composables/useEdgeShadow.ts
|
|
5809
5946
|
function useEdgeShadow(viewport, opts) {
|
|
5810
5947
|
const showXStart = shallowRef(false);
|
|
@@ -5812,22 +5949,12 @@ function useEdgeShadow(viewport, opts) {
|
|
|
5812
5949
|
const showYStart = shallowRef(false);
|
|
5813
5950
|
const showYEnd = shallowRef(false);
|
|
5814
5951
|
function updateEdges() {
|
|
5815
|
-
const el = viewport.value;
|
|
5816
5952
|
const { direction, shadow } = opts();
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
return;
|
|
5823
|
-
}
|
|
5824
|
-
const room = 1;
|
|
5825
|
-
const x = direction !== "vertical";
|
|
5826
|
-
const y = direction !== "horizontal";
|
|
5827
|
-
showXStart.value = x && Math.abs(el.scrollLeft) > room;
|
|
5828
|
-
showXEnd.value = x && Math.abs(el.scrollLeft) + el.clientWidth < el.scrollWidth - room;
|
|
5829
|
-
showYStart.value = y && el.scrollTop > room;
|
|
5830
|
-
showYEnd.value = y && el.scrollTop + el.clientHeight < el.scrollHeight - room;
|
|
5953
|
+
const edges = scrollEdges(viewport.value, direction, shadow);
|
|
5954
|
+
showXStart.value = edges.xStart;
|
|
5955
|
+
showXEnd.value = edges.xEnd;
|
|
5956
|
+
showYStart.value = edges.yStart;
|
|
5957
|
+
showYEnd.value = edges.yEnd;
|
|
5831
5958
|
}
|
|
5832
5959
|
return {
|
|
5833
5960
|
showXStart,
|
|
@@ -5844,16 +5971,7 @@ function useWheelRedirect(viewport, enabled) {
|
|
|
5844
5971
|
if (event.defaultPrevented || !enabled()) return;
|
|
5845
5972
|
const el = viewport.value;
|
|
5846
5973
|
if (!el) return;
|
|
5847
|
-
|
|
5848
|
-
const max = el.scrollWidth - el.clientWidth;
|
|
5849
|
-
if (max <= 0) return;
|
|
5850
|
-
const sign = getComputedStyle(el).direction === "rtl" ? -1 : 1;
|
|
5851
|
-
const offset = Math.max(0, Math.min(max, el.scrollLeft * sign));
|
|
5852
|
-
const atStart = offset <= 1 && event.deltaY < 0;
|
|
5853
|
-
const atEnd = offset >= max - 1 && event.deltaY > 0;
|
|
5854
|
-
if (atStart || atEnd) return;
|
|
5855
|
-
event.preventDefault();
|
|
5856
|
-
el.scrollLeft = (offset + event.deltaY) * sign;
|
|
5974
|
+
redirectWheel(el, event);
|
|
5857
5975
|
}
|
|
5858
5976
|
watch(viewport, (el, _, onCleanup) => {
|
|
5859
5977
|
if (!el) return;
|
|
@@ -5885,21 +6003,7 @@ function useLayerLock(viewport) {
|
|
|
5885
6003
|
release = void 0;
|
|
5886
6004
|
const el = viewport.value;
|
|
5887
6005
|
if (!el || !locked.value) return;
|
|
5888
|
-
|
|
5889
|
-
if (getComputedStyle(el).pointerEvents === "none") event.preventDefault();
|
|
5890
|
-
};
|
|
5891
|
-
el.addEventListener("wheel", block, {
|
|
5892
|
-
passive: false,
|
|
5893
|
-
capture: true
|
|
5894
|
-
});
|
|
5895
|
-
el.addEventListener("touchmove", block, {
|
|
5896
|
-
passive: false,
|
|
5897
|
-
capture: true
|
|
5898
|
-
});
|
|
5899
|
-
release = () => {
|
|
5900
|
-
el.removeEventListener("wheel", block, true);
|
|
5901
|
-
el.removeEventListener("touchmove", block, true);
|
|
5902
|
-
};
|
|
6006
|
+
release = blockWhenInert(el);
|
|
5903
6007
|
}
|
|
5904
6008
|
watch([locked, viewport], apply, { flush: "post" });
|
|
5905
6009
|
onBeforeUnmount(() => release?.());
|
|
@@ -5971,31 +6075,12 @@ var ScrollArea_default = /* @__PURE__ */ defineComponent({
|
|
|
5971
6075
|
const t = useUiLocale();
|
|
5972
6076
|
const host = shallowRef();
|
|
5973
6077
|
const content = shallowRef();
|
|
5974
|
-
const overflow = {
|
|
5975
|
-
vertical: {
|
|
5976
|
-
x: "hidden",
|
|
5977
|
-
y: "scroll"
|
|
5978
|
-
},
|
|
5979
|
-
horizontal: {
|
|
5980
|
-
x: "scroll",
|
|
5981
|
-
y: "hidden"
|
|
5982
|
-
},
|
|
5983
|
-
both: {
|
|
5984
|
-
x: "scroll",
|
|
5985
|
-
y: "scroll"
|
|
5986
|
-
}
|
|
5987
|
-
};
|
|
5988
6078
|
function options() {
|
|
5989
|
-
return {
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
autoHideDelay: 800
|
|
5995
|
-
},
|
|
5996
|
-
overflow: overflow[props.direction],
|
|
5997
|
-
update: { elementEvents: [["img", "load"]] }
|
|
5998
|
-
};
|
|
6079
|
+
return scrollAreaOptions({
|
|
6080
|
+
direction: props.direction,
|
|
6081
|
+
autoHide: props.autoHide,
|
|
6082
|
+
scrollbar: props.scrollbar
|
|
6083
|
+
});
|
|
5999
6084
|
}
|
|
6000
6085
|
const { viewport, instance, onEvent } = useOverlayScrollbars(host, content, options);
|
|
6001
6086
|
const { hostFocus, viewportFocus } = useScrollFocus(host, viewport, () => ({
|
|
@@ -6530,7 +6615,7 @@ function stepZoom(zoom, direction, max = 2) {
|
|
|
6530
6615
|
return clampZoom(zoom * ZOOM_STEP ** direction, 1, max);
|
|
6531
6616
|
}
|
|
6532
6617
|
//#endregion
|
|
6533
|
-
//#region src/
|
|
6618
|
+
//#region ../shared/src/lib/lightbox/pose.ts
|
|
6534
6619
|
var REST_POSE = {
|
|
6535
6620
|
x: 0,
|
|
6536
6621
|
y: 0,
|
|
@@ -7462,7 +7547,7 @@ function useLightboxLarge(item, active) {
|
|
|
7462
7547
|
};
|
|
7463
7548
|
}
|
|
7464
7549
|
//#endregion
|
|
7465
|
-
//#region src/
|
|
7550
|
+
//#region ../shared/src/lib/lightbox/clip.ts
|
|
7466
7551
|
function emptyCorners() {
|
|
7467
7552
|
return [
|
|
7468
7553
|
{
|
|
@@ -7587,7 +7672,7 @@ function clipOf(el, box) {
|
|
|
7587
7672
|
};
|
|
7588
7673
|
}
|
|
7589
7674
|
//#endregion
|
|
7590
|
-
//#region src/
|
|
7675
|
+
//#region ../shared/src/lib/lightbox/source.ts
|
|
7591
7676
|
function sourceRect(source) {
|
|
7592
7677
|
if (!source) return null;
|
|
7593
7678
|
const isElement = "getBoundingClientRect" in source;
|
|
@@ -7814,7 +7899,7 @@ function useLightboxRotation(frames, current) {
|
|
|
7814
7899
|
};
|
|
7815
7900
|
}
|
|
7816
7901
|
//#endregion
|
|
7817
|
-
//#region src/
|
|
7902
|
+
//#region ../shared/src/lib/lightbox/download.ts
|
|
7818
7903
|
function fileNameOf(url, fallback = "image") {
|
|
7819
7904
|
try {
|
|
7820
7905
|
const parsed = new URL(url, "http://localhost");
|
|
@@ -8755,7 +8840,7 @@ var Callout_default = /* @__PURE__ */ defineComponent({
|
|
|
8755
8840
|
}
|
|
8756
8841
|
});
|
|
8757
8842
|
//#endregion
|
|
8758
|
-
//#region src/lib/collapse.ts
|
|
8843
|
+
//#region ../shared/src/lib/collapse.ts
|
|
8759
8844
|
function collapseGapOf(parent, axis = "y") {
|
|
8760
8845
|
if (!parent) return "0px";
|
|
8761
8846
|
const style = getComputedStyle(parent);
|
|
@@ -8782,6 +8867,8 @@ function collapseHooks(axis = "y", parentOf) {
|
|
|
8782
8867
|
beforeLeave
|
|
8783
8868
|
};
|
|
8784
8869
|
}
|
|
8870
|
+
//#endregion
|
|
8871
|
+
//#region src/lib/collapse.ts
|
|
8785
8872
|
function useCollapseHooks(axis = "y") {
|
|
8786
8873
|
const instance = getCurrentInstance();
|
|
8787
8874
|
let parent = null;
|
|
@@ -9568,7 +9655,10 @@ var PaginationPopup_default = /* @__PURE__ */ defineComponent({
|
|
|
9568
9655
|
}
|
|
9569
9656
|
});
|
|
9570
9657
|
//#endregion
|
|
9571
|
-
//#region src/
|
|
9658
|
+
//#region ../shared/src/lib/pagination.ts
|
|
9659
|
+
function paginationInteger(value, fallback, minimum) {
|
|
9660
|
+
return Number.isFinite(value) ? Math.max(minimum, Math.floor(value)) : fallback;
|
|
9661
|
+
}
|
|
9572
9662
|
function paginationRanges(items) {
|
|
9573
9663
|
return items.flatMap((item, index) => {
|
|
9574
9664
|
if (item.type !== "ellipsis") return [];
|
|
@@ -9583,7 +9673,7 @@ function paginationRanges(items) {
|
|
|
9583
9673
|
});
|
|
9584
9674
|
}
|
|
9585
9675
|
//#endregion
|
|
9586
|
-
//#region src/lib/pointer-corridor.ts
|
|
9676
|
+
//#region ../shared/src/lib/pointer-corridor.ts
|
|
9587
9677
|
var cross = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
|
9588
9678
|
function inPointerCorridor(point, first, second) {
|
|
9589
9679
|
const points = [first, second].flatMap((rect) => [
|
|
@@ -10049,12 +10139,22 @@ function injectInputGroup() {
|
|
|
10049
10139
|
return inject(INPUT_GROUP_KEY, null);
|
|
10050
10140
|
}
|
|
10051
10141
|
//#endregion
|
|
10052
|
-
//#region src/
|
|
10053
|
-
function
|
|
10054
|
-
return
|
|
10142
|
+
//#region ../shared/src/lib/virtual/flow.ts
|
|
10143
|
+
function virtualFlow(items, total, margin = 0) {
|
|
10144
|
+
return {
|
|
10145
|
+
entries: items.map((item, index) => ({
|
|
10146
|
+
...item,
|
|
10147
|
+
gapBefore: index ? Math.max(0, item.start - items[index - 1].end) : 0
|
|
10148
|
+
})),
|
|
10149
|
+
before: Math.max(0, (items[0]?.start ?? margin) - margin),
|
|
10150
|
+
after: Math.max(0, total - ((items.at(-1)?.end ?? margin) - margin))
|
|
10151
|
+
};
|
|
10055
10152
|
}
|
|
10056
|
-
function
|
|
10057
|
-
return
|
|
10153
|
+
function measuredSize(size, cached, estimate) {
|
|
10154
|
+
return size > 0 ? size : cached ?? estimate();
|
|
10155
|
+
}
|
|
10156
|
+
function scrollPosition(offset, adjustments, horizontal, rtl) {
|
|
10157
|
+
return { [horizontal ? "left" : "top"]: (offset + adjustments) * (horizontal && rtl ? -1 : 1) };
|
|
10058
10158
|
}
|
|
10059
10159
|
//#endregion
|
|
10060
10160
|
//#region src/lib/virtual/useVirtualWindow.ts
|
|
@@ -10062,65 +10162,85 @@ function useVirtualWindow(options) {
|
|
|
10062
10162
|
return useVirtualizer(computed(() => ({
|
|
10063
10163
|
useAnimationFrameWithResizeObserver: true,
|
|
10064
10164
|
measureElement: (element, entry, instance) => {
|
|
10065
|
-
const size = measureElement(element, entry, instance);
|
|
10066
10165
|
const index = instance.indexFromElement(element);
|
|
10067
|
-
return
|
|
10166
|
+
return measuredSize(measureElement(element, entry, instance), instance.itemSizeCache.get(instance.options.getItemKey(index)), () => instance.options.estimateSize(index));
|
|
10068
10167
|
},
|
|
10069
10168
|
scrollToFn: (offset, { adjustments = 0, behavior }, instance) => {
|
|
10070
10169
|
instance.scrollElement?.scrollTo({
|
|
10071
|
-
|
|
10170
|
+
...scrollPosition(offset, adjustments, instance.options.horizontal, instance.options.isRtl),
|
|
10072
10171
|
behavior
|
|
10073
10172
|
});
|
|
10074
10173
|
},
|
|
10075
10174
|
...toValue(options)
|
|
10076
10175
|
})));
|
|
10077
10176
|
}
|
|
10078
|
-
|
|
10177
|
+
//#endregion
|
|
10178
|
+
//#region ../shared/src/lib/virtual/collection.ts
|
|
10179
|
+
var VIRTUAL_RECT = {
|
|
10180
|
+
width: 320,
|
|
10181
|
+
height: 320
|
|
10182
|
+
};
|
|
10183
|
+
function finite(value, fallback) {
|
|
10184
|
+
return value !== void 0 && Number.isFinite(value) ? value : fallback;
|
|
10185
|
+
}
|
|
10186
|
+
function virtualConfig(config) {
|
|
10187
|
+
return typeof config === "object" ? config : {};
|
|
10188
|
+
}
|
|
10189
|
+
function collectionEstimator(items, config, estimate) {
|
|
10190
|
+
return (index) => Math.max(1, finite(config.estimateSize, estimate?.(items[index]) ?? 36));
|
|
10191
|
+
}
|
|
10192
|
+
function collectionOverscan(config) {
|
|
10193
|
+
return Math.max(0, Math.floor(finite(config.overscan, 6)));
|
|
10194
|
+
}
|
|
10195
|
+
function centeredOffset(index, count, estimateSize, viewport = VIRTUAL_RECT.height) {
|
|
10196
|
+
if (index < 0 || index >= count) return 0;
|
|
10197
|
+
let offset = (estimateSize(index) - viewport) / 2;
|
|
10198
|
+
for (let current = 0; current < index; current++) offset += estimateSize(current);
|
|
10199
|
+
return Math.max(0, offset);
|
|
10200
|
+
}
|
|
10201
|
+
function mergeRange(indexes, retained, count, include) {
|
|
10202
|
+
const merged = [...indexes, ...retained];
|
|
10203
|
+
return [.../* @__PURE__ */ new Set([...merged, ...include?.(merged) ?? []])].filter((index) => index >= 0 && index < count).sort((a, b) => a - b);
|
|
10204
|
+
}
|
|
10205
|
+
function fallbackRect(rect) {
|
|
10079
10206
|
return {
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
gapBefore: index ? Math.max(0, item.start - items[index - 1].end) : 0
|
|
10083
|
-
})),
|
|
10084
|
-
before: Math.max(0, (items[0]?.start ?? margin) - margin),
|
|
10085
|
-
after: Math.max(0, total - ((items.at(-1)?.end ?? margin) - margin))
|
|
10207
|
+
width: rect.width || VIRTUAL_RECT.width,
|
|
10208
|
+
height: rect.height || VIRTUAL_RECT.height
|
|
10086
10209
|
};
|
|
10087
10210
|
}
|
|
10211
|
+
function layoutTop(element) {
|
|
10212
|
+
let top = 0;
|
|
10213
|
+
for (let node = element; node; node = node.offsetParent) top += node.offsetTop;
|
|
10214
|
+
return top;
|
|
10215
|
+
}
|
|
10216
|
+
function scrollMargin(body, viewport) {
|
|
10217
|
+
return Math.max(0, layoutTop(body) - layoutTop(viewport));
|
|
10218
|
+
}
|
|
10219
|
+
function overscrolledOffset(scrollTop, total, clientHeight) {
|
|
10220
|
+
const max = Math.max(0, total - clientHeight);
|
|
10221
|
+
return scrollTop > max ? max : void 0;
|
|
10222
|
+
}
|
|
10088
10223
|
//#endregion
|
|
10089
10224
|
//#region src/lib/virtual/useVirtualCollection.ts
|
|
10090
10225
|
function useVirtualCollection(options) {
|
|
10091
10226
|
const margin = shallowRef(0);
|
|
10092
|
-
const
|
|
10093
|
-
const config = computed(() => typeof options.config() === "object" ? options.config() : {});
|
|
10227
|
+
const config = computed(() => virtualConfig(options.config()));
|
|
10094
10228
|
const virtualizer = useVirtualWindow(computed(() => {
|
|
10095
10229
|
const items = options.items();
|
|
10096
10230
|
const retained = options.retain?.() ?? [];
|
|
10097
10231
|
const initialIndex = options.initialIndex?.() ?? -1;
|
|
10098
|
-
const estimateSize = (
|
|
10232
|
+
const estimateSize = collectionEstimator(items, config.value, options.estimate);
|
|
10099
10233
|
return {
|
|
10100
10234
|
count: items.length,
|
|
10101
10235
|
getScrollElement: () => options.viewport.value ?? null,
|
|
10102
10236
|
getItemKey: (index) => options.key(items[index]),
|
|
10103
10237
|
estimateSize,
|
|
10104
|
-
overscan:
|
|
10105
|
-
initialRect:
|
|
10106
|
-
|
|
10107
|
-
height: 320
|
|
10108
|
-
},
|
|
10109
|
-
initialOffset: () => {
|
|
10110
|
-
if (initialIndex < 0 || initialIndex >= items.length) return 0;
|
|
10111
|
-
let offset = (estimateSize(initialIndex) - 320) / 2;
|
|
10112
|
-
for (let index = 0; index < initialIndex; index++) offset += estimateSize(index);
|
|
10113
|
-
return Math.max(0, offset);
|
|
10114
|
-
},
|
|
10238
|
+
overscan: collectionOverscan(config.value),
|
|
10239
|
+
initialRect: VIRTUAL_RECT,
|
|
10240
|
+
initialOffset: () => centeredOffset(initialIndex, items.length, estimateSize),
|
|
10115
10241
|
scrollMargin: margin.value,
|
|
10116
|
-
observeElementRect: (instance, callback) => observeElementRect(instance, (rect) => callback(
|
|
10117
|
-
|
|
10118
|
-
height: rect.height || 320
|
|
10119
|
-
})),
|
|
10120
|
-
rangeExtractor: (range) => {
|
|
10121
|
-
const indexes = [...defaultRangeExtractor(range), ...retained];
|
|
10122
|
-
return [.../* @__PURE__ */ new Set([...indexes, ...options.include?.(indexes) ?? []])].filter((index) => index >= 0 && index < items.length).sort((a, b) => a - b);
|
|
10123
|
-
}
|
|
10242
|
+
observeElementRect: (instance, callback) => observeElementRect(instance, (rect) => callback(fallbackRect(rect))),
|
|
10243
|
+
rangeExtractor: (range) => mergeRange(defaultRangeExtractor(range), retained, items.length, options.include)
|
|
10124
10244
|
};
|
|
10125
10245
|
}));
|
|
10126
10246
|
const flow = computed(() => virtualFlow(virtualizer.value.getVirtualItems(), virtualizer.value.getTotalSize(), margin.value));
|
|
@@ -10132,15 +10252,10 @@ function useVirtualCollection(options) {
|
|
|
10132
10252
|
if (element === null) virtualizer.value.measureElement(null);
|
|
10133
10253
|
else if (options.viewport.value && element instanceof HTMLElement && element.isConnected) virtualizer.value.measureElement(element);
|
|
10134
10254
|
}
|
|
10135
|
-
function layoutTop(element) {
|
|
10136
|
-
let top = 0;
|
|
10137
|
-
for (let node = element; node; node = node.offsetParent) top += node.offsetTop;
|
|
10138
|
-
return top;
|
|
10139
|
-
}
|
|
10140
10255
|
async function refresh() {
|
|
10141
10256
|
const viewport = options.viewport.value;
|
|
10142
10257
|
const body = options.body.value;
|
|
10143
|
-
if (viewport && body?.isConnected) margin.value =
|
|
10258
|
+
if (viewport && body?.isConnected) margin.value = scrollMargin(body, viewport);
|
|
10144
10259
|
virtualizer.value.measure();
|
|
10145
10260
|
await nextTick();
|
|
10146
10261
|
for (const child of options.body.value?.children ?? []) measure(child);
|
|
@@ -10163,7 +10278,9 @@ function useVirtualCollection(options) {
|
|
|
10163
10278
|
watch(() => [config.value.estimateSize, options.items().length], async () => {
|
|
10164
10279
|
await nextTick();
|
|
10165
10280
|
const viewport = options.viewport.value;
|
|
10166
|
-
if (viewport
|
|
10281
|
+
if (!viewport) return;
|
|
10282
|
+
const offset = overscrolledOffset(viewport.scrollTop, virtualizer.value.getTotalSize(), viewport.clientHeight);
|
|
10283
|
+
if (offset !== void 0) virtualizer.value.scrollToOffset(offset);
|
|
10167
10284
|
});
|
|
10168
10285
|
onScopeDispose(() => {
|
|
10169
10286
|
if (frame !== void 0) cancelAnimationFrame(frame);
|
|
@@ -10180,7 +10297,7 @@ function useVirtualCollection(options) {
|
|
|
10180
10297
|
};
|
|
10181
10298
|
}
|
|
10182
10299
|
//#endregion
|
|
10183
|
-
//#region src/lib/virtual/navigation.ts
|
|
10300
|
+
//#region ../shared/src/lib/virtual/navigation.ts
|
|
10184
10301
|
function nextEnabled(length, from, step, disabled) {
|
|
10185
10302
|
for (let index = from; index >= 0 && index < length; index += step) if (!disabled(index)) return index;
|
|
10186
10303
|
return -1;
|
|
@@ -10196,6 +10313,123 @@ function typeaheadMatch(labels, query, current, disabled) {
|
|
|
10196
10313
|
return -1;
|
|
10197
10314
|
}
|
|
10198
10315
|
//#endregion
|
|
10316
|
+
//#region ../shared/src/types/select.ts
|
|
10317
|
+
function isOptionGroup(item) {
|
|
10318
|
+
return !("value" in item) && "options" in item;
|
|
10319
|
+
}
|
|
10320
|
+
function flattenOptions(items) {
|
|
10321
|
+
return items.flatMap((item) => isOptionGroup(item) ? item.options : [item]);
|
|
10322
|
+
}
|
|
10323
|
+
function choiceKey(value) {
|
|
10324
|
+
return `option:${typeof value}:${value}`;
|
|
10325
|
+
}
|
|
10326
|
+
function choiceRows(items, query, contains) {
|
|
10327
|
+
const result = [];
|
|
10328
|
+
let position = 0;
|
|
10329
|
+
items.forEach((item, groupIndex) => {
|
|
10330
|
+
if (isOptionGroup(item)) {
|
|
10331
|
+
const options = item.options.filter((option) => !query || contains(option.label, query));
|
|
10332
|
+
if (!options.length) return;
|
|
10333
|
+
const group = result.length;
|
|
10334
|
+
result.push({
|
|
10335
|
+
key: `group:${groupIndex}`,
|
|
10336
|
+
label: item.label,
|
|
10337
|
+
position: 0
|
|
10338
|
+
});
|
|
10339
|
+
for (const option of options) result.push({
|
|
10340
|
+
key: choiceKey(option.value),
|
|
10341
|
+
label: option.label,
|
|
10342
|
+
option,
|
|
10343
|
+
group,
|
|
10344
|
+
position: ++position
|
|
10345
|
+
});
|
|
10346
|
+
} else if (!query || contains(item.label, query)) result.push({
|
|
10347
|
+
key: choiceKey(item.value),
|
|
10348
|
+
label: item.label,
|
|
10349
|
+
option: item,
|
|
10350
|
+
position: ++position
|
|
10351
|
+
});
|
|
10352
|
+
});
|
|
10353
|
+
return result;
|
|
10354
|
+
}
|
|
10355
|
+
function choiceSize(rows) {
|
|
10356
|
+
return rows.filter((row) => row.option).length;
|
|
10357
|
+
}
|
|
10358
|
+
function choiceDisabled(rows, index) {
|
|
10359
|
+
return !rows[index]?.option || !!rows[index]?.option?.disabled;
|
|
10360
|
+
}
|
|
10361
|
+
function choiceEstimate(row) {
|
|
10362
|
+
return row.option ? row.option.description ? 54 : 36 : 30;
|
|
10363
|
+
}
|
|
10364
|
+
function choiceGroups(rows, indexes) {
|
|
10365
|
+
return indexes.flatMap((index) => rows[index]?.group === void 0 ? [] : [rows[index].group]);
|
|
10366
|
+
}
|
|
10367
|
+
function selectedChoice(rows, model) {
|
|
10368
|
+
const value = Array.isArray(model) ? model[0] : model;
|
|
10369
|
+
return rows.findIndex((row) => row.option?.value === value && !!row.option);
|
|
10370
|
+
}
|
|
10371
|
+
function choiceAttrs(rows, index, size, id) {
|
|
10372
|
+
const row = rows[index];
|
|
10373
|
+
return {
|
|
10374
|
+
"aria-posinset": row.position,
|
|
10375
|
+
"aria-setsize": size,
|
|
10376
|
+
"aria-describedby": row.group === void 0 ? void 0 : `${id}-${row.group}`
|
|
10377
|
+
};
|
|
10378
|
+
}
|
|
10379
|
+
function enabledChoiceValues(rows) {
|
|
10380
|
+
return rows.flatMap((row) => row.option && !row.option.disabled ? [row.option.value] : []);
|
|
10381
|
+
}
|
|
10382
|
+
function choiceRangeValues(rows, anchor, target) {
|
|
10383
|
+
const start = rows.findIndex((row) => row.option?.value === anchor);
|
|
10384
|
+
if (start < 0) return void 0;
|
|
10385
|
+
return enabledChoiceValues(rows.slice(Math.min(start, target), Math.max(start, target) + 1));
|
|
10386
|
+
}
|
|
10387
|
+
function createChoiceTypeahead(now = () => Date.now()) {
|
|
10388
|
+
let search = "";
|
|
10389
|
+
let searchedAt = 0;
|
|
10390
|
+
return {
|
|
10391
|
+
get search() {
|
|
10392
|
+
return search;
|
|
10393
|
+
},
|
|
10394
|
+
expire() {
|
|
10395
|
+
if (now() - searchedAt > 1e3) search = "";
|
|
10396
|
+
},
|
|
10397
|
+
extend(key) {
|
|
10398
|
+
const time = now();
|
|
10399
|
+
search = (time - searchedAt > 1e3 ? "" : search) + key;
|
|
10400
|
+
searchedAt = time;
|
|
10401
|
+
return search;
|
|
10402
|
+
}
|
|
10403
|
+
};
|
|
10404
|
+
}
|
|
10405
|
+
function choiceKeyAction(event, state) {
|
|
10406
|
+
const { count, current, input, disabled, typeahead } = state;
|
|
10407
|
+
const meta = event.ctrlKey || event.metaKey || event.altKey;
|
|
10408
|
+
typeahead.expire();
|
|
10409
|
+
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === "a" && !input && state.multiple) return { type: "select-all" };
|
|
10410
|
+
if (meta) return { type: "none" };
|
|
10411
|
+
let target = -1;
|
|
10412
|
+
if (event.key === "ArrowDown") target = nextEnabled(count, current + 1, 1, disabled);
|
|
10413
|
+
else if (event.key === "ArrowUp") target = nextEnabled(count, current < 0 ? count - 1 : current - 1, -1, disabled);
|
|
10414
|
+
else if (event.key === "Home") target = nextEnabled(count, 0, 1, disabled);
|
|
10415
|
+
else if (event.key === "End") target = nextEnabled(count, count - 1, -1, disabled);
|
|
10416
|
+
else if (event.key === "PageDown" || event.key === "PageUp") {
|
|
10417
|
+
const step = event.key === "PageDown" ? 1 : -1;
|
|
10418
|
+
target = nextEnabled(count, Math.max(0, Math.min(count - 1, Math.max(0, current) + step * Math.max(1, Math.floor(state.page / 36)))), step, disabled);
|
|
10419
|
+
} else if (event.key === "Enter" || event.key === " " && !input && !typeahead.search) {
|
|
10420
|
+
if (current < 0 || disabled(current)) return { type: "none" };
|
|
10421
|
+
return {
|
|
10422
|
+
type: "commit",
|
|
10423
|
+
index: current
|
|
10424
|
+
};
|
|
10425
|
+
} else if (!input && event.key.length === 1) target = typeaheadMatch(state.labels(), typeahead.extend(event.key), current, disabled);
|
|
10426
|
+
else return { type: "none" };
|
|
10427
|
+
return {
|
|
10428
|
+
type: "move",
|
|
10429
|
+
target
|
|
10430
|
+
};
|
|
10431
|
+
}
|
|
10432
|
+
//#endregion
|
|
10199
10433
|
//#region src/lib/reka/useVirtualChoices.ts
|
|
10200
10434
|
function useVirtualChoices(props) {
|
|
10201
10435
|
const select = props.kind === "select" ? injectSelectRootContext() : void 0;
|
|
@@ -10207,44 +10441,11 @@ function useVirtualChoices(props) {
|
|
|
10207
10441
|
const activeKey = shallowRef();
|
|
10208
10442
|
const id = useId();
|
|
10209
10443
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
10210
|
-
const rows = computed(() =>
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
let position = 0;
|
|
10214
|
-
props.options.forEach((item, groupIndex) => {
|
|
10215
|
-
if (isOptionGroup(item)) {
|
|
10216
|
-
const options = item.options.filter((option) => !query || contains(option.label, query));
|
|
10217
|
-
if (!options.length) return;
|
|
10218
|
-
const group = result.length;
|
|
10219
|
-
result.push({
|
|
10220
|
-
key: `group:${groupIndex}`,
|
|
10221
|
-
label: item.label,
|
|
10222
|
-
position: 0
|
|
10223
|
-
});
|
|
10224
|
-
for (const option of options) result.push({
|
|
10225
|
-
key: `option:${typeof option.value}:${option.value}`,
|
|
10226
|
-
label: option.label,
|
|
10227
|
-
option,
|
|
10228
|
-
group,
|
|
10229
|
-
position: ++position
|
|
10230
|
-
});
|
|
10231
|
-
} else if (!query || contains(item.label, query)) result.push({
|
|
10232
|
-
key: `option:${typeof item.value}:${item.value}`,
|
|
10233
|
-
label: item.label,
|
|
10234
|
-
option: item,
|
|
10235
|
-
position: ++position
|
|
10236
|
-
});
|
|
10237
|
-
});
|
|
10238
|
-
return result;
|
|
10239
|
-
});
|
|
10240
|
-
const size = computed(() => rows.value.filter((row) => row.option).length);
|
|
10241
|
-
const disabled = (index) => !rows.value[index]?.option || !!rows.value[index]?.option?.disabled;
|
|
10444
|
+
const rows = computed(() => choiceRows(props.options, combobox && !combobox.ignoreFilter.value ? combobox.filterSearch.value : "", contains));
|
|
10445
|
+
const size = computed(() => choiceSize(rows.value));
|
|
10446
|
+
const disabled = (index) => choiceDisabled(rows.value, index);
|
|
10242
10447
|
const first = () => nextEnabled(rows.value.length, 0, 1, disabled);
|
|
10243
|
-
const selectedIndex = computed(() =>
|
|
10244
|
-
const model = select?.modelValue.value ?? listbox?.modelValue.value;
|
|
10245
|
-
const value = Array.isArray(model) ? model[0] : model;
|
|
10246
|
-
return rows.value.findIndex((row) => row.option?.value === value && !!row.option);
|
|
10247
|
-
});
|
|
10448
|
+
const selectedIndex = computed(() => selectedChoice(rows.value, select?.modelValue.value ?? listbox?.modelValue.value));
|
|
10248
10449
|
const activeIndex = computed(() => rows.value.findIndex((row) => row.key === activeKey.value));
|
|
10249
10450
|
const collection = useVirtualCollection({
|
|
10250
10451
|
items: () => rows.value,
|
|
@@ -10254,8 +10455,8 @@ function useVirtualChoices(props) {
|
|
|
10254
10455
|
config: () => props.virtualize,
|
|
10255
10456
|
initialIndex: props.kind === "listbox" ? void 0 : () => selectedIndex.value,
|
|
10256
10457
|
retain: () => [activeIndex.value, selectedIndex.value],
|
|
10257
|
-
include: (indexes) =>
|
|
10258
|
-
estimate:
|
|
10458
|
+
include: (indexes) => choiceGroups(rows.value, indexes),
|
|
10459
|
+
estimate: choiceEstimate
|
|
10259
10460
|
});
|
|
10260
10461
|
let generation = 0;
|
|
10261
10462
|
let disposed = false;
|
|
@@ -10277,52 +10478,39 @@ function useVirtualChoices(props) {
|
|
|
10277
10478
|
const wrapper = event.target.closest("[data-index]");
|
|
10278
10479
|
if (wrapper && body.value?.contains(wrapper)) activeKey.value = rows.value[Number(wrapper.dataset.index)]?.key;
|
|
10279
10480
|
}
|
|
10280
|
-
|
|
10281
|
-
let searchedAt = 0;
|
|
10481
|
+
const typeahead = createChoiceTypeahead();
|
|
10282
10482
|
function keydown(event) {
|
|
10283
10483
|
if (event.isComposing || event.defaultPrevented || select?.disabled?.value || listbox?.disabled.value) return;
|
|
10284
|
-
const
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10484
|
+
const action = choiceKeyAction(event, {
|
|
10485
|
+
labels: () => rows.value.map((row) => row.label),
|
|
10486
|
+
count: rows.value.length,
|
|
10487
|
+
current: activeIndex.value,
|
|
10488
|
+
input: event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement,
|
|
10489
|
+
multiple: !!listbox?.multiple.value,
|
|
10490
|
+
page: viewport.value?.clientHeight ?? 320,
|
|
10491
|
+
disabled,
|
|
10492
|
+
typeahead
|
|
10493
|
+
});
|
|
10494
|
+
if (action.type === "none") return;
|
|
10495
|
+
event.preventDefault();
|
|
10496
|
+
event.stopImmediatePropagation();
|
|
10497
|
+
if (action.type === "select-all") {
|
|
10498
|
+
listbox.modelValue.value = enabledChoiceValues(rows.value);
|
|
10293
10499
|
return;
|
|
10294
10500
|
}
|
|
10295
|
-
if (
|
|
10296
|
-
if (event.key === "ArrowDown") target = nextEnabled(rows.value.length, current + 1, 1, disabled);
|
|
10297
|
-
else if (event.key === "ArrowUp") target = nextEnabled(rows.value.length, current < 0 ? rows.value.length - 1 : current - 1, -1, disabled);
|
|
10298
|
-
else if (event.key === "Home") target = first();
|
|
10299
|
-
else if (event.key === "End") target = nextEnabled(rows.value.length, rows.value.length - 1, -1, disabled);
|
|
10300
|
-
else if (event.key === "PageDown" || event.key === "PageUp") {
|
|
10301
|
-
const step = event.key === "PageDown" ? 1 : -1;
|
|
10302
|
-
target = nextEnabled(rows.value.length, Math.max(0, Math.min(rows.value.length - 1, Math.max(0, current) + step * Math.max(1, Math.floor((viewport.value?.clientHeight ?? 320) / 36)))), step, disabled);
|
|
10303
|
-
} else if (event.key === "Enter" || event.key === " " && !input && !search) {
|
|
10304
|
-
if (current < 0 || disabled(current)) return;
|
|
10305
|
-
event.preventDefault();
|
|
10306
|
-
event.stopImmediatePropagation();
|
|
10501
|
+
if (action.type === "commit") {
|
|
10307
10502
|
if (select) {
|
|
10308
|
-
select.onValueChange(rows.value[
|
|
10503
|
+
select.onValueChange(rows.value[action.index].option.value);
|
|
10309
10504
|
if (!select.multiple.value) select.onOpenChange(false);
|
|
10310
|
-
} else highlight(
|
|
10505
|
+
} else highlight(action.index, false, false).then((element) => element?.click());
|
|
10311
10506
|
return;
|
|
10312
|
-
}
|
|
10313
|
-
|
|
10314
|
-
search = (now - searchedAt > 1e3 ? "" : search) + event.key;
|
|
10315
|
-
searchedAt = now;
|
|
10316
|
-
target = typeaheadMatch(rows.value.map((row) => row.label), search, current, disabled);
|
|
10317
|
-
} else return;
|
|
10318
|
-
event.preventDefault();
|
|
10319
|
-
event.stopImmediatePropagation();
|
|
10320
|
-
if (target < 0) return;
|
|
10507
|
+
}
|
|
10508
|
+
if (action.target < 0) return;
|
|
10321
10509
|
if (event.shiftKey && listbox?.multiple.value && listbox.selectionBehavior?.value === "replace") {
|
|
10322
|
-
const
|
|
10323
|
-
if (
|
|
10510
|
+
const values = choiceRangeValues(rows.value, listbox.firstValue?.value, action.target);
|
|
10511
|
+
if (values) listbox.modelValue.value = values;
|
|
10324
10512
|
}
|
|
10325
|
-
highlight(target);
|
|
10513
|
+
highlight(action.target);
|
|
10326
10514
|
}
|
|
10327
10515
|
useEventListener(body, "keydown", keydown, { capture: true });
|
|
10328
10516
|
useEventListener(() => combobox?.inputElement.value ?? props.input, "keydown", keydown, { capture: true });
|
|
@@ -10372,21 +10560,13 @@ function useVirtualChoices(props) {
|
|
|
10372
10560
|
generation++;
|
|
10373
10561
|
stops.forEach((stop) => stop());
|
|
10374
10562
|
});
|
|
10375
|
-
function itemAttrs(index) {
|
|
10376
|
-
const row = rows.value[index];
|
|
10377
|
-
return {
|
|
10378
|
-
"aria-posinset": row.position,
|
|
10379
|
-
"aria-setsize": size.value,
|
|
10380
|
-
"aria-describedby": row.group === void 0 ? void 0 : `${id}-${row.group}`
|
|
10381
|
-
};
|
|
10382
|
-
}
|
|
10383
10563
|
return {
|
|
10384
10564
|
area,
|
|
10385
10565
|
body,
|
|
10386
10566
|
viewport,
|
|
10387
10567
|
rows,
|
|
10388
10568
|
...collection,
|
|
10389
|
-
itemAttrs,
|
|
10569
|
+
itemAttrs: (index) => choiceAttrs(rows.value, index, size.value, id),
|
|
10390
10570
|
labelId: (index) => `${id}-${index}`
|
|
10391
10571
|
};
|
|
10392
10572
|
}
|
|
@@ -10904,7 +11084,7 @@ var PaginationSize_default = /* @__PURE__ */ defineComponent({
|
|
|
10904
11084
|
}
|
|
10905
11085
|
});
|
|
10906
11086
|
//#endregion
|
|
10907
|
-
//#region src/lib/field-focus.ts
|
|
11087
|
+
//#region ../shared/src/lib/field-focus.ts
|
|
10908
11088
|
var INTERACTIVE = "button, a, input, textarea, select, [contenteditable], [role=\"button\"]";
|
|
10909
11089
|
var CONTROL = "input:not([type=\"hidden\"]), textarea";
|
|
10910
11090
|
function controlOf(node) {
|
|
@@ -11195,9 +11375,6 @@ var PaginationJump_default = /* @__PURE__ */ defineComponent({
|
|
|
11195
11375
|
});
|
|
11196
11376
|
//#endregion
|
|
11197
11377
|
//#region src/components/pagination/composables/usePagination.ts
|
|
11198
|
-
function paginationInteger(value, fallback, minimum) {
|
|
11199
|
-
return Number.isFinite(value) ? Math.max(minimum, Math.floor(value)) : fallback;
|
|
11200
|
-
}
|
|
11201
11378
|
function usePagination(props, model, sizeModel, change) {
|
|
11202
11379
|
const total = computed(() => paginationInteger(props.total, 0, 0));
|
|
11203
11380
|
const pageSize = computed(() => paginationInteger(sizeModel.value, 10, 1));
|
|
@@ -11562,10 +11739,17 @@ var Table_default = /* @__PURE__ */ defineComponent({
|
|
|
11562
11739
|
caption: {},
|
|
11563
11740
|
class: {}
|
|
11564
11741
|
},
|
|
11565
|
-
setup(__props) {
|
|
11742
|
+
setup(__props, { expose: __expose }) {
|
|
11566
11743
|
const props = __props;
|
|
11744
|
+
const area = shallowRef(null);
|
|
11745
|
+
__expose({
|
|
11746
|
+
viewport: computed(() => area.value?.viewport),
|
|
11747
|
+
instance: computed(() => area.value?.instance)
|
|
11748
|
+
});
|
|
11567
11749
|
return (_ctx, _cache) => {
|
|
11568
11750
|
return openBlock(), createBlock(ScrollArea_default, {
|
|
11751
|
+
ref_key: "area",
|
|
11752
|
+
ref: area,
|
|
11569
11753
|
direction: props.stickyHeader ? "both" : "horizontal",
|
|
11570
11754
|
class: normalizeClass(unref(cn)(unref(tableWrapper)({
|
|
11571
11755
|
variant: props.variant,
|
|
@@ -11899,11 +12083,18 @@ var TabsList_default = /* @__PURE__ */ defineComponent({
|
|
|
11899
12083
|
label: {},
|
|
11900
12084
|
class: {}
|
|
11901
12085
|
},
|
|
11902
|
-
setup(__props) {
|
|
12086
|
+
setup(__props, { expose: __expose }) {
|
|
11903
12087
|
const props = __props;
|
|
11904
12088
|
const { variant, orientation } = useTabsStyle();
|
|
12089
|
+
const area = shallowRef(null);
|
|
12090
|
+
__expose({
|
|
12091
|
+
viewport: computed(() => area.value?.viewport),
|
|
12092
|
+
instance: computed(() => area.value?.instance)
|
|
12093
|
+
});
|
|
11905
12094
|
return (_ctx, _cache) => {
|
|
11906
12095
|
return openBlock(), createBlock(ScrollArea_default, {
|
|
12096
|
+
ref_key: "area",
|
|
12097
|
+
ref: area,
|
|
11907
12098
|
direction: unref(orientation),
|
|
11908
12099
|
scrollbar: false,
|
|
11909
12100
|
class: normalizeClass(unref(cn)(unref(tabsScroll)({
|
|
@@ -12000,7 +12191,7 @@ var TabsContent_default = /* @__PURE__ */ defineComponent({
|
|
|
12000
12191
|
}
|
|
12001
12192
|
});
|
|
12002
12193
|
//#endregion
|
|
12003
|
-
//#region src/lib/caret.ts
|
|
12194
|
+
//#region ../shared/src/lib/caret.ts
|
|
12004
12195
|
var MIRRORED = [
|
|
12005
12196
|
"font-family",
|
|
12006
12197
|
"font-size",
|
|
@@ -12215,39 +12406,742 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
12215
12406
|
};
|
|
12216
12407
|
}
|
|
12217
12408
|
});
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
},
|
|
12230
|
-
defaultVariants: {
|
|
12231
|
-
size: "md",
|
|
12232
|
-
divided: true
|
|
12409
|
+
function clamp(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY) {
|
|
12410
|
+
return Math.min(max, Math.max(min, value));
|
|
12411
|
+
}
|
|
12412
|
+
function roundToStepPrecision(value, step) {
|
|
12413
|
+
let rounded = value;
|
|
12414
|
+
const text = step.toString();
|
|
12415
|
+
const point = text.indexOf(".");
|
|
12416
|
+
const precision = point >= 0 ? text.length - point : 0;
|
|
12417
|
+
if (precision > 0) {
|
|
12418
|
+
const pow = 10 ** precision;
|
|
12419
|
+
rounded = Math.round(rounded * pow) / pow;
|
|
12233
12420
|
}
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
12421
|
+
return rounded;
|
|
12422
|
+
}
|
|
12423
|
+
function snapValueToStep(value, minValue, maxValue, step) {
|
|
12424
|
+
const min = Number(minValue);
|
|
12425
|
+
const max = Number(maxValue);
|
|
12426
|
+
const remainder = (value - (Number.isNaN(min) ? 0 : min)) % step;
|
|
12427
|
+
let snapped = roundToStepPrecision(Math.abs(remainder) * 2 >= step ? value + Math.sign(remainder) * (step - Math.abs(remainder)) : value - remainder, step);
|
|
12428
|
+
if (!Number.isNaN(min)) {
|
|
12429
|
+
if (snapped < min) snapped = min;
|
|
12430
|
+
else if (!Number.isNaN(max) && snapped > max) snapped = min + Math.floor(roundToStepPrecision((max - min) / step, step)) * step;
|
|
12431
|
+
} else if (!Number.isNaN(max) && snapped > max) snapped = Math.floor(roundToStepPrecision(max / step, step)) * step;
|
|
12432
|
+
return roundToStepPrecision(snapped, step);
|
|
12433
|
+
}
|
|
12434
|
+
function handleDecimalOperation(operator, left, right) {
|
|
12435
|
+
let result = operator === "+" ? left + right : left - right;
|
|
12436
|
+
if (left % 1 !== 0 || right % 1 !== 0) {
|
|
12437
|
+
const leftDecimals = left.toString().split(".")[1]?.length ?? 0;
|
|
12438
|
+
const rightDecimals = right.toString().split(".")[1]?.length ?? 0;
|
|
12439
|
+
const multiplier = 10 ** Math.max(leftDecimals, rightDecimals);
|
|
12440
|
+
const a = Math.round(left * multiplier);
|
|
12441
|
+
const b = Math.round(right * multiplier);
|
|
12442
|
+
result = (operator === "+" ? a + b : a - b) / multiplier;
|
|
12443
|
+
}
|
|
12444
|
+
return result;
|
|
12445
|
+
}
|
|
12446
|
+
function isNullish(value) {
|
|
12447
|
+
return value === null || value === void 0;
|
|
12448
|
+
}
|
|
12449
|
+
function isNumber(value) {
|
|
12450
|
+
return !isNullish(value) && !Number.isNaN(value);
|
|
12451
|
+
}
|
|
12452
|
+
function resolveNumberFieldLocale(locale, inherited) {
|
|
12453
|
+
return locale || inherited || "en";
|
|
12454
|
+
}
|
|
12455
|
+
function createNumberFieldFormat(locale, options) {
|
|
12456
|
+
return {
|
|
12457
|
+
formatter: new NumberFormatter(locale, options),
|
|
12458
|
+
parser: new NumberParser(locale, options)
|
|
12459
|
+
};
|
|
12460
|
+
}
|
|
12461
|
+
function numberFieldInputMode(format) {
|
|
12462
|
+
return format.formatter.resolvedOptions().maximumFractionDigits > 0 ? "decimal" : "numeric";
|
|
12463
|
+
}
|
|
12464
|
+
function formatNumberFieldValue(value, format) {
|
|
12465
|
+
return isNumber(value) ? format.formatter.format(value) : "";
|
|
12466
|
+
}
|
|
12467
|
+
function clampNumberFieldValue(value, range, format) {
|
|
12468
|
+
const { min, max, step, stepSnapping } = range;
|
|
12469
|
+
const clamped = Number.isNaN(step) || !stepSnapping ? clamp(value, min, max) : snapValueToStep(value, min, max, step);
|
|
12470
|
+
return format.parser.parse(format.formatter.format(clamped));
|
|
12471
|
+
}
|
|
12472
|
+
function nextNumberFieldValue(direction, from, range, format, multiplier = 1) {
|
|
12473
|
+
const { step } = range;
|
|
12474
|
+
const operator = direction === "increase" ? "+" : "-";
|
|
12475
|
+
let next;
|
|
12476
|
+
if (range.stepSnapping && !Number.isNaN(step)) {
|
|
12477
|
+
const snapped = snapValueToStep(from, range.min, range.max, step);
|
|
12478
|
+
if (snapped === from) next = handleDecimalOperation(operator, from, step * multiplier);
|
|
12479
|
+
else {
|
|
12480
|
+
const aligned = direction === "increase" ? snapped > from ? snapped : handleDecimalOperation("+", snapped, step) : snapped < from ? snapped : handleDecimalOperation("-", snapped, step);
|
|
12481
|
+
next = multiplier > 1 ? handleDecimalOperation(operator, aligned, step * (multiplier - 1)) : aligned;
|
|
12482
|
+
}
|
|
12483
|
+
} else next = handleDecimalOperation(operator, from, step * multiplier);
|
|
12484
|
+
return clampNumberFieldValue(next, range, format);
|
|
12485
|
+
}
|
|
12486
|
+
function isNumberFieldAtLimit(direction, value, range, format) {
|
|
12487
|
+
if (!isNumber(value)) return false;
|
|
12488
|
+
const next = nextNumberFieldValue(direction, value, range, format);
|
|
12489
|
+
return direction === "increase" ? next <= value : next >= value;
|
|
12490
|
+
}
|
|
12491
|
+
function stepNumberFieldText(direction, text, range, format, multiplier = 1) {
|
|
12492
|
+
const current = format.parser.parse(text);
|
|
12493
|
+
if (Number.isNaN(current)) return clampNumberFieldValue(range.min ?? 0, range, format);
|
|
12494
|
+
return nextNumberFieldValue(direction, current, range, format, multiplier);
|
|
12495
|
+
}
|
|
12496
|
+
function boundNumberFieldValue(bound, range, format) {
|
|
12497
|
+
const target = bound === "min" ? range.min : range.max;
|
|
12498
|
+
return target === void 0 ? void 0 : clampNumberFieldValue(target, range, format);
|
|
12499
|
+
}
|
|
12500
|
+
function commitNumberFieldText(text, range, format) {
|
|
12501
|
+
const parsed = format.parser.parse(text);
|
|
12502
|
+
return {
|
|
12503
|
+
value: Number.isNaN(parsed) ? void 0 : clampNumberFieldValue(parsed, range, format),
|
|
12504
|
+
reformat: text.length > 0
|
|
12505
|
+
};
|
|
12506
|
+
}
|
|
12507
|
+
function rejectsNumberFieldInput(event, input, range, format) {
|
|
12508
|
+
if (event.isComposing) return false;
|
|
12509
|
+
if (event.inputType.startsWith("delete") || event.inputType.startsWith("history")) return false;
|
|
12510
|
+
const next = input.value.slice(0, input.selectionStart ?? void 0) + (event.data ?? "") + input.value.slice(input.selectionEnd ?? void 0);
|
|
12511
|
+
return !format.parser.isValidPartialNumber(next, range.min, range.max);
|
|
12512
|
+
}
|
|
12513
|
+
function numberFieldKeyAction(event, composing) {
|
|
12514
|
+
if (composing || event.isComposing) return void 0;
|
|
12515
|
+
switch (event.key) {
|
|
12516
|
+
case "ArrowUp": return {
|
|
12517
|
+
type: "step",
|
|
12518
|
+
direction: "increase",
|
|
12519
|
+
multiplier: 1,
|
|
12520
|
+
prevent: true
|
|
12521
|
+
};
|
|
12522
|
+
case "ArrowDown": return {
|
|
12523
|
+
type: "step",
|
|
12524
|
+
direction: "decrease",
|
|
12525
|
+
multiplier: 1,
|
|
12526
|
+
prevent: true
|
|
12527
|
+
};
|
|
12528
|
+
case "PageUp": return {
|
|
12529
|
+
type: "step",
|
|
12530
|
+
direction: "increase",
|
|
12531
|
+
multiplier: 10,
|
|
12532
|
+
prevent: true
|
|
12533
|
+
};
|
|
12534
|
+
case "PageDown": return {
|
|
12535
|
+
type: "step",
|
|
12536
|
+
direction: "decrease",
|
|
12537
|
+
multiplier: 10,
|
|
12538
|
+
prevent: true
|
|
12539
|
+
};
|
|
12540
|
+
case "Home": return {
|
|
12541
|
+
type: "bound",
|
|
12542
|
+
bound: "min",
|
|
12543
|
+
prevent: true
|
|
12544
|
+
};
|
|
12545
|
+
case "End": return {
|
|
12546
|
+
type: "bound",
|
|
12547
|
+
bound: "max",
|
|
12548
|
+
prevent: true
|
|
12549
|
+
};
|
|
12550
|
+
case "Enter": return {
|
|
12551
|
+
type: "commit",
|
|
12552
|
+
prevent: false
|
|
12553
|
+
};
|
|
12554
|
+
default: return;
|
|
12555
|
+
}
|
|
12556
|
+
}
|
|
12557
|
+
function numberFieldWheelStep(event, state) {
|
|
12558
|
+
if (state.disabled || !state.focused) return void 0;
|
|
12559
|
+
if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) return void 0;
|
|
12560
|
+
return event.deltaY > 0 !== state.inverted ? "increase" : "decrease";
|
|
12561
|
+
}
|
|
12562
|
+
function deepActiveElement(root) {
|
|
12563
|
+
let active = root.activeElement;
|
|
12564
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
12565
|
+
return active;
|
|
12566
|
+
}
|
|
12567
|
+
function createNumberFieldPressHold(options) {
|
|
12568
|
+
let handle;
|
|
12569
|
+
let pressed = false;
|
|
12570
|
+
const reset = () => options.timers.clearTimeout(handle);
|
|
12571
|
+
const repeat = (delay) => {
|
|
12572
|
+
reset();
|
|
12573
|
+
if (options.disabled()) return;
|
|
12574
|
+
options.trigger();
|
|
12575
|
+
handle = options.timers.setTimeout(() => repeat(60), delay);
|
|
12576
|
+
};
|
|
12577
|
+
return {
|
|
12578
|
+
press(event) {
|
|
12579
|
+
if (event.button !== 0 || pressed) return;
|
|
12580
|
+
event.preventDefault();
|
|
12581
|
+
pressed = true;
|
|
12582
|
+
options.pressed(true);
|
|
12583
|
+
repeat(400);
|
|
12584
|
+
},
|
|
12585
|
+
release() {
|
|
12586
|
+
pressed = false;
|
|
12587
|
+
options.pressed(false);
|
|
12588
|
+
reset();
|
|
12589
|
+
},
|
|
12590
|
+
dispose: reset
|
|
12591
|
+
};
|
|
12592
|
+
}
|
|
12593
|
+
function numberFieldRootAttributes(state) {
|
|
12594
|
+
return {
|
|
12595
|
+
role: "group",
|
|
12596
|
+
"data-disabled": state.disabled ? "" : void 0,
|
|
12597
|
+
"data-readonly": state.readonly ? "" : void 0
|
|
12598
|
+
};
|
|
12599
|
+
}
|
|
12600
|
+
function numberFieldInputAttributes(state) {
|
|
12601
|
+
return {
|
|
12602
|
+
id: state.id,
|
|
12603
|
+
value: state.value,
|
|
12604
|
+
role: "spinbutton",
|
|
12605
|
+
type: "text",
|
|
12606
|
+
tabindex: "0",
|
|
12607
|
+
inputmode: state.inputMode,
|
|
12608
|
+
disabled: state.disabled ? "" : void 0,
|
|
12609
|
+
"data-disabled": state.disabled ? "" : void 0,
|
|
12610
|
+
readonly: state.readonly ? "" : void 0,
|
|
12611
|
+
"data-readonly": state.readonly ? "" : void 0,
|
|
12612
|
+
autocomplete: "off",
|
|
12613
|
+
autocorrect: "off",
|
|
12614
|
+
spellcheck: "false",
|
|
12615
|
+
"aria-roledescription": "Number field",
|
|
12616
|
+
"aria-valuenow": state.modelValue,
|
|
12617
|
+
"aria-valuemin": state.min,
|
|
12618
|
+
"aria-valuemax": state.max
|
|
12619
|
+
};
|
|
12620
|
+
}
|
|
12621
|
+
function isNumberFieldStepDisabled(state) {
|
|
12622
|
+
return state.disabled || state.readonly || state.own || state.atLimit;
|
|
12623
|
+
}
|
|
12624
|
+
function numberFieldStepAttributes(state) {
|
|
12625
|
+
return {
|
|
12626
|
+
tabindex: "-1",
|
|
12627
|
+
"aria-label": state.direction === "increase" ? "Increase" : "Decrease",
|
|
12628
|
+
type: state.button ? "button" : void 0,
|
|
12629
|
+
style: { userSelect: state.pressed ? "none" : void 0 },
|
|
12630
|
+
disabled: state.disabled ? "" : void 0,
|
|
12631
|
+
"data-disabled": state.disabled ? "" : void 0,
|
|
12632
|
+
"data-pressed": state.pressed ? "true" : void 0
|
|
12633
|
+
};
|
|
12634
|
+
}
|
|
12635
|
+
//#endregion
|
|
12636
|
+
//#region src/primitives/utils/usePrimitiveElement.ts
|
|
12637
|
+
function usePrimitiveElement() {
|
|
12638
|
+
const primitiveElement = ref();
|
|
12639
|
+
return {
|
|
12640
|
+
primitiveElement,
|
|
12641
|
+
currentElement: computed(() => {
|
|
12642
|
+
const element = primitiveElement.value?.$el;
|
|
12643
|
+
if (element && ["#text", "#comment"].includes(element.nodeName)) return element.nextElementSibling;
|
|
12644
|
+
return element ?? primitiveElement.value;
|
|
12645
|
+
})
|
|
12646
|
+
};
|
|
12647
|
+
}
|
|
12648
|
+
//#endregion
|
|
12649
|
+
//#region src/primitives/utils/useVModel.ts
|
|
12650
|
+
function useVModel$1(props, key, emit, options = {}) {
|
|
12651
|
+
const event = `update:${key}`;
|
|
12652
|
+
const current = () => props[key] !== void 0 ? props[key] : options.defaultValue;
|
|
12653
|
+
if (!options.passive) return computed({
|
|
12654
|
+
get: current,
|
|
12655
|
+
set: (value) => emit(event, value)
|
|
12656
|
+
});
|
|
12657
|
+
const proxy = ref(current());
|
|
12658
|
+
let updating = false;
|
|
12659
|
+
watch(() => props[key], (value) => {
|
|
12660
|
+
if (updating) return;
|
|
12661
|
+
updating = true;
|
|
12662
|
+
proxy.value = value;
|
|
12663
|
+
nextTick(() => updating = false);
|
|
12664
|
+
});
|
|
12665
|
+
watch(proxy, (value) => {
|
|
12666
|
+
if (!updating && value !== props[key]) emit(event, value);
|
|
12667
|
+
});
|
|
12668
|
+
return proxy;
|
|
12669
|
+
}
|
|
12670
|
+
//#endregion
|
|
12671
|
+
//#region src/primitives/visually-hidden/VisuallyHiddenInputBubble.vue
|
|
12672
|
+
var VisuallyHiddenInputBubble_default = /* @__PURE__ */ defineComponent({
|
|
12673
|
+
inheritAttrs: false,
|
|
12674
|
+
__name: "VisuallyHiddenInputBubble",
|
|
12675
|
+
props: {
|
|
12676
|
+
name: {},
|
|
12677
|
+
value: {},
|
|
12678
|
+
checked: {
|
|
12679
|
+
type: Boolean,
|
|
12680
|
+
default: void 0
|
|
12681
|
+
},
|
|
12682
|
+
required: { type: Boolean },
|
|
12683
|
+
disabled: { type: Boolean },
|
|
12684
|
+
feature: { default: "fully-hidden" }
|
|
12685
|
+
},
|
|
12686
|
+
setup(__props) {
|
|
12687
|
+
const props = __props;
|
|
12688
|
+
const { primitiveElement, currentElement } = usePrimitiveElement();
|
|
12689
|
+
const valueState = computed(() => props.checked ?? props.value);
|
|
12690
|
+
watch(valueState, (cur, prev) => {
|
|
12691
|
+
if (!currentElement.value) return;
|
|
12692
|
+
const input = currentElement.value;
|
|
12693
|
+
const setValue = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
|
|
12694
|
+
if (setValue && cur !== prev) {
|
|
12695
|
+
const inputEvent = new Event("input", { bubbles: true });
|
|
12696
|
+
const changeEvent = new Event("change", { bubbles: true });
|
|
12697
|
+
setValue.call(input, cur);
|
|
12698
|
+
input.dispatchEvent(inputEvent);
|
|
12699
|
+
input.dispatchEvent(changeEvent);
|
|
12700
|
+
}
|
|
12701
|
+
});
|
|
12702
|
+
return (_ctx, _cache) => {
|
|
12703
|
+
return openBlock(), createBlock(unref(VisuallyHidden), mergeProps({
|
|
12704
|
+
ref_key: "primitiveElement",
|
|
12705
|
+
ref: primitiveElement
|
|
12706
|
+
}, {
|
|
12707
|
+
...props,
|
|
12708
|
+
..._ctx.$attrs
|
|
12709
|
+
}, { as: "input" }), null, 16);
|
|
12710
|
+
};
|
|
12711
|
+
}
|
|
12712
|
+
});
|
|
12713
|
+
//#endregion
|
|
12714
|
+
//#region src/primitives/visually-hidden/VisuallyHiddenInput.ts
|
|
12715
|
+
var REQUIRED_NOTE = " We render single input if it's required ";
|
|
12716
|
+
var VisuallyHiddenInput_default = defineComponent({
|
|
12717
|
+
name: "VisuallyHiddenInput",
|
|
12718
|
+
inheritAttrs: false,
|
|
12719
|
+
props: {
|
|
12720
|
+
name: {
|
|
12721
|
+
type: String,
|
|
12722
|
+
required: true
|
|
12723
|
+
},
|
|
12724
|
+
value: {
|
|
12725
|
+
type: null,
|
|
12726
|
+
required: true
|
|
12727
|
+
},
|
|
12728
|
+
checked: {
|
|
12729
|
+
type: Boolean,
|
|
12730
|
+
required: false,
|
|
12731
|
+
default: void 0
|
|
12732
|
+
},
|
|
12733
|
+
required: {
|
|
12734
|
+
type: Boolean,
|
|
12735
|
+
required: false
|
|
12736
|
+
},
|
|
12737
|
+
disabled: {
|
|
12738
|
+
type: Boolean,
|
|
12739
|
+
required: false
|
|
12740
|
+
},
|
|
12741
|
+
feature: {
|
|
12742
|
+
type: String,
|
|
12743
|
+
required: false,
|
|
12744
|
+
default: "fully-hidden"
|
|
12745
|
+
}
|
|
12746
|
+
},
|
|
12747
|
+
setup(props, { attrs }) {
|
|
12748
|
+
const isFormArrayEmptyAndRequired = computed(() => Array.isArray(props.value) && props.value.length === 0 && props.required);
|
|
12749
|
+
const parsedValue = computed(() => {
|
|
12750
|
+
const value = props.value;
|
|
12751
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null || value === void 0) return [{
|
|
12752
|
+
name: props.name,
|
|
12753
|
+
value
|
|
12754
|
+
}];
|
|
12755
|
+
if (Array.isArray(value)) return value.flatMap((item, index) => typeof item === "object" ? Object.entries(item).map(([key, entry]) => ({
|
|
12756
|
+
name: `${props.name}[${index}][${key}]`,
|
|
12757
|
+
value: entry
|
|
12758
|
+
})) : {
|
|
12759
|
+
name: `${props.name}[${index}]`,
|
|
12760
|
+
value: item
|
|
12761
|
+
});
|
|
12762
|
+
if (typeof value === "object") return Object.entries(value).map(([key, entry]) => ({
|
|
12763
|
+
name: `${props.name}[${key}]`,
|
|
12764
|
+
value: entry
|
|
12765
|
+
}));
|
|
12766
|
+
return [];
|
|
12767
|
+
});
|
|
12768
|
+
return () => h(Fragment, null, [createCommentVNode(REQUIRED_NOTE), isFormArrayEmptyAndRequired.value ? h(VisuallyHiddenInputBubble_default, mergeProps({ key: props.name }, {
|
|
12769
|
+
...props,
|
|
12770
|
+
...attrs
|
|
12771
|
+
}, {
|
|
12772
|
+
name: props.name,
|
|
12773
|
+
value: props.value
|
|
12774
|
+
})) : h(Fragment, { key: 1 }, parsedValue.value.map((parsed) => h(VisuallyHiddenInputBubble_default, mergeProps({ key: parsed.name }, {
|
|
12775
|
+
...props,
|
|
12776
|
+
...attrs
|
|
12777
|
+
}, {
|
|
12778
|
+
name: parsed.name,
|
|
12779
|
+
value: parsed.value
|
|
12780
|
+
}))))]);
|
|
12781
|
+
}
|
|
12782
|
+
});
|
|
12783
|
+
//#endregion
|
|
12784
|
+
//#region src/primitives/utils/timers.ts
|
|
12785
|
+
var windowTimers = {
|
|
12786
|
+
setTimeout: (callback, delay) => window.setTimeout(callback, delay),
|
|
12787
|
+
clearTimeout: (handle) => window.clearTimeout(handle)
|
|
12788
|
+
};
|
|
12789
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
12790
|
+
//#endregion
|
|
12791
|
+
//#region src/primitives/number-field/context.ts
|
|
12792
|
+
var NUMBER_FIELD_ROOT = Symbol("NumberFieldRootContext");
|
|
12793
|
+
function provideNumberFieldRootContext(context) {
|
|
12794
|
+
provide(NUMBER_FIELD_ROOT, context);
|
|
12795
|
+
return context;
|
|
12796
|
+
}
|
|
12797
|
+
function injectNumberFieldRootContext() {
|
|
12798
|
+
const context = inject(NUMBER_FIELD_ROOT, null);
|
|
12799
|
+
if (!context) throw new Error("Injection `Symbol(NumberFieldRootContext)` not found. Component must be used within `NumberFieldRoot`");
|
|
12800
|
+
return context;
|
|
12801
|
+
}
|
|
12802
|
+
function useNumberFieldStep(direction, props) {
|
|
12803
|
+
const root = injectNumberFieldRootContext();
|
|
12804
|
+
const isDisabled = computed(() => isNumberFieldStepDisabled({
|
|
12805
|
+
disabled: root.disabled.value,
|
|
12806
|
+
readonly: root.readonly.value,
|
|
12807
|
+
own: !!props.disabled,
|
|
12808
|
+
atLimit: direction === "increase" ? root.isIncreaseDisabled.value : root.isDecreaseDisabled.value
|
|
12809
|
+
}));
|
|
12810
|
+
const { primitiveElement, currentElement } = usePrimitiveElement();
|
|
12811
|
+
const isPressed = ref(false);
|
|
12812
|
+
const hold = createNumberFieldPressHold({
|
|
12813
|
+
timers: windowTimers,
|
|
12814
|
+
disabled: () => isDisabled.value,
|
|
12815
|
+
trigger: () => root.step(direction),
|
|
12816
|
+
pressed: (pressed) => isPressed.value = pressed
|
|
12817
|
+
});
|
|
12818
|
+
if (isClient) {
|
|
12819
|
+
watch(currentElement, (element, _, onCleanup) => {
|
|
12820
|
+
if (!element) return;
|
|
12821
|
+
element.addEventListener("pointerdown", hold.press);
|
|
12822
|
+
onCleanup(() => element.removeEventListener("pointerdown", hold.press));
|
|
12823
|
+
}, {
|
|
12824
|
+
immediate: true,
|
|
12825
|
+
flush: "post"
|
|
12826
|
+
});
|
|
12827
|
+
window.addEventListener("pointerup", hold.release);
|
|
12828
|
+
window.addEventListener("pointercancel", hold.release);
|
|
12829
|
+
onScopeDispose(() => {
|
|
12830
|
+
window.removeEventListener("pointerup", hold.release);
|
|
12831
|
+
window.removeEventListener("pointercancel", hold.release);
|
|
12832
|
+
});
|
|
12833
|
+
}
|
|
12834
|
+
return {
|
|
12835
|
+
primitiveElement,
|
|
12836
|
+
attributes: computed(() => numberFieldStepAttributes({
|
|
12837
|
+
direction,
|
|
12838
|
+
button: props.as === "button",
|
|
12839
|
+
disabled: isDisabled.value,
|
|
12840
|
+
pressed: isPressed.value
|
|
12841
|
+
}))
|
|
12842
|
+
};
|
|
12843
|
+
}
|
|
12844
|
+
//#endregion
|
|
12845
|
+
//#region src/primitives/number-field/NumberFieldRoot.vue
|
|
12846
|
+
var NumberFieldRoot_default = /* @__PURE__ */ defineComponent({
|
|
12847
|
+
inheritAttrs: false,
|
|
12848
|
+
__name: "NumberFieldRoot",
|
|
12849
|
+
props: {
|
|
12850
|
+
defaultValue: { default: void 0 },
|
|
12851
|
+
modelValue: {},
|
|
12852
|
+
min: {},
|
|
12853
|
+
max: {},
|
|
12854
|
+
step: { default: 1 },
|
|
12855
|
+
stepSnapping: {
|
|
12856
|
+
type: Boolean,
|
|
12857
|
+
default: true
|
|
12858
|
+
},
|
|
12859
|
+
focusOnChange: {
|
|
12860
|
+
type: Boolean,
|
|
12861
|
+
default: true
|
|
12862
|
+
},
|
|
12863
|
+
formatOptions: {},
|
|
12864
|
+
locale: {},
|
|
12865
|
+
disabled: { type: Boolean },
|
|
12866
|
+
readonly: { type: Boolean },
|
|
12867
|
+
disableWheelChange: { type: Boolean },
|
|
12868
|
+
invertWheelChange: { type: Boolean },
|
|
12869
|
+
id: {},
|
|
12870
|
+
name: {},
|
|
12871
|
+
required: { type: Boolean },
|
|
12872
|
+
asChild: { type: Boolean },
|
|
12873
|
+
as: { default: "div" }
|
|
12874
|
+
},
|
|
12875
|
+
emits: ["update:modelValue"],
|
|
12876
|
+
setup(__props, { emit: __emit }) {
|
|
12877
|
+
const props = __props;
|
|
12878
|
+
const emits = __emit;
|
|
12879
|
+
const { disabled, readonly, disableWheelChange, invertWheelChange, id } = toRefs(props);
|
|
12880
|
+
const modelValue = useVModel$1(props, "modelValue", emits, {
|
|
12881
|
+
defaultValue: props.defaultValue,
|
|
12882
|
+
passive: props.modelValue === void 0
|
|
12883
|
+
});
|
|
12884
|
+
const { primitiveElement, currentElement } = usePrimitiveElement();
|
|
12885
|
+
const config = injectConfigProviderContext(null);
|
|
12886
|
+
const locale = computed(() => resolveNumberFieldLocale(props.locale, config?.locale?.value));
|
|
12887
|
+
const isFormControl = computed(() => currentElement.value ? Boolean(currentElement.value.closest("form")) : true);
|
|
12888
|
+
const inputEl = ref();
|
|
12889
|
+
const format = computed(() => createNumberFieldFormat(locale.value, props.formatOptions));
|
|
12890
|
+
const range = computed(() => ({
|
|
12891
|
+
min: props.min,
|
|
12892
|
+
max: props.max,
|
|
12893
|
+
step: props.step,
|
|
12894
|
+
stepSnapping: props.stepSnapping
|
|
12895
|
+
}));
|
|
12896
|
+
const isDecreaseDisabled = computed(() => isNumberFieldAtLimit("decrease", modelValue.value, range.value, format.value));
|
|
12897
|
+
const isIncreaseDisabled = computed(() => isNumberFieldAtLimit("increase", modelValue.value, range.value, format.value));
|
|
12898
|
+
const inputMode = computed(() => numberFieldInputMode(format.value));
|
|
12899
|
+
const textValue = computed(() => formatNumberFieldValue(modelValue.value, format.value));
|
|
12900
|
+
const attributes = computed(() => numberFieldRootAttributes({
|
|
12901
|
+
disabled: props.disabled,
|
|
12902
|
+
readonly: props.readonly
|
|
12903
|
+
}));
|
|
12904
|
+
function step(direction, multiplier = 1) {
|
|
12905
|
+
if (props.focusOnChange) inputEl.value?.focus();
|
|
12906
|
+
if (props.disabled || props.readonly) return;
|
|
12907
|
+
modelValue.value = stepNumberFieldText(direction, inputEl.value?.value ?? "", range.value, format.value, multiplier);
|
|
12908
|
+
}
|
|
12909
|
+
function jump(bound) {
|
|
12910
|
+
const next = boundNumberFieldValue(bound, range.value, format.value);
|
|
12911
|
+
if (next !== void 0) modelValue.value = next;
|
|
12912
|
+
}
|
|
12913
|
+
function commit(text) {
|
|
12914
|
+
const { value, reformat } = commitNumberFieldText(text, range.value, format.value);
|
|
12915
|
+
modelValue.value = value;
|
|
12916
|
+
if (inputEl.value) inputEl.value.value = reformat ? textValue.value : text;
|
|
12917
|
+
}
|
|
12918
|
+
const FormInput = () => isFormControl.value && props.name ? h(VisuallyHiddenInput_default, {
|
|
12919
|
+
type: "text",
|
|
12920
|
+
value: modelValue.value,
|
|
12921
|
+
name: props.name,
|
|
12922
|
+
disabled: props.disabled,
|
|
12923
|
+
readonly: props.readonly,
|
|
12924
|
+
required: props.required
|
|
12925
|
+
}) : createCommentVNode("v-if", true);
|
|
12926
|
+
provideNumberFieldRootContext({
|
|
12927
|
+
modelValue,
|
|
12928
|
+
step,
|
|
12929
|
+
jump,
|
|
12930
|
+
commit,
|
|
12931
|
+
inputEl,
|
|
12932
|
+
onInputElement: (element) => inputEl.value = element,
|
|
12933
|
+
inputMode,
|
|
12934
|
+
textValue,
|
|
12935
|
+
range,
|
|
12936
|
+
format,
|
|
12937
|
+
disabled,
|
|
12938
|
+
readonly,
|
|
12939
|
+
disableWheelChange,
|
|
12940
|
+
invertWheelChange,
|
|
12941
|
+
isDecreaseDisabled,
|
|
12942
|
+
isIncreaseDisabled,
|
|
12943
|
+
id
|
|
12944
|
+
});
|
|
12945
|
+
return (_ctx, _cache) => {
|
|
12946
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({
|
|
12947
|
+
..._ctx.$attrs,
|
|
12948
|
+
...attributes.value
|
|
12949
|
+
}, {
|
|
12950
|
+
ref_key: "primitiveElement",
|
|
12951
|
+
ref: primitiveElement,
|
|
12952
|
+
as: __props.as,
|
|
12953
|
+
"as-child": __props.asChild
|
|
12954
|
+
}), {
|
|
12955
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
|
|
12956
|
+
modelValue: unref(modelValue),
|
|
12957
|
+
textValue: textValue.value,
|
|
12958
|
+
readonly: unref(readonly)
|
|
12959
|
+
}), createVNode(FormInput)]),
|
|
12960
|
+
_: 3
|
|
12961
|
+
}, 16, ["as", "as-child"]);
|
|
12962
|
+
};
|
|
12963
|
+
}
|
|
12964
|
+
});
|
|
12965
|
+
//#endregion
|
|
12966
|
+
//#region src/primitives/number-field/NumberFieldInput.vue
|
|
12967
|
+
var NumberFieldInput_default = /* @__PURE__ */ defineComponent({
|
|
12968
|
+
__name: "NumberFieldInput",
|
|
12969
|
+
props: {
|
|
12970
|
+
asChild: { type: Boolean },
|
|
12971
|
+
as: { default: "input" }
|
|
12972
|
+
},
|
|
12973
|
+
setup(__props) {
|
|
12974
|
+
const props = __props;
|
|
12975
|
+
const { primitiveElement, currentElement } = usePrimitiveElement();
|
|
12976
|
+
const root = injectNumberFieldRootContext();
|
|
12977
|
+
const composing = ref(false);
|
|
12978
|
+
function handleKeydown(event) {
|
|
12979
|
+
const action = numberFieldKeyAction(event, composing.value);
|
|
12980
|
+
if (!action) return;
|
|
12981
|
+
if (action.prevent) event.preventDefault();
|
|
12982
|
+
if (action.type === "step") root.step(action.direction, action.multiplier);
|
|
12983
|
+
else if (action.type === "bound") root.jump(action.bound);
|
|
12984
|
+
else root.commit(event.target?.value);
|
|
12985
|
+
}
|
|
12986
|
+
function handleWheel(event) {
|
|
12987
|
+
const direction = numberFieldWheelStep(event, {
|
|
12988
|
+
focused: event.target === deepActiveElement(document),
|
|
12989
|
+
disabled: root.disableWheelChange.value,
|
|
12990
|
+
inverted: root.invertWheelChange.value
|
|
12991
|
+
});
|
|
12992
|
+
if (!direction) return;
|
|
12993
|
+
event.preventDefault();
|
|
12994
|
+
root.step(direction);
|
|
12995
|
+
}
|
|
12996
|
+
function handleBeforeInput(event) {
|
|
12997
|
+
const input = event.target;
|
|
12998
|
+
if (rejectsNumberFieldInput(event, input, root.range.value, root.format.value)) event.preventDefault();
|
|
12999
|
+
}
|
|
13000
|
+
function handleInput(event) {
|
|
13001
|
+
inputValue.value = event.target.value;
|
|
13002
|
+
}
|
|
13003
|
+
function handleChange() {
|
|
13004
|
+
requestAnimationFrame(() => {
|
|
13005
|
+
inputValue.value = root.textValue.value;
|
|
13006
|
+
});
|
|
13007
|
+
}
|
|
13008
|
+
function handleBlur(event) {
|
|
13009
|
+
root.commit(event.target?.value);
|
|
13010
|
+
}
|
|
13011
|
+
function handleCompositionEnd() {
|
|
13012
|
+
nextTick(() => {
|
|
13013
|
+
composing.value = false;
|
|
13014
|
+
});
|
|
13015
|
+
}
|
|
13016
|
+
onMounted(() => {
|
|
13017
|
+
root.onInputElement(currentElement.value);
|
|
13018
|
+
});
|
|
13019
|
+
const inputValue = ref(root.textValue.value);
|
|
13020
|
+
watch(() => root.textValue.value, () => {
|
|
13021
|
+
inputValue.value = root.textValue.value;
|
|
13022
|
+
}, {
|
|
13023
|
+
immediate: true,
|
|
13024
|
+
deep: true
|
|
13025
|
+
});
|
|
13026
|
+
const attributes = computed(() => numberFieldInputAttributes({
|
|
13027
|
+
id: root.id.value,
|
|
13028
|
+
value: inputValue.value,
|
|
13029
|
+
inputMode: root.inputMode.value,
|
|
13030
|
+
disabled: root.disabled.value,
|
|
13031
|
+
readonly: root.readonly.value,
|
|
13032
|
+
modelValue: root.modelValue.value,
|
|
13033
|
+
min: root.range.value.min,
|
|
13034
|
+
max: root.range.value.max
|
|
13035
|
+
}));
|
|
13036
|
+
return (_ctx, _cache) => {
|
|
13037
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({
|
|
13038
|
+
...props,
|
|
13039
|
+
...attributes.value
|
|
13040
|
+
}, {
|
|
13041
|
+
ref_key: "primitiveElement",
|
|
13042
|
+
ref: primitiveElement,
|
|
13043
|
+
onKeydown: handleKeydown,
|
|
13044
|
+
onWheel: handleWheel,
|
|
13045
|
+
onBeforeinput: handleBeforeInput,
|
|
13046
|
+
onInput: handleInput,
|
|
13047
|
+
onChange: handleChange,
|
|
13048
|
+
onBlur: handleBlur,
|
|
13049
|
+
onCompositionstart: _cache[0] || (_cache[0] = ($event) => composing.value = true),
|
|
13050
|
+
onCompositionend: handleCompositionEnd
|
|
13051
|
+
}), {
|
|
13052
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
13053
|
+
_: 3
|
|
13054
|
+
}, 16);
|
|
13055
|
+
};
|
|
13056
|
+
}
|
|
13057
|
+
});
|
|
13058
|
+
//#endregion
|
|
13059
|
+
//#region src/primitives/number-field/NumberFieldIncrement.vue
|
|
13060
|
+
var NumberFieldIncrement_default = /* @__PURE__ */ defineComponent({
|
|
13061
|
+
__name: "NumberFieldIncrement",
|
|
13062
|
+
props: {
|
|
13063
|
+
disabled: { type: Boolean },
|
|
13064
|
+
asChild: { type: Boolean },
|
|
13065
|
+
as: { default: "button" }
|
|
13066
|
+
},
|
|
13067
|
+
setup(__props) {
|
|
13068
|
+
const props = __props;
|
|
13069
|
+
const { primitiveElement, attributes } = useNumberFieldStep("increase", props);
|
|
13070
|
+
return (_ctx, _cache) => {
|
|
13071
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({
|
|
13072
|
+
...props,
|
|
13073
|
+
...unref(attributes)
|
|
13074
|
+
}, {
|
|
13075
|
+
ref_key: "primitiveElement",
|
|
13076
|
+
ref: primitiveElement,
|
|
13077
|
+
onContextmenu: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
|
|
13078
|
+
}), {
|
|
13079
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
13080
|
+
_: 3
|
|
13081
|
+
}, 16);
|
|
13082
|
+
};
|
|
13083
|
+
}
|
|
13084
|
+
});
|
|
13085
|
+
//#endregion
|
|
13086
|
+
//#region src/primitives/number-field/NumberFieldDecrement.vue
|
|
13087
|
+
var NumberFieldDecrement_default = /* @__PURE__ */ defineComponent({
|
|
13088
|
+
__name: "NumberFieldDecrement",
|
|
13089
|
+
props: {
|
|
13090
|
+
disabled: { type: Boolean },
|
|
13091
|
+
asChild: { type: Boolean },
|
|
13092
|
+
as: { default: "button" }
|
|
13093
|
+
},
|
|
13094
|
+
setup(__props) {
|
|
13095
|
+
const props = __props;
|
|
13096
|
+
const { primitiveElement, attributes } = useNumberFieldStep("decrease", props);
|
|
13097
|
+
return (_ctx, _cache) => {
|
|
13098
|
+
return openBlock(), createBlock(unref(Primitive), mergeProps({
|
|
13099
|
+
...props,
|
|
13100
|
+
...unref(attributes)
|
|
13101
|
+
}, {
|
|
13102
|
+
ref_key: "primitiveElement",
|
|
13103
|
+
ref: primitiveElement,
|
|
13104
|
+
onContextmenu: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
|
|
13105
|
+
}), {
|
|
13106
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
13107
|
+
_: 3
|
|
13108
|
+
}, 16);
|
|
13109
|
+
};
|
|
13110
|
+
}
|
|
13111
|
+
});
|
|
13112
|
+
//#endregion
|
|
13113
|
+
//#region ../shared/src/variants/number-input.ts
|
|
13114
|
+
var numberInputStepper = tv({
|
|
13115
|
+
base: "flex shrink-0 flex-col",
|
|
13116
|
+
variants: {
|
|
13117
|
+
divided: { true: "border-line border-s" },
|
|
13118
|
+
size: {
|
|
13119
|
+
sm: "[&_svg]:size-3",
|
|
13120
|
+
md: "[&_svg]:size-3",
|
|
13121
|
+
lg: "[&_svg]:size-3.5"
|
|
13122
|
+
}
|
|
13123
|
+
},
|
|
13124
|
+
defaultVariants: {
|
|
13125
|
+
size: "md",
|
|
13126
|
+
divided: true
|
|
13127
|
+
}
|
|
13128
|
+
});
|
|
13129
|
+
var numberInputStep = tv({
|
|
13130
|
+
base: [
|
|
13131
|
+
"hn-interactive hn-state-layer hn-press-none text-muted",
|
|
13132
|
+
"flex min-h-0 flex-1 basis-0 items-center justify-center px-1.5 outline-none",
|
|
13133
|
+
"disabled:pointer-events-none disabled:opacity-40"
|
|
13134
|
+
],
|
|
13135
|
+
variants: { divided: { true: "border-line border-t" } }
|
|
13136
|
+
});
|
|
13137
|
+
//#endregion
|
|
13138
|
+
//#region src/components/number-input/NumberInput.vue
|
|
13139
|
+
var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
13140
|
+
name: "HnNumberInput",
|
|
13141
|
+
inheritAttrs: false,
|
|
13142
|
+
__name: "NumberInput",
|
|
13143
|
+
props: {
|
|
13144
|
+
modelValue: {},
|
|
12251
13145
|
defaultValue: {},
|
|
12252
13146
|
min: {},
|
|
12253
13147
|
max: {},
|
|
@@ -12292,7 +13186,7 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
|
12292
13186
|
readonly: props.readonly
|
|
12293
13187
|
}), emits);
|
|
12294
13188
|
return (_ctx, _cache) => {
|
|
12295
|
-
return openBlock(), createBlock(unref(
|
|
13189
|
+
return openBlock(), createBlock(unref(NumberFieldRoot_default), mergeProps(unref(forwarded), {
|
|
12296
13190
|
locale: props.locale ?? unref(t).tag,
|
|
12297
13191
|
disabled: unref(disabled),
|
|
12298
13192
|
"data-hn-number-input": "",
|
|
@@ -12303,7 +13197,7 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
|
12303
13197
|
size: props.size
|
|
12304
13198
|
}), props.class)
|
|
12305
13199
|
}), {
|
|
12306
|
-
default: withCtx(() => [createVNode(unref(
|
|
13200
|
+
default: withCtx(() => [createVNode(unref(NumberFieldInput_default), mergeProps(_ctx.$attrs, {
|
|
12307
13201
|
id: unref(fieldId),
|
|
12308
13202
|
"aria-invalid": unref(invalid) || void 0,
|
|
12309
13203
|
"aria-describedby": unref(describedBy),
|
|
@@ -12319,13 +13213,13 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
|
12319
13213
|
size: size.value,
|
|
12320
13214
|
divided: divided.value
|
|
12321
13215
|
}))
|
|
12322
|
-
}, [createVNode(unref(
|
|
13216
|
+
}, [createVNode(unref(NumberFieldIncrement_default), {
|
|
12323
13217
|
"aria-label": unref(t).numberInput.increase,
|
|
12324
13218
|
class: normalizeClass(unref(numberInputStep)())
|
|
12325
13219
|
}, {
|
|
12326
13220
|
default: withCtx(() => [createVNode(unref(ChevronUp))]),
|
|
12327
13221
|
_: 1
|
|
12328
|
-
}, 8, ["aria-label", "class"]), createVNode(unref(
|
|
13222
|
+
}, 8, ["aria-label", "class"]), createVNode(unref(NumberFieldDecrement_default), {
|
|
12329
13223
|
"aria-label": unref(t).numberInput.decrease,
|
|
12330
13224
|
class: normalizeClass(unref(numberInputStep)({ divided: divided.value }))
|
|
12331
13225
|
}, {
|
|
@@ -12368,13 +13262,21 @@ var PasswordInput_default = /* @__PURE__ */ defineComponent({
|
|
|
12368
13262
|
"visibleModifiers": {}
|
|
12369
13263
|
}),
|
|
12370
13264
|
emits: ["update:modelValue", "update:visible"],
|
|
12371
|
-
setup(__props) {
|
|
13265
|
+
setup(__props, { expose: __expose }) {
|
|
12372
13266
|
const props = __props;
|
|
12373
13267
|
const model = useModel(__props, "modelValue");
|
|
12374
13268
|
const visible = useModel(__props, "visible");
|
|
12375
13269
|
const t = useUiLocale();
|
|
13270
|
+
const base = shallowRef(null);
|
|
13271
|
+
__expose({
|
|
13272
|
+
clear: () => base.value?.clear(),
|
|
13273
|
+
focus: () => base.value?.focus()
|
|
13274
|
+
});
|
|
12376
13275
|
return (_ctx, _cache) => {
|
|
12377
|
-
return openBlock(), createBlock(InputBase_default, mergeProps(
|
|
13276
|
+
return openBlock(), createBlock(InputBase_default, mergeProps({
|
|
13277
|
+
ref_key: "base",
|
|
13278
|
+
ref: base
|
|
13279
|
+
}, _ctx.$attrs, {
|
|
12378
13280
|
modelValue: model.value,
|
|
12379
13281
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value = $event),
|
|
12380
13282
|
type: visible.value ? "text" : "password",
|
|
@@ -12434,7 +13336,7 @@ var SearchInput_default = /* @__PURE__ */ defineComponent({
|
|
|
12434
13336
|
"modelModifiers": {}
|
|
12435
13337
|
}),
|
|
12436
13338
|
emits: /*@__PURE__*/ mergeModels(["search", "clear"], ["update:modelValue"]),
|
|
12437
|
-
setup(__props, { emit: __emit }) {
|
|
13339
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
12438
13340
|
const props = __props;
|
|
12439
13341
|
const emit = __emit;
|
|
12440
13342
|
const model = useModel(__props, "modelValue");
|
|
@@ -12444,8 +13346,15 @@ var SearchInput_default = /* @__PURE__ */ defineComponent({
|
|
|
12444
13346
|
model.value = "";
|
|
12445
13347
|
emit("clear");
|
|
12446
13348
|
}
|
|
13349
|
+
const base = shallowRef(null);
|
|
13350
|
+
__expose({
|
|
13351
|
+
clear: () => base.value?.clear(),
|
|
13352
|
+
focus: () => base.value?.focus()
|
|
13353
|
+
});
|
|
12447
13354
|
return (_ctx, _cache) => {
|
|
12448
13355
|
return openBlock(), createBlock(InputBase_default, mergeProps({
|
|
13356
|
+
ref_key: "base",
|
|
13357
|
+
ref: base,
|
|
12449
13358
|
type: "search",
|
|
12450
13359
|
enterkeyhint: "search"
|
|
12451
13360
|
}, _ctx.$attrs, {
|
|
@@ -12711,7 +13620,7 @@ var MultiSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
12711
13620
|
"aria-invalid",
|
|
12712
13621
|
"class"
|
|
12713
13622
|
]),
|
|
12714
|
-
props.name ? (openBlock(), createBlock(
|
|
13623
|
+
props.name ? (openBlock(), createBlock(unref(VisuallyHidden), {
|
|
12715
13624
|
key: 0,
|
|
12716
13625
|
"as-child": ""
|
|
12717
13626
|
}, {
|
|
@@ -13789,12 +14698,10 @@ var CommandPaletteItem_default = /* @__PURE__ */ defineComponent({
|
|
|
13789
14698
|
}
|
|
13790
14699
|
});
|
|
13791
14700
|
//#endregion
|
|
13792
|
-
//#region src/
|
|
13793
|
-
function
|
|
14701
|
+
//#region ../shared/src/lib/command-palette/match.ts
|
|
14702
|
+
function isGroup(entry) {
|
|
13794
14703
|
return "items" in entry;
|
|
13795
14704
|
}
|
|
13796
|
-
//#endregion
|
|
13797
|
-
//#region src/components/command-palette/utils/match.ts
|
|
13798
14705
|
function score(item, query) {
|
|
13799
14706
|
if (!query) return {
|
|
13800
14707
|
item,
|
|
@@ -13864,7 +14771,7 @@ function filterCommands(items, query) {
|
|
|
13864
14771
|
loose = [];
|
|
13865
14772
|
};
|
|
13866
14773
|
for (const entry of items) {
|
|
13867
|
-
if (!
|
|
14774
|
+
if (!isGroup(entry)) {
|
|
13868
14775
|
loose.push(entry);
|
|
13869
14776
|
continue;
|
|
13870
14777
|
}
|
|
@@ -14022,7 +14929,7 @@ var CommandPalettePanel_default = /* @__PURE__ */ defineComponent({
|
|
|
14022
14929
|
}
|
|
14023
14930
|
});
|
|
14024
14931
|
//#endregion
|
|
14025
|
-
//#region src/
|
|
14932
|
+
//#region ../shared/src/lib/command-palette/hotkey.ts
|
|
14026
14933
|
function parseHotkey(spec) {
|
|
14027
14934
|
const parts = spec.toLowerCase().split("+").map((part) => part.trim()).filter(Boolean);
|
|
14028
14935
|
const modifiers = parts.slice(0, -1);
|
|
@@ -14506,13 +15413,56 @@ var TreeCheck_default = /* @__PURE__ */ defineComponent({
|
|
|
14506
15413
|
}
|
|
14507
15414
|
});
|
|
14508
15415
|
//#endregion
|
|
15416
|
+
//#region ../shared/src/lib/virtual/tree.ts
|
|
15417
|
+
function virtualTreeDisabled(rows, index, rootDisabled, disabled) {
|
|
15418
|
+
const row = rows[index];
|
|
15419
|
+
return !row || rootDisabled || (disabled?.(row.value) ?? !!row.value.disabled);
|
|
15420
|
+
}
|
|
15421
|
+
function virtualTreeKeyTarget(event, state) {
|
|
15422
|
+
const { rows, current, expanded, disabled } = state;
|
|
15423
|
+
if (event.ctrlKey || event.metaKey || event.altKey) return void 0;
|
|
15424
|
+
const count = rows.length;
|
|
15425
|
+
const item = rows[current];
|
|
15426
|
+
if (event.key === "ArrowDown") return nextEnabled(count, current + 1, 1, disabled);
|
|
15427
|
+
if (event.key === "ArrowUp") return nextEnabled(count, current - 1, -1, disabled);
|
|
15428
|
+
if (event.key === "Home") return nextEnabled(count, 0, 1, disabled);
|
|
15429
|
+
if (event.key === "End") return nextEnabled(count, count - 1, -1, disabled);
|
|
15430
|
+
if (event.key === "PageDown" || event.key === "PageUp") {
|
|
15431
|
+
const step = event.key === "PageDown" ? 1 : -1;
|
|
15432
|
+
return nextEnabled(count, Math.max(0, Math.min(count - 1, current + step * Math.max(1, Math.floor(state.page / 36)))), step, disabled);
|
|
15433
|
+
}
|
|
15434
|
+
if (event.key === (state.dir === "rtl" ? "ArrowLeft" : "ArrowRight")) {
|
|
15435
|
+
if (!item?.hasChildren) return void 0;
|
|
15436
|
+
if (!expanded.includes(item._id)) return void 0;
|
|
15437
|
+
const child = nextEnabled(count, current + 1, 1, disabled);
|
|
15438
|
+
return rows[child]?.level === item.level + 1 ? child : -1;
|
|
15439
|
+
}
|
|
15440
|
+
if (event.key === (state.dir === "rtl" ? "ArrowRight" : "ArrowLeft")) {
|
|
15441
|
+
if (!item || expanded.includes(item._id)) return void 0;
|
|
15442
|
+
if (!item.parentItem) return -1;
|
|
15443
|
+
const parent = state.getKey(item.parentItem);
|
|
15444
|
+
return rows.findIndex((row) => row._id === parent);
|
|
15445
|
+
}
|
|
15446
|
+
if (event.key.length === 1 && event.key !== " ") return typeaheadMatch(rows.map((row) => row.value.label), state.typeahead.extend(event.key), current, disabled);
|
|
15447
|
+
}
|
|
15448
|
+
function survivingTreeAncestor(rows, previous, active, getKey) {
|
|
15449
|
+
let removed = previous?.find((row) => row._id === active);
|
|
15450
|
+
let target = -1;
|
|
15451
|
+
while (removed?.parentItem && target < 0) {
|
|
15452
|
+
const parent = getKey(removed.parentItem);
|
|
15453
|
+
target = rows.findIndex((row) => row._id === parent);
|
|
15454
|
+
removed = previous?.find((row) => row._id === parent);
|
|
15455
|
+
}
|
|
15456
|
+
return target;
|
|
15457
|
+
}
|
|
15458
|
+
//#endregion
|
|
14509
15459
|
//#region src/lib/reka/useVirtualTree.ts
|
|
14510
15460
|
function useVirtualTree(props, viewport) {
|
|
14511
15461
|
const root = injectTreeRootContext();
|
|
14512
15462
|
const body = shallowRef();
|
|
14513
15463
|
const active = shallowRef();
|
|
14514
15464
|
const index = computed(() => props.items.findIndex((item) => item._id === active.value));
|
|
14515
|
-
const disabled = (i) =>
|
|
15465
|
+
const disabled = (i) => virtualTreeDisabled(props.items, i, root.disabled.value, props.disabled);
|
|
14516
15466
|
const selected = computed(() => props.items.findIndex((item) => root.selectedKeys.value.includes(item._id)));
|
|
14517
15467
|
const collection = useVirtualCollection({
|
|
14518
15468
|
items: () => props.items,
|
|
@@ -14539,34 +15489,20 @@ function useVirtualTree(props, viewport) {
|
|
|
14539
15489
|
}
|
|
14540
15490
|
const first = () => nextEnabled(props.items.length, 0, 1, disabled);
|
|
14541
15491
|
const last = () => nextEnabled(props.items.length, props.items.length - 1, -1, disabled);
|
|
14542
|
-
|
|
14543
|
-
let searchedAt = 0;
|
|
15492
|
+
const typeahead = createChoiceTypeahead();
|
|
14544
15493
|
function keydown(event) {
|
|
14545
|
-
if (event.defaultPrevented || event.isComposing ||
|
|
14546
|
-
const
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
if (!item?.hasChildren) return;
|
|
14558
|
-
if (!root.expanded.value.includes(item._id)) return;
|
|
14559
|
-
const child = nextEnabled(props.items.length, current + 1, 1, disabled);
|
|
14560
|
-
if (props.items[child]?.level === item.level + 1) target = child;
|
|
14561
|
-
} else if (event.key === (root.dir.value === "rtl" ? "ArrowRight" : "ArrowLeft")) {
|
|
14562
|
-
if (!item || root.expanded.value.includes(item._id)) return;
|
|
14563
|
-
if (item.parentItem) target = props.items.findIndex((row) => row._id === root.getKey(item.parentItem));
|
|
14564
|
-
} else if (event.key.length === 1 && event.key !== " ") {
|
|
14565
|
-
const now = Date.now();
|
|
14566
|
-
search = (now - searchedAt > 1e3 ? "" : search) + event.key;
|
|
14567
|
-
searchedAt = now;
|
|
14568
|
-
target = typeaheadMatch(props.items.map((row) => row.value.label), search, current, disabled);
|
|
14569
|
-
} else return;
|
|
15494
|
+
if (event.defaultPrevented || event.isComposing || root.disabled.value) return;
|
|
15495
|
+
const target = virtualTreeKeyTarget(event, {
|
|
15496
|
+
rows: props.items,
|
|
15497
|
+
current: index.value,
|
|
15498
|
+
expanded: root.expanded.value,
|
|
15499
|
+
dir: root.dir.value,
|
|
15500
|
+
page: viewport.value?.clientHeight ?? 320,
|
|
15501
|
+
getKey: root.getKey,
|
|
15502
|
+
disabled,
|
|
15503
|
+
typeahead
|
|
15504
|
+
});
|
|
15505
|
+
if (target === void 0) return;
|
|
14570
15506
|
event.preventDefault();
|
|
14571
15507
|
event.stopImmediatePropagation();
|
|
14572
15508
|
focus(target);
|
|
@@ -14578,13 +15514,7 @@ function useVirtualTree(props, viewport) {
|
|
|
14578
15514
|
});
|
|
14579
15515
|
watch(() => props.items, (items, old) => {
|
|
14580
15516
|
if (index.value >= 0 || !active.value) return;
|
|
14581
|
-
|
|
14582
|
-
let target = -1;
|
|
14583
|
-
while (removed?.parentItem && target < 0) {
|
|
14584
|
-
const parent = root.getKey(removed.parentItem);
|
|
14585
|
-
target = items.findIndex((item) => item._id === parent);
|
|
14586
|
-
removed = old?.find((item) => item._id === parent);
|
|
14587
|
-
}
|
|
15517
|
+
const target = survivingTreeAncestor(items, old, active.value, root.getKey);
|
|
14588
15518
|
focus(target >= 0 ? target : first(), body.value?.contains(document.activeElement));
|
|
14589
15519
|
}, { flush: "pre" });
|
|
14590
15520
|
watch(viewport, (element) => {
|
|
@@ -14707,7 +15637,7 @@ var TreeRows_default = /* @__PURE__ */ defineComponent({
|
|
|
14707
15637
|
}
|
|
14708
15638
|
});
|
|
14709
15639
|
//#endregion
|
|
14710
|
-
//#region src/
|
|
15640
|
+
//#region ../shared/src/lib/tree/selection.ts
|
|
14711
15641
|
function indexTree(nodes) {
|
|
14712
15642
|
const entries = /* @__PURE__ */ new Map();
|
|
14713
15643
|
function visit(node, parent, disabled = false) {
|
|
@@ -14770,29 +15700,48 @@ function toggleChecked(tree, values, value) {
|
|
|
14770
15700
|
const next = checkedState(tree, [...checked]);
|
|
14771
15701
|
return [...[...checked].filter((value) => !tree.entries.has(value)), ...[...tree.entries.keys()].filter((value) => next.get(value).selected)];
|
|
14772
15702
|
}
|
|
15703
|
+
function treeKey(node) {
|
|
15704
|
+
return `${typeof node.value}:${node.value}`;
|
|
15705
|
+
}
|
|
15706
|
+
function treeStates(tree, multiple, model) {
|
|
15707
|
+
if (multiple) return checkedState(tree, Array.isArray(model) ? model : []);
|
|
15708
|
+
return new Map([...tree.entries].map(([value, entry]) => [value, {
|
|
15709
|
+
selected: value === model,
|
|
15710
|
+
indeterminate: false,
|
|
15711
|
+
disabled: entry.disabled
|
|
15712
|
+
}]));
|
|
15713
|
+
}
|
|
15714
|
+
function selectedTreeNodes(tree, states) {
|
|
15715
|
+
return [...tree.entries.values()].filter((entry) => states.get(entry.node.value)?.selected).map((entry) => entry.node);
|
|
15716
|
+
}
|
|
15717
|
+
function treeKeyMap(tree) {
|
|
15718
|
+
return new Map([...tree.entries].map(([value, entry]) => [treeKey(entry.node), value]));
|
|
15719
|
+
}
|
|
15720
|
+
function expandedTreeKeys(values) {
|
|
15721
|
+
return values.map((value) => treeKey({ value }));
|
|
15722
|
+
}
|
|
15723
|
+
function expandedTreeValues(keys, expanded) {
|
|
15724
|
+
return expanded.flatMap((key) => keys.has(key) ? [keys.get(key)] : []);
|
|
15725
|
+
}
|
|
15726
|
+
function nextTreeModel(tree, multiple, model, value) {
|
|
15727
|
+
return multiple ? toggleChecked(tree, Array.isArray(model) ? model : [], value) : model === value ? null : value;
|
|
15728
|
+
}
|
|
14773
15729
|
//#endregion
|
|
14774
15730
|
//#region src/components/tree/composables/useTree.ts
|
|
14775
15731
|
function useTree(props, model, expandedModel, disabled) {
|
|
14776
15732
|
const initialExpanded = [...props.defaultExpanded];
|
|
14777
15733
|
const index = computed(() => indexTree(props.items));
|
|
14778
|
-
const states = computed(() =>
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
selected: value === model.value,
|
|
14782
|
-
indeterminate: false,
|
|
14783
|
-
disabled: entry.disabled
|
|
14784
|
-
}]));
|
|
14785
|
-
});
|
|
14786
|
-
const selected = computed(() => [...index.value.entries.values()].filter((entry) => states.value.get(entry.node.value)?.selected).map((entry) => entry.node));
|
|
14787
|
-
const keys = computed(() => new Map([...index.value.entries].map(([value, entry]) => [key(entry.node), value])));
|
|
15734
|
+
const states = computed(() => treeStates(index.value, props.multiple, model.value));
|
|
15735
|
+
const selected = computed(() => selectedTreeNodes(index.value, states.value));
|
|
15736
|
+
const keys = computed(() => treeKeyMap(index.value));
|
|
14788
15737
|
const expanded = computed({
|
|
14789
|
-
get: () => (expandedModel.value ?? initialExpanded)
|
|
15738
|
+
get: () => expandedTreeKeys(expandedModel.value ?? initialExpanded),
|
|
14790
15739
|
set: (value) => {
|
|
14791
|
-
expandedModel.value =
|
|
15740
|
+
expandedModel.value = expandedTreeValues(keys.value, value);
|
|
14792
15741
|
}
|
|
14793
15742
|
});
|
|
14794
15743
|
function key(node) {
|
|
14795
|
-
return
|
|
15744
|
+
return treeKey(node);
|
|
14796
15745
|
}
|
|
14797
15746
|
function getChildren(node) {
|
|
14798
15747
|
return node.children?.length ? node.children : void 0;
|
|
@@ -14808,7 +15757,7 @@ function useTree(props, model, expandedModel, disabled) {
|
|
|
14808
15757
|
event.preventDefault();
|
|
14809
15758
|
const node = event.detail.value;
|
|
14810
15759
|
if (!node || state(node).disabled) return;
|
|
14811
|
-
model.value =
|
|
15760
|
+
model.value = nextTreeModel(index.value, props.multiple, model.value, node.value);
|
|
14812
15761
|
}
|
|
14813
15762
|
function toggle(node) {
|
|
14814
15763
|
if (state(node).disabled || !getChildren(node)) return;
|
|
@@ -15088,7 +16037,7 @@ var TreeSelectSearch_default = /* @__PURE__ */ defineComponent({
|
|
|
15088
16037
|
}
|
|
15089
16038
|
});
|
|
15090
16039
|
//#endregion
|
|
15091
|
-
//#region src/
|
|
16040
|
+
//#region ../shared/src/types/tree-select.ts
|
|
15092
16041
|
function findNode(nodes, value) {
|
|
15093
16042
|
for (const node of nodes) {
|
|
15094
16043
|
if (node.value === value) return node;
|
|
@@ -15107,7 +16056,7 @@ function pathTo(nodes, value, trail = []) {
|
|
|
15107
16056
|
return null;
|
|
15108
16057
|
}
|
|
15109
16058
|
//#endregion
|
|
15110
|
-
//#region src/
|
|
16059
|
+
//#region ../shared/src/lib/tree-select/filter.ts
|
|
15111
16060
|
function filterTree(nodes, matches) {
|
|
15112
16061
|
const children = /* @__PURE__ */ new Map();
|
|
15113
16062
|
const expanded = [];
|
|
@@ -17830,7 +18779,7 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
|
|
|
17830
18779
|
}
|
|
17831
18780
|
});
|
|
17832
18781
|
//#endregion
|
|
17833
|
-
//#region src/lib/date.ts
|
|
18782
|
+
//#region ../shared/src/lib/date.ts
|
|
17834
18783
|
var TIME_LENGTH = {
|
|
17835
18784
|
hour: 5,
|
|
17836
18785
|
minute: 5,
|
|
@@ -18046,7 +18995,7 @@ var CalendarHeader_default = /* @__PURE__ */ defineComponent({
|
|
|
18046
18995
|
}
|
|
18047
18996
|
});
|
|
18048
18997
|
//#endregion
|
|
18049
|
-
//#region src/
|
|
18998
|
+
//#region ../shared/src/lib/calendar/format.ts
|
|
18050
18999
|
var local = (date) => date.toDate(getLocalTimeZone());
|
|
18051
19000
|
function formatMonthHeading(tag, date) {
|
|
18052
19001
|
return new Intl.DateTimeFormat(tag, {
|
|
@@ -18895,7 +19844,7 @@ var DatePicker_default = /* @__PURE__ */ defineComponent({
|
|
|
18895
19844
|
//#region ../shared/src/variants/date-range-field.ts
|
|
18896
19845
|
var dateRangeFieldSeparator = tv({ base: "text-faint shrink-0 px-1 select-none" });
|
|
18897
19846
|
//#endregion
|
|
18898
|
-
//#region src/
|
|
19847
|
+
//#region ../shared/src/lib/date-range-field/validity.ts
|
|
18899
19848
|
function outside(value, { min, max }) {
|
|
18900
19849
|
if (!value) return false;
|
|
18901
19850
|
return !!min && value.compare(min) < 0 || !!max && value.compare(max) > 0;
|
|
@@ -19117,7 +20066,7 @@ var rangeCalendarDay = tv({
|
|
|
19117
20066
|
]
|
|
19118
20067
|
});
|
|
19119
20068
|
//#endregion
|
|
19120
|
-
//#region src/
|
|
20069
|
+
//#region ../shared/src/lib/range-calendar/limit.ts
|
|
19121
20070
|
function maximumDaysMatcher(start, end, maximumDays) {
|
|
19122
20071
|
if (!start || end || !maximumDays) return void 0;
|
|
19123
20072
|
const reach = maximumDays - 1;
|
|
@@ -19902,7 +20851,7 @@ var ratingStar = tv({
|
|
|
19902
20851
|
});
|
|
19903
20852
|
var ratingFill = tv({ base: "absolute inset-y-0 start-0 overflow-hidden" });
|
|
19904
20853
|
//#endregion
|
|
19905
|
-
//#region src/
|
|
20854
|
+
//#region ../shared/src/lib/rating.ts
|
|
19906
20855
|
function starFill(value, index) {
|
|
19907
20856
|
const portion = Math.min(Math.max(value - (index - 1), 0), 1);
|
|
19908
20857
|
return `${Math.round(portion * 1e3) / 10}%`;
|
|
@@ -20130,7 +21079,7 @@ var fileUploadItem = tv({ base: "bg-subtle flex min-w-0 items-center gap-3 round
|
|
|
20130
21079
|
var fileUploadThumb = tv({ base: "text-muted flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-sm bg-inset [&>img]:size-full [&>img]:object-cover [&>svg]:size-5" });
|
|
20131
21080
|
var fileUploadMeta = tv({ base: "flex min-w-0 flex-1 flex-col" });
|
|
20132
21081
|
//#endregion
|
|
20133
|
-
//#region src/
|
|
21082
|
+
//#region ../shared/src/lib/file-upload/select.ts
|
|
20134
21083
|
function matchesAccept(file, accept) {
|
|
20135
21084
|
if (!accept) return true;
|
|
20136
21085
|
const name = file.name.toLowerCase();
|
|
@@ -20182,7 +21131,7 @@ function selectFiles(current, incoming, rules) {
|
|
|
20182
21131
|
};
|
|
20183
21132
|
}
|
|
20184
21133
|
//#endregion
|
|
20185
|
-
//#region src/
|
|
21134
|
+
//#region ../shared/src/lib/file-upload/size.ts
|
|
20186
21135
|
var UNITS = [
|
|
20187
21136
|
"byte",
|
|
20188
21137
|
"kilobyte",
|
|
@@ -22052,7 +23001,7 @@ var meterLegend = tv({ base: "flex flex-wrap gap-x-4 gap-y-1 text-sm" });
|
|
|
22052
23001
|
var meterLegendItem = tv({ base: "inline-flex items-center gap-1.5" });
|
|
22053
23002
|
var meterValue = tv({ base: "text-muted tabular-nums" });
|
|
22054
23003
|
//#endregion
|
|
22055
|
-
//#region src/
|
|
23004
|
+
//#region ../shared/src/lib/meter-group.ts
|
|
22056
23005
|
var METER_TONES = [
|
|
22057
23006
|
"accent",
|
|
22058
23007
|
"info",
|
|
@@ -22555,7 +23504,7 @@ var bannerIcons = {
|
|
|
22555
23504
|
accent: Megaphone
|
|
22556
23505
|
};
|
|
22557
23506
|
//#endregion
|
|
22558
|
-
//#region src/
|
|
23507
|
+
//#region ../shared/src/lib/banner.ts
|
|
22559
23508
|
function stepBetween(previous, next, count) {
|
|
22560
23509
|
if (count < 2) return 1;
|
|
22561
23510
|
const from = (previous % count + count) % count;
|
|
@@ -23077,12 +24026,12 @@ var MenubarRadioItem_default = /* @__PURE__ */ defineComponent({
|
|
|
23077
24026
|
}
|
|
23078
24027
|
});
|
|
23079
24028
|
//#endregion
|
|
23080
|
-
//#region src/
|
|
24029
|
+
//#region ../shared/src/lib/form/standard-schema.ts
|
|
23081
24030
|
function isStandardSchema(rules) {
|
|
23082
24031
|
return typeof rules === "object" && rules !== null && "~standard" in rules;
|
|
23083
24032
|
}
|
|
23084
24033
|
//#endregion
|
|
23085
|
-
//#region src/
|
|
24034
|
+
//#region ../shared/src/lib/form/errors.ts
|
|
23086
24035
|
function issueKey(issue) {
|
|
23087
24036
|
return (issue.path ?? []).map((part) => String(typeof part === "object" && part !== null ? part.key : part)).join(".");
|
|
23088
24037
|
}
|
|
@@ -23106,7 +24055,7 @@ async function runRules(rules, values) {
|
|
|
23106
24055
|
return await rules(values);
|
|
23107
24056
|
}
|
|
23108
24057
|
//#endregion
|
|
23109
|
-
//#region src/
|
|
24058
|
+
//#region ../shared/src/lib/form/values.ts
|
|
23110
24059
|
function isPlain(value) {
|
|
23111
24060
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
23112
24061
|
}
|
|
@@ -23125,31 +24074,41 @@ function same(a, b) {
|
|
|
23125
24074
|
return false;
|
|
23126
24075
|
}
|
|
23127
24076
|
//#endregion
|
|
23128
|
-
//#region src/
|
|
23129
|
-
function
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
24077
|
+
//#region ../shared/src/behavior/form.ts
|
|
24078
|
+
function createForm(options) {
|
|
24079
|
+
let found = {};
|
|
24080
|
+
let touched = /* @__PURE__ */ new Set();
|
|
24081
|
+
let submitted = false;
|
|
24082
|
+
let submitting = false;
|
|
24083
|
+
let server = /* @__PURE__ */ new Map();
|
|
23135
24084
|
let pending;
|
|
23136
24085
|
let validation = 0;
|
|
23137
24086
|
let submission = 0;
|
|
23138
24087
|
let initial = snapshot(options.values());
|
|
24088
|
+
let version = 0;
|
|
24089
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
24090
|
+
function notify() {
|
|
24091
|
+
version++;
|
|
24092
|
+
for (const listener of [...listeners]) listener();
|
|
24093
|
+
}
|
|
23139
24094
|
function shown(key) {
|
|
23140
|
-
if (submitted
|
|
24095
|
+
if (submitted || touched.has(key)) return true;
|
|
23141
24096
|
return options.validateOn() === "change" && !same(readPath(options.values(), key), readPath(initial, key));
|
|
23142
24097
|
}
|
|
23143
|
-
|
|
24098
|
+
function errors() {
|
|
23144
24099
|
const result = {};
|
|
23145
|
-
for (const [key, message] of Object.entries(found
|
|
23146
|
-
for (const [key, entry] of server
|
|
24100
|
+
for (const [key, message] of Object.entries(found)) if (key !== "" && shown(key)) result[key] = message;
|
|
24101
|
+
for (const [key, entry] of server) result[key] = entry.message;
|
|
23147
24102
|
return result;
|
|
23148
|
-
}
|
|
23149
|
-
|
|
23150
|
-
|
|
24103
|
+
}
|
|
24104
|
+
function formError() {
|
|
24105
|
+
return found[""];
|
|
24106
|
+
}
|
|
24107
|
+
function invalid() {
|
|
24108
|
+
return Object.keys(errors()).length > 0 || !!formError();
|
|
24109
|
+
}
|
|
23151
24110
|
async function validate() {
|
|
23152
|
-
const
|
|
24111
|
+
const current = ++validation;
|
|
23153
24112
|
const values = snapshot(options.values());
|
|
23154
24113
|
const rules = options.rules();
|
|
23155
24114
|
const request = {
|
|
@@ -23159,8 +24118,9 @@ function useForm(options) {
|
|
|
23159
24118
|
pending = request;
|
|
23160
24119
|
try {
|
|
23161
24120
|
const result = await runRules(rules, values);
|
|
23162
|
-
if (
|
|
23163
|
-
found
|
|
24121
|
+
if (current !== validation || rules !== options.rules() || !same(values, options.values())) return false;
|
|
24122
|
+
found = result;
|
|
24123
|
+
notify();
|
|
23164
24124
|
return Object.keys(result).length === 0;
|
|
23165
24125
|
} finally {
|
|
23166
24126
|
if (pending === request) pending = void 0;
|
|
@@ -23171,31 +24131,39 @@ function useForm(options) {
|
|
|
23171
24131
|
validate();
|
|
23172
24132
|
}
|
|
23173
24133
|
function touch(name) {
|
|
23174
|
-
if (touched.
|
|
23175
|
-
touched
|
|
24134
|
+
if (touched.has(name)) return;
|
|
24135
|
+
touched = new Set(touched).add(name);
|
|
24136
|
+
notify();
|
|
23176
24137
|
if (options.validateOn() !== "submit") revalidate();
|
|
23177
24138
|
}
|
|
23178
24139
|
function onChange() {
|
|
23179
24140
|
const values = options.values();
|
|
23180
|
-
if (server.
|
|
23181
|
-
const next = new Map(server
|
|
24141
|
+
if (server.size) {
|
|
24142
|
+
const next = new Map(server);
|
|
23182
24143
|
for (const [key, entry] of next) if (readPath(values, key) !== entry.value) next.delete(key);
|
|
23183
|
-
if (next.size !== server.
|
|
24144
|
+
if (next.size !== server.size) {
|
|
24145
|
+
server = next;
|
|
24146
|
+
notify();
|
|
24147
|
+
}
|
|
23184
24148
|
}
|
|
23185
|
-
if (submitted
|
|
24149
|
+
if (submitted || options.validateOn() !== "submit") revalidate();
|
|
23186
24150
|
}
|
|
23187
24151
|
async function submit(handler) {
|
|
23188
|
-
if (submitting
|
|
23189
|
-
const
|
|
24152
|
+
if (submitting) return false;
|
|
24153
|
+
const current = ++submission;
|
|
23190
24154
|
const values = snapshot(options.values());
|
|
23191
|
-
submitted
|
|
23192
|
-
submitting
|
|
24155
|
+
submitted = true;
|
|
24156
|
+
submitting = true;
|
|
24157
|
+
notify();
|
|
23193
24158
|
try {
|
|
23194
|
-
if (!await validate() ||
|
|
24159
|
+
if (!await validate() || current !== submission || server.size || !same(values, options.values())) return false;
|
|
23195
24160
|
await handler?.(options.values());
|
|
23196
24161
|
return true;
|
|
23197
24162
|
} finally {
|
|
23198
|
-
if (
|
|
24163
|
+
if (current === submission) {
|
|
24164
|
+
submitting = false;
|
|
24165
|
+
notify();
|
|
24166
|
+
}
|
|
23199
24167
|
}
|
|
23200
24168
|
}
|
|
23201
24169
|
function setErrors(next) {
|
|
@@ -23205,25 +24173,35 @@ function useForm(options) {
|
|
|
23205
24173
|
message,
|
|
23206
24174
|
value: readPath(values, key)
|
|
23207
24175
|
});
|
|
23208
|
-
server
|
|
24176
|
+
server = map;
|
|
24177
|
+
notify();
|
|
23209
24178
|
}
|
|
23210
24179
|
function reset() {
|
|
23211
24180
|
validation++;
|
|
23212
24181
|
submission++;
|
|
23213
24182
|
pending = void 0;
|
|
23214
|
-
submitting
|
|
23215
|
-
found
|
|
23216
|
-
touched
|
|
23217
|
-
submitted
|
|
23218
|
-
server
|
|
24183
|
+
submitting = false;
|
|
24184
|
+
found = {};
|
|
24185
|
+
touched = /* @__PURE__ */ new Set();
|
|
24186
|
+
submitted = false;
|
|
24187
|
+
server = /* @__PURE__ */ new Map();
|
|
23219
24188
|
initial = snapshot(options.values());
|
|
24189
|
+
notify();
|
|
24190
|
+
}
|
|
24191
|
+
function subscribe(listener) {
|
|
24192
|
+
listeners.add(listener);
|
|
24193
|
+
return () => {
|
|
24194
|
+
listeners.delete(listener);
|
|
24195
|
+
};
|
|
23220
24196
|
}
|
|
23221
24197
|
return {
|
|
23222
24198
|
errors,
|
|
23223
24199
|
formError,
|
|
23224
24200
|
invalid,
|
|
23225
|
-
submitted,
|
|
23226
|
-
submitting,
|
|
24201
|
+
submitted: () => submitted,
|
|
24202
|
+
submitting: () => submitting,
|
|
24203
|
+
version: () => version,
|
|
24204
|
+
subscribe,
|
|
23227
24205
|
validate,
|
|
23228
24206
|
touch,
|
|
23229
24207
|
onChange,
|
|
@@ -23233,6 +24211,34 @@ function useForm(options) {
|
|
|
23233
24211
|
};
|
|
23234
24212
|
}
|
|
23235
24213
|
//#endregion
|
|
24214
|
+
//#region src/components/form/composables/useForm.ts
|
|
24215
|
+
function useForm(options) {
|
|
24216
|
+
const form = createForm(options);
|
|
24217
|
+
const version = shallowRef(form.version());
|
|
24218
|
+
form.subscribe(() => {
|
|
24219
|
+
version.value = form.version();
|
|
24220
|
+
});
|
|
24221
|
+
function track(read) {
|
|
24222
|
+
return computed(() => {
|
|
24223
|
+
version.value;
|
|
24224
|
+
return read();
|
|
24225
|
+
});
|
|
24226
|
+
}
|
|
24227
|
+
return {
|
|
24228
|
+
errors: track(form.errors),
|
|
24229
|
+
formError: track(form.formError),
|
|
24230
|
+
invalid: track(form.invalid),
|
|
24231
|
+
submitted: track(form.submitted),
|
|
24232
|
+
submitting: track(form.submitting),
|
|
24233
|
+
validate: form.validate,
|
|
24234
|
+
touch: form.touch,
|
|
24235
|
+
onChange: form.onChange,
|
|
24236
|
+
submit: form.submit,
|
|
24237
|
+
setErrors: form.setErrors,
|
|
24238
|
+
reset: form.reset
|
|
24239
|
+
};
|
|
24240
|
+
}
|
|
24241
|
+
//#endregion
|
|
23236
24242
|
//#region src/components/form/context.ts
|
|
23237
24243
|
var FORM_KEY = Symbol("hn-form");
|
|
23238
24244
|
function provideForm(context) {
|
|
@@ -23245,7 +24251,7 @@ function injectForm() {
|
|
|
23245
24251
|
//#region ../shared/src/variants/form.ts
|
|
23246
24252
|
var formRoot = tv({ base: "flex flex-col gap-4" });
|
|
23247
24253
|
//#endregion
|
|
23248
|
-
//#region src/
|
|
24254
|
+
//#region ../shared/src/lib/form/focus.ts
|
|
23249
24255
|
var FOCUSABLE = "input,select,textarea,button,[tabindex],[contenteditable=\"true\"]";
|
|
23250
24256
|
function focusFirstInvalid(root) {
|
|
23251
24257
|
const invalid = root.querySelector("[aria-invalid=\"true\"]");
|
|
@@ -23410,7 +24416,8 @@ var FormField_default = /* @__PURE__ */ defineComponent({
|
|
|
23410
24416
|
const t = useUiLocale();
|
|
23411
24417
|
const form = injectForm();
|
|
23412
24418
|
const root = shallowRef(null);
|
|
23413
|
-
const
|
|
24419
|
+
const body = shallowRef(null);
|
|
24420
|
+
const hooks = collapseHooks("y", () => body.value);
|
|
23414
24421
|
const id = useId();
|
|
23415
24422
|
const labelId = useId();
|
|
23416
24423
|
const descriptionId = useId();
|
|
@@ -23484,6 +24491,8 @@ var FormField_default = /* @__PURE__ */ defineComponent({
|
|
|
23484
24491
|
id: unref(descriptionId),
|
|
23485
24492
|
class: normalizeClass(unref(formFieldDescription)())
|
|
23486
24493
|
}, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(props.description), 1)])], 10, _hoisted_3$20)) : createCommentVNode("", true)], 2)) : createCommentVNode("", true), createElementVNode("div", {
|
|
24494
|
+
ref_key: "body",
|
|
24495
|
+
ref: body,
|
|
23487
24496
|
"data-hn-form-field-body": "",
|
|
23488
24497
|
class: normalizeClass(unref(formFieldContent)())
|
|
23489
24498
|
}, [
|
|
@@ -23951,7 +24960,7 @@ var Mark_default = /* @__PURE__ */ defineComponent({
|
|
|
23951
24960
|
}
|
|
23952
24961
|
});
|
|
23953
24962
|
//#endregion
|
|
23954
|
-
//#region src/
|
|
24963
|
+
//#region ../shared/src/lib/highlighter.ts
|
|
23955
24964
|
var langLoaders = {
|
|
23956
24965
|
typescript: () => import("shiki/langs/typescript.mjs"),
|
|
23957
24966
|
tsx: () => import("shiki/langs/tsx.mjs"),
|
|
@@ -24188,7 +25197,7 @@ var DescriptionDetails_default = /* @__PURE__ */ defineComponent({
|
|
|
24188
25197
|
}
|
|
24189
25198
|
});
|
|
24190
25199
|
//#endregion
|
|
24191
|
-
//#region src/
|
|
25200
|
+
//#region ../shared/src/lib/relative-time.ts
|
|
24192
25201
|
var DIVISIONS = [
|
|
24193
25202
|
[60, "second"],
|
|
24194
25203
|
[60, "minute"],
|
|
@@ -24875,6 +25884,8 @@ var CollapsibleTrigger_default = /* @__PURE__ */ defineComponent({
|
|
|
24875
25884
|
class: {}
|
|
24876
25885
|
},
|
|
24877
25886
|
setup(__props) {
|
|
25887
|
+
const root = injectCollapsibleRootContext();
|
|
25888
|
+
root.contentId ||= useId$1(void 0, "reka-collapsible-content");
|
|
24878
25889
|
const props = __props;
|
|
24879
25890
|
const slots = useSlots();
|
|
24880
25891
|
return (_ctx, _cache) => {
|
|
@@ -25009,6 +26020,8 @@ var AccordionTrigger_default = /* @__PURE__ */ defineComponent({
|
|
|
25009
26020
|
class: {}
|
|
25010
26021
|
},
|
|
25011
26022
|
setup(__props) {
|
|
26023
|
+
const root = injectCollapsibleRootContext();
|
|
26024
|
+
root.contentId ||= useId$1(void 0, "reka-collapsible-content");
|
|
25012
26025
|
const props = __props;
|
|
25013
26026
|
const slots = useSlots();
|
|
25014
26027
|
return (_ctx, _cache) => {
|
|
@@ -25919,52 +26932,85 @@ var Section_default = /* @__PURE__ */ defineComponent({
|
|
|
25919
26932
|
}
|
|
25920
26933
|
});
|
|
25921
26934
|
//#endregion
|
|
26935
|
+
//#region ../shared/src/lib/anchor.ts
|
|
26936
|
+
var SCROLL_SPY_OPTIONS = {
|
|
26937
|
+
rootMargin: "0px 0px -15% 0px",
|
|
26938
|
+
threshold: [0, Number.EPSILON]
|
|
26939
|
+
};
|
|
26940
|
+
function anchorEntries(items) {
|
|
26941
|
+
return items.flatMap((item) => [{
|
|
26942
|
+
id: item.id,
|
|
26943
|
+
label: item.label,
|
|
26944
|
+
depth: 0,
|
|
26945
|
+
item
|
|
26946
|
+
}, ...(item.children ?? []).map((child) => ({
|
|
26947
|
+
id: child.id,
|
|
26948
|
+
label: child.label,
|
|
26949
|
+
depth: 1,
|
|
26950
|
+
item: child
|
|
26951
|
+
}))]);
|
|
26952
|
+
}
|
|
26953
|
+
function coveredEntries(entries, visible) {
|
|
26954
|
+
return entries.filter((entry) => visible.has(entry.id));
|
|
26955
|
+
}
|
|
26956
|
+
function coveredSpan(entries, visible) {
|
|
26957
|
+
const rows = entries.flatMap((entry, index) => visible.has(entry.id) ? [index] : []);
|
|
26958
|
+
return rows.length ? `${rows[0] + 1} / ${rows.at(-1) + 2}` : void 0;
|
|
26959
|
+
}
|
|
26960
|
+
function sameTargets(next, previous) {
|
|
26961
|
+
return next.length === previous.length && next.every((entry, index) => entry.id === previous[index]?.id);
|
|
26962
|
+
}
|
|
26963
|
+
function hashTarget(entries) {
|
|
26964
|
+
const hash = decodeURIComponent(location.hash.slice(1));
|
|
26965
|
+
return hash && entries.some((entry) => entry.id === hash) ? hash : void 0;
|
|
26966
|
+
}
|
|
26967
|
+
function spyTargets(entries) {
|
|
26968
|
+
return entries.map(({ id }) => document.getElementById(id));
|
|
26969
|
+
}
|
|
26970
|
+
function applyIntersections(intersecting, observed, current) {
|
|
26971
|
+
for (const entry of observed) if (entry.isIntersecting && entry.intersectionRatio > 0) intersecting.add(entry.target.id);
|
|
26972
|
+
else intersecting.delete(entry.target.id);
|
|
26973
|
+
return intersecting.size ? new Set(intersecting) : new Set(current ? [current] : []);
|
|
26974
|
+
}
|
|
26975
|
+
function jumpToAnchor(event, id) {
|
|
26976
|
+
const el = document.getElementById(id);
|
|
26977
|
+
if (!el) return false;
|
|
26978
|
+
event.preventDefault();
|
|
26979
|
+
el.scrollIntoView({
|
|
26980
|
+
behavior: prefersReducedMotion() ? "auto" : "smooth",
|
|
26981
|
+
block: "start"
|
|
26982
|
+
});
|
|
26983
|
+
history.replaceState(history.state, "", `#${id}`);
|
|
26984
|
+
return true;
|
|
26985
|
+
}
|
|
26986
|
+
//#endregion
|
|
25922
26987
|
//#region src/components/anchor/composables/useScrollSpy.ts
|
|
25923
26988
|
function useScrollSpy(entries) {
|
|
25924
26989
|
const visible = shallowRef(/* @__PURE__ */ new Set());
|
|
25925
26990
|
const targets = shallowRef([]);
|
|
25926
26991
|
const intersecting = /* @__PURE__ */ new Set();
|
|
25927
|
-
const covered = computed(() => entries()
|
|
26992
|
+
const covered = computed(() => coveredEntries(entries(), visible.value));
|
|
25928
26993
|
const current = computed(() => covered.value[0]?.id);
|
|
25929
|
-
const span = computed(() =>
|
|
25930
|
-
const rows = entries().flatMap((entry, index) => visible.value.has(entry.id) ? [index] : []);
|
|
25931
|
-
return rows.length ? `${rows[0] + 1} / ${rows.at(-1) + 2}` : void 0;
|
|
25932
|
-
});
|
|
26994
|
+
const span = computed(() => coveredSpan(entries(), visible.value));
|
|
25933
26995
|
useIntersectionObserver(targets, (observed) => {
|
|
25934
|
-
|
|
25935
|
-
|
|
25936
|
-
visible.value = intersecting.size ? new Set(intersecting) : new Set(current.value ? [current.value] : []);
|
|
25937
|
-
}, {
|
|
25938
|
-
rootMargin: "0px 0px -15% 0px",
|
|
25939
|
-
threshold: [0, Number.EPSILON]
|
|
25940
|
-
});
|
|
25941
|
-
function targetOf(id) {
|
|
25942
|
-
return document.getElementById(id);
|
|
25943
|
-
}
|
|
26996
|
+
visible.value = applyIntersections(intersecting, observed, current.value);
|
|
26997
|
+
}, SCROLL_SPY_OPTIONS);
|
|
25944
26998
|
function locate() {
|
|
25945
26999
|
intersecting.clear();
|
|
25946
|
-
targets.value = entries()
|
|
27000
|
+
targets.value = spyTargets(entries());
|
|
25947
27001
|
}
|
|
25948
27002
|
onMounted(() => {
|
|
25949
|
-
const hash =
|
|
25950
|
-
if (hash
|
|
27003
|
+
const hash = hashTarget(entries());
|
|
27004
|
+
if (hash) visible.value = /* @__PURE__ */ new Set([hash]);
|
|
25951
27005
|
locate();
|
|
25952
27006
|
watch(entries, (next, previous) => {
|
|
25953
|
-
if (next
|
|
27007
|
+
if (sameTargets(next, previous)) return;
|
|
25954
27008
|
visible.value = /* @__PURE__ */ new Set();
|
|
25955
27009
|
locate();
|
|
25956
27010
|
});
|
|
25957
27011
|
});
|
|
25958
27012
|
function jump(event, id) {
|
|
25959
|
-
|
|
25960
|
-
if (!el) return;
|
|
25961
|
-
event.preventDefault();
|
|
25962
|
-
el.scrollIntoView({
|
|
25963
|
-
behavior: prefersReducedMotion() ? "auto" : "smooth",
|
|
25964
|
-
block: "start"
|
|
25965
|
-
});
|
|
25966
|
-
history.replaceState(history.state, "", `#${id}`);
|
|
25967
|
-
visible.value = /* @__PURE__ */ new Set([id]);
|
|
27013
|
+
if (jumpToAnchor(event, id)) visible.value = /* @__PURE__ */ new Set([id]);
|
|
25968
27014
|
}
|
|
25969
27015
|
return {
|
|
25970
27016
|
visible,
|
|
@@ -25977,57 +27023,41 @@ function useScrollSpy(entries) {
|
|
|
25977
27023
|
//#endregion
|
|
25978
27024
|
//#region src/components/anchor/composables/useAnchor.ts
|
|
25979
27025
|
function useAnchor(items) {
|
|
25980
|
-
const entries = computed(() => items()
|
|
25981
|
-
id: item.id,
|
|
25982
|
-
label: item.label,
|
|
25983
|
-
depth: 0,
|
|
25984
|
-
item
|
|
25985
|
-
}, ...(item.children ?? []).map((child) => ({
|
|
25986
|
-
id: child.id,
|
|
25987
|
-
label: child.label,
|
|
25988
|
-
depth: 1,
|
|
25989
|
-
item: child
|
|
25990
|
-
}))]));
|
|
27026
|
+
const entries = computed(() => anchorEntries(items()));
|
|
25991
27027
|
return {
|
|
25992
27028
|
entries,
|
|
25993
27029
|
...useScrollSpy(() => entries.value)
|
|
25994
27030
|
};
|
|
25995
27031
|
}
|
|
25996
27032
|
//#endregion
|
|
25997
|
-
//#region src/
|
|
25998
|
-
function
|
|
25999
|
-
const
|
|
26000
|
-
|
|
26001
|
-
let
|
|
27033
|
+
//#region ../shared/src/behavior/anchor-follow.ts
|
|
27034
|
+
function findViewport(nav, target) {
|
|
27035
|
+
const doc = nav.ownerDocument;
|
|
27036
|
+
const view = doc.defaultView;
|
|
27037
|
+
for (let node = nav; node && node !== doc.body && node !== doc.documentElement; node = node.parentElement) {
|
|
27038
|
+
if (node.contains(target)) break;
|
|
27039
|
+
if (/^(auto|scroll|overlay)$/.test(view.getComputedStyle(node).overflowY)) return node;
|
|
27040
|
+
}
|
|
27041
|
+
}
|
|
27042
|
+
function createAnchorFollow() {
|
|
26002
27043
|
let lastCurrent;
|
|
26003
27044
|
let lastEnd;
|
|
26004
|
-
function
|
|
26005
|
-
|
|
26006
|
-
const view = doc.defaultView;
|
|
26007
|
-
for (let node = nav; node && node !== doc.body && node !== doc.documentElement; node = node.parentElement) {
|
|
26008
|
-
if (node.contains(target)) break;
|
|
26009
|
-
if (/^(auto|scroll|overlay)$/.test(view.getComputedStyle(node).overflowY)) return node;
|
|
26010
|
-
}
|
|
26011
|
-
}
|
|
26012
|
-
function follow() {
|
|
26013
|
-
frame = 0;
|
|
26014
|
-
const nav = root.value;
|
|
26015
|
-
const id = current.value;
|
|
26016
|
-
if (!enabled() || !nav || !id) return;
|
|
27045
|
+
function follow({ nav, current: id, lastCovered, enabled }) {
|
|
27046
|
+
if (!enabled || !nav || !id) return;
|
|
26017
27047
|
const target = nav.ownerDocument.getElementById(id);
|
|
26018
27048
|
const link = nav.querySelector("a[aria-current=\"location\"]");
|
|
26019
27049
|
if (!target || !link || !link.getClientRects().length) return;
|
|
26020
27050
|
const port = findViewport(nav, target);
|
|
26021
|
-
|
|
26022
|
-
const endId = lastCovered
|
|
27051
|
+
const result = { viewport: port };
|
|
27052
|
+
const endId = lastCovered ?? id;
|
|
26023
27053
|
const changed = lastCurrent !== void 0 && (lastCurrent !== id || lastEnd !== endId);
|
|
26024
27054
|
lastCurrent = id;
|
|
26025
27055
|
lastEnd = endId;
|
|
26026
|
-
if (!port || port.clientHeight <= 0 || port.scrollHeight <= port.clientHeight) return;
|
|
27056
|
+
if (!port || port.clientHeight <= 0 || port.scrollHeight <= port.clientHeight) return result;
|
|
26027
27057
|
const box = port.getBoundingClientRect();
|
|
26028
27058
|
let row = link.getBoundingClientRect();
|
|
26029
27059
|
const scale = port.offsetHeight ? box.height / port.offsetHeight : 1;
|
|
26030
|
-
if (scale <= 0) return;
|
|
27060
|
+
if (scale <= 0) return result;
|
|
26031
27061
|
if (endId !== id) {
|
|
26032
27062
|
const end = nav.querySelector(`a[href="#${CSS.escape(endId)}"]`);
|
|
26033
27063
|
if (end?.getClientRects().length) {
|
|
@@ -26042,8 +27072,8 @@ function useAnchorFollow(root, current, lastCovered, enabled) {
|
|
|
26042
27072
|
}
|
|
26043
27073
|
const top = box.top + port.clientTop * scale;
|
|
26044
27074
|
const bottom = top + port.clientHeight * scale;
|
|
26045
|
-
if (row.top >= top && row.bottom <= bottom) return;
|
|
26046
|
-
if (row.top <= top && row.bottom >= bottom) return;
|
|
27075
|
+
if (row.top >= top && row.bottom <= bottom) return result;
|
|
27076
|
+
if (row.top <= top && row.bottom >= bottom) return result;
|
|
26047
27077
|
const style = port.ownerDocument.defaultView.getComputedStyle(port);
|
|
26048
27078
|
const margin = Math.min(row.height / scale / 2, port.clientHeight / 4);
|
|
26049
27079
|
const padding = (value) => Math.min(Math.max(0, (port.clientHeight - row.height / scale) / 2), value === "auto" ? margin : (parseFloat(value) || 0) * (value.endsWith("%") ? port.clientHeight / 100 : 1));
|
|
@@ -26051,11 +27081,31 @@ function useAnchorFollow(root, current, lastCovered, enabled) {
|
|
|
26051
27081
|
const after = padding(style.scrollPaddingBottom);
|
|
26052
27082
|
const delta = row.height > bottom - top || row.top < top ? (row.top - top) / scale - before : (row.bottom - bottom) / scale + after;
|
|
26053
27083
|
const next = Math.max(0, Math.min(port.scrollHeight - port.clientHeight, port.scrollTop + delta));
|
|
26054
|
-
if (Math.abs(next - port.scrollTop) < 1) return;
|
|
27084
|
+
if (Math.abs(next - port.scrollTop) < 1) return result;
|
|
26055
27085
|
port.scrollTo({
|
|
26056
27086
|
top: next,
|
|
26057
27087
|
behavior: changed && !prefersReducedMotion() ? "smooth" : "instant"
|
|
26058
27088
|
});
|
|
27089
|
+
return result;
|
|
27090
|
+
}
|
|
27091
|
+
return { follow };
|
|
27092
|
+
}
|
|
27093
|
+
//#endregion
|
|
27094
|
+
//#region src/components/anchor/composables/useAnchorFollow.ts
|
|
27095
|
+
function useAnchorFollow(root, current, lastCovered, enabled) {
|
|
27096
|
+
const viewport = shallowRef();
|
|
27097
|
+
const follower = createAnchorFollow();
|
|
27098
|
+
let mounted = false;
|
|
27099
|
+
let frame = 0;
|
|
27100
|
+
function follow() {
|
|
27101
|
+
frame = 0;
|
|
27102
|
+
const result = follower.follow({
|
|
27103
|
+
nav: root.value,
|
|
27104
|
+
current: current.value,
|
|
27105
|
+
lastCovered: lastCovered.value,
|
|
27106
|
+
enabled: enabled()
|
|
27107
|
+
});
|
|
27108
|
+
if (result) viewport.value = result.viewport;
|
|
26059
27109
|
}
|
|
26060
27110
|
function schedule() {
|
|
26061
27111
|
if (mounted && !frame) frame = requestAnimationFrame(follow);
|
|
@@ -26680,198 +27730,230 @@ var SidebarTrigger_default = /* @__PURE__ */ defineComponent({
|
|
|
26680
27730
|
}
|
|
26681
27731
|
});
|
|
26682
27732
|
//#endregion
|
|
26683
|
-
//#region src/
|
|
27733
|
+
//#region ../shared/src/behavior/toast.ts
|
|
26684
27734
|
var MAX_VISIBLE = 5;
|
|
26685
27735
|
var SETTLE_DELAY = (DURATION.exit + .06) * 1e3;
|
|
26686
|
-
var seed = 0;
|
|
26687
|
-
var toastState = reactive({ items: [] });
|
|
26688
|
-
var timers = /* @__PURE__ */ new Map();
|
|
26689
|
-
var pauseReasons = /* @__PURE__ */ new Set();
|
|
26690
|
-
function fire(id) {
|
|
26691
|
-
timers.delete(id);
|
|
26692
|
-
const item = toastState.items.find((t) => t.id === id);
|
|
26693
|
-
if (item) close(item, "auto");
|
|
26694
|
-
}
|
|
26695
|
-
function startTimer(item) {
|
|
26696
|
-
stopTimer(item.id);
|
|
26697
|
-
if (item.duration <= 0) return;
|
|
26698
|
-
const timer = {
|
|
26699
|
-
handle: void 0,
|
|
26700
|
-
remaining: item.duration,
|
|
26701
|
-
startedAt: Date.now()
|
|
26702
|
-
};
|
|
26703
|
-
timers.set(item.id, timer);
|
|
26704
|
-
if (pauseReasons.size === 0) timer.handle = setTimeout(() => fire(item.id), timer.remaining);
|
|
26705
|
-
}
|
|
26706
|
-
function stopTimer(id) {
|
|
26707
|
-
const timer = timers.get(id);
|
|
26708
|
-
if (timer?.handle) clearTimeout(timer.handle);
|
|
26709
|
-
timers.delete(id);
|
|
26710
|
-
}
|
|
26711
|
-
function pauseTimers(reason) {
|
|
26712
|
-
if (pauseReasons.has(reason)) return;
|
|
26713
|
-
const wasRunning = pauseReasons.size === 0;
|
|
26714
|
-
pauseReasons.add(reason);
|
|
26715
|
-
if (!wasRunning) return;
|
|
26716
|
-
for (const timer of timers.values()) {
|
|
26717
|
-
if (!timer.handle) continue;
|
|
26718
|
-
clearTimeout(timer.handle);
|
|
26719
|
-
timer.handle = void 0;
|
|
26720
|
-
timer.remaining = Math.max(0, timer.remaining - (Date.now() - timer.startedAt));
|
|
26721
|
-
}
|
|
26722
|
-
}
|
|
26723
|
-
function resumeTimers(reason) {
|
|
26724
|
-
pauseReasons.delete(reason);
|
|
26725
|
-
if (pauseReasons.size > 0) return;
|
|
26726
|
-
for (const [id, timer] of timers) {
|
|
26727
|
-
if (timer.handle) continue;
|
|
26728
|
-
timer.startedAt = Date.now();
|
|
26729
|
-
timer.handle = setTimeout(() => fire(id), timer.remaining);
|
|
26730
|
-
}
|
|
26731
|
-
}
|
|
26732
|
-
function settle(item) {
|
|
26733
|
-
const index = toastState.items.indexOf(item);
|
|
26734
|
-
if (index >= 0) toastState.items.splice(index, 1);
|
|
26735
|
-
}
|
|
26736
|
-
function close(item, source) {
|
|
26737
|
-
if (!item.open) return;
|
|
26738
|
-
item.open = false;
|
|
26739
|
-
stopTimer(item.id);
|
|
26740
|
-
if (source === "auto") item.onAutoClose?.(item.id);
|
|
26741
|
-
item.onDismiss?.(item.id);
|
|
26742
|
-
setTimeout(() => settle(item), SETTLE_DELAY);
|
|
26743
|
-
}
|
|
26744
|
-
function dismiss(id) {
|
|
26745
|
-
for (const item of toastState.items) {
|
|
26746
|
-
if (id !== void 0 && item.id !== id) continue;
|
|
26747
|
-
close(item, "manual");
|
|
26748
|
-
}
|
|
26749
|
-
}
|
|
26750
27736
|
function defaultDuration(tone) {
|
|
26751
27737
|
return tone === "loading" ? 0 : 4e3;
|
|
26752
27738
|
}
|
|
26753
|
-
function push(message, options = {}) {
|
|
26754
|
-
const tone = options.tone ?? "neutral";
|
|
26755
|
-
const existing = options.id !== void 0 ? toastState.items.find((t) => t.id === options.id) : void 0;
|
|
26756
|
-
if (existing && existing.open) {
|
|
26757
|
-
existing.tone = tone;
|
|
26758
|
-
existing.message = message;
|
|
26759
|
-
existing.description = options.description;
|
|
26760
|
-
existing.duration = options.duration ?? defaultDuration(tone);
|
|
26761
|
-
existing.action = options.action;
|
|
26762
|
-
existing.cancel = options.cancel;
|
|
26763
|
-
existing.component = options.component ? markRaw(options.component) : void 0;
|
|
26764
|
-
existing.componentProps = options.componentProps;
|
|
26765
|
-
if (options.onDismiss) existing.onDismiss = options.onDismiss;
|
|
26766
|
-
if (options.onAutoClose) existing.onAutoClose = options.onAutoClose;
|
|
26767
|
-
startTimer(existing);
|
|
26768
|
-
return existing.id;
|
|
26769
|
-
}
|
|
26770
|
-
if (existing) settle(existing);
|
|
26771
|
-
const item = {
|
|
26772
|
-
id: options.id ?? ++seed,
|
|
26773
|
-
tone,
|
|
26774
|
-
message,
|
|
26775
|
-
description: options.description,
|
|
26776
|
-
duration: options.duration ?? defaultDuration(tone),
|
|
26777
|
-
open: true,
|
|
26778
|
-
action: options.action,
|
|
26779
|
-
cancel: options.cancel,
|
|
26780
|
-
component: options.component ? markRaw(options.component) : void 0,
|
|
26781
|
-
componentProps: options.componentProps,
|
|
26782
|
-
onDismiss: options.onDismiss,
|
|
26783
|
-
onAutoClose: options.onAutoClose
|
|
26784
|
-
};
|
|
26785
|
-
toastState.items.push(item);
|
|
26786
|
-
startTimer(item);
|
|
26787
|
-
const visible = toastState.items.filter((t) => t.open);
|
|
26788
|
-
for (const stale of visible.slice(0, Math.max(0, visible.length - MAX_VISIBLE))) close(stale, "manual");
|
|
26789
|
-
return item.id;
|
|
26790
|
-
}
|
|
26791
27739
|
function resolveMessage(input, value) {
|
|
26792
27740
|
const raw = typeof input === "function" ? input(value) : input;
|
|
26793
27741
|
if (typeof raw === "string") return { message: raw };
|
|
26794
27742
|
return raw;
|
|
26795
27743
|
}
|
|
26796
|
-
function
|
|
26797
|
-
const
|
|
26798
|
-
|
|
26799
|
-
|
|
26800
|
-
|
|
26801
|
-
|
|
26802
|
-
|
|
26803
|
-
|
|
26804
|
-
|
|
27744
|
+
function createToastStore(options) {
|
|
27745
|
+
const state = options.state;
|
|
27746
|
+
const wrap = options.raw ?? ((component) => component);
|
|
27747
|
+
const notify = options.notify ?? (() => {});
|
|
27748
|
+
let seed = 0;
|
|
27749
|
+
const timers = /* @__PURE__ */ new Map();
|
|
27750
|
+
const pauseReasons = /* @__PURE__ */ new Set();
|
|
27751
|
+
function fire(id) {
|
|
27752
|
+
timers.delete(id);
|
|
27753
|
+
const item = state.items.find((t) => t.id === id);
|
|
27754
|
+
if (item) close(item, "auto");
|
|
27755
|
+
}
|
|
27756
|
+
function startTimer(item) {
|
|
27757
|
+
stopTimer(item.id);
|
|
27758
|
+
if (item.duration <= 0) return;
|
|
27759
|
+
const timer = {
|
|
27760
|
+
handle: void 0,
|
|
27761
|
+
remaining: item.duration,
|
|
27762
|
+
startedAt: Date.now()
|
|
27763
|
+
};
|
|
27764
|
+
timers.set(item.id, timer);
|
|
27765
|
+
if (pauseReasons.size === 0) timer.handle = setTimeout(() => fire(item.id), timer.remaining);
|
|
27766
|
+
}
|
|
27767
|
+
function stopTimer(id) {
|
|
27768
|
+
const timer = timers.get(id);
|
|
27769
|
+
if (timer?.handle) clearTimeout(timer.handle);
|
|
27770
|
+
timers.delete(id);
|
|
27771
|
+
}
|
|
27772
|
+
function pauseTimers(reason) {
|
|
27773
|
+
if (pauseReasons.has(reason)) return;
|
|
27774
|
+
const wasRunning = pauseReasons.size === 0;
|
|
27775
|
+
pauseReasons.add(reason);
|
|
27776
|
+
if (!wasRunning) return;
|
|
27777
|
+
for (const timer of timers.values()) {
|
|
27778
|
+
if (!timer.handle) continue;
|
|
27779
|
+
clearTimeout(timer.handle);
|
|
27780
|
+
timer.handle = void 0;
|
|
27781
|
+
timer.remaining = Math.max(0, timer.remaining - (Date.now() - timer.startedAt));
|
|
27782
|
+
}
|
|
27783
|
+
}
|
|
27784
|
+
function resumeTimers(reason) {
|
|
27785
|
+
pauseReasons.delete(reason);
|
|
27786
|
+
if (pauseReasons.size > 0) return;
|
|
27787
|
+
for (const [id, timer] of timers) {
|
|
27788
|
+
if (timer.handle) continue;
|
|
27789
|
+
timer.startedAt = Date.now();
|
|
27790
|
+
timer.handle = setTimeout(() => fire(id), timer.remaining);
|
|
27791
|
+
}
|
|
27792
|
+
}
|
|
27793
|
+
function settle(item) {
|
|
27794
|
+
const index = state.items.indexOf(item);
|
|
27795
|
+
if (index >= 0) state.items.splice(index, 1);
|
|
27796
|
+
notify();
|
|
27797
|
+
}
|
|
27798
|
+
function close(item, source) {
|
|
27799
|
+
if (!item.open) return;
|
|
27800
|
+
item.open = false;
|
|
27801
|
+
stopTimer(item.id);
|
|
27802
|
+
notify();
|
|
27803
|
+
if (source === "auto") item.onAutoClose?.(item.id);
|
|
27804
|
+
item.onDismiss?.(item.id);
|
|
27805
|
+
setTimeout(() => settle(item), SETTLE_DELAY);
|
|
27806
|
+
}
|
|
27807
|
+
function dismiss(id) {
|
|
27808
|
+
for (const item of state.items) {
|
|
27809
|
+
if (id !== void 0 && item.id !== id) continue;
|
|
27810
|
+
close(item, "manual");
|
|
27811
|
+
}
|
|
27812
|
+
}
|
|
27813
|
+
function push(message, options = {}) {
|
|
27814
|
+
const tone = options.tone ?? "neutral";
|
|
27815
|
+
const existing = options.id !== void 0 ? state.items.find((t) => t.id === options.id) : void 0;
|
|
27816
|
+
if (existing && existing.open) {
|
|
27817
|
+
existing.tone = tone;
|
|
27818
|
+
existing.message = message;
|
|
27819
|
+
existing.description = options.description;
|
|
27820
|
+
existing.duration = options.duration ?? defaultDuration(tone);
|
|
27821
|
+
existing.action = options.action;
|
|
27822
|
+
existing.cancel = options.cancel;
|
|
27823
|
+
existing.component = options.component ? wrap(options.component) : void 0;
|
|
27824
|
+
existing.componentProps = options.componentProps;
|
|
27825
|
+
if (options.onDismiss) existing.onDismiss = options.onDismiss;
|
|
27826
|
+
if (options.onAutoClose) existing.onAutoClose = options.onAutoClose;
|
|
27827
|
+
startTimer(existing);
|
|
27828
|
+
notify();
|
|
27829
|
+
return existing.id;
|
|
27830
|
+
}
|
|
27831
|
+
if (existing) settle(existing);
|
|
27832
|
+
const item = {
|
|
27833
|
+
id: options.id ?? ++seed,
|
|
27834
|
+
tone,
|
|
27835
|
+
message,
|
|
27836
|
+
description: options.description,
|
|
27837
|
+
duration: options.duration ?? defaultDuration(tone),
|
|
27838
|
+
open: true,
|
|
27839
|
+
action: options.action,
|
|
27840
|
+
cancel: options.cancel,
|
|
27841
|
+
component: options.component ? wrap(options.component) : void 0,
|
|
27842
|
+
componentProps: options.componentProps,
|
|
27843
|
+
onDismiss: options.onDismiss,
|
|
27844
|
+
onAutoClose: options.onAutoClose
|
|
27845
|
+
};
|
|
27846
|
+
state.items.push(item);
|
|
27847
|
+
startTimer(item);
|
|
27848
|
+
notify();
|
|
27849
|
+
const visible = state.items.filter((t) => t.open);
|
|
27850
|
+
for (const stale of visible.slice(0, Math.max(0, visible.length - MAX_VISIBLE))) close(stale, "manual");
|
|
27851
|
+
return item.id;
|
|
27852
|
+
}
|
|
27853
|
+
function promiseToast(promise, messages, options = {}) {
|
|
27854
|
+
const id = push(messages.loading, {
|
|
26805
27855
|
...options,
|
|
26806
|
-
|
|
26807
|
-
|
|
26808
|
-
description: done.description
|
|
27856
|
+
tone: "loading",
|
|
27857
|
+
duration: 0
|
|
26809
27858
|
});
|
|
26810
|
-
|
|
26811
|
-
|
|
26812
|
-
|
|
26813
|
-
|
|
26814
|
-
|
|
26815
|
-
|
|
26816
|
-
|
|
27859
|
+
promise.then((value) => {
|
|
27860
|
+
const done = resolveMessage(messages.success, value);
|
|
27861
|
+
push(done.message, {
|
|
27862
|
+
...options,
|
|
27863
|
+
id,
|
|
27864
|
+
tone: "success",
|
|
27865
|
+
description: done.description
|
|
27866
|
+
});
|
|
27867
|
+
}).catch((reason) => {
|
|
27868
|
+
const done = resolveMessage(messages.error, reason);
|
|
27869
|
+
push(done.message, {
|
|
27870
|
+
...options,
|
|
27871
|
+
id,
|
|
27872
|
+
tone: "danger",
|
|
27873
|
+
description: done.description
|
|
27874
|
+
});
|
|
26817
27875
|
});
|
|
26818
|
-
|
|
26819
|
-
|
|
27876
|
+
return promise;
|
|
27877
|
+
}
|
|
27878
|
+
return {
|
|
27879
|
+
toast: Object.assign((message, options) => push(message, options), {
|
|
27880
|
+
success: (message, options) => push(message, {
|
|
27881
|
+
...options,
|
|
27882
|
+
tone: "success"
|
|
27883
|
+
}),
|
|
27884
|
+
danger: (message, options) => push(message, {
|
|
27885
|
+
...options,
|
|
27886
|
+
tone: "danger"
|
|
27887
|
+
}),
|
|
27888
|
+
warning: (message, options) => push(message, {
|
|
27889
|
+
...options,
|
|
27890
|
+
tone: "warning"
|
|
27891
|
+
}),
|
|
27892
|
+
info: (message, options) => push(message, {
|
|
27893
|
+
...options,
|
|
27894
|
+
tone: "info"
|
|
27895
|
+
}),
|
|
27896
|
+
loading: (message, options) => push(message, {
|
|
27897
|
+
...options,
|
|
27898
|
+
tone: "loading"
|
|
27899
|
+
}),
|
|
27900
|
+
custom: (component, options) => {
|
|
27901
|
+
const { props: componentProps, ...rest } = options ?? {};
|
|
27902
|
+
return push("", {
|
|
27903
|
+
...rest,
|
|
27904
|
+
component,
|
|
27905
|
+
componentProps
|
|
27906
|
+
});
|
|
27907
|
+
},
|
|
27908
|
+
promise: promiseToast,
|
|
27909
|
+
dismiss
|
|
27910
|
+
}),
|
|
27911
|
+
dismiss,
|
|
27912
|
+
pauseTimers,
|
|
27913
|
+
resumeTimers
|
|
27914
|
+
};
|
|
26820
27915
|
}
|
|
26821
|
-
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
|
|
26834
|
-
|
|
26835
|
-
|
|
26836
|
-
|
|
26837
|
-
}),
|
|
26838
|
-
loading: (message, options) => push(message, {
|
|
26839
|
-
...options,
|
|
26840
|
-
tone: "loading"
|
|
26841
|
-
}),
|
|
26842
|
-
custom: (component, options) => {
|
|
26843
|
-
const { props: componentProps, ...rest } = options ?? {};
|
|
26844
|
-
return push("", {
|
|
26845
|
-
...rest,
|
|
26846
|
-
component,
|
|
26847
|
-
componentProps
|
|
27916
|
+
//#endregion
|
|
27917
|
+
//#region src/components/toast/store.ts
|
|
27918
|
+
var toastState = reactive({ items: [] });
|
|
27919
|
+
var { toast, dismiss, pauseTimers, resumeTimers } = createToastStore({
|
|
27920
|
+
state: toastState,
|
|
27921
|
+
raw: (component) => markRaw(component)
|
|
27922
|
+
});
|
|
27923
|
+
function toastLayout(open, heightOf) {
|
|
27924
|
+
const map = /* @__PURE__ */ new Map();
|
|
27925
|
+
let offset = 0;
|
|
27926
|
+
for (let i = open.length - 1; i >= 0; i -= 1) {
|
|
27927
|
+
const item = open[i];
|
|
27928
|
+
const index = open.length - 1 - i;
|
|
27929
|
+
map.set(item.id, {
|
|
27930
|
+
index,
|
|
27931
|
+
offset
|
|
26848
27932
|
});
|
|
26849
|
-
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
}
|
|
27933
|
+
offset += (heightOf(item.id) ?? 0) + 12;
|
|
27934
|
+
}
|
|
27935
|
+
return map;
|
|
27936
|
+
}
|
|
27937
|
+
function toastItemStyle(slot, selfHeight, frontHeight) {
|
|
27938
|
+
return {
|
|
27939
|
+
"--hn-t-index": String(slot.index),
|
|
27940
|
+
"--hn-t-offset": `${slot.offset}px`,
|
|
27941
|
+
...selfHeight ? { "--hn-t-self-h": `${selfHeight}px` } : {},
|
|
27942
|
+
...frontHeight > 0 ? { "--hn-t-front-h": `${frontHeight}px` } : {}
|
|
27943
|
+
};
|
|
27944
|
+
}
|
|
27945
|
+
function toastCardHeight(body) {
|
|
27946
|
+
return body.offsetHeight + 34;
|
|
27947
|
+
}
|
|
26853
27948
|
//#endregion
|
|
26854
27949
|
//#region src/components/toast/composables/useToastLayout.ts
|
|
26855
|
-
var GAP = 12;
|
|
26856
|
-
var CARD_CHROME_BLOCK = 34;
|
|
26857
27950
|
function useToastLayout() {
|
|
26858
27951
|
const heights = reactive(/* @__PURE__ */ new Map());
|
|
26859
27952
|
const observers = /* @__PURE__ */ new Map();
|
|
26860
27953
|
const lastLayout = /* @__PURE__ */ new Map();
|
|
26861
27954
|
const openItems = computed(() => toastState.items.filter((item) => item.open));
|
|
26862
27955
|
const layout = computed(() => {
|
|
26863
|
-
const map =
|
|
26864
|
-
const open = openItems.value;
|
|
26865
|
-
let offset = 0;
|
|
26866
|
-
for (let i = open.length - 1; i >= 0; i -= 1) {
|
|
26867
|
-
const item = open[i];
|
|
26868
|
-
const index = open.length - 1 - i;
|
|
26869
|
-
map.set(item.id, {
|
|
26870
|
-
index,
|
|
26871
|
-
offset
|
|
26872
|
-
});
|
|
26873
|
-
offset += (heights.get(item.id) ?? 0) + GAP;
|
|
26874
|
-
}
|
|
27956
|
+
const map = toastLayout(openItems.value, (id) => heights.get(id));
|
|
26875
27957
|
for (const [id, slot] of map) lastLayout.set(id, slot);
|
|
26876
27958
|
return map;
|
|
26877
27959
|
});
|
|
@@ -26886,14 +27968,7 @@ function useToastLayout() {
|
|
|
26886
27968
|
};
|
|
26887
27969
|
}
|
|
26888
27970
|
function itemStyle(item) {
|
|
26889
|
-
|
|
26890
|
-
const selfHeight = heights.get(item.id);
|
|
26891
|
-
return {
|
|
26892
|
-
"--hn-t-index": String(slot.index),
|
|
26893
|
-
"--hn-t-offset": `${slot.offset}px`,
|
|
26894
|
-
...selfHeight ? { "--hn-t-self-h": `${selfHeight}px` } : {},
|
|
26895
|
-
...frontHeight.value > 0 ? { "--hn-t-front-h": `${frontHeight.value}px` } : {}
|
|
26896
|
-
};
|
|
27971
|
+
return toastItemStyle(slotOf(item), heights.get(item.id), frontHeight.value);
|
|
26897
27972
|
}
|
|
26898
27973
|
function setItemRef(id, refValue) {
|
|
26899
27974
|
const el = refValue;
|
|
@@ -26902,10 +27977,10 @@ function useToastLayout() {
|
|
|
26902
27977
|
if (existing?.el === el) return;
|
|
26903
27978
|
existing?.observer.disconnect();
|
|
26904
27979
|
const observer = new ResizeObserver(() => {
|
|
26905
|
-
heights.set(id, el
|
|
27980
|
+
heights.set(id, toastCardHeight(el));
|
|
26906
27981
|
});
|
|
26907
27982
|
observer.observe(el);
|
|
26908
|
-
heights.set(id, el
|
|
27983
|
+
heights.set(id, toastCardHeight(el));
|
|
26909
27984
|
observers.set(id, {
|
|
26910
27985
|
observer,
|
|
26911
27986
|
el
|
|
@@ -27119,7 +28194,7 @@ var Toaster_default = /* @__PURE__ */ defineComponent({
|
|
|
27119
28194
|
}
|
|
27120
28195
|
});
|
|
27121
28196
|
//#endregion
|
|
27122
|
-
//#region src/
|
|
28197
|
+
//#region ../shared/src/behavior/spoiler/worklet.ts
|
|
27123
28198
|
var workletMain = () => {
|
|
27124
28199
|
const M = Math;
|
|
27125
28200
|
const lcgrand = (seed = 1) => (a = 0, b = 1) => a + M.abs(b - a) * (M.imul(48271, seed = M.imul(214013, seed) + 2531011) & 2147483647) / 2147483647;
|
|
@@ -27272,7 +28347,7 @@ var workletMain = () => {
|
|
|
27272
28347
|
};
|
|
27273
28348
|
var workletSource = `(${workletMain.toString()})()`;
|
|
27274
28349
|
//#endregion
|
|
27275
|
-
//#region src/
|
|
28350
|
+
//#region ../shared/src/behavior/spoiler/painter.ts
|
|
27276
28351
|
var isPaintWorkletSupported = typeof CSS !== "undefined" && CSS.paintWorklet !== void 0;
|
|
27277
28352
|
var workletRegistered = false;
|
|
27278
28353
|
function registerSpoilerWorklet() {
|
|
@@ -27452,7 +28527,7 @@ function useSpoiler(host, hidden, forceFallback) {
|
|
|
27452
28527
|
return { usesFallback };
|
|
27453
28528
|
}
|
|
27454
28529
|
//#endregion
|
|
27455
|
-
//#region src/
|
|
28530
|
+
//#region ../shared/src/lib/iris-origin.ts
|
|
27456
28531
|
function irisOrigin(rects, clientX, clientY) {
|
|
27457
28532
|
const valid = rects.filter((r) => r.width > 0 && r.height > 0);
|
|
27458
28533
|
if (valid.length === 0) return null;
|
|
@@ -27624,7 +28699,7 @@ var ImageGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
27624
28699
|
}
|
|
27625
28700
|
});
|
|
27626
28701
|
//#endregion
|
|
27627
|
-
//#region src/
|
|
28702
|
+
//#region ../shared/src/lib/scroll-restore.ts
|
|
27628
28703
|
var SCROLL_STATE_FIELD = "hnScroll";
|
|
27629
28704
|
var RESTORE_DEADLINE_MS = 3e3;
|
|
27630
28705
|
var SAVE_THROTTLE_MS = 500;
|
|
@@ -28125,7 +29200,7 @@ var DataTableText_default = /* @__PURE__ */ defineComponent({
|
|
|
28125
29200
|
}
|
|
28126
29201
|
});
|
|
28127
29202
|
//#endregion
|
|
28128
|
-
//#region src/
|
|
29203
|
+
//#region ../shared/src/lib/data-table/utils.ts
|
|
28129
29204
|
function rowId(key) {
|
|
28130
29205
|
return `${typeof key}:${key}`;
|
|
28131
29206
|
}
|
|
@@ -28551,6 +29626,140 @@ var features = tableFeatures({
|
|
|
28551
29626
|
paginatedRowModel: createPaginatedRowModel()
|
|
28552
29627
|
});
|
|
28553
29628
|
//#endregion
|
|
29629
|
+
//#region ../shared/src/lib/data-table/state.ts
|
|
29630
|
+
function keyOf(row, field) {
|
|
29631
|
+
return typeof field === "function" ? field(row) : row[field];
|
|
29632
|
+
}
|
|
29633
|
+
function labelOf(row, label, key) {
|
|
29634
|
+
return String(typeof label === "function" ? label(row) : label === void 0 ? key(row) : row[label]);
|
|
29635
|
+
}
|
|
29636
|
+
function valueOf(row, column) {
|
|
29637
|
+
return column.accessor ? column.accessor(row) : row[column.field ?? column.key];
|
|
29638
|
+
}
|
|
29639
|
+
function displayValue(row, column) {
|
|
29640
|
+
const value = valueOf(row, column);
|
|
29641
|
+
return column.format ? column.format(value, row) : value == null ? "—" : String(value);
|
|
29642
|
+
}
|
|
29643
|
+
function compareValues(left, right, collator) {
|
|
29644
|
+
if (typeof left === "number" && typeof right === "number") return left - right;
|
|
29645
|
+
if (left instanceof Date && right instanceof Date) return left.getTime() - right.getTime();
|
|
29646
|
+
return collator.compare(String(left), String(right));
|
|
29647
|
+
}
|
|
29648
|
+
function engineSorting(sorting) {
|
|
29649
|
+
return sorting.map((sort) => ({
|
|
29650
|
+
id: sort.key,
|
|
29651
|
+
desc: sort.desc
|
|
29652
|
+
}));
|
|
29653
|
+
}
|
|
29654
|
+
function modelSorting(sorting) {
|
|
29655
|
+
return sorting.map((sort) => ({
|
|
29656
|
+
key: sort.id,
|
|
29657
|
+
desc: sort.desc
|
|
29658
|
+
}));
|
|
29659
|
+
}
|
|
29660
|
+
function engineSelection(selected) {
|
|
29661
|
+
return Object.fromEntries(selected.map((key) => [rowId(key), true]));
|
|
29662
|
+
}
|
|
29663
|
+
function modelSelection(selection) {
|
|
29664
|
+
return Object.keys(selection).filter((key) => selection[key]).map(rowKey);
|
|
29665
|
+
}
|
|
29666
|
+
function engineColumnFilters(leaves, filters) {
|
|
29667
|
+
return filters.filter((filter) => leaves.some((column) => column.key === filter.key)).map((filter) => ({
|
|
29668
|
+
id: filter.key,
|
|
29669
|
+
value: filter.value
|
|
29670
|
+
}));
|
|
29671
|
+
}
|
|
29672
|
+
function engineGrouping(leaves, grouping) {
|
|
29673
|
+
return grouping.filter((key) => leaves.some((column) => column.key === key));
|
|
29674
|
+
}
|
|
29675
|
+
function engineExpanded(expanded, groups) {
|
|
29676
|
+
return Object.fromEntries([...expanded.map(rowId), ...groups].map((key) => [key, true]));
|
|
29677
|
+
}
|
|
29678
|
+
function engineVisibility(hidden) {
|
|
29679
|
+
return Object.fromEntries(hidden.map((key) => [key, false]));
|
|
29680
|
+
}
|
|
29681
|
+
function engineState(leaves, models, page, pageSize) {
|
|
29682
|
+
return {
|
|
29683
|
+
sorting: engineSorting(models.sorting),
|
|
29684
|
+
globalFilter: models.filter.trim(),
|
|
29685
|
+
columnFilters: engineColumnFilters(leaves, models.columnFilters),
|
|
29686
|
+
grouping: engineGrouping(leaves, models.grouping),
|
|
29687
|
+
expanded: engineExpanded(models.expanded, models.expandedGroups),
|
|
29688
|
+
pagination: {
|
|
29689
|
+
pageIndex: page - 1,
|
|
29690
|
+
pageSize
|
|
29691
|
+
},
|
|
29692
|
+
rowSelection: engineSelection(models.selected),
|
|
29693
|
+
columnVisibility: engineVisibility(models.hiddenColumns)
|
|
29694
|
+
};
|
|
29695
|
+
}
|
|
29696
|
+
function orderColumns(leaves, hidden, order) {
|
|
29697
|
+
const visible = leaves.filter((column) => !hidden.includes(column.key));
|
|
29698
|
+
const ranking = [.../* @__PURE__ */ new Set([...order, ...visible.map((column) => column.key)])];
|
|
29699
|
+
return visible.sort((a, b) => {
|
|
29700
|
+
const rank = (column) => column.pin === "start" ? 0 : column.pin === "end" ? 2 : 1;
|
|
29701
|
+
return rank(a) - rank(b) || ranking.indexOf(a.key) - ranking.indexOf(b.key);
|
|
29702
|
+
});
|
|
29703
|
+
}
|
|
29704
|
+
function toggleKey(list, key, next) {
|
|
29705
|
+
return next ? [.../* @__PURE__ */ new Set([...list, key])] : list.filter((item) => item !== key);
|
|
29706
|
+
}
|
|
29707
|
+
function nextColumnFilters(filters, column, value) {
|
|
29708
|
+
const next = filters.filter((filter) => filter.key !== column);
|
|
29709
|
+
if (value != null && value !== "" && !(Array.isArray(value) && !value.length)) next.push({
|
|
29710
|
+
key: column,
|
|
29711
|
+
value
|
|
29712
|
+
});
|
|
29713
|
+
return next;
|
|
29714
|
+
}
|
|
29715
|
+
function totalRows(manual, total, supplied, processed) {
|
|
29716
|
+
return manual ? Math.max(0, Math.floor(Number.isFinite(total) ? total : supplied)) : processed();
|
|
29717
|
+
}
|
|
29718
|
+
function pageCount(total, pageSize) {
|
|
29719
|
+
return Math.max(1, Math.ceil(total / pageSize));
|
|
29720
|
+
}
|
|
29721
|
+
function canGoNext(knownTotal, page, count, hasNextPage, rows, pageSize) {
|
|
29722
|
+
return knownTotal ? page < count : hasNextPage ?? rows >= pageSize;
|
|
29723
|
+
}
|
|
29724
|
+
function clampedPage(pagination, loading, knownTotal, page, count) {
|
|
29725
|
+
return pagination && !loading && knownTotal && page > count ? count : void 0;
|
|
29726
|
+
}
|
|
29727
|
+
function uniqueSelectable(rows) {
|
|
29728
|
+
return [...new Map(rows.filter((row) => row.getCanSelect()).map((row) => [row.id, row])).values()];
|
|
29729
|
+
}
|
|
29730
|
+
function selectionState(eligible) {
|
|
29731
|
+
if (!eligible.length) return false;
|
|
29732
|
+
const count = eligible.filter((row) => row.getIsSelected()).length;
|
|
29733
|
+
return count === eligible.length ? true : count || eligible.some((row) => row.getIsSomeSelected()) ? "indeterminate" : false;
|
|
29734
|
+
}
|
|
29735
|
+
function toggleSelection(selected, rows, value, cascade, key) {
|
|
29736
|
+
const keys = new Set(selected);
|
|
29737
|
+
for (const row of rows) {
|
|
29738
|
+
const descendants = cascade ? [row, ...row.getLeafRows()] : [row];
|
|
29739
|
+
for (const item of descendants) if (item.getCanSelect()) {
|
|
29740
|
+
if (value === true) keys.add(key(item.original));
|
|
29741
|
+
else keys.delete(key(item.original));
|
|
29742
|
+
}
|
|
29743
|
+
}
|
|
29744
|
+
return [...keys];
|
|
29745
|
+
}
|
|
29746
|
+
function sortLabel(next, messages) {
|
|
29747
|
+
return next === "asc" ? messages.sortAsc : next === "desc" ? messages.sortDesc : messages.sortNone;
|
|
29748
|
+
}
|
|
29749
|
+
function ariaSort(sorting) {
|
|
29750
|
+
return sorting ? sorting === "asc" ? "ascending" : "descending" : void 0;
|
|
29751
|
+
}
|
|
29752
|
+
function tableQuery(page, pageSize, models) {
|
|
29753
|
+
return {
|
|
29754
|
+
page,
|
|
29755
|
+
pageSize,
|
|
29756
|
+
sorting: models.sorting.map((sort) => ({ ...sort })),
|
|
29757
|
+
filter: models.filter,
|
|
29758
|
+
columnFilters: models.columnFilters.map((filter) => ({ ...filter })),
|
|
29759
|
+
grouping: [...models.grouping]
|
|
29760
|
+
};
|
|
29761
|
+
}
|
|
29762
|
+
//#endregion
|
|
28554
29763
|
//#region src/components/data-table/composables/useDataTable.ts
|
|
28555
29764
|
function useDataTable(props, models, onChange, onRowClick) {
|
|
28556
29765
|
const t = useUiLocale();
|
|
@@ -28563,27 +29772,24 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28563
29772
|
numeric: true,
|
|
28564
29773
|
sensitivity: "base"
|
|
28565
29774
|
}));
|
|
28566
|
-
const keyOf = (row) =>
|
|
28567
|
-
const labelOf = (row) =>
|
|
28568
|
-
const valueOf = (row, column) =>
|
|
29775
|
+
const keyOf$1 = (row) => keyOf(row, props.rowKey);
|
|
29776
|
+
const labelOf$1 = (row) => labelOf(row, props.rowLabel, keyOf$1);
|
|
29777
|
+
const valueOf$1 = (row, column) => valueOf(row, column);
|
|
28569
29778
|
const selectable = (row) => typeof props.selectable === "function" ? props.selectable(row) : !!props.selectable;
|
|
28570
29779
|
const expandable = (row) => typeof props.expandable === "function" ? props.expandable(row) : !!props.expandable;
|
|
28571
29780
|
const columns = computed(() => {
|
|
28572
29781
|
const compare = collator.value;
|
|
28573
29782
|
return leaves.value.map((column) => ({
|
|
28574
29783
|
id: column.key,
|
|
28575
|
-
accessorFn: (row) => valueOf(row, column) ?? void 0,
|
|
29784
|
+
accessorFn: (row) => valueOf$1(row, column) ?? void 0,
|
|
28576
29785
|
enableSorting: !!column.sortable,
|
|
28577
29786
|
enableGlobalFilter: column.filterable !== false,
|
|
28578
|
-
filterFn: (row, _id, value) => column.filterValue ? column.filterValue(row.original, value) : filterValue(valueOf(row.original, column), value, column.filterMode, t.value.tag),
|
|
29787
|
+
filterFn: (row, _id, value) => column.filterValue ? column.filterValue(row.original, value) : filterValue(valueOf$1(row.original, column), value, column.filterMode, t.value.tag),
|
|
28579
29788
|
sortDescFirst: false,
|
|
28580
29789
|
sortUndefined: "last",
|
|
28581
29790
|
sortFn: (a, b, id) => {
|
|
28582
29791
|
if (column.sort) return column.sort(a.original, b.original);
|
|
28583
|
-
|
|
28584
|
-
if (typeof left === "number" && typeof right === "number") return left - right;
|
|
28585
|
-
if (left instanceof Date && right instanceof Date) return left.getTime() - right.getTime();
|
|
28586
|
-
return compare.compare(String(left), String(right));
|
|
29792
|
+
return compareValues(a.getValue(id), b.getValue(id), compare);
|
|
28587
29793
|
}
|
|
28588
29794
|
}));
|
|
28589
29795
|
});
|
|
@@ -28591,7 +29797,7 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28591
29797
|
features,
|
|
28592
29798
|
data: computed(() => props.rows),
|
|
28593
29799
|
columns,
|
|
28594
|
-
getRowId: (row) => rowId(keyOf(row)),
|
|
29800
|
+
getRowId: (row) => rowId(keyOf$1(row)),
|
|
28595
29801
|
getSubRows: (row) => props.getChildren?.(row),
|
|
28596
29802
|
manualSorting: computed(() => !!props.manual),
|
|
28597
29803
|
manualFiltering: computed(() => !!props.manual),
|
|
@@ -28612,61 +29818,39 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28612
29818
|
const column = leaves.value.find((column) => column.key === id);
|
|
28613
29819
|
return column.filter ? column.filter(row.original, query) : filterValue(row.getValue(id), query, "contains", t.value.tag);
|
|
28614
29820
|
},
|
|
28615
|
-
state: computed(() => ({
|
|
28616
|
-
sorting: models.sorting.value
|
|
28617
|
-
|
|
28618
|
-
|
|
28619
|
-
|
|
28620
|
-
|
|
28621
|
-
|
|
28622
|
-
|
|
28623
|
-
|
|
28624
|
-
|
|
28625
|
-
grouping: models.grouping.value.filter((key) => leaves.value.some((column) => column.key === key)),
|
|
28626
|
-
expanded: Object.fromEntries([...models.expanded.value.map(rowId), ...models.expandedGroups.value].map((key) => [key, true])),
|
|
28627
|
-
pagination: {
|
|
28628
|
-
pageIndex: page.value - 1,
|
|
28629
|
-
pageSize: pageSize.value
|
|
28630
|
-
},
|
|
28631
|
-
rowSelection: Object.fromEntries(models.selected.value.map((key) => [rowId(key), true])),
|
|
28632
|
-
columnVisibility: Object.fromEntries(models.hiddenColumns.value.map((key) => [key, false]))
|
|
28633
|
-
})),
|
|
29821
|
+
state: computed(() => engineState(leaves.value, {
|
|
29822
|
+
sorting: models.sorting.value,
|
|
29823
|
+
filter: models.filter.value,
|
|
29824
|
+
columnFilters: models.columnFilters.value,
|
|
29825
|
+
grouping: models.grouping.value,
|
|
29826
|
+
selected: models.selected.value,
|
|
29827
|
+
expanded: models.expanded.value,
|
|
29828
|
+
expandedGroups: models.expandedGroups.value,
|
|
29829
|
+
hiddenColumns: models.hiddenColumns.value
|
|
29830
|
+
}, page.value, pageSize.value)),
|
|
28634
29831
|
onSortingChange: (updater) => {
|
|
28635
29832
|
if (blocked.value) return;
|
|
28636
|
-
const current = models.sorting.value
|
|
28637
|
-
id: sort.key,
|
|
28638
|
-
desc: sort.desc
|
|
28639
|
-
}));
|
|
29833
|
+
const current = engineSorting(models.sorting.value);
|
|
28640
29834
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
28641
|
-
models.sorting.value = next
|
|
28642
|
-
key: sort.id,
|
|
28643
|
-
desc: sort.desc
|
|
28644
|
-
}));
|
|
29835
|
+
models.sorting.value = modelSorting(next);
|
|
28645
29836
|
},
|
|
28646
29837
|
onRowSelectionChange: (updater) => {
|
|
28647
29838
|
if (blocked.value) return;
|
|
28648
|
-
const current =
|
|
29839
|
+
const current = engineSelection(models.selected.value);
|
|
28649
29840
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
28650
|
-
models.selected.value =
|
|
29841
|
+
models.selected.value = modelSelection(next);
|
|
28651
29842
|
}
|
|
28652
29843
|
});
|
|
28653
|
-
const visibleColumns = computed(() =>
|
|
28654
|
-
const visible = leaves.value.filter((column) => !models.hiddenColumns.value.includes(column.key));
|
|
28655
|
-
const order = [.../* @__PURE__ */ new Set([...models.columnOrder.value, ...visible.map((column) => column.key)])];
|
|
28656
|
-
return visible.sort((a, b) => {
|
|
28657
|
-
const rank = (column) => column.pin === "start" ? 0 : column.pin === "end" ? 2 : 1;
|
|
28658
|
-
return rank(a) - rank(b) || order.indexOf(a.key) - order.indexOf(b.key);
|
|
28659
|
-
});
|
|
28660
|
-
});
|
|
29844
|
+
const visibleColumns = computed(() => orderColumns(leaves.value, models.hiddenColumns.value, models.columnOrder.value));
|
|
28661
29845
|
const knownTotal = computed(() => !props.manual || props.total !== void 0);
|
|
28662
|
-
const total = computed(() => props.manual
|
|
28663
|
-
const pageCount = computed(() =>
|
|
28664
|
-
const canNext = computed(() => knownTotal.value
|
|
29846
|
+
const total = computed(() => totalRows(props.manual, props.total, props.rows.length, () => table.getPreExpandedRowModel().rows.length));
|
|
29847
|
+
const pageCount$1 = computed(() => pageCount(total.value, pageSize.value));
|
|
29848
|
+
const canNext = computed(() => canGoNext(knownTotal.value, page.value, pageCount$1.value, props.hasNextPage, props.rows.length, pageSize.value));
|
|
28665
29849
|
function toggleExpanded(key, value) {
|
|
28666
29850
|
if (blocked.value) return;
|
|
28667
29851
|
if (!table.getCoreRowModel().rowsById[rowId(key)]?.getCanExpand()) return;
|
|
28668
29852
|
const next = value ?? !models.expanded.value.includes(key);
|
|
28669
|
-
models.expanded.value =
|
|
29853
|
+
models.expanded.value = toggleKey(models.expanded.value, key, next);
|
|
28670
29854
|
}
|
|
28671
29855
|
function toggleSelected(key, value) {
|
|
28672
29856
|
if (blocked.value) return;
|
|
@@ -28676,7 +29860,7 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28676
29860
|
const rows = computed(() => table.getRowModel().rows.map((row) => {
|
|
28677
29861
|
const context = {
|
|
28678
29862
|
row: row.original,
|
|
28679
|
-
key: keyOf(row.original),
|
|
29863
|
+
key: keyOf$1(row.original),
|
|
28680
29864
|
index: row.index,
|
|
28681
29865
|
depth: row.depth,
|
|
28682
29866
|
selected: row.getIsSelected(),
|
|
@@ -28684,9 +29868,9 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28684
29868
|
indeterminate: props.selectChildren !== false && row.getIsSomeSelected(),
|
|
28685
29869
|
expanded: row.getIsExpanded(),
|
|
28686
29870
|
expandable: row.getCanExpand(),
|
|
28687
|
-
toggleSelected: (value) => toggleSelected(keyOf(row.original), value),
|
|
28688
|
-
toggleExpanded: (value) => toggleExpanded(keyOf(row.original), value),
|
|
28689
|
-
startEdit: (column) => api.startEdit(keyOf(row.original), column)
|
|
29871
|
+
toggleSelected: (value) => toggleSelected(keyOf$1(row.original), value),
|
|
29872
|
+
toggleExpanded: (value) => toggleExpanded(keyOf$1(row.original), value),
|
|
29873
|
+
startEdit: (column) => api.startEdit(keyOf$1(row.original), column)
|
|
28690
29874
|
};
|
|
28691
29875
|
const group = row.getIsGrouped() ? {
|
|
28692
29876
|
key: row.id,
|
|
@@ -28698,51 +29882,30 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28698
29882
|
toggleExpanded: (value) => {
|
|
28699
29883
|
if (blocked.value) return;
|
|
28700
29884
|
const next = value ?? !models.expandedGroups.value.includes(row.id);
|
|
28701
|
-
models.expandedGroups.value =
|
|
29885
|
+
models.expandedGroups.value = toggleKey(models.expandedGroups.value, row.id, next);
|
|
28702
29886
|
},
|
|
28703
29887
|
aggregate: (key) => {
|
|
28704
29888
|
const column = leaves.value.find((column) => column.key === key);
|
|
28705
|
-
return column ? aggregate(row.getLeafRows().map((leaf) => leaf.original), column, valueOf) : void 0;
|
|
29889
|
+
return column ? aggregate(row.getLeafRows().map((leaf) => leaf.original), column, valueOf$1) : void 0;
|
|
28706
29890
|
}
|
|
28707
29891
|
} : void 0;
|
|
28708
29892
|
return {
|
|
28709
29893
|
...context,
|
|
28710
29894
|
id: row.id,
|
|
28711
|
-
label: labelOf(row.original),
|
|
29895
|
+
label: labelOf$1(row.original),
|
|
28712
29896
|
group
|
|
28713
29897
|
};
|
|
28714
29898
|
}));
|
|
28715
|
-
const selectionRows = computed(() =>
|
|
28716
|
-
|
|
28717
|
-
return [...new Map(source.filter((row) => row.getCanSelect()).map((row) => [row.id, row])).values()];
|
|
28718
|
-
});
|
|
28719
|
-
const pageSelection = computed(() => {
|
|
28720
|
-
const eligible = selectionRows.value;
|
|
28721
|
-
if (!eligible.length) return false;
|
|
28722
|
-
const count = eligible.filter((row) => row.getIsSelected()).length;
|
|
28723
|
-
return count === eligible.length ? true : count || eligible.some((row) => row.getIsSomeSelected()) ? "indeterminate" : false;
|
|
28724
|
-
});
|
|
29899
|
+
const selectionRows = computed(() => uniqueSelectable(props.selectAll === "filtered" ? table.getFilteredRowModel().flatRows : table.getRowModel().rows.flatMap((row) => row.getIsGrouped() ? row.getLeafRows() : [row])));
|
|
29900
|
+
const pageSelection = computed(() => selectionState(selectionRows.value));
|
|
28725
29901
|
const selectionDisabled = computed(() => blocked.value || !selectionRows.value.length);
|
|
28726
29902
|
function togglePage(selected) {
|
|
28727
29903
|
if (blocked.value || props.selectionMode === "single") return;
|
|
28728
|
-
|
|
28729
|
-
for (const row of selectionRows.value) {
|
|
28730
|
-
const descendants = props.selectChildren === false ? [row] : [row, ...row.getLeafRows()];
|
|
28731
|
-
for (const item of descendants) if (item.getCanSelect()) {
|
|
28732
|
-
if (selected === true) keys.add(keyOf(item.original));
|
|
28733
|
-
else keys.delete(keyOf(item.original));
|
|
28734
|
-
}
|
|
28735
|
-
}
|
|
28736
|
-
models.selected.value = [...keys];
|
|
29904
|
+
models.selected.value = toggleSelection(models.selected.value, selectionRows.value, selected, props.selectChildren !== false, keyOf$1);
|
|
28737
29905
|
}
|
|
28738
29906
|
function setFilter(column, value) {
|
|
28739
29907
|
if (blocked.value) return;
|
|
28740
|
-
|
|
28741
|
-
if (value != null && value !== "" && !(Array.isArray(value) && !value.length)) next.push({
|
|
28742
|
-
key: column,
|
|
28743
|
-
value
|
|
28744
|
-
});
|
|
28745
|
-
models.columnFilters.value = next;
|
|
29908
|
+
models.columnFilters.value = nextColumnFilters(models.columnFilters.value, column, value);
|
|
28746
29909
|
}
|
|
28747
29910
|
function headerContext(column) {
|
|
28748
29911
|
const engine = leaves.value.some((item) => item.key === column.key) ? table.getColumn(column.key) : void 0;
|
|
@@ -28754,8 +29917,8 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28754
29917
|
sortIndex: engine?.getSortIndex() ?? -1,
|
|
28755
29918
|
filterValue: models.columnFilters.value.find((filter) => filter.key === column.key)?.value,
|
|
28756
29919
|
setFilter: (value) => setFilter(column.key, value),
|
|
28757
|
-
nextLabel: next
|
|
28758
|
-
ariaSort: sorting
|
|
29920
|
+
nextLabel: sortLabel(next, t.value.table),
|
|
29921
|
+
ariaSort: ariaSort(sorting),
|
|
28759
29922
|
toggleSort: (multi = false) => {
|
|
28760
29923
|
if (!blocked.value && column.sortable) engine?.toggleSorting(void 0, !!props.multiSort && multi);
|
|
28761
29924
|
}
|
|
@@ -28770,7 +29933,7 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28770
29933
|
toggleExpanded,
|
|
28771
29934
|
setFilter,
|
|
28772
29935
|
setColumnHidden: (key, hidden) => {
|
|
28773
|
-
models.hiddenColumns.value =
|
|
29936
|
+
models.hiddenColumns.value = toggleKey(models.hiddenColumns.value, key, hidden);
|
|
28774
29937
|
}
|
|
28775
29938
|
});
|
|
28776
29939
|
const state = computed(() => ({
|
|
@@ -28797,13 +29960,14 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28797
29960
|
if (props.autoResetPage !== false) models.page.value = 1;
|
|
28798
29961
|
}, { deep: true });
|
|
28799
29962
|
watch([
|
|
28800
|
-
pageCount,
|
|
29963
|
+
pageCount$1,
|
|
28801
29964
|
page,
|
|
28802
29965
|
() => props.loading,
|
|
28803
29966
|
() => props.pagination,
|
|
28804
29967
|
knownTotal
|
|
28805
29968
|
], () => {
|
|
28806
|
-
|
|
29969
|
+
const target = clampedPage(props.pagination, props.loading, knownTotal.value, page.value, pageCount$1.value);
|
|
29970
|
+
if (target !== void 0) models.page.value = target;
|
|
28807
29971
|
}, { immediate: true });
|
|
28808
29972
|
watch(() => [
|
|
28809
29973
|
page.value,
|
|
@@ -28813,14 +29977,12 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28813
29977
|
models.columnFilters.value,
|
|
28814
29978
|
models.grouping.value
|
|
28815
29979
|
], () => {
|
|
28816
|
-
onChange({
|
|
28817
|
-
|
|
28818
|
-
pageSize: pageSize.value,
|
|
28819
|
-
sorting: models.sorting.value.map((sort) => ({ ...sort })),
|
|
29980
|
+
onChange(tableQuery(page.value, pageSize.value, {
|
|
29981
|
+
sorting: models.sorting.value,
|
|
28820
29982
|
filter: models.filter.value,
|
|
28821
|
-
columnFilters: models.columnFilters.value
|
|
28822
|
-
grouping:
|
|
28823
|
-
});
|
|
29983
|
+
columnFilters: models.columnFilters.value,
|
|
29984
|
+
grouping: models.grouping.value
|
|
29985
|
+
}));
|
|
28824
29986
|
}, {
|
|
28825
29987
|
deep: true,
|
|
28826
29988
|
flush: "post"
|
|
@@ -28830,9 +29992,8 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28830
29992
|
if (event.type === "keydown") event.preventDefault();
|
|
28831
29993
|
onRowClick(row, event);
|
|
28832
29994
|
}
|
|
28833
|
-
function displayValue(row, column) {
|
|
28834
|
-
|
|
28835
|
-
return column.format ? column.format(value, row) : value == null ? "—" : String(value);
|
|
29995
|
+
function displayValue$1(row, column) {
|
|
29996
|
+
return displayValue(row, column);
|
|
28836
29997
|
}
|
|
28837
29998
|
return {
|
|
28838
29999
|
api,
|
|
@@ -28849,17 +30010,17 @@ function useDataTable(props, models, onChange, onRowClick) {
|
|
|
28849
30010
|
pageSelection,
|
|
28850
30011
|
selectionDisabled,
|
|
28851
30012
|
state,
|
|
28852
|
-
valueOf,
|
|
28853
|
-
displayValue,
|
|
30013
|
+
valueOf: valueOf$1,
|
|
30014
|
+
displayValue: displayValue$1,
|
|
28854
30015
|
togglePage,
|
|
28855
30016
|
activate,
|
|
28856
30017
|
headerContext,
|
|
28857
|
-
keyOf,
|
|
28858
|
-
labelOf
|
|
30018
|
+
keyOf: keyOf$1,
|
|
30019
|
+
labelOf: labelOf$1
|
|
28859
30020
|
};
|
|
28860
30021
|
}
|
|
28861
30022
|
//#endregion
|
|
28862
|
-
//#region src/
|
|
30023
|
+
//#region ../shared/src/lib/data-table/column-sizing.ts
|
|
28863
30024
|
function pixelWidth(value, fallback) {
|
|
28864
30025
|
return typeof value === "number" && Number.isFinite(value) ? value : typeof value === "string" && /^\d+(\.\d+)?px$/.test(value) ? parseFloat(value) : fallback;
|
|
28865
30026
|
}
|
|
@@ -28927,7 +30088,7 @@ function resizeWidths(column, neighbor, widths, value, minimumTotalWidth = 0, ma
|
|
|
28927
30088
|
};
|
|
28928
30089
|
}
|
|
28929
30090
|
//#endregion
|
|
28930
|
-
//#region src/
|
|
30091
|
+
//#region ../shared/src/lib/data-table/column-sizing-styles.ts
|
|
28931
30092
|
function columnSizingStyles(columns, overrides, controls) {
|
|
28932
30093
|
const initial = allocateWidths(columns, overrides, 0);
|
|
28933
30094
|
const total = Object.values(initial).reduce((sum, width) => sum + width, controls);
|
|
@@ -28947,26 +30108,165 @@ function columnSizingStyles(columns, overrides, controls) {
|
|
|
28947
30108
|
};
|
|
28948
30109
|
}
|
|
28949
30110
|
//#endregion
|
|
30111
|
+
//#region ../shared/src/lib/data-table/layout.ts
|
|
30112
|
+
function pinStyle(layout, column, head = false) {
|
|
30113
|
+
if (!column.pin) return {};
|
|
30114
|
+
const siblings = layout.columns.filter((item) => item.pin === column.pin);
|
|
30115
|
+
const index = siblings.findIndex((item) => item.key === column.key);
|
|
30116
|
+
const preceding = column.pin === "start" ? siblings.slice(0, index) : siblings.slice(index + 1);
|
|
30117
|
+
const controls = column.pin === "start" ? layout.leading * 48 : layout.trailing * 72;
|
|
30118
|
+
const offset = `${preceding.reduce((sum, column) => sum + (layout.constrained ? layout.fixedWidths[column.key] : layout.width(column)), controls)}px`;
|
|
30119
|
+
return {
|
|
30120
|
+
position: "sticky",
|
|
30121
|
+
[column.pin === "start" ? "insetInlineStart" : "insetInlineEnd"]: offset,
|
|
30122
|
+
zIndex: head ? 5 : 1,
|
|
30123
|
+
backgroundColor: head ? "var(--hn-table-head-bg)" : "var(--hn-table-bg)",
|
|
30124
|
+
boxShadow: `${column.pin === "start" ? "1px" : "-1px"} 0 0 var(--hn-border)`
|
|
30125
|
+
};
|
|
30126
|
+
}
|
|
30127
|
+
function cellStyle(layout, column, head = false) {
|
|
30128
|
+
return {
|
|
30129
|
+
...layout.constrained ? {} : {
|
|
30130
|
+
width: cssSize(column.width),
|
|
30131
|
+
minWidth: cssSize(column.minWidth ?? column.width),
|
|
30132
|
+
maxWidth: cssSize(column.maxWidth)
|
|
30133
|
+
},
|
|
30134
|
+
...pinStyle(layout, column, head)
|
|
30135
|
+
};
|
|
30136
|
+
}
|
|
30137
|
+
function controlStyle(columns, side, index, head = false) {
|
|
30138
|
+
return {
|
|
30139
|
+
width: side === "end" ? "72px" : "48px",
|
|
30140
|
+
minWidth: side === "end" ? "72px" : "48px",
|
|
30141
|
+
paddingInline: "8px",
|
|
30142
|
+
textAlign: "center",
|
|
30143
|
+
...columns.some((column) => column.pin === side) ? {
|
|
30144
|
+
position: "sticky",
|
|
30145
|
+
[side === "start" ? "insetInlineStart" : "insetInlineEnd"]: `${index * 48}px`,
|
|
30146
|
+
zIndex: head ? 5 : 1,
|
|
30147
|
+
backgroundColor: head ? "var(--hn-table-head-bg)" : "var(--hn-table-bg)"
|
|
30148
|
+
} : {}
|
|
30149
|
+
};
|
|
30150
|
+
}
|
|
30151
|
+
function headerRows(columns, visible, heights, sticky, context, styleOf) {
|
|
30152
|
+
const paths = /* @__PURE__ */ new Map();
|
|
30153
|
+
function visit(columns, parent = []) {
|
|
30154
|
+
for (const column of columns) {
|
|
30155
|
+
const path = [...parent, column];
|
|
30156
|
+
if (column.children?.length) visit(column.children, path);
|
|
30157
|
+
else paths.set(column.key, path);
|
|
30158
|
+
}
|
|
30159
|
+
}
|
|
30160
|
+
visit(columns);
|
|
30161
|
+
const depth = Math.max(1, ...visible.map((column) => paths.get(column.key).length));
|
|
30162
|
+
return Array.from({ length: depth }, (_, level) => {
|
|
30163
|
+
const result = [];
|
|
30164
|
+
for (let index = 0; index < visible.length;) {
|
|
30165
|
+
const first = visible[index];
|
|
30166
|
+
const path = paths.get(first.key);
|
|
30167
|
+
const column = path[level];
|
|
30168
|
+
if (!column) {
|
|
30169
|
+
index++;
|
|
30170
|
+
continue;
|
|
30171
|
+
}
|
|
30172
|
+
const leaf = level === path.length - 1;
|
|
30173
|
+
let end = index + 1;
|
|
30174
|
+
if (!leaf) while (end < visible.length && paths.get(visible[end].key)?.[level]?.key === column.key && visible[end].pin === first.pin) end++;
|
|
30175
|
+
const top = Array.from({ length: level }, (_, i) => heights[i] ?? 44).reduce((a, b) => a + b, 0);
|
|
30176
|
+
result.push({
|
|
30177
|
+
...context(column),
|
|
30178
|
+
id: leaf ? `leaf:${column.key}` : `${level}:${column.key}:${first.key}`,
|
|
30179
|
+
leaf,
|
|
30180
|
+
colspan: end - index,
|
|
30181
|
+
rowspan: leaf ? depth - level : 1,
|
|
30182
|
+
top,
|
|
30183
|
+
style: {
|
|
30184
|
+
...leaf ? styleOf(column, true) : styleOf(first.pin === "end" ? visible[end - 1] : first, false),
|
|
30185
|
+
...sticky ? { top: `${top}px` } : {}
|
|
30186
|
+
}
|
|
30187
|
+
});
|
|
30188
|
+
index = end;
|
|
30189
|
+
}
|
|
30190
|
+
return result;
|
|
30191
|
+
});
|
|
30192
|
+
}
|
|
30193
|
+
function canMoveColumn(columns, key, target) {
|
|
30194
|
+
if (key === target) return false;
|
|
30195
|
+
const source = columns.find((column) => column.key === key), destination = columns.find((column) => column.key === target);
|
|
30196
|
+
return !(!source || !destination || source.pin !== destination.pin || source.reorderable === false || destination.reorderable === false);
|
|
30197
|
+
}
|
|
30198
|
+
function columnOrder(order, leaves) {
|
|
30199
|
+
return [.../* @__PURE__ */ new Set([...order, ...leaves.map((column) => column.key)])];
|
|
30200
|
+
}
|
|
30201
|
+
function moveColumnOrder(order, leaves, key, target) {
|
|
30202
|
+
const next = columnOrder(order, leaves);
|
|
30203
|
+
const from = next.indexOf(key), to = next.indexOf(target);
|
|
30204
|
+
next.splice(from, 1);
|
|
30205
|
+
next.splice(to, 0, key);
|
|
30206
|
+
return next;
|
|
30207
|
+
}
|
|
30208
|
+
function dropColumnOrder(order, leaves, key, target, before) {
|
|
30209
|
+
const next = columnOrder(order, leaves);
|
|
30210
|
+
next.splice(next.indexOf(key), 1);
|
|
30211
|
+
next.splice(next.indexOf(target) + (before ? 0 : 1), 0, key);
|
|
30212
|
+
return next;
|
|
30213
|
+
}
|
|
30214
|
+
function reorderPosition(from, to, before) {
|
|
30215
|
+
return before === void 0 ? to : to + (before ? 0 : 1) - (from < to ? 1 : 0);
|
|
30216
|
+
}
|
|
30217
|
+
function reorderedRows(source, from, position, row) {
|
|
30218
|
+
const rows = [...source];
|
|
30219
|
+
rows.splice(from, 1);
|
|
30220
|
+
rows.splice(position, 0, row);
|
|
30221
|
+
return rows;
|
|
30222
|
+
}
|
|
30223
|
+
//#endregion
|
|
30224
|
+
//#region ../shared/src/lib/data-table/resize.ts
|
|
30225
|
+
function resizeHandlePositions(columns, cells, box, scale, rtl) {
|
|
30226
|
+
let left = box.left;
|
|
30227
|
+
let right = box.right;
|
|
30228
|
+
for (const column of columns) {
|
|
30229
|
+
const rect = cells.get(column.key);
|
|
30230
|
+
if (!rect || !column.pin) continue;
|
|
30231
|
+
if (column.pin === "start" !== rtl) left = Math.max(left, rect.right);
|
|
30232
|
+
else right = Math.min(right, rect.left);
|
|
30233
|
+
}
|
|
30234
|
+
const next = {};
|
|
30235
|
+
for (const column of columns) {
|
|
30236
|
+
const rect = cells.get(column.key);
|
|
30237
|
+
if (!rect) continue;
|
|
30238
|
+
const start = Math.max(rect.left, column.pin ? box.left : left);
|
|
30239
|
+
const end = Math.min(rect.right, column.pin ? box.right : right);
|
|
30240
|
+
const fromLeft = column.pin === "end" !== rtl;
|
|
30241
|
+
next[column.key] = {
|
|
30242
|
+
inset: Math.max(0, (fromLeft ? start - rect.left : rect.right - end) / scale),
|
|
30243
|
+
visible: end - start >= 9 * scale - .01
|
|
30244
|
+
};
|
|
30245
|
+
}
|
|
30246
|
+
return next;
|
|
30247
|
+
}
|
|
30248
|
+
function resizeAffectedColumns(columns, column, mode) {
|
|
30249
|
+
const edge = resizeBoundary(columns, column, mode);
|
|
30250
|
+
return edge?.neighbor ? edge.side === "start" ? [edge.neighbor, column] : [column, edge.neighbor] : [column];
|
|
30251
|
+
}
|
|
30252
|
+
function pinnedMaximumWidth(columns, column, mode, source, available) {
|
|
30253
|
+
if (!column.pin || resizeBoundary(columns, column, mode)?.neighbor?.pin) return Infinity;
|
|
30254
|
+
const otherPinned = columns.reduce((sum, item) => sum + (item.pin && item.key !== column.key ? source[item.key] : 0), 0);
|
|
30255
|
+
const center = columns.some((item) => !item.pin) ? 48 : 0;
|
|
30256
|
+
return Math.max(source[column.key], available - otherPinned - center);
|
|
30257
|
+
}
|
|
30258
|
+
//#endregion
|
|
28950
30259
|
//#region src/components/data-table/composables/useTableResize.ts
|
|
28951
30260
|
function useTableResize(props, models, ctl, element, viewport, widths, active, available, updateHandles) {
|
|
28952
30261
|
const resizing = shallowRef();
|
|
28953
30262
|
const guide = shallowRef();
|
|
28954
30263
|
let release;
|
|
28955
30264
|
const boundary = (column) => resizeBoundary(ctl.visibleColumns.value, column, props.resizeMode ?? "fit");
|
|
28956
|
-
const affectedColumns = (column) =>
|
|
28957
|
-
const edge = boundary(column);
|
|
28958
|
-
return edge?.neighbor ? edge.side === "start" ? [edge.neighbor, column] : [column, edge.neighbor] : [column];
|
|
28959
|
-
};
|
|
30265
|
+
const affectedColumns = (column) => resizeAffectedColumns(ctl.visibleColumns.value, column, props.resizeMode ?? "fit");
|
|
28960
30266
|
const resizeLabel = (column) => affectedColumns(column).map((item) => item.label).join(" / ");
|
|
28961
30267
|
const resizeValueText = (column) => affectedColumns(column).map((item) => `${item.label}: ${Math.round(widths.value[item.key])}px`).join(" / ");
|
|
28962
30268
|
const minimumTotalWidth = () => props.resizeMode === "expand" ? Math.max(0, available.value) : 0;
|
|
28963
|
-
const maximumWidth = (column, source) =>
|
|
28964
|
-
if (!column.pin || boundary(column)?.neighbor?.pin) return Infinity;
|
|
28965
|
-
const columns = ctl.visibleColumns.value;
|
|
28966
|
-
const otherPinned = columns.reduce((sum, item) => sum + (item.pin && item.key !== column.key ? source[item.key] : 0), 0);
|
|
28967
|
-
const center = columns.some((item) => !item.pin) ? 48 : 0;
|
|
28968
|
-
return Math.max(source[column.key], available.value - otherPinned - center);
|
|
28969
|
-
};
|
|
30269
|
+
const maximumWidth = (column, source) => pinnedMaximumWidth(ctl.visibleColumns.value, column, props.resizeMode ?? "fit", source, available.value);
|
|
28970
30270
|
const bounds = (column) => resizeBounds(column, boundary(column)?.neighbor, widths.value, minimumTotalWidth(), maximumWidth(column, widths.value));
|
|
28971
30271
|
const canResize = (column) => {
|
|
28972
30272
|
if (!props.resizable || !boundary(column)) return false;
|
|
@@ -29193,26 +30493,7 @@ function useTableResizeHandles(element, viewport, columns, enabled) {
|
|
|
29193
30493
|
const scale = box.width / area.clientWidth || 1;
|
|
29194
30494
|
const rtl = getComputedStyle(table).direction === "rtl";
|
|
29195
30495
|
const cells = new Map([...table.querySelectorAll("thead [data-hn-column]")].map((cell) => [cell.dataset.hnColumn, cell.getBoundingClientRect()]));
|
|
29196
|
-
|
|
29197
|
-
let right = box.right;
|
|
29198
|
-
for (const column of columns.value) {
|
|
29199
|
-
const rect = cells.get(column.key);
|
|
29200
|
-
if (!rect || !column.pin) continue;
|
|
29201
|
-
if (column.pin === "start" !== rtl) left = Math.max(left, rect.right);
|
|
29202
|
-
else right = Math.min(right, rect.left);
|
|
29203
|
-
}
|
|
29204
|
-
const next = {};
|
|
29205
|
-
for (const column of columns.value) {
|
|
29206
|
-
const rect = cells.get(column.key);
|
|
29207
|
-
if (!rect) continue;
|
|
29208
|
-
const start = Math.max(rect.left, column.pin ? box.left : left);
|
|
29209
|
-
const end = Math.min(rect.right, column.pin ? box.right : right);
|
|
29210
|
-
const fromLeft = column.pin === "end" !== rtl;
|
|
29211
|
-
next[column.key] = {
|
|
29212
|
-
inset: Math.max(0, (fromLeft ? start - rect.left : rect.right - end) / scale),
|
|
29213
|
-
visible: end - start >= 9 * scale - .01
|
|
29214
|
-
};
|
|
29215
|
-
}
|
|
30496
|
+
const next = resizeHandlePositions(columns.value, cells, box, scale, rtl);
|
|
29216
30497
|
if (JSON.stringify(next) !== JSON.stringify(positions.value)) positions.value = next;
|
|
29217
30498
|
}
|
|
29218
30499
|
function schedule() {
|
|
@@ -29319,88 +30600,26 @@ function useTableColumns(props, models, ctl, element, viewport, leading, trailin
|
|
|
29319
30600
|
function columnStyle(column) {
|
|
29320
30601
|
return { width: cssSize(constrained.value ? widthVariable(column) : column.width) };
|
|
29321
30602
|
}
|
|
29322
|
-
|
|
29323
|
-
|
|
29324
|
-
|
|
29325
|
-
|
|
29326
|
-
|
|
29327
|
-
|
|
29328
|
-
|
|
29329
|
-
|
|
29330
|
-
|
|
29331
|
-
|
|
29332
|
-
|
|
29333
|
-
|
|
29334
|
-
boxShadow: `${column.pin === "start" ? "1px" : "-1px"} 0 0 var(--hn-border)`
|
|
29335
|
-
};
|
|
30603
|
+
const pinLayout = () => ({
|
|
30604
|
+
columns: ctl.visibleColumns.value,
|
|
30605
|
+
constrained: constrained.value,
|
|
30606
|
+
leading: leading.value,
|
|
30607
|
+
trailing: trailing.value,
|
|
30608
|
+
get fixedWidths() {
|
|
30609
|
+
return fixedWidths.value;
|
|
30610
|
+
},
|
|
30611
|
+
width
|
|
30612
|
+
});
|
|
30613
|
+
function pinStyle$1(column, head = false) {
|
|
30614
|
+
return pinStyle(pinLayout(), column, head);
|
|
29336
30615
|
}
|
|
29337
|
-
function cellStyle(column, head = false) {
|
|
29338
|
-
return
|
|
29339
|
-
...constrained.value ? {} : {
|
|
29340
|
-
width: cssSize(column.width),
|
|
29341
|
-
minWidth: cssSize(column.minWidth ?? column.width),
|
|
29342
|
-
maxWidth: cssSize(column.maxWidth)
|
|
29343
|
-
},
|
|
29344
|
-
...pinStyle(column, head)
|
|
29345
|
-
};
|
|
30616
|
+
function cellStyle$1(column, head = false) {
|
|
30617
|
+
return cellStyle(pinLayout(), column, head);
|
|
29346
30618
|
}
|
|
29347
|
-
function controlStyle(side, index, head = false) {
|
|
29348
|
-
return
|
|
29349
|
-
|
|
29350
|
-
|
|
29351
|
-
paddingInline: "8px",
|
|
29352
|
-
textAlign: "center",
|
|
29353
|
-
...ctl.visibleColumns.value.some((column) => column.pin === side) ? {
|
|
29354
|
-
position: "sticky",
|
|
29355
|
-
[side === "start" ? "insetInlineStart" : "insetInlineEnd"]: `${index * 48}px`,
|
|
29356
|
-
zIndex: head ? 5 : 1,
|
|
29357
|
-
backgroundColor: head ? "var(--hn-table-head-bg)" : "var(--hn-table-bg)"
|
|
29358
|
-
} : {}
|
|
29359
|
-
};
|
|
29360
|
-
}
|
|
29361
|
-
const headerRows = computed(() => {
|
|
29362
|
-
const paths = /* @__PURE__ */ new Map();
|
|
29363
|
-
function visit(columns, parent = []) {
|
|
29364
|
-
for (const column of columns) {
|
|
29365
|
-
const path = [...parent, column];
|
|
29366
|
-
if (column.children?.length) visit(column.children, path);
|
|
29367
|
-
else paths.set(column.key, path);
|
|
29368
|
-
}
|
|
29369
|
-
}
|
|
29370
|
-
visit(props.columns);
|
|
29371
|
-
const visible = ctl.visibleColumns.value;
|
|
29372
|
-
const depth = Math.max(1, ...visible.map((column) => paths.get(column.key).length));
|
|
29373
|
-
return Array.from({ length: depth }, (_, level) => {
|
|
29374
|
-
const result = [];
|
|
29375
|
-
for (let index = 0; index < visible.length;) {
|
|
29376
|
-
const first = visible[index];
|
|
29377
|
-
const path = paths.get(first.key);
|
|
29378
|
-
const column = path[level];
|
|
29379
|
-
if (!column) {
|
|
29380
|
-
index++;
|
|
29381
|
-
continue;
|
|
29382
|
-
}
|
|
29383
|
-
const leaf = level === path.length - 1;
|
|
29384
|
-
let end = index + 1;
|
|
29385
|
-
if (!leaf) while (end < visible.length && paths.get(visible[end].key)?.[level]?.key === column.key && visible[end].pin === first.pin) end++;
|
|
29386
|
-
const top = Array.from({ length: level }, (_, i) => heights.value[i] ?? 44).reduce((a, b) => a + b, 0);
|
|
29387
|
-
result.push({
|
|
29388
|
-
...ctl.headerContext(column),
|
|
29389
|
-
id: leaf ? `leaf:${column.key}` : `${level}:${column.key}:${first.key}`,
|
|
29390
|
-
leaf,
|
|
29391
|
-
colspan: end - index,
|
|
29392
|
-
rowspan: leaf ? depth - level : 1,
|
|
29393
|
-
top,
|
|
29394
|
-
style: {
|
|
29395
|
-
...leaf ? cellStyle(column, true) : pinStyle(first.pin === "end" ? visible[end - 1] : first, true),
|
|
29396
|
-
...props.stickyHeader ? { top: `${top}px` } : {}
|
|
29397
|
-
}
|
|
29398
|
-
});
|
|
29399
|
-
index = end;
|
|
29400
|
-
}
|
|
29401
|
-
return result;
|
|
29402
|
-
});
|
|
29403
|
-
});
|
|
30619
|
+
function controlStyle$1(side, index, head = false) {
|
|
30620
|
+
return controlStyle(ctl.visibleColumns.value, side, index, head);
|
|
30621
|
+
}
|
|
30622
|
+
const headerRows$1 = computed(() => headerRows(props.columns, ctl.visibleColumns.value, heights.value, props.stickyHeader, ctl.headerContext, (column, leaf) => leaf ? cellStyle$1(column, true) : pinStyle$1(column, true)));
|
|
29404
30623
|
const sizing = computed(() => constrained.value ? columnSizingStyles(ctl.visibleColumns.value, active.value ?? models.columnWidths.value, leading.value * 48 + trailing.value * 72) : {});
|
|
29405
30624
|
const tableStyle = computed(() => ({
|
|
29406
30625
|
tableLayout: constrained.value ? "fixed" : "auto",
|
|
@@ -29412,15 +30631,8 @@ function useTableColumns(props, models, ctl, element, viewport, leading, trailin
|
|
|
29412
30631
|
});
|
|
29413
30632
|
const errorStyle = computed(() => ({ "--hn-table-viewport-width": available.value ? `${available.value}px` : void 0 }));
|
|
29414
30633
|
function moveColumn(key, target) {
|
|
29415
|
-
if (ctl.blocked.value || key
|
|
29416
|
-
|
|
29417
|
-
const source = columns.find((column) => column.key === key), destination = columns.find((column) => column.key === target);
|
|
29418
|
-
if (!source || !destination || source.pin !== destination.pin || source.reorderable === false || destination.reorderable === false) return;
|
|
29419
|
-
const order = [.../* @__PURE__ */ new Set([...models.columnOrder.value, ...ctl.leaves.value.map((column) => column.key)])];
|
|
29420
|
-
const from = order.indexOf(key), to = order.indexOf(target);
|
|
29421
|
-
order.splice(from, 1);
|
|
29422
|
-
order.splice(to, 0, key);
|
|
29423
|
-
models.columnOrder.value = order;
|
|
30634
|
+
if (ctl.blocked.value || !canMoveColumn(ctl.visibleColumns.value, key, target)) return;
|
|
30635
|
+
models.columnOrder.value = moveColumnOrder(models.columnOrder.value, ctl.leaves.value, key, target);
|
|
29424
30636
|
}
|
|
29425
30637
|
Object.assign(ctl.api, {
|
|
29426
30638
|
setColumnWidth: resizing.setWidth,
|
|
@@ -29433,13 +30645,13 @@ function useTableColumns(props, models, ctl, element, viewport, leading, trailin
|
|
|
29433
30645
|
});
|
|
29434
30646
|
return {
|
|
29435
30647
|
constrained,
|
|
29436
|
-
headerRows,
|
|
30648
|
+
headerRows: headerRows$1,
|
|
29437
30649
|
tableStyle,
|
|
29438
30650
|
columnStyles,
|
|
29439
30651
|
columnStyle,
|
|
29440
30652
|
errorStyle,
|
|
29441
|
-
cellStyle,
|
|
29442
|
-
controlStyle,
|
|
30653
|
+
cellStyle: cellStyle$1,
|
|
30654
|
+
controlStyle: controlStyle$1,
|
|
29443
30655
|
...resizing,
|
|
29444
30656
|
...handles,
|
|
29445
30657
|
width
|
|
@@ -29462,19 +30674,16 @@ function useTableDrag(props, models, ctl, element, viewport, onReorder) {
|
|
|
29462
30674
|
const parent = row.parentId ? all[row.parentId]?.original : void 0;
|
|
29463
30675
|
const source = parent ? props.getChildren?.(parent) : props.rows;
|
|
29464
30676
|
if (!source) return;
|
|
29465
|
-
const from = source.findIndex((item) => ctl.keyOf(item) === key)
|
|
29466
|
-
const position =
|
|
30677
|
+
const from = source.findIndex((item) => ctl.keyOf(item) === key);
|
|
30678
|
+
const position = reorderPosition(from, source.findIndex((item) => ctl.keyOf(item) === targetKey), before);
|
|
29467
30679
|
if (position === from) return;
|
|
29468
|
-
const rows = [...source];
|
|
29469
|
-
rows.splice(from, 1);
|
|
29470
|
-
rows.splice(position, 0, row.original);
|
|
29471
30680
|
onReorder({
|
|
29472
30681
|
row: row.original,
|
|
29473
30682
|
target: target.original,
|
|
29474
30683
|
parent,
|
|
29475
30684
|
from,
|
|
29476
30685
|
to: position,
|
|
29477
|
-
rows
|
|
30686
|
+
rows: reorderedRows(source, from, position, row.original)
|
|
29478
30687
|
});
|
|
29479
30688
|
}
|
|
29480
30689
|
function start(kind, key, label, event) {
|
|
@@ -29582,12 +30791,8 @@ function useTableDrag(props, models, ctl, element, viewport, onReorder) {
|
|
|
29582
30791
|
const destination = moved && targetAtPoint();
|
|
29583
30792
|
cleanup?.();
|
|
29584
30793
|
if (!apply || !destination) return;
|
|
29585
|
-
if (kind === "column")
|
|
29586
|
-
|
|
29587
|
-
order.splice(order.indexOf(key), 1);
|
|
29588
|
-
order.splice(order.indexOf(destination.target) + (destination.before ? 0 : 1), 0, key);
|
|
29589
|
-
models.columnOrder.value = order;
|
|
29590
|
-
} else {
|
|
30794
|
+
if (kind === "column") models.columnOrder.value = dropColumnOrder(models.columnOrder.value, ctl.leaves.value, key, destination.target, destination.before);
|
|
30795
|
+
else {
|
|
29591
30796
|
const all = ctl.table.getCoreRowModel().rowsById;
|
|
29592
30797
|
const row = all[key], target = all[destination.target];
|
|
29593
30798
|
if (row && target) moveRow(ctl.keyOf(row.original), ctl.keyOf(target.original), destination.before);
|
|
@@ -29847,28 +31052,40 @@ function useTableEditing(props, ctl, onEdit, onError, element) {
|
|
|
29847
31052
|
};
|
|
29848
31053
|
}
|
|
29849
31054
|
//#endregion
|
|
31055
|
+
//#region ../shared/src/lib/data-table/csv.ts
|
|
31056
|
+
function exportColumns(columns, options) {
|
|
31057
|
+
return columns.filter((column) => column.exportable !== false && (!options.columns || options.columns.includes(column.key)));
|
|
31058
|
+
}
|
|
31059
|
+
function tableCsv(visible, rows, options, valueOf, displayValue) {
|
|
31060
|
+
const delimiter = options.delimiter ?? ",";
|
|
31061
|
+
const columns = exportColumns(visible, options);
|
|
31062
|
+
const escape = (value) => {
|
|
31063
|
+
let text = value == null ? "" : String(value);
|
|
31064
|
+
if (typeof value === "string" && /^[\s]*[=+@-]/.test(text)) text = "'" + text;
|
|
31065
|
+
return "\"" + text.replaceAll("\"", "\"\"") + "\"";
|
|
31066
|
+
};
|
|
31067
|
+
const lines = [columns.map((column) => escape(column.label)).join(delimiter)];
|
|
31068
|
+
for (const row of rows) lines.push(columns.map((column) => escape(column.exportValue ? column.exportValue(row) : options.formatted ? displayValue(row, column) : valueOf(row, column))).join(delimiter));
|
|
31069
|
+
return (options.bom === false ? "" : "") + lines.join("\r\n");
|
|
31070
|
+
}
|
|
31071
|
+
function downloadCsv(text, filename = "data.csv") {
|
|
31072
|
+
if (typeof document === "undefined") return;
|
|
31073
|
+
const url = URL.createObjectURL(new Blob([text], { type: "text/csv;charset=utf-8" }));
|
|
31074
|
+
const anchor = document.createElement("a");
|
|
31075
|
+
anchor.href = url;
|
|
31076
|
+
anchor.download = filename;
|
|
31077
|
+
anchor.click();
|
|
31078
|
+
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
31079
|
+
}
|
|
31080
|
+
//#endregion
|
|
29850
31081
|
//#region src/components/data-table/composables/useTableExport.ts
|
|
29851
31082
|
function useTableExport(ctl) {
|
|
29852
31083
|
function toCsv(options = {}) {
|
|
29853
|
-
|
|
29854
|
-
const columns = ctl.visibleColumns.value.filter((column) => column.exportable !== false && (!options.columns || options.columns.includes(column.key)));
|
|
29855
|
-
const escape = (value) => {
|
|
29856
|
-
let text = value == null ? "" : String(value);
|
|
29857
|
-
if (typeof value === "string" && /^[\s]*[=+@-]/.test(text)) text = "'" + text;
|
|
29858
|
-
return "\"" + text.replaceAll("\"", "\"\"") + "\"";
|
|
29859
|
-
};
|
|
29860
|
-
const lines = [columns.map((column) => escape(column.label)).join(delimiter)];
|
|
29861
|
-
for (const row of ctl.api.getRows(options.scope ?? "filtered")) lines.push(columns.map((column) => escape(column.exportValue ? column.exportValue(row) : options.formatted ? ctl.displayValue(row, column) : ctl.valueOf(row, column))).join(delimiter));
|
|
29862
|
-
return (options.bom === false ? "" : "") + lines.join("\r\n");
|
|
31084
|
+
return tableCsv(ctl.visibleColumns.value, ctl.api.getRows(options.scope ?? "filtered"), options, ctl.valueOf, ctl.displayValue);
|
|
29863
31085
|
}
|
|
29864
31086
|
function exportCsv(options = {}) {
|
|
29865
31087
|
if (typeof document === "undefined") return;
|
|
29866
|
-
|
|
29867
|
-
const anchor = document.createElement("a");
|
|
29868
|
-
anchor.href = url;
|
|
29869
|
-
anchor.download = options.filename ?? "data.csv";
|
|
29870
|
-
anchor.click();
|
|
29871
|
-
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
31088
|
+
downloadCsv(toCsv(options), options.filename);
|
|
29872
31089
|
}
|
|
29873
31090
|
Object.assign(ctl.api, {
|
|
29874
31091
|
toCsv,
|
|
@@ -30601,7 +31818,11 @@ var DataListLayoutToggle_default = /* @__PURE__ */ defineComponent({
|
|
|
30601
31818
|
}
|
|
30602
31819
|
});
|
|
30603
31820
|
//#endregion
|
|
30604
|
-
//#region src/
|
|
31821
|
+
//#region ../shared/src/lib/data-list.ts
|
|
31822
|
+
function dataListText(item, index, field) {
|
|
31823
|
+
const value = typeof field === "function" ? field(item, index) : field ? item[field] : void 0;
|
|
31824
|
+
return value !== "" && (typeof value === "string" || typeof value === "number") ? value : void 0;
|
|
31825
|
+
}
|
|
30605
31826
|
function scrollDataListItem(element, viewport, { align = "auto", behavior }) {
|
|
30606
31827
|
if (!viewport) {
|
|
30607
31828
|
element.scrollIntoView({
|
|
@@ -30969,8 +32190,7 @@ var DataListItem_default = /* @__PURE__ */ defineComponent({
|
|
|
30969
32190
|
function useDataList(props, pageModel, sizeModel, change, layoutModel) {
|
|
30970
32191
|
const layout = computed(() => layoutModel?.value ?? props.layout ?? "list");
|
|
30971
32192
|
function text(item, index, field) {
|
|
30972
|
-
|
|
30973
|
-
return value !== "" && (typeof value === "string" || typeof value === "number") ? value : void 0;
|
|
32193
|
+
return dataListText(item, index, field);
|
|
30974
32194
|
}
|
|
30975
32195
|
const pageSize = computed(() => paginationInteger(sizeModel.value, 10, 1));
|
|
30976
32196
|
const total = computed(() => props.manual ? props.total === void 0 ? void 0 : paginationInteger(props.total, 0, 0) : props.items.length);
|
|
@@ -31408,10 +32628,51 @@ var Timeline_default = /* @__PURE__ */ defineComponent({
|
|
|
31408
32628
|
}
|
|
31409
32629
|
});
|
|
31410
32630
|
//#endregion
|
|
31411
|
-
//#region src/
|
|
32631
|
+
//#region ../shared/src/lib/virtual/list.ts
|
|
31412
32632
|
function nonnegative(value) {
|
|
31413
32633
|
return Number.isFinite(value) ? Math.max(0, value) : 0;
|
|
31414
32634
|
}
|
|
32635
|
+
function listEstimator(items, estimate) {
|
|
32636
|
+
const value = estimate ?? 48;
|
|
32637
|
+
return (index) => Math.max(1, nonnegative(typeof value === "function" ? value(items[index], index) : value));
|
|
32638
|
+
}
|
|
32639
|
+
function listInitialRect(initialRect, height) {
|
|
32640
|
+
return initialRect ?? {
|
|
32641
|
+
width: VIRTUAL_RECT.width,
|
|
32642
|
+
height: typeof height === "number" ? height : VIRTUAL_RECT.height
|
|
32643
|
+
};
|
|
32644
|
+
}
|
|
32645
|
+
function retainIndex(indexes, retained) {
|
|
32646
|
+
if (retained >= 0 && !indexes.includes(retained)) indexes.push(retained);
|
|
32647
|
+
return indexes.sort((a, b) => a - b);
|
|
32648
|
+
}
|
|
32649
|
+
function listContentStyle(flow, horizontal) {
|
|
32650
|
+
const { before: start, after: end } = flow;
|
|
32651
|
+
return horizontal ? {
|
|
32652
|
+
width: "max-content",
|
|
32653
|
+
height: "100%",
|
|
32654
|
+
paddingInlineStart: `${start}px`,
|
|
32655
|
+
paddingInlineEnd: `${end}px`
|
|
32656
|
+
} : {
|
|
32657
|
+
width: "100%",
|
|
32658
|
+
paddingBlockStart: `${start}px`,
|
|
32659
|
+
paddingBlockEnd: `${end}px`
|
|
32660
|
+
};
|
|
32661
|
+
}
|
|
32662
|
+
function listRootStyle(height) {
|
|
32663
|
+
return { height: typeof height === "string" ? height : `${height ?? VIRTUAL_RECT.height}px` };
|
|
32664
|
+
}
|
|
32665
|
+
function listItemStyle(entry, horizontal, dynamic) {
|
|
32666
|
+
return horizontal ? {
|
|
32667
|
+
marginInlineStart: `${entry.gapBefore}px`,
|
|
32668
|
+
width: dynamic === false ? `${entry.size}px` : void 0
|
|
32669
|
+
} : {
|
|
32670
|
+
marginBlockStart: `${entry.gapBefore}px`,
|
|
32671
|
+
height: dynamic === false ? `${entry.size}px` : void 0
|
|
32672
|
+
};
|
|
32673
|
+
}
|
|
32674
|
+
//#endregion
|
|
32675
|
+
//#region src/components/virtual-list/composables/useVirtualList.ts
|
|
31415
32676
|
function useVirtualList(props, onRangeChange) {
|
|
31416
32677
|
const { root, direction, rootDirection } = useDirection$1(() => props.dir);
|
|
31417
32678
|
const area = shallowRef();
|
|
@@ -31428,12 +32689,11 @@ function useVirtualList(props, onRangeChange) {
|
|
|
31428
32689
|
const items = props.items;
|
|
31429
32690
|
const itemKeys = keys.value;
|
|
31430
32691
|
const retained = focusedIndex.value;
|
|
31431
|
-
const estimate = props.estimateSize ?? 48;
|
|
31432
32692
|
return {
|
|
31433
32693
|
count: items.length,
|
|
31434
32694
|
getScrollElement: () => viewport.value ?? null,
|
|
31435
32695
|
getItemKey: (index) => itemKeys[index],
|
|
31436
|
-
estimateSize: (
|
|
32696
|
+
estimateSize: listEstimator(items, props.estimateSize),
|
|
31437
32697
|
horizontal: horizontal.value,
|
|
31438
32698
|
isRtl: direction.value === "rtl",
|
|
31439
32699
|
overscan: Math.floor(nonnegative(props.overscan ?? 5)),
|
|
@@ -31441,15 +32701,8 @@ function useVirtualList(props, onRangeChange) {
|
|
|
31441
32701
|
paddingStart: nonnegative(props.paddingStart ?? 0),
|
|
31442
32702
|
paddingEnd: nonnegative(props.paddingEnd ?? 0),
|
|
31443
32703
|
initialOffset: nonnegative(props.initialOffset ?? 0),
|
|
31444
|
-
initialRect: props.initialRect
|
|
31445
|
-
|
|
31446
|
-
height: typeof props.height === "number" ? props.height : 320
|
|
31447
|
-
},
|
|
31448
|
-
rangeExtractor: (range) => {
|
|
31449
|
-
const indexes = defaultRangeExtractor(range);
|
|
31450
|
-
if (retained >= 0 && !indexes.includes(retained)) indexes.push(retained);
|
|
31451
|
-
return indexes.sort((a, b) => a - b);
|
|
31452
|
-
}
|
|
32704
|
+
initialRect: listInitialRect(props.initialRect, props.height),
|
|
32705
|
+
rangeExtractor: (range) => retainIndex(defaultRangeExtractor(range), retained)
|
|
31453
32706
|
};
|
|
31454
32707
|
}));
|
|
31455
32708
|
const flow = computed(() => virtualFlow(virtualizer.value.getVirtualItems(), virtualizer.value.getTotalSize()));
|
|
@@ -31457,28 +32710,10 @@ function useVirtualList(props, onRangeChange) {
|
|
|
31457
32710
|
...entry,
|
|
31458
32711
|
key: keys.value[entry.index]
|
|
31459
32712
|
})));
|
|
31460
|
-
const contentStyle = computed(() =>
|
|
31461
|
-
|
|
31462
|
-
return horizontal.value ? {
|
|
31463
|
-
width: "max-content",
|
|
31464
|
-
height: "100%",
|
|
31465
|
-
paddingInlineStart: `${start}px`,
|
|
31466
|
-
paddingInlineEnd: `${end}px`
|
|
31467
|
-
} : {
|
|
31468
|
-
width: "100%",
|
|
31469
|
-
paddingBlockStart: `${start}px`,
|
|
31470
|
-
paddingBlockEnd: `${end}px`
|
|
31471
|
-
};
|
|
31472
|
-
});
|
|
31473
|
-
const rootStyle = computed(() => ({ height: typeof props.height === "string" ? props.height : `${props.height ?? 320}px` }));
|
|
32713
|
+
const contentStyle = computed(() => listContentStyle(flow.value, horizontal.value));
|
|
32714
|
+
const rootStyle = computed(() => listRootStyle(props.height));
|
|
31474
32715
|
function itemStyle(entry) {
|
|
31475
|
-
return horizontal.value
|
|
31476
|
-
marginInlineStart: `${entry.gapBefore}px`,
|
|
31477
|
-
width: props.dynamic === false ? `${entry.size}px` : void 0
|
|
31478
|
-
} : {
|
|
31479
|
-
marginBlockStart: `${entry.gapBefore}px`,
|
|
31480
|
-
height: props.dynamic === false ? `${entry.size}px` : void 0
|
|
31481
|
-
};
|
|
32716
|
+
return listItemStyle(entry, horizontal.value, props.dynamic);
|
|
31482
32717
|
}
|
|
31483
32718
|
function measureElement(element) {
|
|
31484
32719
|
if (element === null) {
|
|
@@ -32739,7 +33974,7 @@ var qrCode = tv({
|
|
|
32739
33974
|
var qrCodeSvg = tv({ base: "block size-full" });
|
|
32740
33975
|
var qrCodeStatus = tv({ base: "bg-subtle text-muted absolute inset-0 flex flex-col items-center justify-center gap-2 p-3 text-center text-sm" });
|
|
32741
33976
|
//#endregion
|
|
32742
|
-
//#region src/
|
|
33977
|
+
//#region ../shared/src/lib/qr-code-export.ts
|
|
32743
33978
|
function dataURL(blob) {
|
|
32744
33979
|
return new Promise((resolve, reject) => {
|
|
32745
33980
|
const reader = new FileReader();
|