@mittwald/flow-remote-vue-components 1.6.0-next.7 → 1.6.0-next.70

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.
Files changed (446) hide show
  1. package/README.md +2 -2
  2. package/USAGE.md +6 -0
  3. package/dist/js/RemoteRoot.mjs +17 -5
  4. package/dist/js/RemoteRoot.mjs.map +1 -1
  5. package/dist/js/components-base/src/action/ActionState.mjs +1 -2
  6. package/dist/js/components-base/src/index.mjs +5 -2
  7. package/dist/js/components-base/src/lib/array.mjs +1 -2
  8. package/dist/js/components-base/src/list/ListModelContext.mjs +1 -2
  9. package/dist/js/components-base/src/list/filter/ListDateRangeFilter.mjs +2 -2
  10. package/dist/js/components-base/src/list/filter/ListDateRangeFilter.mjs.map +1 -1
  11. package/dist/js/components-base/src/list/filter/ListFilter.mjs +5 -3
  12. package/dist/js/components-base/src/list/filter/ListFilter.mjs.map +1 -1
  13. package/dist/js/components-base/src/list/filter/ListFilterValue.mjs +1 -2
  14. package/dist/js/components-base/src/list/filter/dateRange.mjs +38 -15
  15. package/dist/js/components-base/src/list/filter/dateRange.mjs.map +1 -1
  16. package/dist/js/components-base/src/list/filter/dateTimeRangeFields.mjs +52 -0
  17. package/dist/js/components-base/src/list/filter/dateTimeRangeFields.mjs.map +1 -0
  18. package/dist/js/components-base/src/list/filter/formatDateRange.mjs +24 -0
  19. package/dist/js/components-base/src/list/filter/formatDateRange.mjs.map +1 -0
  20. package/dist/js/components-base/src/list/item/ListItem.mjs +1 -2
  21. package/dist/js/components-base/src/list/item/ListItemCollection.mjs +1 -2
  22. package/dist/js/components-base/src/list/loading/ListLoaderState.mjs +11 -7
  23. package/dist/js/components-base/src/list/loading/ListLoaderState.mjs.map +1 -1
  24. package/dist/js/components-base/src/list/loading/types.mjs +1 -2
  25. package/dist/js/components-base/src/list/pagination/ListBatchesController.mjs +1 -2
  26. package/dist/js/components-base/src/list/search/ListSearch.mjs +1 -2
  27. package/dist/js/components-base/src/list/sorting/ListSorting.mjs +1 -2
  28. package/dist/js/components-base/src/list/table/ListTable.mjs +1 -2
  29. package/dist/js/components-base/src/list/viewMode/ListViewMode.mjs +1 -2
  30. package/dist/js/components-base/src/overlay/OverlayState.mjs +193 -0
  31. package/dist/js/components-base/src/overlay/OverlayState.mjs.map +1 -0
  32. package/dist/js/index.mjs +3 -1
  33. package/dist/js/remote-vue-components/src/auto-generated/AccentBox.mjs +1 -2
  34. package/dist/js/remote-vue-components/src/auto-generated/Accordion.mjs +1 -2
  35. package/dist/js/remote-vue-components/src/auto-generated/AccordionGroup.mjs +1 -2
  36. package/dist/js/remote-vue-components/src/auto-generated/ActionGroup.mjs +1 -2
  37. package/dist/js/remote-vue-components/src/auto-generated/Alert.mjs +1 -2
  38. package/dist/js/remote-vue-components/src/auto-generated/AlertBadge.mjs +1 -2
  39. package/dist/js/remote-vue-components/src/auto-generated/AlertIcon.mjs +1 -2
  40. package/dist/js/remote-vue-components/src/auto-generated/AlertText.mjs +1 -2
  41. package/dist/js/remote-vue-components/src/auto-generated/Align.mjs +1 -2
  42. package/dist/js/remote-vue-components/src/auto-generated/Area.mjs +1 -2
  43. package/dist/js/remote-vue-components/src/auto-generated/Autocomplete.mjs +1 -2
  44. package/dist/js/remote-vue-components/src/auto-generated/Avatar.mjs +1 -2
  45. package/dist/js/remote-vue-components/src/auto-generated/AvatarStack.mjs +1 -2
  46. package/dist/js/remote-vue-components/src/auto-generated/Badge.mjs +1 -2
  47. package/dist/js/remote-vue-components/src/auto-generated/Bar.mjs +1 -2
  48. package/dist/js/remote-vue-components/src/auto-generated/BigNumber.mjs +1 -2
  49. package/dist/js/remote-vue-components/src/auto-generated/Breadcrumb.mjs +3 -3
  50. package/dist/js/remote-vue-components/src/auto-generated/Breadcrumb.mjs.map +1 -1
  51. package/dist/js/remote-vue-components/src/auto-generated/Button.mjs +2 -2
  52. package/dist/js/remote-vue-components/src/auto-generated/Button.mjs.map +1 -1
  53. package/dist/js/remote-vue-components/src/auto-generated/CartesianChart.mjs +1 -2
  54. package/dist/js/remote-vue-components/src/auto-generated/CartesianGrid.mjs +1 -2
  55. package/dist/js/remote-vue-components/src/auto-generated/ChartGrid.mjs +1 -2
  56. package/dist/js/remote-vue-components/src/auto-generated/ChartLegend.mjs +1 -2
  57. package/dist/js/remote-vue-components/src/auto-generated/ChartTooltip.mjs +1 -2
  58. package/dist/js/remote-vue-components/src/auto-generated/Chat.mjs +1 -2
  59. package/dist/js/remote-vue-components/src/auto-generated/Checkbox.mjs +3 -3
  60. package/dist/js/remote-vue-components/src/auto-generated/Checkbox.mjs.map +1 -1
  61. package/dist/js/remote-vue-components/src/auto-generated/CheckboxButton.mjs +3 -3
  62. package/dist/js/remote-vue-components/src/auto-generated/CheckboxButton.mjs.map +1 -1
  63. package/dist/js/remote-vue-components/src/auto-generated/CheckboxGroup.mjs +3 -3
  64. package/dist/js/remote-vue-components/src/auto-generated/CheckboxGroup.mjs.map +1 -1
  65. package/dist/js/remote-vue-components/src/auto-generated/ClearPropsContext.mjs +1 -2
  66. package/dist/js/remote-vue-components/src/auto-generated/CoachMark.mjs +3 -3
  67. package/dist/js/remote-vue-components/src/auto-generated/CoachMark.mjs.map +1 -1
  68. package/dist/js/remote-vue-components/src/auto-generated/CodeBlock.mjs +1 -2
  69. package/dist/js/remote-vue-components/src/auto-generated/CodeEditor.mjs +1 -2
  70. package/dist/js/remote-vue-components/src/auto-generated/Color.mjs +1 -2
  71. package/dist/js/remote-vue-components/src/auto-generated/ColumnLayout.mjs +1 -2
  72. package/dist/js/remote-vue-components/src/auto-generated/Combine.mjs +1 -2
  73. package/dist/js/remote-vue-components/src/auto-generated/ComboBox.mjs +3 -3
  74. package/dist/js/remote-vue-components/src/auto-generated/ComboBox.mjs.map +1 -1
  75. package/dist/js/remote-vue-components/src/auto-generated/ComponentPropsContextProvider.mjs +1 -2
  76. package/dist/js/remote-vue-components/src/auto-generated/Content.mjs +1 -2
  77. package/dist/js/remote-vue-components/src/auto-generated/ContextMenu.mjs +3 -3
  78. package/dist/js/remote-vue-components/src/auto-generated/ContextMenu.mjs.map +1 -1
  79. package/dist/js/remote-vue-components/src/auto-generated/ContextMenuContent.mjs +3 -3
  80. package/dist/js/remote-vue-components/src/auto-generated/ContextMenuContent.mjs.map +1 -1
  81. package/dist/js/remote-vue-components/src/auto-generated/ContextMenuSection.mjs +1 -2
  82. package/dist/js/remote-vue-components/src/auto-generated/ContextMenuTrigger.mjs +1 -2
  83. package/dist/js/remote-vue-components/src/auto-generated/ContextualHelp.mjs +3 -3
  84. package/dist/js/remote-vue-components/src/auto-generated/ContextualHelp.mjs.map +1 -1
  85. package/dist/js/remote-vue-components/src/auto-generated/ContextualHelpTrigger.mjs +1 -2
  86. package/dist/js/remote-vue-components/src/auto-generated/CopyButton.mjs +2 -2
  87. package/dist/js/remote-vue-components/src/auto-generated/CopyButton.mjs.map +1 -1
  88. package/dist/js/remote-vue-components/src/auto-generated/CounterBadge.mjs +1 -2
  89. package/dist/js/remote-vue-components/src/auto-generated/DatePicker.mjs +3 -3
  90. package/dist/js/remote-vue-components/src/auto-generated/DatePicker.mjs.map +1 -1
  91. package/dist/js/remote-vue-components/src/auto-generated/DateRangePicker.mjs +2 -2
  92. package/dist/js/remote-vue-components/src/auto-generated/DateRangePicker.mjs.map +1 -1
  93. package/dist/js/remote-vue-components/src/auto-generated/DialogTrigger.mjs +1 -2
  94. package/dist/js/remote-vue-components/src/auto-generated/Div.mjs +1 -2
  95. package/dist/js/remote-vue-components/src/auto-generated/DonutChart.mjs +3 -3
  96. package/dist/js/remote-vue-components/src/auto-generated/DonutChart.mjs.map +1 -1
  97. package/dist/js/remote-vue-components/src/auto-generated/FieldDescription.mjs +1 -2
  98. package/dist/js/remote-vue-components/src/auto-generated/FieldError.mjs +3 -3
  99. package/dist/js/remote-vue-components/src/auto-generated/FieldError.mjs.map +1 -1
  100. package/dist/js/remote-vue-components/src/auto-generated/FileCard.mjs +1 -2
  101. package/dist/js/remote-vue-components/src/auto-generated/FileCardList.mjs +1 -2
  102. package/dist/js/remote-vue-components/src/auto-generated/FileDropZone.mjs +1 -2
  103. package/dist/js/remote-vue-components/src/auto-generated/FileField.mjs +1 -2
  104. package/dist/js/remote-vue-components/src/auto-generated/Flex.mjs +1 -2
  105. package/dist/js/remote-vue-components/src/auto-generated/Header.mjs +1 -2
  106. package/dist/js/remote-vue-components/src/auto-generated/HeaderNavigation.mjs +1 -2
  107. package/dist/js/remote-vue-components/src/auto-generated/Heading.mjs +1 -2
  108. package/dist/js/remote-vue-components/src/auto-generated/Icon.mjs +1 -2
  109. package/dist/js/remote-vue-components/src/auto-generated/IllustratedMessage.mjs +1 -2
  110. package/dist/js/remote-vue-components/src/auto-generated/Image.mjs +1 -2
  111. package/dist/js/remote-vue-components/src/auto-generated/ImageCropper.mjs +1 -2
  112. package/dist/js/remote-vue-components/src/auto-generated/Initials.mjs +1 -2
  113. package/dist/js/remote-vue-components/src/auto-generated/InlineCode.mjs +1 -2
  114. package/dist/js/remote-vue-components/src/auto-generated/ItemsGridList.mjs +3 -3
  115. package/dist/js/remote-vue-components/src/auto-generated/ItemsGridList.mjs.map +1 -1
  116. package/dist/js/remote-vue-components/src/auto-generated/ItemsGridListItem.mjs +3 -3
  117. package/dist/js/remote-vue-components/src/auto-generated/ItemsGridListItem.mjs.map +1 -1
  118. package/dist/js/remote-vue-components/src/auto-generated/Kbd.mjs +1 -2
  119. package/dist/js/remote-vue-components/src/auto-generated/Label.mjs +1 -2
  120. package/dist/js/remote-vue-components/src/auto-generated/LabeledValue.mjs +1 -2
  121. package/dist/js/remote-vue-components/src/auto-generated/LayoutCard.mjs +1 -2
  122. package/dist/js/remote-vue-components/src/auto-generated/Legend.mjs +1 -2
  123. package/dist/js/remote-vue-components/src/auto-generated/LightBoxGallery.mjs +1 -2
  124. package/dist/js/remote-vue-components/src/auto-generated/LightBoxGalleryItem.mjs +2 -3
  125. package/dist/js/remote-vue-components/src/auto-generated/LightBoxGalleryItem.mjs.map +1 -1
  126. package/dist/js/remote-vue-components/src/auto-generated/LightBoxZoom.mjs +7 -0
  127. package/dist/js/remote-vue-components/src/auto-generated/LightBoxZoom.mjs.map +1 -0
  128. package/dist/js/remote-vue-components/src/auto-generated/Line.mjs +1 -2
  129. package/dist/js/remote-vue-components/src/auto-generated/Link.mjs +2 -2
  130. package/dist/js/remote-vue-components/src/auto-generated/Link.mjs.map +1 -1
  131. package/dist/js/remote-vue-components/src/auto-generated/ListEmptyView.mjs +1 -2
  132. package/dist/js/remote-vue-components/src/auto-generated/ListEmptyViewContainer.mjs +1 -2
  133. package/dist/js/remote-vue-components/src/auto-generated/ListItemViewContent.mjs +1 -2
  134. package/dist/js/remote-vue-components/src/auto-generated/ListSummary.mjs +1 -2
  135. package/dist/js/remote-vue-components/src/auto-generated/LoadingSpinner.mjs +1 -2
  136. package/dist/js/remote-vue-components/src/auto-generated/Markdown.mjs +6 -3
  137. package/dist/js/remote-vue-components/src/auto-generated/Markdown.mjs.map +1 -1
  138. package/dist/js/remote-vue-components/src/auto-generated/MarkdownEditor.mjs +4 -3
  139. package/dist/js/remote-vue-components/src/auto-generated/MarkdownEditor.mjs.map +1 -1
  140. package/dist/js/remote-vue-components/src/auto-generated/MenuItem.mjs +3 -3
  141. package/dist/js/remote-vue-components/src/auto-generated/MenuItem.mjs.map +1 -1
  142. package/dist/js/remote-vue-components/src/auto-generated/MenuTrigger.mjs +1 -2
  143. package/dist/js/remote-vue-components/src/auto-generated/Message.mjs +1 -2
  144. package/dist/js/remote-vue-components/src/auto-generated/MessageSeparator.mjs +1 -2
  145. package/dist/js/remote-vue-components/src/auto-generated/MessageThread.mjs +1 -2
  146. package/dist/js/remote-vue-components/src/auto-generated/Navigation.mjs +1 -2
  147. package/dist/js/remote-vue-components/src/auto-generated/NavigationGroup.mjs +1 -2
  148. package/dist/js/remote-vue-components/src/auto-generated/Notification.mjs +1 -2
  149. package/dist/js/remote-vue-components/src/auto-generated/NumberField.mjs +3 -3
  150. package/dist/js/remote-vue-components/src/auto-generated/NumberField.mjs.map +1 -1
  151. package/dist/js/remote-vue-components/src/auto-generated/Option.mjs +3 -3
  152. package/dist/js/remote-vue-components/src/auto-generated/Option.mjs.map +1 -1
  153. package/dist/js/remote-vue-components/src/auto-generated/OverlayContent.mjs +1 -2
  154. package/dist/js/remote-vue-components/src/auto-generated/PasswordCreationField.mjs +3 -3
  155. package/dist/js/remote-vue-components/src/auto-generated/PasswordCreationField.mjs.map +1 -1
  156. package/dist/js/remote-vue-components/src/auto-generated/PopoverContent.mjs +1 -2
  157. package/dist/js/remote-vue-components/src/auto-generated/ProgressBar.mjs +3 -3
  158. package/dist/js/remote-vue-components/src/auto-generated/ProgressBar.mjs.map +1 -1
  159. package/dist/js/remote-vue-components/src/auto-generated/Radio.mjs +3 -3
  160. package/dist/js/remote-vue-components/src/auto-generated/Radio.mjs.map +1 -1
  161. package/dist/js/remote-vue-components/src/auto-generated/RadioButton.mjs +3 -3
  162. package/dist/js/remote-vue-components/src/auto-generated/RadioButton.mjs.map +1 -1
  163. package/dist/js/remote-vue-components/src/auto-generated/RadioGroup.mjs +3 -3
  164. package/dist/js/remote-vue-components/src/auto-generated/RadioGroup.mjs.map +1 -1
  165. package/dist/js/remote-vue-components/src/auto-generated/RangeCalendar.mjs +2 -2
  166. package/dist/js/remote-vue-components/src/auto-generated/RangeCalendar.mjs.map +1 -1
  167. package/dist/js/remote-vue-components/src/auto-generated/Rating.mjs +3 -3
  168. package/dist/js/remote-vue-components/src/auto-generated/Rating.mjs.map +1 -1
  169. package/dist/js/remote-vue-components/src/auto-generated/RatingSegment.mjs +3 -3
  170. package/dist/js/remote-vue-components/src/auto-generated/RatingSegment.mjs.map +1 -1
  171. package/dist/js/remote-vue-components/src/auto-generated/SearchField.mjs +3 -3
  172. package/dist/js/remote-vue-components/src/auto-generated/SearchField.mjs.map +1 -1
  173. package/dist/js/remote-vue-components/src/auto-generated/Section.mjs +1 -2
  174. package/dist/js/remote-vue-components/src/auto-generated/Segment.mjs +3 -3
  175. package/dist/js/remote-vue-components/src/auto-generated/Segment.mjs.map +1 -1
  176. package/dist/js/remote-vue-components/src/auto-generated/SegmentedControl.mjs +3 -3
  177. package/dist/js/remote-vue-components/src/auto-generated/SegmentedControl.mjs.map +1 -1
  178. package/dist/js/remote-vue-components/src/auto-generated/Select.mjs +3 -3
  179. package/dist/js/remote-vue-components/src/auto-generated/Select.mjs.map +1 -1
  180. package/dist/js/remote-vue-components/src/auto-generated/Separator.mjs +6 -3
  181. package/dist/js/remote-vue-components/src/auto-generated/Separator.mjs.map +1 -1
  182. package/dist/js/remote-vue-components/src/auto-generated/Skeleton.mjs +1 -2
  183. package/dist/js/remote-vue-components/src/auto-generated/SkeletonMode.mjs +1 -2
  184. package/dist/js/remote-vue-components/src/auto-generated/SkeletonText.mjs +1 -2
  185. package/dist/js/remote-vue-components/src/auto-generated/Slider.mjs +3 -3
  186. package/dist/js/remote-vue-components/src/auto-generated/Slider.mjs.map +1 -1
  187. package/dist/js/remote-vue-components/src/auto-generated/Switch.mjs +3 -3
  188. package/dist/js/remote-vue-components/src/auto-generated/Switch.mjs.map +1 -1
  189. package/dist/js/remote-vue-components/src/auto-generated/Tab.mjs +3 -3
  190. package/dist/js/remote-vue-components/src/auto-generated/Tab.mjs.map +1 -1
  191. package/dist/js/remote-vue-components/src/auto-generated/TabNavigation.mjs +1 -2
  192. package/dist/js/remote-vue-components/src/auto-generated/TabTitle.mjs +3 -3
  193. package/dist/js/remote-vue-components/src/auto-generated/TabTitle.mjs.map +1 -1
  194. package/dist/js/remote-vue-components/src/auto-generated/Table.mjs +3 -3
  195. package/dist/js/remote-vue-components/src/auto-generated/Table.mjs.map +1 -1
  196. package/dist/js/remote-vue-components/src/auto-generated/TableBody.mjs +6 -3
  197. package/dist/js/remote-vue-components/src/auto-generated/TableBody.mjs.map +1 -1
  198. package/dist/js/remote-vue-components/src/auto-generated/TableCell.mjs +3 -3
  199. package/dist/js/remote-vue-components/src/auto-generated/TableCell.mjs.map +1 -1
  200. package/dist/js/remote-vue-components/src/auto-generated/TableColumn.mjs +3 -3
  201. package/dist/js/remote-vue-components/src/auto-generated/TableColumn.mjs.map +1 -1
  202. package/dist/js/remote-vue-components/src/auto-generated/TableFooterRow.mjs +3 -3
  203. package/dist/js/remote-vue-components/src/auto-generated/TableFooterRow.mjs.map +1 -1
  204. package/dist/js/remote-vue-components/src/auto-generated/TableHeader.mjs +6 -3
  205. package/dist/js/remote-vue-components/src/auto-generated/TableHeader.mjs.map +1 -1
  206. package/dist/js/remote-vue-components/src/auto-generated/TableRow.mjs +3 -3
  207. package/dist/js/remote-vue-components/src/auto-generated/TableRow.mjs.map +1 -1
  208. package/dist/js/remote-vue-components/src/auto-generated/Tabs.mjs +3 -3
  209. package/dist/js/remote-vue-components/src/auto-generated/Tabs.mjs.map +1 -1
  210. package/dist/js/remote-vue-components/src/auto-generated/Text.mjs +1 -2
  211. package/dist/js/remote-vue-components/src/auto-generated/TextArea.mjs +3 -3
  212. package/dist/js/remote-vue-components/src/auto-generated/TextArea.mjs.map +1 -1
  213. package/dist/js/remote-vue-components/src/auto-generated/TextField.mjs +3 -3
  214. package/dist/js/remote-vue-components/src/auto-generated/TextField.mjs.map +1 -1
  215. package/dist/js/remote-vue-components/src/auto-generated/TimeField.mjs +3 -3
  216. package/dist/js/remote-vue-components/src/auto-generated/TimeField.mjs.map +1 -1
  217. package/dist/js/remote-vue-components/src/auto-generated/Tooltip.mjs +3 -3
  218. package/dist/js/remote-vue-components/src/auto-generated/Tooltip.mjs.map +1 -1
  219. package/dist/js/remote-vue-components/src/auto-generated/TooltipTrigger.mjs +1 -2
  220. package/dist/js/remote-vue-components/src/auto-generated/TranslationProvider.mjs +1 -2
  221. package/dist/js/remote-vue-components/src/auto-generated/Truncate.mjs +1 -2
  222. package/dist/js/remote-vue-components/src/auto-generated/TunnelEntry.mjs +1 -2
  223. package/dist/js/remote-vue-components/src/auto-generated/XAxis.mjs +1 -2
  224. package/dist/js/remote-vue-components/src/auto-generated/YAxis.mjs +1 -2
  225. package/dist/js/remote-vue-components/src/components/Action.mjs +2 -3
  226. package/dist/js/remote-vue-components/src/components/ActionBatch.mjs +1 -2
  227. package/dist/js/remote-vue-components/src/components/BrowserOnly.mjs +1 -2
  228. package/dist/js/remote-vue-components/src/components/CountryOptions.mjs +1 -2
  229. package/dist/js/remote-vue-components/src/components/DeprecationWarningProvider.mjs +16 -11
  230. package/dist/js/remote-vue-components/src/components/DeprecationWarningProvider.mjs.map +1 -1
  231. package/dist/js/remote-vue-components/src/components/Form.mjs +1 -2
  232. package/dist/js/remote-vue-components/src/components/LoadingIndicator.mjs +1 -2
  233. package/dist/js/remote-vue-components/src/components/NotificationProvider.mjs +1 -2
  234. package/dist/js/remote-vue-components/src/components/SettingsProvider.mjs +1 -2
  235. package/dist/js/remote-vue-components/src/components/Wrap.mjs +1 -2
  236. package/dist/js/remote-vue-components/src/composables/remoteContext.mjs +1 -2
  237. package/dist/js/remote-vue-components/src/composables/useComponentUsage.mjs +1 -2
  238. package/dist/js/remote-vue-components/src/composables/useIsMounted.mjs +1 -2
  239. package/dist/js/remote-vue-components/src/composables/useOnChange.mjs +1 -2
  240. package/dist/js/remote-vue-components/src/composables/useWatchPathname.mjs +1 -2
  241. package/dist/js/remote-vue-components/src/icons/IconSetProvider.mjs +1 -2
  242. package/dist/js/remote-vue-components/src/icons/components/IconAI.mjs +1 -2
  243. package/dist/js/remote-vue-components/src/icons/components/IconAIHosting.mjs +1 -2
  244. package/dist/js/remote-vue-components/src/icons/components/IconAnalytics.mjs +1 -2
  245. package/dist/js/remote-vue-components/src/icons/components/IconApp.mjs +1 -2
  246. package/dist/js/remote-vue-components/src/icons/components/IconAscending.mjs +1 -2
  247. package/dist/js/remote-vue-components/src/icons/components/IconAttachment.mjs +1 -2
  248. package/dist/js/remote-vue-components/src/icons/components/IconAutoresponder.mjs +1 -2
  249. package/dist/js/remote-vue-components/src/icons/components/IconBackLink.mjs +1 -2
  250. package/dist/js/remote-vue-components/src/icons/components/IconBackup.mjs +1 -2
  251. package/dist/js/remote-vue-components/src/icons/components/IconBold.mjs +1 -2
  252. package/dist/js/remote-vue-components/src/icons/components/IconCamera.mjs +1 -2
  253. package/dist/js/remote-vue-components/src/icons/components/IconCertificate.mjs +1 -2
  254. package/dist/js/remote-vue-components/src/icons/components/IconChangelog.mjs +1 -2
  255. package/dist/js/remote-vue-components/src/icons/components/IconCheck.mjs +1 -2
  256. package/dist/js/remote-vue-components/src/icons/components/IconCheckboxChecked.mjs +1 -2
  257. package/dist/js/remote-vue-components/src/icons/components/IconCheckboxEmpty.mjs +1 -2
  258. package/dist/js/remote-vue-components/src/icons/components/IconCheckboxIndeterminate.mjs +1 -2
  259. package/dist/js/remote-vue-components/src/icons/components/IconChevronDown.mjs +1 -2
  260. package/dist/js/remote-vue-components/src/icons/components/IconChevronLeft.mjs +1 -2
  261. package/dist/js/remote-vue-components/src/icons/components/IconChevronRight.mjs +1 -2
  262. package/dist/js/remote-vue-components/src/icons/components/IconChevronUp.mjs +1 -2
  263. package/dist/js/remote-vue-components/src/icons/components/IconClose.mjs +1 -2
  264. package/dist/js/remote-vue-components/src/icons/components/IconCode.mjs +1 -2
  265. package/dist/js/remote-vue-components/src/icons/components/IconContainer.mjs +1 -2
  266. package/dist/js/remote-vue-components/src/icons/components/IconContextMenu.mjs +1 -2
  267. package/dist/js/remote-vue-components/src/icons/components/IconContextMenuVertical.mjs +1 -2
  268. package/dist/js/remote-vue-components/src/icons/components/IconContract.mjs +1 -2
  269. package/dist/js/remote-vue-components/src/icons/components/IconContractPartner.mjs +1 -2
  270. package/dist/js/remote-vue-components/src/icons/components/IconContributor.mjs +1 -2
  271. package/dist/js/remote-vue-components/src/icons/components/IconCopy.mjs +1 -2
  272. package/dist/js/remote-vue-components/src/icons/components/IconCronjob.mjs +1 -2
  273. package/dist/js/remote-vue-components/src/icons/components/IconCustomer.mjs +1 -2
  274. package/dist/js/remote-vue-components/src/icons/components/IconDanger.mjs +1 -2
  275. package/dist/js/remote-vue-components/src/icons/components/IconDashboard.mjs +1 -2
  276. package/dist/js/remote-vue-components/src/icons/components/IconDatabase.mjs +1 -2
  277. package/dist/js/remote-vue-components/src/icons/components/IconDate.mjs +1 -2
  278. package/dist/js/remote-vue-components/src/icons/components/IconDelete.mjs +1 -2
  279. package/dist/js/remote-vue-components/src/icons/components/IconDeliveryBox.mjs +1 -2
  280. package/dist/js/remote-vue-components/src/icons/components/IconDescending.mjs +1 -2
  281. package/dist/js/remote-vue-components/src/icons/components/IconDesktop.mjs +1 -2
  282. package/dist/js/remote-vue-components/src/icons/components/IconDirectory.mjs +1 -2
  283. package/dist/js/remote-vue-components/src/icons/components/IconDnsSubZone.mjs +1 -2
  284. package/dist/js/remote-vue-components/src/icons/components/IconDnsZone.mjs +1 -2
  285. package/dist/js/remote-vue-components/src/icons/components/IconDomain.mjs +1 -2
  286. package/dist/js/remote-vue-components/src/icons/components/IconDownload.mjs +1 -2
  287. package/dist/js/remote-vue-components/src/icons/components/IconEdit.mjs +1 -2
  288. package/dist/js/remote-vue-components/src/icons/components/IconEmail.mjs +1 -2
  289. package/dist/js/remote-vue-components/src/icons/components/IconEmailArchive.mjs +1 -2
  290. package/dist/js/remote-vue-components/src/icons/components/IconExtension.mjs +1 -2
  291. package/dist/js/remote-vue-components/src/icons/components/IconExternalLink.mjs +1 -2
  292. package/dist/js/remote-vue-components/src/icons/components/IconFailed.mjs +1 -2
  293. package/dist/js/remote-vue-components/src/icons/components/IconFeedback.mjs +1 -2
  294. package/dist/js/remote-vue-components/src/icons/components/IconFile.mjs +1 -2
  295. package/dist/js/remote-vue-components/src/icons/components/IconFilter.mjs +1 -2
  296. package/dist/js/remote-vue-components/src/icons/components/IconForwardAddress.mjs +1 -2
  297. package/dist/js/remote-vue-components/src/icons/components/IconForwardLink.mjs +1 -2
  298. package/dist/js/remote-vue-components/src/icons/components/IconHide.mjs +1 -2
  299. package/dist/js/remote-vue-components/src/icons/components/IconHome.mjs +1 -2
  300. package/dist/js/remote-vue-components/src/icons/components/IconImage.mjs +1 -2
  301. package/dist/js/remote-vue-components/src/icons/components/IconInfo.mjs +1 -2
  302. package/dist/js/remote-vue-components/src/icons/components/IconInvite.mjs +1 -2
  303. package/dist/js/remote-vue-components/src/icons/components/IconInvoice.mjs +1 -2
  304. package/dist/js/remote-vue-components/src/icons/components/IconItalic.mjs +1 -2
  305. package/dist/js/remote-vue-components/src/icons/components/IconKnowledgeHint.mjs +1 -2
  306. package/dist/js/remote-vue-components/src/icons/components/IconLanguage.mjs +1 -2
  307. package/dist/js/remote-vue-components/src/icons/components/IconLeadFyndr.mjs +1 -2
  308. package/dist/js/remote-vue-components/src/icons/components/IconLink.mjs +1 -2
  309. package/dist/js/remote-vue-components/src/icons/components/IconLock.mjs +1 -2
  310. package/dist/js/remote-vue-components/src/icons/components/IconLockOpen.mjs +1 -2
  311. package/dist/js/remote-vue-components/src/icons/components/IconLogout.mjs +1 -2
  312. package/dist/js/remote-vue-components/src/icons/components/IconMainUser.mjs +1 -2
  313. package/dist/js/remote-vue-components/src/icons/components/IconMarketplace.mjs +1 -2
  314. package/dist/js/remote-vue-components/src/icons/components/IconMaximize.mjs +1 -2
  315. package/dist/js/remote-vue-components/src/icons/components/IconMember.mjs +1 -2
  316. package/dist/js/remote-vue-components/src/icons/components/IconMenu.mjs +1 -2
  317. package/dist/js/remote-vue-components/src/icons/components/IconMinimize.mjs +1 -2
  318. package/dist/js/remote-vue-components/src/icons/components/IconMinus.mjs +1 -2
  319. package/dist/js/remote-vue-components/src/icons/components/IconMittwald.mjs +1 -2
  320. package/dist/js/remote-vue-components/src/icons/components/IconMobile.mjs +1 -2
  321. package/dist/js/remote-vue-components/src/icons/components/IconMonitoring.mjs +1 -2
  322. package/dist/js/remote-vue-components/src/icons/components/IconMove.mjs +1 -2
  323. package/dist/js/remote-vue-components/src/icons/components/IconNewsletter.mjs +1 -2
  324. package/dist/js/remote-vue-components/src/icons/components/IconNotification.mjs +1 -2
  325. package/dist/js/remote-vue-components/src/icons/components/IconNumber.mjs +1 -2
  326. package/dist/js/remote-vue-components/src/icons/components/IconOrder.mjs +1 -2
  327. package/dist/js/remote-vue-components/src/icons/components/IconOrderedList.mjs +1 -2
  328. package/dist/js/remote-vue-components/src/icons/components/IconPassword.mjs +1 -2
  329. package/dist/js/remote-vue-components/src/icons/components/IconPath.mjs +1 -2
  330. package/dist/js/remote-vue-components/src/icons/components/IconPause.mjs +1 -2
  331. package/dist/js/remote-vue-components/src/icons/components/IconPayment.mjs +1 -2
  332. package/dist/js/remote-vue-components/src/icons/components/IconPending.mjs +1 -2
  333. package/dist/js/remote-vue-components/src/icons/components/IconPicture.mjs +1 -2
  334. package/dist/js/remote-vue-components/src/icons/components/IconPlus.mjs +1 -2
  335. package/dist/js/remote-vue-components/src/icons/components/IconProject.mjs +1 -2
  336. package/dist/js/remote-vue-components/src/icons/components/IconQuote.mjs +1 -2
  337. package/dist/js/remote-vue-components/src/icons/components/IconRadioOff.mjs +1 -2
  338. package/dist/js/remote-vue-components/src/icons/components/IconRadioOn.mjs +1 -2
  339. package/dist/js/remote-vue-components/src/icons/components/IconRedo.mjs +1 -2
  340. package/dist/js/remote-vue-components/src/icons/components/IconRefresh.mjs +1 -2
  341. package/dist/js/remote-vue-components/src/icons/components/IconRegistry.mjs +1 -2
  342. package/dist/js/remote-vue-components/src/icons/components/IconSave.mjs +1 -2
  343. package/dist/js/remote-vue-components/src/icons/components/IconSearch.mjs +1 -2
  344. package/dist/js/remote-vue-components/src/icons/components/IconSecurity.mjs +1 -2
  345. package/dist/js/remote-vue-components/src/icons/components/IconSend.mjs +1 -2
  346. package/dist/js/remote-vue-components/src/icons/components/IconServer.mjs +1 -2
  347. package/dist/js/remote-vue-components/src/icons/components/IconSettings.mjs +1 -2
  348. package/dist/js/remote-vue-components/src/icons/components/IconShare.mjs +1 -2
  349. package/dist/js/remote-vue-components/src/icons/components/IconShow.mjs +1 -2
  350. package/dist/js/remote-vue-components/src/icons/components/IconSorting.mjs +1 -2
  351. package/dist/js/remote-vue-components/src/icons/components/IconSsh.mjs +1 -2
  352. package/dist/js/remote-vue-components/src/icons/components/IconSshKey.mjs +1 -2
  353. package/dist/js/remote-vue-components/src/icons/components/IconSshSftp.mjs +1 -2
  354. package/dist/js/remote-vue-components/src/icons/components/IconStack.mjs +1 -2
  355. package/dist/js/remote-vue-components/src/icons/components/IconStar.mjs +1 -2
  356. package/dist/js/remote-vue-components/src/icons/components/IconStarFilled.mjs +1 -2
  357. package/dist/js/remote-vue-components/src/icons/components/IconStart.mjs +1 -2
  358. package/dist/js/remote-vue-components/src/icons/components/IconStrikeThrough.mjs +1 -2
  359. package/dist/js/remote-vue-components/src/icons/components/IconSubdomain.mjs +1 -2
  360. package/dist/js/remote-vue-components/src/icons/components/IconSucceeded.mjs +1 -2
  361. package/dist/js/remote-vue-components/src/icons/components/IconSuccess.mjs +1 -2
  362. package/dist/js/remote-vue-components/src/icons/components/IconSupport.mjs +1 -2
  363. package/dist/js/remote-vue-components/src/icons/components/IconTerminate.mjs +1 -2
  364. package/dist/js/remote-vue-components/src/icons/components/IconTicket.mjs +1 -2
  365. package/dist/js/remote-vue-components/src/icons/components/IconTime.mjs +1 -2
  366. package/dist/js/remote-vue-components/src/icons/components/IconUnavailable.mjs +1 -2
  367. package/dist/js/remote-vue-components/src/icons/components/IconUndo.mjs +1 -2
  368. package/dist/js/remote-vue-components/src/icons/components/IconUnorderedList.mjs +1 -2
  369. package/dist/js/remote-vue-components/src/icons/components/IconUpload.mjs +1 -2
  370. package/dist/js/remote-vue-components/src/icons/components/IconUser.mjs +1 -2
  371. package/dist/js/remote-vue-components/src/icons/components/IconVhost.mjs +1 -2
  372. package/dist/js/remote-vue-components/src/icons/components/IconView.mjs +1 -2
  373. package/dist/js/remote-vue-components/src/icons/components/IconVolume.mjs +1 -2
  374. package/dist/js/remote-vue-components/src/icons/components/IconWarning.mjs +1 -2
  375. package/dist/js/remote-vue-components/src/icons/lib/createIcon.mjs +1 -2
  376. package/dist/js/remote-vue-components/src/lib/composition.mjs +1 -2
  377. package/dist/js/remote-vue-components/src/lib/controlledRemoteValue.mjs +1 -2
  378. package/dist/js/remote-vue-components/src/lib/createFlowRemoteComponent.mjs +1 -2
  379. package/dist/js/remote-vue-components/src/lib/handlers.mjs +1 -2
  380. package/dist/js/remote-vue-components/src/lib/isRenderError.mjs +1 -2
  381. package/dist/js/remote-vue-components/src/lib/mobxSelector.mjs +1 -2
  382. package/dist/js/remote-vue-components/src/lib/propKeys.mjs +1 -2
  383. package/dist/js/remote-vue-components/src/lib/stringifyError.mjs +1 -2
  384. package/dist/js/remote-vue-components/src/lib/vModel.mjs +1 -2
  385. package/dist/js/remote-vue-components/src/list/ActiveFilters.mjs +6 -4
  386. package/dist/js/remote-vue-components/src/list/ActiveFilters.mjs.map +1 -1
  387. package/dist/js/remote-vue-components/src/list/AllFiltersModal.mjs +4 -4
  388. package/dist/js/remote-vue-components/src/list/AllFiltersModal.mjs.map +1 -1
  389. package/dist/js/remote-vue-components/src/list/ComposableLoader.mjs +1 -2
  390. package/dist/js/remote-vue-components/src/list/DateTimeRangeFields.mjs +99 -0
  391. package/dist/js/remote-vue-components/src/list/DateTimeRangeFields.mjs.map +1 -0
  392. package/dist/js/remote-vue-components/src/list/Footer.mjs +1 -2
  393. package/dist/js/remote-vue-components/src/list/Header.mjs +13 -9
  394. package/dist/js/remote-vue-components/src/list/Header.mjs.map +1 -1
  395. package/dist/js/remote-vue-components/src/list/Item.mjs +1 -2
  396. package/dist/js/remote-vue-components/src/list/Items.mjs +1 -2
  397. package/dist/js/remote-vue-components/src/list/List.mjs +1 -2
  398. package/dist/js/remote-vue-components/src/list/ListItemView.mjs +1 -2
  399. package/dist/js/remote-vue-components/src/list/Table.mjs +1 -2
  400. package/dist/js/remote-vue-components/src/list/dateRangeFilter.mjs +15 -8
  401. package/dist/js/remote-vue-components/src/list/dateRangeFilter.mjs.map +1 -1
  402. package/dist/js/remote-vue-components/src/list/itemContext.mjs +1 -2
  403. package/dist/js/remote-vue-components/src/list/listContext.mjs +1 -2
  404. package/dist/js/remote-vue-components/src/list/locales.mjs +15 -2
  405. package/dist/js/remote-vue-components/src/list/locales.mjs.map +1 -1
  406. package/dist/js/remote-vue-components/src/list/metadata.mjs +1 -2
  407. package/dist/js/remote-vue-components/src/list/model.mjs +1 -2
  408. package/dist/js/remote-vue-components/src/list/settings.mjs +1 -2
  409. package/dist/js/remote-vue-components/src/list/setupComponents.mjs +1 -2
  410. package/dist/js/remote-vue-components/src/list/styles.mjs +8 -3
  411. package/dist/js/remote-vue-components/src/list/styles.mjs.map +1 -1
  412. package/dist/js/remote-vue-components/src/overlays/LightBox.mjs +22 -8
  413. package/dist/js/remote-vue-components/src/overlays/LightBox.mjs.map +1 -1
  414. package/dist/js/remote-vue-components/src/overlays/Modal.mjs +15 -20
  415. package/dist/js/remote-vue-components/src/overlays/Modal.mjs.map +1 -1
  416. package/dist/js/remote-vue-components/src/overlays/Popover.mjs +1 -2
  417. package/dist/js/remote-vue-components/src/overlays/childProps.mjs +1 -2
  418. package/dist/js/remote-vue-components/src/overlays/createOverlayTrigger.mjs +1 -2
  419. package/dist/js/remote-vue-components/src/overlays/locales.mjs +1 -2
  420. package/dist/js/remote-vue-components/src/overlays/overlayController.mjs +58 -65
  421. package/dist/js/remote-vue-components/src/overlays/overlayController.mjs.map +1 -1
  422. package/dist/js/remote-vue-components/src/overlays/triggers.mjs +1 -2
  423. package/dist/js/remote-vue-components/src/version.mjs +3 -4
  424. package/dist/js/remote-vue-components/src/version.mjs.map +1 -1
  425. package/dist/types/_bundled/flow-components-base/index.d.ts +4 -1
  426. package/dist/types/_bundled/flow-components-base/list/filter/ListFilter.d.ts +2 -0
  427. package/dist/types/_bundled/flow-components-base/list/filter/dateRange.d.ts +24 -1
  428. package/dist/types/_bundled/flow-components-base/list/filter/dateTimeRangeFields.d.ts +34 -0
  429. package/dist/types/_bundled/flow-components-base/list/filter/formatDateRange.d.ts +7 -0
  430. package/dist/types/_bundled/flow-components-base/list/loading/ListLoaderState.d.ts +5 -0
  431. package/dist/types/_bundled/flow-components-base/overlay/OverlayState.d.ts +94 -0
  432. package/dist/types/auto-generated/LightBoxZoom.d.ts +4 -0
  433. package/dist/types/auto-generated/index.d.ts +1 -0
  434. package/dist/types/components/DeprecationWarningProvider.d.ts +2 -4
  435. package/dist/types/components/RemoteRoot.d.ts +19 -0
  436. package/dist/types/list/DateTimeRangeFields.d.ts +43 -0
  437. package/dist/types/list/dateRangeFilter.d.ts +6 -6
  438. package/dist/types/list/index.d.ts +1 -0
  439. package/dist/types/list/locales.d.ts +14 -0
  440. package/dist/types/list/styles.d.ts +6 -0
  441. package/dist/types/list/types.d.ts +8 -2
  442. package/dist/types/overlays/LightBox.d.ts +17 -0
  443. package/dist/types/overlays/Modal.d.ts +2 -2
  444. package/dist/types/overlays/overlayController.d.ts +28 -18
  445. package/dist/types/version.d.ts +2 -2
  446. package/package.json +14 -14
