@rebasepro/admin 0.1.2 → 0.2.3

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 (243) hide show
  1. package/LICENSE +21 -6
  2. package/dist/{CollectionEditorDialog-ywdxhs1L.js → CollectionEditorDialog-CmGXXSY9.js} +42 -209
  3. package/dist/CollectionEditorDialog-CmGXXSY9.js.map +1 -0
  4. package/dist/{CollectionsStudioView-BDzMFzqH.js → CollectionsStudioView-DcLHT5bU.js} +6 -8
  5. package/dist/CollectionsStudioView-DcLHT5bU.js.map +1 -0
  6. package/dist/{ContentHomePage-0tHuEIm_.js → ContentHomePage-C7vFqKSe.js} +5 -7
  7. package/dist/ContentHomePage-C7vFqKSe.js.map +1 -0
  8. package/dist/{ExportCollectionAction-BIrq92To.js → ExportCollectionAction-BfN34eWX.js} +36 -38
  9. package/dist/ExportCollectionAction-BfN34eWX.js.map +1 -0
  10. package/dist/{ImportCollectionAction-h8yg_To8.js → ImportCollectionAction-SZrInjhx.js} +5 -7
  11. package/dist/ImportCollectionAction-SZrInjhx.js.map +1 -0
  12. package/dist/{PropertyEditView-BuZrNnBN.js → PropertyEditView-Cvryrb3B.js} +563 -489
  13. package/dist/PropertyEditView-Cvryrb3B.js.map +1 -0
  14. package/dist/{RolesView-CMPsaIXo.js → RolesView-BCb7qwWs.js} +22 -11
  15. package/dist/RolesView-BCb7qwWs.js.map +1 -0
  16. package/dist/{UsersView-BkeblMVT.js → UsersView-Cex24r8H.js} +7 -71
  17. package/dist/UsersView-Cex24r8H.js.map +1 -0
  18. package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.d.ts +2 -2
  19. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.d.ts +1 -7
  20. package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.d.ts +3 -0
  21. package/dist/collection_editor_ui.js +5 -5
  22. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +1 -1
  23. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +1 -1
  24. package/dist/components/EntityCollectionView/EntityCollectionListView.d.ts +18 -2
  25. package/dist/components/EntityCollectionView/FilterPresetsButton.d.ts +21 -0
  26. package/dist/components/EntityDetailView.d.ts +31 -0
  27. package/dist/components/EntityEditView.d.ts +3 -2
  28. package/dist/components/ReferenceTable/EntitySelectionTable.d.ts +1 -1
  29. package/dist/components/admin/CreationResultDialog.d.ts +5 -0
  30. package/dist/components/admin/RolesFilterSelect.d.ts +2 -0
  31. package/dist/components/admin/UserRolesSelectField.d.ts +2 -0
  32. package/dist/components/common/default_entity_actions.d.ts +7 -1
  33. package/dist/components/field_configs.d.ts +1 -1
  34. package/dist/components/index.d.ts +1 -0
  35. package/dist/data_import/utils/data.d.ts +1 -1
  36. package/dist/data_import/utils/file_headers.d.ts +6 -1
  37. package/dist/data_import/utils/file_to_json.d.ts +1 -11
  38. package/dist/data_import/utils/transforms.d.ts +11 -0
  39. package/dist/editor.js +2 -4
  40. package/dist/editor.js.map +1 -1
  41. package/dist/form/EntityForm.d.ts +1 -1
  42. package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
  43. package/dist/form/field_bindings/VectorFieldBinding.d.ts +11 -0
  44. package/dist/form/index.d.ts +1 -0
  45. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -1
  46. package/dist/{index-eRJbMvHi.js → index-DjduZG1T.js} +3 -3
  47. package/dist/index-DjduZG1T.js.map +1 -0
  48. package/dist/{index-BuZaHcyc.js → index-MKPc70-v.js} +3 -3
  49. package/dist/index-MKPc70-v.js.map +1 -0
  50. package/dist/{index-CS6uJ7oW.js → index-PLIQXpTt.js} +4 -6
  51. package/dist/index-PLIQXpTt.js.map +1 -0
  52. package/dist/index.d.ts +4 -1
  53. package/dist/index.js +352 -148
  54. package/dist/index.js.map +1 -1
  55. package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
  56. package/dist/types/components/EntityFormProps.d.ts +2 -1
  57. package/dist/types/fields.d.ts +3 -3
  58. package/dist/util/navigation_utils.d.ts +1 -1
  59. package/dist/{util-zfU1zOCX.js → util-DbWax_sV.js} +5453 -2641
  60. package/dist/util-DbWax_sV.js.map +1 -0
  61. package/package.json +46 -39
  62. package/src/collection_editor/ConfigControllerProvider.tsx +1 -1
  63. package/src/collection_editor/ui/AddKanbanColumnAction.tsx +12 -2
  64. package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +1 -2
  65. package/src/collection_editor/ui/EditorCollectionAction.tsx +1 -2
  66. package/src/collection_editor/ui/EditorCollectionActionStart.tsx +1 -2
  67. package/src/collection_editor/ui/EditorEntityAction.tsx +1 -2
  68. package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +1 -2
  69. package/src/collection_editor/ui/NewCollectionButton.tsx +1 -2
  70. package/src/collection_editor/ui/NewCollectionCard.tsx +4 -6
  71. package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +1 -2
  72. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +10 -2
  73. package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +18 -2
  74. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +23 -17
  75. package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +16 -2
  76. package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +19 -9
  77. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +13 -2
  78. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +24 -2
  79. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +22 -3
  80. package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +1 -2
  81. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +11 -2
  82. package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +12 -2
  83. package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +16 -3
  84. package/src/collection_editor/ui/collection_editor/EnumForm.tsx +17 -2
  85. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +18 -2
  86. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +1 -2
  87. package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +1 -2
  88. package/src/collection_editor/ui/collection_editor/LayoutModeSwitch.tsx +17 -5
  89. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +32 -6
  90. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +7 -7
  91. package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +14 -2
  92. package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +16 -2
  93. package/src/collection_editor/ui/collection_editor/ViewModeSwitch.tsx +9 -2
  94. package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +1 -2
  95. package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +1 -2
  96. package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +9 -2
  97. package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +37 -57
  98. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +11 -2
  99. package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +34 -0
  100. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +15 -7
  101. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +1 -2
  102. package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +15 -3
  103. package/src/collection_editor/ui/collection_editor/properties/conditions/property_paths.ts +1 -1
  104. package/src/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -2
  105. package/src/collection_editor/useLocalCollectionsConfigController.tsx +0 -2
  106. package/src/collection_editor/validateCollectionJson.ts +97 -10
  107. package/src/components/AdminModeSyncer.tsx +1 -1
  108. package/src/components/ArrayContainer.tsx +19 -15
  109. package/src/components/ClearFilterSortButton.tsx +1 -2
  110. package/src/components/CollectionEditorDialogs.tsx +1 -1
  111. package/src/components/DefaultAppBar.tsx +15 -3
  112. package/src/components/DefaultDrawer.tsx +3 -3
  113. package/src/components/DrawerNavigationGroup.tsx +1 -2
  114. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +14 -6
  115. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +1 -1
  116. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +1 -1
  117. package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +1 -2
  118. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -2
  119. package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +1 -2
  120. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +1 -2
  121. package/src/components/EntityCollectionTable/fields/VirtualTableSelect.tsx +0 -1
  122. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +15 -27
  123. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +1 -2
  124. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +1 -2
  125. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -5
  126. package/src/components/EntityCollectionTable/table_bindings.tsx +51 -45
  127. package/src/components/EntityCollectionView/Board.tsx +1 -2
  128. package/src/components/EntityCollectionView/BoardColumn.tsx +9 -2
  129. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +5 -4
  130. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +18 -16
  131. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +16 -17
  132. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +87 -18
  133. package/src/components/EntityCollectionView/EntityCollectionView.tsx +20 -11
  134. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +6 -7
  135. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +14 -5
  136. package/src/components/EntityCollectionView/FilterPresetsButton.tsx +292 -0
  137. package/src/components/EntityCollectionView/FiltersDialog.tsx +1 -2
  138. package/src/components/EntityCollectionView/SplitListView.tsx +76 -25
  139. package/src/components/EntityCollectionView/ViewModeToggle.tsx +20 -7
  140. package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +1 -1
  141. package/src/components/EntityCollectionView/useBoardDataController.tsx +74 -6
  142. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +1 -1
  143. package/src/components/EntityDetailView.tsx +619 -0
  144. package/src/components/EntityEditView.tsx +29 -10
  145. package/src/components/EntityEditViewFormActions.tsx +20 -7
  146. package/src/components/EntityPreview.tsx +14 -5
  147. package/src/components/EntitySidePanel.tsx +116 -62
  148. package/src/components/EntityView.tsx +1 -2
  149. package/src/components/HomePage/ContentHomePage.tsx +1 -1
  150. package/src/components/HomePage/FavouritesView.tsx +1 -2
  151. package/src/components/HomePage/NavigationCard.tsx +1 -2
  152. package/src/components/HomePage/NavigationCardBinding.tsx +1 -2
  153. package/src/components/HomePage/NavigationGroup.tsx +1 -2
  154. package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
  155. package/src/components/PropertyIdCopyTooltip.tsx +1 -2
  156. package/src/components/RebaseAuthGate.tsx +2 -2
  157. package/src/components/RebaseNavigation.tsx +9 -7
  158. package/src/components/ReferenceTable/EntitySelectionTable.tsx +12 -8
  159. package/src/components/RelationSelector.tsx +34 -6
  160. package/src/components/SearchIconsView.tsx +10 -2
  161. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  162. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +1 -2
  163. package/src/components/SideDialogs.tsx +63 -38
  164. package/src/components/UserSelector.tsx +30 -6
  165. package/src/components/admin/CreationResultDialog.tsx +135 -0
  166. package/src/components/admin/RolesFilterSelect.tsx +45 -0
  167. package/src/components/admin/RolesView.tsx +53 -14
  168. package/src/components/admin/UserRolesSelectField.tsx +50 -0
  169. package/src/components/admin/UsersView.tsx +41 -124
  170. package/src/components/app/Scaffold.tsx +1 -2
  171. package/src/components/common/default_entity_actions.tsx +119 -12
  172. package/src/components/field_configs.tsx +39 -3
  173. package/src/components/history/EntityHistoryEntry.tsx +1 -2
  174. package/src/components/history/EntityHistoryView.tsx +1 -2
  175. package/src/components/index.ts +2 -0
  176. package/src/data_export/export/BasicExportAction.tsx +35 -38
  177. package/src/data_export/export/ExportCollectionAction.tsx +39 -40
  178. package/src/data_import/components/DataNewPropertiesMapping.tsx +15 -2
  179. package/src/data_import/components/ImportFileUpload.tsx +1 -2
  180. package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +1 -2
  181. package/src/data_import/import/ImportCollectionAction.tsx +21 -8
  182. package/src/data_import/utils/data.ts +23 -5
  183. package/src/data_import/utils/file_headers.ts +13 -89
  184. package/src/data_import/utils/file_to_json.ts +43 -68
  185. package/src/data_import/utils/transforms.ts +47 -0
  186. package/src/editor/components/SlashCommandMenu.tsx +17 -2
  187. package/src/editor/components/editor-bubble-item.tsx +1 -1
  188. package/src/editor/extensions/Image/index.ts +1 -1
  189. package/src/editor/extensions/Image.ts +1 -1
  190. package/src/editor/selectors/color-selector.tsx +1 -2
  191. package/src/editor/selectors/link-selector.tsx +1 -2
  192. package/src/editor/selectors/node-selector.tsx +16 -2
  193. package/src/editor/selectors/text-buttons.tsx +1 -2
  194. package/src/editor/utils/prosemirror-utils.ts +1 -1
  195. package/src/form/EntityForm.tsx +16 -6
  196. package/src/form/EntityFormActions.tsx +11 -3
  197. package/src/form/PropertyFieldBinding.tsx +5 -12
  198. package/src/form/components/FieldHelperText.tsx +1 -2
  199. package/src/form/components/LocalChangesMenu.tsx +17 -2
  200. package/src/form/components/StorageItemPreview.tsx +1 -2
  201. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +1 -2
  202. package/src/form/field_bindings/KeyValueFieldBinding.tsx +17 -2
  203. package/src/form/field_bindings/MapFieldBinding.tsx +1 -1
  204. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +10 -3
  205. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -2
  206. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +1 -2
  207. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +7 -7
  208. package/src/form/field_bindings/RelationFieldBinding.tsx +150 -147
  209. package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -1
  210. package/src/form/field_bindings/SelectFieldBinding.tsx +1 -2
  211. package/src/form/field_bindings/TextFieldBinding.tsx +10 -2
  212. package/src/form/field_bindings/VectorFieldBinding.tsx +202 -0
  213. package/src/form/index.tsx +1 -0
  214. package/src/form/validation.ts +54 -2
  215. package/src/hooks/navigation/useBuildNavigationStateController.tsx +2 -1
  216. package/src/hooks/navigation/useResolvedViews.tsx +30 -15
  217. package/src/hooks/navigation/useTopLevelNavigation.ts +1 -1
  218. package/src/index.ts +6 -0
  219. package/src/preview/PropertyPreview.tsx +1 -1
  220. package/src/preview/components/ImagePreview.tsx +1 -1
  221. package/src/preview/components/UrlComponentPreview.tsx +1 -2
  222. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -2
  223. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +23 -24
  224. package/src/routes/RebaseRoute.tsx +64 -35
  225. package/src/types/components/EntityFormActionsProps.tsx +1 -1
  226. package/src/types/components/EntityFormProps.tsx +3 -1
  227. package/src/types/fields.tsx +4 -3
  228. package/src/util/navigation_utils.ts +4 -3
  229. package/src/util/previews.ts +1 -1
  230. package/src/util/property_utils.tsx +22 -6
  231. package/src/util/resolutions.ts +2 -2
  232. package/dist/CollectionEditorDialog-ywdxhs1L.js.map +0 -1
  233. package/dist/CollectionsStudioView-BDzMFzqH.js.map +0 -1
  234. package/dist/ContentHomePage-0tHuEIm_.js.map +0 -1
  235. package/dist/ExportCollectionAction-BIrq92To.js.map +0 -1
  236. package/dist/ImportCollectionAction-h8yg_To8.js.map +0 -1
  237. package/dist/PropertyEditView-BuZrNnBN.js.map +0 -1
  238. package/dist/RolesView-CMPsaIXo.js.map +0 -1
  239. package/dist/UsersView-BkeblMVT.js.map +0 -1
  240. package/dist/index-BuZaHcyc.js.map +0 -1
  241. package/dist/index-CS6uJ7oW.js.map +0 -1
  242. package/dist/index-eRJbMvHi.js.map +0 -1
  243. package/dist/util-zfU1zOCX.js.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,21 @@
