@flux-ui/components 3.0.0-next.34 → 3.0.0-next.38
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/dist/component/FluxActionBar.vue.d.ts +17 -17
- package/dist/component/FluxActionPane.vue.d.ts +7 -7
- package/dist/component/{FluxActions.vue.d.ts → FluxActionStack.vue.d.ts} +11 -15
- package/dist/component/{FluxAutoGrid.vue.d.ts → FluxAdaptiveGroup.vue.d.ts} +6 -3
- package/dist/component/FluxAdaptiveSlot.vue.d.ts +35 -0
- package/dist/component/FluxAspectRatio.vue.d.ts +3 -3
- package/dist/component/FluxBadgeStack.vue.d.ts +3 -3
- package/dist/component/FluxButtonGroup.vue.d.ts +3 -3
- package/dist/component/FluxButtonStack.vue.d.ts +3 -3
- package/dist/component/FluxCalendar.vue.d.ts +3 -3
- package/dist/component/FluxCalendarEvent.vue.d.ts +3 -3
- package/dist/component/FluxCheckbox.vue.d.ts +2 -1
- package/dist/component/FluxClickablePane.vue.d.ts +5 -5
- package/dist/component/FluxColorSelect.vue.d.ts +1 -0
- package/dist/component/{FluxPaneDeck.vue.d.ts → FluxColumn.vue.d.ts} +5 -5
- package/dist/component/FluxCommandPalette.vue.d.ts +52 -0
- package/dist/component/FluxCommandPaletteGroup.vue.d.ts +8 -0
- package/dist/component/FluxCommandPaletteItem.vue.d.ts +18 -0
- package/dist/component/FluxComment.vue.d.ts +3 -3
- package/dist/component/FluxContainer.vue.d.ts +3 -3
- package/dist/component/FluxDivider.vue.d.ts +5 -3
- package/dist/component/FluxDropZone.vue.d.ts +8 -7
- package/dist/component/FluxExpandableGroup.vue.d.ts +3 -3
- package/dist/component/FluxFader.vue.d.ts +3 -3
- package/dist/component/FluxFaderItem.vue.d.ts +3 -3
- package/dist/component/FluxFilter.vue.d.ts +3 -3
- package/dist/component/FluxFilterBar.vue.d.ts +3 -3
- package/dist/component/FluxFilterBase.vue.d.ts +4 -4
- package/dist/component/FluxFilterWindow.vue.d.ts +13 -17
- package/dist/component/FluxFlyout.vue.d.ts +19 -21
- package/dist/component/FluxForm.vue.d.ts +3 -3
- package/dist/component/FluxFormColumn.vue.d.ts +3 -3
- package/dist/component/FluxFormDateInput.vue.d.ts +18 -24
- package/dist/component/FluxFormDateRangeInput.vue.d.ts +18 -21
- package/dist/component/FluxFormDateTimeInput.vue.d.ts +18 -24
- package/dist/component/FluxFormField.vue.d.ts +7 -7
- package/dist/component/FluxFormGrid.vue.d.ts +3 -3
- package/dist/component/FluxFormInput.vue.d.ts +2 -9
- package/dist/component/FluxFormInputAddition.vue.d.ts +3 -3
- package/dist/component/FluxFormInputGroup.vue.d.ts +3 -3
- package/dist/component/FluxFormPinInput.vue.d.ts +2 -4
- package/dist/component/FluxFormRangeSlider.vue.d.ts +18 -2
- package/dist/component/FluxFormRow.vue.d.ts +3 -3
- package/dist/component/FluxFormSection.vue.d.ts +3 -3
- package/dist/component/FluxFormSelect.vue.d.ts +2 -4
- package/dist/component/FluxFormSelectAsync.vue.d.ts +2 -4
- package/dist/component/FluxFormSlider.vue.d.ts +11 -2
- package/dist/component/FluxFormTextArea.vue.d.ts +2 -6
- package/dist/component/FluxFormTimeZonePicker.vue.d.ts +2 -4
- package/dist/component/FluxFormTreeViewSelect.vue.d.ts +15 -37
- package/dist/component/FluxGallery.vue.d.ts +3 -3
- package/dist/component/FluxGrid.vue.d.ts +3 -3
- package/dist/component/FluxGridColumn.vue.d.ts +3 -3
- package/dist/component/FluxIcon.vue.d.ts +1 -0
- package/dist/component/FluxInfo.vue.d.ts +3 -3
- package/dist/component/FluxInfoStack.vue.d.ts +3 -3
- package/dist/component/FluxLayerPane.vue.d.ts +20 -0
- package/dist/component/FluxLayerPaneSecondary.vue.d.ts +20 -0
- package/dist/component/FluxMenu.vue.d.ts +3 -3
- package/dist/component/FluxMenuCollapsible.vue.d.ts +47 -0
- package/dist/component/FluxMenuGroup.vue.d.ts +3 -3
- package/dist/component/FluxMenuItem.vue.d.ts +5 -3
- package/dist/component/FluxMenuOptions.vue.d.ts +3 -3
- package/dist/component/FluxNotice.vue.d.ts +5 -5
- package/dist/component/FluxNoticeStack.vue.d.ts +3 -3
- package/dist/component/FluxOverflowBar.vue.d.ts +4 -4
- package/dist/component/FluxPane.vue.d.ts +5 -5
- package/dist/component/FluxPaneBody.vue.d.ts +3 -3
- package/dist/component/FluxPaneFooter.vue.d.ts +3 -3
- package/dist/component/FluxPaneGroup.vue.d.ts +3 -3
- package/dist/component/FluxPaneHeader.vue.d.ts +6 -6
- package/dist/component/FluxPaneIllustration.vue.d.ts +5 -5
- package/dist/component/FluxPressable.vue.d.ts +3 -3
- package/dist/component/FluxPrompt.vue.d.ts +3 -17
- package/dist/component/FluxRoot.vue.d.ts +3 -3
- package/dist/component/FluxRow.vue.d.ts +23 -0
- package/dist/component/FluxSegmentedControl.vue.d.ts +3 -2
- package/dist/component/FluxSplitButton.vue.d.ts +5 -5
- package/dist/component/FluxStack.vue.d.ts +3 -3
- package/dist/component/FluxStepper.vue.d.ts +6 -6
- package/dist/component/FluxStepperStep.vue.d.ts +3 -3
- package/dist/component/FluxTab.vue.d.ts +3 -3
- package/dist/component/FluxTabBar.vue.d.ts +3 -3
- package/dist/component/FluxTabBarItem.vue.d.ts +5 -7
- package/dist/component/FluxTableActions.vue.d.ts +3 -3
- package/dist/component/FluxTableBar.vue.d.ts +3 -3
- package/dist/component/FluxTableCell.vue.d.ts +5 -5
- package/dist/component/FluxTableHeader.vue.d.ts +3 -3
- package/dist/component/FluxTableRow.vue.d.ts +3 -3
- package/dist/component/FluxTabs.vue.d.ts +6 -6
- package/dist/component/FluxTag.vue.d.ts +1 -0
- package/dist/component/FluxTagStack.vue.d.ts +3 -3
- package/dist/component/FluxTimeline.vue.d.ts +3 -3
- package/dist/component/FluxTimelineItem.vue.d.ts +3 -3
- package/dist/component/FluxToggle.vue.d.ts +2 -3
- package/dist/component/FluxToolbar.vue.d.ts +3 -3
- package/dist/component/FluxToolbarGroup.vue.d.ts +3 -3
- package/dist/component/FluxWindow.vue.d.ts +3 -3
- package/dist/component/index.d.ts +11 -3
- package/dist/component/primitive/Anchor.vue.d.ts +3 -3
- package/dist/component/primitive/AnchorPopup.vue.d.ts +3 -3
- package/dist/component/primitive/CoordinatePicker.vue.d.ts +1 -0
- package/dist/component/primitive/DialogLayout.vue.d.ts +28 -0
- package/dist/component/primitive/FilterOptionBase.vue.d.ts +2 -2
- package/dist/component/primitive/SelectBase.vue.d.ts +19 -37
- package/dist/component/primitive/SliderThumb.vue.d.ts +4 -0
- package/dist/component/primitive/TreeNodeRenderer.vue.d.ts +30 -0
- package/dist/component/primitive/index.d.ts +2 -0
- package/dist/composable/index.d.ts +1 -0
- package/dist/composable/private/index.d.ts +8 -0
- package/dist/composable/private/useAsyncFilterOptions.d.ts +14 -0
- package/dist/composable/private/useCommandPalette.d.ts +38 -0
- package/dist/composable/private/useDateFlyout.d.ts +10 -0
- package/dist/composable/private/useDropdownPopup.d.ts +27 -0
- package/dist/composable/private/useFilterOption.d.ts +12 -0
- package/dist/composable/useAdaptiveGroupInjection.d.ts +2 -0
- package/dist/data/di.d.ts +11 -0
- package/dist/data/filter.d.ts +4 -17
- package/dist/data/i18n.d.ts +17 -0
- package/dist/data/timeZones.d.ts +3 -0
- package/dist/index.css +710 -349
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6936 -5537
- package/dist/index.js.map +1 -1
- package/dist/transition/FluxAutoHeightTransition.vue.d.ts +5 -3
- package/dist/transition/FluxAutoWidthTransition.vue.d.ts +5 -3
- package/dist/transition/FluxBreakthroughTransition.vue.d.ts +5 -3
- package/dist/transition/FluxFadeTransition.vue.d.ts +5 -3
- package/dist/transition/FluxOverlayTransition.vue.d.ts +5 -3
- package/dist/transition/FluxRouteTransition.vue.d.ts +5 -3
- package/dist/transition/FluxSlideOverTransition.vue.d.ts +5 -3
- package/dist/transition/FluxTooltipTransition.vue.d.ts +5 -3
- package/dist/transition/FluxVerticalWindowTransition.vue.d.ts +5 -3
- package/dist/transition/FluxWindowTransition.vue.d.ts +5 -3
- package/package.json +19 -23
- package/src/component/FluxActionBar.vue +9 -8
- package/src/component/FluxActionPane.vue +4 -3
- package/src/component/{FluxActions.vue → FluxActionStack.vue} +2 -2
- package/src/component/FluxAdaptiveGroup.vue +112 -0
- package/src/component/FluxAdaptiveSlot.vue +159 -0
- package/src/component/FluxAlert.vue +8 -17
- package/src/component/FluxAnimatedColors.vue +1 -1
- package/src/component/FluxAspectRatio.vue +2 -1
- package/src/component/FluxBadge.vue +5 -1
- package/src/component/FluxBadgeStack.vue +2 -1
- package/src/component/FluxButtonGroup.vue +2 -1
- package/src/component/FluxButtonStack.vue +2 -1
- package/src/component/FluxCalendar.vue +8 -1
- package/src/component/FluxCalendarEvent.vue +2 -1
- package/src/component/FluxCheckbox.vue +33 -6
- package/src/component/FluxChip.vue +1 -0
- package/src/component/FluxClickablePane.vue +3 -2
- package/src/component/FluxColorPicker.vue +8 -1
- package/src/component/FluxColorSelect.vue +25 -4
- package/src/component/{FluxAutoGrid.vue → FluxColumn.vue} +5 -8
- package/src/component/FluxCommandPalette.vue +290 -0
- package/src/component/FluxCommandPaletteGroup.vue +23 -0
- package/src/component/FluxCommandPaletteItem.vue +60 -0
- package/src/component/FluxComment.vue +2 -2
- package/src/component/FluxConfirm.vue +8 -17
- package/src/component/FluxContainer.vue +3 -2
- package/src/component/FluxDataTable.vue +3 -1
- package/src/component/FluxDivider.vue +7 -3
- package/src/component/FluxDropZone.vue +22 -8
- package/src/component/FluxExpandable.vue +3 -2
- package/src/component/FluxExpandableGroup.vue +2 -2
- package/src/component/FluxFader.vue +2 -2
- package/src/component/FluxFaderItem.vue +2 -1
- package/src/component/FluxFilter.vue +2 -1
- package/src/component/FluxFilterBar.vue +3 -2
- package/src/component/FluxFilterBase.vue +17 -9
- package/src/component/FluxFilterOption.vue +3 -14
- package/src/component/FluxFilterOptionAsync.vue +17 -60
- package/src/component/FluxFilterOptions.vue +3 -25
- package/src/component/FluxFilterOptionsAsync.vue +9 -73
- package/src/component/FluxFilterWindow.vue +1 -1
- package/src/component/FluxFlyout.vue +13 -11
- package/src/component/FluxForm.vue +2 -1
- package/src/component/FluxFormColumn.vue +2 -1
- package/src/component/FluxFormDateInput.vue +9 -22
- package/src/component/FluxFormDateRangeInput.vue +20 -15
- package/src/component/FluxFormDateTimeInput.vue +17 -20
- package/src/component/FluxFormField.vue +4 -4
- package/src/component/FluxFormGrid.vue +2 -1
- package/src/component/FluxFormInput.vue +11 -10
- package/src/component/FluxFormInputAddition.vue +2 -1
- package/src/component/FluxFormInputGroup.vue +3 -2
- package/src/component/FluxFormPinInput.vue +14 -6
- package/src/component/FluxFormRangeSlider.vue +12 -2
- package/src/component/FluxFormRow.vue +2 -1
- package/src/component/FluxFormSection.vue +4 -3
- package/src/component/FluxFormSelect.vue +11 -4
- package/src/component/FluxFormSelectAsync.vue +14 -8
- package/src/component/FluxFormSlider.vue +8 -2
- package/src/component/FluxFormTextArea.vue +12 -7
- package/src/component/FluxFormTimeZonePicker.vue +13 -626
- package/src/component/FluxFormTreeViewSelect.vue +51 -79
- package/src/component/FluxGallery.vue +2 -1
- package/src/component/FluxGrid.vue +3 -2
- package/src/component/FluxGridColumn.vue +2 -1
- package/src/component/FluxIcon.vue +4 -2
- package/src/component/FluxInfo.vue +2 -1
- package/src/component/FluxInfoStack.vue +3 -2
- package/src/component/FluxLayerPane.vue +16 -0
- package/src/component/FluxLayerPaneSecondary.vue +16 -0
- package/src/component/FluxLegend.vue +9 -9
- package/src/component/FluxMenu.vue +2 -2
- package/src/component/FluxMenuCollapsible.vue +187 -0
- package/src/component/FluxMenuGroup.vue +2 -1
- package/src/component/FluxMenuItem.vue +9 -1
- package/src/component/FluxMenuOptions.vue +1 -1
- package/src/component/FluxNotice.vue +7 -2
- package/src/component/FluxNoticeStack.vue +2 -1
- package/src/component/FluxOverflowBar.vue +3 -3
- package/src/component/FluxPagination.vue +1 -0
- package/src/component/FluxPane.vue +3 -2
- package/src/component/FluxPaneBody.vue +2 -1
- package/src/component/FluxPaneFooter.vue +2 -1
- package/src/component/FluxPaneGroup.vue +2 -1
- package/src/component/FluxPaneHeader.vue +7 -6
- package/src/component/FluxPaneIllustration.vue +3 -3
- package/src/component/FluxPaneMedia.vue +1 -1
- package/src/component/FluxPercentageBar.vue +3 -1
- package/src/component/FluxPressable.vue +2 -1
- package/src/component/FluxProgressBar.vue +2 -1
- package/src/component/FluxPrompt.vue +16 -27
- package/src/component/FluxRemove.vue +4 -0
- package/src/component/FluxRoot.vue +2 -2
- package/src/component/FluxRow.vue +24 -0
- package/src/component/FluxSegmentedControl.vue +51 -4
- package/src/component/FluxSnackbar.vue +36 -12
- package/src/component/FluxSplitButton.vue +3 -2
- package/src/component/FluxStack.vue +4 -3
- package/src/component/FluxStepper.vue +3 -3
- package/src/component/FluxStepperStep.vue +2 -1
- package/src/component/FluxTab.vue +2 -1
- package/src/component/FluxTabBar.vue +3 -3
- package/src/component/FluxTableActions.vue +5 -4
- package/src/component/FluxTableBar.vue +2 -1
- package/src/component/FluxTableCell.vue +4 -3
- package/src/component/FluxTableHeader.vue +4 -2
- package/src/component/FluxTableRow.vue +2 -1
- package/src/component/FluxTabs.vue +15 -6
- package/src/component/FluxTag.vue +8 -2
- package/src/component/FluxTagStack.vue +2 -1
- package/src/component/FluxTimeline.vue +2 -1
- package/src/component/FluxTimelineItem.vue +2 -1
- package/src/component/FluxToggle.vue +20 -5
- package/src/component/FluxToolbar.vue +2 -1
- package/src/component/FluxToolbarGroup.vue +2 -1
- package/src/component/FluxTooltip.vue +1 -1
- package/src/component/FluxTreeView.vue +9 -35
- package/src/component/FluxWindow.vue +2 -2
- package/src/component/index.ts +11 -3
- package/src/component/primitive/Anchor.vue +3 -1
- package/src/component/primitive/AnchorPopup.vue +3 -3
- package/src/component/primitive/CoordinatePicker.vue +2 -1
- package/src/component/primitive/CoordinatePickerThumb.vue +2 -0
- package/src/component/primitive/DialogLayout.vue +44 -0
- package/src/component/primitive/SelectBase.vue +22 -28
- package/src/component/primitive/SliderBase.vue +0 -1
- package/src/component/primitive/SliderThumb.vue +9 -0
- package/src/component/primitive/TreeNodeRenderer.vue +77 -0
- package/src/component/primitive/index.ts +2 -0
- package/src/composable/index.ts +1 -0
- package/src/composable/private/index.ts +8 -0
- package/src/composable/private/useAsyncFilterOptions.ts +70 -0
- package/src/composable/private/useCommandPalette.ts +405 -0
- package/src/composable/private/useDateFlyout.ts +34 -0
- package/src/composable/private/useDropdownPopup.ts +99 -0
- package/src/composable/private/useFilterOption.ts +59 -0
- package/src/composable/useAdaptiveGroupInjection.ts +6 -0
- package/src/css/component/Action.module.scss +2 -2
- package/src/css/component/AdaptiveSlot.module.scss +25 -0
- package/src/css/component/Avatar.module.scss +10 -11
- package/src/css/component/Badge.module.scss +11 -4
- package/src/css/component/Button.module.scss +4 -16
- package/src/css/component/Calendar.module.scss +4 -4
- package/src/css/component/Chip.module.scss +6 -10
- package/src/css/component/Color.module.scss +1 -1
- package/src/css/component/CommandPalette.module.scss +332 -0
- package/src/css/component/DatePicker.module.scss +1 -1
- package/src/css/component/Expandable.module.scss +5 -5
- package/src/css/component/Fader.module.scss +2 -1
- package/src/css/component/Flyout.module.scss +1 -1
- package/src/css/component/FocalPoint.module.scss +1 -1
- package/src/css/component/Form.module.scss +56 -10
- package/src/css/component/Item.module.scss +4 -4
- package/src/css/component/LayerPane.module.scss +40 -0
- package/src/css/component/Layout.module.scss +11 -4
- package/src/css/component/Legend.module.scss +2 -2
- package/src/css/component/Menu.module.scss +59 -11
- package/src/css/component/Notice.module.scss +7 -7
- package/src/css/component/Overlay.module.scss +2 -2
- package/src/css/component/Pane.module.scss +10 -23
- package/src/css/component/PercentageBar.module.scss +1 -1
- package/src/css/component/Remove.module.scss +1 -1
- package/src/css/component/SegmentedControl.module.scss +1 -0
- package/src/css/component/Snackbar.module.scss +1 -1
- package/src/css/component/Statistic.module.scss +2 -2
- package/src/css/component/Stepper.module.scss +1 -1
- package/src/css/component/Tab.module.scss +11 -15
- package/src/css/component/Table.module.scss +13 -13
- package/src/css/component/Timeline.module.scss +2 -2
- package/src/css/component/Toolbar.module.scss +3 -3
- package/src/css/component/Tooltip.module.scss +3 -4
- package/src/css/component/Transition.module.scss +1 -1
- package/src/css/component/TreeView.module.scss +2 -15
- package/src/css/component/TreeViewSelect.module.scss +1 -15
- package/src/css/component/base/Button.module.scss +6 -7
- package/src/css/component/base/Effect.module.scss +2 -1
- package/src/css/component/primitive/Slider.module.scss +6 -7
- package/src/css/component/primitive/TreeNode.module.scss +19 -0
- package/src/css/mixin/button-active.scss +6 -0
- package/src/css/mixin/focus-ring.scss +1 -1
- package/src/css/mixin/index.scss +1 -0
- package/src/css/typography.scss +3 -2
- package/src/css/variables.scss +7 -2
- package/src/data/di.ts +13 -0
- package/src/data/filter.ts +24 -28
- package/src/data/i18n.ts +17 -0
- package/src/data/store.ts +46 -11
- package/src/data/timeZones.ts +619 -0
- package/src/index.ts +2 -0
- package/src/transition/FluxAutoHeightTransition.vue +5 -0
- package/src/transition/FluxAutoWidthTransition.vue +5 -0
- package/src/transition/FluxBreakthroughTransition.vue +5 -0
- package/src/transition/FluxFadeTransition.vue +5 -0
- package/src/transition/FluxOverlayTransition.vue +5 -0
- package/src/transition/FluxRouteTransition.vue +5 -0
- package/src/transition/FluxSlideOverTransition.vue +5 -0
- package/src/transition/FluxTooltipTransition.vue +5 -0
- package/src/transition/FluxVerticalWindowTransition.vue +5 -0
- package/src/transition/FluxWindowTransition.vue +5 -0
- package/dist/0db98648.svg +0 -3
- package/src/component/FluxPaneDeck.vue +0 -24
- package/src/css/component/base/Grid.module.scss +0 -8
- package/src/image/avatar-mask.svg +0 -3
- package/tsconfig.json +0 -7
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
isSearchable && $style.isSearchable
|
|
10
10
|
)"
|
|
11
11
|
:id="id"
|
|
12
|
+
role="combobox"
|
|
12
13
|
:aria-disabled="disabled ? true : undefined"
|
|
14
|
+
:aria-expanded="isPopupOpen"
|
|
15
|
+
aria-haspopup="listbox"
|
|
13
16
|
tabindex="0"
|
|
14
17
|
tag-name="div"
|
|
15
18
|
@click="toggle()"
|
|
@@ -133,13 +136,12 @@
|
|
|
133
136
|
<script
|
|
134
137
|
lang="ts"
|
|
135
138
|
setup>
|
|
136
|
-
import { useClickOutside } from '@basmilius/common';
|
|
137
139
|
import { unrefTemplateElement } from '@flux-ui/internals';
|
|
138
140
|
import type { FluxFormSelectOption, FluxFormSelectOptions } from '@flux-ui/types';
|
|
139
141
|
import { clsx } from 'clsx';
|
|
140
142
|
import { type ComponentPublicInstance, computed, nextTick, ref, toRef, unref, useTemplateRef, watch } from 'vue';
|
|
141
143
|
import { useDisabled, useFormFieldInjection } from '$flux/composable';
|
|
142
|
-
import { useTranslate } from '$flux/composable/private';
|
|
144
|
+
import { useDropdownPopup, useTranslate } from '$flux/composable/private';
|
|
143
145
|
import { isFluxFormSelectGroup, isFluxFormSelectOption } from '$flux/data';
|
|
144
146
|
import { FluxFadeTransition } from '$flux/transition';
|
|
145
147
|
import FluxFormInput from '$flux/component/FluxFormInput.vue';
|
|
@@ -193,20 +195,27 @@
|
|
|
193
195
|
const translate = useTranslate();
|
|
194
196
|
|
|
195
197
|
const anchorRef = useTemplateRef<ComponentPublicInstance>('anchor');
|
|
196
|
-
const anchorPopupRef = useTemplateRef('anchorPopup');
|
|
198
|
+
const anchorPopupRef = useTemplateRef<ComponentPublicInstance>('anchorPopup');
|
|
197
199
|
const optionElementRefs = useTemplateRef<typeof FluxMenuItem[]>('optionElements');
|
|
198
200
|
const searchInputElementRef = useTemplateRef<ComponentPublicInstance<typeof FluxFormInput>>('searchInputElement');
|
|
199
201
|
|
|
200
202
|
const highlightedIndex = ref(INITIAL_HIGHLIGHTED_INDEX);
|
|
201
203
|
const isKeyboardAction = ref(false);
|
|
202
|
-
const isPopupOpen = ref(false);
|
|
203
204
|
|
|
204
205
|
const focusElement = computed(() => unrefTemplateElement(searchInputElementRef) ?? unrefTemplateElement(anchorRef));
|
|
205
206
|
const highlightedId = computed(() => unref(rawOptions)[unref(highlightedIndex)]?.value);
|
|
206
207
|
const rawOptions = computed(() => options.map(group => group[1]).flat());
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
const {
|
|
210
|
+
isOpen: isPopupOpen,
|
|
211
|
+
toggle,
|
|
212
|
+
onKeyDownBase
|
|
213
|
+
} = useDropdownPopup({
|
|
214
|
+
anchorRef,
|
|
215
|
+
popupRef: anchorPopupRef,
|
|
216
|
+
focusElement,
|
|
217
|
+
disabled
|
|
218
|
+
});
|
|
210
219
|
|
|
211
220
|
function deselect(id: string | number | null): void {
|
|
212
221
|
emit('deselect', id);
|
|
@@ -217,7 +226,9 @@
|
|
|
217
226
|
function select(id: string | number | null): void {
|
|
218
227
|
emit('select', id);
|
|
219
228
|
|
|
220
|
-
!isMultiple
|
|
229
|
+
if (!isMultiple) {
|
|
230
|
+
isPopupOpen.value = false;
|
|
231
|
+
}
|
|
221
232
|
|
|
222
233
|
highlightedIndex.value = INITIAL_HIGHLIGHTED_INDEX;
|
|
223
234
|
modelSearch.value = '';
|
|
@@ -225,14 +236,6 @@
|
|
|
225
236
|
nextTick(() => unref(focusElement)?.focus());
|
|
226
237
|
}
|
|
227
238
|
|
|
228
|
-
function toggle(): void {
|
|
229
|
-
if (unref(disabled)) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
isPopupOpen.value = !unref(isPopupOpen);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
239
|
function onKeyDown(evt: KeyboardEvent): void {
|
|
237
240
|
emit('keyDown', evt);
|
|
238
241
|
|
|
@@ -246,6 +249,10 @@
|
|
|
246
249
|
|
|
247
250
|
isKeyboardAction.value = true;
|
|
248
251
|
|
|
252
|
+
if (onKeyDownBase(evt)) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
249
256
|
if (unref(highlightedIndex) === INITIAL_HIGHLIGHTED_INDEX && ['ArrowDown', 'ArrowUp'].includes(evt.key)) {
|
|
250
257
|
const options = unref(optionElementRefs);
|
|
251
258
|
const selectedIndex = options?.findIndex(o => 'isActive' in o.$props && o.$props.isActive);
|
|
@@ -277,14 +284,6 @@
|
|
|
277
284
|
id && select(id);
|
|
278
285
|
break;
|
|
279
286
|
|
|
280
|
-
case 'Escape':
|
|
281
|
-
isPopupOpen.value = false;
|
|
282
|
-
break;
|
|
283
|
-
|
|
284
|
-
case 'Tab':
|
|
285
|
-
isPopupOpen.value = false;
|
|
286
|
-
return;
|
|
287
|
-
|
|
288
287
|
default:
|
|
289
288
|
if (evt.key.length === 1) {
|
|
290
289
|
highlightedIndex.value = unref(rawOptions).findIndex(o => o.label.toLowerCase().startsWith(evt.key.toLowerCase()));
|
|
@@ -314,11 +313,6 @@
|
|
|
314
313
|
return;
|
|
315
314
|
}
|
|
316
315
|
|
|
317
|
-
nextTick(() => {
|
|
318
|
-
const searchInput = unref(searchInputElementRef);
|
|
319
|
-
searchInput?.focus();
|
|
320
|
-
});
|
|
321
|
-
|
|
322
316
|
nextTick(() => {
|
|
323
317
|
const options = unref(optionElementRefs);
|
|
324
318
|
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
:style="{
|
|
9
9
|
left: `${position * 100}%`
|
|
10
10
|
}"
|
|
11
|
+
role="slider"
|
|
11
12
|
:aria-disabled="disabled ? true : undefined"
|
|
13
|
+
:aria-label="ariaLabel"
|
|
14
|
+
:aria-valuemax="ariaValuemax"
|
|
15
|
+
:aria-valuemin="ariaValuemin"
|
|
16
|
+
:aria-valuenow="ariaValuenow"
|
|
12
17
|
:tabindex="disabled ? -1 : 0"
|
|
13
18
|
type="button"
|
|
14
19
|
@keydown="onKeyDown"
|
|
@@ -32,6 +37,10 @@
|
|
|
32
37
|
const {
|
|
33
38
|
disabled: componentDisabled
|
|
34
39
|
} = defineProps<{
|
|
40
|
+
readonly ariaLabel?: string;
|
|
41
|
+
readonly ariaValuemax?: number;
|
|
42
|
+
readonly ariaValuemin?: number;
|
|
43
|
+
readonly ariaValuenow?: number;
|
|
35
44
|
readonly disabled?: boolean;
|
|
36
45
|
readonly isDragging?: boolean;
|
|
37
46
|
readonly position: number;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.treeNodeLineArea">
|
|
3
|
+
<span
|
|
4
|
+
v-for="(showLine, guideIndex) in node.lineGuides"
|
|
5
|
+
:key="`g-${guideIndex}`"
|
|
6
|
+
:class="[$style.treeIndent, showLine && $style.hasLine]"/>
|
|
7
|
+
|
|
8
|
+
<span
|
|
9
|
+
v-if="node.depth > 0"
|
|
10
|
+
:class="[$style.treeConnector, node.isLast && $style.isLast]"/>
|
|
11
|
+
|
|
12
|
+
<span
|
|
13
|
+
:class="$style.treeNodeExpand"
|
|
14
|
+
@click="onExpandClick($event)">
|
|
15
|
+
<FluxIcon
|
|
16
|
+
v-if="node.children?.length"
|
|
17
|
+
:name="expanded ? 'angle-down' : 'angle-right'"
|
|
18
|
+
:size="12"/>
|
|
19
|
+
</span>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<span
|
|
23
|
+
v-if="dotColor"
|
|
24
|
+
:class="$style.treeNodeColorDot"
|
|
25
|
+
:style="{ background: dotColor }"/>
|
|
26
|
+
|
|
27
|
+
<FluxIcon
|
|
28
|
+
v-if="node.icon"
|
|
29
|
+
:class="$style.treeNodeIcon"
|
|
30
|
+
:name="node.icon"
|
|
31
|
+
:size="16"/>
|
|
32
|
+
|
|
33
|
+
<span :class="$style.treeNodeLabel">{{ node.label }}</span>
|
|
34
|
+
|
|
35
|
+
<slot
|
|
36
|
+
name="trailing"
|
|
37
|
+
:node="node"/>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script
|
|
41
|
+
lang="ts"
|
|
42
|
+
setup
|
|
43
|
+
generic="TOption extends TreeBaseOption">
|
|
44
|
+
import type { FluxColor } from '@flux-ui/types';
|
|
45
|
+
import { computed } from 'vue';
|
|
46
|
+
import type { TreeBaseOption, TreeFlatNode } from '$flux/composable/private';
|
|
47
|
+
import { getLevelColor } from '$flux/composable/private';
|
|
48
|
+
import FluxIcon from '$flux/component/FluxIcon.vue';
|
|
49
|
+
import $style from '$flux/css/component/primitive/TreeNode.module.scss';
|
|
50
|
+
|
|
51
|
+
const emit = defineEmits<{
|
|
52
|
+
expandClick: [MouseEvent];
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
const {
|
|
56
|
+
levelColors,
|
|
57
|
+
node
|
|
58
|
+
} = defineProps<{
|
|
59
|
+
readonly node: TreeFlatNode<TOption>;
|
|
60
|
+
readonly expanded: boolean;
|
|
61
|
+
readonly levelColors?: (FluxColor | string)[];
|
|
62
|
+
}>();
|
|
63
|
+
|
|
64
|
+
defineSlots<{
|
|
65
|
+
trailing?(props: { node: TreeFlatNode<TOption> }): any;
|
|
66
|
+
}>();
|
|
67
|
+
|
|
68
|
+
defineOptions({
|
|
69
|
+
inheritAttrs: false
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const dotColor = computed(() => getLevelColor(node.depth, levelColors));
|
|
73
|
+
|
|
74
|
+
function onExpandClick(evt: MouseEvent): void {
|
|
75
|
+
emit('expandClick', evt);
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as Anchor } from './Anchor.vue';
|
|
2
2
|
export { default as AnchorPopup } from './AnchorPopup.vue';
|
|
3
|
+
export { default as DialogLayout } from './DialogLayout.vue';
|
|
3
4
|
export { default as FilterBadge } from './FilterBadge.vue';
|
|
4
5
|
export { default as FilterItem } from './FilterItem.vue';
|
|
5
6
|
export { default as FilterOptionBase } from './FilterOptionBase.vue';
|
|
@@ -7,6 +8,7 @@ export { default as SelectBase } from './SelectBase.vue';
|
|
|
7
8
|
export { default as SliderBase } from './SliderBase.vue';
|
|
8
9
|
export { default as SliderThumb } from './SliderThumb.vue';
|
|
9
10
|
export { default as SliderTrack } from './SliderTrack.vue';
|
|
11
|
+
export { default as TreeNodeRenderer } from './TreeNodeRenderer.vue';
|
|
10
12
|
|
|
11
13
|
export { FilterMenuRenderer } from './FilterMenuRenderer';
|
|
12
14
|
export { VNodeRenderer } from './VNodeRenderer';
|
package/src/composable/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as useBreakpoints } from './useBreakpoints';
|
|
2
2
|
export { default as useDisabled } from './useDisabled';
|
|
3
3
|
|
|
4
|
+
export { default as useAdaptiveGroupInjection } from './useAdaptiveGroupInjection';
|
|
4
5
|
export { default as useDisabledInjection } from './useDisabledInjection';
|
|
5
6
|
export { default as useExpandableGroupInjection } from './useExpandableGroupInjection';
|
|
6
7
|
export { default as useFilterInjection } from './useFilterInjection';
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
export { default as useAsyncFilterOptions } from './useAsyncFilterOptions';
|
|
2
|
+
export { default as useDateFlyout } from './useDateFlyout';
|
|
3
|
+
export { default as useDropdownPopup } from './useDropdownPopup';
|
|
4
|
+
export type { UseDropdownPopupOptions, UseDropdownPopupReturn } from './useDropdownPopup';
|
|
1
5
|
export { default as useFormSelect } from './useFormSelect';
|
|
2
6
|
export { default as useTranslate } from './useTranslate';
|
|
7
|
+
export { useCommandPalette } from './useCommandPalette';
|
|
8
|
+
export type { CommandPaletteGroup, CommandPaletteResultItem } from './useCommandPalette';
|
|
9
|
+
export { useFilterOptionMulti, useFilterOptionSingle } from './useFilterOption';
|
|
10
|
+
export type { FilterOptionMulti, FilterOptionSingle } from './useFilterOption';
|
|
3
11
|
export { flattenAll, flattenVisible, getLevelColor, INITIAL_HIGHLIGHTED_INDEX, useTreeView } from './useTreeView';
|
|
4
12
|
export type { TreeBaseOption, TreeFlatNode } from './useTreeView';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useDebouncedRef, useLoaded } from '@basmilius/common';
|
|
2
|
+
import type { FluxFilterOptionRow, FluxFilterValue } from '@flux-ui/types';
|
|
3
|
+
import { type ComputedRef, type ModelRef, computed, type Ref, ref, unref, watch } from 'vue';
|
|
4
|
+
import { isFluxFilterOptionItem } from '$flux/data';
|
|
5
|
+
|
|
6
|
+
type UseAsyncFilterOptionsParams = {
|
|
7
|
+
readonly currentValueIds: ComputedRef<FluxFilterValue[]>;
|
|
8
|
+
readonly modelSearch: ModelRef<string, string, string, string>;
|
|
9
|
+
fetchOptions(ids: FluxFilterValue[]): Promise<FluxFilterOptionRow[]>;
|
|
10
|
+
fetchRelevant(): Promise<FluxFilterOptionRow[]>;
|
|
11
|
+
fetchSearch(searchQuery: string): Promise<FluxFilterOptionRow[]>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default function ({
|
|
15
|
+
currentValueIds,
|
|
16
|
+
modelSearch,
|
|
17
|
+
fetchOptions: fetchOptionsProp,
|
|
18
|
+
fetchRelevant: fetchRelevantProp,
|
|
19
|
+
fetchSearch: fetchSearchProp
|
|
20
|
+
}: UseAsyncFilterOptionsParams) {
|
|
21
|
+
const {isLoading, loaded} = useLoaded();
|
|
22
|
+
const debouncedModelSearch = useDebouncedRef(modelSearch, 150) as unknown as Ref<string>;
|
|
23
|
+
const fetchOptions = computed(() => loaded(fetchOptionsProp));
|
|
24
|
+
const fetchRelevant = computed(() => loaded(fetchRelevantProp));
|
|
25
|
+
const fetchSearch = computed(() => loaded(fetchSearchProp));
|
|
26
|
+
|
|
27
|
+
const selectedOptions = ref<FluxFilterOptionRow[]>([]);
|
|
28
|
+
const visibleOptions = ref<FluxFilterOptionRow[]>([]);
|
|
29
|
+
|
|
30
|
+
const options = computed(() => {
|
|
31
|
+
const options: FluxFilterOptionRow[] = [];
|
|
32
|
+
const search = unref(modelSearch);
|
|
33
|
+
const selected = unref(selectedOptions);
|
|
34
|
+
const visible = unref(visibleOptions);
|
|
35
|
+
|
|
36
|
+
visible.forEach(vo => options.push(vo));
|
|
37
|
+
|
|
38
|
+
selected.forEach(so => {
|
|
39
|
+
if (isFluxFilterOptionItem(so) && visible.find(vo => isFluxFilterOptionItem(vo) && vo.value === so.value)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (isFluxFilterOptionItem(so) && !so.label.toLowerCase().includes(search.toLowerCase())) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
options.push(so);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return options;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
watch(currentValueIds, async ids => {
|
|
54
|
+
if (ids.length === 0) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
selectedOptions.value = await unref(fetchOptions)(ids);
|
|
59
|
+
}, {immediate: true});
|
|
60
|
+
|
|
61
|
+
watch(debouncedModelSearch, async searchQuery => {
|
|
62
|
+
if (searchQuery.length > 0) {
|
|
63
|
+
visibleOptions.value = await unref(fetchSearch)(searchQuery);
|
|
64
|
+
} else {
|
|
65
|
+
visibleOptions.value = await unref(fetchRelevant)();
|
|
66
|
+
}
|
|
67
|
+
}, {immediate: true});
|
|
68
|
+
|
|
69
|
+
return {isLoading, options};
|
|
70
|
+
}
|