package/README.md CHANGED
@@ -127,10 +127,9 @@ themselves. They cannot be generated, so this package rebuilds them in Vue:
127
127
  | Component | The rebuild |
128
128
  | --------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
129
129
  | `Modal`, `Popover`, `LightBox` | render `OverlayContent` / `PopoverContent` with Flow's own classes, and configure their children |
130
- | `Modal confirmOnClose` | a confirmation modal bound to the parent's `isConfirmingClose`, with its own copy of the four strings |
130
+ | `Modal confirmOnClose` | a confirmation modal with its own controller, opened while the parent asks; its own copy of the texts |
131
131
  | `IconSetProvider` | provide/inject; its `IconSet` is partial, because there is no complete second set to hand it |
132
132
  | `ModalTrigger`, `PopoverTrigger`, `LightBoxTrigger` | a `DialogTrigger` whose `Button` (also inside an `Action`) gets the `onPress` that opens it |
133
- | `useOverlayController`, `useModalController` | a `ref` plus `provide`/`inject`; given a type, the surrounding overlay's controller, as in Flow |
134
133
  | `Action`, `ActionBatch` | run, report pending/succeeded/failed on the button, close the overlay |
135
134
  | `NotificationProvider`, `useNotificationController` | a reactive list, with the auto-close timer that pauses on hover and focus |