1
- Source code in this repository is variously licensed under the Business Source
2
- License 1.1 (BSL), Apache version 2.0 and the MIT license. A copy of each
3
- license can be found in each one of the packages under the folder packages
4
- under a file called License. Source code in a given file is licensed under the
5
- BSL and the copyright belongs to Rebase Authors unless otherwise noted at the
6
- beginning of the file.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rebase
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,11 +1,10 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import { useAuthController, useCustomizationController, IconForView, useSnackbarController, useLargeLayout, AIIcon, useRebaseContext, ErrorView, ConfirmationDialog, useUnsavedChangesDialog, UnsavedChangesDialog } from "@rebasepro/core";
4
- import { bk as useCollectionsConfigController, a3 as FieldCaption, ar as SearchIconsView, d as getFieldConfig, P as PropertyConfigBadge, aX as getFullId, b0 as idToPropertiesPath, b4 as namespaceToPropertiesOrderPath, br as validateCollectionJson, e as useCollectionRegistryController, K as CollectionGenerationApiError, s as useCollectionEditorController, I as ImportFileUpload, a as getInferenceType, a8 as ImportNewPropertyFieldPreview, D as DataNewPropertiesMapping, aW as getFieldId, f as useSelectionController, h as convertDataToEntity, E as EntityCollectionTable, m as useNavigationStateController, u as useImportConfig, j as useUrlController, b as ImportSaveInProgress, aY as getFullIdPath } from "./util-zfU1zOCX.js";
4
+ import { bi as useCollectionsConfigController, J as FieldCaption, ad as SearchIconsView, aL as getFieldConfig, $ as PropertyConfigBadge, aN as getFullId, aV as idToPropertiesPath, aZ as namespaceToPropertiesOrderPath, bu as validateCollectionJson, bh as useCollectionRegistryController, C as CollectionGenerationApiError, bg as useCollectionEditorController, O as ImportFileUpload, aR as getInferenceType, P as ImportNewPropertyFieldPreview, p as DataNewPropertiesMapping, aM as getFieldId, bp as useSelectionController, ay as convertDataToEntity, w as EntityCollectionTable, bm as useNavigationStateController, bk as useImportConfig, bt as useUrlController, Q as ImportSaveInProgress, aO as getFullIdPath } from "./util-DbWax_sV.js";
5
5
  import * as React from "react";
