@rebasepro/admin 0.3.0 → 0.4.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 (86) hide show
  1. package/dist/{CollectionEditorDialog-D0VqpLPO.js → CollectionEditorDialog-Bo86h-d-.js} +22 -5
  2. package/dist/CollectionEditorDialog-Bo86h-d-.js.map +1 -0
  3. package/dist/{CollectionsStudioView-Bc3Rxxc2.js → CollectionsStudioView-bsg4AT_Z.js} +4 -4
  4. package/dist/{CollectionsStudioView-Bc3Rxxc2.js.map → CollectionsStudioView-bsg4AT_Z.js.map} +1 -1
  5. package/dist/{ExportCollectionAction-Ckc-09BQ.js → ExportCollectionAction-Cf-Id5uO.js} +35 -27
  6. package/dist/ExportCollectionAction-Cf-Id5uO.js.map +1 -0
  7. package/dist/{ImportCollectionAction-BqjIrC3Z.js → ImportCollectionAction-LN5sreK9.js} +2 -2
  8. package/dist/{ImportCollectionAction-BqjIrC3Z.js.map → ImportCollectionAction-LN5sreK9.js.map} +1 -1
  9. package/dist/{PropertyEditView-CvRSV-A2.js → PropertyEditView-jCWCxmCz.js} +2 -2
  10. package/dist/{PropertyEditView-CvRSV-A2.js.map → PropertyEditView-jCWCxmCz.js.map} +1 -1
  11. package/dist/collection_editor_ui.js +3 -3
  12. package/dist/components/CollectionPanel.d.ts +83 -0
  13. package/dist/components/EntityDetailView.d.ts +0 -3
  14. package/dist/components/EntityEditView.d.ts +2 -3
  15. package/dist/components/RebaseRouteDefs.d.ts +1 -1
  16. package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
  17. package/dist/components/SelectableTable/SelectableTableContext.d.ts +1 -1
  18. package/dist/components/SelectableTable/SelectionStore.d.ts +3 -3
  19. package/dist/components/admin/index.d.ts +1 -3
  20. package/dist/components/index.d.ts +1 -0
  21. package/dist/editor.js +15 -5
  22. package/dist/editor.js.map +1 -1
  23. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +1 -1
  24. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -5
  25. package/dist/{index-UQOMHwt1.js → index-BrqSvMG0.js} +3 -3
  26. package/dist/index-BrqSvMG0.js.map +1 -0
  27. package/dist/{index-DY2k5TtG.js → index-Cb0bPnzZ.js} +3 -3
  28. package/dist/index-Cb0bPnzZ.js.map +1 -0
  29. package/dist/{index-BCcLwgfe.js → index-z3H8iqsj.js} +2 -2
  30. package/dist/{index-BCcLwgfe.js.map → index-z3H8iqsj.js.map} +1 -1
  31. package/dist/index.d.ts +2 -4
  32. package/dist/index.js +228 -295
  33. package/dist/index.js.map +1 -1
  34. package/dist/util/entity_view_constants.d.ts +6 -0
  35. package/dist/util/resolutions.d.ts +1 -2
  36. package/dist/{util-ZM9gQuCv.js → util-CvNp6A-r.js} +422 -798
  37. package/dist/util-CvNp6A-r.js.map +1 -0
  38. package/package.json +8 -8
  39. package/src/collection_editor/pgColumnToProperty.ts +19 -2
  40. package/src/collection_editor/validateCollectionJson.ts +12 -12
  41. package/src/components/CollectionPanel.tsx +155 -0
  42. package/src/components/DefaultDrawer.tsx +2 -2
  43. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +64 -34
  44. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +8 -1
  45. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -1
  46. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -0
  47. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +69 -18
  48. package/src/components/EntityDetailView.tsx +36 -37
  49. package/src/components/EntityEditView.tsx +108 -51
  50. package/src/components/EntityEditViewFormActions.tsx +4 -4
  51. package/src/components/EntitySidePanel.tsx +47 -14
  52. package/src/components/PropertyCollectionView.tsx +1 -0
  53. package/src/components/RebaseRouteDefs.tsx +4 -6
  54. package/src/components/SelectableTable/SelectableTable.tsx +24 -22
  55. package/src/components/SelectableTable/SelectableTableContext.tsx +2 -1
  56. package/src/components/SelectableTable/SelectionStore.ts +4 -4
  57. package/src/components/admin/index.ts +1 -3
  58. package/src/components/index.ts +3 -3
  59. package/src/data_export/export/BasicExportAction.tsx +11 -9
  60. package/src/data_export/export/ExportCollectionAction.tsx +15 -13
  61. package/src/editor/editor.tsx +20 -4
  62. package/src/form/EntityForm.tsx +3 -3
  63. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +3 -1
  64. package/src/hooks/navigation/useBuildNavigationStateController.tsx +2 -3
  65. package/src/hooks/navigation/useResolvedCollections.ts +2 -10
  66. package/src/hooks/navigation/useResolvedViews.tsx +6 -48
  67. package/src/hooks/useBuildSideEntityController.tsx +20 -3
  68. package/src/index.ts +6 -5
  69. package/src/util/entity_view_constants.ts +6 -0
  70. package/src/util/previews.ts +9 -1
  71. package/src/util/resolutions.ts +2 -6
  72. package/dist/CollectionEditorDialog-D0VqpLPO.js.map +0 -1
  73. package/dist/ExportCollectionAction-Ckc-09BQ.js.map +0 -1
  74. package/dist/components/admin/RoleChip.d.ts +0 -4
  75. package/dist/components/admin/RolesFilterSelect.d.ts +0 -2
  76. package/dist/components/admin/RolesView.d.ts +0 -4
  77. package/dist/components/admin/UserRolesSelectField.d.ts +0 -2
  78. package/dist/components/admin/UsersView.d.ts +0 -4
  79. package/dist/index-DY2k5TtG.js.map +0 -1
  80. package/dist/index-UQOMHwt1.js.map +0 -1
  81. package/dist/util-ZM9gQuCv.js.map +0 -1
  82. package/src/components/admin/RoleChip.tsx +0 -23
  83. package/src/components/admin/RolesFilterSelect.tsx +0 -45
  84. package/src/components/admin/RolesView.tsx +0 -470
  85. package/src/components/admin/UserRolesSelectField.tsx +0 -50
  86. package/src/components/admin/UsersView.tsx +0 -693