136
135
  | `DeprecationWarningProvider`, `useWarnDeprecation` | provide/inject; `RemoteRoot` forwards to the host |
@@ -138,6 +137,7 @@ themselves. They cannot be generated, so this package rebuilds them in Vue:
138
137
  | `CountryOptions` | `Option`s from `country-codes-list`, named by `Intl.DisplayNames` |
139
138
  | `Wrap`, `BrowserOnly` | the same two-line components |
140
139
  | `List`, `ListItemView` | the arrangement around `@mittwald/flow-components-base`, plus the batch loading |
140
+ | `useOverlayController`, `useModalController` | refs over the shared `OverlayState`; given a type, the surrounding overlay's controller, as in Flow |
141
141
  | `useIsMounted`, `useOnChange`, `useLanguage` | composables |
142
142
  | `useListMetadata` | what the list's loader sent beside its data |
143
143
  | `Form` | `flr-form` has no Flow component behind it, so the generator never sees it |
package/USAGE.md CHANGED
@@ -68,6 +68,12 @@ createApp({
68
68
  }).mount("#app");
69
69
  ```
70
70
 
71
+ `RemoteRoot` talks only to a host on an mStudio origin or on your app's own
72
+ origin. To develop against another host, add its origin with the
73
+ `allowedHostOrigins` prop. `hostPathnameChanged` emits relative app paths only.
74
+ Your frontend must also send a `frame-ancestors` CSP header — see the
75
+ [ext-bridge USAGE.md](https://github.com/mittwald/flow/blob/main/packages/ext-bridge/USAGE.md).
76
+
71
77
  The full explainer:
72
78
  <https://github.com/mittwald/flow/blob/main/docs/remote-ui.md>.
73
79
 
@@ -6,9 +6,9 @@ import { useWatchPathname } from "./remote-vue-components/src/composables/useWat
6
6
  import { isRenderError } from "./remote-vue-components/src/lib/isRenderError.mjs";
7
7
  import { stringifyError } from "./remote-vue-components/src/lib/stringifyError.mjs";
8
8
  import { defineComponent, h, onErrorCaptured, onMounted, ref, watch } from "vue";
9
- import { connectHostRenderRootRef, connectRemoteReceiver } from "@mittwald/flow-remote-core";
9
+ import { connectHostRenderRootRef, connectRemoteReceiver, toRelativePathname } from "@mittwald/flow-remote-core";
10
10
  import { initExtBridge } from "@mittwald/ext-bridge/browser";
11
- //#region src/components/RemoteRoot.ts
11
+ // src/components/RemoteRoot.ts
12
12
  /**
13
13
  * Hides the remote tree without unmounting it: the elements have to exist and
14
14
  * mutate, because those mutations are the protocol — the host renders the
@@ -38,6 +38,15 @@ var RemoteRoot = defineComponent({
38
38
  default: void 0
39
39
  },
40
40
  /**
41
+ * Additional host origins the remote app accepts, e.g. for local
42
+ * development. The mStudio origins and the app's own origin are always
43
+ * allowed.
44
+ */
45
+ allowedHostOrigins: {
46
+ type: Array,
47
+ default: void 0
48
+ },
49
+ /**
41
50
  * Internal use only: renders against a receiver in the same realm instead
42
51
  * of connecting to a parent frame.
43
52
  */
@@ -87,11 +96,15 @@ var RemoteRoot = defineComponent({
87
96
  }
88
97
  initExtBridge();
89
98
  connectHostRenderRootRef({
90
- onPathnameChanged: (pathname) => emit("hostPathnameChanged", pathname),
99
+ onPathnameChanged: (pathname) => {
100
+ const relativePathname = toRelativePathname(pathname);
101
+ if (relativePathname !== void 0) emit("hostPathnameChanged", relativePathname);
102
+ },
91
103
  onHostError: (error) => {
92
104
  failure.value = new Error(error);
93
105
  },
94
- packageVersion
106
+ packageVersion,
107
+ allowedHostOrigins: props.allowedHostOrigins
95
108
  })(root)?.then(async (hostConnection) => {
96
109
  connection.value = hostConnection;
97
110
  setIsLoading();
@@ -115,7 +128,6 @@ var RemoteRoot = defineComponent({
115
128
  }
116
129
  });
117
130
  composition(RemoteRoot);
118
- //#endregion
119
131
  export { RemoteRoot, RemoteRoot as default };
120
132
 
121
133
  //# sourceMappingURL=RemoteRoot.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteRoot.mjs","names":[],"sources":["../../src/components/RemoteRoot.ts"],"sourcesContent":["import { DeprecationWarningProvider } from \"@/components/DeprecationWarningProvider\";\nimport { provideRemoteContext } from \"@/composables/remoteContext\";\nimport { useWatchPathname } from \"@/composables/useWatchPathname\";\nimport { isRenderError } from \"@/lib/isRenderError\";\nimport { stringifyError } from \"@/lib/stringifyError\";\nimport { packageVersion } from \"@/version\";\nimport {\n connectHostRenderRootRef,\n connectRemoteReceiver,\n type RemoteReceiver,\n type RemoteToHostConnection,\n} from \"@mittwald/flow-remote-core\";\nimport { initExtBridge } from \"@mittwald/ext-bridge/browser\";\nimport {\n defineComponent,\n h,\n onErrorCaptured,\n onMounted,\n ref,\n watch,\n type PropType,\n type StyleValue,\n} from \"vue\";\nimport { composition } from \"@/lib/composition\";\n\n/**\n * Hides the remote tree without unmounting it: the elements have to exist and\n * mutate, because those mutations are the protocol — the host renders the\n * visible output.\n */\nconst hiddenStyle: StyleValue = {\n visibility: \"hidden\",\n height: 0,\n width: 0,\n border: \"none\",\n position: \"absolute\",\n marginLeft: \"-9999px\",\n};\n\n/**\n * Connects a Vue app to the mStudio host and renders its children into the\n * remote tree.\n *\n * Everything below it renders `flr-*` elements, never visible DOM — see\n * `docs/remote-ui.md`.\n */\nexport const RemoteRoot = defineComponent({\n name: \"RemoteRoot\",\n\n props: {\n /** Forwarded to the host, which shows its own loading state. */\n isLoading: { type: Boolean, default: undefined },\n /**\n * Internal use only: renders against a receiver in the same realm instead\n * of connecting to a parent frame.\n */\n __remoteReceiver: {\n type: Object as PropType<RemoteReceiver>,\n default: undefined,\n },\n },\n\n emits: {\n hostPathnameChanged: (pathname: string) => typeof pathname === \"string\",\n },\n\n setup(props, { slots, emit }) {\n const rootRef = ref<HTMLDivElement>();\n const connection = ref<RemoteToHostConnection>();\n const language = ref<string>();\n const isConnected = ref(false);\n const failure = ref<unknown>();\n\n const reportedComponents = new Set<string>();\n\n provideRemoteContext({\n connection,\n language,\n reportComponentUsage: (component) => {\n if (reportedComponents.has(component)) {\n return;\n }\n reportedComponents.add(component);\n\n void connection.value?.imports\n .reportEvent?.({ event: \"ComponentRendered\", data: { component } })\n ?.catch(() => {\n // ignore: host does not support event reporting\n });\n },\n });\n\n const setIsLoading = () => {\n if (props.isLoading !== undefined) {\n connection.value?.imports.setIsLoading(props.isLoading);\n }\n };\n\n watch(() => props.isLoading, setIsLoading);\n\n useWatchPathname((pathname) =>\n connection.value?.imports.setNavigationState({\n pathname,\n isPending: false,\n }),\n );\n\n /*\n * A render error in the extension is not the host's error to guess at: the\n * host shows its own failure state and the message travels with it. Any\n * other error — a hook, a watcher, an event handler, sync or async — is\n * left to the app. Every error goes on to `app.config.errorHandler`.\n */\n onErrorCaptured((error, _instance, info) => {\n if (isRenderError(info)) {\n void connection.value?.imports.setError(stringifyError(error));\n }\n });\n\n onMounted(() => {\n const root = rootRef.value;\n if (!root) {\n return;\n }\n\n if (props.__remoteReceiver) {\n void connectRemoteReceiver(root, props.__remoteReceiver.connection);\n isConnected.value = true;\n return;\n }\n\n initExtBridge();\n\n void connectHostRenderRootRef({\n onPathnameChanged: (pathname) => emit(\"hostPathnameChanged\", pathname),\n onHostError: (error) => {\n failure.value = new Error(error);\n },\n packageVersion,\n })(root)\n ?.then(async (hostConnection) => {\n connection.value = hostConnection;\n setIsLoading();\n const hostConfig = await hostConnection.imports.getHostConfig();\n language.value = hostConfig.language?.trim() || undefined;\n isConnected.value = true;\n })\n .catch((error: unknown) => {\n failure.value = error;\n });\n });\n\n return () => {\n if (failure.value) {\n throw failure.value;\n }\n\n /*\n * The host is told about deprecated paths an extension still uses, the\n * same way the React root reports them — that report is how mStudio\n * learns who to inform before something is removed.\n */\n const children = isConnected.value\n ? h(\n DeprecationWarningProvider,\n {\n onWarning: (message: string) => {\n void connection.value?.imports\n .reportDeprecation?.(message)\n ?.catch(() => {\n // ignore: host does not support deprecation reporting\n });\n },\n },\n { default: () => slots.default?.() },\n )\n : undefined;\n\n return h(\n \"div\",\n { ref: rootRef, style: props.__remoteReceiver ? hiddenStyle : {} },\n children,\n );\n };\n },\n});\n\ncomposition(RemoteRoot);\n\nexport default RemoteRoot;\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAM,cAA0B;CAC9B,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,UAAU;CACV,YAAY;AACd;;;;;;;;AASA,IAAa,aAAa,gBAAgB;CACxC,MAAM;CAEN,OAAO;;EAEL,WAAW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AAC,CAAC,IAAI,CAAC,EACJ,KAAK,OAAO,mBAAmB;IAC/B,WAAW,QAAQ;IACnB,aAAa;IACb,MAAM,aAAa,MAAM,eAAe,QAAQ,cAAc;IAC9D,SAAS,QAAQ,WAAW,UAAU,KAAK,KAAK,KAAA;IAChD,YAAY,QAAQ;GACtB,CAAC,CAAC,CACD,OAAO,UAAmB;IACzB,QAAQ,QAAQ;GAClB,CAAC;EACL,CAAC;EAED,aAAa;GACX,IAAI,QAAQ,OACV,MAAM,QAAQ;GAQhB,MAAM,WAAW,YAAY,QACzB,EACE,4BACA,EACE,YAAY,YAAoB;IAC9B,WAAgB,OAAO,QACpB,oBAAoB,OAAO,CAAC,EAC3B,YAAY,CAEd,CAAC;GACL,EACF,GACA,EAAE,eAAe,MAAM,UAAU,EAAE,CACrC,IACA,KAAA;GAEJ,OAAO,EACL,OACA;IAAE,KAAK;IAAS,OAAO,MAAM,mBAAmB,cAAc,CAAC;GAAE,GACjE,QACF;EACF;CACF;AACF,CAAC;AAED,YAAY,UAAU"}
1
+ {"version":3,"file":"RemoteRoot.mjs","names":[],"sources":["../../src/components/RemoteRoot.ts"],"sourcesContent":["import { DeprecationWarningProvider } from \"@/components/DeprecationWarningProvider\";\nimport { provideRemoteContext } from \"@/composables/remoteContext\";\nimport { useWatchPathname } from \"@/composables/useWatchPathname\";\nimport { isRenderError } from \"@/lib/isRenderError\";\nimport { stringifyError } from \"@/lib/stringifyError\";\nimport { packageVersion } from \"@/version\";\nimport {\n connectHostRenderRootRef,\n connectRemoteReceiver,\n toRelativePathname,\n type RemoteReceiver,\n type RemoteToHostConnection,\n} from \"@mittwald/flow-remote-core\";\nimport { initExtBridge } from \"@mittwald/ext-bridge/browser\";\nimport {\n defineComponent,\n h,\n onErrorCaptured,\n onMounted,\n ref,\n watch,\n type PropType,\n type StyleValue,\n} from \"vue\";\nimport { composition } from \"@/lib/composition\";\n\n/**\n * Hides the remote tree without unmounting it: the elements have to exist and\n * mutate, because those mutations are the protocol — the host renders the\n * visible output.\n */\nconst hiddenStyle: StyleValue = {\n visibility: \"hidden\",\n height: 0,\n width: 0,\n border: \"none\",\n position: \"absolute\",\n marginLeft: \"-9999px\",\n};\n\n/**\n * Connects a Vue app to the mStudio host and renders its children into the\n * remote tree.\n *\n * Everything below it renders `flr-*` elements, never visible DOM — see\n * `docs/remote-ui.md`.\n */\nexport const RemoteRoot = defineComponent({\n name: \"RemoteRoot\",\n\n props: {\n /** Forwarded to the host, which shows its own loading state. */\n isLoading: { type: Boolean, default: undefined },\n /**\n * Additional host origins the remote app accepts, e.g. for local\n * development. The mStudio origins and the app's own origin are always\n * allowed.\n */\n allowedHostOrigins: {\n type: Array as PropType<string[]>,\n default: undefined,\n },\n /**\n * Internal use only: renders against a receiver in the same realm instead\n * of connecting to a parent frame.\n */\n __remoteReceiver: {\n type: Object as PropType<RemoteReceiver>,\n default: undefined,\n },\n },\n\n emits: {\n hostPathnameChanged: (pathname: string) => typeof pathname === \"string\",\n },\n\n setup(props, { slots, emit }) {\n const rootRef = ref<HTMLDivElement>();\n const connection = ref<RemoteToHostConnection>();\n const language = ref<string>();\n const isConnected = ref(false);\n const failure = ref<unknown>();\n\n const reportedComponents = new Set<string>();\n\n provideRemoteContext({\n connection,\n language,\n reportComponentUsage: (component) => {\n if (reportedComponents.has(component)) {\n return;\n }\n reportedComponents.add(component);\n\n void connection.value?.imports\n .reportEvent?.({ event: \"ComponentRendered\", data: { component } })\n ?.catch(() => {\n // ignore: host does not support event reporting\n });\n },\n });\n\n const setIsLoading = () => {\n if (props.isLoading !== undefined) {\n connection.value?.imports.setIsLoading(props.isLoading);\n }\n };\n\n watch(() => props.isLoading, setIsLoading);\n\n useWatchPathname((pathname) =>\n connection.value?.imports.setNavigationState({\n pathname,\n isPending: false,\n }),\n );\n\n /*\n * A render error in the extension is not the host's error to guess at: the\n * host shows its own failure state and the message travels with it. Any\n * other error — a hook, a watcher, an event handler, sync or async — is\n * left to the app. Every error goes on to `app.config.errorHandler`.\n */\n onErrorCaptured((error, _instance, info) => {\n if (isRenderError(info)) {\n void connection.value?.imports.setError(stringifyError(error));\n }\n });\n\n onMounted(() => {\n const root = rootRef.value;\n if (!root) {\n return;\n }\n\n if (props.__remoteReceiver) {\n void connectRemoteReceiver(root, props.__remoteReceiver.connection);\n isConnected.value = true;\n return;\n }\n\n initExtBridge();\n\n void connectHostRenderRootRef({\n onPathnameChanged: (pathname) => {\n const relativePathname = toRelativePathname(pathname);\n if (relativePathname !== undefined) {\n emit(\"hostPathnameChanged\", relativePathname);\n }\n },\n onHostError: (error) => {\n failure.value = new Error(error);\n },\n packageVersion,\n allowedHostOrigins: props.allowedHostOrigins,\n })(root)\n ?.then(async (hostConnection) => {\n connection.value = hostConnection;\n setIsLoading();\n const hostConfig = await hostConnection.imports.getHostConfig();\n language.value = hostConfig.language?.trim() || undefined;\n isConnected.value = true;\n })\n .catch((error: unknown) => {\n failure.value = error;\n });\n });\n\n return () => {\n if (failure.value) {\n throw failure.value;\n }\n\n /*\n * The host is told about deprecated paths an extension still uses, the\n * same way the React root reports them — that report is how mStudio\n * learns who to inform before something is removed.\n */\n const children = isConnected.value\n ? h(\n DeprecationWarningProvider,\n {\n onWarning: (message: string) => {\n void connection.value?.imports\n .reportDeprecation?.(message)\n ?.catch(() => {\n // ignore: host does not support deprecation reporting\n });\n },\n },\n { default: () => slots.default?.() },\n )\n : undefined;\n\n return h(\n \"div\",\n { ref: rootRef, style: props.__remoteReceiver ? hiddenStyle : {} },\n children,\n );\n };\n },\n});\n\ncomposition(RemoteRoot);\n\nexport default RemoteRoot;\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAM,cAA0B;CAC9B,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,UAAU;CACV,YAAY;AACd;;;;;;;;AASA,IAAa,aAAa,gBAAgB;CACxC,MAAM;CAEN,OAAO;;EAEL,WAAW;GAAE,MAAM;GAAS,SAAS,KAAA;EAAU;;;;;;EAM/C,oBAAoB;GACl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,UAAU;KACtB,QAAQ,QAAQ,IAAI,MAAM,KAAK;IACjC;IACA;IACA,oBAAoB,MAAM;GAC5B,CAAC,CAAC,CAAC,IAAI,CAAC,EACJ,KAAK,OAAO,mBAAmB;IAC/B,WAAW,QAAQ;IACnB,aAAa;IACb,MAAM,aAAa,MAAM,eAAe,QAAQ,cAAc;IAC9D,SAAS,QAAQ,WAAW,UAAU,KAAK,KAAK,KAAA;IAChD,YAAY,QAAQ;GACtB,CAAC,CAAC,CACD,OAAO,UAAmB;IACzB,QAAQ,QAAQ;GAClB,CAAC;EACL,CAAC;EAED,aAAa;GACX,IAAI,QAAQ,OACV,MAAM,QAAQ;GAQhB,MAAM,WAAW,YAAY,QACzB,EACE,4BACA,EACE,YAAY,YAAoB;IAC9B,WAAgB,OAAO,QACpB,oBAAoB,OAAO,CAAC,EAC3B,YAAY,CAEd,CAAC;GACL,EACF,GACA,EAAE,eAAe,MAAM,UAAU,EAAE,CACrC,IACA,KAAA;GAEJ,OAAO,EACL,OACA;IAAE,KAAK;IAAS,OAAO,MAAM,mBAAmB,cAAc,CAAC;GAAE,GACjE,QACF;EACF;CACF;AACF,CAAC;AAED,YAAY,UAAU"}
@@ -1,5 +1,5 @@
1
1
  import { action, computed, makeObservable, observable } from "mobx";
2
- //#region ../components-base/src/action/ActionState.ts
2
+ // ../components-base/src/action/ActionState.ts
3
3
  /** How long each state lasts, in ms. */
4
4
  var actionStateDurations = {
5
5
  /** An async action counts as pending only after this long. */
@@ -79,7 +79,6 @@ var ActionState = class {
79
79
  this.updateState("isPending");
80
80
  }
81
81
  };
82
- //#endregion
83
82
  export { ActionState, ActionState as default, actionStateDurations };
84
83
 
85
84
  //# sourceMappingURL=ActionState.mjs.map
@@ -3,8 +3,10 @@ import "./lib/array.mjs";
3
3
  import "./list/ListModelContext.mjs";
4
4
  import "./list/filter/ListFilterValue.mjs";
5
5
  import { ListFilter } from "./list/filter/ListFilter.mjs";
6
- import "./list/filter/dateRange.mjs";
6
+ import { resolveListDateRange } from "./list/filter/dateRange.mjs";
7
7
  import { ListDateRangeFilter } from "./list/filter/ListDateRangeFilter.mjs";
8
+ import { formatListDateRange } from "./list/filter/formatDateRange.mjs";
9
+ import { getListDateTimeRangeUpdate, isListDateTimeRangeEndBeforeStart, listDateTimeRangeFieldsFromValue, toListCalendarDate, toListTime } from "./list/filter/dateTimeRangeFields.mjs";
8
10
  import "./list/item/ListItem.mjs";
9
11
  import { ListItemCollection } from "./list/item/ListItemCollection.mjs";
10
12
  import { ListLoaderState } from "./list/loading/ListLoaderState.mjs";
@@ -14,4 +16,5 @@ import { ListSearch } from "./list/search/ListSearch.mjs";
14
16
  import { ListSorting, mergeHiddenSorting } from "./list/sorting/ListSorting.mjs";
15
17
  import { ListTable } from "./list/table/ListTable.mjs";
16
18
  import { ListViewMode } from "./list/viewMode/ListViewMode.mjs";
17
- export { ActionState, ListBatchesController, ListDateRangeFilter, ListFilter, ListItemCollection, ListLoaderState, ListSearch, ListSorting, ListTable, ListViewMode, getListDataLoaderOptions, mergeHiddenSorting };
19
+ import { OverlayState } from "./overlay/OverlayState.mjs";
20
+ export { ActionState, ListBatchesController, ListDateRangeFilter, ListFilter, ListItemCollection, ListLoaderState, ListSearch, ListSorting, ListTable, ListViewMode, OverlayState, formatListDateRange, getListDataLoaderOptions, getListDateTimeRangeUpdate, isListDateTimeRangeEndBeforeStart, listDateTimeRangeFieldsFromValue, mergeHiddenSorting, resolveListDateRange, toListCalendarDate, toListTime };
@@ -1,7 +1,6 @@
1
- //#region ../components-base/src/lib/array.ts
1
+ // ../components-base/src/lib/array.ts
2
2
  /** One value or many, as many. */
3
3
  var toArray = (value) => Array.isArray(value) ? value : [value];
4
- //#endregion
5
4
  export { toArray };
6
5
 
7
6
  //# sourceMappingURL=array.mjs.map
@@ -1,4 +1,4 @@
1
- //#region ../components-base/src/list/ListModelContext.ts
1
+ // ../components-base/src/list/ListModelContext.ts
2
2
  /**
3
3
  * The table's column for a property.
4
4
  *
@@ -11,7 +11,6 @@ var getListColumn = (table, property) => {
11
11
  if (!column) throw new Error(`Column #${String(property)} is not defined`);