6
6
  import React__default, { useState, useRef, useMemo, useEffect } from "react";
7
- import { Chip, Typography, cls, Tooltip, IconButton, TextField, DebouncedTextField, Dialog, Container, ToggleButtonGroup, Select, SelectItem, iconSize, Button, BooleanSwitchWithLabel, DialogTitle, DialogContent, DialogActions, CircularProgress, ErrorBoundary, defaultBorderMixin, Table, TableHeader, TableCell, TableBody, TableRow, Menu, Card, CircularProgressCenter, Paper, MultiSelect, MultiSelectItem, coolIconKeys, Tabs, Tab, LoadingButton } from "@rebasepro/ui";
8
- import { ColumnsIcon, SquareIcon, PanelLeftIcon, ListIcon, TableIcon, LayoutGridIcon, KanbanIcon, XIcon, CopyIcon, FileSearchIcon, PlusIcon, Trash2Icon, CodeIcon, ShoppingCartIcon, UserIcon, FileTextIcon, FileIcon, KeyIcon, ArrowLeftIcon, CheckIcon } from "lucide-react";
7
+ import { Chip, Typography, cls, Tooltip, IconButton, TextField, DebouncedTextField, Dialog, Container, ColumnsIcon, SquareIcon, PanelLeftIcon, AppWindow, ToggleButtonGroup, ListIcon, TableIcon, LayoutGridIcon, KanbanIcon, Select, SelectItem, XIcon, iconSize, Button, BooleanSwitchWithLabel, DialogTitle, DialogContent, CopyIcon, DialogActions, CircularProgress, FileSearchIcon, PlusIcon, ErrorBoundary, defaultBorderMixin, CodeIcon, Alert, Menu, ShoppingCartIcon, UserIcon, FileTextIcon, FileIcon, Card, CircularProgressCenter, Paper, KeyIcon, Trash2Icon, MultiSelect, MultiSelectItem, coolIconKeys, Tabs, Tab, LoadingButton, ArrowLeftIcon, CheckIcon } from "@rebasepro/ui";
9
8
  import { isPropertyBuilder, getSubcollections, getTableName, removeInitialAndTrailingSlashes } from "@rebasepro/common";
