@rebasepro/admin 0.12.1-canary.gf5f1d39 → 0.13.0

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 (178) hide show
  1. package/README.md +1 -1
  2. package/dist/{CollectionEditorDialog-Dpc75wIZ.js → CollectionEditorDialog-CjXkWZ64.js} +75 -62
  3. package/dist/{CollectionEditorDialog-Dpc75wIZ.js.map → CollectionEditorDialog-CjXkWZ64.js.map} +1 -1
  4. package/dist/{PropertyEditView-DH3XZC2x.js → PropertyEditView-W8I3YV89.js} +36 -16
  5. package/dist/{PropertyEditView-DH3XZC2x.js.map → PropertyEditView-W8I3YV89.js.map} +1 -1
  6. package/dist/{RouterCollectionsStudioView-BZLq4MGp.js → RouterCollectionsStudioView-BsLTNoqX.js} +5 -5
  7. package/dist/{RouterCollectionsStudioView-BZLq4MGp.js.map → RouterCollectionsStudioView-BsLTNoqX.js.map} +1 -1
  8. package/dist/collection_editor/serializable_types.d.ts +4 -1
  9. package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +1 -0
  10. package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +8 -0
  11. package/dist/collection_editor_ui.js +5 -5
  12. package/dist/collection_editor_ui.js.map +1 -1
  13. package/dist/components/CollectionTableBinding/column_utils.d.ts +17 -0
  14. package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +7 -2
  15. package/dist/components/CollectionViewBinding/SortButton.d.ts +24 -0
  16. package/dist/components/CollectionViewBinding/SplitListCloseButton.d.ts +10 -0
  17. package/dist/components/CollectionViewBinding/SplitViewContext.d.ts +23 -0
  18. package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +26 -0
  19. package/dist/components/DetailViewBinding.d.ts +5 -0
  20. package/dist/components/EditFormActions.d.ts +12 -1
  21. package/dist/components/EditViewBinding.d.ts +6 -1
  22. package/dist/components/EntityIdentityBar.d.ts +53 -0
  23. package/dist/components/EntityInspector.d.ts +35 -0
  24. package/dist/components/EntityPreviewNesting.d.ts +25 -0
  25. package/dist/components/EntityViewBinding.d.ts +9 -0
  26. package/dist/components/InlineEntityPreview.d.ts +47 -0
  27. package/dist/components/history/EntityHistoryView.d.ts +4 -1
  28. package/dist/components/index.d.ts +2 -0
  29. package/dist/editor.js +18 -10
  30. package/dist/editor.js.map +1 -1
  31. package/dist/{export-BzIpUdSK.js → export-J79rMoNj.js} +2 -2
  32. package/dist/{export-BzIpUdSK.js.map → export-J79rMoNj.js.map} +1 -1
  33. package/dist/form/EntityForm.d.ts +1 -1
  34. package/dist/form/EntityFormActions.d.ts +11 -1
  35. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  36. package/dist/form/components/FieldBlock.d.ts +30 -0
  37. package/dist/form/components/FormRail.d.ts +18 -0
  38. package/dist/form/components/FormSections.d.ts +16 -0
  39. package/dist/form/components/index.d.ts +3 -2
  40. package/dist/form/components/useRailVisible.d.ts +24 -0
  41. package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
  42. package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
  43. package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
  44. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
  45. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
  46. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  47. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  48. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
  49. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
  50. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  51. package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
  52. package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
  53. package/dist/{history-g9688IaK.js → history-D7L_JlLO.js} +35 -33
  54. package/dist/history-D7L_JlLO.js.map +1 -0
  55. package/dist/hooks/navigation/utils.d.ts +16 -0
  56. package/dist/hooks/useBuildSidePanel.d.ts +14 -0
  57. package/dist/hooks/useEntityDisplayTitle.d.ts +18 -0
  58. package/dist/hooks/useHistory.d.ts +7 -0
  59. package/dist/hooks/useRecordActions.d.ts +17 -0
  60. package/dist/{import-BjUG-cIY.js → import-BvYl--U4.js} +2 -2
  61. package/dist/{import-BjUG-cIY.js.map → import-BvYl--U4.js.map} +1 -1
  62. package/dist/index.js +106 -35
  63. package/dist/index.js.map +1 -1
  64. package/dist/markdown-CklalUUk.js.map +1 -1
  65. package/dist/preview/components/InlineEntityListPreview.d.ts +15 -0
  66. package/dist/preview/index.d.ts +1 -0
  67. package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
  68. package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
  69. package/dist/types/components/EntityFormActionsProps.d.ts +0 -1
  70. package/dist/types/components/EntityFormProps.d.ts +0 -5
  71. package/dist/types/fields.d.ts +24 -0
  72. package/dist/{util-B5fJm1FA.js → util-GiwPgxnL.js} +2106 -1117
  73. package/dist/util-GiwPgxnL.js.map +1 -0
  74. package/package.json +32 -34
  75. package/src/collection_editor/ConfigControllerProvider.tsx +1 -1
  76. package/src/collection_editor/serializable_types.ts +4 -3
  77. package/src/collection_editor/serializable_utils.ts +51 -17
  78. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +65 -22
  79. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +38 -30
  80. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +3 -1
  81. package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +1 -1
  82. package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +1 -1
  83. package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +16 -0
  84. package/src/collection_editor/useLocalCollectionsConfigController.tsx +127 -15
  85. package/src/collection_editor/validateCollectionJson.ts +3 -3
  86. package/src/components/AdminModeSyncer.tsx +1 -1
  87. package/src/components/CollectionTableBinding/PropertyTableCell.tsx +10 -2
  88. package/src/components/CollectionTableBinding/column_utils.tsx +59 -2
  89. package/src/components/CollectionTableBinding/table_bindings.tsx +2 -1
  90. package/src/components/CollectionViewBinding/CollectionBoardViewBinding.tsx +23 -16
  91. package/src/components/CollectionViewBinding/CollectionViewActions.tsx +7 -1
  92. package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +9 -2
  93. package/src/components/CollectionViewBinding/CollectionViewStartActions.tsx +47 -12
  94. package/src/components/CollectionViewBinding/SortButton.tsx +189 -0
  95. package/src/components/CollectionViewBinding/SplitListCloseButton.tsx +33 -0
  96. package/src/components/CollectionViewBinding/SplitListView.tsx +18 -3
  97. package/src/components/CollectionViewBinding/SplitViewContext.tsx +34 -0
  98. package/src/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.ts +48 -9
  99. package/src/components/CollectionViewBinding/useBoardDataController.tsx +80 -25
  100. package/src/components/CollectionViewBinding/usePreviewSlots.ts +18 -6
  101. package/src/components/DefaultAppBar.tsx +1 -1
  102. package/src/components/DefaultDrawer.tsx +1 -1
  103. package/src/components/DetailViewBinding.tsx +112 -148
  104. package/src/components/DrawerNavigationItem.tsx +1 -1
  105. package/src/components/EditFormActions.tsx +54 -129
  106. package/src/components/EditViewBinding.tsx +202 -99
  107. package/src/components/EntityIdentityBar.tsx +288 -0
  108. package/src/components/EntityInspector.tsx +137 -0
  109. package/src/components/EntityPreviewBinding.tsx +6 -2
  110. package/src/components/EntityPreviewNesting.tsx +50 -0
  111. package/src/components/EntityViewBinding.tsx +35 -32
  112. package/src/components/HomePage/FavouritesView.tsx +1 -1
  113. package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
  114. package/src/components/HomePage/SmallNavigationCard.tsx +1 -1
  115. package/src/components/InlineEntityPreview.tsx +149 -0
  116. package/src/components/RebaseLayout.tsx +1 -1
  117. package/src/components/RebaseNavigation.tsx +45 -5
  118. package/src/components/RebaseRouteDefs.tsx +1 -1
  119. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  120. package/src/components/SidePanelBinding.tsx +19 -13
  121. package/src/components/UserSelector.tsx +12 -6
  122. package/src/components/common/default_entity_actions.tsx +4 -3
  123. package/src/components/history/EntityHistoryEntry.tsx +28 -7
  124. package/src/components/history/EntityHistoryView.tsx +29 -24
  125. package/src/components/history/LastEditedByIndicator.tsx +4 -3
  126. package/src/components/index.ts +2 -0
  127. package/src/data_import/utils/get_import_inference_type.ts +6 -0
  128. package/src/form/EntityForm.tsx +267 -179
  129. package/src/form/EntityFormActions.tsx +50 -99
  130. package/src/form/EntityFormBinding.tsx +4 -2
  131. package/src/form/PropertyFieldBinding.tsx +4 -0
  132. package/src/form/components/FieldBlock.tsx +119 -0
  133. package/src/form/components/FormRail.tsx +125 -0
  134. package/src/form/components/FormSections.tsx +118 -0
  135. package/src/form/components/index.tsx +3 -2
  136. package/src/form/components/useRailVisible.tsx +46 -0
  137. package/src/form/field_bindings/BinaryFieldBinding.tsx +3 -2
  138. package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -2
  139. package/src/form/field_bindings/GeopointFieldBinding.tsx +3 -2
  140. package/src/form/field_bindings/MapFieldBinding.tsx +1 -2
  141. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +3 -2
  142. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +2 -1
  143. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -1
  144. package/src/form/field_bindings/ReferenceFieldBinding.tsx +2 -1
  145. package/src/form/field_bindings/RelationFieldBinding.tsx +6 -4
  146. package/src/form/field_bindings/RepeatFieldBinding.tsx +4 -1
  147. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -2
  148. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +31 -8
  149. package/src/form/field_bindings/SwitchFieldBinding.tsx +7 -3
  150. package/src/form/field_bindings/TextFieldBinding.tsx +18 -16
  151. package/src/form/field_bindings/UserSelectFieldBinding.tsx +3 -2
  152. package/src/form/field_bindings/VectorFieldBinding.tsx +2 -1
  153. package/src/hooks/navigation/useBuildUrlController.tsx +1 -1
  154. package/src/hooks/navigation/useTopLevelNavigation.ts +18 -7
  155. package/src/hooks/navigation/utils.ts +20 -0
  156. package/src/hooks/useBuildSideDialogsController.tsx +2 -2
  157. package/src/hooks/useBuildSidePanel.tsx +22 -61
  158. package/src/hooks/useEntityDisplayTitle.tsx +60 -0
  159. package/src/hooks/useHistory.ts +20 -10
  160. package/src/hooks/useRecordActions.tsx +69 -0
  161. package/src/hooks/useResolvedUsers.ts +10 -5
  162. package/src/preview/PropertyPreview.tsx +48 -22
  163. package/src/preview/components/InlineEntityListPreview.tsx +42 -0
  164. package/src/preview/components/ReferencePreview.tsx +34 -14
  165. package/src/preview/components/RelationPreview.tsx +34 -14
  166. package/src/preview/index.ts +1 -0
  167. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +24 -1
  168. package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +25 -1
  169. package/src/routes/RebaseRoute.tsx +2 -2
  170. package/src/types/components/EntityFormActionsProps.tsx +0 -1
  171. package/src/types/components/EntityFormProps.tsx +0 -6
  172. package/src/types/fields.tsx +27 -0
  173. package/dist/form/components/FormEntry.d.ts +0 -6
  174. package/dist/form/components/FormLayout.d.ts +0 -5
  175. package/dist/history-g9688IaK.js.map +0 -1
  176. package/dist/util-B5fJm1FA.js.map +0 -1
  177. package/src/form/components/FormEntry.tsx +0 -22
  178. package/src/form/components/FormLayout.tsx +0 -16
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { A as getFieldId, E as DEFAULT_FIELD_CONFIGS, Ft as FieldCaption, In as useCollectionRegistryController, Mt as ArrayContainer, Nt as PropertyConfigBadge, a as namespaceToPropertiesPath, g as toSerializableProperty, i as namespaceToPropertiesOrderPath, k as getFieldConfig, m as toSerializableCollectionConfig, n as getFullIdPath, r as idToPropertiesPath, t as getFullId } from "./util-B5fJm1FA.js";
2
+ import { A as getFieldId, E as DEFAULT_FIELD_CONFIGS, Ft as FieldCaption, Ln as useCollectionRegistryController, Mt as ArrayContainer, Nt as PropertyConfigBadge, a as namespaceToPropertiesPath, g as toSerializableProperty, i as namespaceToPropertiesOrderPath, k as getFieldConfig, m as toSerializableCollectionConfig, n as getFullIdPath, r as idToPropertiesPath, t as getFullId } from "./util-GiwPgxnL.js";
3
3
  import React, { createContext, useCallback, useContext, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { deepEqual } from "fast-equals";
5
5
  import { AlertTriangleIcon, ArrowDownToLineIcon, ArrowUpToLineIcon, Badge, BooleanSwitchWithLabel, Button, Card, CheckSquareIcon, CircularProgress, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, ExpandablePanel, FileSearchIcon, FunctionSquareIcon, IconButton, InfoLabel, ListIcon, Menu, MenuItem, MinusCircleIcon, MoreVerticalIcon, MultiSelect, MultiSelectItem, Paper, PlusIcon, RefreshCcwIcon, Select, SelectItem, SettingsIcon, TextField, Tooltip, Trash2Icon, Typography, UploadCloudIcon, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
@@ -1297,7 +1297,8 @@ function MapPropertyField({ disabled, getData, allowDataInference, propertyConfi
1297
1297
  [id]: property
1298
1298
  }, false);
1299
1299
  const currentPropertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});