12
12
  return column;
13
13
  };
14
- //#endregion
15
14
  export { getListColumn };
16
15
 
17
16
  //# sourceMappingURL=ListModelContext.mjs.map
@@ -1,6 +1,6 @@
1
1
  import { ListFilter } from "./ListFilter.mjs";
2
2
  import { applyDateRangeColumnDef, isListDateRange } from "./dateRange.mjs";
3
- //#region ../components-base/src/list/filter/ListDateRangeFilter.ts
3
+ // ../components-base/src/list/filter/ListDateRangeFilter.ts
4
4
  /**
5
5
  * A filter over a span of days rather than over a set of values.
6
6
  *
@@ -19,9 +19,9 @@ var ListDateRangeFilter = class extends ListFilter {
19
19
  }
20
20
  setValue(range) {
21
21
  this.getTableColumn().setFilterValue(range);
22
+ this.notifyFilterUpdated(range ? [range] : []);
22
23
  }
23
24
  };
24
- //#endregion
25
25
  export { ListDateRangeFilter, ListDateRangeFilter as default };
26
26
 
27
27
  //# sourceMappingURL=ListDateRangeFilter.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListDateRangeFilter.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/ListDateRangeFilter.ts"],"sourcesContent":["import { ListFilter } from \"./ListFilter\";\nimport {\n applyDateRangeColumnDef,\n isListDateRange,\n type ListDateRange,\n} from \"./dateRange\";\nimport type { PropertyName } from \"../types\";\nimport type { ColumnDef } from \"@tanstack/table-core\";\n\n/**\n * A filter over a span of days rather than over a set of values.\n *\n * Everything except the control that picks the range: the table column, the\n * comparison and the stored value are the same in every binding, and what a\n * calendar looks like is not. A binding subclasses this to add its own calendar\n * options.\n */\nexport class ListDateRangeFilter<\n T = never,\n TProp extends PropertyName<T> = never,\n TRendered = unknown,\n> extends ListFilter<T, TProp, never, TRendered> {\n public override updateTableColumnDef(def: ColumnDef<T>): void {\n applyDateRangeColumnDef(def);\n }\n\n public override getValue(): ListDateRange | null {\n const value = super.getValue();\n return isListDateRange(value) ? value : null;\n }\n\n public setValue(range: ListDateRange | null): void {\n this.getTableColumn().setFilterValue(range);\n }\n}\n\nexport default ListDateRangeFilter;\n"],"mappings":";;;;;;;;;;;AAiBA,IAAa,sBAAb,cAIU,WAAuC;CAC/C,qBAAqC,KAAyB;EAC5D,wBAAwB,GAAG;CAC7B;CAEA,WAAiD;EAC/C,MAAM,QAAQ,MAAM,SAAS;EAC7B,OAAO,gBAAgB,KAAK,IAAI,QAAQ;CAC1C;CAEA,SAAgB,OAAmC;EACjD,KAAK,eAAe,CAAC,CAAC,eAAe,KAAK;CAC5C;AACF"}