10
9
  import "fast-equals";
11
10
  import { useFormex, getIn, Field, clone, useCreateFormex, Formex } from "@rebasepro/formex";
@@ -17,13 +16,12 @@ import "@dnd-kit/sortable";
17
16
  import "@dnd-kit/utilities";
18
17
  import { getDataSourceCapabilities } from "@rebasepro/types";
19
18
  import "@dnd-kit/modifiers";
20
- import "react-router";
21
19
  import "react-router-dom";
22
- import "xlsx";
20
+ import "exceljs";
23
21
  import { buildPropertyFromData, buildEntityPropertiesFromData } from "@rebasepro/schema-inference";
24
22
  import "date-fns";
25
23
  import "date-fns/locale";
26
- import { a as PropertyFormDialog, u as useAIModifiedPaths, b as PropertyTree, P as PropertyForm, s as supportedFields, c as updatePropertyFromWidget, A as AIModifiedPathsProvider } from "./PropertyEditView-BuZrNnBN.js";
24
+ import { b as PropertyFormDialog, d as useAIModifiedPaths, c as PropertyTree, a as PropertyForm, s as supportedFields, u as updatePropertyFromWidget, A as AIModifiedPathsProvider } from "./PropertyEditView-Cvryrb3B.js";
27
25
  import JSON5 from "json5";