@@ -15,10 +15,10 @@ import { SelectedCellProps } from "@rebasepro/types";
15
15
  * derivation actually changed will re-render.
16
16
  */
17
17
  export function createSelectionStore() {
18
- let selectedCell: SelectedCellProps<any> | undefined = undefined;
18
+ let selectedCell: SelectedCellProps | undefined = undefined;
19
19
  const listeners = new Set<() => void>();
20
20
 
21
- function getSnapshot(): SelectedCellProps<any> | undefined {
21
+ function getSnapshot(): SelectedCellProps | undefined {
22
22
  return selectedCell;
23
23
  }
24
24
 
@@ -27,7 +27,7 @@ export function createSelectionStore() {
27
27
  return () => listeners.delete(listener);
28
28
  }
29
29
 
30
- function select(cell: SelectedCellProps<any> | undefined) {
30
+ function select(cell: SelectedCellProps | undefined) {
31
31
  selectedCell = cell;
32
32
  listeners.forEach(l => l());
33
33
  }
@@ -43,7 +43,7 @@ export type SelectionStore = ReturnType<typeof createSelectionStore>;
43
43
  * `selected` boolean actually changes (not on every store update).
44
44
  */
45
45
  export function useCellSelected(
46
- store: { getSnapshot: () => SelectedCellProps<any> | undefined; subscribe: (listener: () => void) => () => void },
46
+ store: { getSnapshot: () => SelectedCellProps | undefined; subscribe: (listener: () => void) => () => void },
47
47
  propertyKey: string,
48
48
  entityPath: string,
49
49
  entityId: string | number
@@ -1,3 +1 @@
1
- export * from "./UsersView";
2
- export * from "./RolesView";
3
- export * from "./RoleChip";
1
+ export * from "./CreationResultDialog";
@@ -32,9 +32,7 @@ export * from "./field_configs";
32
32
 
33
33
  export * from "./SideEntityProvider";
34
34
  export * from "./AdminModeSyncer";
35
- // Admin views are lazy-loaded by RebaseRouteDefs and useResolvedViews
36
- // export * from "./admin/RolesView";
37
- // export * from "./admin/UsersView";
35
+ // Admin views: only CreationResultDialog remains (used by resetPasswordAction)
38
36
  export * from "./app/AppBar";
39
37
  export * from "./app/Drawer";
40
38
  export * from "./app/Scaffold";
@@ -55,3 +53,5 @@ export * from "./RebaseAuthGate";
55
53
  export * from "./RebaseNavigation";
56
54
  export * from "./RebaseLayout";
57
55
  export * from "./RebaseRouteDefs";
56
+
57
+ export * from "./CollectionPanel";
@@ -1,6 +1,7 @@
1
1
 
2
2
  import React, { useCallback } from "react";
3
3
 
4
+ import { useTranslation } from "@rebasepro/core";
4
5
  import { Entity, Properties } from "@rebasepro/types";
5
6
  import {
6
7
  BooleanSwitchWithLabel,
@@ -31,6 +32,7 @@ export function BasicExportAction({
31
32
  propertiesOrder
32
33
  }: BasicExportActionProps) {
33
34
 
35
+ const { t } = useTranslation();
34
36
  const dateRef = React.useRef<Date>(new Date());
35
37
  const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);
36
38
  const [exportType, setExportType] = React.useState<"csv" | "json">("csv");
@@ -78,22 +80,22 @@ export function BasicExportAction({
78
80
  onOpenChange={setOpen}
79
81
  maxWidth={"xl"}>
80
82
 
81
- <DialogTitle variant={"h6"}>Export data</DialogTitle>
83
+ <DialogTitle variant={"h6"}>{t("export_data")}</DialogTitle>
82
84
 
83
85
  <DialogContent className={"flex flex-col gap-4 my-4"}>
84
86
 
85
- <div>DownloadIcon the the content of this table as a CSV</div>
87
+ <div>{t("download_table_csv")}</div>
86
88
 
87
89
  <div className={"flex flex-row gap-4"}>
88
90
  <div className={"p-4 flex flex-col"}>
89
91
  <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as "csv" | "json")}>
90
92
  <div className="flex items-center gap-2">
91
93
  <RadioGroupItem value="csv" id="radio-csv"/>
92
- <Label htmlFor="radio-csv">CSV</Label>
94
+ <Label htmlFor="radio-csv">{t("csv")}</Label>
93
95
  </div>
94
96
  <div className="flex items-center gap-2">
95
97
  <RadioGroupItem value="json" id="radio-json"/>
96
- <Label htmlFor="radio-json">JSON</Label>
98
+ <Label htmlFor="radio-json">{t("json")}</Label>
97
99
  </div>
98
100
  </RadioGroup>
99
101
  </div>
@@ -102,11 +104,11 @@ export function BasicExportAction({
102
104
  <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as "timestamp" | "string")}>
103
105
  <div className="flex items-center gap-2">
104
106
  <RadioGroupItem value="timestamp" id="radio-timestamp"/>
105
- <Label htmlFor="radio-timestamp">Dates as timestamps ({dateRef.current.getTime()})</Label>
107
+ <Label htmlFor="radio-timestamp">{t("dates_as_timestamps")} ({dateRef.current.getTime()})</Label>
106
108
  </div>
107
109
  <div className="flex items-center gap-2">
108
110
  <RadioGroupItem value="string" id="radio-string"/>
109
- <Label htmlFor="radio-string">Dates as strings ({dateRef.current.toISOString()})</Label>
111
+ <Label htmlFor="radio-string">{t("dates_as_strings")} ({dateRef.current.toISOString()})</Label>
110
112
  </div>
111
113
  </RadioGroup>
112
114
  </div>
@@ -117,7 +119,7 @@ export function BasicExportAction({
117
119
  disabled={exportType !== "csv"}
118
120
  value={flattenArrays}
119
121
  onValueChange={setFlattenArrays}
120
- label={"Flatten arrays"}/>
122
+ label={t("flatten_arrays")}/>
121
123
 
122
124
  </DialogContent>
123
125
 
@@ -125,11 +127,11 @@ export function BasicExportAction({
125
127
 
126
128
  <Button onClick={handleClose}
127
129
  variant={"text"}>
128
- Cancel
130
+ {t("cancel")}
129
131
  </Button>
130
132
 
131
133
  <Button onClick={onOkClicked}>
132
- DownloadIcon
134
+ {t("download")}
133
135
  </Button>
134
136
 
135
137
  </DialogActions>
@@ -4,7 +4,8 @@ import React, { useCallback } from "react";
4
4
  import {
5
5
  useAuthController,
6
6
  useCustomizationController,
7
- useData
7
+ useData,
8
+ useTranslation
8
9
  } from "@rebasepro/core";
9
10
  import { useCMSContext } from "../../hooks";
10
11
  import { CollectionActionsProps, Entity, EntityCollection, ExportConfig, RebaseContext, User } from "@rebasepro/types";
@@ -43,6 +44,8 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
43
44
  onAnalyticsEvent?: (event: string, params?: any) => void;
44
45
  }) {
45
46
 
47
+ const { t } = useTranslation();
48
+
46
49
  const exportConfig = typeof collection.exportable === "object" ? collection.exportable : undefined;
47
50
 
48
51
  const dateRef = React.useRef<Date>(new Date());
@@ -184,17 +187,16 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
184
187
  onOpenChange={setOpen}
185
188
  maxWidth={"xl"}>
186
189
 
187
- <DialogTitle variant={"h6"}>Export data</DialogTitle>
190
+ <DialogTitle variant={"h6"}>{t("export_data")}</DialogTitle>
188
191
 
189
192
  <DialogContent className={"flex flex-col gap-4 my-4"}>
190
193
 
191
- <div>DownloadIcon the the content of this table as a CSV</div>
194
+ <div>{t("download_table_csv")}</div>
192
195
 
193
196
  {collectionEntitiesCount !== undefined && collectionEntitiesCount > DOCS_LIMIT &&
194
197
  <Alert color={"warning"}>
195
198
  <div>
196
- This collections has a large number
197
- of documents ({collectionEntitiesCount}).
199
+ {t("large_number_of_documents", { count: collectionEntitiesCount.toString() })}
198
200
  </div>
199
201
  </Alert>}
200
202
 
@@ -203,11 +205,11 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
203
205
  <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as "csv" | "json")}>
204
206
  <div className="flex items-center gap-2">
205
207
  <RadioGroupItem value="csv" id="radio-csv"/>
206
- <Label htmlFor="radio-csv">CSV</Label>
208
+ <Label htmlFor="radio-csv">{t("csv")}</Label>
207
209
  </div>
208
210
  <div className="flex items-center gap-2">
209
211
  <RadioGroupItem value="json" id="radio-json"/>
210
- <Label htmlFor="radio-json">JSON</Label>
212
+ <Label htmlFor="radio-json">{t("json")}</Label>
211
213
  </div>
212
214
  </RadioGroup>
213
215
  </div>
@@ -216,11 +218,11 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
216
218
  <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as "timestamp" | "string")}>
217
219
  <div className="flex items-center gap-2">
218
220
  <RadioGroupItem value="timestamp" id="radio-timestamp"/>
219
- <Label htmlFor="radio-timestamp">Dates as timestamps ({dateRef.current.getTime()})</Label>
221
+ <Label htmlFor="radio-timestamp">{t("dates_as_timestamps")} ({dateRef.current.getTime()})</Label>
220
222
  </div>
221
223
  <div className="flex items-center gap-2">
222
224
  <RadioGroupItem value="string" id="radio-string"/>
223
- <Label htmlFor="radio-string">Dates as strings ({dateRef.current.toISOString()})</Label>
225
+ <Label htmlFor="radio-string">{t("dates_as_strings")} ({dateRef.current.toISOString()})</Label>
224
226
  </div>
225
227
  </RadioGroup>
226
228
  </div>
@@ -231,13 +233,13 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
231
233
  disabled={exportType !== "csv"}
232
234
  value={flattenArrays}
233
235
  onValueChange={setFlattenArrays}
234
- label={"Flatten arrays"}/>
236
+ label={t("flatten_arrays")}/>
235
237
 
236
238
  <BooleanSwitchWithLabel
237
239
  size={"small"}
238
240
  value={includeUndefinedValues}
239
241
  onValueChange={setIncludeUndefinedValues}
240
- label={"Include undefined values"}/>
242
+ label={t("include_undefined_values")}/>
241
243
 
242
244
  {!canExport && notAllowedView}
243
245
 
@@ -249,12 +251,12 @@ export function ExportCollectionAction<M extends Record<string, unknown>, USER e
249
251
 
250
252
  <Button onClick={handleClose}
251
253
  variant={"text"}>
252
- Cancel
254
+ {t("cancel")}
253
255
  </Button>
254
256
 
255
257
  <Button onClick={onOkClicked}
256
258
  disabled={dataLoading || !canExport}>
257
- DownloadIcon
259
+ {t("download")}
258
260
  </Button>
259
261
 
260
262
  </DialogActions>
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import React, { useEffect, useState, useRef, useMemo } from "react";
3
- import { EditorState } from "prosemirror-state";
3
+ import { EditorState, Selection } from "prosemirror-state";
4
4
  import { cls, defaultBorderMixin, Separator, useInjectStyles, TextareaAutosize } from "@rebasepro/ui";
5
5
  import { useTranslation } from "@rebasepro/core";
6
6
  import { EditorBubble, ImageBubble, SlashCommandMenu, TableBubble, type JSONContent } from "./components";
@@ -236,7 +236,7 @@ onJsonContentChange };
236
236
 
237
237
 
238
238
  return (
239
- <div className="relative min-h-[200px] w-full">
239
+ <div className="relative min-h-[200px] w-full flex flex-col">
240
240
  <button
241
241
  type="button"
242
242
  onClick={handleToggleMarkdown}
@@ -249,10 +249,23 @@ onJsonContentChange };
249
249
  <ProseMirrorContext.Provider value={useMemo(() => ({ state,
250
250
  view }), [state, view])}>
251
251
 
252
- <div style={{ display: isMarkdownMode ? "none" : "block" }}>
252
+ <div style={{ display: isMarkdownMode ? "none" : "flex" }} className="flex-1 flex flex-col">
253
253
  <div
254
254
  ref={editorRef}
255
- className={cls("relative prose dark:prose-invert", proseClass, "prose-headings:font-title prose-headings:font-normal prose-strong:font-semibold prose-code:font-normal prose-blockquote:font-normal prose-a:font-normal font-default focus:outline-none max-w-full px-12 py-4")}
255
+ onClick={(e) => {
256
+ // If the click landed on the wrapper padding (not on the ProseMirror
257
+ // content), focus the editor and place the cursor at the nearest position.
258
+ if (view && e.target === e.currentTarget) {
259
+ view.focus();
260
+ // Place cursor at end of the document
261
+ const end = view.state.doc.content.size;
262
+ const tr = view.state.tr.setSelection(
263
+ Selection.near(view.state.doc.resolve(end), -1)
264
+ );
265
+ view.dispatch(tr);
266
+ }
267
+ }}
268
+ className={cls("relative prose dark:prose-invert cursor-text flex-1", proseClass, "prose-headings:font-title prose-headings:font-normal prose-strong:font-semibold prose-code:font-normal prose-blockquote:font-normal prose-a:font-normal font-default focus:outline-none max-w-full py-4")}
256
269
  />
257
270
 
258
271
  {view && (
@@ -311,6 +324,9 @@ view }), [state, view])}>
311
324
  const cssStyles = `
312
325
  .ProseMirror {
313
326
  box-shadow: none !important;
327
+ padding-left: 2rem;
328
+ padding-right: 2rem;
329
+ min-height: 100%;
314
330
  }
315
331
  .ProseMirror .is-editor-empty:first-child::before {
316
332
  content: attr(data-placeholder);
@@ -311,7 +311,7 @@ export function EntityForm<M extends Record<string, unknown>>({
311
311
  }
312
312
  }
313
313
  },
314
- validation: async (values) => {
314
+ validation: async (values): Promise<Record<string, string>> => {
315
315
  if (!validationSchema) return {};
316
316
  const result = await validationSchema.safeParseAsync(values);
317
317
  if (result.success) return {};
@@ -737,14 +737,14 @@ export function EntityForm<M extends Record<string, unknown>>({
737
737
  entity={entity}
738
738
  layout={forceActionsAtTheBottom ? "bottom" : "responsive"}
739
739
  savingError={savingError}
740
- formex={formex as any}
740
+ formex={formex as FormexController<Record<string, unknown>>}
741
741
  disabled={actionsDisabled}
742
742
  status={status}
743
743
  pluginActions={pluginFormActions ?? []}
744
744
  openEntityMode={openEntityMode}
745
745
  showDefaultActions={showDefaultActions}
746
746
  navigateBack={navigateBack}
747
- formContext={formContext as any}
747
+ formContext={formContext as FormContext<Record<string, unknown>>}
748
748
  />;
749
749
 
750
750
  return (
@@ -32,6 +32,8 @@ export function ReadOnlyFieldBinding({
32
32
  // if (!context.entityId)
33
33
  // throw new Error("ReadOnlyFieldBinding: Entity id is null");
34
34
 
35
+ const skipCardWrapper = property.type === "relation" || property.type === "reference";
36
+
35
37
  return (
36
38
 
37
39
  <>
@@ -45,7 +47,7 @@ export function ReadOnlyFieldBinding({
45
47
  }
46
48
 
47
49
  <div
48
- className={cls(paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar")}>
50
+ className={cls(!skipCardWrapper && paperMixin, "w-full min-h-14 overflow-x-scroll no-scrollbar", !skipCardWrapper && "p-4 md:p-6")}>
49
51
 
50
52
  <ErrorBoundary>
51
53
  <PropertyPreview propertyKey={propertyKey}
@@ -33,7 +33,7 @@ export type BuildNavigationStateProps<EC extends EntityCollection, USER extends
33
33
  * NavigationStateController. This is a thin composition of three focused hooks:
34
34
  *
35
35
  * - useResolvedCollections: resolves collection props and registers with CollectionRegistry
36
- * - useResolvedViews: resolves view/admin view props and injects Users/Roles views
36
+ * - useResolvedViews: resolves view/admin view props
37
37
  * - useTopLevelNavigation: computes the NavigationResult from resolved data
38
38
  *
39
39
  * The NavigationStateController type is preserved as a public API.
@@ -87,8 +87,7 @@ export function useBuildNavigationStateController<EC extends EntityCollection, U
87
87
  data,
88
88
  plugins,
89
89
  adminMode,
90
- effectiveRoleController,
91
- userManagement
90
+ effectiveRoleController
92
91
  });
93
92
 
94
93
  // Step 3: Compute top-level navigation (pure derived state)
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef, useState, useMemo } from "react";
3
3
 
4
4
  import { AuthController, CollectionRegistryController, RebaseData, User } from "@rebasepro/types";
5
5
  import type { EntityCollectionsBuilder } from "@rebasepro/types";
6
- import { CollectionRegistry, defaultUsersCollection } from "@rebasepro/common";
6
+ import { CollectionRegistry } from "@rebasepro/common";
7
7
  import { UserManagementDelegate } from "@rebasepro/types";
8
8
 
9
9
  import { resolveCollections } from "./useNavigationResolution";
@@ -95,15 +95,7 @@ export function useResolvedCollections<EC extends EntityCollection, USER extends
95
95
 
96
96
  if (cancelled) return;
97
97
 
98
- // Prepend system defaults; developer collections override via generic dedup.
99
- // Map keyed by slug — last-write-wins, so developer collections overwrite defaults.
100
- const defaults: EntityCollection[] = [];
101
- if (userManagementRef.current) {
102
- defaults.push(defaultUsersCollection);
103
- }
104
- const deduped = Array.from(
105
- new Map([...defaults, ...resolved].map(c => [c.slug, c])).values()
106
- );
98
+ const deduped = [...resolved];
107
99
 
108
100
  // Register with the CollectionRegistry; returns true if changed
109
101
  const changed = collectionRegistryController.collectionRegistryRef.current.registerMultiple(deduped);
@@ -1,6 +1,6 @@
1
1
 
2
- import type { AppView, AppViewsBuilder, EffectiveRoleController, EntityCollection, RebasePlugin } from "@rebasepro/types";
3
- import React, { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import type { AppView, AppViewsBuilder, EffectiveRoleController, RebasePlugin } from "@rebasepro/types";
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
 
5
5
  /**
6
6
  * Compare two view arrays by their slug identity.
@@ -17,14 +17,10 @@ function viewSlugsEqual(a: AppView[] | undefined, b: AppView[] | undefined): boo
17
17
  return true;
18
18
  }
19
19
 
20
- import { AuthController, RebaseData, User } from "@rebasepro/types";
21
- import { UserManagementDelegate } from "@rebasepro/types";
20
+ import type { AuthController, RebaseData, User } from "@rebasepro/types";
22
21
 
23
22
  import { resolveAppViews } from "./useNavigationResolution";
24
23
 
25
-
26
- import { RolesView } from "../../components/admin/RolesView";
27
-
28
24
  export type UseResolvedViewsProps<USER extends User> = {
29
25
  authController: AuthController<USER>;
30
26
  views?: AppView[] | AppViewsBuilder;
@@ -33,7 +29,6 @@ export type UseResolvedViewsProps<USER extends User> = {
33
29
  plugins?: RebasePlugin[];
34
30
  adminMode?: "content" | "studio" | "settings";
35
31
  effectiveRoleController?: EffectiveRoleController;
36
- userManagement?: UserManagementDelegate<USER>;
37
32
  };
38
33
 
39
34
  export type UseResolvedViewsResult = {
@@ -46,8 +41,7 @@ export type UseResolvedViewsResult = {
46
41
 
47
42
  /**
48
43
  * Hook that resolves view and admin view props (which may be async builders or arrays)
49
- * into concrete AppView[]. Also injects the Roles admin view when userManagement
50
- * is provided with roles.
44
+ * into concrete AppView[].
51
45
  *
52
46
  * Uses refs for potentially-unstable dependencies (driver, authController,
53
47
  * plugins) to avoid re-triggering effects when their object identity changes.
@@ -63,8 +57,7 @@ export function useResolvedViews<USER extends User>(
63
57
  data,
64
58
  plugins,
65
59
  adminMode = "content",
66
- effectiveRoleController,
67
- userManagement
60
+ effectiveRoleController
68
61
  } = props;
69
62
 
70
63
  const [loading, setLoading] = useState(true);
@@ -110,32 +103,6 @@ export function useResolvedViews<USER extends User>(
110
103
  const resolvedAuthControllerRef = useRef(resolvedAuthController);
111
104
  resolvedAuthControllerRef.current = resolvedAuthController;
112
105
 
113
- // Memoize JSX element for injected Roles admin view to ensure stable reference.
114
- const hasRoles = !!userManagement?.roles;
115
- const rolesViewElement = useMemo(() =>
116
- hasRoles ? <RolesView /> : null,
117
- [hasRoles]
118
- );
119
-
120
- const injectedAdminViews: AppView[] = useMemo(() => {
121
- const views: AppView[] = [];
122
- const isUserAdmin = userManagement?.isAdmin !== false;
123
- if (userManagement && isUserAdmin && userManagement.roles && rolesViewElement) {
124
- views.push({
125
- slug: "roles",
126
- name: "Roles",
127
- icon: "Shield",
128
- view: rolesViewElement,
129
- group: "Settings"
130
- });
131
- }
132
- return views;
133
- }, [userManagement, rolesViewElement]);
134
-
135
- // Store injectedAdminViews in a ref for effect access
136
- const injectedAdminViewsRef = useRef(injectedAdminViews);
137
- injectedAdminViewsRef.current = injectedAdminViews;
138
-
139
106
  const initialLoading = resolvedAuthController.initialLoading;
140
107
  const user = resolvedAuthController.user;
141
108
 
@@ -146,20 +113,11 @@ export function useResolvedViews<USER extends User>(
146
113
 
147
114
  (async () => {
148
115
  try {
149
- const [newViews, newAdminViewsProp] = await Promise.all([
116
+ const [newViews, newAdminViews] = await Promise.all([
150
117
  resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current),
151
118
  resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)
152
119
  ]);
153
120
 
154
- // Generic dedup: developer-provided admin views override any injected ones with the same slug.
155
- // No hardcoded slug checks — works for any slug generically.
156
- const customSlugs = new Set(newAdminViewsProp.flatMap(v => Array.isArray(v.slug) ? v.slug : [v.slug]));
157
- const finalInjected = injectedAdminViewsRef.current.filter(v => {
158
- const slugs = Array.isArray(v.slug) ? v.slug : [v.slug];
159
- return slugs.every(s => !customSlugs.has(s));
160
- });
161
- const newAdminViews = [...newAdminViewsProp, ...finalInjected];
162
-
163
121
  // Compare views by slug identity rather than deepEqual.
164
122
  // Views contain React elements (JSX) whose internal properties
165
123
  // change on every render, making deepEqual unreliable.
@@ -26,7 +26,7 @@ export function getEntityViewWidth(props: EntitySidePanelProps<any>, small: bool
26
26
  selectedSecondaryForm
27
27
  } = resolvedSelectedEntityView(props.collection?.entityViews, customizationController, props.selectedTab);
28
28
 
29
- const shouldUseSmallLayout = !props.selectedTab || props.selectedTab === JSON_TAB_VALUE || props.selectedTab === HISTORY_TAB_VALUE || Boolean(selectedSecondaryForm);
29
+ const shouldUseSmallLayout = !props.selectedTab || props.selectedTab === "edit" || props.selectedTab === JSON_TAB_VALUE || props.selectedTab === HISTORY_TAB_VALUE || Boolean(selectedSecondaryForm);
30
30
 
31
31
  let resolvedWidth: string | undefined;
32
32
  if (props.width) {
@@ -187,8 +187,8 @@ width: newWidth };
187
187
 
188
188
  sideDialogsController.open(
189
189
  propsToSidePanel({
190
- selectedTab: defaultSelectedView,
191
- ...props
190
+ ...props,
191
+ selectedTab: props.selectedTab ?? defaultSelectedView,
192
192
  },
193
193
  urlController.buildUrlCollectionPath,
194
194
  urlController.resolveDatabasePathsFrom,
@@ -241,6 +241,7 @@ export function buildSidePanelsFromUrl(path: string, collections: EntityCollecti
241
241
  path: navigationEntry.slug,
242
242
  entityId: navigationEntry.entityId,
243
243
  copy: false,
244
+ collection: navigationEntry.parentCollection,
244
245
  width: navigationEntry.parentCollection?.sideDialogWidth
245
246
  };
246
247
  } else if (navigationEntry.type === "custom_view") {
@@ -257,6 +258,22 @@ export function buildSidePanelsFromUrl(path: string, collections: EntityCollecti
257
258
 
258
259
  }
259
260
 
261
+ // When the URL doesn't contain a tab segment but the collection has a
262
+ // defaultSelectedView, resolve it so the panel opens with the correct
263
+ // width and the URL is updated on the next replace() cycle.
264
+ if (sidePanel && !sidePanel.selectedTab && sidePanel.collection) {
265
+ const defaultView = resolveDefaultSelectedView(
266
+ sidePanel.collection.defaultSelectedView,
267
+ {
268
+ status: sidePanel.copy ? "copy" : (sidePanel.entityId ? "existing" : "new"),
269
+ entityId: sidePanel.entityId
270
+ }
271
+ );
272
+ if (defaultView) {
273
+ sidePanel.selectedTab = defaultView;
274
+ }
275
+ }
276
+
260
277
  if (newFlag) {
261
278
  sidePanel = {
262
279
  path: lastCollectionPath,
package/src/index.ts CHANGED
@@ -45,7 +45,7 @@ export {
45
45
  DefaultDrawer,
46
46
  DrawerFooterActions,
47
47
  AdminModeSyncer,
48
- // ContentHomePage, UsersView, RolesView are lazy-loaded — not re-exported here
48
+ // ContentHomePage is lazy-loaded — not re-exported here
49
49
  RebaseCMS,
50
50
  RebaseShell,
51
51
  RebaseAuthGate,
@@ -53,12 +53,14 @@ export {
53
53
  RebaseLayout,
54
54
  RebaseRouteDefs,
55
55
  SideDialogs,
56
- useApp
56
+ useApp,
57
+ CollectionPanel
57
58
  } from "./components";
58
59
  export type {
59
60
  EntityViewProps,
60
61
  EntitySelectionProps,
61
- SelectableTableProps
62
+ SelectableTableProps,
63
+ CollectionPanelProps
62
64
  } from "./components";
63
65
 
64
66
  export * from "./hooks";
@@ -97,7 +99,6 @@ export * from "./data_export";
97
99
  // Collection editor — moved from @rebasepro/studio (CMS-dependent visual schema editor)
98
100
  export * from "./collection_editor";
99
101
 
100
- export { RolesFilterSelect } from "./components/admin/RolesFilterSelect";
101
- export { UserRolesSelectField } from "./components/admin/UserRolesSelectField";
102
+
102
103
  export { CreationResultDialog } from "./components/admin/CreationResultDialog";
103
104
 
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared tab value constants used by EntityEditView and EntityDetailView.
3
+ */
4
+ export const MAIN_TAB_VALUE = "__main_##Q$SC^#S6";
5
+ export const JSON_TAB_VALUE = "__json";
6
+ export const HISTORY_TAB_VALUE = "__rebase_history";
@@ -3,6 +3,11 @@ import { AuthController } from "@rebasepro/types";
3
3
  import { isPropertyBuilder } from "@rebasepro/common";
4
4
  import { isReferenceProperty, isRelationProperty } from "./property_utils";
5
5
 
6
+ function isHiddenProperty(property: Property | undefined): boolean {
7
+ if (!property) return false;
8
+ return Boolean(property.ui?.hideFromCollection);
9
+ }
10
+
6
11
  export function getEntityPreviewKeys(
7
12
  authController: AuthController,
8
13
  targetCollection: EntityCollection<any>,
@@ -26,7 +31,7 @@ export function getEntityPreviewKeys(
26
31
  })
27
32
  .filter(key => {
28
33
  const property = targetCollection.properties[key];
29
- return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property);
34
+ return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property) && !isHiddenProperty(property);
30
35
  }).slice(0, limit);
31
36
  }
32
37
  }
@@ -43,6 +48,9 @@ export function getEntityTitlePropertyKey<M extends Record<string, unknown>>(col
43
48
  const property = collection.properties[key];
44
49
  if (property && !isPropertyBuilder(property)) {
45
50
  const prop = property as Property;
51
+ if (isHiddenProperty(prop)) {
52
+ continue;
53
+ }
46
54
  if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
47
55
  if (!firstStringCandidate) {
48
56
  firstStringCandidate = key;
@@ -1,10 +1,7 @@
1
1
  import { HistoryIcon } from "@rebasepro/ui";
2
- import React, { lazy } from "react";
3
- import type { EntityCustomView, EntityCollection } from "@rebasepro/types";
4
- import type { CustomizationController, EntityAction } from "@rebasepro/types";
2
+ import React from "react";
3
+ import type { CustomizationController, EntityAction, EntityCustomView } from "@rebasepro/types";
5
4
 
6
- // Lazy-load: only resolved when HistoryIcon tab is visited
7
- const EntityHistoryView = lazy(() => import("../components/history").then(m => ({ default: m.EntityHistoryView })));
8
5
  /**
9
6
  * Built-in entity views that are resolved by token name.
10
7
  * These are always available without needing to be registered
@@ -15,7 +12,6 @@ const BUILTIN_ENTITY_VIEWS: Record<string, EntityCustomView> = {
15
12
  key: "__rebase_history",
16
13
  name: "History",
17
14
  tabComponent: React.createElement(HistoryIcon, { size: 20 }),
18
- Builder: EntityHistoryView,
19
15
  position: "end"
20
16
  }
21
17
  };