1
+ {"version":3,"file":"ListDateRangeFilter.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/ListDateRangeFilter.ts"],"sourcesContent":["import { ListFilter } from \"./ListFilter\";\nimport {\n applyDateRangeColumnDef,\n isListDateRange,\n type ListDateRange,\n} from \"./dateRange\";\nimport type { PropertyName } from \"../types\";\nimport type { ColumnDef } from \"@tanstack/table-core\";\n\n/**\n * A filter over a span of days rather than over a set of values.\n *\n * Everything except the control that picks the range: the table column, the\n * comparison and the stored value are the same in every binding, and what a\n * calendar looks like is not. A binding subclasses this to add its own calendar\n * options.\n */\nexport class ListDateRangeFilter<\n T = never,\n TProp extends PropertyName<T> = never,\n TRendered = unknown,\n> extends ListFilter<T, TProp, never, TRendered> {\n public override updateTableColumnDef(def: ColumnDef<T>): void {\n applyDateRangeColumnDef(def);\n }\n\n public override getValue(): ListDateRange | null {\n const value = super.getValue();\n return isListDateRange(value) ? value : null;\n }\n\n public setValue(range: ListDateRange | null): void {\n this.getTableColumn().setFilterValue(range);\n this.notifyFilterUpdated(range ? [range] : []);\n }\n}\n\nexport default ListDateRangeFilter;\n"],"mappings":";;;;;;;;;;;AAiBA,IAAa,sBAAb,cAIU,WAAuC;CAC/C,qBAAqC,KAAyB;EAC5D,wBAAwB,GAAG;CAC7B;CAEA,WAAiD;EAC/C,MAAM,QAAQ,MAAM,SAAS;EAC7B,OAAO,gBAAgB,KAAK,IAAI,QAAQ;CAC1C;CAEA,SAAgB,OAAmC;EACjD,KAAK,eAAe,CAAC,CAAC,eAAe,KAAK;EAC1C,KAAK,oBAAoB,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC;CAC/C;AACF"}
@@ -3,7 +3,7 @@ import { getListColumn } from "../ListModelContext.mjs";
3
3
  import { ListFilterValue } from "./ListFilterValue.mjs";
4
4
  import { difference, unique } from "remeda";
5
5
  import { getProperty } from "dot-prop";
6
- //#region ../components-base/src/list/filter/ListFilter.ts
6
+ // ../components-base/src/list/filter/ListFilter.ts
7
7
  var equalsPropertyMatcher = (filterValue, propertyValue) => filterValue === propertyValue;
8
8
  /** From how many values on a multiple-choice filter offers "Select all". */
9
9
  var selectAllMinValueCount = 6;
@@ -164,7 +164,10 @@ var ListFilter = class {
164
164
  this.callOnChangedHandlers(updatedValue);
165
165
  }
166
166
  callOnChangedHandlers(newValue) {
167
- const values = toArray(newValue).map((v) => v?.value);
167
+ this.notifyFilterUpdated(toArray(newValue).map((v) => v?.value));
168
+ }
169
+ /** Tells the listeners — the list resetting its batches among them. */
170
+ notifyFilterUpdated(values) {
168
171
  this.onFilterChangeCallbacks.forEach((cb) => cb(values));
169
172
  }
170
173
  hasChanges() {
@@ -221,7 +224,6 @@ var ListFilter = class {
221
224
  this.onFilterChangeCallbacks.add(cb);
222
225
  }
223
226
  };
224
- //#endregion
225
227
  export { ListFilter, ListFilter as default };
226
228
 
227
229
  //# sourceMappingURL=ListFilter.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListFilter.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/ListFilter.ts"],"sourcesContent":["import { toArray } from \"../../lib/array\";\nimport { getListColumn, type ListModelContext } from \"../ListModelContext\";\nimport type { ListSettingsOperationOptions } from \"../settings/types\";\nimport { customPropertyPrefix } from \"../types\";\nimport type { PropertyName, PropertyValueRenderMethod } from \"../types\";\nimport { ListFilterValue } from \"./ListFilterValue\";\nimport type {\n FilterMatcher,\n FilterMode,\n FilterUpdatedCallback,\n ListFilterShape,\n} from \"./types\";\nimport type {\n Column,\n ColumnDef,\n ColumnFilter,\n InitialTableState,\n} from \"@tanstack/table-core\";\nimport { getProperty } from \"dot-prop\";\nimport { difference, unique } from \"remeda\";\n\nconst equalsPropertyMatcher: FilterMatcher<unknown, never, never> = (\n filterValue,\n propertyValue,\n) => filterValue === propertyValue;\n\n/** From how many values on a multiple-choice filter offers \"Select all\". */\nconst selectAllMinValueCount = 6;\n\nconst stringCastRenderMethod: PropertyValueRenderMethod<unknown, never> = (\n value,\n) => String(value) as never;\n\n/** What `storeFilters` needs of a filter, and nothing more. */\ninterface StorableFilter {\n readonly storageKey: string;\n getArrayValue(): { id: string }[];\n}\n\n/**\n * One filter of a list: its values, which of them are on, and how that is\n * persisted.\n *\n * Framework-free apart from one thing, which is why `TRendered` exists: a\n * filter value has to be _shown_, and what \"shown\" is belongs to the binding.\n * React's `Filter` fills it with `ReactNode`; the default is `unknown`, so the\n * core can be read without deciding.\n *\n * The selected values live in the TanStack table's column filter, not here.\n * This translates: ids to values, values to a predicate, a toggle to a new\n * column filter.\n */\nexport class ListFilter<\n T = never,\n TProp extends PropertyName<T> = never,\n TMatchValue = never,\n TRendered = unknown,\n> {\n private _values?: ListFilterValue<TRendered>[] | undefined;\n private valuesFromTableState?: {\n facets: Map<unknown, number>;\n values: ListFilterValue<TRendered>[];\n };\n public readonly context: ListModelContext<T>;\n public readonly property: TProp;\n public readonly mode: FilterMode;\n public readonly matcher: FilterMatcher<T, never, never>;\n public readonly renderItem: PropertyValueRenderMethod<TMatchValue, TRendered>;\n public readonly name?: string;\n public readonly autosave: boolean;\n public readonly manualSave: boolean;\n private readonly onFilterChangeCallbacks = new Set<FilterUpdatedCallback>();\n private readonly defaultSelectedValues?: ListFilterValue<TRendered>[];\n public readonly priority: \"primary\" | \"secondary\";\n public readonly storageKey: string;\n\n public constructor(\n context: ListModelContext<T>,\n shape: ListFilterShape<T, TProp, TMatchValue, TRendered>,\n ) {\n const {\n autosave = context.settingsDefaults?.filters?.autosave ?? false,\n manualSave = context.settingsDefaults?.filters?.manualSave ?? true,\n property,\n mode = \"some\",\n values,\n matcher = equalsPropertyMatcher,\n renderItem = stringCastRenderMethod as PropertyValueRenderMethod<\n TMatchValue,\n TRendered\n >,\n priority = \"primary\",\n name,\n defaultSelected,\n onChange,\n } = shape;\n\n this.context = context;\n this.autosave = autosave;\n this.manualSave = manualSave;\n this.property = property;\n this.storageKey = String(property);\n this.mode = mode;\n this._values = values?.map((v) => ListFilterValue.create(this, v));\n this.matcher = matcher;\n this.renderItem = renderItem;\n this.name = name;\n this.priority = priority;\n this.defaultSelectedValues = defaultSelected?.map((v) =>\n ListFilterValue.create(this, v),\n );\n if (onChange) {\n this.onFilterChangeCallbacks.add(onChange);\n }\n }\n\n public updateInitialState(initialState: InitialTableState): void {\n const initialIds = this.getInitialSelectedIds();\n\n if (initialIds?.length) {\n initialState.columnFilters = [\n ...(initialState.columnFilters ?? []),\n {\n id: this.property as string,\n value: initialIds,\n },\n ];\n }\n }\n\n private getInitialSelectedIds(): string[] | undefined {\n return (\n this.getStoredSelectedIds({\n autosave: this.autosave,\n manualSave: this.manualSave,\n }) ?? this.defaultSelectedValues?.map((v) => v.id)\n );\n }\n\n private getStoredSelectedIds(\n options: ListSettingsOperationOptions,\n ): string[] | undefined {\n return this.context.settings?.get(\"activeFilters\", options)?.[\n this.storageKey\n ];\n }\n\n private getStoredSelectedValues(\n options: ListSettingsOperationOptions,\n ): ListFilterValue<TRendered>[] | undefined {\n return this.getStoredSelectedIds(options)\n ?.map((id) => this.values.find((v) => v.id === id))\n .filter((v): v is ListFilterValue<TRendered> => v !== undefined);\n }\n\n /**\n * Writes every filter's selection in one go — they share a settings key.\n *\n * Takes the two members it reads rather than a `ListFilter<any, …>`: a\n * `Table<never>` is not assignable to a `Table<any>` (a row model sits in a\n * contravariant position deep inside), so a list of concrete filters would\n * not go in.\n */\n public static storeFilters<T>(\n context: ListModelContext<T>,\n filters: StorableFilter[],\n options: ListSettingsOperationOptions,\n ): void {\n const data = Object.fromEntries(\n filters.map((filter) => [\n filter.storageKey,\n filter.getArrayValue().map((v) => v.id),\n ]),\n );\n\n context.settings?.store(\"activeFilters\", data, options);\n }\n\n public updateTableColumnDef(def: ColumnDef<T>): void {\n def.enableColumnFilter = true;\n def.filterFn = this.getTableFilterFn();\n }\n\n private getTableFilterFn(): ColumnDef<T>[\"filterFn\"] {\n return (row, _, filterValue) => {\n const propertyAsString = this.property as string;\n\n /*\n * A custom property is not on the item, so the matcher gets the item\n * itself and decides.\n */\n const filterBy = propertyAsString.startsWith(customPropertyPrefix)\n ? row.original\n : getProperty(row.original as object, propertyAsString);\n\n return this.checkFilterMatches(filterBy, filterValue);\n };\n }\n\n private checkFilterMatches(\n property: unknown,\n filterValueInput: unknown,\n ): boolean {\n if (filterValueInput === null) {\n return true;\n }\n\n const predicate = (filterValue: ListFilterValue<TRendered>) =>\n this.matcher(filterValue.value as never, property as never);\n\n const toFilterValue = (something: unknown) =>\n ListFilterValue.create(this, something);\n\n if (this.mode === \"all\") {\n return toArray(filterValueInput).map(toFilterValue).every(predicate);\n } else if (this.mode === \"some\") {\n const filterArr = toArray(filterValueInput);\n return (\n filterArr.length === 0 || filterArr.map(toFilterValue).some(predicate)\n );\n } else if (this.mode === \"one\") {\n const oneValue = Array.isArray(filterValueInput)\n ? filterValueInput[0]\n : filterValueInput;\n return predicate(toFilterValue(oneValue));\n }\n\n throw new Error(`Unknown filter mode '${this.mode}'`);\n }\n\n protected getTableColumnFilter(): ColumnFilter | undefined {\n return this.context.dataTable\n .getState()\n .columnFilters.find((f) => f.id === this.property);\n }\n\n protected getTableColumn(): Column<T> {\n return getListColumn(this.context.dataTable, this.property);\n }\n\n public getValue(): unknown {\n return this.getTableColumnFilter()?.value ?? null;\n }\n\n /*\n * Rebuilt only when TanStack hands out a new map: it memoizes the faceted\n * values and replaces the map when the data changes. Without this, every\n * row the filter function checks re-hashes every value — `getArrayValue()`\n * resolves each stored id through `values`.\n */\n private getValuesFromTableState(): ListFilterValue<TRendered>[] {\n const facets = this.getTableColumn().getFacetedUniqueValues();\n\n if (this.valuesFromTableState?.facets !== facets) {\n this.valuesFromTableState = {\n facets,\n values: unique(\n Array.from(facets.keys())\n .flatMap((v) => v)\n .filter((v) => v !== undefined && v !== null),\n ).map((v) => ListFilterValue.create(this, v)),\n };\n }\n\n return this.valuesFromTableState.values;\n }\n\n private checkIfValueIsUnknown(value: ListFilterValue<TRendered>): boolean {\n return !this.values.some((v) => v.id === value.id);\n }\n\n /**\n * Drops a selection the data no longer offers — a stored filter value whose\n * item is gone would otherwise filter everything away with no way to undo\n * it.\n */\n public deleteUnknownFilterValues(): void {\n /* Values the data offers are by definition known. */\n if (this._values === undefined) {\n return;\n }\n\n for (const currentValues of this.getArrayValue()) {\n if (this.checkIfValueIsUnknown(currentValues)) {\n this.deactivateValue(currentValues);\n }\n }\n }\n\n /**\n * The values the filter offers — the ones it was given, or the ones the data\n * has.\n *\n * Follows the table, not a snapshot. A binding that keeps one filter instance\n * for the list's lifetime would otherwise hold the answer from before the\n * first batch arrived: an async loader gives the header an empty menu and\n * never fills it. The values are cached per faceted-values map, which\n * TanStack replaces when the data changes.\n */\n public get values(): ListFilterValue<TRendered>[] {\n return this._values ?? this.getValuesFromTableState();\n }\n\n public getArrayValue(): ListFilterValue<TRendered>[] {\n const value = this.getValue();\n return value === null\n ? []\n : toArray(value).map((v) => ListFilterValue.create(this, v));\n }\n\n public isValueActive(value: ListFilterValue<TRendered>): boolean {\n return this.getArrayValue().some((v) => v.equals(value));\n }\n\n public isActive(): boolean {\n return this.getArrayValue().length > 0;\n }\n\n public deactivateValue(value: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n const updatedValue =\n this.mode === \"all\" || this.mode === \"some\"\n ? currentValueAsArray.filter((v) => !v.equals(value))\n : null;\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n private callOnChangedHandlers(\n newValue: ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null,\n ): void {\n const values = toArray(newValue).map((v) => v?.value);\n this.onFilterChangeCallbacks.forEach((cb) => cb(values));\n }\n\n public hasChanges(): boolean {\n const currentIds = this.getArrayValue().map((v) => v.id);\n\n const defaultIds =\n this.getStoredSelectedIds({ autosave: false }) ??\n this.defaultSelectedValues?.map((v) => v.id) ??\n [];\n\n return (\n currentIds.length !== defaultIds.length ||\n difference(currentIds, defaultIds).length > 0\n );\n }\n\n public isStoringAvailable(): boolean {\n return !!this.context.settings && this.manualSave;\n }\n\n public resetValues(): void {\n const storedValues =\n this.getStoredSelectedValues({ autosave: false }) ??\n this.defaultSelectedValues;\n\n const resetTo =\n storedValues ?? (this.mode === \"all\" || this.mode === \"some\" ? [] : null);\n\n this.getTableColumn().setFilterValue(resetTo);\n this.callOnChangedHandlers(resetTo);\n }\n\n public clear(): void {\n this.getTableColumn().setFilterValue(null);\n this.callOnChangedHandlers(null);\n }\n\n public toggleValue(newValue: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n let updatedValue:\n ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null;\n\n if (this.mode === \"all\" || this.mode === \"some\") {\n updatedValue = newValue.isActive\n ? currentValueAsArray.filter((v) => !v.equals(newValue))\n : [...currentValueAsArray, newValue];\n } else {\n updatedValue = newValue.isActive ? null : newValue;\n }\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n /**\n * Whether the filter offers \"Select all\" — a `some` filter with enough\n * values.\n */\n public get isSelectAllAvailable(): boolean {\n return this.mode === \"some\" && this.values.length >= selectAllMinValueCount;\n }\n\n public isEveryValueActive(): boolean {\n return this.values.every((v) => v.isActive);\n }\n\n public selectAll(): void {\n this.setArrayValue(this.values);\n }\n\n /** Makes exactly these values active — what a multiple-selection menu reports. */\n public setActiveValueIds(ids: Iterable<unknown>): void {\n const idSet = new Set(ids);\n this.setArrayValue(this.values.filter((v) => idSet.has(v.id)));\n }\n\n public deselectAll(): void {\n this.setArrayValue([]);\n }\n\n private setArrayValue(value: ListFilterValue<TRendered>[]): void {\n this.getTableColumn().setFilterValue(value);\n this.callOnChangedHandlers(value);\n }\n\n public onFilterUpdated(cb: () => unknown): void {\n this.onFilterChangeCallbacks.add(cb);\n }\n}\n\nexport default ListFilter;\n"],"mappings":";;;;;;AAqBA,IAAM,yBACJ,aACA,kBACG,gBAAgB;;AAGrB,IAAM,yBAAyB;AAE/B,IAAM,0BACJ,UACG,OAAO,KAAK;;;;;;;;;;;;;;AAqBjB,IAAa,aAAb,MAKE;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,0CAA2C,IAAI,IAA2B;CAC1E;CACA;CACA;CAEA,YACE,SACA,OACA;EACA,MAAM,EACJ,WAAW,QAAQ,kBAAkB,SAAS,YAAY,OAC1D,aAAa,QAAQ,kBAAkB,SAAS,cAAc,MAC9D,UACA,OAAO,QACP,QACA,UAAU,uBACV,aAAa,wBAIb,WAAW,WACX,MACA,iBACA,aACE;EAEJ,KAAK,UAAU;EACf,KAAK,WAAW;EAChB,KAAK,aAAa;EAClB,KAAK,WAAW;EAChB,KAAK,aAAa,OAAO,QAAQ;EACjC,KAAK,OAAO;EACZ,KAAK,UAAU,QAAQ,KAAK,MAAM,gBAAgB,OAAO,MAAM,CAAC,CAAC;EACjE,KAAK,UAAU;EACf,KAAK,aAAa;EAClB,KAAK,OAAO;EACZ,KAAK,WAAW;EAChB,KAAK,wBAAwB,iBAAiB,KAAK,MACjD,gBAAgB,OAAO,MAAM,CAAC,CAChC;EACA,IAAI,UACF,KAAK,wBAAwB,IAAI,QAAQ;CAE7C;CAEA,mBAA0B,cAAuC;EAC/D,MAAM,aAAa,KAAK,sBAAsB;EAE9C,IAAI,YAAY,QACd,aAAa,gBAAgB,CAC3B,GAAI,aAAa,iBAAiB,CAAC,GACnC;GACE,IAAI,KAAK;GACT,OAAO;EACT,CACF;CAEJ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sB,OAAO;CACpC;CAEA,QAAqB;EACnB,KAAK,eAAe,CAAC,CAAC,eAAe,IAAI;EACzC,KAAK,sBAAsB,IAAI;CACjC;CAEA,YAAmB,UAA4C;EAC7D,MAAM,sBAAsB,KAAK,cAAc;EAE/C,IAAI;EAGJ,IAAI,KAAK,SAAS,SAAS,KAAK,SAAS,QACvC,eAAe,SAAS,WACpB,oBAAoB,QAAQ,MAAM,CAAC,EAAE,OAAO,QAAQ,CAAC,IACrD,CAAC,GAAG,qBAAqB,QAAQ;OAErC,eAAe,SAAS,WAAW,OAAO;EAG5C,KAAK,eAAe,CAAC,CAAC,eAAe,YAAY;EACjD,KAAK,sBAAsB,YAAY;CACzC;;;;;CAMA,IAAW,uBAAgC;EACzC,OAAO,KAAK,SAAS,UAAU,KAAK,OAAO,UAAU;CACvD;CAEA,qBAAqC;EACnC,OAAO,KAAK,OAAO,OAAO,MAAM,EAAE,QAAQ;CAC5C;CAEA,YAAyB;EACvB,KAAK,cAAc,KAAK,MAAM;CAChC;;CAGA,kBAAyB,KAA8B;EACrD,MAAM,QAAQ,IAAI,IAAI,GAAG;EACzB,KAAK,cAAc,KAAK,OAAO,QAAQ,MAAM,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;CAC/D;CAEA,cAA2B;EACzB,KAAK,cAAc,CAAC,CAAC;CACvB;CAEA,cAAsB,OAA2C;EAC/D,KAAK,eAAe,CAAC,CAAC,eAAe,KAAK;EAC1C,KAAK,sBAAsB,KAAK;CAClC;CAEA,gBAAuB,IAAyB;EAC9C,KAAK,wBAAwB,IAAI,EAAE;CACrC;AACF"}
