@rebasepro/cms 0.24.0 → 0.24.1-canary.g19596ef

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 (816) hide show
  1. package/README.md +3 -1
  2. package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
  3. package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
  4. package/dist/collection_editor/ConfigControllerProvider.js +274 -0
  5. package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
  6. package/dist/collection_editor/api/generateCollectionApi.js +64 -0
  7. package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
  8. package/dist/collection_editor/collection_wire.d.ts +13 -0
  9. package/dist/collection_editor/collection_wire.js +49 -0
  10. package/dist/collection_editor/collection_wire.js.map +1 -0
  11. package/dist/collection_editor/liveSchemaClient.js +130 -0
  12. package/dist/collection_editor/liveSchemaClient.js.map +1 -0
  13. package/dist/collection_editor/relation_kinds.js +74 -0
  14. package/dist/collection_editor/relation_kinds.js.map +1 -0
  15. package/dist/collection_editor/serializable_types.d.ts +4 -1
  16. package/dist/collection_editor/serializable_utils.js +504 -0
  17. package/dist/collection_editor/serializable_utils.js.map +1 -0
  18. package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
  19. package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
  20. package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
  21. package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
  22. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
  23. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
  24. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
  25. package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
  26. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
  27. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
  28. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
  29. package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
  30. package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
  31. package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
  32. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
  33. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
  34. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
  35. package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
  36. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
  37. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
  38. package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
  39. package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
  40. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
  41. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
  42. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
  43. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
  44. package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
  45. package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
  46. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
  47. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
  48. package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
  49. package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
  50. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
  51. package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
  52. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
  53. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
  54. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
  55. package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
  56. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
  57. package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
  58. package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
  59. package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
  60. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
  61. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
  62. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
  63. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
  64. package/dist/{SchemaChangeDialog-CcFSXvkK.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +42 -59
  65. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
  66. package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
  67. package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
  68. package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
  69. package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
  70. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
  71. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
  72. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
  73. package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
  74. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
  75. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
  76. package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
  77. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
  78. package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
  79. package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
  80. package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
  81. package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
  82. package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
  83. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
  84. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
  85. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
  86. package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
  87. package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
  88. package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
  89. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
  90. package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
  91. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
  92. package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
  93. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
  94. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
  95. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
  96. package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
  97. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
  98. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
  99. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
  100. package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
  101. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
  102. package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
  103. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
  104. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
  105. package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
  106. package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
  107. package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
  108. package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
  109. package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
  110. package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
  111. package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
  112. package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
  113. package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
  114. package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
  115. package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
  116. package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
  117. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
  118. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
  119. package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
  120. package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
  121. package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
  122. package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
  123. package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
  124. package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
  125. package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
  126. package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
  127. package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
  128. package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
  129. package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
  130. package/dist/collection_editor/ui/collection_editor/util.js +20 -0
  131. package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
  132. package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
  133. package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
  134. package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
  135. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
  136. package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
  137. package/dist/collection_editor/useCollectionEditorController.js +12 -0
  138. package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
  139. package/dist/collection_editor/useCollectionsConfigController.js +12 -0
  140. package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
  141. package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
  142. package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
  143. package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
  144. package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
  145. package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
  146. package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
  147. package/dist/collection_editor/useSafeSnackbarController.js +13 -0
  148. package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
  149. package/dist/collection_editor/validateCollectionJson.js +289 -0
  150. package/dist/collection_editor/validateCollectionJson.js.map +1 -0
  151. package/dist/collection_editor_ui.js +7 -33
  152. package/dist/components/AdditionalFieldValue.js +60 -0
  153. package/dist/components/AdditionalFieldValue.js.map +1 -0
  154. package/dist/components/AdminModeSyncer.js +41 -0
  155. package/dist/components/AdminModeSyncer.js.map +1 -0
  156. package/dist/components/ArrayContainer.d.ts +8 -2
  157. package/dist/components/ArrayContainer.js +363 -0
  158. package/dist/components/ArrayContainer.js.map +1 -0
  159. package/dist/components/ClearFilterSortButton.js +33 -0
  160. package/dist/components/ClearFilterSortButton.js.map +1 -0
  161. package/dist/components/CollectionEditorDialogs.js +49 -0
  162. package/dist/components/CollectionEditorDialogs.js.map +1 -0
  163. package/dist/components/CollectionPanel.d.ts +26 -5
  164. package/dist/components/CollectionPanel.js +142 -0
  165. package/dist/components/CollectionPanel.js.map +1 -0
  166. package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
  167. package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
  168. package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
  169. package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
  170. package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
  171. package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
  172. package/dist/components/CollectionTableBinding/column_utils.js +85 -0
  173. package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
  174. package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
  175. package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
  176. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
  177. package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
  178. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
  179. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
  180. package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
  181. package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
  182. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
  183. package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
  184. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
  185. package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
  186. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
  187. package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
  188. package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
  189. package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
  190. package/dist/components/CollectionTableBinding/index.js +6 -0
  191. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
  192. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
  193. package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
  194. package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
  195. package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
  196. package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
  197. package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
  198. package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
  199. package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
  200. package/dist/components/CollectionTableBinding/internal/common.js +40 -0
  201. package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
  202. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
  203. package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
  204. package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
  205. package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
  206. package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
  207. package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
  208. package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
  209. package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
  210. package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
  211. package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
  212. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
  213. package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
  214. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
  215. package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
  216. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
  217. package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
  218. package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
  219. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
  220. package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
  221. package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
  222. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
  223. package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
  224. package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
  225. package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
  226. package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
  227. package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
  228. package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
  229. package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
  230. package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
  231. package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
  232. package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
  233. package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
  234. package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
  235. package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
  236. package/dist/components/CollectionViewBinding/SortButton.js +214 -0
  237. package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
  238. package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
  239. package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
  240. package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
  241. package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
  242. package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
  243. package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
  244. package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
  245. package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
  246. package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
  247. package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
  248. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
  249. package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
  250. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
  251. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
  252. package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
  253. package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
  254. package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
  255. package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
  256. package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
  257. package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
  258. package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
  259. package/dist/components/CollectionViewBinding/utils.js +21 -0
  260. package/dist/components/CollectionViewBinding/utils.js.map +1 -0
  261. package/dist/components/CollectionsProvider.d.ts +44 -0
  262. package/dist/components/CollectionsProvider.js +137 -0
  263. package/dist/components/CollectionsProvider.js.map +1 -0
  264. package/dist/components/CollectionsScopeContext.d.ts +18 -0
  265. package/dist/components/CollectionsScopeContext.js +25 -0
  266. package/dist/components/CollectionsScopeContext.js.map +1 -0
  267. package/dist/components/DefaultAppBar.js +179 -0
  268. package/dist/components/DefaultAppBar.js.map +1 -0
  269. package/dist/components/DefaultDrawer.js +364 -0
  270. package/dist/components/DefaultDrawer.js.map +1 -0
  271. package/dist/components/DeleteEntityDialog.js +256 -0
  272. package/dist/components/DeleteEntityDialog.js.map +1 -0
  273. package/dist/components/DetailViewBinding.js +504 -0
  274. package/dist/components/DetailViewBinding.js.map +1 -0
  275. package/dist/components/DrawerNavigationGroup.js +74 -0
  276. package/dist/components/DrawerNavigationGroup.js.map +1 -0
  277. package/dist/components/DrawerNavigationItem.d.ts +8 -0
  278. package/dist/components/DrawerNavigationItem.js +45 -0
  279. package/dist/components/DrawerNavigationItem.js.map +1 -0
  280. package/dist/components/EditFormActions.js +210 -0
  281. package/dist/components/EditFormActions.js.map +1 -0
  282. package/dist/components/EditViewBinding.js +802 -0
  283. package/dist/components/EditViewBinding.js.map +1 -0
  284. package/dist/components/EntityDisplayHeader.js +139 -0
  285. package/dist/components/EntityDisplayHeader.js.map +1 -0
  286. package/dist/components/EntityFormPanel.d.ts +58 -0
  287. package/dist/components/EntityFormPanel.js +126 -0
  288. package/dist/components/EntityFormPanel.js.map +1 -0
  289. package/dist/components/EntityIdentityBar.js +364 -0
  290. package/dist/components/EntityIdentityBar.js.map +1 -0
  291. package/dist/components/EntityInspector.js +96 -0
  292. package/dist/components/EntityInspector.js.map +1 -0
  293. package/dist/components/EntityPreviewBinding.js +282 -0
  294. package/dist/components/EntityPreviewBinding.js.map +1 -0
  295. package/dist/components/EntityPreviewNesting.js +53 -0
  296. package/dist/components/EntityPreviewNesting.js.map +1 -0
  297. package/dist/components/EntityViewBinding.js +246 -0
  298. package/dist/components/EntityViewBinding.js.map +1 -0
  299. package/dist/components/FieldCaption.js +17 -0
  300. package/dist/components/FieldCaption.js.map +1 -0
  301. package/dist/components/HomePage/ContentHomePage.js +326 -0
  302. package/dist/components/HomePage/ContentHomePage.js.map +1 -0
  303. package/dist/components/HomePage/FavouritesView.js +44 -0
  304. package/dist/components/HomePage/FavouritesView.js.map +1 -0
  305. package/dist/components/HomePage/HomePageDnD.js +436 -0
  306. package/dist/components/HomePage/HomePageDnD.js.map +1 -0
  307. package/dist/components/HomePage/NavigationCard.js +59 -0
  308. package/dist/components/HomePage/NavigationCard.js.map +1 -0
  309. package/dist/components/HomePage/NavigationCardBinding.js +70 -0
  310. package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
  311. package/dist/components/HomePage/NavigationGroup.js +98 -0
  312. package/dist/components/HomePage/NavigationGroup.js.map +1 -0
  313. package/dist/components/HomePage/RenameGroupDialog.js +89 -0
  314. package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
  315. package/dist/components/InlineEntityPreview.js +116 -0
  316. package/dist/components/InlineEntityPreview.js.map +1 -0
  317. package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
  318. package/dist/components/JsonPreviewBinding.js.map +1 -0
  319. package/dist/components/NavigationLoadingErrorView.js +27 -0
  320. package/dist/components/NavigationLoadingErrorView.js.map +1 -0
  321. package/dist/components/PickerTrigger.js +27 -0
  322. package/dist/components/PickerTrigger.js.map +1 -0
  323. package/dist/components/PropertyCollectionView.js +215 -0
  324. package/dist/components/PropertyCollectionView.js.map +1 -0
  325. package/dist/components/PropertyConfigBadge.js +19 -0
  326. package/dist/components/PropertyConfigBadge.js.map +1 -0
  327. package/dist/components/PropertyKeyHint.js +58 -0
  328. package/dist/components/PropertyKeyHint.js.map +1 -0
  329. package/dist/components/RebaseAuthGate.js +35 -0
  330. package/dist/components/RebaseAuthGate.js.map +1 -0
  331. package/dist/components/RebaseCMS.js +44 -0
  332. package/dist/components/RebaseCMS.js.map +1 -0
  333. package/dist/components/RebaseLayout.js +59 -0
  334. package/dist/components/RebaseLayout.js.map +1 -0
  335. package/dist/components/RebaseNavigation.js +215 -0
  336. package/dist/components/RebaseNavigation.js.map +1 -0
  337. package/dist/components/RebaseRouteDefs.js +96 -0
  338. package/dist/components/RebaseRouteDefs.js.map +1 -0
  339. package/dist/components/RebaseShell.js +50 -0
  340. package/dist/components/RebaseShell.js.map +1 -0
  341. package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
  342. package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
  343. package/dist/components/ReferenceWidget.js +100 -0
  344. package/dist/components/ReferenceWidget.js.map +1 -0
  345. package/dist/components/RelationSelector.js +625 -0
  346. package/dist/components/RelationSelector.js.map +1 -0
  347. package/dist/components/SearchIconsView.js +52 -0
  348. package/dist/components/SearchIconsView.js.map +1 -0
  349. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  350. package/dist/components/SelectableTable/SelectableTable.js +158 -0
  351. package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
  352. package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
  353. package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
  354. package/dist/components/SelectableTable/SelectionStore.js +29 -0
  355. package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
  356. package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
  357. package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
  358. package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
  359. package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
  360. package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
  361. package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
  362. package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
  363. package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
  364. package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
  365. package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
  366. package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
  367. package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
  368. package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
  369. package/dist/components/SelectableTable/filters/null_filter.js +36 -0
  370. package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
  371. package/dist/components/SideDialogs.js +149 -0
  372. package/dist/components/SideDialogs.js.map +1 -0
  373. package/dist/components/SidePanelBinding.js +287 -0
  374. package/dist/components/SidePanelBinding.js.map +1 -0
  375. package/dist/components/SidePanelProvider.js +69 -0
  376. package/dist/components/SidePanelProvider.js.map +1 -0
  377. package/dist/components/UserSelector.d.ts +2 -0
  378. package/dist/components/UserSelector.js +418 -0
  379. package/dist/components/UserSelector.js.map +1 -0
  380. package/dist/components/admin/CreationResultDialog.js +118 -0
  381. package/dist/components/admin/CreationResultDialog.js.map +1 -0
  382. package/dist/components/app/AppBar.js +14 -0
  383. package/dist/components/app/AppBar.js.map +1 -0
  384. package/dist/components/app/Drawer.js +26 -0
  385. package/dist/components/app/Drawer.js.map +1 -0
  386. package/dist/components/app/Scaffold.js +229 -0
  387. package/dist/components/app/Scaffold.js.map +1 -0
  388. package/dist/components/app/useApp.js +24 -0
  389. package/dist/components/app/useApp.js.map +1 -0
  390. package/dist/components/common/ActionMenuLabel.js +30 -0
  391. package/dist/components/common/ActionMenuLabel.js.map +1 -0
  392. package/dist/components/common/default_entity_actions.js +590 -0
  393. package/dist/components/common/default_entity_actions.js.map +1 -0
  394. package/dist/components/drawer_expansion.d.ts +25 -0
  395. package/dist/components/drawer_expansion.js +44 -0
  396. package/dist/components/drawer_expansion.js.map +1 -0
  397. package/dist/components/field_configs.d.ts +2 -2
  398. package/dist/components/field_configs.js +431 -0
  399. package/dist/components/field_configs.js.map +1 -0
  400. package/dist/components/field_ids.d.ts +11 -0
  401. package/dist/components/field_ids.js +58 -0
  402. package/dist/components/field_ids.js.map +1 -0
  403. package/dist/components/history/EntityHistoryEntry.js +151 -0
  404. package/dist/components/history/EntityHistoryEntry.js.map +1 -0
  405. package/dist/components/history/EntityHistoryView.js +157 -0
  406. package/dist/components/history/EntityHistoryView.js.map +1 -0
  407. package/dist/components/history/UserChip.js +21 -0
  408. package/dist/components/history/UserChip.js.map +1 -0
  409. package/dist/components/history/index.js +4 -0
  410. package/dist/components/index.d.ts +2 -0
  411. package/dist/components/lazy_record_views.d.ts +10 -0
  412. package/dist/components/lazy_record_views.js +57 -0
  413. package/dist/components/lazy_record_views.js.map +1 -0
  414. package/dist/contexts/BreacrumbsContext.js +28 -0
  415. package/dist/contexts/BreacrumbsContext.js.map +1 -0
  416. package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
  417. package/dist/contexts/EditorAIControllerContext.js +29 -0
  418. package/dist/contexts/EditorAIControllerContext.js.map +1 -0
  419. package/dist/contexts/SideDialogsControllerContext.js +7 -0
  420. package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
  421. package/dist/data_export/export/BasicExportAction.js +151 -0
  422. package/dist/data_export/export/BasicExportAction.js.map +1 -0
  423. package/dist/data_export/export/ExportCollectionAction.js +297 -0
  424. package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
  425. package/dist/data_export/export/additional_fields.js +40 -0
  426. package/dist/data_export/export/additional_fields.js.map +1 -0
  427. package/dist/data_export/export/export.d.ts +35 -0
  428. package/dist/data_export/export/export.js +400 -0
  429. package/dist/data_export/export/export.js.map +1 -0
  430. package/dist/data_export/export/fetch_export_data.d.ts +17 -7
  431. package/dist/data_export/export/fetch_export_data.js +67 -0
  432. package/dist/data_export/export/fetch_export_data.js.map +1 -0
  433. package/dist/data_export/export/index.d.ts +4 -2
  434. package/dist/data_export/export/index.js +5 -0
  435. package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
  436. package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
  437. package/dist/data_import/components/ImportConversionProblems.js +89 -0
  438. package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
  439. package/dist/data_import/components/ImportFileUpload.js +43 -0
  440. package/dist/data_import/components/ImportFileUpload.js.map +1 -0
  441. package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
  442. package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
  443. package/dist/data_import/components/ImportSaveInProgress.js +105 -0
  444. package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
  445. package/dist/data_import/hooks/useImportConfig.js +34 -0
  446. package/dist/data_import/hooks/useImportConfig.js.map +1 -0
  447. package/dist/{import-DjQoRrIU.js → data_import/import/ImportCollectionAction.js} +53 -43
  448. package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
  449. package/dist/data_import/import/index.js +2 -0
  450. package/dist/data_import/utils/csv.js +146 -0
  451. package/dist/data_import/utils/csv.js.map +1 -0
  452. package/dist/data_import/utils/data.js +366 -0
  453. package/dist/data_import/utils/data.js.map +1 -0
  454. package/dist/data_import/utils/file_headers.js +32 -0
  455. package/dist/data_import/utils/file_headers.js.map +1 -0
  456. package/dist/data_import/utils/file_to_json.js +149 -0
  457. package/dist/data_import/utils/file_to_json.js.map +1 -0
  458. package/dist/data_import/utils/get_import_inference_type.js +14 -0
  459. package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
  460. package/dist/data_import/utils/id_column.js +27 -0
  461. package/dist/data_import/utils/id_column.js.map +1 -0
  462. package/dist/data_import/utils/import_columns.js +92 -0
  463. package/dist/data_import/utils/import_columns.js.map +1 -0
  464. package/dist/data_import/utils/save_entities.d.ts +33 -4
  465. package/dist/data_import/utils/save_entities.js +244 -0
  466. package/dist/data_import/utils/save_entities.js.map +1 -0
  467. package/dist/data_import/utils/transforms.js +83 -0
  468. package/dist/data_import/utils/transforms.js.map +1 -0
  469. package/dist/editor/components/SlashCommandMenu.js +497 -0
  470. package/dist/editor/components/SlashCommandMenu.js.map +1 -0
  471. package/dist/editor/components/editor-bubble-item.js +24 -0
  472. package/dist/editor/components/editor-bubble-item.js.map +1 -0
  473. package/dist/editor/components/editor-bubble.js +97 -0
  474. package/dist/editor/components/editor-bubble.js.map +1 -0
  475. package/dist/editor/components/image-bubble.js +148 -0
  476. package/dist/editor/components/image-bubble.js.map +1 -0
  477. package/dist/editor/components/table-bubble.js +406 -0
  478. package/dist/editor/components/table-bubble.js.map +1 -0
  479. package/dist/editor/editor.js +423 -0
  480. package/dist/editor/editor.js.map +1 -0
  481. package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
  482. package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
  483. package/dist/editor/extensions/Image.d.ts +7 -1
  484. package/dist/editor/extensions/Image.js +160 -0
  485. package/dist/editor/extensions/Image.js.map +1 -0
  486. package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
  487. package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
  488. package/dist/editor/extensions/clipboard.js +63 -0
  489. package/dist/editor/extensions/clipboard.js.map +1 -0
  490. package/dist/editor/extensions/drag-and-drop.js +354 -0
  491. package/dist/editor/extensions/drag-and-drop.js.map +1 -0
  492. package/dist/editor/hooks/useProseMirror.js +101 -0
  493. package/dist/editor/hooks/useProseMirror.js.map +1 -0
  494. package/dist/editor/hooks/useProseMirrorContext.js +11 -0
  495. package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
  496. package/dist/editor/markdown.js +154 -0
  497. package/dist/editor/markdown.js.map +1 -0
  498. package/dist/editor/nodeViews/ImageComponent.js +35 -0
  499. package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
  500. package/dist/editor/nodeViews/ReactNodeView.js +57 -0
  501. package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
  502. package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
  503. package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
  504. package/dist/editor/nodeViews/index.js +21 -0
  505. package/dist/editor/nodeViews/index.js.map +1 -0
  506. package/dist/editor/plugins/index.js +54 -0
  507. package/dist/editor/plugins/index.js.map +1 -0
  508. package/dist/editor/plugins/inputrules.js +54 -0
  509. package/dist/editor/plugins/inputrules.js.map +1 -0
  510. package/dist/editor/plugins/placeholderPlugin.js +38 -0
  511. package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
  512. package/dist/editor/plugins/slashCommandPlugin.js +40 -0
  513. package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
  514. package/dist/editor/sanitize-html.js +190 -0
  515. package/dist/editor/sanitize-html.js.map +1 -0
  516. package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
  517. package/dist/editor/schema.js.map +1 -0
  518. package/dist/editor/selectors/link-selector.js +118 -0
  519. package/dist/editor/selectors/link-selector.js.map +1 -0
  520. package/dist/editor/selectors/node-selector.js +118 -0
  521. package/dist/editor/selectors/node-selector.js.map +1 -0
  522. package/dist/editor/selectors/text-buttons.js +71 -0
  523. package/dist/editor/selectors/text-buttons.js.map +1 -0
  524. package/dist/editor/utils/prosemirror-utils.js +92 -0
  525. package/dist/editor/utils/prosemirror-utils.js.map +1 -0
  526. package/dist/editor/utils/remove_classes.js +16 -0
  527. package/dist/editor/utils/remove_classes.js.map +1 -0
  528. package/dist/editor.js +1 -3147
  529. package/dist/form/EntityForm.js +734 -0
  530. package/dist/form/EntityForm.js.map +1 -0
  531. package/dist/form/EntityFormActions.js +101 -0
  532. package/dist/form/EntityFormActions.js.map +1 -0
  533. package/dist/form/EntityFormBinding.js +256 -0
  534. package/dist/form/EntityFormBinding.js.map +1 -0
  535. package/dist/form/PropertyFieldBinding.js +298 -0
  536. package/dist/form/PropertyFieldBinding.js.map +1 -0
  537. package/dist/form/components/ErrorFocus.js +33 -0
  538. package/dist/form/components/ErrorFocus.js.map +1 -0
  539. package/dist/form/components/FieldBlock.js +118 -0
  540. package/dist/form/components/FieldBlock.js.map +1 -0
  541. package/dist/form/components/FieldHelperText.js +56 -0
  542. package/dist/form/components/FieldHelperText.js.map +1 -0
  543. package/dist/form/components/FormRail.js +118 -0
  544. package/dist/form/components/FormRail.js.map +1 -0
  545. package/dist/form/components/FormSections.js +63 -0
  546. package/dist/form/components/FormSections.js.map +1 -0
  547. package/dist/form/components/LabelWithIcon.js +29 -0
  548. package/dist/form/components/LabelWithIcon.js.map +1 -0
  549. package/dist/form/components/LocalChangesMenu.js +127 -0
  550. package/dist/form/components/LocalChangesMenu.js.map +1 -0
  551. package/dist/form/components/StorageItemPreview.js +46 -0
  552. package/dist/form/components/StorageItemPreview.js.map +1 -0
  553. package/dist/form/components/StorageUploadProgress.js +84 -0
  554. package/dist/form/components/StorageUploadProgress.js.map +1 -0
  555. package/dist/form/components/useRailVisible.js +43 -0
  556. package/dist/form/components/useRailVisible.js.map +1 -0
  557. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
  558. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
  559. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
  560. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
  561. package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
  562. package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
  563. package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
  564. package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
  565. package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
  566. package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
  567. package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
  568. package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
  569. package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
  570. package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
  571. package/dist/form/field_bindings/MapFieldBinding.js +77 -0
  572. package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
  573. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
  574. package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
  575. package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
  576. package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
  577. package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
  578. package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
  579. package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
  580. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
  581. package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
  582. package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
  583. package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
  584. package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
  585. package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
  586. package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
  587. package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
  588. package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
  589. package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
  590. package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
  591. package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
  592. package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
  593. package/dist/form/field_bindings/TextFieldBinding.js +114 -0
  594. package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
  595. package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
  596. package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
  597. package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
  598. package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
  599. package/dist/form/form_keyboard_scope.d.ts +26 -0
  600. package/dist/form/form_keyboard_scope.js +39 -0
  601. package/dist/form/form_keyboard_scope.js.map +1 -0
  602. package/dist/form/form_uploads.d.ts +24 -0
  603. package/dist/form/form_uploads.js +31 -0
  604. package/dist/form/form_uploads.js.map +1 -0
  605. package/dist/form/form_utils.d.ts +24 -0
  606. package/dist/form/form_utils.js +280 -0
  607. package/dist/form/form_utils.js.map +1 -0
  608. package/dist/form/resolve_cell_property.d.ts +32 -0
  609. package/dist/form/resolve_cell_property.js +80 -0
  610. package/dist/form/resolve_cell_property.js.map +1 -0
  611. package/dist/form/resolve_form_properties.d.ts +2 -1
  612. package/dist/form/resolve_form_properties.js +78 -0
  613. package/dist/form/resolve_form_properties.js.map +1 -0
  614. package/dist/form/useClearRestoreValue.js +27 -0
  615. package/dist/form/useClearRestoreValue.js.map +1 -0
  616. package/dist/form/useUndoableDiscard.js +36 -0
  617. package/dist/form/useUndoableDiscard.js.map +1 -0
  618. package/dist/form/validation.d.ts +20 -0
  619. package/dist/form/validation.js +416 -0
  620. package/dist/form/validation.js.map +1 -0
  621. package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
  622. package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
  623. package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
  624. package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
  625. package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
  626. package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
  627. package/dist/hooks/navigation/useAsyncResolver.js +68 -0
  628. package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
  629. package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
  630. package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
  631. package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
  632. package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
  633. package/dist/hooks/navigation/useBuildUrlController.js +57 -0
  634. package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
  635. package/dist/hooks/navigation/useNavigationResolution.js +177 -0
  636. package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
  637. package/dist/hooks/navigation/useResolvedCollections.js +56 -0
  638. package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
  639. package/dist/hooks/navigation/useResolvedViews.js +94 -0
  640. package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
  641. package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
  642. package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
  643. package/dist/hooks/navigation/utils.js +125 -0
  644. package/dist/hooks/navigation/utils.js.map +1 -0
  645. package/dist/hooks/useAdminContext.js +45 -0
  646. package/dist/hooks/useAdminContext.js.map +1 -0
  647. package/dist/hooks/useBreadcrumbsController.js +17 -0
  648. package/dist/hooks/useBreadcrumbsController.js.map +1 -0
  649. package/dist/hooks/useBuildSideDialogsController.js +96 -0
  650. package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
  651. package/dist/hooks/useBuildSidePanel.js +221 -0
  652. package/dist/hooks/useBuildSidePanel.js.map +1 -0
  653. package/dist/hooks/useChildViewSource.js +41 -0
  654. package/dist/hooks/useChildViewSource.js.map +1 -0
  655. package/dist/hooks/useEntityDisplay.js +136 -0
  656. package/dist/hooks/useEntityDisplay.js.map +1 -0
  657. package/dist/hooks/useEntityDisplayTitle.js +34 -0
  658. package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
  659. package/dist/hooks/useHistory.js +137 -0
  660. package/dist/hooks/useHistory.js.map +1 -0
  661. package/dist/hooks/useRecordActions.js +108 -0
  662. package/dist/hooks/useRecordActions.js.map +1 -0
  663. package/dist/hooks/useReferencePaths.js +32 -0
  664. package/dist/hooks/useReferencePaths.js.map +1 -0
  665. package/dist/hooks/useResolvedNavigationFrom.js +83 -0
  666. package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
  667. package/dist/hooks/useResolvedUsers.js +109 -0
  668. package/dist/hooks/useResolvedUsers.js.map +1 -0
  669. package/dist/hooks/useSelectionDialog.js +53 -0
  670. package/dist/hooks/useSelectionDialog.js.map +1 -0
  671. package/dist/hooks/useSideDialogsController.js +8 -0
  672. package/dist/hooks/useSideDialogsController.js.map +1 -0
  673. package/dist/hooks/useSidePanel.js +15 -0
  674. package/dist/hooks/useSidePanel.js.map +1 -0
  675. package/dist/hooks/useStorageReferenceResolver.d.ts +4 -2
  676. package/dist/hooks/useStorageReferenceResolver.js +49 -0
  677. package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
  678. package/dist/index.d.ts +3 -2
  679. package/dist/index.js +151 -3867
  680. package/dist/preview/PropertyPreview.js +260 -0
  681. package/dist/preview/PropertyPreview.js.map +1 -0
  682. package/dist/preview/compact_text.js +52 -0
  683. package/dist/preview/compact_text.js.map +1 -0
  684. package/dist/preview/components/ArrayEnumPreview.js +24 -0
  685. package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
  686. package/dist/preview/components/BooleanPreview.js +25 -0
  687. package/dist/preview/components/BooleanPreview.js.map +1 -0
  688. package/dist/preview/components/DatePreview.d.ts +3 -2
  689. package/dist/preview/components/DatePreview.js +87 -0
  690. package/dist/preview/components/DatePreview.js.map +1 -0
  691. package/dist/preview/components/EmptyValue.js +13 -0
  692. package/dist/preview/components/EmptyValue.js.map +1 -0
  693. package/dist/preview/components/EnumValuesChip.js +26 -0
  694. package/dist/preview/components/EnumValuesChip.js.map +1 -0
  695. package/dist/preview/components/ImagePreview.d.ts +7 -1
  696. package/dist/preview/components/ImagePreview.js +112 -0
  697. package/dist/preview/components/ImagePreview.js.map +1 -0
  698. package/dist/preview/components/InlineEntityListPreview.js +31 -0
  699. package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
  700. package/dist/preview/components/ReferencePreview.js +162 -0
  701. package/dist/preview/components/ReferencePreview.js.map +1 -0
  702. package/dist/preview/components/RelationPreview.js +196 -0
  703. package/dist/preview/components/RelationPreview.js.map +1 -0
  704. package/dist/preview/components/StorageMarkdown.d.ts +2 -1
  705. package/dist/preview/components/StorageMarkdown.js +49 -0
  706. package/dist/preview/components/StorageMarkdown.js.map +1 -0
  707. package/dist/preview/components/StorageThumbnail.js +183 -0
  708. package/dist/preview/components/StorageThumbnail.js.map +1 -0
  709. package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
  710. package/dist/preview/components/UrlComponentPreview.js +88 -0
  711. package/dist/preview/components/UrlComponentPreview.js.map +1 -0
  712. package/dist/preview/components/UserPreview.js +30 -0
  713. package/dist/preview/components/UserPreview.js.map +1 -0
  714. package/dist/preview/components/date_fns_locales.js +124 -0
  715. package/dist/preview/components/date_fns_locales.js.map +1 -0
  716. package/dist/preview/components/storageRenditions.d.ts +10 -0
  717. package/dist/preview/components/storageRenditions.js +95 -0
  718. package/dist/preview/components/storageRenditions.js.map +1 -0
  719. package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
  720. package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
  721. package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
  722. package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
  723. package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
  724. package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
  725. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
  726. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
  727. package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
  728. package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
  729. package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
  730. package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
  731. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
  732. package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
  733. package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
  734. package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
  735. package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
  736. package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
  737. package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
  738. package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
  739. package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
  740. package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
  741. package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
  742. package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
  743. package/dist/preview/util.d.ts +4 -3
  744. package/dist/{util-D7ebttKT.js → preview/util.js} +8 -5
  745. package/dist/preview/util.js.map +1 -0
  746. package/dist/routes/CustomViewRoute.js +26 -0
  747. package/dist/routes/CustomViewRoute.js.map +1 -0
  748. package/dist/routes/RebaseRoute.js +311 -0
  749. package/dist/routes/RebaseRoute.js.map +1 -0
  750. package/dist/selection/SelectionMenu.js +90 -0
  751. package/dist/selection/SelectionMenu.js.map +1 -0
  752. package/dist/selection/resolve_selection.js +79 -0
  753. package/dist/selection/resolve_selection.js.map +1 -0
  754. package/dist/util/caller_scopes.js +25 -0
  755. package/dist/util/caller_scopes.js.map +1 -0
  756. package/dist/util/collection_open_mode.d.ts +20 -0
  757. package/dist/util/collection_open_mode.js +32 -0
  758. package/dist/util/collection_open_mode.js.map +1 -0
  759. package/dist/util/dataControllerAdapter.js +65 -0
  760. package/dist/util/dataControllerAdapter.js.map +1 -0
  761. package/dist/util/entity_actions.d.ts +5 -0
  762. package/dist/util/entity_actions.js +77 -0
  763. package/dist/util/entity_actions.js.map +1 -0
  764. package/dist/util/entity_pages.d.ts +37 -3
  765. package/dist/util/entity_pages.js +71 -0
  766. package/dist/util/entity_pages.js.map +1 -0
  767. package/dist/util/find_entities_by_ids.d.ts +23 -0
  768. package/dist/util/find_entities_by_ids.js +55 -0
  769. package/dist/util/find_entities_by_ids.js.map +1 -0
  770. package/dist/util/fit_inline_actions.js +40 -0
  771. package/dist/util/fit_inline_actions.js.map +1 -0
  772. package/dist/util/format_collection_date.d.ts +29 -0
  773. package/dist/util/format_collection_date.js +60 -0
  774. package/dist/util/format_collection_date.js.map +1 -0
  775. package/dist/util/map_with_concurrency.js +46 -0
  776. package/dist/util/map_with_concurrency.js.map +1 -0
  777. package/dist/util/navigation_utils.js +45 -0
  778. package/dist/util/navigation_utils.js.map +1 -0
  779. package/dist/util/number_format.js +33 -0
  780. package/dist/util/number_format.js.map +1 -0
  781. package/dist/util/previews.js +71 -0
  782. package/dist/util/previews.js.map +1 -0
  783. package/dist/util/propertyConfigMapper.js +83 -0
  784. package/dist/util/propertyConfigMapper.js.map +1 -0
  785. package/dist/util/property_utils.js +141 -0
  786. package/dist/util/property_utils.js.map +1 -0
  787. package/dist/util/resolutions.js +55 -0
  788. package/dist/util/resolutions.js.map +1 -0
  789. package/dist/util/view_constants.js +35 -0
  790. package/dist/util/view_constants.js.map +1 -0
  791. package/dist/util/view_mode.js +112 -0
  792. package/dist/util/view_mode.js.map +1 -0
  793. package/package.json +13 -9
  794. package/dist/CollectionEditorDialog-p5-I-Apu.js +0 -3669
  795. package/dist/CollectionEditorDialog-p5-I-Apu.js.map +0 -1
  796. package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
  797. package/dist/PropertyEditView-DDB_X-00.js +0 -3837
  798. package/dist/PropertyEditView-DDB_X-00.js.map +0 -1
  799. package/dist/RouterCollectionsStudioView-SGBV4CMg.js +0 -212
  800. package/dist/RouterCollectionsStudioView-SGBV4CMg.js.map +0 -1
  801. package/dist/SchemaChangeDialog-CcFSXvkK.js.map +0 -1
  802. package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
  803. package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
  804. package/dist/collection_editor_ui.js.map +0 -1
  805. package/dist/editor.js.map +0 -1
  806. package/dist/export-DCHuPD1a.js +0 -520
  807. package/dist/export-DCHuPD1a.js.map +0 -1
  808. package/dist/history-CBd6SBRs.js +0 -314
  809. package/dist/history-CBd6SBRs.js.map +0 -1
  810. package/dist/import-DjQoRrIU.js.map +0 -1
  811. package/dist/index.js.map +0 -1
  812. package/dist/markdown-CCqp8ibf.js.map +0 -1
  813. package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
  814. package/dist/util-BRvKFMLa.js +0 -27773
  815. package/dist/util-BRvKFMLa.js.map +0 -1
  816. package/dist/util-D7ebttKT.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelationSelector.js","names":[],"sources":["../../src/components/RelationSelector.tsx"],"sourcesContent":["\nimport {\n ArrowRightToLineIcon,\n CheckIcon,\n ChevronDownIcon,\n Chip,\n CircularProgress,\n cls,\n defaultBorderMixin,\n fieldBackgroundDisabledMixin,\n fieldBackgroundHoverMixin,\n fieldBackgroundInvisibleMixin,\n fieldBackgroundMixin,\n focusedDisabled,\n IconButton,\n iconSize,\n PlusIcon,\n PopoverPrimitive,\n SearchIcon,\n Separator,\n Tooltip,\n usePortalContainer,\n XIcon\n} from \"@rebasepro/ui\";\nimport * as React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Entity, EntityRelation, FilterValues, Relation, getCollectionDataPath } from \"@rebasepro/types\";\nimport { EntityPreviewBindingData } from \"./EntityPreviewBinding\";\nimport { PickerTrigger } from \"./PickerTrigger\";\nimport { getTitlePropertyKey, useData, usePermissions, useRelationSelector, useTranslation } from \"@rebasepro/app\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { normalizeToEntityRelation } from \"@rebasepro/common\";\nimport { findEntitiesByIds } from \"../util/find_entities_by_ids\";\n\n/** Whether an authored relation yields many rows. Derived from its kind. */\nfunction relationCardinality(relation: { kind?: string; cardinality?: string } | undefined): \"one\" | \"many\" | undefined {\n if (!relation) return undefined;\n if (relation.kind === \"via\") return relation.cardinality as \"one\" | \"many\" | undefined;\n if (relation.kind === \"hasMany\" || relation.kind === \"manyToMany\") return \"many\";\n if (relation.kind === \"belongsTo\" || relation.kind === \"hasOne\") return \"one\";\n return relation.cardinality as \"one\" | \"many\" | undefined;\n}\n\n\nexport interface RelationItem {\n id: string | number;\n label: string;\n description?: string;\n data?: Entity;\n relation: EntityRelation;\n}\n\nexport interface RelationSelectorProps {\n className?: string;\n name?: string;\n id?: string;\n value?: EntityRelation | EntityRelation[] | null;\n /** Callback returning selected EntityRelation(s) */\n\n onValueChange?: (updatedValue: EntityRelation | EntityRelation[] | undefined) => void;\n placeholder?: React.ReactNode;\n /**\n * `large` is the form's size and is on the shared 28/32/40/48 control\n * scale, so a relation picker lines up with the text field beside it.\n *\n * `small` and `medium` predate that scale (42 and 56) and are kept as they\n * are because the filter row is built around them. A table cell passes\n * `triggerContent` instead, and has no size of its own.\n */\n size?: \"small\" | \"medium\" | \"large\";\n useChips?: boolean;\n disabled?: boolean;\n invisible?: boolean;\n\n relation: Relation;\n /**\n * Whether the selector picks many rows or one.\n *\n * Defaults to what the relation implies — a `hasMany` or `manyToMany`\n * picks many — which is right wherever the selector *edits* the relation,\n * because there the cardinality is the shape of the stored value.\n *\n * A filter is the case where it is not. `tags == <one tag>` asks a single\n * question about a to-many link, and the operator is what decides how many\n * values it takes. Deriving multiplicity from the relation there meant a\n * to-many relation could only ever emit a list, so the filter field had to\n * hide every single-value operator to avoid handing `==` an array.\n */\n multiple?: boolean;\n fixedFilter?: FilterValues<string>;\n pageSize?: number;\n emptyPlaceholder?: string;\n searchPlaceholder?: string;\n /** Shown in the open list when a search matched nothing. */\n noResultsText?: string;\n /**\n * Shown on the closed trigger when nothing is selected. Says only that the\n * field is empty — see the note by `resolvedPlaceholder` for why it cannot\n * say whether there is anything to pick.\n */\n emptyText?: string;\n /**\n * Shown in the open list when the target collection turned out to hold no\n * rows at all, as opposed to a search simply not matching. Defaults to a\n * sentence naming the target collection.\n */\n emptyCollectionText?: string;\n loadingText?: string;\n /**\n * Whether the list is open, for a caller that opens it from outside the\n * trigger — a table cell's opener. Every open and close the selector\n * makes itself is reported through `onOpenChange`, controlled or not.\n */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Replaces everything the trigger draws — the value, the box, its padding\n * and the chevron — with this node. For a caller that frames the picker\n * itself: a table cell passes the preview it shows at rest, so the cell\n * looks the same whether the picker is mounted, closed or open.\n */\n triggerContent?: React.ReactNode;\n /**\n * Positions the list against this element instead of the trigger. A\n * table cell passes itself: the trigger inside it can be taller than the\n * cell that clips it, and the list belongs under what can be seen.\n */\n anchorRef?: React.RefObject<HTMLElement | null>;\n /**\n * Whether the open list offers to create a row in the target collection.\n * Defaults to `true`. The offer is shown only when the user could actually\n * insert into that collection — the same permission check the selection\n * dialog's \"Add\" button makes — so turning this off is for the cases where\n * creating is possible but not wanted, like a filter.\n */\n allowCreate?: boolean;\n}\n\nexport const RelationSelector = React.forwardRef<\n HTMLElement,\n RelationSelectorProps\n>(\n (\n {\n value,\n size = \"medium\",\n onValueChange,\n invisible,\n disabled,\n placeholder,\n useChips = true,\n className,\n relation,\n multiple: multipleOverride,\n fixedFilter,\n pageSize,\n emptyPlaceholder,\n searchPlaceholder = \"Search...\",\n noResultsText = \"No matches.\",\n emptyText = \"Select…\",\n emptyCollectionText,\n loadingText = \"Loading...\",\n allowCreate = true,\n open: openProp,\n onOpenChange,\n triggerContent,\n anchorRef\n },\n ref\n ) => {\n\n const collection = relation.target();\n const dataPath = getCollectionDataPath(collection);\n const dataClient = useData();\n const sidePanelController = useSidePanel();\n const { canCreate } = usePermissions();\n const { t } = useTranslation();\n const contextPortalContainer = usePortalContainer();\n const multiple = multipleOverride ?? relationCardinality(relation) === \"many\";\n\n const [isPopoverOpen, setIsPopoverOpenState] = useState(false);\n const isPopoverOpenRef = useRef(false);\n // The list is only worth fetching once the picker has been opened. A\n // table cell mounts one of these per row, and the selected value is\n // resolved by its own effect below, not from the list. Latches on the\n // first open so a closed popover keeps its results.\n const [listRequested, setListRequested] = useState(false);\n const [selectedItems, setSelectedItems] = useState<RelationItem[]>([]);\n const [isLoadingSelectedItems, setIsLoadingSelectedItems] = useState(false);\n const [searchString, setSearchString] = useState<string>(\"\");\n\n // Track IDs that were set via local user interaction (onItemClick / handleClear / handleRemoveItem).\n // When an incoming value change matches these IDs exactly, we skip async re-resolution.\n const localSelectionIdsRef = useRef<string | null>(null);\n // Entity of selected IDs captured when the popover opens.\n // Used to sort the dropdown list so selected items appear at the top.\n // Stays stable for the entire popover session so items don't jump around.\n const pinnedIdsRef = useRef<Set<string> | null>(null);\n\n const selectedItemsForPinRef = useRef<RelationItem[]>([]);\n selectedItemsForPinRef.current = selectedItems;\n const onOpenChangeRef = useRef(onOpenChange);\n onOpenChangeRef.current = onOpenChange;\n\n // Every open and close goes through here. Opening pins the current\n // selection to the top of the list for as long as it stays open, and\n // is what first requests the list at all.\n const setPopoverOpen = useCallback((next: boolean, notify = true) => {\n if (next) {\n // From the value as well as the resolved items: a picker a\n // table cell mounts already open has not resolved them yet.\n pinnedIdsRef.current = new Set([\n ...selectedItemsForPinRef.current.map(i => String(i.id)),\n ...relationsArrayRef.current.map(rel =>\n String(typeof rel === \"string\" || typeof rel === \"number\" ? rel : rel.id))\n ]);\n setListRequested(true);\n } else {\n pinnedIdsRef.current = null;\n }\n const changed = isPopoverOpenRef.current !== next;\n isPopoverOpenRef.current = next;\n setIsPopoverOpenState(next);\n if (changed && notify) onOpenChangeRef.current?.(next);\n }, []);\n\n useEffect(() => {\n if (openProp === undefined || openProp === isPopoverOpenRef.current) return;\n if (openProp && disabled) {\n onOpenChangeRef.current?.(false);\n return;\n }\n setPopoverOpen(openProp, false);\n }, [openProp, disabled, setPopoverOpen]);\n\n const {\n items: availableItems,\n isLoading,\n hasMore,\n search,\n loadMore,\n entityToRelationItem\n } = useRelationSelector({\n path: dataPath,\n collection,\n fixedFilter,\n pageSize,\n enabled: listRequested\n });\n\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const sentinelRef = useRef<HTMLDivElement>(null);\n const observerRef = useRef<IntersectionObserver | null>(null);\n const localTriggerRef = useRef<HTMLElement | null>(null);\n\n const handleButtonRef = useCallback((node: HTMLElement | null) => {\n localTriggerRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }, [ref]);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const searchInputRef = useRef<HTMLInputElement | null>(null);\n\n // Keep stable refs for dependencies used in the value-resolution effect\n // so the effect only re-fires when the actual `value` identity changes.\n const dataClientRef = useRef(dataClient);\n dataClientRef.current = dataClient;\n const entityToRelationItemRef = useRef(entityToRelationItem);\n entityToRelationItemRef.current = entityToRelationItem;\n const collectionSlugRef = useRef(collection.slug);\n collectionSlugRef.current = collection.slug;\n const collectionRef = useRef(collection);\n collectionRef.current = collection;\n\n // Stable ref to track which IDs we've already resolved\n const resolvedIdsRef = useRef<string>(\"\");\n // Track whether we have resolved items (used for skip guard without adding to deps)\n const hasResolvedItemsRef = useRef(false);\n\n const selectedItemsRef = useRef(selectedItems);\n selectedItemsRef.current = selectedItems;\n\n // Normalize incoming values — plain { __type: \"relation\" } objects\n // from the server are converted to proper EntityRelation instances.\n const rawArray = !value ? [] : Array.isArray(value) ? value : [value];\n const relationsArray = rawArray.map(rel => {\n if (typeof rel === \"string\" || typeof rel === \"number\") return rel;\n return normalizeToEntityRelation(rel) ?? rel;\n });\n\n // Build a fingerprint of the incoming value's IDs\n const incomingIds = relationsArray\n .map(rel => {\n const isPrimitive = typeof rel === \"string\" || typeof rel === \"number\";\n return String(isPrimitive ? rel : (rel as EntityRelation).id);\n })\n .sort()\n .join(\",\");\n\n // CheckIcon if every relation already has embedded data\n const allHaveData = relationsArray.length > 0 && relationsArray.every(rel => {\n if (typeof rel === \"string\" || typeof rel === \"number\") return false;\n return !!(rel as EntityRelation)?.data;\n });\n\n const relationsArrayRef = useRef(relationsArray);\n relationsArrayRef.current = relationsArray;\n\n useEffect(() => {\n let active = true;\n const currentRelationsArray = relationsArrayRef.current;\n\n // If the IDs haven't changed and we already resolved them, skip entirely\n if (incomingIds === resolvedIdsRef.current && (allHaveData || hasResolvedItemsRef.current)) {\n return;\n }\n\n // FAST PATH: If the incoming IDs match what we just set locally via user interaction,\n // our selectedItems already have the correct data — no re-resolution needed.\n //\n // The fingerprint answers for one echo only, and is dropped on the\n // first incoming value whether it matches or not. Kept, it also\n // matched a *later* return to the same ids — pick A, discard to B,\n // undo back to A — and the chip went on showing B.\n const localSelectionIds = localSelectionIdsRef.current;\n localSelectionIdsRef.current = null;\n if (localSelectionIds !== null && incomingIds === localSelectionIds) {\n resolvedIdsRef.current = incomingIds;\n hasResolvedItemsRef.current = true;\n // Do NOT call setSelectedItems or setIsLoadingSelectedItems — they are already correct.\n return;\n }\n\n const currentSelected = selectedItemsRef.current;\n const currentSelectedMap = new Map(currentSelected.map(item => [String(item.id), item]));\n\n let allCovered = true;\n const newResolvedItems: RelationItem[] = [];\n const toRelationItem = entityToRelationItemRef.current;\n const slug = collectionSlugRef.current;\n\n for (const rel of currentRelationsArray) {\n const isPrimitive = typeof rel === \"string\" || typeof rel === \"number\";\n const relId = String(isPrimitive ? rel : (rel as EntityRelation).id);\n const hasEmbeddedData = !isPrimitive && !!(rel as EntityRelation).data;\n\n if (hasEmbeddedData) {\n const r = rel as EntityRelation;\n // admin wire format embeds relation data as { id, path, values }\n newResolvedItems.push(toRelationItem(r.data as unknown as Entity, r));\n } else if (currentSelectedMap.has(relId)) {\n // We already have it in currentSelected\n const existingItem = currentSelectedMap.get(relId)!;\n newResolvedItems.push(existingItem);\n } else {\n allCovered = false;\n break;\n }\n }\n\n // FAST PATH: We have all necessary data embedded or in local cache\n if (allCovered) {\n setSelectedItems(newResolvedItems);\n hasResolvedItemsRef.current = true;\n resolvedIdsRef.current = incomingIds;\n setIsLoadingSelectedItems(false);\n return;\n }\n\n // SLOW PATH: fetch missing data — but don't show loading if popover is open\n // (user is actively interacting; showing a spinner is disruptive)\n if (!isPopoverOpenRef.current) {\n setIsLoadingSelectedItems(true);\n }\n const client = dataClientRef.current;\n const target = collectionRef.current;\n\n // The ids nothing above resolves, by the path they are read at:\n // one request per path (per 1,000 ids), not one per id.\n const unresolved = new Map<string, (string | number)[]>();\n for (const rel of currentRelationsArray) {\n const isPrimitive = typeof rel === \"string\" || typeof rel === \"number\";\n const relId = isPrimitive ? rel : (rel as EntityRelation).id;\n if (!isPrimitive && (rel as EntityRelation).data) continue;\n if (currentSelectedMap.has(String(relId))) continue;\n const path = isPrimitive ? slug : (rel as EntityRelation).path;\n unresolved.set(path, [...(unresolved.get(path) ?? []), relId]);\n }\n\n Promise.all(\n [...unresolved].map(async ([path, ids]): Promise<[string, Map<string, Entity>]> => {\n try {\n return [path, await findEntitiesByIds(client.collection(path), target, ids)];\n } catch (e) {\n console.warn(\"RelationSelector: could not fetch the entities for relations\", path, ids, e);\n return [path, new Map()];\n }\n })\n ).then(read => {\n const readByPath = new Map(read);\n return currentRelationsArray.map((rel) => {\n const isPrimitive = typeof rel === \"string\" || typeof rel === \"number\";\n const relId = isPrimitive ? rel : (rel as EntityRelation).id;\n const path = isPrimitive ? slug : (rel as EntityRelation).path;\n const relation = isPrimitive ? new EntityRelation(relId, path) : rel as EntityRelation;\n\n if (!isPrimitive && (rel as EntityRelation).data) {\n // admin wire format embeds relation data as { id, path, values }\n return toRelationItem((rel as EntityRelation).data as unknown as Entity, relation);\n }\n if (currentSelectedMap.has(String(relId))) {\n return currentSelectedMap.get(String(relId))!;\n }\n const entity = readByPath.get(path)?.get(String(relId));\n if (entity) return toRelationItem(entity, relation);\n return { id: relId,\nlabel: String(relId),\nrelation } as RelationItem;\n });\n }).then(resolved => {\n if (active) {\n setSelectedItems(resolved);\n setIsLoadingSelectedItems(false);\n hasResolvedItemsRef.current = true;\n resolvedIdsRef.current = incomingIds;\n }\n });\n\n return () => {\n active = false;\n };\n }, [incomingIds, allHaveData]);\n\n const sentinelCallbackRef = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n if (sentinelRef.current !== node) {\n (sentinelRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n if (!node || !hasMore || isLoading || !loadMore) return;\n const observer = new IntersectionObserver(\n (entries) => {\n const entry = entries[0];\n if (entry.isIntersecting && hasMore && !isLoading) loadMore();\n },\n {\n root: scrollContainerRef.current,\n rootMargin: \"20px\",\n threshold: 0\n }\n );\n observer.observe(node);\n observerRef.current = observer;\n }, [hasMore, isLoading, loadMore]);\n\n useEffect(() => () => {\n if (observerRef.current) observerRef.current.disconnect();\n }, []);\n\n // Enhanced scroll event listener specifically for dialog contexts\n useEffect(() => {\n const scrollContainer = scrollContainerRef.current;\n if (!scrollContainer || !hasMore || isLoading || !isPopoverOpen) return;\n\n const handleScroll = () => {\n const { scrollTop, scrollHeight, clientHeight } = scrollContainer;\n const isNearBottom = scrollTop + clientHeight >= scrollHeight - 100;\n\n if (isNearBottom && hasMore && !isLoading) {\n loadMore();\n }\n };\n\n // Add scroll listener directly to the container\n scrollContainer.addEventListener(\"scroll\", handleScroll, { passive: true });\n\n return () => {\n scrollContainer.removeEventListener(\"scroll\", handleScroll);\n };\n }, [hasMore, isLoading, loadMore, isPopoverOpen]);\n\n const handleSearchChange = useCallback((newSearchString: string) => {\n setSearchString(newSearchString);\n search(newSearchString);\n }, [search]);\n\n const emitValueChange = useCallback((selected: RelationItem[]) => {\n if (multiple) onValueChange?.(selected.length ? selected.map(i => i.relation) : undefined);\n else onValueChange?.(selected[0]?.relation);\n }, [onValueChange, multiple]);\n\n // The picker can hand its selection over long after the render that\n // built the callback — a row created in the side panel arrives whenever\n // the person saves it — so the emitter is read from a ref rather than\n // captured.\n const emitValueChangeRef = useRef(emitValueChange);\n emitValueChangeRef.current = emitValueChange;\n\n // Helper: compute the \"IDs fingerprint\" for a set of RelationItems\n // so we can mark it in localSelectionIdsRef and skip re-resolution.\n const computeSelectionFingerprint = useCallback((items: RelationItem[]): string => {\n return items.map(i => String(i.id)).sort().join(\",\");\n }, []);\n\n const onItemClick = useCallback((item: RelationItem) => {\n let newSelected: RelationItem[];\n if (multiple) {\n const isSelected = selectedItems.some(v => String(v.id) === String(item.id));\n newSelected = isSelected\n ? selectedItems.filter(v => String(v.id) !== String(item.id))\n : [...selectedItems, item];\n } else {\n newSelected = [item];\n setPopoverOpen(false);\n }\n setSelectedItems(newSelected);\n // Mark this fingerprint so the resolution effect skips async work\n // when the parent echoes the same IDs back via props.\n localSelectionIdsRef.current = computeSelectionFingerprint(newSelected);\n emitValueChange(newSelected);\n }, [multiple, selectedItems, emitValueChange, computeSelectionFingerprint, setPopoverOpen]);\n\n const handleClear = useCallback(() => {\n setSelectedItems([]);\n localSelectionIdsRef.current = \"\";\n onValueChange?.(undefined);\n }, [onValueChange]);\n\n const handleRemoveItem = useCallback((itemToRemove: RelationItem) => {\n const newSelected = selectedItems.filter(v => String(v.id) !== String(itemToRemove.id));\n setSelectedItems(newSelected);\n localSelectionIdsRef.current = computeSelectionFingerprint(newSelected);\n emitValueChange(newSelected);\n }, [selectedItems, emitValueChange, computeSelectionFingerprint]);\n\n const handleRootOpenChange = useCallback((next: boolean) => {\n if (disabled) return;\n // We control open manually; only allow opening attempts from Radix (e.g. trigger press)\n if (next) setPopoverOpen(true);\n // Ignore close attempts here; outside click/Escape handled manually; single select closes explicitly on selection.\n }, [disabled, setPopoverOpen]);\n\n // Outside click + Escape handling (simple and reliable)\n useEffect(() => {\n if (!isPopoverOpen) return;\n\n function handlePointerDown(ev: MouseEvent) {\n const target = ev.target as Node;\n const triggerEl = localTriggerRef.current;\n const contentEl = contentRef.current;\n if (triggerEl?.contains(target)) return;\n if (contentEl?.contains(target)) return;\n // Outside\n setPopoverOpen(false);\n }\n\n // A layer of its own, so capture phase — and it claims the Escape\n // it acts on, so the record view underneath leaves the record open.\n function handleKey(ev: KeyboardEvent) {\n if (ev.key !== \"Escape\") return;\n ev.preventDefault();\n setPopoverOpen(false);\n }\n\n document.addEventListener(\"mousedown\", handlePointerDown, true);\n document.addEventListener(\"keydown\", handleKey, true);\n return () => {\n document.removeEventListener(\"mousedown\", handlePointerDown, true);\n document.removeEventListener(\"keydown\", handleKey, true);\n };\n }, [isPopoverOpen, setPopoverOpen]);\n\n const closePopover = useCallback(() => setPopoverOpen(false), [setPopoverOpen]);\n\n const toggleOpen = useCallback(() => {\n if (disabled) return;\n setPopoverOpen(!isPopoverOpenRef.current);\n }, [disabled, setPopoverOpen]);\n\n // Pointing at a row that does not exist yet.\n //\n // Until now the only way out of that was to abandon the form, go to the\n // other collection, create the row, come back and start again — and on\n // a new record that meant losing everything typed so far. The side\n // panel already stacks (the selection dialog creates from inside itself\n // this way), so the picker can open a create form over the form it\n // belongs to and select what comes back.\n const canCreateTarget = allowCreate && canCreate(collection, dataPath);\n\n // A search that matched nothing is the name the person was looking for,\n // so it seeds the new row. Only when the title lands on a plain string\n // property: putting free text into an enum, a relation or a computed\n // property would be worse than not prefilling at all.\n const buildDefaultValues = useCallback((searchText: string): Record<string, unknown> | undefined => {\n const trimmed = searchText.trim();\n if (!trimmed) return undefined;\n const titleKey = getTitlePropertyKey(collection);\n if (!titleKey || titleKey.includes(\".\")) return undefined;\n const titleProperty = collection.properties?.[titleKey];\n // A property builder is a function, and it decides its own value.\n if (!titleProperty || typeof titleProperty === \"function\") return undefined;\n if (titleProperty.type !== \"string\" || titleProperty.enum) return undefined;\n return { [titleKey]: trimmed };\n }, [collection]);\n\n const handleCreateNew = useCallback(() => {\n const defaultValues = buildDefaultValues(searchString);\n closePopover();\n sidePanelController.open({\n path: dataPath,\n collection,\n // No URL. This panel is a detour inside the form you are\n // filling in, not somewhere you navigated to, and its address\n // would restore nothing anyway — a record that does not exist\n // yet has none.\n //\n // Pushing one made closing it a *pathname* change, which is\n // exactly what the unsaved-changes blocker watches\n // (`useUnsavedChangesDialog`). So saving the new row raced the\n // panel clearing its own dirty flag, and often enough lost:\n // \"There are unsaved changes\" over a record that had just been\n // saved, with the URL stranded on the target collection. Worst\n // of all in the case this feature exists for — the outer form\n // has content in it, which is the whole reason not to leave.\n updateUrl: false,\n // Saving is the whole point of the detour; the panel goes away\n // and the picker is left holding the row it made.\n closeOnSave: true,\n defaultValues,\n onUpdate: ({ entity }) => {\n if (!entity) return;\n const item = entityToRelationItemRef.current(entity, new EntityRelation(entity.id, dataPath));\n const current = selectedItemsRef.current;\n const newSelected = multiple\n ? [...current.filter(i => String(i.id) !== String(item.id)), item]\n : [item];\n setSelectedItems(newSelected);\n // Same bookkeeping `onItemClick` does: mark the fingerprint\n // so the resolution effect does not re-fetch the row we\n // already hold when the form echoes the value back.\n localSelectionIdsRef.current = newSelected.map(i => String(i.id)).sort().join(\",\");\n emitValueChangeRef.current(newSelected);\n }\n });\n }, [buildDefaultValues, searchString, closePopover, sidePanelController, dataPath, collection, multiple]);\n\n // Text, not `EmptyValue`. That component draws a small grey rounded bar\n // with no text in it, which is the same shape the `Skeleton` component\n // uses while data is in flight — so a relation you simply had not filled\n // in was indistinguishable from one that was still loading, and an empty\n // Author or Tags field read as permanently stuck. It also left the trigger\n // button with no accessible name, since the bar contains no text at all.\n //\n // This says \"not filled in\" rather than \"nothing to choose from\": which of\n // those it is cannot be known here. The list is deliberately not fetched\n // until the picker is first opened (`enabled: listRequested`, guarded by\n // relation_cell_picker_gating.test.tsx, because a table renders one of\n // these per row), so before that `availableItems` is empty because nobody\n // asked, not because the target collection is. The genuine \"nothing to\n // pick yet\" state is reported inside the popover below, where the fetch\n // has actually happened.\n const resolvedPlaceholder = placeholder || emptyPlaceholder || emptyText;\n\n // Whatever dialog, side dialog or sheet we are inside offers as its\n // portal host, falling back to `document.body`. This is not cosmetic:\n // those are modal, and a modal locks scrolling everywhere outside its\n // own content — a list portaled to the body opens and then refuses to\n // scroll, because every wheel event over it is cancelled.\n const portalContainer = (contextPortalContainer ?? (typeof document !== \"undefined\" ? document.body : undefined)) ?? undefined;\n\n return (\n <>\n <PopoverPrimitive.Root open={isPopoverOpen} onOpenChange={handleRootOpenChange} modal={false}>\n <PickerTrigger anchorRef={anchorRef}>\n {triggerContent !== undefined\n // Bare: the caller frames it. No box, no padding,\n // no height of its own — the node it passed,\n // exactly where it would be anyway. A `div`, not a\n // `button`: what it wraps can hold buttons of its\n // own (a record card's open button, at tall rows).\n ? <div\n ref={handleButtonRef}\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled || undefined}\n aria-haspopup=\"listbox\"\n aria-expanded={isPopoverOpen}\n data-relation-selector-trigger\n onClick={toggleOpen}\n // A record's title in the value opens that\n // record, and the list has no business staying\n // open over it.\n onClickCapture={(event) => {\n const target = event.target;\n if (!(target instanceof Element) || !isPopoverOpenRef.current) return;\n const interactive = target.closest(\"a, button, [role=\\\"button\\\"]\");\n if (interactive && interactive !== event.currentTarget) setPopoverOpen(false);\n }}\n onKeyDown={(event) => {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n toggleOpen();\n }}\n className={cls(\"w-full select-none text-left text-sm relative flex items-center outline-none\", className)}>\n {triggerContent}\n </div>\n : <button\n ref={handleButtonRef}\n type=\"button\"\n aria-haspopup=\"listbox\"\n aria-expanded={isPopoverOpen}\n data-relation-selector-trigger\n disabled={disabled}\n onClick={toggleOpen}\n className={cls(\n {\n \"min-h-[42px] py-1 px-2\": size === \"small\",\n \"min-h-[56px] py-2 px-4\": size === \"medium\",\n \"min-h-[48px] py-1 px-4\": size === \"large\"\n },\n // `rounded-lg` like every other field box —\n // `rounded-md` made this the one control in a\n // row with a different corner.\n \"w-full select-none rounded-lg text-sm relative flex items-center\",\n invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,\n disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,\n className\n )}\n >\n <div className=\"flex justify-between items-center w-full\">\n {isLoadingSelectedItems ? (\n <div className=\"flex items-center gap-2\">\n <CircularProgress size=\"smallest\"/>\n <span className=\"text-sm text-text-secondary dark:text-text-secondary-dark\">{loadingText}</span>\n </div>\n ) : selectedItems.length > 0 ? (\n <div\n className=\"flex flex-wrap items-center gap-1.5 text-start flex-1 min-w-0 mr-2\">\n {selectedItems.map((item) => {\n if (!useChips || !multiple) {\n return (\n <div key={String(item.id)}\n className=\"flex flex-row items-center gap-1 truncate\">\n {item.data ? (\n <EntityPreviewBindingData size={\"medium\"}\n entity={item.data}\n includeEntityLink={false}\n includeId={false}\n onSidePanelClick={closePopover}\n />\n ) : (\n <span className=\"text-sm truncate\">{item.label}</span>\n )}\n </div>\n );\n }\n return (\n <Chip\n size={\"small\"}\n key={String(item.id)}\n className={cls(\"flex flex-row items-center gap-1 truncate\")}\n >\n {item.data ? (\n <EntityPreviewBindingData size={\"smallest\"} entity={item.data}\n includeEntityLink={false}\n includeId={false}/>\n ) : (\n <span className=\"text-sm truncate\">{item.label}</span>\n )}\n <XIcon\n size={iconSize.smallest}\n onClick={(event) => {\n event.stopPropagation();\n handleRemoveItem(item);\n }}\n />\n </Chip>\n );\n })}\n </div>\n ) :\n (\n <span className=\"text-sm text-text-secondary dark:text-text-secondary-dark\">\n {resolvedPlaceholder}\n </span>\n )}\n\n <div className=\"flex items-center flex-shrink-0\">\n {!multiple && selectedItems.length === 1 && selectedItems[0]?.data && (\n <Tooltip title={`Open ${selectedItems[0].label}`}>\n <IconButton aria-label={`Open ${selectedItems[0].label}`}\n component={\"div\"}\n size={\"small\"}\n className=\"opacity-60 hover:opacity-100\"\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n const entity = selectedItems[0].data!;\n setPopoverOpen(false);\n sidePanelController.open({\n entityId: entity.id,\n path: entity.path,\n collection,\n updateUrl: true\n });\n }}>\n <ArrowRightToLineIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n )}\n <ChevronDownIcon\n size={size === \"small\" ? iconSize.small : iconSize.medium}\n className={cls(\"transition\", isPopoverOpen ? \"rotate-180\" : \"\")}\n />\n </div>\n </div>\n\n </button>}\n </PickerTrigger>\n <PopoverPrimitive.Portal container={portalContainer}>\n <PopoverPrimitive.Content\n ref={contentRef}\n data-relation-selector-content\n className={cls(\"z-50 overflow-hidden border bg-surface-card rounded-lg min-w-72\", defaultBorderMixin)}\n align=\"start\"\n sideOffset={8}\n side=\"bottom\"\n avoidCollisions={true}\n collisionPadding={16}\n // Allow default auto focus (we manually refocus anyway)\n onOpenAutoFocus={(_e) => { /* leave default or custom manual focus */\n }}\n onCloseAutoFocus={(e) => {\n e.preventDefault();\n }}\n style={{ width: \"var(--radix-popover-trigger-width)\" }}\n >\n <CommandPrimitive shouldFilter={false}>\n <div className=\"flex flex-row items-center\">\n <div className=\"relative flex-1\">\n <SearchIcon\n className=\"absolute left-3 top-1/2 transform -translate-y-1/2 text-text-secondary dark:text-text-secondary-dark\"\n size={iconSize.smallest}/>\n <CommandPrimitive.Input\n ref={searchInputRef}\n className={cls(\n focusedDisabled,\n \"bg-transparent outline-hidden flex-1 h-full w-full pl-10 pr-4 py-3 text-text-primary dark:text-text-primary-dark placeholder:text-text-secondary dark:placeholder:text-text-secondary-dark\"\n )}\n placeholder={searchPlaceholder}\n value={searchString}\n onValueChange={handleSearchChange}\n />\n </div>\n {isLoading && (\n <div className=\"flex items-center justify-center px-3\">\n <CircularProgress size=\"smallest\"/>\n </div>\n )}\n {selectedItems.length > 0 && (\n <div\n onClick={handleClear}\n className=\"text-sm justify-center cursor-pointer py-3 px-4 text-text-secondary dark:text-text-secondary-dark hover:text-text-primary dark:hover:text-text-primary-dark\"\n >\n Clear\n </div>\n )}\n </div>\n <Separator orientation=\"horizontal\" className=\"my-0\"/>\n <CommandPrimitive.List\n ref={scrollContainerRef}\n style={{\n maxHeight: \"40vh\",\n overflowY: \"auto\"\n }}\n >\n {isLoading && availableItems.length === 0 && (\n <div className=\"flex items-center justify-center py-6\">\n <CircularProgress size=\"small\"/>\n <span\n className=\"ml-2 text-sm text-text-secondary dark:text-text-secondary-dark\">{loadingText}</span>\n </div>\n )}\n {/* Two different nothings, which used to share one\n message (\"No relations found.\") even though the\n fix for each is the opposite: clear the search, or\n go and create the first row. With the fetch done,\n the search string is what tells them apart. */}\n {!isLoading && availableItems.length === 0 && (\n <CommandPrimitive.Empty\n className=\"px-4 py-6 text-center text-text-secondary dark:text-text-secondary-dark\">\n {searchString\n ? noResultsText\n : (emptyCollectionText ?? `No ${collection.name ?? \"entries\"} yet.`)}\n </CommandPrimitive.Empty>\n )}\n <CommandPrimitive.Group>\n {(() => {\n // Sort items so that initially-selected (pinned) items appear first.\n // We use the entity taken when the popover opened so items don't\n // jump around as the user checks/unchecks.\n const pinned = pinnedIdsRef.current;\n const sortedItems = pinned && pinned.size > 0\n ? [...availableItems].sort((a, b) => {\n const aP = pinned.has(String(a.id)) ? 0 : 1;\n const bP = pinned.has(String(b.id)) ? 0 : 1;\n return aP - bP;\n })\n : availableItems;\n return sortedItems;\n })().map((item) => {\n const isSelected = selectedItems.some(v => String(v.id) === String(item.id));\n return (\n <CommandPrimitive.Item\n key={String(item.id)}\n value={String(item.id)}\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n onSelect={() => onItemClick(item)}\n className={cls(\n \"flex flex-row items-center gap-1.5 m-1 p-1 rounded-xs cursor-pointer ring-offset-transparent\",\n isSelected && \"bg-surface-active\",\n \"aria-selected:outline-hidden aria-selected:bg-surface-active\"\n )}\n >\n {multiple && (<InnerCheckBox checked={isSelected}/>)}\n {item.data ? (\n <div\n className=\"flex flex-row items-center gap-2 min-w-0 w-full\">\n <EntityPreviewBindingData\n size={multiple ? \"smallest\" : \"medium\"}\n entity={item.data}\n includeId={false}\n includeEntityLink={true}\n />\n </div>\n ) : (\n <div>\n <div\n className=\"text-sm font-medium text-text-primary dark:text-text-primary-dark\">{item.label}</div>\n {item.description && (\n <div\n className=\"text-xs text-text-secondary dark:text-text-secondary-dark\">{item.description}</div>\n )}\n </div>\n )}\n </CommandPrimitive.Item>\n );\n })}\n {availableItems.length > 0 && hasMore && (\n <div ref={sentinelCallbackRef} className=\"h-1 w-full\"\n style={{ visibility: \"hidden\" }}/>\n )}\n {isLoading && availableItems.length > 0 && (\n <div className=\"flex items-center justify-center py-4\">\n <CircularProgress size=\"smallest\"/>\n <span\n className=\"ml-2 text-xs text-text-secondary dark:text-text-secondary-dark\">Loading...</span>\n </div>\n )}\n </CommandPrimitive.Group>\n </CommandPrimitive.List>\n {canCreateTarget && <>\n <Separator orientation=\"horizontal\" className=\"my-0\"/>\n {/* Outside the scrolling list on purpose: it\n is most wanted exactly when the list is\n long and nothing in it matched. */}\n <button\n type=\"button\"\n data-relation-selector-create\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n onClick={handleCreateNew}\n className={cls(\n \"w-full flex flex-row items-center gap-2 px-4 py-3 text-sm text-left\",\n \"text-primary hover:bg-surface-hover\"\n )}>\n <PlusIcon size={iconSize.smallest}/>\n <span className=\"truncate\">\n {searchString.trim()\n ? t(\"add_named\", { name: searchString.trim() })\n : t(\"add_specific\", { name: collection.singularName ?? collection.name })}\n </span>\n </button>\n </>}\n </CommandPrimitive>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </>\n );\n }\n);\n\nRelationSelector.displayName = \"RelationSelector\";\n\nfunction InnerCheckBox({ checked }: { checked: boolean }) {\n return (\n <div className={cls(\n \"p-2 w-8 h-8 inline-flex items-center justify-center text-sm font-medium focus:outline-hidden transition-colors ease-in-out duration-150\"\n )}>\n <div\n className={cls(\n \"border-2 relative transition-colors ease-in-out duration-150 w-4 h-4 rounded-xs flex items-center justify-center\",\n checked ? \"bg-primary text-surface-accent-100 dark:text-surface-accent-900 border-transparent\" : \"bg-surface-card border-surface-accent-800 dark:border-surface-accent-500\"\n )}\n >\n {checked && <CheckIcon size={iconSize.smallest} className=\"absolute\"/>}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAoCA,SAAS,oBAAoB,UAA2F;CACpH,IAAI,CAAC,UAAU,OAAO,KAAA;CACtB,IAAI,SAAS,SAAS,OAAO,OAAO,SAAS;CAC7C,IAAI,SAAS,SAAS,aAAa,SAAS,SAAS,cAAc,OAAO;CAC1E,IAAI,SAAS,SAAS,eAAe,SAAS,SAAS,UAAU,OAAO;CACxE,OAAO,SAAS;AACpB;AAiGA,IAAa,mBAAmB,Q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K;UAAqB,WAAU;UACrC,OAAO,EAAE,YAAY,SAAS;SAAG,CAAA;SAExC,aAAa,eAAe,SAAS,KAClC,qBAAC,OAAD;UAAK,WAAU;oBAAf,CACI,oBAAC,kBAAD,EAAkB,MAAK,WAAW,CAAA,GAClC,oBAAC,QAAD;WACI,WAAU;qBAAiE;UAAgB,CAAA,CAC9F;;QAEW,EAAA,CAAA;OACL;;MACtB,mBAAmB,qBAAA,UAAA,EAAA,UAAA,CAChB,oBAAC,WAAD;OAAW,aAAY;OAAa,WAAU;MAAO,CAAA,GAIrD,qBAAC,UAAD;OACI,MAAK;OACL,iCAAA;OACA,cAAc,MAAM;QAChB,EAAE,eAAe;QACjB,EAAE,gBAAgB;OACtB;OACA,SAAS;OACT,WAAW,IACP,uEACA,qCACJ;iBAXJ,CAYI,oBAAC,UAAD,EAAU,MAAM,SAAS,SAAU,CAAA,GACnC,oBAAC,QAAD;QAAM,WAAU;kBACX,aAAa,KAAK,IACb,EAAE,aAAa,EAAE,MAAM,aAAa,KAAK,EAAE,CAAC,IAC5C,EAAE,gBAAgB,EAAE,MAAM,WAAW,gBAAgB,WAAW,KAAK,CAAC;OAC1E,CAAA,CACF;QACV,EAAA,CAAA;KACY;;GACI,CAAA;EACL,CAAA,CACN;IACzB,CAAA;AAEV,CACJ;AAEA,iBAAiB,cAAc;AAE/B,SAAS,cAAc,EAAE,WAAiC;CACtD,OACI,oBAAC,OAAD;EAAK,WAAW,IACZ,yIACJ;YACI,oBAAC,OAAD;GACI,WAAW,IACP,oHACA,UAAU,uFAAuF,0EACrG;aAEC,WAAW,oBAAC,WAAD;IAAW,MAAM,SAAS;IAAU,WAAU;GAAW,CAAA;EACpE,CAAA;CACJ,CAAA;AAEb"}
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { IconButton, LucideIconByName, SearchBar, Tooltip, coolIconKeys, debounce, iconSize } from "@rebasepro/ui";
4
+ import { iconsSearch, useTranslation } from "@rebasepro/app";
5
+ //#region src/components/SearchIconsView.tsx
6
+ var UPDATE_SEARCH_INDEX_WAIT_MS = 220;
7
+ function SearchIconsView({ selectedIcon = "", onIconSelected }) {
8
+ const { t } = useTranslation();
9
+ const [keys, setKeys] = React.useState(null);
10
+ const [query, setQuery] = React.useState("");
11
+ const updateSearchResults = React.useMemo(() => debounce((value) => {
12
+ if (!value || value === "") setKeys(null);
13
+ else {
14
+ const limited = iconsSearch.search(value).slice(0, 50);
15
+ setKeys(limited.map((e) => e.item.key));
16
+ }
17
+ }, UPDATE_SEARCH_INDEX_WAIT_MS), []);
18
+ React.useEffect(() => {
19
+ updateSearchResults(query);
20
+ return () => {
21
+ updateSearchResults.clear();
22
+ };
23
+ }, [query, updateSearchResults]);
24
+ const icons = keys === null ? coolIconKeys : keys;
25
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SearchBar, {
26
+ autoFocus: false,
27
+ innerClassName: "w-full sticky top-0 z-10",
28
+ onTextSearch: (value) => setQuery(value ?? ""),
29
+ placeholder: t("search_for_more_icons")
30
+ }), /* @__PURE__ */ jsx("div", {
31
+ className: "flex max-w-full flex-wrap mt-4",
32
+ children: icons.map((icon) => /* @__PURE__ */ jsx(Tooltip, {
33
+ title: icon,
34
+ asChild: true,
35
+ children: /* @__PURE__ */ jsx(IconButton, {
36
+ "aria-label": icon,
37
+ shape: "square",
38
+ toggled: selectedIcon === icon,
39
+ onClick: onIconSelected ? () => onIconSelected(icon) : void 0,
40
+ className: "box-content m-1",
41
+ children: /* @__PURE__ */ jsx(LucideIconByName, {
42
+ name: icon,
43
+ size: iconSize.medium
44
+ })
45
+ })
46
+ }, icon))
47
+ })] });
48
+ }
49
+ //#endregion
50
+ export { SearchIconsView };
51
+
52
+ //# sourceMappingURL=SearchIconsView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchIconsView.js","names":[],"sources":["../../src/components/SearchIconsView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport {\n coolIconKeys,\n debounce,\n IconButton,\n iconSize,\n LucideIconByName,\n SearchBar,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { iconsSearch } from \"@rebasepro/app\";\nimport { useTranslation } from \"@rebasepro/app\";\n\nconst UPDATE_SEARCH_INDEX_WAIT_MS = 220;\n\nexport interface SearchIconsProps {\n selectedIcon?: string;\n onIconSelected?: (icon: string) => void;\n}\n\nexport function SearchIconsView({\n selectedIcon = \"\",\n onIconSelected\n}: SearchIconsProps) {\n const { t } = useTranslation();\n const [keys, setKeys] = React.useState<string[] | null>(null);\n const [query, setQuery] = React.useState<string>(\"\");\n\n const updateSearchResults = React.useMemo(() =>\n debounce((value: string) => {\n if (!value || value === \"\") {\n setKeys(null);\n } else {\n const searchResult = iconsSearch.search(value);\n const limit = 50;\n const limited = searchResult.slice(0, limit);\n setKeys(limited.map((e) => e.item.key));\n }\n }, UPDATE_SEARCH_INDEX_WAIT_MS), []\n );\n\n React.useEffect(() => {\n updateSearchResults(query);\n return () => {\n updateSearchResults.clear();\n };\n }, [query, updateSearchResults]);\n\n const icons = keys === null ? coolIconKeys : keys;\n\n return (\n <>\n <SearchBar\n autoFocus={false}\n innerClassName={\"w-full sticky top-0 z-10\"}\n onTextSearch={(value?: string) => setQuery(value ?? \"\")}\n placeholder={t(\"search_for_more_icons\")}\n />\n\n <div className={\"flex max-w-full flex-wrap mt-4\"}>\n {icons.map((icon: string) => (\n <Tooltip title={icon} key={icon}\n asChild={true}>\n <IconButton aria-label={icon}\n shape={\"square\"}\n toggled={selectedIcon === icon}\n onClick={onIconSelected ? () => onIconSelected(icon) : undefined}\n className=\"box-content m-1\"\n >\n <LucideIconByName name={icon} size={iconSize.medium}/>\n </IconButton>\n </Tooltip>\n ))}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;AAcA,IAAM,8BAA8B;AAOpC,SAAgB,gBAAgB,EAC5B,eAAe,IACf,kBACiB;CACjB,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,MAAM,WAAW,MAAM,SAA0B,IAAI;CAC5D,MAAM,CAAC,OAAO,YAAY,MAAM,SAAiB,EAAE;CAEnD,MAAM,sBAAsB,MAAM,cAC9B,UAAU,UAAkB;EACxB,IAAI,CAAC,SAAS,UAAU,IACpB,QAAQ,IAAI;OACT;GAGH,MAAM,UAFe,YAAY,OAAO,KAExB,CAAA,CAAa,MAAM,GAAG,EAAK;GAC3C,QAAQ,QAAQ,KAAK,MAAM,EAAE,KAAK,GAAG,CAAC;EAC1C;CACJ,GAAG,2BAA2B,GAAG,CAAC,CACtC;CAEA,MAAM,gBAAgB;EAClB,oBAAoB,KAAK;EACzB,aAAa;GACT,oBAAoB,MAAM;EAC9B;CACJ,GAAG,CAAC,OAAO,mBAAmB,CAAC;CAE/B,MAAM,QAAQ,SAAS,OAAO,eAAe;CAE7C,OACI,qBAAA,UAAA,EAAA,UAAA,CACI,oBAAC,WAAD;EACI,WAAW;EACX,gBAAgB;EAChB,eAAe,UAAmB,SAAS,SAAS,EAAE;EACtD,aAAa,EAAE,uBAAuB;CACzC,CAAA,GAED,oBAAC,OAAD;EAAK,WAAW;YACX,MAAM,KAAK,SACR,oBAAC,SAAD;GAAS,OAAO;GACZ,SAAS;aACT,oBAAC,YAAD;IAAY,cAAY;IACpB,OAAO;IACP,SAAS,iBAAiB;IAC1B,SAAS,uBAAuB,eAAe,IAAI,IAAI,KAAA;IACvD,WAAU;cAEV,oBAAC,kBAAD;KAAkB,MAAM;KAAM,MAAM,SAAS;IAAQ,CAAA;GAC7C,CAAA;EACP,GAVkB,IAUlB,CACZ;CACA,CAAA,CACP,EAAA,CAAA;AAEV"}
@@ -93,4 +93,4 @@ export type SelectableTableProps<M extends Record<string, unknown>> = {
93
93
  * @see VirtualTable
94
94
  * @group Components
95
95
  */
96
- export declare const SelectableTable: <M extends Record<string, unknown>>({ onValueChange, cellRenderer, onEntityClick, onColumnResize, hoverRow, size, inlineEditing, tableController: { data, dataLoading, noMoreToLoad, dataLoadingError, filterValues, setFilterValues, sortBy, setSortBy, itemCount, setItemCount, pageSize, paginationEnabled, checkFilterCombination, setPopupCell }, filterable, onScroll, initialScroll, emptyComponent, columns, fixedFilter, highlightedRow, endAdornment, AddColumnComponent, onColumnsOrderChange, extraData }: SelectableTableProps<M>) => React.JSX.Element;
96
+ export declare const SelectableTable: <M extends Record<string, unknown>>({ onValueChange, cellRenderer, onEntityClick, onColumnResize, hoverRow, size, inlineEditing, tableController: { data, sparseData, onRowsRendered, dataLoading, noMoreToLoad, dataLoadingError, filterValues, setFilterValues, sortBy, setSortBy, itemCount, setItemCount, pageSize, paginationEnabled, checkFilterCombination, setPopupCell }, filterable, onScroll, initialScroll, emptyComponent, columns, fixedFilter, highlightedRow, endAdornment, AddColumnComponent, onColumnsOrderChange, extraData }: SelectableTableProps<M>) => React.JSX.Element;
@@ -0,0 +1,158 @@
1
+ import { createSelectionStore } from "./SelectionStore.js";
2
+ import { SelectableTableContext } from "./SelectableTableContext.js";
3
+ import { FilterFieldBinding } from "./filters/FilterFieldBinding.js";
4
+ import React, { useCallback, useEffect, useMemo, useRef } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { VirtualTable, isKeyHandled, useOutsideAlerter } from "@rebasepro/ui";
7
+ import { DEFAULT_PAGE_SIZE, getRowHeight } from "@rebasepro/app";
8
+ //#region src/components/SelectableTable/SelectableTable.tsx
9
+ /**
10
+ * This component is in charge of rendering a collection table with a high
11
+ * degree of customization.
12
+ *
13
+ * This component is used internally by {@link CollectionViewBinding} and
14
+ * {@link useReferenceDialog}
15
+ *
16
+ * Please note that you only need to use this component if you are building
17
+ * a custom view. If you just need to create a default view you can do it
18
+ * exclusively with config options.
19
+ *
20
+ * If you want to bind a {@link AdminCollection} to a table with the default
21
+ * options you see in collections in the top level navigation, you can
22
+ * check {@link CollectionViewBinding}.
23
+ *
24
+ * The data displayed in the table is managed by a {@link EntityTableController}.
25
+ * You can build the default, bound to a path in the driver, by using the hook
26
+ * {@link useDataTableController}
27
+ *
28
+ * @see CollectionTableBindingProps
29
+ * @see CollectionViewBinding
30
+ * @see VirtualTable
31
+ * @group Components
32
+ */
33
+ var SelectableTable = function SelectableTable({ onValueChange, cellRenderer, onEntityClick, onColumnResize, hoverRow = true, size = "m", inlineEditing = false, tableController: { data, sparseData, onRowsRendered, dataLoading, noMoreToLoad, dataLoadingError, filterValues, setFilterValues, sortBy, setSortBy, itemCount, setItemCount, pageSize = DEFAULT_PAGE_SIZE, paginationEnabled, checkFilterCombination, setPopupCell }, filterable = true, onScroll, initialScroll, emptyComponent, columns, fixedFilter, highlightedRow, endAdornment, AddColumnComponent, onColumnsOrderChange, extraData }) {
34
+ const ref = useRef(null);
35
+ const selectionStore = useMemo(() => createSelectionStore(), []);
36
+ const [localSelectedCell, setLocalSelectedCell] = React.useState(void 0);
37
+ const loadNextPage = useCallback(() => {
38
+ if (!paginationEnabled || dataLoading || noMoreToLoad) return;
39
+ if (itemCount !== void 0) setItemCount?.(itemCount + pageSize);
40
+ }, [
41
+ paginationEnabled,
42
+ dataLoading,
43
+ noMoreToLoad,
44
+ itemCount,
45
+ pageSize,
46
+ setItemCount
47
+ ]);
48
+ const resetPagination = useCallback(() => {
49
+ setItemCount?.(pageSize);
50
+ }, [pageSize]);
51
+ const onRowClick = useCallback(({ rowData }) => {
52
+ if (inlineEditing) return;
53
+ return onEntityClick && onEntityClick(rowData);
54
+ }, [onEntityClick, inlineEditing]);
55
+ const select = useCallback((cell) => {
56
+ setLocalSelectedCell(cell);
57
+ if (cell) selectionStore.select({
58
+ ...cell,
59
+ columnKey: cell.propertyKey,
60
+ id: cell.entityId
61
+ });
62
+ else selectionStore.select(void 0);
63
+ }, [selectionStore]);
64
+ const unselect = useCallback(() => {
65
+ setLocalSelectedCell(void 0);
66
+ selectionStore.select(void 0);
67
+ }, [selectionStore]);
68
+ useOutsideAlerter(ref, () => {
69
+ if (localSelectedCell) unselect();
70
+ }, Boolean(localSelectedCell));
71
+ useEffect(() => {
72
+ const escFunction = (event) => {
73
+ if (event.key !== "Escape" || isKeyHandled(event)) return;
74
+ const target = event.target;
75
+ if (target instanceof Node && target !== document.body && ref.current && !ref.current.contains(target)) return;
76
+ unselect();
77
+ };
78
+ document.addEventListener("keydown", escFunction, false);
79
+ return () => {
80
+ document.removeEventListener("keydown", escFunction, false);
81
+ };
82
+ }, [unselect]);
83
+ useEffect(() => () => onRowsRendered?.(void 0), [onRowsRendered]);
84
+ const onFilterUpdate = useCallback((updatedFilterValues) => {
85
+ if (setFilterValues) setFilterValues({
86
+ ...updatedFilterValues,
87
+ ...fixedFilter
88
+ });
89
+ }, [fixedFilter, setFilterValues]);
90
+ const contextValue = useMemo(() => ({
91
+ select,
92
+ onValueChange,
93
+ size: size ?? "m",
94
+ selectionStore,
95
+ setPopupCell
96
+ }), [
97
+ setPopupCell,
98
+ select,
99
+ onValueChange,
100
+ size,
101
+ selectionStore
102
+ ]);
103
+ const createFilterField = useCallback(({ id, filterValue, setFilterValue, column, hidden, setHidden }) => {
104
+ if (!column.custom) return null;
105
+ const { resolvedProperty } = column.custom;
106
+ if (!resolvedProperty) return null;
107
+ return /* @__PURE__ */ jsx(FilterFieldBinding, {
108
+ propertyKey: id,
109
+ property: resolvedProperty,
110
+ value: filterValue,
111
+ setValue: setFilterValue,
112
+ hidden,
113
+ setHidden
114
+ });
115
+ }, []);
116
+ return /* @__PURE__ */ jsx(SelectableTableContext.Provider, {
117
+ value: contextValue,
118
+ children: /* @__PURE__ */ jsx("div", {
119
+ className: "h-full w-full flex flex-col bg-surface-card",
120
+ ref,
121
+ children: /* @__PURE__ */ jsx(VirtualTable, {
122
+ data: sparseData ?? data,
123
+ onRowsRendered,
124
+ columns,
125
+ cellRenderer,
126
+ onRowClick: inlineEditing ? void 0 : onEntityClick ? onRowClick : void 0,
127
+ onEndReached: loadNextPage,
128
+ onResetPagination: resetPagination,
129
+ error: dataLoadingError,
130
+ onColumnResize,
131
+ rowHeight: getRowHeight(size),
132
+ loading: dataLoading,
133
+ filter: filterValues,
134
+ onFilterUpdate: setFilterValues ? onFilterUpdate : void 0,
135
+ sortBy,
136
+ onSortByUpdate: setSortBy,
137
+ hoverRow,
138
+ initialScroll,
139
+ onScroll,
140
+ checkFilterCombination,
141
+ createFilterField: filterable ? createFilterField : void 0,
142
+ rowClassName: useCallback((entity) => {
143
+ return highlightedRow?.(entity) ? "!bg-surface-raised" : "";
144
+ }, [highlightedRow]),
145
+ className: "grow",
146
+ emptyComponent,
147
+ endAdornment,
148
+ AddColumnComponent,
149
+ onColumnsOrderChange,
150
+ extraData
151
+ })
152
+ })
153
+ });
154
+ };
155
+ //#endregion
156
+ export { SelectableTable };
157
+
158
+ //# sourceMappingURL=SelectableTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectableTable.js","names":[],"sources":["../../../src/components/SelectableTable/SelectableTable.tsx"],"sourcesContent":["import { createSelectionStore, AdminSelectedCell } from \"./SelectionStore\";\nimport type { Property, WhereFilterOp } from \"@rebasepro/types\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { Entity, FilterValues } from \"@rebasepro/types\";\nimport { CollectionSize, EntityTableController, SelectedCellProps, AdminCollection } from \"@rebasepro/cms-types\";\nimport { CellRendererParams, VirtualTable, VirtualTableColumn, VirtualTableFilterValues, VirtualTableSortKey, OnRowClickParams } from \"@rebasepro/ui\";\nimport { DEFAULT_PAGE_SIZE, DataCollectionTableController, OnCellValueChange, OnColumnResizeParams } from \"@rebasepro/app\";\nimport { FilterFormFieldProps } from \"@rebasepro/ui\";\nimport { isKeyHandled, useOutsideAlerter } from \"@rebasepro/ui\";\nimport { SelectableTableContext } from \"./SelectableTableContext\";\nimport { getRowHeight } from \"@rebasepro/app\";\nimport { FilterFieldBinding } from \"./filters/FilterFieldBinding\";\n\nexport type SelectableTableProps<M extends Record<string, unknown>> = {\n\n /**\n * Callback when a cell value changes.\n */\n onValueChange?: OnCellValueChange<unknown, M>;\n\n columns: VirtualTableColumn[];\n\n cellRenderer: (props: CellRendererParams<Entity<M>>) => React.ReactNode;\n\n /**\n * Builder for creating the buttons in each row\n * @param entity\n * @param size\n */\n tableRowActionsBuilder?: (params: {\n entity: Entity<M>,\n size: CollectionSize,\n width: number,\n frozen?: boolean\n }) => React.ReactNode;\n\n /**\n * Callback when anywhere on the table is clicked\n */\n onEntityClick?(entity: Entity<M>): void;\n\n /**\n * Callback when a column is resized\n */\n onColumnResize?(params: OnColumnResizeParams): void;\n\n /**\n * Should apply a different style to a row when hovering\n */\n hoverRow?: boolean;\n\n /**\n * Controller holding the logic for the table\n * {@link useDataTableController}\n * {@link EntityTableController}\n */\n tableController: EntityTableController<M>;\n\n filterable?: boolean;\n\n sortable?: boolean;\n\n inlineEditing?: boolean;\n\n fixedFilter?: FilterValues<keyof M extends string ? keyof M : never>;\n\n highlightedRow?: (data: Entity<M>) => boolean;\n\n size?: CollectionSize;\n\n initialScroll?: number;\n\n /**\n * Callback when the table is scrolled\n * @param props\n */\n onScroll?: (props: {\n scrollDirection: \"forward\" | \"backward\",\n scrollOffset: number,\n scrollUpdateWasRequested: boolean\n }) => void;\n\n emptyComponent?: React.ReactNode;\n\n endAdornment?: React.ReactNode;\n\n AddColumnComponent?: React.ComponentType;\n\n /**\n * Callback when columns are reordered via drag-and-drop\n */\n onColumnsOrderChange?: (columns: VirtualTableColumn[]) => void;\n\n /**\n * Extra data passed to VirtualTable cells. Changes to this object\n * bust the cell memo comparator, triggering re-render of cells\n * even when rowData hasn't changed.\n */\n extraData?: unknown;\n}\n\n/**\n * This component is in charge of rendering a collection table with a high\n * degree of customization.\n *\n * This component is used internally by {@link CollectionViewBinding} and\n * {@link useReferenceDialog}\n *\n * Please note that you only need to use this component if you are building\n * a custom view. If you just need to create a default view you can do it\n * exclusively with config options.\n *\n * If you want to bind a {@link AdminCollection} to a table with the default\n * options you see in collections in the top level navigation, you can\n * check {@link CollectionViewBinding}.\n *\n * The data displayed in the table is managed by a {@link EntityTableController}.\n * You can build the default, bound to a path in the driver, by using the hook\n * {@link useDataTableController}\n *\n * @see CollectionTableBindingProps\n * @see CollectionViewBinding\n * @see VirtualTable\n * @group Components\n */\nexport const SelectableTable = function SelectableTable<M extends Record<string, unknown>>\n ({\n onValueChange,\n cellRenderer,\n onEntityClick,\n onColumnResize,\n hoverRow = true,\n size = \"m\",\n inlineEditing = false,\n tableController:\n {\n data,\n sparseData,\n onRowsRendered,\n dataLoading,\n noMoreToLoad,\n dataLoadingError,\n filterValues,\n setFilterValues,\n sortBy,\n setSortBy,\n itemCount,\n setItemCount,\n pageSize = DEFAULT_PAGE_SIZE,\n paginationEnabled,\n checkFilterCombination,\n setPopupCell\n },\n filterable = true,\n onScroll,\n initialScroll,\n emptyComponent,\n columns,\n fixedFilter,\n highlightedRow,\n endAdornment,\n AddColumnComponent,\n onColumnsOrderChange,\n extraData\n }: SelectableTableProps<M>) {\n\n const ref = useRef<HTMLDivElement>(null);\n\n // Create the selection store once\n const selectionStore = useMemo(() => createSelectionStore(), []);\n // We still keep local state for side-effects like outside-alerter, but we don't put it in context\n const [localSelectedCell, setLocalSelectedCell] = React.useState<SelectedCellProps<M> | undefined>(undefined);\n\n const loadNextPage = useCallback(() => {\n if (!paginationEnabled || dataLoading || noMoreToLoad)\n return;\n if (itemCount !== undefined)\n setItemCount?.(itemCount + pageSize);\n }, [paginationEnabled, dataLoading, noMoreToLoad, itemCount, pageSize, setItemCount]);\n\n const resetPagination = useCallback(() => {\n setItemCount?.(pageSize);\n }, [pageSize]);\n\n const onRowClick = useCallback(({ rowData }: OnRowClickParams<Entity<M>>) => {\n if (inlineEditing)\n return;\n return onEntityClick && onEntityClick(rowData);\n }, [onEntityClick, inlineEditing]);\n\n const select = useCallback((cell?: SelectedCellProps<M>) => {\n setLocalSelectedCell(cell);\n if (cell) {\n selectionStore.select({\n ...cell,\n columnKey: cell.propertyKey,\n id: cell.entityId\n } as AdminSelectedCell);\n } else {\n selectionStore.select(undefined);\n }\n }, [selectionStore]);\n\n const unselect = useCallback(() => {\n setLocalSelectedCell(undefined);\n selectionStore.select(undefined);\n }, [selectionStore]);\n\n useOutsideAlerter(ref,\n () => {\n if (localSelectedCell) {\n unselect();\n }\n },\n Boolean(localSelectedCell));\n\n // on ESC key press\n useEffect(() => {\n const escFunction = (event: KeyboardEvent) => {\n // A layer above the table already acted on this Escape (kit rule:\n // it called preventDefault) — closing it is the whole of the key.\n if (event.key !== \"Escape\" || isKeyHandled(event)) return;\n // A key pressed inside something the table opened — a cell's\n // dropdown, portaled out of the table — is that layer's Escape: it\n // closes the list and leaves the cell selected. The next one, from\n // the cell itself, clears the selection.\n const target = event.target;\n if (target instanceof Node && target !== document.body && ref.current && !ref.current.contains(target))\n return;\n unselect();\n };\n document.addEventListener(\"keydown\", escFunction, false);\n return () => {\n document.removeEventListener(\"keydown\", escFunction, false);\n };\n }, [unselect]);\n\n // The table stops drawing rows when it goes (another view takes over):\n // say so, so the controller keeps every row held current again.\n useEffect(() => () => onRowsRendered?.(undefined), [onRowsRendered]);\n\n const onFilterUpdate = useCallback((updatedFilterValues?: VirtualTableFilterValues<string>) => {\n if (setFilterValues) {\n setFilterValues({\n ...updatedFilterValues,\n ...fixedFilter\n } as FilterValues<Extract<keyof M, string> | (string & {})>);\n }\n }, [fixedFilter, setFilterValues]);\n\n const contextValue = useMemo(() => ({\n select,\n onValueChange,\n size: size ?? \"m\",\n selectionStore,\n setPopupCell\n } as DataCollectionTableController<Record<string, unknown>>), [setPopupCell, select, onValueChange, size, selectionStore]);\n\n const createFilterField = useCallback(({\n id,\n filterValue,\n setFilterValue,\n column,\n hidden,\n setHidden\n }: FilterFormFieldProps<unknown>): React.ReactNode => {\n if (!column.custom) return null;\n const { resolvedProperty } = column.custom as { resolvedProperty?: Property };\n if (!resolvedProperty) return null;\n // Engine-aware operator resolution happens inside FilterFieldBinding,\n // which reads the collection from the surrounding CollectionScopeProvider.\n return <FilterFieldBinding\n propertyKey={id as string}\n property={resolvedProperty}\n value={filterValue as [WhereFilterOp, unknown] | undefined}\n setValue={setFilterValue as (value?: [WhereFilterOp, unknown]) => void}\n hidden={hidden}\n setHidden={setHidden}/>;\n }, []);\n\n return (\n <SelectableTableContext.Provider\n value={contextValue}>\n <div className=\"h-full w-full flex flex-col bg-surface-card\"\n ref={ref}>\n\n <VirtualTable\n data={sparseData ?? data}\n onRowsRendered={onRowsRendered}\n columns={columns}\n cellRenderer={cellRenderer}\n onRowClick={inlineEditing ? undefined : (onEntityClick ? onRowClick : undefined)}\n onEndReached={loadNextPage}\n onResetPagination={resetPagination}\n error={dataLoadingError}\n onColumnResize={onColumnResize}\n rowHeight={getRowHeight(size)}\n loading={dataLoading}\n filter={filterValues}\n onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}\n sortBy={sortBy}\n onSortByUpdate={setSortBy as ((sortBy?: VirtualTableSortKey[]) => void)}\n hoverRow={hoverRow}\n initialScroll={initialScroll}\n onScroll={onScroll}\n checkFilterCombination={checkFilterCombination}\n createFilterField={filterable ? createFilterField : undefined}\n rowClassName={useCallback((entity: Entity<M>) => {\n return highlightedRow?.(entity) ? \"!bg-surface-raised\" : \"\";\n }, [highlightedRow])}\n className=\"grow\"\n emptyComponent={emptyComponent}\n endAdornment={endAdornment}\n AddColumnComponent={AddColumnComponent}\n onColumnsOrderChange={onColumnsOrderChange}\n extraData={extraData}\n />\n\n </div>\n </SelectableTableContext.Provider>\n );\n\n};\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,IAAa,kBAAkB,SAAS,gBACnC,EACG,eACA,cACA,eACA,gBACA,WAAW,MACX,OAAO,KACP,gBAAgB,OAChB,iBACA,EACI,MACA,YACA,gBACA,aACA,cACA,kBACA,cACA,iBACA,QACA,WACA,WACA,cACA,WAAW,mBACX,mBACA,wBACA,gBAEJ,aAAa,MACb,UACA,eACA,gBACA,SACA,aACA,gBACA,cACA,oBACA,sBACA,aACwB;CAE5B,MAAM,MAAM,OAAuB,IAAI;CAGvC,MAAM,iBAAiB,cAAc,qBAAq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AAiB,KAAA,CAAS,GAAG,CAAC,cAAc,CAAC;CAEnE,MAAM,iBAAiB,aAAa,wBAA2D;EAC3F,IAAI,iBACA,gBAAgB;GACZ,GAAG;GACH,GAAG;EACP,CAA2D;CAEnE,GAAG,CAAC,aAAa,eAAe,CAAC;CAEjC,MAAM,eAAe,eAAe;EAChC;EACA;EACA,MAAM,QAAQ;EACd;EACA;CACJ,IAA8D;EAAC;EAAc;EAAQ;EAAe;EAAM;CAAc,CAAC;CAEzH,MAAM,oBAAoB,aAAa,EACnC,IACA,aACA,gBACA,QACA,QACA,gBACkD;EAClD,IAAI,CAAC,OAAO,QAAQ,OAAO;EAC3B,MAAM,EAAE,qBAAqB,OAAO;EACpC,IAAI,CAAC,kBAAkB,OAAO;EAG9B,OAAO,oBAAC,oBAAD;GACH,aAAa;GACb,UAAU;GACV,OAAO;GACP,UAAU;GACF;GACG;EAAW,CAAA;CAC9B,GAAG,CAAC,CAAC;CAEL,OACI,oBAAC,uBAAuB,UAAxB;EACI,OAAO;YACP,oBAAC,OAAD;GAAK,WAAU;GACN;aAEJ,oBAAC,cAAD;IACG,MAAM,cAAc;IACJ;IACP;IACK;IACd,YAAY,gBAAgB,KAAA,IAAa,gBAAgB,aAAa,KAAA;IACtE,cAAc;IACd,mBAAmB;IACnB,OAAO;IACS;IAChB,WAAW,aAAa,IAAI;IAC5B,SAAS;IACT,QAAQ;IACR,gBAAgB,kBAAkB,iBAAiB,KAAA;IAC3C;IACR,gBAAgB;IACN;IACK;IACL;IACc;IACxB,mBAAmB,aAAa,oBAAoB,KAAA;IACpD,cAAc,aAAa,WAAsB;KAC7C,OAAO,iBAAiB,MAAM,IAAI,uBAAuB;IAC7D,GAAG,CAAC,cAAc,CAAC;IACnB,WAAU;IACM;IACF;IACM;IACE;IACX;GACd,CAAA;EAEA,CAAA;CACwB,CAAA;AAGzC"}
@@ -0,0 +1,8 @@
1
+ import React, { useContext } from "react";
2
+ //#region src/components/SelectableTable/SelectableTableContext.tsx
3
+ var SelectableTableContext = React.createContext(null);
4
+ var useSelectableTableController = () => useContext(SelectableTableContext);
5
+ //#endregion
6
+ export { SelectableTableContext, useSelectableTableController };
7
+
8
+ //# sourceMappingURL=SelectableTableContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectableTableContext.js","names":[],"sources":["../../../src/components/SelectableTable/SelectableTableContext.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport { DataCollectionTableController } from \"@rebasepro/app\";\n\nexport const SelectableTableContext = React.createContext<DataCollectionTableController<Record<string, unknown>>>(null! as DataCollectionTableController<Record<string, unknown>>);\n\nexport const useSelectableTableController = <M extends Record<string, unknown> = Record<string, unknown>>() =>\n useContext(SelectableTableContext) as DataCollectionTableController<M>;\n"],"mappings":";;AAGA,IAAa,yBAAyB,MAAM,cAAsE,IAA+D;AAEjL,IAAa,qCACT,WAAW,sBAAsB"}
@@ -0,0 +1,29 @@
1
+ import { useCallback, useRef, useSyncExternalStore } from "react";
2
+ import { createVirtualTableSelectionStore } from "@rebasepro/ui";
3
+ //#region src/components/SelectableTable/SelectionStore.ts
4
+ function createSelectionStore() {
5
+ return createVirtualTableSelectionStore();
6
+ }
7
+ function useCellSelected(store, propertyKey, entityPath, entityId) {
8
+ const selectorRef = useRef({
9
+ propertyKey,
10
+ entityPath,
11
+ entityId
12
+ });
13
+ selectorRef.current = {
14
+ propertyKey,
15
+ entityPath,
16
+ entityId
17
+ };
18
+ const getEntity = useCallback(() => {
19
+ const cell = store.getEntity();
20
+ if (!cell) return false;
21
+ const s = selectorRef.current;
22
+ return cell.propertyKey === s.propertyKey && cell.entityPath === s.entityPath && cell.entityId === s.entityId;
23
+ }, [store]);
24
+ return useSyncExternalStore(store.subscribe, getEntity, getEntity);
25
+ }
26
+ //#endregion
27
+ export { createSelectionStore, useCellSelected };
28
+
29
+ //# sourceMappingURL=SelectionStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectionStore.js","names":[],"sources":["../../../src/components/SelectableTable/SelectionStore.ts"],"sourcesContent":["import { useSyncExternalStore, useCallback, useRef } from \"react\";\nimport { SelectedCellProps } from \"@rebasepro/cms-types\";\nimport {\n createVirtualTableSelectionStore,\n VirtualTableSelectionStore,\n SelectedCell\n} from \"@rebasepro/ui\";\n\nexport interface AdminSelectedCell extends SelectedCell {\n entityPath: string;\n entityId: string | number;\n propertyKey: string;\n cellRect: DOMRect;\n width: number;\n height: number;\n}\n\nexport function createSelectionStore() {\n return createVirtualTableSelectionStore<AdminSelectedCell>();\n}\n\nexport type SelectionStore = VirtualTableSelectionStore<AdminSelectedCell>;\n\nexport function useCellSelected(\n store: { getEntity: () => SelectedCellProps | undefined; subscribe: (listener: () => void) => () => void },\n propertyKey: string,\n entityPath: string,\n entityId: string | number\n): boolean {\n const selectorRef = useRef({ propertyKey, entityPath, entityId });\n selectorRef.current = { propertyKey, entityPath, entityId };\n\n const getEntity = useCallback(() => {\n const cell = store.getEntity();\n if (!cell) return false;\n const s = selectorRef.current;\n return cell.propertyKey === s.propertyKey &&\n cell.entityPath === s.entityPath &&\n cell.entityId === s.entityId;\n }, [store]);\n\n return useSyncExternalStore(store.subscribe, getEntity, getEntity);\n}\n"],"mappings":";;;AAiBA,SAAgB,uBAAuB;CACnC,OAAO,iCAAoD;AAC/D;AAIA,SAAgB,gBACZ,OACA,aACA,YACA,UACO;CACP,MAAM,cAAc,OAAO;EAAE;EAAa;EAAY;CAAS,CAAC;CAChE,YAAY,UAAU;EAAE;EAAa;EAAY;CAAS;CAE1D,MAAM,YAAY,kBAAkB;EAChC,MAAM,OAAO,MAAM,UAAU;EAC7B,IAAI,CAAC,MAAM,OAAO;EAClB,MAAM,IAAI,YAAY;EACtB,OAAO,KAAK,gBAAgB,EAAE,eAC1B,KAAK,eAAe,EAAE,cACtB,KAAK,aAAa,EAAE;CAC5B,GAAG,CAAC,KAAK,CAAC;CAEV,OAAO,qBAAqB,MAAM,WAAW,WAAW,SAAS;AACrE"}
@@ -0,0 +1,28 @@
1
+ import "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { BooleanSwitchWithLabel } from "@rebasepro/ui";
4
+ import { useTranslation } from "@rebasepro/app";
5
+ //#region src/components/SelectableTable/filters/BooleanFilterField.tsx
6
+ function BooleanFilterField({ name, title, value, setValue, operators }) {
7
+ const { t } = useTranslation();
8
+ if (operators && !operators.includes("==")) return null;
9
+ function updateFilter(val) {
10
+ if (val !== void 0) setValue(["==", val]);
11
+ else setValue(void 0);
12
+ }
13
+ const valueSetToTrue = value && value[1];
14
+ return /* @__PURE__ */ jsx("div", {
15
+ className: "w-full",
16
+ children: /* @__PURE__ */ jsx(BooleanSwitchWithLabel, {
17
+ size: "medium",
18
+ value: valueSetToTrue,
19
+ allowIndeterminate: true,
20
+ onValueChange: (v) => updateFilter(v === null ? void 0 : v),
21
+ label: !!!value ? t("no_filter") : valueSetToTrue ? `${title} ${t("is_true")}` : `${title} ${t("is_false")}`
22
+ })
23
+ });
24
+ }
25
+ //#endregion
26
+ export { BooleanFilterField };
27
+
28
+ //# sourceMappingURL=BooleanFilterField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BooleanFilterField.js","names":[],"sources":["../../../../src/components/SelectableTable/filters/BooleanFilterField.tsx"],"sourcesContent":["import React from \"react\";\nimport { VirtualTableWhereFilterOp } from \"@rebasepro/ui\";\nimport { BooleanSwitchWithLabel } from \"@rebasepro/ui\";\nimport { useTranslation } from \"@rebasepro/app\";\n\ninterface BooleanFieldProps {\n name: string,\n value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];\n setValue: (value?: [op: VirtualTableWhereFilterOp, newValue: unknown]) => void;\n title?: string;\n /**\n * Restrict the offered operators. This field only ever emits `[\"==\", …]`,\n * so it renders nothing when `==` is not allowed.\n */\n operators?: readonly VirtualTableWhereFilterOp[];\n}\n\nexport function BooleanFilterField({\n name,\n title,\n value,\n setValue,\n operators\n}: BooleanFieldProps) {\n const { t } = useTranslation();\n\n if (operators && !operators.includes(\"==\")) return null;\n\n function updateFilter(val?: boolean) {\n if (val !== undefined) {\n setValue(\n [\"==\", val]\n );\n } else {\n setValue(\n undefined\n );\n }\n }\n\n const valueSetToTrue = value && value[1];\n const valueSet = !!value;\n\n return (\n <div className=\"w-full\">\n <BooleanSwitchWithLabel\n size={\"medium\"}\n value={valueSetToTrue as boolean | null}\n allowIndeterminate={true}\n onValueChange={(v: boolean | null) => updateFilter(v === null ? undefined : v)}\n label={!valueSet\n ? t(\"no_filter\")\n : valueSetToTrue\n ? `${title} ${t(\"is_true\")}`\n : `${title} ${t(\"is_false\")}`}\n />\n </div>\n );\n}\n"],"mappings":";;;;;AAiBA,SAAgB,mBAAmB,EAC/B,MACA,OACA,OACA,UACA,aACkB;CAClB,MAAM,EAAE,MAAM,eAAe;CAE7B,IAAI,aAAa,CAAC,UAAU,SAAS,IAAI,GAAG,OAAO;CAEnD,SAAS,aAAa,KAAe;EACjC,IAAI,QAAQ,KAAA,GACR,SACI,CAAC,MAAM,GAAG,CACd;OAEA,SACI,KAAA,CACJ;CAER;CAEA,MAAM,iBAAiB,SAAS,MAAM;CAGtC,OACI,oBAAC,OAAD;EAAK,WAAU;YACX,oBAAC,wBAAD;GACI,MAAM;GACN,OAAO;GACP,oBAAoB;GACpB,gBAAgB,MAAsB,aAAa,MAAM,OAAO,KAAA,IAAY,CAAC;GAC7E,OAAO,CAAC,CATF,CAAC,QAUD,EAAE,WAAW,IACb,iBACI,GAAG,MAAM,GAAG,EAAE,SAAS,MACvB,GAAG,MAAM,GAAG,EAAE,UAAU;EACrC,CAAA;CACA,CAAA;AAEb"}
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
2
  import { VirtualTableWhereFilterOp } from "@rebasepro/ui";
3
+ import { type DateTimeFieldMode } from "@rebasepro/ui";
3
4
  interface DateTimeFilterFieldProps {
4
5
  name: string;
5
- mode?: "date" | "date_time";
6
+ mode?: DateTimeFieldMode;
6
7
  value?: [op: VirtualTableWhereFilterOp, fieldValue: unknown];
7
8
  setValue: (value?: [op: VirtualTableWhereFilterOp, newValue: unknown]) => void;
8
9
  isArray?: boolean;
@@ -0,0 +1,93 @@
1
+ import { useState } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { DateTimeField, Select, SelectItem } from "@rebasepro/ui";
4
+ import { useCustomizationController } from "@rebasepro/app";
5
+ //#region src/components/SelectableTable/filters/DateTimeFilterField.tsx
6
+ var operationLabels = {
7
+ "==": "==",
8
+ "!=": "!=",
9
+ ">": ">",
10
+ "<": "<",
11
+ ">=": ">=",
12
+ "<=": "<=",
13
+ "not-in": "not in",
14
+ in: "in",
15
+ "array-contains": "Contains",
16
+ "array-contains-any": "Any",
17
+ "is-null": "Is null",
18
+ "is-not-null": "Is not null"
19
+ };
20
+ var multipleSelectOperations = ["array-contains-any", "in"];
21
+ function DateTimeFilterField({ name, isArray, mode, value, setValue, title, timezone, operators }) {
22
+ const { locale } = useCustomizationController();
23
+ let possibleOperations = isArray ? ["array-contains"] : [
24
+ "==",
25
+ "!=",
26
+ ">",
27
+ "<",
28
+ ">=",
29
+ "<=",
30
+ "is-null",
31
+ "is-not-null"
32
+ ];
33
+ if (operators) possibleOperations = possibleOperations.filter((op) => operators.includes(op));
34
+ const [fieldOperation, fieldValue] = value || [possibleOperations[0], void 0];
35
+ const [operation, setOperation] = useState(fieldOperation === "==" && fieldValue === null ? "is-null" : fieldOperation === "!=" && fieldValue === null ? "is-not-null" : fieldOperation);
36
+ const [internalValue, setInternalValue] = useState(fieldValue);
37
+ const isNullOperation = operation === "is-null" || operation === "is-not-null";
38
+ if (possibleOperations.length === 0) return null;
39
+ function updateFilter(op, val) {
40
+ if (op === "is-null" || op === "is-not-null") {
41
+ setOperation(op);
42
+ setInternalValue(null);
43
+ setValue([op, null]);
44
+ return;
45
+ }
46
+ let newValue = val;
47
+ const prevOpIsArray = multipleSelectOperations.includes(operation);
48
+ const newOpIsArray = multipleSelectOperations.includes(op);
49
+ if (prevOpIsArray !== newOpIsArray) newValue = newOpIsArray ? val ? [val] : [] : void 0;
50
+ setOperation(op);
51
+ setInternalValue(Array.isArray(newValue) ? newValue[0] ?? null : newValue);
52
+ const hasNewValue = newValue !== null && Array.isArray(newValue) ? newValue.length > 0 : newValue !== void 0;
53
+ if (op && hasNewValue) setValue([op, newValue]);
54
+ else setValue(void 0);
55
+ }
56
+ return /* @__PURE__ */ jsxs("div", {
57
+ className: "flex w-full",
58
+ children: [/* @__PURE__ */ jsx("div", {
59
+ className: "w-[100px]",
60
+ children: /* @__PURE__ */ jsx(Select, {
61
+ value: operation,
62
+ size: "medium",
63
+ fullWidth: true,
64
+ onValueChange: (value) => {
65
+ updateFilter(value, internalValue);
66
+ },
67
+ renderValue: (op) => operationLabels[op],
68
+ children: possibleOperations.map((op) => /* @__PURE__ */ jsx(SelectItem, {
69
+ value: op,
70
+ children: operationLabels[op]
71
+ }, op))
72
+ })
73
+ }), /* @__PURE__ */ jsx("div", {
74
+ className: "grow ml-2 flex flex-col gap-2",
75
+ children: /* @__PURE__ */ jsx(DateTimeField, {
76
+ mode,
77
+ size: "medium",
78
+ locale,
79
+ timezone,
80
+ disabled: isNullOperation,
81
+ value: isNullOperation ? void 0 : internalValue ?? void 0,
82
+ onChange: (dateValue) => {
83
+ updateFilter(operation, dateValue === null ? void 0 : dateValue);
84
+ },
85
+ clearable: true
86
+ })
87
+ })]
88
+ });
89
+ }
90
+ //#endregion
91
+ export { DateTimeFilterField };
92
+
93
+ //# sourceMappingURL=DateTimeFilterField.js.map