@mittwald/flow-remote-vue-components 1.6.0-next.9 → 1.6.1
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 +2 -2
- package/USAGE.md +6 -0
- package/dist/js/RemoteRoot.mjs +17 -5
- package/dist/js/RemoteRoot.mjs.map +1 -1
- package/dist/js/components-base/src/action/ActionState.mjs +1 -2
- package/dist/js/components-base/src/index.mjs +5 -2
- package/dist/js/components-base/src/lib/array.mjs +1 -2
- package/dist/js/components-base/src/list/ListModelContext.mjs +1 -2
- package/dist/js/components-base/src/list/filter/ListDateRangeFilter.mjs +2 -2
- package/dist/js/components-base/src/list/filter/ListDateRangeFilter.mjs.map +1 -1
- package/dist/js/components-base/src/list/filter/ListFilter.mjs +5 -3
- package/dist/js/components-base/src/list/filter/ListFilter.mjs.map +1 -1
- package/dist/js/components-base/src/list/filter/ListFilterValue.mjs +1 -2
- package/dist/js/components-base/src/list/filter/dateRange.mjs +38 -15
- package/dist/js/components-base/src/list/filter/dateRange.mjs.map +1 -1
- package/dist/js/components-base/src/list/filter/dateTimeRangeFields.mjs +52 -0
- package/dist/js/components-base/src/list/filter/dateTimeRangeFields.mjs.map +1 -0
- package/dist/js/components-base/src/list/filter/formatDateRange.mjs +24 -0
- package/dist/js/components-base/src/list/filter/formatDateRange.mjs.map +1 -0
- package/dist/js/components-base/src/list/item/ListItem.mjs +1 -2
- package/dist/js/components-base/src/list/item/ListItemCollection.mjs +1 -2
- package/dist/js/components-base/src/list/loading/ListLoaderState.mjs +11 -7
- package/dist/js/components-base/src/list/loading/ListLoaderState.mjs.map +1 -1
- package/dist/js/components-base/src/list/loading/types.mjs +1 -2
- package/dist/js/components-base/src/list/pagination/ListBatchesController.mjs +1 -2
- package/dist/js/components-base/src/list/search/ListSearch.mjs +1 -2
- package/dist/js/components-base/src/list/sorting/ListSorting.mjs +1 -2
- package/dist/js/components-base/src/list/table/ListTable.mjs +1 -2
- package/dist/js/components-base/src/list/viewMode/ListViewMode.mjs +1 -2
- package/dist/js/components-base/src/overlay/OverlayState.mjs +193 -0
- package/dist/js/components-base/src/overlay/OverlayState.mjs.map +1 -0
- package/dist/js/index.mjs +3 -1
- package/dist/js/remote-vue-components/src/auto-generated/AccentBox.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Accordion.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/AccordionGroup.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ActionGroup.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Alert.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/AlertBadge.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/AlertIcon.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/AlertText.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Align.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Area.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Autocomplete.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Avatar.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/AvatarStack.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Badge.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Bar.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/BigNumber.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Breadcrumb.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Breadcrumb.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Button.mjs +2 -2
- package/dist/js/remote-vue-components/src/auto-generated/Button.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/CartesianChart.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/CartesianGrid.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ChartGrid.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ChartLegend.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ChartTooltip.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Chat.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Checkbox.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Checkbox.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/CheckboxButton.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/CheckboxButton.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/CheckboxGroup.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/CheckboxGroup.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/ClearPropsContext.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/CoachMark.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/CoachMark.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/CodeBlock.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/CodeEditor.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Color.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ColumnLayout.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Combine.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ComboBox.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/ComboBox.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/ComponentPropsContextProvider.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Content.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ContextMenu.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/ContextMenu.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/ContextMenuContent.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/ContextMenuContent.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/ContextMenuSection.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ContextMenuTrigger.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ContextualHelp.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/ContextualHelp.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/ContextualHelpTrigger.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/CopyButton.mjs +2 -2
- package/dist/js/remote-vue-components/src/auto-generated/CopyButton.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/CounterBadge.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/DatePicker.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/DatePicker.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/DateRangePicker.mjs +2 -2
- package/dist/js/remote-vue-components/src/auto-generated/DateRangePicker.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/DialogTrigger.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Div.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/DonutChart.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/DonutChart.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/FieldDescription.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/FieldError.mjs +4 -3
- package/dist/js/remote-vue-components/src/auto-generated/FieldError.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/FileCard.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/FileCardList.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/FileDropZone.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/FileField.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Flex.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Header.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/HeaderNavigation.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Heading.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Icon.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/IllustratedMessage.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Image.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ImageCropper.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Initials.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/InlineCode.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ItemsGridList.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/ItemsGridList.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/ItemsGridListItem.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/ItemsGridListItem.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Kbd.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Label.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/LabeledValue.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/LayoutCard.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Legend.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/LightBoxGallery.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/LightBoxGalleryItem.mjs +2 -3
- package/dist/js/remote-vue-components/src/auto-generated/LightBoxGalleryItem.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/LightBoxZoom.mjs +7 -0
- package/dist/js/remote-vue-components/src/auto-generated/LightBoxZoom.mjs.map +1 -0
- package/dist/js/remote-vue-components/src/auto-generated/Line.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Link.mjs +2 -2
- package/dist/js/remote-vue-components/src/auto-generated/Link.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/ListEmptyView.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ListEmptyViewContainer.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ListItemViewContent.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ListSummary.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/LoadingSpinner.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Markdown.mjs +6 -3
- package/dist/js/remote-vue-components/src/auto-generated/Markdown.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/MarkdownEditor.mjs +4 -3
- package/dist/js/remote-vue-components/src/auto-generated/MarkdownEditor.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/MenuItem.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/MenuItem.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/MenuTrigger.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Message.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/MessageSeparator.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/MessageThread.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Navigation.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/NavigationGroup.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Notification.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/NumberField.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/NumberField.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Option.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Option.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/OverlayContent.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/PasswordCreationField.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/PasswordCreationField.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/PopoverContent.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/ProgressBar.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/ProgressBar.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Radio.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Radio.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/RadioButton.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/RadioButton.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/RadioGroup.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/RadioGroup.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/RangeCalendar.mjs +2 -2
- package/dist/js/remote-vue-components/src/auto-generated/RangeCalendar.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Rating.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Rating.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/RatingSegment.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/RatingSegment.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/SearchField.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/SearchField.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Section.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Segment.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Segment.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/SegmentedControl.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/SegmentedControl.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Select.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Select.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Separator.mjs +6 -3
- package/dist/js/remote-vue-components/src/auto-generated/Separator.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Skeleton.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/SkeletonMode.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/SkeletonText.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Slider.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Slider.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Switch.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Switch.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Tab.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Tab.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TabNavigation.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/TabTitle.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TabTitle.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Table.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Table.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TableBody.mjs +6 -3
- package/dist/js/remote-vue-components/src/auto-generated/TableBody.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TableCell.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TableCell.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TableColumn.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TableColumn.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TableFooterRow.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TableFooterRow.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TableHeader.mjs +6 -3
- package/dist/js/remote-vue-components/src/auto-generated/TableHeader.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TableRow.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TableRow.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Tabs.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Tabs.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Text.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/TextArea.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TextArea.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TextField.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TextField.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TimeField.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/TimeField.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/Tooltip.mjs +3 -3
- package/dist/js/remote-vue-components/src/auto-generated/Tooltip.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/auto-generated/TooltipTrigger.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/TranslationProvider.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/Truncate.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/TunnelEntry.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/XAxis.mjs +1 -2
- package/dist/js/remote-vue-components/src/auto-generated/YAxis.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/Action.mjs +2 -3
- package/dist/js/remote-vue-components/src/components/ActionBatch.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/BrowserOnly.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/CountryOptions.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/DeprecationWarningProvider.mjs +16 -11
- package/dist/js/remote-vue-components/src/components/DeprecationWarningProvider.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/components/Form.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/LoadingIndicator.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/NotificationProvider.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/SettingsProvider.mjs +1 -2
- package/dist/js/remote-vue-components/src/components/Wrap.mjs +1 -2
- package/dist/js/remote-vue-components/src/composables/remoteContext.mjs +1 -2
- package/dist/js/remote-vue-components/src/composables/useComponentUsage.mjs +1 -2
- package/dist/js/remote-vue-components/src/composables/useIsMounted.mjs +1 -2
- package/dist/js/remote-vue-components/src/composables/useOnChange.mjs +1 -2
- package/dist/js/remote-vue-components/src/composables/useWatchPathname.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/IconSetProvider.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconAI.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconAIHosting.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconAnalytics.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconApp.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconAscending.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconAttachment.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconAutoresponder.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconBackLink.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconBackup.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconBold.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCamera.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCertificate.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconChangelog.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCheck.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCheckboxChecked.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCheckboxEmpty.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCheckboxIndeterminate.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconChevronDown.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconChevronLeft.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconChevronRight.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconChevronUp.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconClose.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCode.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconContainer.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconContextMenu.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconContextMenuVertical.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconContract.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconContractPartner.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconContributor.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCopy.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCronjob.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconCustomer.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDanger.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDashboard.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDatabase.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDate.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDelete.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDeliveryBox.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDescending.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDesktop.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDirectory.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDnsSubZone.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDnsZone.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDomain.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconDownload.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconEdit.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconEmail.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconEmailArchive.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconExtension.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconExternalLink.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconFailed.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconFeedback.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconFile.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconFilter.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconForwardAddress.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconForwardLink.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconHide.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconHome.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconImage.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconInfo.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconInvite.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconInvoice.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconItalic.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconKnowledgeHint.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconLanguage.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconLeadFyndr.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconLink.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconLock.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconLockOpen.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconLogout.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMainUser.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMarketplace.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMaximize.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMember.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMenu.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMinimize.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMinus.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMittwald.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMobile.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMonitoring.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconMove.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconNewsletter.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconNotification.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconNumber.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconOrder.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconOrderedList.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconPassword.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconPath.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconPause.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconPayment.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconPending.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconPicture.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconPlus.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconProject.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconQuote.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconRadioOff.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconRadioOn.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconRedo.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconRefresh.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconRegistry.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSave.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSearch.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSecurity.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSend.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconServer.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSettings.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconShare.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconShow.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSorting.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSsh.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSshKey.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSshSftp.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconStack.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconStar.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconStarFilled.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconStart.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconStrikeThrough.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSubdomain.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSucceeded.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSuccess.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconSupport.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconTerminate.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconTicket.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconTime.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconUnavailable.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconUndo.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconUnorderedList.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconUpload.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconUser.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconVhost.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconView.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconVolume.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/components/IconWarning.mjs +1 -2
- package/dist/js/remote-vue-components/src/icons/lib/createIcon.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/composition.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/controlledRemoteValue.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/createFlowRemoteComponent.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/handlers.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/isRenderError.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/mobxSelector.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/propKeys.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/stringifyError.mjs +1 -2
- package/dist/js/remote-vue-components/src/lib/vModel.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/ActiveFilters.mjs +6 -4
- package/dist/js/remote-vue-components/src/list/ActiveFilters.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/list/AllFiltersModal.mjs +4 -4
- package/dist/js/remote-vue-components/src/list/AllFiltersModal.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/list/ComposableLoader.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/DateTimeRangeFields.mjs +99 -0
- package/dist/js/remote-vue-components/src/list/DateTimeRangeFields.mjs.map +1 -0
- package/dist/js/remote-vue-components/src/list/Footer.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/Header.mjs +13 -9
- package/dist/js/remote-vue-components/src/list/Header.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/list/Item.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/Items.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/List.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/ListItemView.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/Table.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/dateRangeFilter.mjs +15 -8
- package/dist/js/remote-vue-components/src/list/dateRangeFilter.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/list/itemContext.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/listContext.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/locales.mjs +15 -2
- package/dist/js/remote-vue-components/src/list/locales.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/list/metadata.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/model.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/settings.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/setupComponents.mjs +1 -2
- package/dist/js/remote-vue-components/src/list/styles.mjs +8 -3
- package/dist/js/remote-vue-components/src/list/styles.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/overlays/LightBox.mjs +22 -8
- package/dist/js/remote-vue-components/src/overlays/LightBox.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/overlays/Modal.mjs +15 -20
- package/dist/js/remote-vue-components/src/overlays/Modal.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/overlays/Popover.mjs +1 -2
- package/dist/js/remote-vue-components/src/overlays/childProps.mjs +1 -2
- package/dist/js/remote-vue-components/src/overlays/createOverlayTrigger.mjs +1 -2
- package/dist/js/remote-vue-components/src/overlays/locales.mjs +1 -2
- package/dist/js/remote-vue-components/src/overlays/overlayController.mjs +58 -65
- package/dist/js/remote-vue-components/src/overlays/overlayController.mjs.map +1 -1
- package/dist/js/remote-vue-components/src/overlays/triggers.mjs +1 -2
- package/dist/js/remote-vue-components/src/version.mjs +3 -4
- package/dist/js/remote-vue-components/src/version.mjs.map +1 -1
- package/dist/types/_bundled/flow-components-base/index.d.ts +4 -1
- package/dist/types/_bundled/flow-components-base/list/filter/ListFilter.d.ts +2 -0
- package/dist/types/_bundled/flow-components-base/list/filter/dateRange.d.ts +24 -1
- package/dist/types/_bundled/flow-components-base/list/filter/dateTimeRangeFields.d.ts +34 -0
- package/dist/types/_bundled/flow-components-base/list/filter/formatDateRange.d.ts +7 -0
- package/dist/types/_bundled/flow-components-base/list/loading/ListLoaderState.d.ts +5 -0
- package/dist/types/_bundled/flow-components-base/overlay/OverlayState.d.ts +94 -0
- package/dist/types/auto-generated/LightBoxZoom.d.ts +4 -0
- package/dist/types/auto-generated/index.d.ts +1 -0
- package/dist/types/components/DeprecationWarningProvider.d.ts +2 -4
- package/dist/types/components/RemoteRoot.d.ts +19 -0
- package/dist/types/list/DateTimeRangeFields.d.ts +43 -0
- package/dist/types/list/dateRangeFilter.d.ts +6 -6
- package/dist/types/list/index.d.ts +1 -0
- package/dist/types/list/locales.d.ts +14 -0
- package/dist/types/list/styles.d.ts +6 -0
- package/dist/types/list/types.d.ts +8 -2
- package/dist/types/overlays/LightBox.d.ts +17 -0
- package/dist/types/overlays/Modal.d.ts +2 -2
- package/dist/types/overlays/overlayController.d.ts +28 -18
- package/dist/types/version.d.ts +2 -2
- package/package.json +14 -14
|
@@ -23,8 +23,9 @@ import { listStyles } from "./styles.mjs";
|
|
|
23
23
|
import { ModalTrigger } from "../overlays/triggers.mjs";
|
|
24
24
|
import { isDateRangeFilter } from "./dateRangeFilter.mjs";
|
|
25
25
|
import { Modal } from "../overlays/Modal.mjs";
|
|
26
|
+
import { DateTimeRangeFields } from "./DateTimeRangeFields.mjs";
|
|
26
27
|
import { defineComponent, h } from "vue";
|
|
27
|
-
|
|
28
|
+
// src/list/AllFiltersModal.ts
|
|
28
29
|
var accordion = (key, heading, expanded, content) => h(Accordion, {
|
|
29
30
|
key,
|
|
30
31
|
defaultExpanded: expanded
|
|
@@ -35,8 +36,8 @@ var renderDateRangeAccordion = (filter, expanded, texts) => {
|
|
|
35
36
|
return accordion(`filter-${name}`, name, expanded, () => h(Flex, {
|
|
36
37
|
direction: "column",
|
|
37
38
|
gap: "m"
|
|
38
|
-
}, () => [h(RangeCalendar, {
|
|
39
|
-
...filter.
|
|
39
|
+
}, () => [filter.granularity === "minute" ? h(DateTimeRangeFields, { filter }) : h(RangeCalendar, {
|
|
40
|
+
...filter.rangeCalendarProps,
|
|
40
41
|
value,
|
|
41
42
|
onChange: (range) => filter.setValue(range)
|
|
42
43
|
}), value ? h(Button, {
|
|
@@ -189,7 +190,6 @@ var AllFiltersModal = defineComponent({
|
|
|
189
190
|
}
|
|
190
191
|
});
|
|
191
192
|
composition(AllFiltersModal);
|
|
192
|
-
//#endregion
|
|
193
193
|
export { AllFiltersModal, AllFiltersModal as default };
|
|
194
194
|
|
|
195
195
|
//# sourceMappingURL=AllFiltersModal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllFiltersModal.mjs","names":[],"sources":["../../../../../src/list/AllFiltersModal.ts"],"sourcesContent":["import {\n Accordion,\n AccordionGroup,\n ActionGroup,\n Button,\n Checkbox,\n CheckboxGroup,\n Content,\n Flex,\n Heading,\n Radio,\n RadioGroup,\n RangeCalendar,\n Section,\n SkeletonText,\n Text,\n} from \"@/auto-generated\";\nimport { IconFilter } from \"@/icons\";\nimport { watchMobxValue } from \"@/lib/mobxSelector\";\nimport { Modal } from \"@/overlays/Modal\";\nimport { createOverlayController } from \"@/overlays/overlayController\";\nimport { ModalTrigger } from \"@/overlays/triggers\";\nimport { defineComponent, h, type VNodeChild } from \"vue\";\nimport { isDateRangeFilter } from \"./dateRangeFilter\";\nimport { injectListModel, type AnyListModel } from \"./listContext\";\nimport { useListTexts, type ListTextFormatter } from \"./locales\";\nimport { listStyles } from \"./styles\";\nimport type { ListRendered } from \"./types\";\nimport { composition } from \"@/lib/composition\";\n\n/*\n * What this modal needs of a filter and a sorting. Not the classes: a list of\n * concrete filters is not assignable to a list of generic ones — a row model\n * sits in a contravariant position deep inside `Column`.\n */\ninterface ModalFilterValue {\n readonly id: string;\n readonly isActive: boolean;\n toggle(): void;\n render(): ListRendered;\n}\n\ninterface ModalFilter {\n readonly name?: string;\n readonly property: unknown;\n readonly mode: string;\n readonly priority: \"primary\" | \"secondary\";\n readonly values: ModalFilterValue[];\n readonly isSelectAllAvailable: boolean;\n isActive(): boolean;\n isEveryValueActive(): boolean;\n selectAll(): void;\n deselectAll(): void;\n clear(): void;\n}\n\ninterface ModalSorting {\n readonly id: string;\n readonly name?: string;\n readonly property: unknown;\n readonly directionName?: string;\n isSorted(): boolean;\n enable(): void;\n}\n\nconst accordion = (\n key: string,\n heading: string,\n expanded: boolean,\n content: () => VNodeChild,\n): VNodeChild =>\n h(Accordion, { key, defaultExpanded: expanded }, () => [\n h(Heading, null, () => heading),\n h(Content, null, content),\n ]);\n\ninterface ModalDateRangeFilter {\n readonly name?: string;\n readonly property: unknown;\n readonly dateRangeOptions?: Record<string, unknown>;\n getValue(): unknown;\n setValue(range: unknown): void;\n clear(): void;\n}\n\nconst renderDateRangeAccordion = (\n filter: ModalDateRangeFilter,\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild => {\n const name = filter.name ?? String(filter.property);\n const value = filter.getValue();\n\n return accordion(`filter-${name}`, name, expanded, () =>\n h(Flex, { direction: \"column\", gap: \"m\" }, () => [\n h(RangeCalendar, {\n ...filter.dateRangeOptions,\n value,\n onChange: (range: unknown) => filter.setValue(range),\n } as never),\n value\n ? h(\n Button,\n {\n size: \"s\",\n color: \"secondary\",\n variant: \"soft\",\n onPress: () => filter.clear(),\n },\n () => texts(\"filters.clearSelection\"),\n )\n : null,\n ]),\n );\n};\n\n/*\n * Flow's `FilterAccordionCheckboxGroup`: outside the checkbox group, so it is\n * not one of the values, and indeterminate while only some of them are on.\n */\nconst renderSelectAllCheckbox = (\n filter: ModalFilter,\n texts: ListTextFormatter,\n): VNodeChild => {\n const isEveryValueActive = filter.isEveryValueActive();\n\n return h(\n Checkbox,\n {\n key: \"select-all\",\n class: listStyles.selectAllCheckbox,\n isSelected: isEveryValueActive,\n isIndeterminate: filter.isActive() && !isEveryValueActive,\n onChange: () =>\n isEveryValueActive ? filter.deselectAll() : filter.selectAll(),\n },\n () =>\n texts(isEveryValueActive ? \"filters.deselectAll\" : \"filters.selectAll\"),\n );\n};\n\nconst renderFilterAccordion = (\n filter: ModalFilter,\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild => {\n const name = filter.name ?? String(filter.property);\n const activeIds = filter.values.filter((v) => v.isActive).map((v) => v.id);\n\n const content = (): VNodeChild =>\n filter.mode === \"one\"\n ? h(Flex, { direction: \"column\", gap: \"m\" }, () => [\n h(\n RadioGroup,\n {\n /*\n * Keyed on the selection, like Flow's: the group is controlled\n * and only remounting makes it pick up a value that changed from\n * outside — a chip removed, a reset.\n */\n key: activeIds[0],\n value: activeIds[0],\n m: [1, 1],\n \"aria-label\": name,\n },\n () =>\n filter.values.map((value) =>\n h(\n Radio,\n {\n key: value.id,\n value: value.id,\n onPress: () => {\n if (!value.isActive) {\n value.toggle();\n }\n },\n },\n () => value.render(),\n ),\n ),\n ),\n activeIds.length > 0\n ? h(\n Button,\n {\n size: \"s\",\n color: \"secondary\",\n variant: \"soft\",\n onPress: () => filter.clear(),\n },\n () => texts(\"filters.clearSelection\"),\n )\n : null,\n ])\n : [\n filter.isSelectAllAvailable\n ? renderSelectAllCheckbox(filter, texts)\n : null,\n h(\n CheckboxGroup,\n { value: activeIds, m: [1, 1], \"aria-label\": name },\n () =>\n filter.values.map((value) =>\n h(\n Checkbox,\n {\n key: value.id,\n value: value.id,\n onPress: () => value.toggle(),\n },\n () => value.render(),\n ),\n ),\n ),\n ];\n\n return accordion(`filter-${name}`, name, expanded, content);\n};\n\nconst renderSortingAccordion = (\n sortings: ModalSorting[],\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild => {\n const active = sortings.find((s) => s.isSorted());\n\n return accordion(\"sorting\", texts(\"sorting\"), expanded, () =>\n h(RadioGroup, { value: active?.id, m: [1, 1] }, () =>\n sortings.map((sorting) =>\n h(\n Radio,\n {\n key: sorting.id,\n value: sorting.id,\n onPress: () => sorting.enable(),\n },\n () =>\n `${sorting.name ?? String(sorting.property)} ${sorting.directionName ?? \"\"}`.trim(),\n ),\n ),\n ),\n );\n};\n\nconst renderViewModeAccordion = (\n list: AnyListModel,\n modes: (\"list\" | \"table\" | \"tiles\")[],\n selected: \"list\" | \"table\" | \"tiles\",\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild =>\n accordion(\"viewMode\", texts(\"settings.viewMode\"), expanded, () =>\n h(RadioGroup, { value: selected, m: [1, 1] }, () =>\n modes.map((mode) =>\n h(\n Radio,\n { key: mode, value: mode, onPress: () => list.viewMode.set(mode) },\n () => texts(`settings.viewMode.${mode}`),\n ),\n ),\n ),\n );\n\n/**\n * Every filter, sorting and view mode in one off-canvas modal.\n *\n * The mobile path to what the header shows as separate menus on desktop — and\n * on desktop too, where a list has secondary filters that the header leaves\n * out. It drives the same model objects, so a value ticked here is the same\n * event as one ticked in a menu.\n */\nexport const AllFiltersModal = defineComponent({\n name: \"ListAllFiltersModal\",\n\n props: {\n isDisabled: { type: Boolean, default: false },\n /** The layouts this list can show, from the header. */\n viewModes: {\n type: Array as () => (\"list\" | \"table\" | \"tiles\")[],\n default: () => [],\n },\n },\n\n setup(props) {\n const list = injectListModel();\n const texts = useListTexts();\n const controller = createOverlayController();\n\n const isInitiallyLoading = watchMobxValue(\n () => list.loaderState.isInitiallyLoading,\n );\n const viewMode = watchMobxValue(() => list.viewMode.value);\n const totalItemCount = watchMobxValue(() => {\n void list.listTable.revision;\n return list.batches.getTotalItemsCount();\n });\n /* Every value below is read off the table's filter and sorting state. */\n const tableRevision = watchMobxValue(() => list.listTable.revision);\n\n return () => {\n void tableRevision.value;\n\n const format = texts.value;\n const filters = list.filters as unknown as ModalFilter[];\n const sortings = list.visibleSorting as unknown as ModalSorting[];\n const modes = props.viewModes;\n\n const accordionCount =\n (modes.length > 1 ? 1 : 0) +\n (sortings.length > 0 ? 1 : 0) +\n filters.length;\n\n if (accordionCount === 0) {\n return null;\n }\n\n /* Two or fewer open by default — more than that is a wall of controls. */\n const expanded = accordionCount <= 2;\n\n const accordions: VNodeChild[] = [\n modes.length > 1\n ? renderViewModeAccordion(\n list,\n modes,\n viewMode.value,\n expanded,\n format,\n )\n : null,\n sortings.length > 0\n ? renderSortingAccordion(sortings, expanded, format)\n : null,\n ...filters.map((filter) =>\n isDateRangeFilter(filter)\n ? renderDateRangeAccordion(\n filter as unknown as ModalDateRangeFilter,\n expanded,\n format,\n )\n : renderFilterAccordion(filter, expanded, format),\n ),\n ];\n\n const hasSecondaryFilters = filters.some(\n (filter) => filter.priority === \"secondary\",\n );\n\n const showCount = format(\n totalItemCount.value === 1 ? \"results.show.one\" : \"results.show.other\",\n { totalItemCount: totalItemCount.value },\n );\n\n return h(ModalTrigger, { controller }, () => [\n h(\n Button,\n {\n class: [\n listStyles.hideOnMobile,\n hasSecondaryFilters ? undefined : listStyles.hideOnDesktop,\n ]\n .filter(Boolean)\n .join(\" \"),\n variant: \"outline\",\n color: \"secondary\",\n isDisabled: props.isDisabled,\n },\n () => [h(Text, null, () => format(\"filters.all\")), h(IconFilter)],\n ),\n\n h(\n Button,\n {\n class: listStyles.hideOnDesktop,\n variant: \"outline\",\n color: \"secondary\",\n \"aria-label\": format(\"filters.all\"),\n },\n () => h(IconFilter),\n ),\n\n h(Modal, { offCanvas: true, controller }, () => [\n h(Heading, null, () => format(\"filters.all\")),\n h(Content, null, () =>\n h(Section, null, () => h(AccordionGroup, null, () => accordions)),\n ),\n h(ActionGroup, null, () => [\n h(Button, { onPress: () => controller.close() }, () =>\n h(Text, null, () =>\n isInitiallyLoading.value\n ? h(SkeletonText, { width: \"16ch\" })\n : showCount,\n ),\n ),\n h(\n Button,\n {\n color: \"secondary\",\n variant: \"soft\",\n onPress: () => {\n list.resetFilters();\n controller.close();\n },\n },\n () => format(\"reset\"),\n ),\n ]),\n ]),\n ]);\n };\n },\n});\n\ncomposition(AllFiltersModal);\n\nexport default AllFiltersModal;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e,UAAU,IAAI,qBAAqB,sBAClD,EAAE,gBAAgB,eAAe,MAAM,CACzC;GAEA,OAAO,EAAE,cAAc,EAAE,WAAW,SAAS;IAC3C,EACE,QACA;KACE,OAAO,CACL,WAAW,cACX,sBAAsB,KAAA,IAAY,WAAW,aAC/C,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;KACX,SAAS;KACT,OAAO;KACP,YAAY,MAAM;IACpB,SACM,CAAC,EAAE,MAAM,YAAY,OAAO,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAClE;IAEA,EACE,QACA;KACE,OAAO,WAAW;KAClB,SAAS;KACT,OAAO;KACP,cAAc,OAAO,aAAa;IACpC,SACM,EAAE,UAAU,CACpB;IAEA,EAAE,OAAO;KAAE,WAAW;KAAM;IAAW,SAAS;KAC9C,EAAE,SAAS,YAAY,OAAO,aAAa,CAAC;KAC5C,EAAE,SAAS,YACT,EAAE,SAAS,YAAY,EAAE,gBAAgB,YAAY,UAAU,CAAC,CAClE;KACA,EAAE,aAAa,YAAY,CACzB,EAAE,QAAQ,EAAE,eAAe,WAAW,MAAM,EAAE,SAC5C,EAAE,MAAM,YACN,mBAAmB,QACf,EAAE,cAAc,EAAE,OAAO,OAAO,CAAC,IACjC,SACN,CACF,GACA,EACE,QACA;MACE,OAAO;MACP,SAAS;MACT,eAAe;OACb,KAAK,aAAa;OAClB,WAAW,MAAM;MACnB;KACF,SACM,OAAO,OAAO,CACtB,CACF,CAAC;IACH,CAAC;GACH,CAAC;EACH;CACF;AACF,CAAC;AAED,YAAY,eAAe"}
|
|
1
|
+
{"version":3,"file":"AllFiltersModal.mjs","names":[],"sources":["../../../../../src/list/AllFiltersModal.ts"],"sourcesContent":["import {\n Accordion,\n AccordionGroup,\n ActionGroup,\n Button,\n Checkbox,\n CheckboxGroup,\n Content,\n Flex,\n Heading,\n Radio,\n RadioGroup,\n RangeCalendar,\n Section,\n SkeletonText,\n Text,\n} from \"@/auto-generated\";\nimport { IconFilter } from \"@/icons\";\nimport { watchMobxValue } from \"@/lib/mobxSelector\";\nimport { Modal } from \"@/overlays/Modal\";\nimport { createOverlayController } from \"@/overlays/overlayController\";\nimport { ModalTrigger } from \"@/overlays/triggers\";\nimport { defineComponent, h, type VNodeChild } from \"vue\";\nimport { isDateRangeFilter } from \"./dateRangeFilter\";\nimport {\n DateTimeRangeFields,\n type DateTimeRangeFilter,\n} from \"./DateTimeRangeFields\";\nimport { injectListModel, type AnyListModel } from \"./listContext\";\nimport { useListTexts, type ListTextFormatter } from \"./locales\";\nimport { listStyles } from \"./styles\";\nimport type { ListRendered } from \"./types\";\nimport { composition } from \"@/lib/composition\";\nimport type { ListDateRange } from \"@mittwald/flow-components-base\";\n\n/*\n * What this modal needs of a filter and a sorting. Not the classes: a list of\n * concrete filters is not assignable to a list of generic ones — a row model\n * sits in a contravariant position deep inside `Column`.\n */\ninterface ModalFilterValue {\n readonly id: string;\n readonly isActive: boolean;\n toggle(): void;\n render(): ListRendered;\n}\n\ninterface ModalFilter {\n readonly name?: string;\n readonly property: unknown;\n readonly mode: string;\n readonly priority: \"primary\" | \"secondary\";\n readonly values: ModalFilterValue[];\n readonly isSelectAllAvailable: boolean;\n isActive(): boolean;\n isEveryValueActive(): boolean;\n selectAll(): void;\n deselectAll(): void;\n clear(): void;\n}\n\ninterface ModalSorting {\n readonly id: string;\n readonly name?: string;\n readonly property: unknown;\n readonly directionName?: string;\n isSorted(): boolean;\n enable(): void;\n}\n\nconst accordion = (\n key: string,\n heading: string,\n expanded: boolean,\n content: () => VNodeChild,\n): VNodeChild =>\n h(Accordion, { key, defaultExpanded: expanded }, () => [\n h(Heading, null, () => heading),\n h(Content, null, content),\n ]);\n\ninterface ModalDateRangeFilter extends DateTimeRangeFilter {\n readonly name?: string;\n readonly property: unknown;\n readonly granularity: \"day\" | \"minute\";\n readonly rangeCalendarProps: Record<string, unknown>;\n}\n\nconst renderDateRangeAccordion = (\n filter: ModalDateRangeFilter,\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild => {\n const name = filter.name ?? String(filter.property);\n const value = filter.getValue();\n\n return accordion(`filter-${name}`, name, expanded, () =>\n h(Flex, { direction: \"column\", gap: \"m\" }, () => [\n filter.granularity === \"minute\"\n ? h(DateTimeRangeFields, { filter })\n : h(RangeCalendar, {\n ...filter.rangeCalendarProps,\n value,\n onChange: (range: ListDateRange) => filter.setValue(range),\n } as never),\n value\n ? h(\n Button,\n {\n size: \"s\",\n color: \"secondary\",\n variant: \"soft\",\n onPress: () => filter.clear(),\n },\n () => texts(\"filters.clearSelection\"),\n )\n : null,\n ]),\n );\n};\n\n/*\n * Flow's `FilterAccordionCheckboxGroup`: outside the checkbox group, so it is\n * not one of the values, and indeterminate while only some of them are on.\n */\nconst renderSelectAllCheckbox = (\n filter: ModalFilter,\n texts: ListTextFormatter,\n): VNodeChild => {\n const isEveryValueActive = filter.isEveryValueActive();\n\n return h(\n Checkbox,\n {\n key: \"select-all\",\n class: listStyles.selectAllCheckbox,\n isSelected: isEveryValueActive,\n isIndeterminate: filter.isActive() && !isEveryValueActive,\n onChange: () =>\n isEveryValueActive ? filter.deselectAll() : filter.selectAll(),\n },\n () =>\n texts(isEveryValueActive ? \"filters.deselectAll\" : \"filters.selectAll\"),\n );\n};\n\nconst renderFilterAccordion = (\n filter: ModalFilter,\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild => {\n const name = filter.name ?? String(filter.property);\n const activeIds = filter.values.filter((v) => v.isActive).map((v) => v.id);\n\n const content = (): VNodeChild =>\n filter.mode === \"one\"\n ? h(Flex, { direction: \"column\", gap: \"m\" }, () => [\n h(\n RadioGroup,\n {\n /*\n * Keyed on the selection, like Flow's: the group is controlled\n * and only remounting makes it pick up a value that changed from\n * outside — a chip removed, a reset.\n */\n key: activeIds[0],\n value: activeIds[0],\n m: [1, 1],\n \"aria-label\": name,\n },\n () =>\n filter.values.map((value) =>\n h(\n Radio,\n {\n key: value.id,\n value: value.id,\n onPress: () => {\n if (!value.isActive) {\n value.toggle();\n }\n },\n },\n () => value.render(),\n ),\n ),\n ),\n activeIds.length > 0\n ? h(\n Button,\n {\n size: \"s\",\n color: \"secondary\",\n variant: \"soft\",\n onPress: () => filter.clear(),\n },\n () => texts(\"filters.clearSelection\"),\n )\n : null,\n ])\n : [\n filter.isSelectAllAvailable\n ? renderSelectAllCheckbox(filter, texts)\n : null,\n h(\n CheckboxGroup,\n { value: activeIds, m: [1, 1], \"aria-label\": name },\n () =>\n filter.values.map((value) =>\n h(\n Checkbox,\n {\n key: value.id,\n value: value.id,\n onPress: () => value.toggle(),\n },\n () => value.render(),\n ),\n ),\n ),\n ];\n\n return accordion(`filter-${name}`, name, expanded, content);\n};\n\nconst renderSortingAccordion = (\n sortings: ModalSorting[],\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild => {\n const active = sortings.find((s) => s.isSorted());\n\n return accordion(\"sorting\", texts(\"sorting\"), expanded, () =>\n h(RadioGroup, { value: active?.id, m: [1, 1] }, () =>\n sortings.map((sorting) =>\n h(\n Radio,\n {\n key: sorting.id,\n value: sorting.id,\n onPress: () => sorting.enable(),\n },\n () =>\n `${sorting.name ?? String(sorting.property)} ${sorting.directionName ?? \"\"}`.trim(),\n ),\n ),\n ),\n );\n};\n\nconst renderViewModeAccordion = (\n list: AnyListModel,\n modes: (\"list\" | \"table\" | \"tiles\")[],\n selected: \"list\" | \"table\" | \"tiles\",\n expanded: boolean,\n texts: ListTextFormatter,\n): VNodeChild =>\n accordion(\"viewMode\", texts(\"settings.viewMode\"), expanded, () =>\n h(RadioGroup, { value: selected, m: [1, 1] }, () =>\n modes.map((mode) =>\n h(\n Radio,\n { key: mode, value: mode, onPress: () => list.viewMode.set(mode) },\n () => texts(`settings.viewMode.${mode}`),\n ),\n ),\n ),\n );\n\n/**\n * Every filter, sorting and view mode in one off-canvas modal.\n *\n * The mobile path to what the header shows as separate menus on desktop — and\n * on desktop too, where a list has secondary filters that the header leaves\n * out. It drives the same model objects, so a value ticked here is the same\n * event as one ticked in a menu.\n */\nexport const AllFiltersModal = defineComponent({\n name: \"ListAllFiltersModal\",\n\n props: {\n isDisabled: { type: Boolean, default: false },\n /** The layouts this list can show, from the header. */\n viewModes: {\n type: Array as () => (\"list\" | \"table\" | \"tiles\")[],\n default: () => [],\n },\n },\n\n setup(props) {\n const list = injectListModel();\n const texts = useListTexts();\n const controller = createOverlayController();\n\n const isInitiallyLoading = watchMobxValue(\n () => list.loaderState.isInitiallyLoading,\n );\n const viewMode = watchMobxValue(() => list.viewMode.value);\n const totalItemCount = watchMobxValue(() => {\n void list.listTable.revision;\n return list.batches.getTotalItemsCount();\n });\n /* Every value below is read off the table's filter and sorting state. */\n const tableRevision = watchMobxValue(() => list.listTable.revision);\n\n return () => {\n void tableRevision.value;\n\n const format = texts.value;\n const filters = list.filters as unknown as ModalFilter[];\n const sortings = list.visibleSorting as unknown as ModalSorting[];\n const modes = props.viewModes;\n\n const accordionCount =\n (modes.length > 1 ? 1 : 0) +\n (sortings.length > 0 ? 1 : 0) +\n filters.length;\n\n if (accordionCount === 0) {\n return null;\n }\n\n /* Two or fewer open by default — more than that is a wall of controls. */\n const expanded = accordionCount <= 2;\n\n const accordions: VNodeChild[] = [\n modes.length > 1\n ? renderViewModeAccordion(\n list,\n modes,\n viewMode.value,\n expanded,\n format,\n )\n : null,\n sortings.length > 0\n ? renderSortingAccordion(sortings, expanded, format)\n : null,\n ...filters.map((filter) =>\n isDateRangeFilter(filter)\n ? renderDateRangeAccordion(\n filter as unknown as ModalDateRangeFilter,\n expanded,\n format,\n )\n : renderFilterAccordion(filter, expanded, format),\n ),\n ];\n\n const hasSecondaryFilters = filters.some(\n (filter) => filter.priority === \"secondary\",\n );\n\n const showCount = format(\n totalItemCount.value === 1 ? \"results.show.one\" : \"results.show.other\",\n { totalItemCount: totalItemCount.value },\n );\n\n return h(ModalTrigger, { controller }, () => [\n h(\n Button,\n {\n class: [\n listStyles.hideOnMobile,\n hasSecondaryFilters ? undefined : listStyles.hideOnDesktop,\n ]\n .filter(Boolean)\n .join(\" \"),\n variant: \"outline\",\n color: \"secondary\",\n isDisabled: props.isDisabled,\n },\n () => [h(Text, null, () => format(\"filters.all\")), h(IconFilter)],\n ),\n\n h(\n Button,\n {\n class: listStyles.hideOnDesktop,\n variant: \"outline\",\n color: \"secondary\",\n \"aria-label\": format(\"filters.all\"),\n },\n () => h(IconFilter),\n ),\n\n h(Modal, { offCanvas: true, controller }, () => [\n h(Heading, null, () => format(\"filters.all\")),\n h(Content, null, () =>\n h(Section, null, () => h(AccordionGroup, null, () => accordions)),\n ),\n h(ActionGroup, null, () => [\n h(Button, { onPress: () => controller.close() }, () =>\n h(Text, null, () =>\n isInitiallyLoading.value\n ? h(SkeletonText, { width: \"16ch\" })\n : showCount,\n ),\n ),\n h(\n Button,\n {\n color: \"secondary\",\n variant: \"soft\",\n onPress: () => {\n list.resetFilters();\n controller.close();\n },\n },\n () => format(\"reset\"),\n ),\n ]),\n ]),\n ]);\n };\n },\n});\n\ncomposition(AllFiltersModal);\n\nexport default AllFiltersModal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,IAAM,aACJ,KACA,SACA,UACA,YAEA,EAAE,WAAW;CAAE;CAAK,iBAAiB;AAAS,SAAS,CACrD,EAAE,SAAS,YAAY,OAAO,GAC9B,EAAE,SAAS,MAAM,OAAO,CAC1B,CAAC;AASH,IAAM,4BACJ,QACA,UACA,UACe;CACf,MAAM,OAAO,OAAO,QAAQ,OAAO,OAAO,QAAQ;CAClD,MAAM,QAAQ,OAAO,SAAS;CAE9B,OAAO,UAAU,UAAU,QAAQ,MAAM,gBACvC,EAAE,MAAM;EAAE,WAAW;EAAU,KAAK;CAAI,SAAS,CAC/C,OAAO,gBAAgB,WACnB,EAAE,qBAAqB,EAAE,OAAO,CAAC,IACjC,EAAE,eAAe;EACf,GAAG,OAAO;EACV;EACA,WAAW,UAAyB,OAAO,SAAS,KAAK;CAC3D,CAAU,GACd,QACI,EACE,QACA;EACE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,YAAY,OAAO,aAAa,CAAC;KAC5C,EAAE,SAAS,YACT,EAAE,SAAS,YAAY,EAAE,gBAAgB,YAAY,UAAU,CAAC,CAClE;KACA,EAAE,aAAa,YAAY,CACzB,EAAE,QAAQ,EAAE,eAAe,WAAW,MAAM,EAAE,SAC5C,EAAE,MAAM,YACN,mBAAmB,QACf,EAAE,cAAc,EAAE,OAAO,OAAO,CAAC,IACjC,SACN,CACF,GACA,EACE,QACA;MACE,OAAO;MACP,SAAS;MACT,eAAe;OACb,KAAK,aAAa;OAClB,WAAW,MAAM;MACnB;KACF,SACM,OAAO,OAAO,CACtB,CACF,CAAC;IACH,CAAC;GACH,CAAC;EACH;CACF;AACF,CAAC;AAED,YAAY,eAAe"}
|
|
@@ -3,7 +3,7 @@ import watchMobxValue from "../lib/mobxSelector.mjs";
|
|
|
3
3
|
import { injectListModel } from "./listContext.mjs";
|
|
4
4
|
import { defineComponent, shallowRef, toValue, watch, watchEffect } from "vue";
|
|
5
5
|
import { isDeepEqual } from "remeda";
|
|
6
|
-
|
|
6
|
+
// src/list/ComposableLoader.ts
|
|
7
7
|
/**
|
|
8
8
|
* One batch of a composable loader.
|
|
9
9
|
*
|
|
@@ -49,7 +49,6 @@ var ListComposableBatchLoader = defineComponent({
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
composition(ListComposableBatchLoader);
|
|
52
|
-
//#endregion
|
|
53
52
|
export { ListComposableBatchLoader, ListComposableBatchLoader as default };
|
|
54
53
|
|
|
55
54
|
//# sourceMappingURL=ComposableLoader.mjs.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { composition } from "../lib/composition.mjs";
|
|
2
|
+
import { DatePicker } from "../auto-generated/DatePicker.mjs";
|
|
3
|
+
import { Div } from "../auto-generated/Div.mjs";
|
|
4
|
+
import { FieldError } from "../auto-generated/FieldError.mjs";
|
|
5
|
+
import { Label } from "../auto-generated/Label.mjs";
|
|
6
|
+
import { TimeField } from "../auto-generated/TimeField.mjs";
|
|
7
|
+
import watchMobxValue from "../lib/mobxSelector.mjs";
|
|
8
|
+
import { getListDateTimeRangeUpdate, isListDateTimeRangeEndBeforeStart, listDateTimeRangeFieldsFromValue, toListCalendarDate, toListTime } from "../../../components-base/src/list/filter/dateTimeRangeFields.mjs";
|
|
9
|
+
import "../../../components-base/src/index.mjs";
|
|
10
|
+
import { injectListModel } from "./listContext.mjs";
|
|
11
|
+
import { useListTexts } from "./locales.mjs";
|
|
12
|
+
import { className, dateTimeRangeStyles } from "./styles.mjs";
|
|
13
|
+
import { defineComponent, h, shallowRef, useId, watch } from "vue";
|
|
14
|
+
// src/list/DateTimeRangeFields.ts
|
|
15
|
+
/**
|
|
16
|
+
* Flow's `DateTimeRangeFields`: start and end, each a date and a time, for a
|
|
17
|
+
* filter with `granularity: "minute"`.
|
|
18
|
+
*
|
|
19
|
+
* Which input is valid and when it applies is `components-base`'s
|
|
20
|
+
* (`getListDateTimeRangeUpdate`), so both bindings apply the same ranges. What
|
|
21
|
+
* is held here is the input itself, which may be invalid for a while — a year
|
|
22
|
+
* typed digit by digit, an end before its start — while the filter keeps the
|
|
23
|
+
* last valid range.
|
|
24
|
+
*/
|
|
25
|
+
var DateTimeRangeFields = defineComponent({
|
|
26
|
+
name: "ListDateTimeRangeFields",
|
|
27
|
+
props: {
|
|
28
|
+
filter: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
class: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: void 0
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
setup(props) {
|
|
38
|
+
const list = injectListModel();
|
|
39
|
+
const texts = useListTexts();
|
|
40
|
+
const rangeErrorId = useId();
|
|
41
|
+
const tableRevision = watchMobxValue(() => list.listTable.revision);
|
|
42
|
+
let appliedValue = props.filter.getValue();
|
|
43
|
+
const fields = shallowRef(listDateTimeRangeFieldsFromValue(appliedValue));
|
|
44
|
+
watch(tableRevision, () => {
|
|
45
|
+
const value = props.filter.getValue();
|
|
46
|
+
if (value !== appliedValue) {
|
|
47
|
+
appliedValue = value;
|
|
48
|
+
fields.value = listDateTimeRangeFieldsFromValue(value);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const update = (change) => {
|
|
52
|
+
const next = {
|
|
53
|
+
...fields.value,
|
|
54
|
+
...change
|
|
55
|
+
};
|
|
56
|
+
fields.value = next;
|
|
57
|
+
const newValue = getListDateTimeRangeUpdate(next, appliedValue, props.filter.dateTimeRangeLimits);
|
|
58
|
+
if (newValue === void 0) return;
|
|
59
|
+
appliedValue = newValue;
|
|
60
|
+
if (newValue) props.filter.setValue(newValue);
|
|
61
|
+
else props.filter.clear();
|
|
62
|
+
};
|
|
63
|
+
const label = (key) => () => h(Label, { optional: false }, () => texts.value(key));
|
|
64
|
+
return () => {
|
|
65
|
+
const limits = props.filter.dateTimeRangeLimits;
|
|
66
|
+
const minValue = toListCalendarDate(limits?.minValue);
|
|
67
|
+
const maxValue = toListCalendarDate(limits?.maxValue);
|
|
68
|
+
const hasRangeError = isListDateTimeRangeEndBeforeStart(fields.value);
|
|
69
|
+
const describedBy = hasRangeError ? rangeErrorId : void 0;
|
|
70
|
+
const datePicker = (side, labelKey) => h(DatePicker, {
|
|
71
|
+
value: fields.value[side],
|
|
72
|
+
onChange: (date) => update({ [side]: toListCalendarDate(date) }),
|
|
73
|
+
minValue,
|
|
74
|
+
maxValue,
|
|
75
|
+
"aria-describedby": describedBy,
|
|
76
|
+
isDateUnavailable: limits?.isDateUnavailable
|
|
77
|
+
}, () => [label(labelKey)(), h(FieldError)]);
|
|
78
|
+
const timeField = (side, labelKey) => h(TimeField, {
|
|
79
|
+
value: fields.value[side],
|
|
80
|
+
onChange: (time) => update({ [side]: toListTime(time) }),
|
|
81
|
+
"aria-describedby": describedBy
|
|
82
|
+
}, label(labelKey));
|
|
83
|
+
return h(Div, { class: className(dateTimeRangeStyles.fields, props.class) }, () => [
|
|
84
|
+
datePicker("startDate", "dateRange.startDate"),
|
|
85
|
+
timeField("startTime", "dateRange.startTime"),
|
|
86
|
+
datePicker("endDate", "dateRange.endDate"),
|
|
87
|
+
timeField("endTime", "dateRange.endTime"),
|
|
88
|
+
hasRangeError ? h(FieldError, {
|
|
89
|
+
id: rangeErrorId,
|
|
90
|
+
class: dateTimeRangeStyles.rangeError
|
|
91
|
+
}, () => texts.value("dateRange.endBeforeStart")) : null
|
|
92
|
+
]);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
composition(DateTimeRangeFields);
|
|
97
|
+
export { DateTimeRangeFields, DateTimeRangeFields as default };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=DateTimeRangeFields.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimeRangeFields.mjs","names":[],"sources":["../../../../../src/list/DateTimeRangeFields.ts"],"sourcesContent":["import {\n DatePicker,\n Div,\n FieldError,\n Label,\n TimeField,\n} from \"@/auto-generated\";\nimport { watchMobxValue } from \"@/lib/mobxSelector\";\nimport {\n getListDateTimeRangeUpdate,\n isListDateTimeRangeEndBeforeStart,\n listDateTimeRangeFieldsFromValue,\n toListCalendarDate,\n toListTime,\n type ListDateRange,\n type ListDateTimeRangeFields,\n type ListDateTimeRangeLimits,\n} from \"@mittwald/flow-components-base\";\nimport {\n defineComponent,\n h,\n shallowRef,\n useId,\n watch,\n type PropType,\n} from \"vue\";\nimport { composition } from \"@/lib/composition\";\nimport { injectListModel } from \"./listContext\";\nimport { useListTexts, type ListTextKey } from \"./locales\";\nimport { className, dateTimeRangeStyles } from \"./styles\";\n\n/** What the fields need of a date-range filter, and nothing more. */\nexport interface DateTimeRangeFilter {\n readonly dateTimeRangeLimits?: ListDateTimeRangeLimits;\n getValue(): ListDateRange | null;\n setValue(range: ListDateRange): void;\n clear(): void;\n}\n\n/**\n * Flow's `DateTimeRangeFields`: start and end, each a date and a time, for a\n * filter with `granularity: \"minute\"`.\n *\n * Which input is valid and when it applies is `components-base`'s\n * (`getListDateTimeRangeUpdate`), so both bindings apply the same ranges. What\n * is held here is the input itself, which may be invalid for a while — a year\n * typed digit by digit, an end before its start — while the filter keeps the\n * last valid range.\n */\nexport const DateTimeRangeFields = defineComponent({\n name: \"ListDateTimeRangeFields\",\n\n props: {\n filter: {\n type: Object as PropType<DateTimeRangeFilter>,\n required: true,\n },\n class: { type: String, default: undefined },\n },\n\n setup(props) {\n const list = injectListModel();\n const texts = useListTexts();\n const rangeErrorId = useId();\n\n /* The filter's value is table state, read through the table's revision. */\n const tableRevision = watchMobxValue(() => list.listTable.revision);\n\n let appliedValue = props.filter.getValue();\n const fields = shallowRef(listDateTimeRangeFieldsFromValue(appliedValue));\n\n /* A range set elsewhere — the chip, \"Reset filters\" — replaces the input. */\n watch(tableRevision, () => {\n const value = props.filter.getValue();\n if (value !== appliedValue) {\n appliedValue = value;\n fields.value = listDateTimeRangeFieldsFromValue(value);\n }\n });\n\n const update = (change: Partial<ListDateTimeRangeFields>) => {\n const next = { ...fields.value, ...change };\n fields.value = next;\n\n const newValue = getListDateTimeRangeUpdate(\n next,\n appliedValue,\n props.filter.dateTimeRangeLimits,\n );\n if (newValue === undefined) {\n return;\n }\n\n appliedValue = newValue;\n\n if (newValue) {\n props.filter.setValue(newValue);\n } else {\n props.filter.clear();\n }\n };\n\n const label = (key: ListTextKey) => () =>\n h(Label, { optional: false }, () => texts.value(key));\n\n return () => {\n const limits = props.filter.dateTimeRangeLimits;\n const minValue = toListCalendarDate(limits?.minValue);\n const maxValue = toListCalendarDate(limits?.maxValue);\n const hasRangeError = isListDateTimeRangeEndBeforeStart(fields.value);\n const describedBy = hasRangeError ? rangeErrorId : undefined;\n\n const datePicker = (\n side: \"startDate\" | \"endDate\",\n labelKey: ListTextKey,\n ) =>\n h(\n DatePicker,\n {\n value: fields.value[side],\n onChange: (date: Parameters<typeof toListCalendarDate>[0]) =>\n update({ [side]: toListCalendarDate(date) }),\n minValue,\n maxValue,\n \"aria-describedby\": describedBy,\n isDateUnavailable: limits?.isDateUnavailable,\n } as never,\n () => [label(labelKey)(), h(FieldError)],\n );\n\n const timeField = (\n side: \"startTime\" | \"endTime\",\n labelKey: ListTextKey,\n ) =>\n h(\n TimeField,\n {\n value: fields.value[side],\n onChange: (time: Parameters<typeof toListTime>[0]) =>\n update({ [side]: toListTime(time) }),\n \"aria-describedby\": describedBy,\n } as never,\n label(labelKey),\n );\n\n return h(\n Div,\n { class: className(dateTimeRangeStyles.fields, props.class) },\n () => [\n datePicker(\"startDate\", \"dateRange.startDate\"),\n timeField(\"startTime\", \"dateRange.startTime\"),\n datePicker(\"endDate\", \"dateRange.endDate\"),\n timeField(\"endTime\", \"dateRange.endTime\"),\n hasRangeError\n ? h(\n FieldError,\n { id: rangeErrorId, class: dateTimeRangeStyles.rangeError },\n () => texts.value(\"dateRange.endBeforeStart\"),\n )\n : null,\n ],\n );\n };\n },\n});\n\ncomposition(DateTimeRangeFields);\n\nexport default DateTimeRangeFields;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAa,sBAAsB,gBAAgB;CACjD,MAAM;CAEN,OAAO;EACL,QAAQ;GACN,MAAM;GACN,UAAU;EACZ;EACA,OAAO;GAAE,MAAM;GAAQ,SAAS,KAAA;EAAU;CAC5C;CAEA,MAAM,OAAO;EACX,MAAM,OAAO,gBAAgB;EAC7B,MAAM,QAAQ,aAAa;EAC3B,MAAM,eAAe,MAAM;EAG3B,MAAM,gBAAgB,qBAAqB,KAAK,UAAU,QAAQ;EAElE,IAAI,eAAe,MAAM,OAAO,SAAS;EACzC,MAAM,SAAS,WAAW,iCAAiC,YAAY,CAAC;EAGxE,MAAM,qBAAqB;GACzB,MAAM,QAAQ,MAAM,OAAO,SAAS;GACpC,IAAI,UAAU,cAAc;IAC1B,eAAe;IACf,OAAO,QAAQ,iCAAiC,KAAK;GACvD;EACF,CAAC;EAED,MAAM,UAAU,WAA6C;GAC3D,MAAM,OAAO;IAAE,GAAG,OAAO;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AmB"}
|
|
@@ -8,7 +8,7 @@ import { injectListModel } from "./listContext.mjs";
|
|
|
8
8
|
import { useListTexts } from "./locales.mjs";
|
|
9
9
|
import { listStyles } from "./styles.mjs";
|
|
10
10
|
import { defineComponent, h } from "vue";
|
|
11
|
-
|
|
11
|
+
// src/list/Footer.ts
|
|
12
12
|
/** How many items are shown, and the way to ask for more. */
|
|
13
13
|
var Footer = defineComponent({
|
|
14
14
|
name: "ListFooter",
|
|
@@ -47,7 +47,6 @@ var Footer = defineComponent({
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
composition(Footer);
|
|
50
|
-
//#endregion
|
|
51
50
|
export { Footer, Footer as default };
|
|
52
51
|
|
|
53
52
|
//# sourceMappingURL=Footer.mjs.map
|
|
@@ -16,16 +16,16 @@ import watchMobxValue from "../lib/mobxSelector.mjs";
|
|
|
16
16
|
import { createOverlayController } from "../overlays/overlayController.mjs";
|
|
17
17
|
import { injectListModel } from "./listContext.mjs";
|
|
18
18
|
import { useListTexts } from "./locales.mjs";
|
|
19
|
-
import { listStyles } from "./styles.mjs";
|
|
19
|
+
import { dateTimeRangeStyles, listStyles } from "./styles.mjs";
|
|
20
20
|
import { Popover } from "../overlays/Popover.mjs";
|
|
21
21
|
import { PopoverTrigger } from "../overlays/triggers.mjs";
|
|
22
22
|
import { isDateRangeFilter } from "./dateRangeFilter.mjs";
|
|
23
23
|
import { ActiveFilters } from "./ActiveFilters.mjs";
|
|
24
|
+
import { DateTimeRangeFields } from "./DateTimeRangeFields.mjs";
|
|
24
25
|
import { AllFiltersModal } from "./AllFiltersModal.mjs";
|
|
25
26
|
import { defineComponent, h, onBeforeUnmount, ref, watch } from "vue";
|
|
26
|
-
|
|
27
|
+
// src/list/Header.ts
|
|
27
28
|
var autoSubmitTimeout = 500;
|
|
28
|
-
var dateRangeCalendarClass = "flow--list--header--filter-context-menu--calendar";
|
|
29
29
|
var availableViewModes = (shape) => {
|
|
30
30
|
const modes = [];
|
|
31
31
|
if (shape.itemView?.showList) modes.push("list");
|
|
@@ -67,11 +67,12 @@ var renderSortingMenu = (list, texts, isDisabled) => {
|
|
|
67
67
|
}, () => `${sorting.name ?? String(sorting.property)} ${sorting.directionName ?? ""}`.trim())))]);
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
|
-
* A date-range filter is a calendar in a popover, not a menu of values
|
|
70
|
+
* A date-range filter is a calendar in a popover, not a menu of values — or,
|
|
71
|
+
* with `granularity: "minute"`, date and time fields.
|
|
71
72
|
*
|
|
72
73
|
* The same shape Flow's React list gives it — the calendar closes the popover
|
|
73
74
|
* when a range is picked, because a range is complete the moment its second end
|
|
74
|
-
* is.
|
|
75
|
+
* is. The fields leave it open: they apply as they are typed.
|
|
75
76
|
*/
|
|
76
77
|
var renderDateRangeFilter = (filter, isDisabled, calendarLabel, controller) => h(PopoverTrigger, {
|
|
77
78
|
key: filter.storageKey,
|
|
@@ -80,9 +81,12 @@ var renderDateRangeFilter = (filter, isDisabled, calendarLabel, controller) => h
|
|
|
80
81
|
placement: "bottom end",
|
|
81
82
|
isDialogContent: true,
|
|
82
83
|
"aria-label": calendarLabel
|
|
83
|
-
}, () => h(
|
|
84
|
-
|
|
85
|
-
class:
|
|
84
|
+
}, () => filter.granularity === "minute" ? h(DateTimeRangeFields, {
|
|
85
|
+
filter,
|
|
86
|
+
class: dateTimeRangeStyles.popover
|
|
87
|
+
}) : h(RangeCalendar, {
|
|
88
|
+
...filter.rangeCalendarProps,
|
|
89
|
+
class: dateTimeRangeStyles.calendar,
|
|
86
90
|
value: filter.getValue(),
|
|
87
91
|
onChange: (range) => {
|
|
88
92
|
filter.setValue(range);
|
|
@@ -185,6 +189,7 @@ var Header = defineComponent({
|
|
|
185
189
|
viewModes: modes
|
|
186
190
|
}),
|
|
187
191
|
list.search ? h(SearchField, {
|
|
192
|
+
key: isDisabled ? "disabled" : "enabled",
|
|
188
193
|
class: listStyles.searchField,
|
|
189
194
|
isDisabled,
|
|
190
195
|
autoFocus: searchShape?.autoFocus,
|
|
@@ -201,7 +206,6 @@ var Header = defineComponent({
|
|
|
201
206
|
}
|
|
202
207
|
});
|
|
203
208
|
composition(Header);
|
|
204
|
-
//#endregion
|
|
205
209
|
export { Header, Header as default };
|
|
206
210
|
|
|
207
211
|
//# sourceMappingURL=Header.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.mjs","names":[],"sources":["../../../../../src/list/Header.ts"],"sourcesContent":["import {\n Button,\n ContextMenu,\n ContextMenuTrigger,\n Div,\n MenuItem,\n RangeCalendar,\n SearchField,\n Text,\n} from \"@/auto-generated\";\nimport { Popover } from \"@/overlays/Popover\";\nimport { PopoverTrigger } from \"@/overlays/triggers\";\nimport {\n IconAscending,\n IconDescending,\n IconFilter,\n IconSorting,\n IconView,\n} from \"@/icons\";\nimport { watchMobxValue } from \"@/lib/mobxSelector\";\nimport {\n createOverlayController,\n type OverlayController,\n} from \"@/overlays/overlayController\";\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n watch,\n type VNodeChild,\n} from \"vue\";\nimport { ActiveFilters } from \"./ActiveFilters\";\nimport { AllFiltersModal } from \"./AllFiltersModal\";\nimport { isDateRangeFilter } from \"./dateRangeFilter\";\nimport { injectListModel, type AnyListModel } from \"./listContext\";\nimport { useListTexts, type ListTextFormatter } from \"./locales\";\nimport type { ListRenderShape } from \"./model\";\nimport { listStyles } from \"./styles\";\nimport type { ListRendered } from \"./types\";\nimport { composition } from \"@/lib/composition\";\n\nconst autoSubmitTimeout = 500;\n\n/* `FilterContextMenus.module.scss`'s `.calendar`. */\nconst dateRangeCalendarClass =\n \"flow--list--header--filter-context-menu--calendar\";\n\n/*\n * What the header needs of a sorting and of a filter, and nothing more.\n *\n * Not the classes themselves: a list of concrete filters is not assignable to\n * a list of generic ones, because a row model sits in a contravariant position\n * deep inside `Column`, so `Table<any>` and `Table<never>` never meet. Reading\n * only the members it renders keeps the header out of that entirely.\n */\ninterface HeaderSorting {\n readonly id: string;\n readonly name?: string;\n readonly property: unknown;\n readonly direction: \"asc\" | \"desc\";\n readonly directionName?: string;\n isSorted(): boolean;\n enable(): void;\n}\n\ninterface HeaderFilterValue {\n readonly id: string;\n readonly isActive: boolean;\n toggle(): void;\n render(): ListRendered;\n}\n\ninterface HeaderDateRangeFilter {\n readonly storageKey: string;\n readonly name?: string;\n readonly property: unknown;\n readonly dateRangeOptions?: Record<string, unknown>;\n getValue(): unknown;\n setValue(range: unknown): void;\n}\n\ninterface HeaderFilter {\n readonly storageKey: string;\n readonly mode: string;\n readonly priority: \"primary\" | \"secondary\";\n readonly name?: string;\n readonly property: unknown;\n readonly values: HeaderFilterValue[];\n readonly isSelectAllAvailable: boolean;\n selectAll(): void;\n setActiveValueIds(ids: Iterable<unknown>): void;\n}\n\n/** Which layouts this list can actually show. */\ntype ViewMode = \"list\" | \"table\" | \"tiles\";\n\nconst availableViewModes = (shape: ListRenderShape<never>): ViewMode[] => {\n const modes: ViewMode[] = [];\n if (shape.itemView?.showList) {\n modes.push(\"list\");\n }\n if (shape.table) {\n modes.push(\"table\");\n }\n if (shape.itemView?.showTiles) {\n modes.push(\"tiles\");\n }\n return modes;\n};\n\nconst outlineButton = (isDisabled: boolean) => ({\n variant: \"outline\" as const,\n color: \"secondary\" as const,\n class: listStyles.hideOnMobile,\n isDisabled,\n});\n\nconst renderViewModeMenu = (\n list: AnyListModel,\n modes: ViewMode[],\n texts: ListTextFormatter,\n isDisabled: boolean,\n selected: ViewMode,\n): VNodeChild => {\n if (modes.length <= 1) {\n return null;\n }\n\n return h(ContextMenuTrigger, null, () => [\n h(\n Button,\n { ...outlineButton(isDisabled), \"aria-label\": texts(\"settings\") },\n () => [\n h(Text, null, () => texts(`settings.viewMode.${selected}`)),\n h(IconView),\n ],\n ),\n h(ContextMenu, { selectionMode: \"single\", selectedKeys: [selected] }, () =>\n modes.map((mode) =>\n h(\n MenuItem,\n { key: mode, id: mode, onAction: () => list.viewMode.set(mode) },\n () => texts(`settings.viewMode.${mode}`),\n ),\n ),\n ),\n ]);\n};\n\nconst renderSortingMenu = (\n list: AnyListModel,\n texts: ListTextFormatter,\n isDisabled: boolean,\n): VNodeChild => {\n const sortings = list.visibleSorting as HeaderSorting[];\n\n if (sortings.length === 0) {\n return null;\n }\n\n const active = sortings.find((s) => s.isSorted());\n\n return h(ContextMenuTrigger, null, () => [\n h(Button, outlineButton(isDisabled), () => [\n h(Text, null, () =>\n active ? (active.name ?? String(active.property)) : texts(\"sorting\"),\n ),\n h(\n active\n ? active.direction === \"asc\"\n ? IconAscending\n : IconDescending\n : IconSorting,\n ),\n ]),\n h(\n ContextMenu,\n {\n selectionMode: \"single\",\n selectedKeys: active ? [active.id] : [],\n },\n () =>\n sortings.map((sorting) =>\n h(\n MenuItem,\n {\n key: sorting.id,\n id: sorting.id,\n onAction: () => sorting.enable(),\n },\n () =>\n `${sorting.name ?? String(sorting.property)} ${sorting.directionName ?? \"\"}`.trim(),\n ),\n ),\n ),\n ]);\n};\n\n/**\n * A date-range filter is a calendar in a popover, not a menu of values.\n *\n * The same shape Flow's React list gives it — the calendar closes the popover\n * when a range is picked, because a range is complete the moment its second end\n * is.\n */\nconst renderDateRangeFilter = (\n filter: HeaderDateRangeFilter,\n isDisabled: boolean,\n calendarLabel: string,\n controller: OverlayController,\n): VNodeChild =>\n h(PopoverTrigger, { key: filter.storageKey, controller }, () => [\n h(Button, outlineButton(isDisabled), () => [\n h(Text, null, () => filter.name ?? String(filter.property)),\n h(IconFilter),\n ]),\n h(\n Popover,\n {\n placement: \"bottom end\",\n isDialogContent: true,\n \"aria-label\": calendarLabel,\n },\n () =>\n /*\n * Cast at the call, because the options are whatever the consumer\n * handed the filter: an open record does not match a typed component's\n * props, and TypeScript then resolves `h` to its instance overload.\n */\n h(RangeCalendar, {\n ...filter.dateRangeOptions,\n class: dateRangeCalendarClass,\n value: filter.getValue(),\n onChange: (range: unknown) => {\n filter.setValue(range);\n controller.close();\n },\n } as never),\n ),\n ]);\n\nconst renderFilterMenu = (\n filter: HeaderFilter,\n isDisabled: boolean,\n): VNodeChild => {\n const selectionMode = filter.mode === \"one\" ? \"single\" : \"multiple\";\n const values = filter.values;\n\n return h(ContextMenuTrigger, { key: filter.storageKey }, () => [\n h(Button, outlineButton(isDisabled), () => [\n h(Text, null, () => filter.name ?? String(filter.property)),\n h(IconFilter),\n ]),\n h(\n ContextMenu,\n {\n selectionMode,\n selectedKeys: values.filter((v) => v.isActive).map((v) => v.id),\n /*\n * Flow's: a multiple-choice menu reports its whole selection, and the\n * \"Select all\" entry the host adds reports it as `\"all\"`.\n */\n onSelectionChange:\n selectionMode === \"multiple\"\n ? (keys: unknown) =>\n keys === \"all\"\n ? filter.selectAll()\n : filter.setActiveValueIds(keys as Iterable<unknown>)\n : undefined,\n showSelectAll: filter.isSelectAllAvailable,\n },\n () =>\n values.map((value) =>\n h(\n MenuItem,\n {\n key: value.id,\n id: value.id,\n /* A multiple choice goes through `onSelectionChange`. */\n onAction: () => {\n if (selectionMode === \"single\" && !value.isActive) {\n value.toggle();\n }\n },\n },\n () => value.render(),\n ),\n ),\n ),\n ]);\n};\n\n/**\n * The list's controls: layout, sorting, filters, search — plus the app's own\n * `ActionGroup`, which the `List` hands over as the `actions` slot.\n *\n * Each one is a remote element the host materialises — a context menu trigger\n * with a button and a menu — and what they act on is the shared model, so a\n * filter behaves here exactly as it does in React.\n */\nexport const Header = defineComponent({\n name: \"ListHeader\",\n\n setup(_props, { slots }) {\n const list = injectListModel();\n const texts = useListTexts();\n\n const isEmpty = watchMobxValue(() => list.isEmpty);\n const isInitiallyLoading = watchMobxValue(\n () => list.loaderState.isInitiallyLoading,\n );\n const emptyViewType = watchMobxValue(() => list.getEmptyViewType());\n const viewMode = watchMobxValue(() => list.viewMode.value);\n /* Filters and sortings read the table, so they follow its revision. */\n const tableRevision = watchMobxValue(() => list.listTable.revision);\n const renderShape = watchMobxValue(() => list.renderShape);\n\n /*\n * One controller per date filter, kept for as long as the header is.\n * Created in the render it would be a new one every time — and a range\n * takes two clicks, so the popover would forget the first between them.\n */\n const dateControllers = new Map<string, OverlayController>();\n const dateController = (key: string): OverlayController => {\n const existing = dateControllers.get(key);\n if (existing) {\n return existing;\n }\n const created = createOverlayController();\n dateControllers.set(key, created);\n return created;\n };\n\n /*\n * Flow's `DefaultSearchFieldRender`: the field holds what is typed, and a\n * search is submitted after a pause — or, with `autoSubmit={false}`, on\n * Enter. Escape and the clear button clear at once.\n */\n const searchShape = list.shape.search;\n const autoSubmit = searchShape?.autoSubmit !== false;\n const searchInput = ref(list.search?.value ?? \"\");\n let previousSearch = \"\";\n let submitTimeout: ReturnType<typeof setTimeout> | undefined;\n\n const submitSearch = () => {\n if (searchInput.value.trim() === \"\") {\n list.search?.setValue(undefined);\n } else if (previousSearch !== searchInput.value) {\n previousSearch = searchInput.value;\n list.search?.setValue(searchInput.value);\n }\n };\n\n const clearSearch = () => {\n clearTimeout(submitTimeout);\n list.search?.setValue(undefined);\n searchInput.value = \"\";\n };\n\n watch(searchInput, () => {\n clearTimeout(submitTimeout);\n if (autoSubmit) {\n submitTimeout = setTimeout(submitSearch, autoSubmitTimeout);\n }\n });\n\n /* A search set from outside the field — a reset — shows in it. */\n const searchValue = watchMobxValue(() => {\n void list.listTable.revision;\n return list.search?.value;\n });\n watch(searchValue, (value) => {\n searchInput.value = value ?? \"\";\n });\n\n const onSearchKeyUp = (event: { key?: string } | undefined) => {\n if (event?.key === \"Enter\" && !autoSubmit) {\n submitSearch();\n } else if (event?.key === \"Escape\") {\n clearSearch();\n }\n };\n\n onBeforeUnmount(() => clearTimeout(submitTimeout));\n\n return () => {\n void tableRevision.value;\n\n const noItemsAvailable = isEmpty.value && emptyViewType.value === \"list\";\n const isDisabled = isInitiallyLoading.value || noItemsAvailable;\n const modes = availableViewModes(renderShape.value);\n\n const actions = slots.actions?.();\n\n /*\n * The header is rendered even with nothing in it, because Flow's is: it\n * holds the app's own `ActionGroup`, and a list that gained one would\n * otherwise change the DOM around it.\n *\n * Asked of the model rather than of what the options rendered — the\n * all-filters modal decides for itself whether it has anything to show.\n */\n const hasOptions =\n list.filters.length > 0 ||\n list.visibleSorting.length > 0 ||\n !!list.search ||\n modes.length > 1;\n\n /*\n * Nothing to show yet and nothing to configure it with: Flow hides the\n * header rather than dropping it, so what an app put in it keeps its\n * state across the switch to and from the empty view.\n */\n if (noItemsAvailable) {\n return h(\n Div,\n { class: listStyles.hideVisuallyActions, \"aria-hidden\": true },\n /*\n * Same nesting and same classes as the branch below, which is what\n * Flow's comment on this branch asks for — the tunnel's content has\n * to survive the switch. React arrives at the inner class by reusing\n * the element rather than by setting it: a `className` that goes from\n * set to undefined never reaches the host, so the previous one stays.\n *\n * `[actions, null]`, not `actions`: Vue wraps a nested array in a\n * fragment, so only the same array shape keeps the actions at the\n * same position in the same fragment — anything else remounts them,\n * and a modal open from the header closes.\n */\n () =>\n h(Div, { class: listStyles.headerContent }, () => [actions, null]),\n );\n }\n\n const options: VNodeChild[] = [\n renderViewModeMenu(\n list,\n modes,\n texts.value,\n isDisabled,\n viewMode.value,\n ),\n renderSortingMenu(list, texts.value, isDisabled),\n /*\n * Primary only. A secondary filter is reachable through the\n * all-filters modal, which is the whole reason that modal shows on\n * desktop at all.\n */\n ...(list.filters as HeaderFilter[])\n .filter((filter) => filter.priority === \"primary\")\n .map((filter) =>\n isDateRangeFilter(filter)\n ? renderDateRangeFilter(\n filter as unknown as HeaderDateRangeFilter,\n isDisabled,\n texts.value(\"dateRange\"),\n dateController(filter.storageKey),\n )\n : renderFilterMenu(filter, isDisabled),\n ),\n h(AllFiltersModal, { isDisabled, viewModes: modes }),\n list.search\n ? h(SearchField, {\n class: listStyles.searchField,\n isDisabled,\n autoFocus: searchShape?.autoFocus,\n value: searchInput.value,\n onChange: (value: string) => {\n searchInput.value = value;\n },\n onKeyUp: onSearchKeyUp,\n onClear: clearSearch,\n })\n : null,\n ];\n\n return h(\n Div,\n {\n class: [\n listStyles.header,\n list.search ? listStyles.headerWithSearch : undefined,\n ]\n .filter(Boolean)\n .join(\" \"),\n },\n () => [\n h(Div, { class: listStyles.headerContent }, () => [\n actions,\n hasOptions\n ? h(Div, { class: listStyles.headerOptions }, () => options)\n : null,\n ]),\n h(ActiveFilters, { isDisabled }),\n ],\n );\n };\n },\n});\n\ncomposition(Header);\n\nexport default Header;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAM,oBAAoB;AAG1B,IAAM,yBACJ;AAmDF,IAAM,sBAAsB,UAA8C;CACxE,MAAM,QAAoB,CAAC;CAC3B,IAAI,MAAM,UAAU,UAClB,MAAM,KAAK,MAAM;CAEnB,IAAI,MAAM,OACR,MAAM,KAAK,OAAO;CAEpB,IAAI,MAAM,UAAU,WAClB,MAAM,KAAK,OAAO;CAEpB,OAAO;AACT;AAEA,IAAM,iBAAiB,gBAAyB;CAC9C,SAAS;CACT,OAAO;CACP,OAAO,WAAW;CAClB;AACF;AAEA,IAAM,sBACJ,MACA,OACA,OACA,YACA,aACe;CACf,IAAI,MAAM,UAAU,GAClB,OAAO;CAGT,OAAO,EAAE,oBAAoB,YAAY,CACvC,EACE,QACA;EAAE,GAAG,cAAc,UAAU;EAAG,cAAc,MAAM,UAAU;CAAE,SAC1D,CACJ,EAAE,MAAM,YAAY,MAAM,qBAAqB,UAAU,CAAC,GAC1D,EAAE,QAAQ,CACZ,CACF,GACA,EAAE,aAAa;EAAE,eAAe;EAAU,cAAc,CAAC,QAAQ;CAAE,SACjE,MAAM,KAAK,SACT,EACE,UACA;EAAE,KAAK;EAAM,IAAI;EAAM,gBAAgB,KAAK,SAAS,IAAI,IAAI;CAAE,SACzD,MAAM,qBAAqB,MAAM,CACzC,CACF,CACF,CACF,CAAC;AACH;AAEA,IAAM,qBACJ,MACA,OACA,eACe;CACf,MAAM,WAAW,KAAK;CAEtB,IAAI,SAAS,WAAW,GACtB,OAAO;CAGT,MAAM,SAAS,SAAS,MAAM,MAAM,EAAE,SAAS,CAAC;CAEhD,OAAO,EAAE,oBAAoB,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J,kBAAkB,MAAM,IACpB,sBACE,QACA,YACA,MAAM,MAAM,WAAW,GACvB,eAAe,OAAO,UAAU,CAClC,IACA,iBAAiB,QAAQ,UAAU,CACzC;IACF,EAAE,iBAAiB;KAAE;KAAY,WAAW;IAAM,CAAC;IACnD,KAAK,SACD,EAAE,aAAa;KACb,OAAO,WAAW;KAClB;KACA,WAAW,aAAa;KACxB,OAAO,YAAY;KACnB,WAAW,UAAkB;MAC3B,YAAY,QAAQ;KACtB;KACA,SAAS;KACT,SAAS;IACX,CAAC,IACD;GACN;GAEA,OAAO,EACL,KACA,EACE,OAAO,CACL,WAAW,QACX,KAAK,SAAS,WAAW,mBAAmB,KAAA,CAC9C,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,EACb,SACM,CACJ,EAAE,KAAK,EAAE,OAAO,WAAW,cAAc,SAAS,CAChD,SACA,aACI,EAAE,KAAK,EAAE,OAAO,WAAW,cAAc,SAAS,OAAO,IACzD,IACN,CAAC,GACD,EAAE,eAAe,EAAE,WAAW,CAAC,CACjC,CACF;EACF;CACF;AACF,CAAC;AAED,YAAY,MAAM"}
|
|
1
|
+
{"version":3,"file":"Header.mjs","names":[],"sources":["../../../../../src/list/Header.ts"],"sourcesContent":["import {\n Button,\n ContextMenu,\n ContextMenuTrigger,\n Div,\n MenuItem,\n RangeCalendar,\n SearchField,\n Text,\n} from \"@/auto-generated\";\nimport { Popover } from \"@/overlays/Popover\";\nimport { PopoverTrigger } from \"@/overlays/triggers\";\nimport {\n IconAscending,\n IconDescending,\n IconFilter,\n IconSorting,\n IconView,\n} from \"@/icons\";\nimport { watchMobxValue } from \"@/lib/mobxSelector\";\nimport {\n createOverlayController,\n type OverlayController,\n} from \"@/overlays/overlayController\";\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n watch,\n type VNodeChild,\n} from \"vue\";\nimport { ActiveFilters } from \"./ActiveFilters\";\nimport { AllFiltersModal } from \"./AllFiltersModal\";\nimport { isDateRangeFilter } from \"./dateRangeFilter\";\nimport {\n DateTimeRangeFields,\n type DateTimeRangeFilter,\n} from \"./DateTimeRangeFields\";\nimport { injectListModel, type AnyListModel } from \"./listContext\";\nimport { useListTexts, type ListTextFormatter } from \"./locales\";\nimport type { ListRenderShape } from \"./model\";\nimport { dateTimeRangeStyles, listStyles } from \"./styles\";\nimport type { ListRendered } from \"./types\";\nimport { composition } from \"@/lib/composition\";\nimport type { ListDateRange } from \"@mittwald/flow-components-base\";\n\nconst autoSubmitTimeout = 500;\n\n/*\n * What the header needs of a sorting and of a filter, and nothing more.\n *\n * Not the classes themselves: a list of concrete filters is not assignable to\n * a list of generic ones, because a row model sits in a contravariant position\n * deep inside `Column`, so `Table<any>` and `Table<never>` never meet. Reading\n * only the members it renders keeps the header out of that entirely.\n */\ninterface HeaderSorting {\n readonly id: string;\n readonly name?: string;\n readonly property: unknown;\n readonly direction: \"asc\" | \"desc\";\n readonly directionName?: string;\n isSorted(): boolean;\n enable(): void;\n}\n\ninterface HeaderFilterValue {\n readonly id: string;\n readonly isActive: boolean;\n toggle(): void;\n render(): ListRendered;\n}\n\ninterface HeaderDateRangeFilter extends DateTimeRangeFilter {\n readonly storageKey: string;\n readonly name?: string;\n readonly property: unknown;\n readonly granularity: \"day\" | \"minute\";\n readonly rangeCalendarProps: Record<string, unknown>;\n}\n\ninterface HeaderFilter {\n readonly storageKey: string;\n readonly mode: string;\n readonly priority: \"primary\" | \"secondary\";\n readonly name?: string;\n readonly property: unknown;\n readonly values: HeaderFilterValue[];\n readonly isSelectAllAvailable: boolean;\n selectAll(): void;\n setActiveValueIds(ids: Iterable<unknown>): void;\n}\n\n/** Which layouts this list can actually show. */\ntype ViewMode = \"list\" | \"table\" | \"tiles\";\n\nconst availableViewModes = (shape: ListRenderShape<never>): ViewMode[] => {\n const modes: ViewMode[] = [];\n if (shape.itemView?.showList) {\n modes.push(\"list\");\n }\n if (shape.table) {\n modes.push(\"table\");\n }\n if (shape.itemView?.showTiles) {\n modes.push(\"tiles\");\n }\n return modes;\n};\n\nconst outlineButton = (isDisabled: boolean) => ({\n variant: \"outline\" as const,\n color: \"secondary\" as const,\n class: listStyles.hideOnMobile,\n isDisabled,\n});\n\nconst renderViewModeMenu = (\n list: AnyListModel,\n modes: ViewMode[],\n texts: ListTextFormatter,\n isDisabled: boolean,\n selected: ViewMode,\n): VNodeChild => {\n if (modes.length <= 1) {\n return null;\n }\n\n return h(ContextMenuTrigger, null, () => [\n h(\n Button,\n { ...outlineButton(isDisabled), \"aria-label\": texts(\"settings\") },\n () => [\n h(Text, null, () => texts(`settings.viewMode.${selected}`)),\n h(IconView),\n ],\n ),\n h(ContextMenu, { selectionMode: \"single\", selectedKeys: [selected] }, () =>\n modes.map((mode) =>\n h(\n MenuItem,\n { key: mode, id: mode, onAction: () => list.viewMode.set(mode) },\n () => texts(`settings.viewMode.${mode}`),\n ),\n ),\n ),\n ]);\n};\n\nconst renderSortingMenu = (\n list: AnyListModel,\n texts: ListTextFormatter,\n isDisabled: boolean,\n): VNodeChild => {\n const sortings = list.visibleSorting as HeaderSorting[];\n\n if (sortings.length === 0) {\n return null;\n }\n\n const active = sortings.find((s) => s.isSorted());\n\n return h(ContextMenuTrigger, null, () => [\n h(Button, outlineButton(isDisabled), () => [\n h(Text, null, () =>\n active ? (active.name ?? String(active.property)) : texts(\"sorting\"),\n ),\n h(\n active\n ? active.direction === \"asc\"\n ? IconAscending\n : IconDescending\n : IconSorting,\n ),\n ]),\n h(\n ContextMenu,\n {\n selectionMode: \"single\",\n selectedKeys: active ? [active.id] : [],\n },\n () =>\n sortings.map((sorting) =>\n h(\n MenuItem,\n {\n key: sorting.id,\n id: sorting.id,\n onAction: () => sorting.enable(),\n },\n () =>\n `${sorting.name ?? String(sorting.property)} ${sorting.directionName ?? \"\"}`.trim(),\n ),\n ),\n ),\n ]);\n};\n\n/**\n * A date-range filter is a calendar in a popover, not a menu of values — or,\n * with `granularity: \"minute\"`, date and time fields.\n *\n * The same shape Flow's React list gives it — the calendar closes the popover\n * when a range is picked, because a range is complete the moment its second end\n * is. The fields leave it open: they apply as they are typed.\n */\nconst renderDateRangeFilter = (\n filter: HeaderDateRangeFilter,\n isDisabled: boolean,\n calendarLabel: string,\n controller: OverlayController,\n): VNodeChild =>\n h(PopoverTrigger, { key: filter.storageKey, controller }, () => [\n h(Button, outlineButton(isDisabled), () => [\n h(Text, null, () => filter.name ?? String(filter.property)),\n h(IconFilter),\n ]),\n h(\n Popover,\n {\n placement: \"bottom end\",\n isDialogContent: true,\n \"aria-label\": calendarLabel,\n },\n () =>\n filter.granularity === \"minute\"\n ? h(DateTimeRangeFields, {\n filter,\n class: dateTimeRangeStyles.popover,\n })\n : /*\n * Cast at the call, because the options are whatever the consumer\n * handed the filter: an open record does not match a typed\n * component's props, and TypeScript then resolves `h` to its\n * instance overload.\n */\n h(RangeCalendar, {\n ...filter.rangeCalendarProps,\n class: dateTimeRangeStyles.calendar,\n value: filter.getValue(),\n onChange: (range: ListDateRange) => {\n filter.setValue(range);\n controller.close();\n },\n } as never),\n ),\n ]);\n\nconst renderFilterMenu = (\n filter: HeaderFilter,\n isDisabled: boolean,\n): VNodeChild => {\n const selectionMode = filter.mode === \"one\" ? \"single\" : \"multiple\";\n const values = filter.values;\n\n return h(ContextMenuTrigger, { key: filter.storageKey }, () => [\n h(Button, outlineButton(isDisabled), () => [\n h(Text, null, () => filter.name ?? String(filter.property)),\n h(IconFilter),\n ]),\n h(\n ContextMenu,\n {\n selectionMode,\n selectedKeys: values.filter((v) => v.isActive).map((v) => v.id),\n /*\n * Flow's: a multiple-choice menu reports its whole selection, and the\n * \"Select all\" entry the host adds reports it as `\"all\"`.\n */\n onSelectionChange:\n selectionMode === \"multiple\"\n ? (keys: unknown) =>\n keys === \"all\"\n ? filter.selectAll()\n : filter.setActiveValueIds(keys as Iterable<unknown>)\n : undefined,\n showSelectAll: filter.isSelectAllAvailable,\n },\n () =>\n values.map((value) =>\n h(\n MenuItem,\n {\n key: value.id,\n id: value.id,\n /* A multiple choice goes through `onSelectionChange`. */\n onAction: () => {\n if (selectionMode === \"single\" && !value.isActive) {\n value.toggle();\n }\n },\n },\n () => value.render(),\n ),\n ),\n ),\n ]);\n};\n\n/**\n * The list's controls: layout, sorting, filters, search — plus the app's own\n * `ActionGroup`, which the `List` hands over as the `actions` slot.\n *\n * Each one is a remote element the host materialises — a context menu trigger\n * with a button and a menu — and what they act on is the shared model, so a\n * filter behaves here exactly as it does in React.\n */\nexport const Header = defineComponent({\n name: \"ListHeader\",\n\n setup(_props, { slots }) {\n const list = injectListModel();\n const texts = useListTexts();\n\n const isEmpty = watchMobxValue(() => list.isEmpty);\n const isInitiallyLoading = watchMobxValue(\n () => list.loaderState.isInitiallyLoading,\n );\n const emptyViewType = watchMobxValue(() => list.getEmptyViewType());\n const viewMode = watchMobxValue(() => list.viewMode.value);\n /* Filters and sortings read the table, so they follow its revision. */\n const tableRevision = watchMobxValue(() => list.listTable.revision);\n const renderShape = watchMobxValue(() => list.renderShape);\n\n /*\n * One controller per date filter, kept for as long as the header is.\n * Created in the render it would be a new one every time — and a range\n * takes two clicks, so the popover would forget the first between them.\n */\n const dateControllers = new Map<string, OverlayController>();\n const dateController = (key: string): OverlayController => {\n const existing = dateControllers.get(key);\n if (existing) {\n return existing;\n }\n const created = createOverlayController();\n dateControllers.set(key, created);\n return created;\n };\n\n /*\n * Flow's `DefaultSearchFieldRender`: the field holds what is typed, and a\n * search is submitted after a pause — or, with `autoSubmit={false}`, on\n * Enter. Escape and the clear button clear at once.\n */\n const searchShape = list.shape.search;\n const autoSubmit = searchShape?.autoSubmit !== false;\n const searchInput = ref(list.search?.value ?? \"\");\n let previousSearch = \"\";\n let submitTimeout: ReturnType<typeof setTimeout> | undefined;\n\n const submitSearch = () => {\n if (searchInput.value.trim() === \"\") {\n list.search?.setValue(undefined);\n } else if (previousSearch !== searchInput.value) {\n previousSearch = searchInput.value;\n list.search?.setValue(searchInput.value);\n }\n };\n\n const clearSearch = () => {\n clearTimeout(submitTimeout);\n list.search?.setValue(undefined);\n searchInput.value = \"\";\n };\n\n watch(searchInput, () => {\n clearTimeout(submitTimeout);\n if (autoSubmit) {\n submitTimeout = setTimeout(submitSearch, autoSubmitTimeout);\n }\n });\n\n /* A search set from outside the field — a reset — shows in it. */\n const searchValue = watchMobxValue(() => {\n void list.listTable.revision;\n return list.search?.value;\n });\n watch(searchValue, (value) => {\n searchInput.value = value ?? \"\";\n });\n\n const onSearchKeyUp = (event: { key?: string } | undefined) => {\n if (event?.key === \"Enter\" && !autoSubmit) {\n submitSearch();\n } else if (event?.key === \"Escape\") {\n clearSearch();\n }\n };\n\n onBeforeUnmount(() => clearTimeout(submitTimeout));\n\n return () => {\n void tableRevision.value;\n\n const noItemsAvailable = isEmpty.value && emptyViewType.value === \"list\";\n const isDisabled = isInitiallyLoading.value || noItemsAvailable;\n const modes = availableViewModes(renderShape.value);\n\n const actions = slots.actions?.();\n\n /*\n * The header is rendered even with nothing in it, because Flow's is: it\n * holds the app's own `ActionGroup`, and a list that gained one would\n * otherwise change the DOM around it.\n *\n * Asked of the model rather than of what the options rendered — the\n * all-filters modal decides for itself whether it has anything to show.\n */\n const hasOptions =\n list.filters.length > 0 ||\n list.visibleSorting.length > 0 ||\n !!list.search ||\n modes.length > 1;\n\n /*\n * Nothing to show yet and nothing to configure it with: Flow hides the\n * header rather than dropping it, so what an app put in it keeps its\n * state across the switch to and from the empty view.\n */\n if (noItemsAvailable) {\n return h(\n Div,\n { class: listStyles.hideVisuallyActions, \"aria-hidden\": true },\n /*\n * Same nesting and same classes as the branch below, which is what\n * Flow's comment on this branch asks for — the tunnel's content has\n * to survive the switch. React arrives at the inner class by reusing\n * the element rather than by setting it: a `className` that goes from\n * set to undefined never reaches the host, so the previous one stays.\n *\n * `[actions, null]`, not `actions`: Vue wraps a nested array in a\n * fragment, so only the same array shape keeps the actions at the\n * same position in the same fragment — anything else remounts them,\n * and a modal open from the header closes.\n */\n () =>\n h(Div, { class: listStyles.headerContent }, () => [actions, null]),\n );\n }\n\n const options: VNodeChild[] = [\n renderViewModeMenu(\n list,\n modes,\n texts.value,\n isDisabled,\n viewMode.value,\n ),\n renderSortingMenu(list, texts.value, isDisabled),\n /*\n * Primary only. A secondary filter is reachable through the\n * all-filters modal, which is the whole reason that modal shows on\n * desktop at all.\n */\n ...(list.filters as HeaderFilter[])\n .filter((filter) => filter.priority === \"primary\")\n .map((filter) =>\n isDateRangeFilter(filter)\n ? renderDateRangeFilter(\n filter as unknown as HeaderDateRangeFilter,\n isDisabled,\n texts.value(\"dateRange\"),\n dateController(filter.storageKey),\n )\n : renderFilterMenu(filter, isDisabled),\n ),\n h(AllFiltersModal, { isDisabled, viewModes: modes }),\n list.search\n ? h(SearchField, {\n /* autoFocus acts on mount only — remount once enabled. */\n key: isDisabled ? \"disabled\" : \"enabled\",\n class: listStyles.searchField,\n isDisabled,\n autoFocus: searchShape?.autoFocus,\n value: searchInput.value,\n onChange: (value: string) => {\n searchInput.value = value;\n },\n onKeyUp: onSearchKeyUp,\n onClear: clearSearch,\n })\n : null,\n ];\n\n return h(\n Div,\n {\n class: [\n listStyles.header,\n list.search ? listStyles.headerWithSearch : undefined,\n ]\n .filter(Boolean)\n .join(\" \"),\n },\n () => [\n h(Div, { class: listStyles.headerContent }, () => [\n actions,\n hasOptions\n ? h(Div, { class: listStyles.headerOptions }, () => options)\n : null,\n ]),\n h(ActiveFilters, { isDisabled }),\n ],\n );\n };\n },\n});\n\ncomposition(Header);\n\nexport default Header;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAM,oBAAoB;AAkD1B,IAAM,sBAAsB,UAA8C;CACxE,MAAM,QAAoB,CAAC;CAC3B,IAAI,MAAM,UAAU,UAClB,MAAM,KAAK,MAAM;CAEnB,IAAI,MAAM,OACR,MAAM,KAAK,OAAO;CAEpB,IAAI,MAAM,UAAU,WAClB,MAAM,KAAK,OAAO;CAEpB,OAAO;AACT;AAEA,IAAM,iBAAiB,gBAAyB;CAC9C,S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AAW,mBAAmB,KAAA,CAC9C,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,EACb,SACM,CACJ,EAAE,KAAK,EAAE,OAAO,WAAW,cAAc,SAAS,CAChD,SACA,aACI,EAAE,KAAK,EAAE,OAAO,WAAW,cAAc,SAAS,OAAO,IACzD,IACN,CAAC,GACD,EAAE,eAAe,EAAE,WAAW,CAAC,CACjC,CACF;EACF;CACF;AACF,CAAC;AAED,YAAY,MAAM"}
|
|
@@ -4,7 +4,7 @@ import watchMobxValue from "../lib/mobxSelector.mjs";
|
|
|
4
4
|
import { injectListModel } from "./listContext.mjs";
|
|
5
5
|
import { provideItemAccordion } from "./itemContext.mjs";
|
|
6
6
|
import { computed, defineComponent, h, ref, useId } from "vue";
|
|
7
|
-
|
|
7
|
+
// src/list/Item.ts
|
|
8
8
|
/**
|
|
9
9
|
* One item of the list.
|
|
10
10
|
*
|
|
@@ -58,7 +58,6 @@ var ListItemRow = defineComponent({
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
composition(ListItemRow);
|
|
61
|
-
//#endregion
|
|
62
61
|
export { ListItemRow, ListItemRow as default };
|
|
63
62
|
|
|
64
63
|
//# sourceMappingURL=Item.mjs.map
|
|
@@ -13,7 +13,7 @@ import { injectListModel } from "./listContext.mjs";
|
|
|
13
13
|
import { className, listStyles } from "./styles.mjs";
|
|
14
14
|
import { ListItemRow } from "./Item.mjs";
|
|
15
15
|
import { defineComponent, h } from "vue";
|
|
16
|
-
|
|
16
|
+
// src/list/Items.ts
|
|
17
17
|
/**
|
|
18
18
|
* The list's items, as a grid list.
|
|
19
19
|
*
|
|
@@ -65,7 +65,6 @@ var Items = defineComponent({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
composition(Items);
|
|
68
|
-
//#endregion
|
|
69
68
|
export { Items, Items as default };
|
|
70
69
|
|
|
71
70
|
//# sourceMappingURL=Items.mjs.map
|
|
@@ -20,7 +20,7 @@ import { ListModel } from "./model.mjs";
|
|
|
20
20
|
import { useListSettings } from "./settings.mjs";
|
|
21
21
|
import { ListFilter, ListItem, ListLoaderAsync, ListLoaderComposable, ListSearch, ListSorting, ListStaticData, ListTable, ListTableBody, ListTableCell, ListTableColumn, ListTableHeader, ListTableRow, findSetup, findSetups, isListSetupComponent } from "./setupComponents.mjs";
|
|
22
22
|
import { computed, defineComponent, h, onBeforeUnmount, onMounted, watch } from "vue";
|
|
23
|
-
|
|
23
|
+
// src/list/List.ts
|
|
24
24
|
var passesContextOn = /* @__PURE__ */ new Set([
|
|
25
25
|
Action,
|
|
26
26
|
ModalTrigger,
|
|
@@ -286,7 +286,6 @@ var List = defineComponent({
|
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
288
|
composition(List);
|
|
289
|
-
//#endregion
|
|
290
289
|
export { List, List as default };
|
|
291
290
|
|
|
292
291
|
//# sourceMappingURL=List.mjs.map
|
|
@@ -22,7 +22,7 @@ import { itemViewStyles, listStyles } from "./styles.mjs";
|
|
|
22
22
|
import { ModalTrigger, PopoverTrigger } from "../overlays/triggers.mjs";
|
|
23
23
|
import { injectItemAccordion } from "./itemContext.mjs";
|
|
24
24
|
import { Fragment, cloneVNode, defineComponent, h } from "vue";
|
|
25
|
-
|
|
25
|
+
// src/list/ListItemView.ts
|
|
26
26
|
var overlayTriggers = /* @__PURE__ */ new Set([
|
|
27
27
|
ContextMenuTrigger,
|
|
28
28
|
ContextualHelpTrigger,
|
|
@@ -134,7 +134,6 @@ var ListItemView = defineComponent({
|
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
composition(ListItemView);
|
|
137
|
-
//#endregion
|
|
138
137
|
export { ListItemView, ListItemView as default };
|
|
139
138
|
|
|
140
139
|
//# sourceMappingURL=ListItemView.mjs.map
|
|
@@ -10,7 +10,7 @@ import watchMobxValue from "../lib/mobxSelector.mjs";
|
|
|
10
10
|
import { injectListModel } from "./listContext.mjs";
|
|
11
11
|
import { className } from "./styles.mjs";
|
|
12
12
|
import { defineComponent, h } from "vue";
|
|
13
|
-
|
|
13
|
+
// src/list/Table.ts
|
|
14
14
|
var tableStyles = {
|
|
15
15
|
table: "flow--list--table",
|
|
16
16
|
isLoading: "flow--list--table--is-loading",
|
|
@@ -72,7 +72,6 @@ var ListTableView = defineComponent({
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
composition(ListTableView);
|
|
75
|
-
//#endregion
|
|
76
75
|
export { ListTableView, ListTableView as default };
|
|
77
76
|
|
|
78
77
|
//# sourceMappingURL=Table.mjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ListDateRangeFilter } from "../../../components-base/src/list/filter/ListDateRangeFilter.mjs";
|
|
2
2
|
import "../../../components-base/src/index.mjs";
|
|
3
|
-
|
|
3
|
+
// src/list/dateRangeFilter.ts
|
|
4
4
|
/**
|
|
5
|
-
* A date-range filter, with the options its
|
|
5
|
+
* A date-range filter, with the options its fields take.
|
|
6
6
|
*
|
|
7
7
|
* The column, the comparison and the stored value are the shared
|
|
8
8
|
* `ListDateRangeFilter`, so a Vue list and a React list filter the same dates
|
|
9
|
-
* the same way. What a binding adds is only what its
|
|
9
|
+
* the same way. What a binding adds is only what its fields accept.
|
|
10
10
|
*/
|
|
11
11
|
var DateRangeFilter = class extends ListDateRangeFilter {
|
|
12
12
|
/** Handed to the `RangeCalendar` — a minimum date, unavailable days, … */
|
|
@@ -15,13 +15,20 @@ var DateRangeFilter = class extends ListDateRangeFilter {
|
|
|
15
15
|
super(context, shape);
|
|
16
16
|
this.dateRangeOptions = shape.dateRangeOptions;
|
|
17
17
|
}
|
|
18
|
+
get granularity() {
|
|
19
|
+
return this.dateRangeOptions?.granularity === "minute" ? "minute" : "day";
|
|
20
|
+
}
|
|
21
|
+
get rangeCalendarProps() {
|
|
22
|
+
if (this.granularity === "minute") return {};
|
|
23
|
+
const { granularity, ...props } = this.dateRangeOptions ?? {};
|
|
24
|
+
return props;
|
|
25
|
+
}
|
|
26
|
+
get dateTimeRangeLimits() {
|
|
27
|
+
return this.granularity === "minute" ? this.dateRangeOptions : void 0;
|
|
28
|
+
}
|
|
18
29
|
};
|
|
19
30
|
/** Whether a filter is one of these, without reaching for the class. */
|
|
20
31
|
var isDateRangeFilter = (filter) => filter.mode === "dateRange";
|
|
21
|
-
|
|
22
|
-
var formatDate = (date) => new Date(date.year, date.month - 1, date.day).toLocaleDateString();
|
|
23
|
-
var formatDateRange = (range) => [range.start, range.end].map((date) => date ? formatDate(date) : "").join(" - ");
|
|
24
|
-
//#endregion
|
|
25
|
-
export { DateRangeFilter, formatDate, formatDateRange, isDateRangeFilter };
|
|
32
|
+
export { DateRangeFilter, isDateRangeFilter };
|
|
26
33
|
|
|
27
34
|
//# sourceMappingURL=dateRangeFilter.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangeFilter.mjs","names":[],"sources":["../../../../../src/list/dateRangeFilter.ts"],"sourcesContent":["import { ListDateRangeFilter } from \"@mittwald/flow-components-base\";\nimport type {\n
|
|
1
|
+
{"version":3,"file":"dateRangeFilter.mjs","names":[],"sources":["../../../../../src/list/dateRangeFilter.ts"],"sourcesContent":["import { ListDateRangeFilter } from \"@mittwald/flow-components-base\";\nimport type {\n ListDateTimeRangeLimits,\n ListModelContext,\n} from \"@mittwald/flow-components-base\";\nimport type { ListRendered, VueListFilterShape } from \"./types\";\n\n/**\n * A date-range filter, with the options its fields take.\n *\n * The column, the comparison and the stored value are the shared\n * `ListDateRangeFilter`, so a Vue list and a React list filter the same dates\n * the same way. What a binding adds is only what its fields accept.\n */\nexport class DateRangeFilter<T = never> extends ListDateRangeFilter<\n T,\n never,\n ListRendered\n> {\n /** Handed to the `RangeCalendar` — a minimum date, unavailable days, … */\n public readonly dateRangeOptions?: Record<string, unknown>;\n\n public constructor(\n context: ListModelContext<T>,\n shape: VueListFilterShape<T>,\n ) {\n super(context, shape as never);\n this.dateRangeOptions = (\n shape as { dateRangeOptions?: Record<string, unknown> }\n ).dateRangeOptions;\n }\n\n public get granularity(): \"day\" | \"minute\" {\n return this.dateRangeOptions?.granularity === \"minute\" ? \"minute\" : \"day\";\n }\n\n public get rangeCalendarProps(): Record<string, unknown> {\n if (this.granularity === \"minute\") {\n return {};\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { granularity, ...props } = this.dateRangeOptions ?? {};\n return props;\n }\n\n public get dateTimeRangeLimits(): ListDateTimeRangeLimits | undefined {\n return this.granularity === \"minute\"\n ? (this.dateRangeOptions as ListDateTimeRangeLimits)\n : undefined;\n }\n}\n\n/** Whether a filter is one of these, without reaching for the class. */\nexport const isDateRangeFilter = (filter: {\n readonly mode: string;\n}): filter is DateRangeFilter<never> => filter.mode === \"dateRange\";\n"],"mappings":";;;;;;;;;;AAcA,IAAa,kBAAb,cAAgD,oBAI9C;;CAEA;CAEA,YACE,SACA,OACA;EACA,MAAM,SAAS,KAAc;EAC7B,KAAK,mBACH,MACA;CACJ;CAEA,IAAW,cAAgC;EACzC,OAAO,KAAK,kBAAkB,gBAAgB,WAAW,WAAW;CACtE;CAEA,IAAW,qBAA8C;EACvD,IAAI,KAAK,gBAAgB,UACvB,OAAO,CAAC;EAGV,MAAM,EAAE,aAAa,GAAG,UAAU,KAAK,oBAAoB,CAAC;EAC5D,OAAO;CACT;CAEA,IAAW,sBAA2D;EACpE,OAAO,KAAK,gBAAgB,WACvB,KAAK,mBACN,KAAA;CACN;AACF;;AAGA,IAAa,qBAAqB,WAEM,OAAO,SAAS"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { inject, provide } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/list/itemContext.ts
|
|
3
3
|
var key = Symbol("flowListItemAccordion");
|
|
4
4
|
var provideItemAccordion = (accordion) => provide(key, accordion);
|
|
5
5
|
/** `undefined` outside a list item. */
|
|
6
6
|
var injectItemAccordion = () => inject(key, void 0);
|
|
7
|
-
//#endregion
|
|
8
7
|
export { injectItemAccordion, provideItemAccordion };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=itemContext.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inject, provide } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/list/listContext.ts
|
|
3
3
|
var listModelKey = Symbol("flowListModel");
|
|
4
4
|
var provideListModel = (model) => provide(listModelKey, model);
|
|
5
5
|
var injectListModel = () => {
|
|
@@ -7,7 +7,6 @@ var injectListModel = () => {
|
|
|
7
7
|
if (!model) throw new Error("This component must be used inside a <List />.");
|
|
8
8
|
return model;
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { injectListModel, provideListModel };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=listContext.mjs.map
|