1
+ {"version":3,"file":"ListFilter.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/ListFilter.ts"],"sourcesContent":["import { toArray } from \"../../lib/array\";\nimport { getListColumn, type ListModelContext } from \"../ListModelContext\";\nimport type { ListSettingsOperationOptions } from \"../settings/types\";\nimport { customPropertyPrefix } from \"../types\";\nimport type { PropertyName, PropertyValueRenderMethod } from \"../types\";\nimport { ListFilterValue } from \"./ListFilterValue\";\nimport type {\n FilterMatcher,\n FilterMode,\n FilterUpdatedCallback,\n ListFilterShape,\n} from \"./types\";\nimport type {\n Column,\n ColumnDef,\n ColumnFilter,\n InitialTableState,\n} from \"@tanstack/table-core\";\nimport { getProperty } from \"dot-prop\";\nimport { difference, unique } from \"remeda\";\n\nconst equalsPropertyMatcher: FilterMatcher<unknown, never, never> = (\n filterValue,\n propertyValue,\n) => filterValue === propertyValue;\n\n/** From how many values on a multiple-choice filter offers \"Select all\". */\nconst selectAllMinValueCount = 6;\n\nconst stringCastRenderMethod: PropertyValueRenderMethod<unknown, never> = (\n value,\n) => String(value) as never;\n\n/** What `storeFilters` needs of a filter, and nothing more. */\ninterface StorableFilter {\n readonly storageKey: string;\n getArrayValue(): { id: string }[];\n}\n\n/**\n * One filter of a list: its values, which of them are on, and how that is\n * persisted.\n *\n * Framework-free apart from one thing, which is why `TRendered` exists: a\n * filter value has to be _shown_, and what \"shown\" is belongs to the binding.\n * React's `Filter` fills it with `ReactNode`; the default is `unknown`, so the\n * core can be read without deciding.\n *\n * The selected values live in the TanStack table's column filter, not here.\n * This translates: ids to values, values to a predicate, a toggle to a new\n * column filter.\n */\nexport class ListFilter<\n T = never,\n TProp extends PropertyName<T> = never,\n TMatchValue = never,\n TRendered = unknown,\n> {\n private _values?: ListFilterValue<TRendered>[] | undefined;\n private valuesFromTableState?: {\n facets: Map<unknown, number>;\n values: ListFilterValue<TRendered>[];\n };\n public readonly context: ListModelContext<T>;\n public readonly property: TProp;\n public readonly mode: FilterMode;\n public readonly matcher: FilterMatcher<T, never, never>;\n public readonly renderItem: PropertyValueRenderMethod<TMatchValue, TRendered>;\n public readonly name?: string;\n public readonly autosave: boolean;\n public readonly manualSave: boolean;\n private readonly onFilterChangeCallbacks = new Set<FilterUpdatedCallback>();\n private readonly defaultSelectedValues?: ListFilterValue<TRendered>[];\n public readonly priority: \"primary\" | \"secondary\";\n public readonly storageKey: string;\n\n public constructor(\n context: ListModelContext<T>,\n shape: ListFilterShape<T, TProp, TMatchValue, TRendered>,\n ) {\n const {\n autosave = context.settingsDefaults?.filters?.autosave ?? false,\n manualSave = context.settingsDefaults?.filters?.manualSave ?? true,\n property,\n mode = \"some\",\n values,\n matcher = equalsPropertyMatcher,\n renderItem = stringCastRenderMethod as PropertyValueRenderMethod<\n TMatchValue,\n TRendered\n >,\n priority = \"primary\",\n name,\n defaultSelected,\n onChange,\n } = shape;\n\n this.context = context;\n this.autosave = autosave;\n this.manualSave = manualSave;\n this.property = property;\n this.storageKey = String(property);\n this.mode = mode;\n this._values = values?.map((v) => ListFilterValue.create(this, v));\n this.matcher = matcher;\n this.renderItem = renderItem;\n this.name = name;\n this.priority = priority;\n this.defaultSelectedValues = defaultSelected?.map((v) =>\n ListFilterValue.create(this, v),\n );\n if (onChange) {\n this.onFilterChangeCallbacks.add(onChange);\n }\n }\n\n public updateInitialState(initialState: InitialTableState): void {\n const initialIds = this.getInitialSelectedIds();\n\n if (initialIds?.length) {\n initialState.columnFilters = [\n ...(initialState.columnFilters ?? []),\n {\n id: this.property as string,\n value: initialIds,\n },\n ];\n }\n }\n\n private getInitialSelectedIds(): string[] | undefined {\n return (\n this.getStoredSelectedIds({\n autosave: this.autosave,\n manualSave: this.manualSave,\n }) ?? this.defaultSelectedValues?.map((v) => v.id)\n );\n }\n\n private getStoredSelectedIds(\n options: ListSettingsOperationOptions,\n ): string[] | undefined {\n return this.context.settings?.get(\"activeFilters\", options)?.[\n this.storageKey\n ];\n }\n\n private getStoredSelectedValues(\n options: ListSettingsOperationOptions,\n ): ListFilterValue<TRendered>[] | undefined {\n return this.getStoredSelectedIds(options)\n ?.map((id) => this.values.find((v) => v.id === id))\n .filter((v): v is ListFilterValue<TRendered> => v !== undefined);\n }\n\n /**\n * Writes every filter's selection in one go — they share a settings key.\n *\n * Takes the two members it reads rather than a `ListFilter<any, …>`: a\n * `Table<never>` is not assignable to a `Table<any>` (a row model sits in a\n * contravariant position deep inside), so a list of concrete filters would\n * not go in.\n */\n public static storeFilters<T>(\n context: ListModelContext<T>,\n filters: StorableFilter[],\n options: ListSettingsOperationOptions,\n ): void {\n const data = Object.fromEntries(\n filters.map((filter) => [\n filter.storageKey,\n filter.getArrayValue().map((v) => v.id),\n ]),\n );\n\n context.settings?.store(\"activeFilters\", data, options);\n }\n\n public updateTableColumnDef(def: ColumnDef<T>): void {\n def.enableColumnFilter = true;\n def.filterFn = this.getTableFilterFn();\n }\n\n private getTableFilterFn(): ColumnDef<T>[\"filterFn\"] {\n return (row, _, filterValue) => {\n const propertyAsString = this.property as string;\n\n /*\n * A custom property is not on the item, so the matcher gets the item\n * itself and decides.\n */\n const filterBy = propertyAsString.startsWith(customPropertyPrefix)\n ? row.original\n : getProperty(row.original as object, propertyAsString);\n\n return this.checkFilterMatches(filterBy, filterValue);\n };\n }\n\n private checkFilterMatches(\n property: unknown,\n filterValueInput: unknown,\n ): boolean {\n if (filterValueInput === null) {\n return true;\n }\n\n const predicate = (filterValue: ListFilterValue<TRendered>) =>\n this.matcher(filterValue.value as never, property as never);\n\n const toFilterValue = (something: unknown) =>\n ListFilterValue.create(this, something);\n\n if (this.mode === \"all\") {\n return toArray(filterValueInput).map(toFilterValue).every(predicate);\n } else if (this.mode === \"some\") {\n const filterArr = toArray(filterValueInput);\n return (\n filterArr.length === 0 || filterArr.map(toFilterValue).some(predicate)\n );\n } else if (this.mode === \"one\") {\n const oneValue = Array.isArray(filterValueInput)\n ? filterValueInput[0]\n : filterValueInput;\n return predicate(toFilterValue(oneValue));\n }\n\n throw new Error(`Unknown filter mode '${this.mode}'`);\n }\n\n protected getTableColumnFilter(): ColumnFilter | undefined {\n return this.context.dataTable\n .getState()\n .columnFilters.find((f) => f.id === this.property);\n }\n\n protected getTableColumn(): Column<T> {\n return getListColumn(this.context.dataTable, this.property);\n }\n\n public getValue(): unknown {\n return this.getTableColumnFilter()?.value ?? null;\n }\n\n /*\n * Rebuilt only when TanStack hands out a new map: it memoizes the faceted\n * values and replaces the map when the data changes. Without this, every\n * row the filter function checks re-hashes every value — `getArrayValue()`\n * resolves each stored id through `values`.\n */\n private getValuesFromTableState(): ListFilterValue<TRendered>[] {\n const facets = this.getTableColumn().getFacetedUniqueValues();\n\n if (this.valuesFromTableState?.facets !== facets) {\n this.valuesFromTableState = {\n facets,\n values: unique(\n Array.from(facets.keys())\n .flatMap((v) => v)\n .filter((v) => v !== undefined && v !== null),\n ).map((v) => ListFilterValue.create(this, v)),\n };\n }\n\n return this.valuesFromTableState.values;\n }\n\n private checkIfValueIsUnknown(value: ListFilterValue<TRendered>): boolean {\n return !this.values.some((v) => v.id === value.id);\n }\n\n /**\n * Drops a selection the data no longer offers — a stored filter value whose\n * item is gone would otherwise filter everything away with no way to undo\n * it.\n */\n public deleteUnknownFilterValues(): void {\n /* Values the data offers are by definition known. */\n if (this._values === undefined) {\n return;\n }\n\n for (const currentValues of this.getArrayValue()) {\n if (this.checkIfValueIsUnknown(currentValues)) {\n this.deactivateValue(currentValues);\n }\n }\n }\n\n /**\n * The values the filter offers — the ones it was given, or the ones the data\n * has.\n *\n * Follows the table, not a snapshot. A binding that keeps one filter instance\n * for the list's lifetime would otherwise hold the answer from before the\n * first batch arrived: an async loader gives the header an empty menu and\n * never fills it. The values are cached per faceted-values map, which\n * TanStack replaces when the data changes.\n */\n public get values(): ListFilterValue<TRendered>[] {\n return this._values ?? this.getValuesFromTableState();\n }\n\n public getArrayValue(): ListFilterValue<TRendered>[] {\n const value = this.getValue();\n return value === null\n ? []\n : toArray(value).map((v) => ListFilterValue.create(this, v));\n }\n\n public isValueActive(value: ListFilterValue<TRendered>): boolean {\n return this.getArrayValue().some((v) => v.equals(value));\n }\n\n public isActive(): boolean {\n return this.getArrayValue().length > 0;\n }\n\n public deactivateValue(value: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n const updatedValue =\n this.mode === \"all\" || this.mode === \"some\"\n ? currentValueAsArray.filter((v) => !v.equals(value))\n : null;\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n private callOnChangedHandlers(\n newValue: ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null,\n ): void {\n this.notifyFilterUpdated(toArray(newValue).map((v) => v?.value));\n }\n\n /** Tells the listeners — the list resetting its batches among them. */\n protected notifyFilterUpdated(values: unknown[]): void {\n this.onFilterChangeCallbacks.forEach((cb) => cb(values));\n }\n\n public hasChanges(): boolean {\n const currentIds = this.getArrayValue().map((v) => v.id);\n\n const defaultIds =\n this.getStoredSelectedIds({ autosave: false }) ??\n this.defaultSelectedValues?.map((v) => v.id) ??\n [];\n\n return (\n currentIds.length !== defaultIds.length ||\n difference(currentIds, defaultIds).length > 0\n );\n }\n\n public isStoringAvailable(): boolean {\n return !!this.context.settings && this.manualSave;\n }\n\n public resetValues(): void {\n const storedValues =\n this.getStoredSelectedValues({ autosave: false }) ??\n this.defaultSelectedValues;\n\n const resetTo =\n storedValues ?? (this.mode === \"all\" || this.mode === \"some\" ? [] : null);\n\n this.getTableColumn().setFilterValue(resetTo);\n this.callOnChangedHandlers(resetTo);\n }\n\n public clear(): void {\n this.getTableColumn().setFilterValue(null);\n this.callOnChangedHandlers(null);\n }\n\n public toggleValue(newValue: ListFilterValue<TRendered>): void {\n const currentValueAsArray = this.getArrayValue();\n\n let updatedValue:\n ListFilterValue<TRendered>[] | ListFilterValue<TRendered> | null;\n\n if (this.mode === \"all\" || this.mode === \"some\") {\n updatedValue = newValue.isActive\n ? currentValueAsArray.filter((v) => !v.equals(newValue))\n : [...currentValueAsArray, newValue];\n } else {\n updatedValue = newValue.isActive ? null : newValue;\n }\n\n this.getTableColumn().setFilterValue(updatedValue);\n this.callOnChangedHandlers(updatedValue);\n }\n\n /**\n * Whether the filter offers \"Select all\" — a `some` filter with enough\n * values.\n */\n public get isSelectAllAvailable(): boolean {\n return this.mode === \"some\" && this.values.length >= selectAllMinValueCount;\n }\n\n public isEveryValueActive(): boolean {\n return this.values.every((v) => v.isActive);\n }\n\n public selectAll(): void {\n this.setArrayValue(this.values);\n }\n\n /** Makes exactly these values active — what a multiple-selection menu reports. */\n public setActiveValueIds(ids: Iterable<unknown>): void {\n const idSet = new Set(ids);\n this.setArrayValue(this.values.filter((v) => idSet.has(v.id)));\n }\n\n public deselectAll(): void {\n this.setArrayValue([]);\n }\n\n private setArrayValue(value: ListFilterValue<TRendered>[]): void {\n this.getTableColumn().setFilterValue(value);\n this.callOnChangedHandlers(value);\n }\n\n public onFilterUpdated(cb: () => unknown): void {\n this.onFilterChangeCallbacks.add(cb);\n }\n}\n\nexport default ListFilter;\n"],"mappings":";;;;;;AAqBA,IAAM,yBACJ,aACA,kBACG,gBAAgB;;AAGrB,IAAM,yBAAyB;AAE/B,IAAM,0BACJ,UACG,OAAO,KAAK;;;;;;;;;;;;;;AAqBjB,IAAa,aAAb,MAKE;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,0CAA2C,IAAI,IAA2B;CAC1E;CACA;CACA;CAEA,YACE,SACA,OACA;EACA,MAAM,EACJ,WAAW,QAAQ,kBAAkB,SAAS,YAAY,OAC1D,aAAa,QAAQ,kBAAkB,SAAS,cAAc,MAC9D,UACA,OAAO,QACP,QACA,UAAU,uBACV,aAAa,wBAIb,WAAW,WACX,MACA,iBACA,aACE;EAEJ,KAAK,UAAU;EACf,KAAK,WAAW;EAChB,KAAK,aAAa;EAClB,KAAK,WAAW;EAChB,KAAK,aAAa,OAAO,QAAQ;EACjC,KAAK,OAAO;EACZ,KAAK,UAAU,QAAQ,KAAK,MAAM,gBAAgB,OAAO,MAAM,CAAC,CAAC;EACjE,KAAK,UAAU;EACf,KAAK,aAAa;EAClB,KAAK,OAAO;EACZ,KAAK,WAAW;EAChB,KAAK,wBAAwB,iBAAiB,KAAK,MACjD,gBAAgB,OAAO,MAAM,CAAC,CAChC;EACA,IAAI,UACF,KAAK,wBAAwB,IAAI,QAAQ;CAE7C;CAEA,mBAA0B,cAAu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  import { isShallowEqual } from "remeda";
3
- //#region ../components-base/src/list/filter/ListFilterValue.ts
3
+ // ../components-base/src/list/filter/ListFilterValue.ts
4
4
  var idPrefix = "FilterValueId@@";