28
26
  import { Highlight, themes } from "prism-react-renderer";
29
27
  const CollectionEditorSchema = z.object({
@@ -509,7 +507,7 @@ function DefaultDatabaseField(t0) {
509
507
  return t4;
510
508
  }
511
509
  function LayoutModeSwitch(t0) {
512
- const $ = c(13);
510
+ const $ = c(14);
513
511
  const {
514
512
  value,
515
513
  onChange,
@@ -554,45 +552,56 @@ function LayoutModeSwitch(t0) {
554
552
  }
555
553
  let t5;
556
554
  if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
557
- t5 = [t3, t4, {
555
+ t5 = {
558
556
  value: "split",
559
557
  label: "Split view",
560
558
  icon: /* @__PURE__ */ jsx(PanelLeftIcon, {})
561
- }];
559
+ };
562
560
  $[5] = t5;
563
561
  } else {
564
562
  t5 = $[5];
565
563
  }
566
564
  let t6;
567
- if ($[6] !== onChange || $[7] !== value) {
568
- t6 = /* @__PURE__ */ jsx("div", { className: "my-2", children: /* @__PURE__ */ jsx(ToggleButtonGroup, { value, onValueChange: onChange, options: t5 }) });
569
- $[6] = onChange;
570
- $[7] = value;
571
- $[8] = t6;
565
+ if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
566
+ t6 = [t3, t4, t5, {
567
+ value: "dialog",
568
+ label: "Centered dialog",
569
+ icon: /* @__PURE__ */ jsx(AppWindow, {})
570
+ }];
571
+ $[6] = t6;
572
572
  } else {
573
- t6 = $[8];
573
+ t6 = $[6];
574
574
  }
575
575
  let t7;
576
- if ($[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
577
- t7 = /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "ml-3.5", children: "Should documents be opened full screen or in an inline side dialog" });
576
+ if ($[7] !== onChange || $[8] !== value) {
577
+ t7 = /* @__PURE__ */ jsx("div", { className: "my-2", children: /* @__PURE__ */ jsx(ToggleButtonGroup, { value, onValueChange: onChange, options: t6 }) });
578
+ $[7] = onChange;
579
+ $[8] = value;
578
580
  $[9] = t7;
579
581
  } else {
580
582
  t7 = $[9];
581
583
  }
582
584
  let t8;
583
- if ($[10] !== t1 || $[11] !== t6) {
584
- t8 = /* @__PURE__ */ jsxs("div", { className: t1, children: [
585
+ if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
586
+ t8 = /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "ml-3.5", children: "Should documents be opened full screen, inline side dialog, or centered dialog" });
587
+ $[10] = t8;
588
+ } else {
589
+ t8 = $[10];
590
+ }
591
+ let t9;
592
+ if ($[11] !== t1 || $[12] !== t7) {
593
+ t9 = /* @__PURE__ */ jsxs("div", { className: t1, children: [
585
594
  t2,
586
- t6,
587
- t7
595
+ t7,
596
+ t8
588
597
  ] });
589
- $[10] = t1;
590
- $[11] = t6;
591
- $[12] = t8;
598
+ $[11] = t1;
599
+ $[12] = t7;
600
+ $[13] = t9;
592
601
  } else {
593
- t8 = $[12];
602
+ t9 = $[13];
594
603
  }
595
- return t8;
604
+ return t9;
596
605
  }
597
606
  function ViewModeSwitch(t0) {
598
607
  const $ = c(14);
@@ -1382,180 +1391,6 @@ function CollectionPropertiesEditorForm({
1382
1391
  /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(GetCodeDialog, { collection: values, open: codeDialogOpen, onOpenChange: setCodeDialogOpen }) })
1383
1392
  ] });
1384
1393
  }