1300
- setFieldValue("propertiesOrder", currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id], false);
1300
+ const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];
1301
+ setFieldValue("propertiesOrder", newPropertiesOrder, false);
1301
1302
  setPropertyDialogOpen(false);
1302
1303
  };
1303
1304
  const deleteProperty = (propertyKey, namespace) => {
@@ -1722,7 +1723,8 @@ function BlockPropertyField({ disabled, getData, allowDataInference, propertyCon
1722
1723
  if (!fullId) throw Error("collection editor miss config");
1723
1724
  setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, void 0, false);
1724
1725
  const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;
1725
- setFieldValue(propertiesOrderPath, (getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)) ?? {})).filter((p) => p !== propertyKey), false);
1726
+ const currentPropertiesOrder = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)) ?? {});
1727
+ setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);
1726
1728
  setPropertyDialogOpen(false);
1727
1729
  setSelectedPropertyKey(void 0);
1728
1730
  setSelectedPropertyNamespace(void 0);
@@ -2584,6 +2586,7 @@ function RelationPropertyField({ disabled, showErrors }) {
2584
2586
  const targetSlug = getTargetSlug(link.target);
2585
2587
  const localKey = link.localKey ?? "";
2586
2588
  const foreignKeyOnTarget = link.foreignKeyOnTarget ?? "";
2589
+ const sourceKey = link.sourceKey ?? "";
2587
2590
  const through = link.through;
2588
2591
  const throughTable = through?.table ?? "";
2589
2592
  const throughSourceColumn = through?.sourceColumn ?? "";
@@ -2595,12 +2598,13 @@ function RelationPropertyField({ disabled, showErrors }) {
2595
2598
  const showForeignKey = kindUsesForeignKeyOnTarget(kind);
2596
2599
  const showJoinPath = kindUsesJoinPath(kind);
2597
2600
  const updateThrough = useCallback((patch) => {
2601
+ const currentThrough = link.through ?? {
2602
+ table: "",
2603
+ sourceColumn: "",
2604
+ targetColumn: ""
2605
+ };
2598
2606
  setFieldValue("relation.through", {
2599
- ...link.through ?? {
2600
- table: "",
2601
- sourceColumn: "",
2602
- targetColumn: ""
2603
- },
2607
+ ...currentThrough,
2604
2608
  ...patch
2605
2609
  });
2606
2610
  }, [link.through, setFieldValue]);
@@ -2676,13 +2680,29 @@ function RelationPropertyField({ disabled, showErrors }) {
2676
2680
  }),
2677
2681
  showForeignKey && /* @__PURE__ */ jsxs("div", {
2678
2682
  className: "col-span-12",
2679
- children: [/* @__PURE__ */ jsx(TextField, {
2680
- value: foreignKeyOnTarget,
2681
- onChange: (e) => setFieldValue("relation.foreignKeyOnTarget", e.target.value),
2682
- label: "Foreign key on target table",
2683
- disabled,
2684
- placeholder: "e.g. post_id"
2685
- }), /* @__PURE__ */ jsx(FieldCaption, { children: "Column on the target table that references this table's primary key" })]
2683
+ children: [
2684
+ /* @__PURE__ */ jsx(TextField, {
2685
+ value: foreignKeyOnTarget,
2686
+ onChange: (e) => setFieldValue("relation.foreignKeyOnTarget", e.target.value),
2687
+ label: "Foreign key on target table",
2688
+ disabled,
2689
+ placeholder: "e.g. post_id"
2690
+ }),
2691
+ /* @__PURE__ */ jsx(FieldCaption, { children: "Column on the target table that references this table's primary key" }),
2692
+ /* @__PURE__ */ jsx(TextField, {
2693
+ className: "mt-4",
2694
+ value: sourceKey,
2695
+ onChange: (e) => setFieldValue("relation.sourceKey", e.target.value),
2696
+ label: "Source key (optional)",
2697
+ disabled,
2698
+ placeholder: "defaults to this table's primary key"
2699
+ }),
2700
+ /* @__PURE__ */ jsxs(FieldCaption, { children: [
2701
+ "Column on ",
2702
+ /* @__PURE__ */ jsx("em", { children: "this" }),
2703
+ " table that the foreign key above points at. Leave empty unless the two sides are joined on a natural key — an external identity id, a SKU — rather than on the row id. It must be unique."
2704
+ ] })
2705
+ ]
2686
2706
  }),
2687
2707
  showJoinPath && /* @__PURE__ */ jsxs("div", {
2688
2708
  className: "col-span-12",
@@ -3846,4 +3866,4 @@ function WidgetSelectViewItem({ onClick, initialProperty, propertyConfig, existi
3846
3866
  //#endregion
3847
3867
  export { updatePropertyFromWidget as a, useAIModifiedPaths as c, supportedFields as i, useSafeSnackbarController as l, PropertyForm as n, PropertyTree as o, PropertyFormDialog as r, AIModifiedPathsProvider as s, PropertyEditView_exports as t };
3848
3868
 
3849
- //# sourceMappingURL=PropertyEditView-DH3XZC2x.js.map
3869
+ //# sourceMappingURL=PropertyEditView-W8I3YV89.js.map