5
5
  /**
6
6
  * One selectable value of a filter, and the identity it is stored under.
@@ -43,7 +43,6 @@ var ListFilterValue = class ListFilterValue {
43
43
  this.filter.deactivateValue(this);
44
44
  }
45
45
  };
46
- //#endregion
47
46
  export { ListFilterValue, ListFilterValue as default };
48
47
 
49
48
  //# sourceMappingURL=ListFilterValue.mjs.map
@@ -1,25 +1,50 @@
1
- import { CalendarDate } from "@internationalized/date";
1
+ import { CalendarDate, CalendarDateTime, ZonedDateTime } from "@internationalized/date";
2
2
  import { DateTime } from "luxon";
3
- //#region ../components-base/src/list/filter/dateRange.ts
3
+ // ../components-base/src/list/filter/dateRange.ts
4
4
  /** A range needs both ends present to be one, even if either may be unset. */
5
5
  var isListDateRange = (value) => !!value && typeof value === "object" && "start" in value && "end" in value;
6
- var startOfDay = (date) => DateTime.fromObject({
6
+ var hasTime = (date) => "hour" in date;
7
+ /**
8
+ * The date as a local point in time. A `ZonedDateTime` is the instant it names;
9
+ * anything else is read field by field, since after crossing the remote
10
+ * boundary a `CalendarDate` is a plain object.
11
+ */
12
+ var listDateToDateTime = (date) => date instanceof ZonedDateTime ? DateTime.fromJSDate(date.toDate()) : DateTime.fromObject({
7
13
  year: date.year,
8
14
  month: date.month,
9
- day: date.day
15
+ day: date.day,
16
+ ...hasTime(date) ? {
17
+ hour: date.hour,
18
+ minute: date.minute,
19
+ second: date.second
20
+ } : {}
10
21
  });
11
22
  /**
23
+ * Resolves a range to the instants it spans, for filtering on the server side.
24
+ * Both bounds are inclusive: a date covers its whole day and a date with time
25
+ * its whole minute, in the user's local time zone. A missing side has no
26
+ * bound.
27
+ */
28
+ var resolveListDateRange = (range) => {
29
+ const unit = (date) => hasTime(date) ? "minute" : "day";
30
+ return {
31
+ start: range.start ? listDateToDateTime(range.start).startOf(unit(range.start)).toJSDate() : void 0,
32
+ end: range.end ? listDateToDateTime(range.end).endOf(unit(range.end)).toJSDate() : void 0
33
+ };
34
+ };
35
+ /**
12
36
  * The cell's value as a point in time, or `undefined` when the filter does not
13
37
  * treat it as a date.
14
38
  *
15
- * Three shapes count, each on its own terms: a luxon `DateTime` and an ISO 8601
16
- * string are compared as the instant they name — a date-only string as the
17
- * start of its day — and a `CalendarDate` as its day. Anything else, a plain `{
18
- * year, month, day }` object included, is not a date here.
39
+ * A luxon `DateTime` and an ISO 8601 string are compared as the instant they
40
+ * name — a date-only string as the start of its day. A `CalendarDate` counts as
41
+ * the start of its day, a `CalendarDateTime` as its local time and a
42
+ * `ZonedDateTime` as its instant. Anything else, a plain `{ year, month, day }`
43
+ * object included, is not a date here.
19
44
  */
20
45
  var toDateTime = (value) => {
21
46
  if (value instanceof DateTime) return value;
22
- if (value instanceof CalendarDate) return startOfDay(value);
47
+ if (value instanceof CalendarDate || value instanceof CalendarDateTime || value instanceof ZonedDateTime) return listDateToDateTime(value);
23
48
  if (typeof value === "string") return DateTime.fromISO(value);
24
49
  };
25
50
  /**
@@ -33,17 +58,15 @@ var dateRangeFilterFn = (row, columnId, range) => {
33
58
  if (!range) return true;
34
59
  const dateValue = toDateTime(row.getValue(columnId));
35
60
  if (!dateValue) return true;
36
- const startDate = range.start ? startOfDay(range.start) : void 0;
37
- const endDate = range.end ? startOfDay(range.end).endOf("day") : void 0;
38
- if (startDate && dateValue < startDate) return false;
39
- return !(endDate && dateValue > endDate);
61
+ const { start, end } = resolveListDateRange(range);
62
+ if (start && dateValue.toMillis() < start.getTime()) return false;
63
+ return !(end && dateValue.toMillis() > end.getTime());
40
64
  };
41
65
  /** Turns the column into one a date range filters. */
42
66
  var applyDateRangeColumnDef = (def) => {
43
67
  def.enableColumnFilter = true;
44
68
  def.filterFn = dateRangeFilterFn;
45
69
  };
46
- //#endregion
47
- export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange };
70
+ export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange, listDateToDateTime, resolveListDateRange };
48
71
 
49
72
  //# sourceMappingURL=dateRange.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateRange.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/dateRange.ts"],"sourcesContent":["import { CalendarDate } from \"@internationalized/date\";\nimport type { ColumnDef, Row } from \"@tanstack/table-core\";\nimport { DateTime } from \"luxon\";\n\n/** A calendar date, in whichever shape it reached the filter. */\nexport interface ListDateParts {\n readonly year: number;\n readonly month: number;\n readonly day: number;\n}\n\nexport interface ListDateRange {\n readonly start?: ListDateParts;\n readonly end?: ListDateParts;\n}\n\n/** A range needs both ends present to be one, even if either may be unset. */\nexport const isListDateRange = (value: unknown): value is ListDateRange =>\n !!value && typeof value === \"object\" && \"start\" in value && \"end\" in value;\n\n/*\n * The range's ends are read field by field: they come from the calendar, and\n * after crossing the remote boundary a `CalendarDate` is a plain object.\n */\nconst startOfDay = (date: ListDateParts): DateTime =>\n DateTime.fromObject({\n year: date.year,\n month: date.month,\n day: date.day,\n });\n\n/**\n * The cell's value as a point in time, or `undefined` when the filter does not\n * treat it as a date.\n *\n * Three shapes count, each on its own terms: a luxon `DateTime` and an ISO 8601\n * string are compared as the instant they name — a date-only string as the\n * start of its day — and a `CalendarDate` as its day. Anything else, a plain `{\n * year, month, day }` object included, is not a date here.\n */\nconst toDateTime = (value: unknown): DateTime | undefined => {\n if (value instanceof DateTime) {\n return value;\n }\n if (value instanceof CalendarDate) {\n return startOfDay(value);\n }\n if (typeof value === \"string\") {\n return DateTime.fromISO(value);\n }\n return undefined;\n};\n\n/**\n * Whether a row's date falls inside the selected range.\n *\n * A value that is not a date keeps its row: a filter the data cannot answer\n * should not empty the list. That includes a string luxon cannot parse — the\n * invalid `DateTime` compares as `NaN`, and neither end excludes it.\n */\nexport const dateRangeFilterFn = <T>(\n row: Row<T>,\n columnId: string,\n range?: ListDateRange,\n): boolean => {\n if (!range) {\n return true;\n }\n\n const dateValue = toDateTime(row.getValue(columnId));\n\n if (!dateValue) {\n return true;\n }\n\n const startDate = range.start ? startOfDay(range.start) : undefined;\n /* The whole end day counts, up to its last moment. */\n const endDate = range.end ? startOfDay(range.end).endOf(\"day\") : undefined;\n\n if (startDate && dateValue < startDate) {\n return false;\n }\n\n return !(endDate && dateValue > endDate);\n};\n\n/** Turns the column into one a date range filters. */\nexport const applyDateRangeColumnDef = <T>(def: ColumnDef<T>): void => {\n def.enableColumnFilter = true;\n def.filterFn = dateRangeFilterFn;\n};\n"],"mappings":";;;;AAiBA,IAAa,mBAAmB,UAC9B,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,WAAW,SAAS,SAAS;AAMvE,IAAM,cAAc,SAClB,SAAS,WAAW;CAClB,MAAM,KAAK;CACX,OAAO,KAAK;CACZ,KAAK,KAAK;AACZ,CAAC;;;;;;;;;;AAWH,IAAM,cAAc,UAAyC;CAC3D,IAAI,iBAAiB,UACnB,OAAO;CAET,IAAI,iBAAiB,cACnB,OAAO,WAAW,KAAK;CAEzB,IAAI,OAAO,UAAU,UACnB,OAAO,SAAS,QAAQ,KAAK;AAGjC;;;;;;;;AASA,IAAa,qBACX,KACA,UACA,UACY;CACZ,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,YAAY,WAAW,IAAI,SAAS,QAAQ,CAAC;CAEnD,IAAI,CAAC,WACH,OAAO;CAGT,MAAM,YAAY,MAAM,QAAQ,WAAW,MAAM,KAAK,IAAI,KAAA;CAE1D,MAAM,UAAU,MAAM,MAAM,WAAW,MAAM,GAAG,CAAC,CAAC,MAAM,KAAK,IAAI,KAAA;CAEjE,IAAI,aAAa,YAAY,WAC3B,OAAO;CAGT,OAAO,EAAE,WAAW,YAAY;AAClC;;AAGA,IAAa,2BAA8B,QAA4B;CACrE,IAAI,qBAAqB;CACzB,IAAI,WAAW;AACjB"}
