@flux-ui/components 3.0.0-next.35 → 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/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/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/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 +7 -2
- 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/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 +372 -331
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7116 -6286
- 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/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/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 +2 -1
- 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 +5 -1
- 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 +7 -2
- 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 +1 -1
- 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 +4 -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/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
package/src/data/filter.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { formatNumber } from '@basmilius/utils';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FluxFilterDateEntry, FluxFilterDateRangeEntry, FluxFilterDateRangeSpec, FluxFilterDateSpec, FluxFilterEntryMap, FluxFilterOptionAsyncSpec, FluxFilterOptionEntry, FluxFilterOptionHeader, FluxFilterOptionItem, FluxFilterOptionSpec, FluxFilterOptionsAsyncSpec, FluxFilterOptionsEntry, FluxFilterOptionsSpec, FluxFilterRangeEntry, FluxFilterRangeSpec, FluxFilterSpecMap, FluxFilterValueSingle } from '@flux-ui/types';
|
|
3
3
|
import { DateTime } from 'luxon';
|
|
4
4
|
import { useTranslate } from '$flux/composable/private';
|
|
5
5
|
import type { FluxTranslate } from '$flux/data';
|
|
6
6
|
import { createLabelForDateRange } from '$flux/util';
|
|
7
7
|
|
|
8
|
-
function parseDate(base:
|
|
8
|
+
function parseDate(base: FluxFilterDateSpec): FluxFilterDateEntry {
|
|
9
9
|
return {
|
|
10
10
|
...base,
|
|
11
11
|
type: 'date',
|
|
@@ -24,7 +24,7 @@ function parseDate(base: FluxFilterBase): FluxFilterDateEntry {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function parseDateRange(base:
|
|
27
|
+
function parseDateRange(base: FluxFilterDateRangeSpec): FluxFilterDateRangeEntry {
|
|
28
28
|
return {
|
|
29
29
|
...base,
|
|
30
30
|
type: 'dateRange',
|
|
@@ -45,36 +45,34 @@ function parseDateRange(base: FluxFilterBase): FluxFilterDateRangeEntry {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
function parseOption(base:
|
|
49
|
-
const
|
|
48
|
+
function parseOption({options, ...base}: FluxFilterOptionSpec): FluxFilterOptionEntry {
|
|
49
|
+
const items = options.filter(isFluxFilterOptionItem);
|
|
50
50
|
|
|
51
51
|
return {
|
|
52
52
|
...base,
|
|
53
53
|
type: 'option',
|
|
54
54
|
|
|
55
55
|
async getValueLabel(value): Promise<string | null> {
|
|
56
|
-
return
|
|
56
|
+
return items.find(o => o.value === value)?.label ?? null;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function parseOptionAsync(base:
|
|
62
|
-
const fetchOptions = (base as any).fetchOptions as (ids: FluxFilterValue[]) => Promise<FluxFilterOptionRow[]>;
|
|
63
|
-
|
|
61
|
+
function parseOptionAsync({fetchOptions, ...base}: FluxFilterOptionAsyncSpec): FluxFilterOptionEntry {
|
|
64
62
|
return {
|
|
65
63
|
...base,
|
|
66
64
|
type: 'option',
|
|
67
65
|
|
|
68
66
|
async getValueLabel(value): Promise<string | null> {
|
|
69
|
-
const
|
|
67
|
+
const items = (await fetchOptions([value])).filter(isFluxFilterOptionItem);
|
|
70
68
|
|
|
71
|
-
return
|
|
69
|
+
return items.find(o => o.value === value)?.label ?? null;
|
|
72
70
|
}
|
|
73
71
|
};
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
function parseOptions(base:
|
|
77
|
-
const
|
|
74
|
+
function parseOptions({options, ...base}: FluxFilterOptionsSpec): FluxFilterOptionsEntry {
|
|
75
|
+
const items = options.filter(isFluxFilterOptionItem);
|
|
78
76
|
const translate = useTranslate();
|
|
79
77
|
|
|
80
78
|
return {
|
|
@@ -86,13 +84,12 @@ function parseOptions(base: FluxFilterBase): FluxFilterOptionsEntry {
|
|
|
86
84
|
return null;
|
|
87
85
|
}
|
|
88
86
|
|
|
89
|
-
return generateMultiOptionsLabel(translate,
|
|
87
|
+
return generateMultiOptionsLabel(translate, items, value);
|
|
90
88
|
}
|
|
91
89
|
};
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
function parseOptionsAsync(base:
|
|
95
|
-
const fetchOptions = (base as any).fetchOptions as (ids: FluxFilterValue[]) => Promise<FluxFilterOptionRow[]>;
|
|
92
|
+
function parseOptionsAsync({fetchOptions, ...base}: FluxFilterOptionsAsyncSpec): FluxFilterOptionsEntry {
|
|
96
93
|
const translate = useTranslate();
|
|
97
94
|
|
|
98
95
|
return {
|
|
@@ -104,14 +101,14 @@ function parseOptionsAsync(base: FluxFilterBase): FluxFilterOptionsEntry {
|
|
|
104
101
|
return null;
|
|
105
102
|
}
|
|
106
103
|
|
|
107
|
-
const
|
|
104
|
+
const items = (await fetchOptions(value)).filter(isFluxFilterOptionItem);
|
|
108
105
|
|
|
109
|
-
return generateMultiOptionsLabel(translate,
|
|
106
|
+
return generateMultiOptionsLabel(translate, items, value);
|
|
110
107
|
}
|
|
111
108
|
};
|
|
112
109
|
}
|
|
113
110
|
|
|
114
|
-
function parseRange(base:
|
|
111
|
+
function parseRange(base: FluxFilterRangeSpec): FluxFilterRangeEntry {
|
|
115
112
|
return {
|
|
116
113
|
...base,
|
|
117
114
|
type: 'range',
|
|
@@ -122,14 +119,9 @@ function parseRange(base: FluxFilterBase): FluxFilterRangeEntry {
|
|
|
122
119
|
}
|
|
123
120
|
|
|
124
121
|
const [lower, upper] = value as number[];
|
|
122
|
+
const formatter = base.formatter ?? formatNumber;
|
|
125
123
|
|
|
126
|
-
|
|
127
|
-
const formatter = base.formatter as (value: number) => string;
|
|
128
|
-
|
|
129
|
-
return `${formatter(lower!)} – ${formatter(upper!)}`;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return `${formatNumber(lower!)} – ${formatNumber(upper!)}`;
|
|
124
|
+
return `${formatter(lower!)} – ${formatter(upper!)}`;
|
|
133
125
|
}
|
|
134
126
|
};
|
|
135
127
|
}
|
|
@@ -150,7 +142,11 @@ function generateMultiOptionsLabel(translate: FluxTranslate, options: FluxFilter
|
|
|
150
142
|
});
|
|
151
143
|
}
|
|
152
144
|
|
|
153
|
-
export
|
|
145
|
+
export type FluxFilterParsers = {
|
|
146
|
+
[K in keyof FluxFilterSpecMap]: (spec: FluxFilterSpecMap[K]) => FluxFilterEntryMap[K];
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const filterParsers: FluxFilterParsers = {
|
|
154
150
|
date: parseDate,
|
|
155
151
|
dateRange: parseDateRange,
|
|
156
152
|
option: parseOption,
|
|
@@ -158,7 +154,7 @@ export const filterParsers = {
|
|
|
158
154
|
options: parseOptions,
|
|
159
155
|
optionsAsync: parseOptionsAsync,
|
|
160
156
|
range: parseRange
|
|
161
|
-
}
|
|
157
|
+
};
|
|
162
158
|
|
|
163
159
|
export function isFluxFilterOptionHeader(obj: object): obj is FluxFilterOptionHeader {
|
|
164
160
|
return 'title' in obj;
|
package/src/data/i18n.ts
CHANGED
|
@@ -4,9 +4,11 @@ export type FluxTranslation = keyof typeof english;
|
|
|
4
4
|
export const english = {
|
|
5
5
|
'flux.back': 'Back',
|
|
6
6
|
'flux.cancel': 'Cancel',
|
|
7
|
+
'flux.close': 'Close',
|
|
7
8
|
'flux.comingSoon': 'Coming soon',
|
|
8
9
|
'flux.continue': 'Continue',
|
|
9
10
|
'flux.customPeriod': 'Custom period',
|
|
11
|
+
'flux.delete': 'Delete',
|
|
10
12
|
'flux.filter': 'Filter',
|
|
11
13
|
'flux.filterReset': 'Reset filters',
|
|
12
14
|
'flux.justNow': 'Just now',
|
|
@@ -32,6 +34,21 @@ export const english = {
|
|
|
32
34
|
'flux.sortDescending': 'Descending',
|
|
33
35
|
'flux.sortRemove': 'Remove sorting',
|
|
34
36
|
'flux.today': 'Today',
|
|
37
|
+
'flux.selectMonth': 'Select month',
|
|
38
|
+
'flux.selectYear': 'Select year',
|
|
39
|
+
'flux.previousMonth': 'Previous month',
|
|
40
|
+
'flux.nextMonth': 'Next month',
|
|
41
|
+
'flux.previousYears': 'Previous years',
|
|
42
|
+
'flux.nextYears': 'Next years',
|
|
43
|
+
'flux.goToPage': 'Go to page {page}',
|
|
44
|
+
'flux.pinDigit': 'Digit {index} of {total}',
|
|
45
|
+
'flux.dropFilesOrClick': 'Drop files here or click to upload',
|
|
46
|
+
'flux.colorSaturationBrightness': 'Color saturation and brightness',
|
|
47
|
+
'flux.customColor': 'Custom color',
|
|
48
|
+
'flux.hue': 'Hue',
|
|
49
|
+
'flux.opacity': 'Opacity',
|
|
50
|
+
'flux.lowerBound': 'Lower bound',
|
|
51
|
+
'flux.upperBound': 'Upper bound',
|
|
35
52
|
'flux.galleryPlaceholderButton': 'Pick image',
|
|
36
53
|
'flux.galleryPlaceholderMessage': 'Drop an image here or click the button to upload...',
|
|
37
54
|
'flux.galleryPlaceholderTitle': 'Gallery',
|
package/src/data/store.ts
CHANGED
|
@@ -46,11 +46,10 @@ const state = reactive<FluxState>({
|
|
|
46
46
|
tooltips: []
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
let
|
|
50
|
-
let tooltipId: number = 0;
|
|
49
|
+
let nextId: number = 0;
|
|
51
50
|
|
|
52
51
|
export function addAlert(spec: Omit<FluxAlertObject, 'id'>): number {
|
|
53
|
-
const id = ++
|
|
52
|
+
const id = ++nextId;
|
|
54
53
|
|
|
55
54
|
state.alerts.push({
|
|
56
55
|
id,
|
|
@@ -61,7 +60,7 @@ export function addAlert(spec: Omit<FluxAlertObject, 'id'>): number {
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
export function addConfirm(spec: Omit<FluxConfirmObject, 'id'>): number {
|
|
64
|
-
const id = ++
|
|
63
|
+
const id = ++nextId;
|
|
65
64
|
|
|
66
65
|
state.confirms.push({
|
|
67
66
|
id,
|
|
@@ -72,7 +71,7 @@ export function addConfirm(spec: Omit<FluxConfirmObject, 'id'>): number {
|
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
export function addPrompt(spec: Omit<FluxPromptObject, 'id'>): number {
|
|
75
|
-
const id = ++
|
|
74
|
+
const id = ++nextId;
|
|
76
75
|
|
|
77
76
|
state.prompts.push({
|
|
78
77
|
id,
|
|
@@ -83,7 +82,7 @@ export function addPrompt(spec: Omit<FluxPromptObject, 'id'>): number {
|
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
export function addSnackbar(spec: Omit<FluxSnackbarObject, 'id'>): number {
|
|
86
|
-
const id = ++
|
|
85
|
+
const id = ++nextId;
|
|
87
86
|
|
|
88
87
|
state.snackbars.unshift({
|
|
89
88
|
id,
|
|
@@ -94,7 +93,7 @@ export function addSnackbar(spec: Omit<FluxSnackbarObject, 'id'>): number {
|
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
export function addTooltip(spec: Omit<FluxTooltipObject, 'id'>): number {
|
|
97
|
-
const id = ++
|
|
96
|
+
const id = ++nextId;
|
|
98
97
|
|
|
99
98
|
state.tooltips.push({
|
|
100
99
|
id,
|
|
@@ -113,36 +112,71 @@ export function registerDialog(): [number, VoidFunction] {
|
|
|
113
112
|
|
|
114
113
|
export function removeAlert(id: number): void {
|
|
115
114
|
const index = state.alerts.findIndex(a => a.id === id);
|
|
115
|
+
|
|
116
|
+
if (index < 0) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
116
120
|
state.alerts.splice(index, 1);
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
export function removeConfirm(id: number): void {
|
|
120
124
|
const index = state.confirms.findIndex(c => c.id === id);
|
|
125
|
+
|
|
126
|
+
if (index < 0) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
121
130
|
state.confirms.splice(index, 1);
|
|
122
131
|
}
|
|
123
132
|
|
|
124
133
|
export function removePrompt(id: number): void {
|
|
125
134
|
const index = state.prompts.findIndex(c => c.id === id);
|
|
135
|
+
|
|
136
|
+
if (index < 0) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
126
140
|
state.prompts.splice(index, 1);
|
|
127
141
|
}
|
|
128
142
|
|
|
129
143
|
export function removeSnackbar(id: number): void {
|
|
130
144
|
const index = state.snackbars.findIndex(s => s.id === id);
|
|
145
|
+
|
|
146
|
+
if (index < 0) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
131
150
|
state.snackbars.splice(index, 1);
|
|
132
151
|
}
|
|
133
152
|
|
|
134
153
|
export function removeTooltip(id: number): void {
|
|
135
154
|
const index = state.tooltips.findIndex(t => t.id === id);
|
|
155
|
+
|
|
156
|
+
if (index < 0) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
136
160
|
state.tooltips.splice(index, 1);
|
|
137
161
|
}
|
|
138
162
|
|
|
139
163
|
export function updateSnackbar(id: number, spec: Partial<Omit<FluxSnackbarObject, 'id'>>): void {
|
|
140
164
|
const index = state.snackbars.findIndex(s => s.id === id);
|
|
165
|
+
|
|
166
|
+
if (index < 0) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
141
170
|
Object.assign(state.snackbars[index], spec);
|
|
142
171
|
}
|
|
143
172
|
|
|
144
173
|
export function updateTooltip(id: number, spec: Partial<Omit<FluxTooltipObject, 'id'>>): void {
|
|
145
174
|
const index = state.tooltips.findIndex(s => s.id === id);
|
|
175
|
+
|
|
176
|
+
if (index < 0) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
146
180
|
Object.assign(state.tooltips[index], spec);
|
|
147
181
|
}
|
|
148
182
|
|
|
@@ -227,9 +261,10 @@ export function useFluxStore(): FluxStore {
|
|
|
227
261
|
};
|
|
228
262
|
}
|
|
229
263
|
|
|
230
|
-
type Fn = (...args:
|
|
231
|
-
type FnSync<T extends Fn> = (...args: Parameters<T>) => void;
|
|
264
|
+
type Fn = (...args: never[]) => unknown;
|
|
232
265
|
|
|
233
|
-
function promiseToVoidFunction<T extends Fn>(fn: T):
|
|
234
|
-
return (...args
|
|
266
|
+
function promiseToVoidFunction<T extends Fn>(fn: T): (...args: Parameters<T>) => void {
|
|
267
|
+
return (...args) => {
|
|
268
|
+
fn(...args);
|
|
269
|
+
};
|
|
235
270
|
}
|