@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/src/lib/collapse.ts
CHANGED
|
@@ -5,36 +5,13 @@ import {
|
|
|
5
5
|
shallowRef,
|
|
6
6
|
type ComponentPublicInstance,
|
|
7
7
|
} from 'vue'
|
|
8
|
+
import {
|
|
9
|
+
collapseHooks,
|
|
10
|
+
writeCollapseGap,
|
|
11
|
+
type CollapseAxis,
|
|
12
|
+
} from '../../../shared/src/lib/collapse'
|
|
8
13
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export function collapseGapOf(parent: Element | null, axis: CollapseAxis = 'y') {
|
|
12
|
-
if (!parent) return '0px'
|
|
13
|
-
const style = getComputedStyle(parent)
|
|
14
|
-
const stacked = style.display.includes('flex') || style.display.includes('grid')
|
|
15
|
-
const gap = axis === 'y' ? style.rowGap : style.columnGap
|
|
16
|
-
return stacked && gap !== 'normal' ? gap : '0px'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function writeCollapseGap(el: Element, parent: Element | null, axis: CollapseAxis = 'y') {
|
|
20
|
-
;(el as HTMLElement).style.setProperty('--hn-collapse-gap', collapseGapOf(parent, axis))
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function collapseHooks(axis: CollapseAxis = 'y', parentOf?: () => Element | null) {
|
|
24
|
-
function beforeEnter(el: Element) {
|
|
25
|
-
writeCollapseGap(el, el.parentElement ?? parentOf?.() ?? null, axis)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function beforeLeave(el: Element) {
|
|
29
|
-
writeCollapseGap(el, el.parentElement, axis)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function afterEnter(el: Element) {
|
|
33
|
-
;(el as HTMLElement).style.removeProperty('--hn-collapse-gap')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return { beforeEnter, afterEnter, beforeLeave }
|
|
37
|
-
}
|
|
14
|
+
export * from '../../../shared/src/lib/collapse'
|
|
38
15
|
|
|
39
16
|
export function useCollapseHooks(axis: CollapseAxis = 'y') {
|
|
40
17
|
const instance = getCurrentInstance()
|
package/src/lib/date.ts
CHANGED
|
@@ -1,111 +1 @@
|
|
|
1
|
-
|
|
2
|
-
CalendarDate,
|
|
3
|
-
CalendarDateTime,
|
|
4
|
-
Time,
|
|
5
|
-
parseDate,
|
|
6
|
-
parseDateTime,
|
|
7
|
-
parseTime,
|
|
8
|
-
type DateValue,
|
|
9
|
-
} from '@internationalized/date'
|
|
10
|
-
|
|
11
|
-
export type DateGranularity = 'day' | 'hour' | 'minute' | 'second'
|
|
12
|
-
export type TimeGranularity = 'hour' | 'minute' | 'second'
|
|
13
|
-
|
|
14
|
-
const TIME_LENGTH: Record<TimeGranularity, number> = {
|
|
15
|
-
hour: 'HH:mm'.length,
|
|
16
|
-
minute: 'HH:mm'.length,
|
|
17
|
-
second: 'HH:mm:ss'.length,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function parseTimeValue(value: string | null | undefined): Time | undefined {
|
|
21
|
-
if (!value) return undefined
|
|
22
|
-
try {
|
|
23
|
-
return parseTime(value)
|
|
24
|
-
} catch {
|
|
25
|
-
return undefined
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function formatTimeValue(
|
|
30
|
-
value: { hour: number; minute: number; second: number },
|
|
31
|
-
granularity: TimeGranularity = 'minute',
|
|
32
|
-
): string {
|
|
33
|
-
return new Time(value.hour, value.minute, value.second)
|
|
34
|
-
.toString()
|
|
35
|
-
.slice(0, TIME_LENGTH[granularity])
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function splitDateTime(value: string | null | undefined) {
|
|
39
|
-
if (!value) return { date: null, time: null }
|
|
40
|
-
const [date, time] = value.split('T')
|
|
41
|
-
return { date: date || null, time: time || null }
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function joinDateTime(date: string | null, time: string | null) {
|
|
45
|
-
return date && time ? `${date}T${time}` : null
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface DateRangeValue {
|
|
49
|
-
start: string | null
|
|
50
|
-
end: string | null
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface DateRangeParts {
|
|
54
|
-
start: DateValue | undefined
|
|
55
|
-
end: DateValue | undefined
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const LENGTH: Record<DateGranularity, number> = {
|
|
59
|
-
day: 'YYYY-MM-DD'.length,
|
|
60
|
-
hour: 'YYYY-MM-DDTHH:mm'.length,
|
|
61
|
-
minute: 'YYYY-MM-DDTHH:mm'.length,
|
|
62
|
-
second: 'YYYY-MM-DDTHH:mm:ss'.length,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function parseDateValue(
|
|
66
|
-
value: string | null | undefined,
|
|
67
|
-
granularity: DateGranularity = 'day',
|
|
68
|
-
): DateValue | undefined {
|
|
69
|
-
if (!value) return undefined
|
|
70
|
-
try {
|
|
71
|
-
if (granularity === 'day') return parseDate(value.slice(0, LENGTH.day))
|
|
72
|
-
return value.includes('T')
|
|
73
|
-
? parseDateTime(value)
|
|
74
|
-
: parseDate(value).toDate('UTC')
|
|
75
|
-
? toDateTime(parseDate(value))
|
|
76
|
-
: undefined
|
|
77
|
-
} catch {
|
|
78
|
-
return undefined
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function formatDateValue(value: DateValue, granularity: DateGranularity = 'day'): string {
|
|
83
|
-
if (granularity === 'day') return new CalendarDate(value.year, value.month, value.day).toString()
|
|
84
|
-
const time = value instanceof CalendarDateTime ? value : toDateTime(value)
|
|
85
|
-
return time.toString().slice(0, LENGTH[granularity])
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function parseDateRange(
|
|
89
|
-
value: DateRangeValue | null | undefined,
|
|
90
|
-
granularity: DateGranularity = 'day',
|
|
91
|
-
): DateRangeParts {
|
|
92
|
-
return {
|
|
93
|
-
start: parseDateValue(value?.start, granularity),
|
|
94
|
-
end: parseDateValue(value?.end, granularity),
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function formatDateRange(
|
|
99
|
-
value: DateRangeParts,
|
|
100
|
-
granularity: DateGranularity = 'day',
|
|
101
|
-
): DateRangeValue | null {
|
|
102
|
-
if (!value.start && !value.end) return null
|
|
103
|
-
return {
|
|
104
|
-
start: value.start ? formatDateValue(value.start, granularity) : null,
|
|
105
|
-
end: value.end ? formatDateValue(value.end, granularity) : null,
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function toDateTime(value: DateValue) {
|
|
110
|
-
return new CalendarDateTime(value.year, value.month, value.day)
|
|
111
|
-
}
|
|
1
|
+
export * from '../../../shared/src/lib/date'
|
package/src/lib/field-focus.ts
CHANGED
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const CONTROL = 'input:not([type="hidden"]), textarea'
|
|
3
|
-
|
|
4
|
-
function controlOf(node: Element) {
|
|
5
|
-
const control = node.matches(CONTROL) ? node : node.querySelector(CONTROL)
|
|
6
|
-
return control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement
|
|
7
|
-
? control
|
|
8
|
-
: null
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function focusFieldFrom(root: HTMLElement, target: HTMLElement) {
|
|
12
|
-
if (target.closest(INTERACTIVE)) return null
|
|
13
|
-
const segments = Array.from(root.children)
|
|
14
|
-
const from = segments.findIndex(segment => segment.contains(target))
|
|
15
|
-
const own = from >= 0 ? controlOf(segments[from]!) : null
|
|
16
|
-
if (own && !own.disabled) {
|
|
17
|
-
own.focus()
|
|
18
|
-
return own
|
|
19
|
-
}
|
|
20
|
-
const after = segments.slice(from + 1)
|
|
21
|
-
const before = segments.slice(0, Math.max(from, 0)).reverse()
|
|
22
|
-
for (const [list, caret] of [
|
|
23
|
-
[after, 'start'],
|
|
24
|
-
[before, 'end'],
|
|
25
|
-
] as const) {
|
|
26
|
-
for (const segment of list) {
|
|
27
|
-
const control = controlOf(segment)
|
|
28
|
-
if (!control || control.disabled) continue
|
|
29
|
-
control.focus()
|
|
30
|
-
const at = caret === 'start' ? 0 : control.value.length
|
|
31
|
-
control.setSelectionRange(at, at)
|
|
32
|
-
return control
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return null
|
|
36
|
-
}
|
|
1
|
+
export * from '../../../shared/src/lib/field-focus'
|
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import { shallowRef, watch, type Ref } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
createOverlayReference,
|
|
4
|
+
type OverlayAnchor,
|
|
5
|
+
type OverlayPositionStrategy,
|
|
6
|
+
type OverlayReference,
|
|
7
|
+
} from '../../../shared/src/lib/overlay-anchor'
|
|
2
8
|
|
|
3
|
-
export
|
|
4
|
-
| HTMLElement
|
|
5
|
-
| {
|
|
6
|
-
getBoundingClientRect: () => Pick<
|
|
7
|
-
DOMRect,
|
|
8
|
-
'x' | 'y' | 'width' | 'height' | 'top' | 'right' | 'bottom' | 'left'
|
|
9
|
-
>
|
|
10
|
-
contextElement?: Element
|
|
11
|
-
}
|
|
12
|
-
export type OverlayPositionStrategy = 'optimized' | 'always'
|
|
13
|
-
|
|
14
|
-
export function overlayAnchorElement(anchor?: OverlayAnchor | null): HTMLElement | undefined {
|
|
15
|
-
return anchor && 'nodeType' in anchor ? anchor : undefined
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function overlayAnchorContext(anchor?: OverlayAnchor | null): Element | undefined {
|
|
19
|
-
return (
|
|
20
|
-
overlayAnchorElement(anchor) ??
|
|
21
|
-
(anchor && 'contextElement' in anchor ? anchor.contextElement : undefined)
|
|
22
|
-
)
|
|
23
|
-
}
|
|
9
|
+
export * from '../../../shared/src/lib/overlay-anchor'
|
|
24
10
|
|
|
25
11
|
export function useOverlayAnchor(
|
|
26
12
|
source: () => OverlayAnchor | null | undefined,
|
|
@@ -29,7 +15,7 @@ export function useOverlayAnchor(
|
|
|
29
15
|
strategy: () => OverlayPositionStrategy,
|
|
30
16
|
direction: () => 'ltr' | 'rtl' | undefined = () => undefined,
|
|
31
17
|
) {
|
|
32
|
-
const reference = shallowRef<
|
|
18
|
+
const reference = shallowRef<OverlayReference>()
|
|
33
19
|
|
|
34
20
|
let current: OverlayAnchor | undefined
|
|
35
21
|
|
|
@@ -42,22 +28,10 @@ export function useOverlayAnchor(
|
|
|
42
28
|
return
|
|
43
29
|
}
|
|
44
30
|
if (!anchor || (!active && reference.value && anchor !== current)) return
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
31
|
+
const next = createOverlayReference(anchor, () => source() === anchor)
|
|
32
|
+
if (!next) return
|
|
47
33
|
current = anchor
|
|
48
|
-
|
|
49
|
-
const { x, y, width, height, top, right, bottom, left } = anchor.getBoundingClientRect()
|
|
50
|
-
return { x, y, width, height, top, right, bottom, left }
|
|
51
|
-
}
|
|
52
|
-
let rect = measure()
|
|
53
|
-
reference.value = {
|
|
54
|
-
contextElement,
|
|
55
|
-
getBoundingClientRect: () => {
|
|
56
|
-
if (source() === anchor && (!contextElement || contextElement.isConnected))
|
|
57
|
-
rect = measure()
|
|
58
|
-
return rect
|
|
59
|
-
},
|
|
60
|
-
}
|
|
34
|
+
reference.value = next
|
|
61
35
|
},
|
|
62
36
|
{ immediate: true, flush: 'post' },
|
|
63
37
|
)
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const cross = (a: Point, b: Point, c: Point) =>
|
|
3
|
-
(b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x)
|
|
4
|
-
|
|
5
|
-
export function inPointerCorridor(point: Point, first: DOMRect, second: DOMRect) {
|
|
6
|
-
const points = [first, second]
|
|
7
|
-
.flatMap(rect => [
|
|
8
|
-
{ x: rect.left - 6, y: rect.top - 6 },
|
|
9
|
-
{ x: rect.right + 6, y: rect.top - 6 },
|
|
10
|
-
{ x: rect.left - 6, y: rect.bottom + 6 },
|
|
11
|
-
{ x: rect.right + 6, y: rect.bottom + 6 },
|
|
12
|
-
])
|
|
13
|
-
.sort((a, b) => a.x - b.x || a.y - b.y)
|
|
14
|
-
const half = (values: Point[]) => {
|
|
15
|
-
const hull: Point[] = []
|
|
16
|
-
for (const value of values) {
|
|
17
|
-
while (hull.length > 1 && cross(hull[hull.length - 2]!, hull[hull.length - 1]!, value) <= 0)
|
|
18
|
-
hull.pop()
|
|
19
|
-
hull.push(value)
|
|
20
|
-
}
|
|
21
|
-
hull.pop()
|
|
22
|
-
return hull
|
|
23
|
-
}
|
|
24
|
-
const hull = [...half(points), ...half([...points].reverse())]
|
|
25
|
-
return hull.every((a, i) => cross(a, hull[(i + 1) % hull.length]!, point) >= 0)
|
|
26
|
-
}
|
|
1
|
+
export * from '../../../shared/src/lib/pointer-corridor'
|
|
@@ -7,18 +7,23 @@ import {
|
|
|
7
7
|
useFilter,
|
|
8
8
|
} from 'reka-ui'
|
|
9
9
|
import type ScrollArea from '../../components/scroll-area/ScrollArea.vue'
|
|
10
|
-
import {
|
|
10
|
+
import type { SelectItems, SelectOption } from '../../components/select/types'
|
|
11
11
|
import { useVirtualCollection } from '../virtual/useVirtualCollection'
|
|
12
|
-
import { nextEnabled
|
|
12
|
+
import { nextEnabled } from '../virtual/navigation'
|
|
13
13
|
import type { VirtualizeOptions } from '../virtual/types'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
import {
|
|
15
|
+
choiceAttrs,
|
|
16
|
+
choiceDisabled,
|
|
17
|
+
choiceEstimate,
|
|
18
|
+
choiceGroups,
|
|
19
|
+
choiceKeyAction,
|
|
20
|
+
choiceRangeValues,
|
|
21
|
+
choiceRows,
|
|
22
|
+
choiceSize,
|
|
23
|
+
createChoiceTypeahead,
|
|
24
|
+
enabledChoiceValues,
|
|
25
|
+
selectedChoice,
|
|
26
|
+
} from '../../../../shared/src/lib/virtual/choices'
|
|
22
27
|
|
|
23
28
|
export function useVirtualChoices<T extends SelectOption>(props: {
|
|
24
29
|
options: SelectItems<T>
|
|
@@ -35,43 +40,19 @@ export function useVirtualChoices<T extends SelectOption>(props: {
|
|
|
35
40
|
const activeKey = shallowRef<string>()
|
|
36
41
|
const id = useId()
|
|
37
42
|
const { contains } = useFilter({ sensitivity: 'base' })
|
|
38
|
-
const rows = computed(() =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
result.push({ key: `group:${groupIndex}`, label: item.label, position: 0 })
|
|
48
|
-
for (const option of options)
|
|
49
|
-
result.push({
|
|
50
|
-
key: `option:${typeof option.value}:${option.value}`,
|
|
51
|
-
label: option.label,
|
|
52
|
-
option,
|
|
53
|
-
group,
|
|
54
|
-
position: ++position,
|
|
55
|
-
})
|
|
56
|
-
} else if (!query || contains(item.label, query))
|
|
57
|
-
result.push({
|
|
58
|
-
key: `option:${typeof item.value}:${item.value}`,
|
|
59
|
-
label: item.label,
|
|
60
|
-
option: item,
|
|
61
|
-
position: ++position,
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
return result
|
|
65
|
-
})
|
|
66
|
-
const size = computed(() => rows.value.filter(row => row.option).length)
|
|
67
|
-
const disabled = (index: number) =>
|
|
68
|
-
!rows.value[index]?.option || !!rows.value[index]?.option?.disabled
|
|
43
|
+
const rows = computed(() =>
|
|
44
|
+
choiceRows(
|
|
45
|
+
props.options,
|
|
46
|
+
combobox && !combobox.ignoreFilter.value ? combobox.filterSearch.value : '',
|
|
47
|
+
contains,
|
|
48
|
+
),
|
|
49
|
+
)
|
|
50
|
+
const size = computed(() => choiceSize(rows.value))
|
|
51
|
+
const disabled = (index: number) => choiceDisabled(rows.value, index)
|
|
69
52
|
const first = () => nextEnabled(rows.value.length, 0, 1, disabled)
|
|
70
|
-
const selectedIndex = computed(() =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return rows.value.findIndex(row => row.option?.value === value && !!row.option)
|
|
74
|
-
})
|
|
53
|
+
const selectedIndex = computed(() =>
|
|
54
|
+
selectedChoice(rows.value, select?.modelValue.value ?? listbox?.modelValue.value),
|
|
55
|
+
)
|
|
75
56
|
const activeIndex = computed(() => rows.value.findIndex(row => row.key === activeKey.value))
|
|
76
57
|
const collection = useVirtualCollection({
|
|
77
58
|
items: () => rows.value,
|
|
@@ -81,11 +62,8 @@ export function useVirtualChoices<T extends SelectOption>(props: {
|
|
|
81
62
|
config: () => props.virtualize,
|
|
82
63
|
initialIndex: props.kind === 'listbox' ? undefined : () => selectedIndex.value,
|
|
83
64
|
retain: () => [activeIndex.value, selectedIndex.value],
|
|
84
|
-
include: indexes =>
|
|
85
|
-
|
|
86
|
-
rows.value[index]?.group === undefined ? [] : [rows.value[index]!.group!],
|
|
87
|
-
),
|
|
88
|
-
estimate: row => (row.option ? (row.option.description ? 54 : 36) : 30),
|
|
65
|
+
include: indexes => choiceGroups(rows.value, indexes),
|
|
66
|
+
estimate: choiceEstimate,
|
|
89
67
|
})
|
|
90
68
|
let generation = 0
|
|
91
69
|
let disposed = false
|
|
@@ -115,8 +93,7 @@ export function useVirtualChoices<T extends SelectOption>(props: {
|
|
|
115
93
|
if (wrapper && body.value?.contains(wrapper))
|
|
116
94
|
activeKey.value = rows.value[Number(wrapper.dataset.index)]?.key
|
|
117
95
|
}
|
|
118
|
-
|
|
119
|
-
let searchedAt = 0
|
|
96
|
+
const typeahead = createChoiceTypeahead()
|
|
120
97
|
function keydown(event: KeyboardEvent) {
|
|
121
98
|
if (
|
|
122
99
|
event.isComposing ||
|
|
@@ -125,90 +102,43 @@ export function useVirtualChoices<T extends SelectOption>(props: {
|
|
|
125
102
|
listbox?.disabled.value
|
|
126
103
|
)
|
|
127
104
|
return
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
listbox
|
|
144
|
-
row.option && !row.option.disabled ? [row.option.value] : [],
|
|
145
|
-
)
|
|
105
|
+
const action = choiceKeyAction(event, {
|
|
106
|
+
labels: () => rows.value.map(row => row.label),
|
|
107
|
+
count: rows.value.length,
|
|
108
|
+
current: activeIndex.value,
|
|
109
|
+
input:
|
|
110
|
+
event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement,
|
|
111
|
+
multiple: !!listbox?.multiple.value,
|
|
112
|
+
page: viewport.value?.clientHeight ?? 320,
|
|
113
|
+
disabled,
|
|
114
|
+
typeahead,
|
|
115
|
+
})
|
|
116
|
+
if (action.type === 'none') return
|
|
117
|
+
event.preventDefault()
|
|
118
|
+
event.stopImmediatePropagation()
|
|
119
|
+
if (action.type === 'select-all') {
|
|
120
|
+
listbox!.modelValue.value = enabledChoiceValues(rows.value)
|
|
146
121
|
return
|
|
147
122
|
}
|
|
148
|
-
if (
|
|
149
|
-
if (event.key === 'ArrowDown') target = nextEnabled(rows.value.length, current + 1, 1, disabled)
|
|
150
|
-
else if (event.key === 'ArrowUp')
|
|
151
|
-
target = nextEnabled(
|
|
152
|
-
rows.value.length,
|
|
153
|
-
current < 0 ? rows.value.length - 1 : current - 1,
|
|
154
|
-
-1,
|
|
155
|
-
disabled,
|
|
156
|
-
)
|
|
157
|
-
else if (event.key === 'Home') target = first()
|
|
158
|
-
else if (event.key === 'End')
|
|
159
|
-
target = nextEnabled(rows.value.length, rows.value.length - 1, -1, disabled)
|
|
160
|
-
else if (event.key === 'PageDown' || event.key === 'PageUp') {
|
|
161
|
-
const step = event.key === 'PageDown' ? 1 : -1
|
|
162
|
-
target = nextEnabled(
|
|
163
|
-
rows.value.length,
|
|
164
|
-
Math.max(
|
|
165
|
-
0,
|
|
166
|
-
Math.min(
|
|
167
|
-
rows.value.length - 1,
|
|
168
|
-
Math.max(0, current) +
|
|
169
|
-
step * Math.max(1, Math.floor((viewport.value?.clientHeight ?? 320) / 36)),
|
|
170
|
-
),
|
|
171
|
-
),
|
|
172
|
-
step,
|
|
173
|
-
disabled,
|
|
174
|
-
)
|
|
175
|
-
} else if (event.key === 'Enter' || (event.key === ' ' && !input && !search)) {
|
|
176
|
-
if (current < 0 || disabled(current)) return
|
|
177
|
-
event.preventDefault()
|
|
178
|
-
event.stopImmediatePropagation()
|
|
123
|
+
if (action.type === 'commit') {
|
|
179
124
|
if (select) {
|
|
180
|
-
select.onValueChange(rows.value[
|
|
125
|
+
select.onValueChange(rows.value[action.index]!.option!.value)
|
|
181
126
|
if (!select.multiple.value) select.onOpenChange(false)
|
|
182
127
|
} else {
|
|
183
|
-
void highlight(
|
|
128
|
+
void highlight(action.index, false, false).then(element => element?.click())
|
|
184
129
|
}
|
|
185
130
|
return
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
search = (now - searchedAt > 1000 ? '' : search) + event.key
|
|
189
|
-
searchedAt = now
|
|
190
|
-
target = typeaheadMatch(
|
|
191
|
-
rows.value.map(row => row.label),
|
|
192
|
-
search,
|
|
193
|
-
current,
|
|
194
|
-
disabled,
|
|
195
|
-
)
|
|
196
|
-
} else return
|
|
197
|
-
event.preventDefault()
|
|
198
|
-
event.stopImmediatePropagation()
|
|
199
|
-
if (target < 0) return
|
|
131
|
+
}
|
|
132
|
+
if (action.target < 0) return
|
|
200
133
|
if (
|
|
201
134
|
event.shiftKey &&
|
|
202
135
|
listbox?.multiple.value &&
|
|
203
136
|
listbox.selectionBehavior?.value === 'replace'
|
|
204
137
|
) {
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
207
|
-
listbox.modelValue.value = rows.value
|
|
208
|
-
.slice(Math.min(start, target), Math.max(start, target) + 1)
|
|
209
|
-
.flatMap(row => (row.option && !row.option.disabled ? [row.option.value] : []))
|
|
138
|
+
const values = choiceRangeValues(rows.value, listbox.firstValue?.value, action.target)
|
|
139
|
+
if (values) listbox.modelValue.value = values
|
|
210
140
|
}
|
|
211
|
-
void highlight(target)
|
|
141
|
+
void highlight(action.target)
|
|
212
142
|
}
|
|
213
143
|
useEventListener(body, 'keydown', keydown, { capture: true })
|
|
214
144
|
useEventListener(() => combobox?.inputElement.value ?? props.input, 'keydown', keydown, {
|
|
@@ -283,21 +213,13 @@ export function useVirtualChoices<T extends SelectOption>(props: {
|
|
|
283
213
|
generation++
|
|
284
214
|
stops.forEach(stop => stop())
|
|
285
215
|
})
|
|
286
|
-
function itemAttrs(index: number) {
|
|
287
|
-
const row = rows.value[index]!
|
|
288
|
-
return {
|
|
289
|
-
'aria-posinset': row.position,
|
|
290
|
-
'aria-setsize': size.value,
|
|
291
|
-
'aria-describedby': row.group === undefined ? undefined : `${id}-${row.group}`,
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
216
|
return {
|
|
295
217
|
area,
|
|
296
218
|
body,
|
|
297
219
|
viewport,
|
|
298
220
|
rows,
|
|
299
221
|
...collection,
|
|
300
|
-
itemAttrs,
|
|
222
|
+
itemAttrs: (index: number) => choiceAttrs(rows.value, index, size.value, id),
|
|
301
223
|
labelId: (index: number) => `${id}-${index}`,
|
|
302
224
|
}
|
|
303
225
|
}
|
|
@@ -2,8 +2,14 @@ import { computed, nextTick, onScopeDispose, shallowRef, watch, type Ref } from
|
|
|
2
2
|
import { useEventListener } from '@vueuse/core'
|
|
3
3
|
import { injectTreeRootContext, type FlattenedItem } from 'reka-ui'
|
|
4
4
|
import { useVirtualCollection } from '../virtual/useVirtualCollection'
|
|
5
|
-
import { nextEnabled
|
|
5
|
+
import { nextEnabled } from '../virtual/navigation'
|
|
6
6
|
import type { VirtualizeOptions } from '../virtual/types'
|
|
7
|
+
import { createChoiceTypeahead } from '../../../../shared/src/lib/virtual/choices'
|
|
8
|
+
import {
|
|
9
|
+
survivingTreeAncestor,
|
|
10
|
+
virtualTreeDisabled,
|
|
11
|
+
virtualTreeKeyTarget,
|
|
12
|
+
} from '../../../../shared/src/lib/virtual/tree'
|
|
7
13
|
|
|
8
14
|
export function useVirtualTree<T extends { label: string; disabled?: boolean }>(
|
|
9
15
|
props: {
|
|
@@ -19,9 +25,7 @@ export function useVirtualTree<T extends { label: string; disabled?: boolean }>(
|
|
|
19
25
|
const active = shallowRef<string>()
|
|
20
26
|
const index = computed(() => props.items.findIndex(item => item._id === active.value))
|
|
21
27
|
const disabled = (i: number) =>
|
|
22
|
-
|
|
23
|
-
root.disabled.value ||
|
|
24
|
-
(props.disabled?.(props.items[i]!.value) ?? !!props.items[i]!.value.disabled)
|
|
28
|
+
virtualTreeDisabled(props.items, i, root.disabled.value, props.disabled)
|
|
25
29
|
const selected = computed(() =>
|
|
26
30
|
props.items.findIndex(item => root.selectedKeys.value.includes(item._id)),
|
|
27
31
|
)
|
|
@@ -53,61 +57,20 @@ export function useVirtualTree<T extends { label: string; disabled?: boolean }>(
|
|
|
53
57
|
}
|
|
54
58
|
const first = () => nextEnabled(props.items.length, 0, 1, disabled)
|
|
55
59
|
const last = () => nextEnabled(props.items.length, props.items.length - 1, -1, disabled)
|
|
56
|
-
|
|
57
|
-
let searchedAt = 0
|
|
60
|
+
const typeahead = createChoiceTypeahead()
|
|
58
61
|
function keydown(event: KeyboardEvent) {
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (event.key === 'ArrowDown')
|
|
72
|
-
target = nextEnabled(props.items.length, current + 1, 1, disabled)
|
|
73
|
-
else if (event.key === 'ArrowUp')
|
|
74
|
-
target = nextEnabled(props.items.length, current - 1, -1, disabled)
|
|
75
|
-
else if (event.key === 'Home') target = first()
|
|
76
|
-
else if (event.key === 'End') target = last()
|
|
77
|
-
else if (event.key === 'PageDown' || event.key === 'PageUp') {
|
|
78
|
-
const step = event.key === 'PageDown' ? 1 : -1
|
|
79
|
-
target = nextEnabled(
|
|
80
|
-
props.items.length,
|
|
81
|
-
Math.max(
|
|
82
|
-
0,
|
|
83
|
-
Math.min(
|
|
84
|
-
props.items.length - 1,
|
|
85
|
-
current + step * Math.max(1, Math.floor((viewport.value?.clientHeight ?? 320) / 36)),
|
|
86
|
-
),
|
|
87
|
-
),
|
|
88
|
-
step,
|
|
89
|
-
disabled,
|
|
90
|
-
)
|
|
91
|
-
} else if (event.key === (root.dir.value === 'rtl' ? 'ArrowLeft' : 'ArrowRight')) {
|
|
92
|
-
if (!item?.hasChildren) return
|
|
93
|
-
if (!root.expanded.value.includes(item._id)) return
|
|
94
|
-
const child = nextEnabled(props.items.length, current + 1, 1, disabled)
|
|
95
|
-
if (props.items[child]?.level === item.level + 1) target = child
|
|
96
|
-
} else if (event.key === (root.dir.value === 'rtl' ? 'ArrowRight' : 'ArrowLeft')) {
|
|
97
|
-
if (!item || root.expanded.value.includes(item._id)) return
|
|
98
|
-
if (item.parentItem)
|
|
99
|
-
target = props.items.findIndex(row => row._id === root.getKey(item.parentItem))
|
|
100
|
-
} else if (event.key.length === 1 && event.key !== ' ') {
|
|
101
|
-
const now = Date.now()
|
|
102
|
-
search = (now - searchedAt > 1000 ? '' : search) + event.key
|
|
103
|
-
searchedAt = now
|
|
104
|
-
target = typeaheadMatch(
|
|
105
|
-
props.items.map(row => row.value.label),
|
|
106
|
-
search,
|
|
107
|
-
current,
|
|
108
|
-
disabled,
|
|
109
|
-
)
|
|
110
|
-
} else return
|
|
62
|
+
if (event.defaultPrevented || event.isComposing || root.disabled.value) return
|
|
63
|
+
const target = virtualTreeKeyTarget(event, {
|
|
64
|
+
rows: props.items,
|
|
65
|
+
current: index.value,
|
|
66
|
+
expanded: root.expanded.value,
|
|
67
|
+
dir: root.dir.value,
|
|
68
|
+
page: viewport.value?.clientHeight ?? 320,
|
|
69
|
+
getKey: root.getKey,
|
|
70
|
+
disabled,
|
|
71
|
+
typeahead,
|
|
72
|
+
})
|
|
73
|
+
if (target === undefined) return
|
|
111
74
|
event.preventDefault()
|
|
112
75
|
event.stopImmediatePropagation()
|
|
113
76
|
void focus(target)
|
|
@@ -122,13 +85,7 @@ export function useVirtualTree<T extends { label: string; disabled?: boolean }>(
|
|
|
122
85
|
() => props.items,
|
|
123
86
|
(items, old) => {
|
|
124
87
|
if (index.value >= 0 || !active.value) return
|
|
125
|
-
|
|
126
|
-
let target = -1
|
|
127
|
-
while (removed?.parentItem && target < 0) {
|
|
128
|
-
const parent = root.getKey(removed.parentItem)
|
|
129
|
-
target = items.findIndex(item => item._id === parent)
|
|
130
|
-
removed = old?.find(item => item._id === parent)
|
|
131
|
-
}
|
|
88
|
+
const target = survivingTreeAncestor(items, old, active.value, root.getKey)
|
|
132
89
|
void focus(target >= 0 ? target : first(), body.value?.contains(document.activeElement))
|
|
133
90
|
},
|
|
134
91
|
{ flush: 'pre' },
|