1
+ {"version":3,"file":"dateRange.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/dateRange.ts"],"sourcesContent":["import {\n CalendarDate,\n CalendarDateTime,\n ZonedDateTime,\n} from \"@internationalized/date\";\nimport type { ColumnDef, Row } from \"@tanstack/table-core\";\nimport { DateTime } from \"luxon\";\n\n/**\n * A calendar date, in whichever shape it reached the filter — with a time of\n * day when the filter narrows down by minute.\n */\nexport interface ListDateParts {\n readonly year: number;\n readonly month: number;\n readonly day: number;\n readonly hour?: number;\n readonly minute?: number;\n readonly second?: number;\n}\n\nexport interface ListDateRange {\n readonly start?: ListDateParts;\n readonly end?: ListDateParts;\n}\n\n/** A range needs both ends present to be one, even if either may be unset. */\nexport const isListDateRange = (value: unknown): value is ListDateRange =>\n !!value && typeof value === \"object\" && \"start\" in value && \"end\" in value;\n\nconst hasTime = (date: ListDateParts) => \"hour\" in date;\n\n/**\n * The date as a local point in time. A `ZonedDateTime` is the instant it names;\n * anything else is read field by field, since after crossing the remote\n * boundary a `CalendarDate` is a plain object.\n */\nexport const listDateToDateTime = (date: ListDateParts): DateTime =>\n date instanceof ZonedDateTime\n ? DateTime.fromJSDate(date.toDate())\n : DateTime.fromObject({\n year: date.year,\n month: date.month,\n day: date.day,\n ...(hasTime(date)\n ? { hour: date.hour, minute: date.minute, second: date.second }\n : {}),\n });\n\n/**\n * Resolves a range to the instants it spans, for filtering on the server side.\n * Both bounds are inclusive: a date covers its whole day and a date with time\n * its whole minute, in the user's local time zone. A missing side has no\n * bound.\n */\nexport const resolveListDateRange = (\n range: ListDateRange,\n): { start?: Date; end?: Date } => {\n const unit = (date: ListDateParts) => (hasTime(date) ? \"minute\" : \"day\");\n\n return {\n start: range.start\n ? listDateToDateTime(range.start).startOf(unit(range.start)).toJSDate()\n : undefined,\n end: range.end\n ? listDateToDateTime(range.end).endOf(unit(range.end)).toJSDate()\n : undefined,\n };\n};\n\n/**\n * The cell's value as a point in time, or `undefined` when the filter does not\n * treat it as a date.\n *\n * A luxon `DateTime` and an ISO 8601 string are compared as the instant they\n * name — a date-only string as the start of its day. A `CalendarDate` counts as\n * the start of its day, a `CalendarDateTime` as its local time and a\n * `ZonedDateTime` as its instant. Anything else, a plain `{ year, month, day }`\n * object included, is not a date here.\n */\nconst toDateTime = (value: unknown): DateTime | undefined => {\n if (value instanceof DateTime) {\n return value;\n }\n if (\n value instanceof CalendarDate ||\n value instanceof CalendarDateTime ||\n value instanceof ZonedDateTime\n ) {\n return listDateToDateTime(value);\n }\n if (typeof value === \"string\") {\n return DateTime.fromISO(value);\n }\n return undefined;\n};\n\n/**\n * Whether a row's date falls inside the selected range.\n *\n * A value that is not a date keeps its row: a filter the data cannot answer\n * should not empty the list. That includes a string luxon cannot parse — the\n * invalid `DateTime` compares as `NaN`, and neither end excludes it.\n */\nexport const dateRangeFilterFn = <T>(\n row: Row<T>,\n columnId: string,\n range?: ListDateRange,\n): boolean => {\n if (!range) {\n return true;\n }\n\n const dateValue = toDateTime(row.getValue(columnId));\n\n if (!dateValue) {\n return true;\n }\n\n const { start, end } = resolveListDateRange(range);\n\n if (start && dateValue.toMillis() < start.getTime()) {\n return false;\n }\n\n return !(end && dateValue.toMillis() > end.getTime());\n};\n\n/** Turns the column into one a date range filters. */\nexport const applyDateRangeColumnDef = <T>(def: ColumnDef<T>): void => {\n def.enableColumnFilter = true;\n def.filterFn = dateRangeFilterFn;\n};\n"],"mappings":";;;;AA2BA,IAAa,mBAAmB,UAC9B,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,WAAW,SAAS,SAAS;AAEvE,IAAM,WAAW,SAAwB,UAAU;;;;;;AAOnD,IAAa,sBAAsB,SACjC,gBAAgB,gBACZ,SAAS,WAAW,KAAK,OAAO,CAAC,IACjC,SAAS,WAAW;CAClB,MAAM,KAAK;CACX,OAAO,KAAK;CACZ,KAAK,KAAK;CACV,GAAI,QAAQ,IAAI,IACZ;EAAE,MAAM,KAAK;EAAM,QAAQ,KAAK;EAAQ,QAAQ,KAAK;CAAO,IAC5D,CAAC;AACP,CAAC;;;;;;;AAQP,IAAa,wBACX,UACiC;CACjC,MAAM,QAAQ,SAAyB,QAAQ,IAAI,IAAI,WAAW;CAElE,OAAO;EACL,OAAO,MAAM,QACT,mBAAmB,MAAM,KAAK,CAAC,CAAC,QAAQ,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC,SAAS,IACpE,KAAA;EACJ,KAAK,MAAM,MACP,mBAAmB,MAAM,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,IAC9D,KAAA;CACN;AACF;;;;;;;;;;;AAYA,IAAM,cAAc,UAAyC;CAC3D,IAAI,iBAAiB,UACnB,OAAO;CAET,IACE,iBAAiB,gBACjB,iBAAiB,oBACjB,iBAAiB,eAEjB,OAAO,mBAAmB,KAAK;CAEjC,IAAI,OAAO,UAAU,UACnB,OAAO,SAAS,QAAQ,KAAK;AAGjC;;;;;;;;AASA,IAAa,qBACX,KACA,UACA,UACY;CACZ,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,YAAY,WAAW,IAAI,SAAS,QAAQ,CAAC;CAEnD,IAAI,CAAC,WACH,OAAO;CAGT,MAAM,EAAE,OAAO,QAAQ,qBAAqB,KAAK;CAEjD,IAAI,SAAS,UAAU,SAAS,IAAI,MAAM,QAAQ,GAChD,OAAO;CAGT,OAAO,EAAE,OAAO,UAAU,SAAS,IAAI,IAAI,QAAQ;AACrD;;AAGA,IAAa,2BAA8B,QAA4B;CACrE,IAAI,qBAAqB;CACzB,IAAI,WAAW;AACjB"}
@@ -0,0 +1,52 @@
1
+ import { resolveListDateRange } from "./dateRange.mjs";
2
+ import { CalendarDate, Time, toCalendarDateTime } from "@internationalized/date";
3
+ // ../components-base/src/list/filter/dateTimeRangeFields.ts
4
+ var toListCalendarDate = (value) => value ? new CalendarDate(value.year, value.month, value.day) : null;
5
+ var toListTime = (value) => value && "hour" in value ? new Time(value.hour, value.minute) : null;
6
+ var listDateTimeRangeFieldsFromValue = (value) => ({
7
+ startDate: toListCalendarDate(value?.start),
8
+ startTime: toListTime(value?.start),
9
+ endDate: toListCalendarDate(value?.end),
10
+ endTime: toListTime(value?.end)
11
+ });
12
+ var toBound = (date, time) => date ? time ? toCalendarDateTime(date, time) : date : void 0;
13
+ var boundKey = (bound) => bound && [
14
+ bound.year,
15
+ bound.month,
16
+ bound.day,
17
+ bound.hour,
18
+ bound.minute
19
+ ].join("-");
20
+ var isYearComplete = (date) => !!date && date.year >= 1e3;
21
+ /** Not while a year is still being typed: "2" would read as an early end. */
22
+ var isListDateTimeRangeEndBeforeStart = (fields) => {
23
+ if (!isYearComplete(fields.startDate) || !isYearComplete(fields.endDate)) return false;
24
+ const { start, end } = resolveListDateRange({
25
+ start: toBound(fields.startDate, fields.startTime),
26
+ end: toBound(fields.endDate, fields.endTime)
27
+ });
28
+ return !!start && !!end && end < start;
29
+ };
30
+ var isListDateValid = (date, limits = {}) => {
31
+ const minValue = toListCalendarDate(limits.minValue);
32
+ const maxValue = toListCalendarDate(limits.maxValue);
33
+ return !date || !(!isYearComplete(date) || minValue && date.compare(minValue) < 0 || maxValue && date.compare(maxValue) > 0 || limits.isDateUnavailable?.(date));
34
+ };
35
+ /**
36
+ * The range the fields stand for, or `undefined` while it must not be applied:
37
+ * an invalid input keeps the last valid range, and an unchanged one needs no
38
+ * update. `null` clears the filter.
39
+ */
40
+ var getListDateTimeRangeUpdate = (fields, applied, limits) => {
41
+ if (!isListDateValid(fields.startDate, limits) || !isListDateValid(fields.endDate, limits) || isListDateTimeRangeEndBeforeStart(fields)) return;
42
+ const start = toBound(fields.startDate, fields.startTime);
43
+ const end = toBound(fields.endDate, fields.endTime);
44
+ if (boundKey(start) === boundKey(applied?.start) && boundKey(end) === boundKey(applied?.end)) return;
45
+ return start || end ? {
46
+ start,
47
+ end
48
+ } : null;
49
+ };
50
+ export { getListDateTimeRangeUpdate, isListDateTimeRangeEndBeforeStart, isListDateValid, listDateTimeRangeFieldsFromValue, toListCalendarDate, toListTime };
51
+
52
+ //# sourceMappingURL=dateTimeRangeFields.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimeRangeFields.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/dateTimeRangeFields.ts"],"sourcesContent":["import {\n CalendarDate,\n type CalendarDateTime,\n Time,\n toCalendarDateTime,\n} from \"@internationalized/date\";\nimport {\n resolveListDateRange,\n type ListDateParts,\n type ListDateRange,\n} from \"./dateRange\";\n\n/*\n * The rules of the date and time fields a range filter shows with\n * `granularity: \"minute\"`. Which input is valid and when it applies is the same\n * in every binding; the fields and the state holding their input are not.\n */\n\nexport interface ListDateTimeRangeFields {\n readonly startDate: CalendarDate | null;\n readonly startTime: Time | null;\n readonly endDate: CalendarDate | null;\n readonly endTime: Time | null;\n}\n\nexport interface ListDateTimeRangeLimits {\n readonly minValue?: ListDateParts | null;\n readonly maxValue?: ListDateParts | null;\n readonly isDateUnavailable?: (date: CalendarDate) => boolean;\n}\n\ntype Bound = CalendarDate | CalendarDateTime;\n\nexport interface ListDateTimeRange {\n readonly start?: Bound;\n readonly end?: Bound;\n}\n\n/* Field by field: a value from the host of a remote connection is a plain object. */\nexport const toListCalendarDate = (\n value?: ListDateParts | null,\n): CalendarDate | null =>\n value ? new CalendarDate(value.year, value.month, value.day) : null;\n\nexport const toListTime = (\n value?: { readonly hour?: number; readonly minute?: number } | null,\n): Time | null =>\n value && \"hour\" in value ? new Time(value.hour, value.minute) : null;\n\nexport const listDateTimeRangeFieldsFromValue = (\n value: ListDateRange | null,\n): ListDateTimeRangeFields => ({\n startDate: toListCalendarDate(value?.start),\n startTime: toListTime(value?.start),\n endDate: toListCalendarDate(value?.end),\n endTime: toListTime(value?.end),\n});\n\nconst toBound = (date: CalendarDate | null, time: Time | null) =>\n date ? (time ? toCalendarDateTime(date, time) : date) : undefined;\n\nconst boundKey = (bound?: ListDateParts) =>\n bound &&\n [bound.year, bound.month, bound.day, bound.hour, bound.minute].join(\"-\");\n\n// react-aria reports a typed year digit by digit (2, 20, 202, 2026)\nconst isYearComplete = (date: CalendarDate | null) =>\n !!date && date.year >= 1000;\n\n/** Not while a year is still being typed: \"2\" would read as an early end. */\nexport const isListDateTimeRangeEndBeforeStart = (\n fields: ListDateTimeRangeFields,\n): boolean => {\n if (!isYearComplete(fields.startDate) || !isYearComplete(fields.endDate)) {\n return false;\n }\n const { start, end } = resolveListDateRange({\n start: toBound(fields.startDate, fields.startTime),\n end: toBound(fields.endDate, fields.endTime),\n });\n return !!start && !!end && end < start;\n};\n\nexport const isListDateValid = (\n date: CalendarDate | null,\n limits: ListDateTimeRangeLimits = {},\n): boolean => {\n const minValue = toListCalendarDate(limits.minValue);\n const maxValue = toListCalendarDate(limits.maxValue);\n\n return (\n !date ||\n !(\n !isYearComplete(date) ||\n (minValue && date.compare(minValue) < 0) ||\n (maxValue && date.compare(maxValue) > 0) ||\n limits.isDateUnavailable?.(date)\n )\n );\n};\n\n/**\n * The range the fields stand for, or `undefined` while it must not be applied:\n * an invalid input keeps the last valid range, and an unchanged one needs no\n * update. `null` clears the filter.\n */\nexport const getListDateTimeRangeUpdate = (\n fields: ListDateTimeRangeFields,\n applied: ListDateRange | null,\n limits?: ListDateTimeRangeLimits,\n): ListDateTimeRange | null | undefined => {\n if (\n !isListDateValid(fields.startDate, limits) ||\n !isListDateValid(fields.endDate, limits) ||\n isListDateTimeRangeEndBeforeStart(fields)\n ) {\n return undefined;\n }\n\n const start = toBound(fields.startDate, fields.startTime);\n const end = toBound(fields.endDate, fields.endTime);\n\n if (\n boundKey(start) === boundKey(applied?.start) &&\n boundKey(end) === boundKey(applied?.end)\n ) {\n return undefined;\n }\n\n return start || end ? { start, end } : null;\n};\n"],"mappings":";;;AAuCA,IAAa,sBACX,UAEA,QAAQ,IAAI,aAAa,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,IAAI;AAEjE,IAAa,cACX,UAEA,SAAS,UAAU,QAAQ,IAAI,KAAK,MAAM,MAAM,MAAM,MAAM,IAAI;AAElE,IAAa,oCACX,WAC6B;CAC7B,WAAW,mBAAmB,OAAO,KAAK;CAC1C,WAAW,WAAW,OAAO,KAAK;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M,SAAS,SAAS,GAAG,GAEvC;CAGF,OAAO,SAAS,MAAM;EAAE;EAAO;CAAI,IAAI;AACzC"}
@@ -0,0 +1,24 @@
1
+ import { listDateToDateTime } from "./dateRange.mjs";
2
+ import { DateFormatter } from "@internationalized/date";
3
+ // ../components-base/src/list/filter/formatDateRange.ts
4
+ /** The active filter chip's text: an end with time shows its time. */
5
+ var formatListDateRange = (value, locale, format) => {
6
+ const formatBound = (bound) => new DateFormatter(locale, {
7
+ year: "numeric",
8
+ month: "numeric",
9
+ day: "numeric",
10
+ ..."hour" in bound ? {
11
+ hour: "2-digit",
12
+ minute: "2-digit",
13
+ hourCycle: "h23"
14
+ } : {}
15
+ }).format(listDateToDateTime(bound).toJSDate());
16
+ const { start, end } = value;
17
+ if (start && end) return `${formatBound(start)} – ${formatBound(end)}`;
18
+ if (start) return format("dateRange.from", { date: formatBound(start) });
19
+ if (end) return format("dateRange.until", { date: formatBound(end) });
20
+ return "";
21
+ };
22
+ export { formatListDateRange };
23
+
24
+ //# sourceMappingURL=formatDateRange.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatDateRange.mjs","names":[],"sources":["../../../../../../../components-base/src/list/filter/formatDateRange.ts"],"sourcesContent":["import { DateFormatter } from \"@internationalized/date\";\nimport {\n listDateToDateTime,\n type ListDateParts,\n type ListDateRange,\n} from \"./dateRange\";\n\n/** Formats the text of an open range (\"from {date}\", \"until {date}\"). */\nexport type ListDateRangeTextFormat = (\n key: \"dateRange.from\" | \"dateRange.until\",\n values: { date: string },\n) => string;\n\n/** The active filter chip's text: an end with time shows its time. */\nexport const formatListDateRange = (\n value: ListDateRange,\n locale: string,\n format: ListDateRangeTextFormat,\n): string => {\n const formatBound = (bound: ListDateParts) =>\n new DateFormatter(locale, {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n // TimeField always shows 24 hours\n ...(\"hour\" in bound\n ? { hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" }\n : {}),\n }).format(listDateToDateTime(bound).toJSDate());\n\n const { start, end } = value;\n\n if (start && end) {\n return `${formatBound(start)} – ${formatBound(end)}`;\n }\n if (start) {\n return format(\"dateRange.from\", { date: formatBound(start) });\n }\n if (end) {\n return format(\"dateRange.until\", { date: formatBound(end) });\n }\n return \"\";\n};\n"],"mappings":";;;;AAcA,IAAa,uBACX,OACA,QACA,WACW;CACX,MAAM,eAAe,UACnB,IAAI,cAAc,QAAQ;EACxB,MAAM;EACN,OAAO;EACP,KAAK;EAEL,GAAI,UAAU,QACV;GAAE,MAAM;GAAW,QAAQ;GAAW,WAAW;EAAM,IACvD,CAAC;CACP,CAAC,CAAC,CAAC,OAAO,mBAAmB,KAAK,CAAC,CAAC,SAAS,CAAC;CAEhD,MAAM,EAAE,OAAO,QAAQ;CAEvB,IAAI,SAAS,KACX,OAAO,GAAG,YAAY,KAAK,EAAE,KAAK,YAAY,GAAG;CAEnD,IAAI,OACF,OAAO,OAAO,kBAAkB,EAAE,MAAM,YAAY,KAAK,EAAE,CAAC;CAE9D,IAAI,KACF,OAAO,OAAO,mBAAmB,EAAE,MAAM,YAAY,GAAG,EAAE,CAAC;CAE7D,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- //#region ../components-base/src/list/item/ListItem.ts
1
+ // ../components-base/src/list/item/ListItem.ts
2
2
  /** One row of the list, as the views see it: an id and the data behind it. */
3
3
  var ListItem = class ListItem {
4
4
  id;
@@ -13,7 +13,6 @@ var ListItem = class ListItem {
13
13
  return new ListItem(collection, row.id, row.original);
14
14
  }
15
15
  };
16
- //#endregion
17
16
  export { ListItem };
18
17
 
19
18
  //# sourceMappingURL=ListItem.mjs.map
@@ -1,5 +1,5 @@
1
1
  import { ListItem } from "./ListItem.mjs";
2
- //#region ../components-base/src/list/item/ListItemCollection.ts
2
+ // ../components-base/src/list/item/ListItemCollection.ts
3
3
  /**
4
4
  * The items the list currently shows.
5
5
  *
@@ -16,7 +16,6 @@ var ListItemCollection = class {
16
16
  return this.context.dataTable.getRowModel().rows.map((r) => ListItem.fromRow(this, r));
17
17
  }
18
18
  };
19
- //#endregion
20
19
  export { ListItemCollection };
21
20
 
22
21
  //# sourceMappingURL=ListItemCollection.mjs.map