1385
- function CollectionRelationsTab() {
1386
- const {
1387
- values,
1388
- setFieldValue
1389
- } = useFormex();
1390
- const {
1391
- collections
1392
- } = useCollectionsConfigController();
1393
- const [editingRelationIndex, setEditingRelationIndex] = useState(null);
1394
- const [editingRelationState, setEditingRelationState] = useState(null);
1395
- const getTargetSlug = (target) => {
1396
- if (typeof target === "string") {
1397
- const match = target.match(/\(\)\s*=>\s*([a-zA-Z0-9_]+)/);
1398
- return match ? match[1] : target;
1399
- }
1400
- if (typeof target === "function") {
1401
- try {
1402
- if (target.slug) return target.slug;
1403
- const col = target();
1404
- return col?.slug || col?.name || "";
1405
- } catch (e) {
1406
- return "";
1407
- }
1408
- }
1409
- return "";
1410
- };
1411
- const relations = values.relations || [];
1412
- const handleDelete = (index) => {
1413
- const newRelations = [...relations];
1414
- newRelations.splice(index, 1);
1415
- setFieldValue("relations", newRelations);
1416
- };
1417
- const handleSave = () => {
1418
- if (!editingRelationState) return;
1419
- const newRelations_0 = [...relations];
1420
- if (editingRelationIndex === -1) {
1421
- newRelations_0.push(editingRelationState);
1422
- } else if (editingRelationIndex !== null) {
1423
- newRelations_0[editingRelationIndex] = editingRelationState;
1424
- }
1425
- setFieldValue("relations", newRelations_0);
1426
- setEditingRelationIndex(null);
1427
- setEditingRelationState(null);
1428
- };
1429
- const handleCancel = () => {
1430
- setEditingRelationIndex(null);
1431
- setEditingRelationState(null);
1432
- };
1433
- return /* @__PURE__ */ jsx("div", { className: "overflow-auto my-auto h-full w-full", children: /* @__PURE__ */ jsxs(Container, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto h-full", children: [
1434
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-8", children: [
1435
- /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Relations" }),
1436
- /* @__PURE__ */ jsx(Button, { variant: "filled", color: "neutral", onClick: () => {
1437
- setEditingRelationIndex(-1);
1438
- setEditingRelationState({
1439
- relationName: "",
1440
- target: "",
1441
- cardinality: "many",
1442
- direction: "owning"
1443
- });
1444
- }, children: "ADD RELATION" })
1445
- ] }),
1446
- relations.length > 0 ? /* @__PURE__ */ jsx("div", { className: "w-full overflow-auto border dark:border-surface-800 rounded-lg", children: /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
1447
- /* @__PURE__ */ jsxs(TableHeader, { children: [
1448
- /* @__PURE__ */ jsx(TableCell, { header: true, className: "w-16" }),
1449
- /* @__PURE__ */ jsx(TableCell, { header: true, children: "Name" }),
1450
- /* @__PURE__ */ jsx(TableCell, { header: true, children: "Target" }),
1451
- /* @__PURE__ */ jsx(TableCell, { header: true, children: "Cardinality" }),
1452
- /* @__PURE__ */ jsx(TableCell, { header: true, children: "Direction" })
1453
- ] }),
1454
- /* @__PURE__ */ jsx(TableBody, { children: relations.map((relation, index_0) => /* @__PURE__ */ jsxs(TableRow, { className: "cursor-pointer hover:bg-surface-100 dark:hover:bg-surface-800", onClick: () => {
1455
- setEditingRelationIndex(index_0);
1456
- setEditingRelationState(relation);
1457
- }, children: [
1458
- /* @__PURE__ */ jsx(TableCell, { style: {
1459
- width: "64px"
1460
- }, children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e_0) => {
1461
- e_0.stopPropagation();
1462
- handleDelete(index_0);
1463
- }, children: /* @__PURE__ */ jsx(Trash2Icon, {}) }) }),
1464
- /* @__PURE__ */ jsx(TableCell, { className: "font-medium", children: relation.relationName }),
1465
- /* @__PURE__ */ jsx(TableCell, { children: getTargetSlug(relation.target) || "Function" }),
1466
- /* @__PURE__ */ jsx(TableCell, { children: relation.cardinality }),
1467
- /* @__PURE__ */ jsx(TableCell, { children: relation.direction || "owning" })
1468
- ] }, index_0)) })
1469
- ] }) }) : /* @__PURE__ */ jsxs("div", { className: "flex-grow flex flex-col border border-dashed dark:border-surface-700 rounded-lg items-center justify-center text-text-disabled py-20", children: [
1470
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "mb-4", children: "No relations defined for this collection." }),
1471
- /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
1472
- setEditingRelationIndex(-1);
1473
- setEditingRelationState({
1474
- relationName: "",
1475
- target: "",
1476
- cardinality: "many",
1477
- direction: "owning"
1478
- });
1479
- }, children: "Create your first relation" })
1480
- ] }),
1481
- /* @__PURE__ */ jsx(Dialog, { open: !!editingRelationState, onOpenChange: (open) => !open && handleCancel(), maxWidth: "2xl", children: editingRelationState && /* @__PURE__ */ jsxs(Fragment, { children: [
1482
- /* @__PURE__ */ jsx(DialogTitle, { className: "flex justify-between items-center w-full", variant: "h6", children: editingRelationIndex === -1 ? "New Relation" : "Edit Relation" }),
1483
- /* @__PURE__ */ jsx(DialogContent, { includeMargin: false, className: cls("p-4 md:p-6 border-t bg-white dark:bg-surface-900", defaultBorderMixin), children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 max-w-2xl mx-auto", children: [
1484
- /* @__PURE__ */ jsx(TextField, { label: "Relation Name", name: "relationName", placeholder: "e.g. posts", value: editingRelationState.relationName || "", onChange: (e_1) => setEditingRelationState((prev) => prev ? {
1485
- ...prev,
1486
- relationName: e_1.target.value
1487
- } : null) }),
1488
- /* @__PURE__ */ jsx(Select, { fullWidth: true, label: "Target Collection", value: getTargetSlug(editingRelationState.target), onValueChange: (val) => {
1489
- setEditingRelationState((prev_0) => {
1490
- if (!prev_0) return null;
1491
- const targetFn = () => collections?.find((c2) => c2.slug === val) || {
1492
- slug: val
1493
- };
1494
- targetFn.slug = val;
1495
- return {
1496
- ...prev_0,
1497
- target: targetFn
1498
- };
1499
- });
1500
- }, children: collections?.map((col_0) => /* @__PURE__ */ jsx(SelectItem, { value: col_0.slug, children: col_0.name || col_0.slug }, col_0.slug)) }),
1501
- /* @__PURE__ */ jsxs(Select, { fullWidth: true, label: "Cardinality", value: editingRelationState.cardinality || "many", onValueChange: (val_0) => setEditingRelationState((prev_1) => prev_1 ? {
1502
- ...prev_1,
1503
- cardinality: val_0
1504
- } : null), children: [
1505
- /* @__PURE__ */ jsx(SelectItem, { value: "many", children: "Many" }),
1506
- /* @__PURE__ */ jsx(SelectItem, { value: "one", children: "One" })
1507
- ] }),
1508
- /* @__PURE__ */ jsxs(Select, { fullWidth: true, label: "Direction", value: editingRelationState.direction || "owning", onValueChange: (val_1) => setEditingRelationState((prev_2) => prev_2 ? {
1509
- ...prev_2,
1510
- direction: val_1
1511
- } : null), children: [
1512
- /* @__PURE__ */ jsx(SelectItem, { value: "owning", children: "Owning" }),
1513
- /* @__PURE__ */ jsx(SelectItem, { value: "inverse", children: "Inverse" })
1514
- ] }),
1515
- editingRelationState.cardinality === "many" && editingRelationState.direction === "owning" && /* @__PURE__ */ jsxs("div", { className: cls("flex flex-col gap-4 mt-4 pt-4 border-t", defaultBorderMixin), children: [
1516
- /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "text-text-primary", children: "Intermediate Table" }),
1517
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary -mt-3", children: "Required for many-to-many relationships. This defines the junction table linking both collections." }),
1518
- /* @__PURE__ */ jsx(TextField, { label: "Table Name", name: "throughTable", placeholder: "e.g. user_roles", value: editingRelationState.through?.table || "", onChange: (e_2) => setEditingRelationState((prev_3) => prev_3 ? {
1519
- ...prev_3,
1520
- through: {
1521
- ...prev_3.through || {
1522
- sourceColumn: "",
1523
- targetColumn: ""
1524
- },
1525
- table: e_2.target.value
1526
- }
1527
- } : null) }),
1528
- /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
1529
- /* @__PURE__ */ jsx(TextField, { className: "flex-1", label: "Source Column", name: "sourceColumn", placeholder: "FK to this collection", value: editingRelationState.through?.sourceColumn || "", onChange: (e_3) => setEditingRelationState((prev_4) => prev_4 ? {
1530
- ...prev_4,
1531
- through: {
1532
- ...prev_4.through || {
1533
- table: "",
1534
- targetColumn: ""
1535
- },
1536
- sourceColumn: e_3.target.value
1537
- }
1538
- } : null) }),
1539
- /* @__PURE__ */ jsx(TextField, { className: "flex-1", label: "Target Column", name: "targetColumn", placeholder: "FK to target collection", value: editingRelationState.through?.targetColumn || "", onChange: (e_4) => setEditingRelationState((prev_5) => prev_5 ? {
1540
- ...prev_5,
1541
- through: {
1542
- ...prev_5.through || {
1543
- table: "",
1544
- sourceColumn: ""
1545
- },
1546
- targetColumn: e_4.target.value
1547
- }
1548
- } : null) })
1549
- ] })
1550
- ] })
1551
- ] }) }),
1552
- /* @__PURE__ */ jsxs(DialogActions, { children: [
1553
- /* @__PURE__ */ jsx(Button, { variant: "text", onClick: handleCancel, children: "Cancel" }),
1554
- /* @__PURE__ */ jsx(Button, { variant: "filled", color: "primary", onClick: handleSave, disabled: !editingRelationState.relationName || !editingRelationState.target, children: "Save" })
1555
- ] })
1556
- ] }) })
1557
- ] }) });
1558
- }
1559
1394
  const EXAMPLE_JSON = `{
1560
1395
  "id": "products",
1561
1396
  "name": "Products",
@@ -1733,8 +1568,8 @@ function CollectionJsonImportDialog(t0) {
1733
1568
  }
1734
1569
  let t15;
1735
1570
  if ($[24] !== errors || $[25] !== touched) {
1736
- t15 = errors.length > 0 && touched && /* @__PURE__ */ jsxs("div", { className: "p-3 bg-red-50 dark:bg-red-900/20 rounded-md border border-red-200 dark:border-red-800", children: [
1737
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-medium text-red-700 dark:text-red-400 mb-2", children: "Validation errors:" }),
1571
+ t15 = errors.length > 0 && touched && /* @__PURE__ */ jsxs(Alert, { color: "error", children: [
1572
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-medium mb-2", children: "Validation errors:" }),
1738
1573
  /* @__PURE__ */ jsx("ul", { className: "list-disc list-inside space-y-1", children: errors.map(_temp$3) })
1739
1574
  ] });
1740
1575
  $[24] = errors;
@@ -1745,7 +1580,7 @@ function CollectionJsonImportDialog(t0) {
1745
1580
  }
1746
1581
  let t16;
1747
1582
  if ($[27] !== isValid) {
1748
- t16 = isValid && /* @__PURE__ */ jsx("div", { className: "p-3 bg-green-50 dark:bg-green-900/20 rounded-md border border-green-200 dark:border-green-800", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-green-700 dark:text-green-400", children: "✓ JSON is valid and ready to import" }) });
1583
+ t16 = isValid && /* @__PURE__ */ jsx(Alert, { color: "success", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "✓ JSON is valid and ready to import" }) });
1749
1584
  $[27] = isValid;
1750
1585
  $[28] = t16;
1751
1586
  } else {
@@ -1814,7 +1649,7 @@ function CollectionJsonImportDialog(t0) {
1814
1649
  return t22;
1815
1650
  }
1816
1651
  function _temp$3(error, index) {
1817
- return /* @__PURE__ */ jsx("li", { className: "text-sm text-red-600 dark:text-red-400", children: error.path ? /* @__PURE__ */ jsxs(Fragment, { children: [
1652
+ return /* @__PURE__ */ jsx("li", { className: "text-sm", children: error.path ? /* @__PURE__ */ jsxs(Fragment, { children: [
1818
1653
  /* @__PURE__ */ jsx("code", { className: "bg-red-100 dark:bg-red-900/40 px-1 rounded", children: error.path }),
1819
1654
  ": ",
1820
1655
  error.message
@@ -4451,7 +4286,7 @@ function CollectionEditorInternal({
4451
4286
  };
4452
4287
  const validation = (col) => {
4453
4288
  let errors = {};
4454
- const schema = (currentView === "properties" || currentView === "relations" || currentView === "general") && CollectionEditorSchema;
4289
+ const schema = (currentView === "properties" || currentView === "general") && CollectionEditorSchema;
4455
4290
  if (schema) {
4456
4291
  const result = schema.safeParse(col);
4457
4292
  if (!result.success) {
@@ -4573,8 +4408,7 @@ function CollectionEditorInternal({
4573
4408
  /* @__PURE__ */ jsx(Tab, { value: "general", children: "General" }),
4574
4409
  /* @__PURE__ */ jsx(Tab, { value: "display", children: "Display" }),
4575
4410
  /* @__PURE__ */ jsx(Tab, { value: "properties", children: "Properties" }),
4576
- getDataSourceCapabilities(values_1.driver).supportsRLS && /* @__PURE__ */ jsx(Tab, { value: "rls", children: "RLS" }),
4577
- getDataSourceCapabilities(values_1.driver).supportsRelations && /* @__PURE__ */ jsx(Tab, { value: "relations", children: "Relations" })
4411
+ getDataSourceCapabilities(values_1.driver).supportsRLS && /* @__PURE__ */ jsx(Tab, { value: "rls", children: "RLS" })
4578
4412
  ] }) }),
4579
4413
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
4580
4414
  generateCollection && /* @__PURE__ */ jsx(AICollectionGeneratorPopover, { existingCollection: values_1, onGenerated: handleAIGenerated, generateCollection, onAnalyticsEvent }),
@@ -4615,7 +4449,6 @@ function CollectionEditorInternal({
4615
4449
  } }),
4616
4450
  currentView === "general" && /* @__PURE__ */ jsx(GeneralSettingsForm, { existingPaths, existingIds, parentCollection, isNewCollection }),
4617
4451
  currentView === "display" && /* @__PURE__ */ jsx(DisplaySettingsForm, { expandKanban }),
4618
- currentView === "relations" && getDataSourceCapabilities(values_1.driver).supportsRelations && /* @__PURE__ */ jsx(CollectionRelationsTab, {}),
4619
4452
  currentView === "rls" && getDataSourceCapabilities(values_1.driver).supportsRLS && /* @__PURE__ */ jsx(CollectionRLSTab, {}),
4620
4453
  currentView === "properties" && /* @__PURE__ */ jsx(CollectionPropertiesEditorForm, { showErrors: submitCount > 0, isNewCollection, onPropertyError: (propertyKey, namespace, error_0) => {
4621
4454
  const current = removeUndefined({
@@ -4728,4 +4561,4 @@ export {
4728
4561
  CollectionEditor,
4729
4562
  CollectionEditorDialog
4730
4563
  };
4731
- //# sourceMappingURL=CollectionEditorDialog-ywdxhs1L.js.map
4564
+ //# sourceMappingURL=CollectionEditorDialog-CmGXXSY9.js.map