@rebasepro/admin 0.3.0 → 0.5.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 (106) hide show
  1. package/README.md +135 -0
  2. package/dist/{CollectionEditorDialog-D0VqpLPO.js → CollectionEditorDialog-C8E440oK.js} +22 -5
  3. package/dist/CollectionEditorDialog-C8E440oK.js.map +1 -0
  4. package/dist/{CollectionsStudioView-Bc3Rxxc2.js → CollectionsStudioView-Brr_b06v.js} +4 -4
  5. package/dist/{CollectionsStudioView-Bc3Rxxc2.js.map → CollectionsStudioView-Brr_b06v.js.map} +1 -1
  6. package/dist/{ExportCollectionAction-Ckc-09BQ.js → ExportCollectionAction-D3TTYXrq.js} +35 -27
  7. package/dist/ExportCollectionAction-D3TTYXrq.js.map +1 -0
  8. package/dist/{ImportCollectionAction-BqjIrC3Z.js → ImportCollectionAction-Dn7lya6E.js} +2 -2
  9. package/dist/{ImportCollectionAction-BqjIrC3Z.js.map → ImportCollectionAction-Dn7lya6E.js.map} +1 -1
  10. package/dist/{PropertyEditView-CvRSV-A2.js → PropertyEditView-ChBleIbN.js} +4 -4
  11. package/dist/PropertyEditView-ChBleIbN.js.map +1 -0
  12. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +1 -0
  13. package/dist/collection_editor/ui/collection_editor/templates/blog_template.d.ts +1 -1
  14. package/dist/collection_editor/ui/collection_editor/templates/pages_template.d.ts +1 -1
  15. package/dist/collection_editor/ui/collection_editor/templates/products_template.d.ts +1 -1
  16. package/dist/collection_editor/ui/collection_editor/templates/users_template.d.ts +1 -1
  17. package/dist/collection_editor_ui.js +3 -3
  18. package/dist/components/CollectionPanel.d.ts +83 -0
  19. package/dist/components/EntityDetailView.d.ts +0 -3
  20. package/dist/components/EntityEditView.d.ts +2 -3
  21. package/dist/components/RebaseRouteDefs.d.ts +1 -1
  22. package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
  23. package/dist/components/SelectableTable/SelectableTableContext.d.ts +1 -1
  24. package/dist/components/SelectableTable/SelectionStore.d.ts +3 -3
  25. package/dist/components/admin/index.d.ts +1 -3
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/editor.js +15 -5
  28. package/dist/editor.js.map +1 -1
  29. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +1 -1
  30. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -5
  31. package/dist/{index-BCcLwgfe.js → index-D3S9x_RP.js} +2 -2
  32. package/dist/{index-BCcLwgfe.js.map → index-D3S9x_RP.js.map} +1 -1
  33. package/dist/{index-DY2k5TtG.js → index-D9RNzm01.js} +3 -3
  34. package/dist/index-D9RNzm01.js.map +1 -0
  35. package/dist/{index-UQOMHwt1.js → index-DrrT332R.js} +3 -3
  36. package/dist/index-DrrT332R.js.map +1 -0
  37. package/dist/index.d.ts +2 -4
  38. package/dist/index.js +228 -295
  39. package/dist/index.js.map +1 -1
  40. package/dist/util/entity_view_constants.d.ts +6 -0
  41. package/dist/util/resolutions.d.ts +1 -2
  42. package/dist/{util-ZM9gQuCv.js → util-COYYD8zr.js} +473 -880
  43. package/dist/util-COYYD8zr.js.map +1 -0
  44. package/package.json +9 -10
  45. package/src/collection_editor/pgColumnToProperty.ts +19 -2
  46. package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +2 -2
  47. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +2 -1
  48. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +2 -2
  49. package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +2 -1
  50. package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +1 -1
  51. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +1 -1
  52. package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +1 -1
  53. package/src/collection_editor/ui/collection_editor/templates/products_template.ts +1 -1
  54. package/src/collection_editor/ui/collection_editor/templates/users_template.ts +1 -1
  55. package/src/collection_editor/validateCollectionJson.ts +12 -12
  56. package/src/components/CollectionPanel.tsx +155 -0
  57. package/src/components/DefaultDrawer.tsx +2 -2
  58. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +5 -2
  59. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +64 -34
  60. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +8 -1
  61. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -1
  62. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -0
  63. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +68 -18
  64. package/src/components/EntityDetailView.tsx +32 -36
  65. package/src/components/EntityEditView.tsx +101 -50
  66. package/src/components/EntityEditViewFormActions.tsx +4 -4
  67. package/src/components/EntitySidePanel.tsx +50 -14
  68. package/src/components/PropertyCollectionView.tsx +1 -0
  69. package/src/components/RebaseRouteDefs.tsx +4 -6
  70. package/src/components/SelectableTable/SelectableTable.tsx +24 -22
  71. package/src/components/SelectableTable/SelectableTableContext.tsx +2 -1
  72. package/src/components/SelectableTable/SelectionStore.ts +4 -4
  73. package/src/components/admin/index.ts +1 -3
  74. package/src/components/index.ts +3 -3
  75. package/src/data_export/export/BasicExportAction.tsx +11 -9
  76. package/src/data_export/export/ExportCollectionAction.tsx +15 -13
  77. package/src/editor/editor.tsx +20 -4
  78. package/src/form/EntityForm.tsx +3 -3
  79. package/src/form/PropertyFieldBinding.tsx +1 -1
  80. package/src/form/field_bindings/KeyValueFieldBinding.tsx +1 -1
  81. package/src/form/field_bindings/MapFieldBinding.tsx +3 -45
  82. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +3 -1
  83. package/src/hooks/navigation/useBuildNavigationStateController.tsx +2 -3
  84. package/src/hooks/navigation/useResolvedCollections.ts +2 -10
  85. package/src/hooks/navigation/useResolvedViews.tsx +6 -48
  86. package/src/hooks/useBuildSideEntityController.tsx +20 -3
  87. package/src/index.ts +6 -5
  88. package/src/util/entity_view_constants.ts +6 -0
  89. package/src/util/previews.ts +9 -1
  90. package/src/util/resolutions.ts +2 -6
  91. package/dist/CollectionEditorDialog-D0VqpLPO.js.map +0 -1
  92. package/dist/ExportCollectionAction-Ckc-09BQ.js.map +0 -1
  93. package/dist/PropertyEditView-CvRSV-A2.js.map +0 -1
  94. package/dist/components/admin/RoleChip.d.ts +0 -4
  95. package/dist/components/admin/RolesFilterSelect.d.ts +0 -2
  96. package/dist/components/admin/RolesView.d.ts +0 -4
  97. package/dist/components/admin/UserRolesSelectField.d.ts +0 -2
  98. package/dist/components/admin/UsersView.d.ts +0 -4
  99. package/dist/index-DY2k5TtG.js.map +0 -1
  100. package/dist/index-UQOMHwt1.js.map +0 -1
  101. package/dist/util-ZM9gQuCv.js.map +0 -1
  102. package/src/components/admin/RoleChip.tsx +0 -23
  103. package/src/components/admin/RolesFilterSelect.tsx +0 -45
  104. package/src/components/admin/RolesView.tsx +0 -470
  105. package/src/components/admin/UserRolesSelectField.tsx +0 -50
  106. package/src/components/admin/UsersView.tsx +0 -693
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # @rebasepro/admin
2
+
3
+ CMS frontend — content management views, forms, routing, visual schema editor, and data import/export for Rebase.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @rebasepro/admin
9
+ ```
10
+
11
+ **Peer dependencies:** `react >= 19`, `react-dom >= 19`, `react-router ^7`, `react-router-dom ^7`
12
+
13
+ ## What This Package Does
14
+
15
+ `@rebasepro/admin` is the complete CMS layer of Rebase. It provides the admin panel UI — collection table/card views, entity editing forms, side-panel navigation, the visual collection (schema) editor, data import/export (CSV, JSON, Excel), and the app shell with auth gating, routing, and drawer layout. It sits on top of `@rebasepro/core` (runtime hooks/providers) and `@rebasepro/ui` (design system components).
16
+
17
+ ## Key Exports
18
+
19
+ ### App Shell & Layout
20
+
21
+ | Export | Description |
22
+ |---|---|
23
+ | `RebaseCMS` | Top-level CMS component — wires routing, auth, and layout together |
24
+ | `RebaseShell` | Outer shell (providers + chrome) without opinionated routing |
25
+ | `RebaseAuthGate` | Auth-gated wrapper — shows login or the CMS based on session state |
26
+ | `RebaseNavigation` | Renders the sidebar navigation from resolved collections/views |
27
+ | `RebaseLayout` | Main content layout (header + body area) |
28
+ | `RebaseRouteDefs` | Route definitions for react-router integration |
29
+ | `Scaffold` | Page-level layout wrapper (header, content, footer) |
30
+ | `AppBar` | Top application bar |
31
+ | `Drawer` / `DefaultDrawer` | Sidebar drawer components |
32
+ | `DrawerFooterActions` | Footer action buttons inside the drawer |
33
+ | `SideDialogs` | Stacked side-panel dialog system |
34
+ | `AdminModeSyncer` | Syncs admin/content mode state |
35
+ | `CollectionPanel` | Standalone collection browser panel |
36
+
37
+ ### Entity & Collection Views
38
+
39
+ | Export | Description |
40
+ |---|---|
41
+ | `EntityView` | Full entity detail/edit view |
42
+ | `EntityCollectionView` | Primary collection list view (table + toolbar) |
43
+ | `EntityCollectionTable` | Virtualized spreadsheet table for a collection |
44
+ | `EntityCollectionCardView` | Card/grid layout for a collection |
45
+ | `EntityCard` | Individual entity card |
46
+ | `EntityCollectionViewActions` | Toolbar actions (filters, search, create) |
47
+ | `EntityCollectionRowActions` | Per-row action buttons |
48
+ | `EntitySelectionTable` | Table for multi-entity selection dialogs |
49
+ | `SelectableTable` | Generic selectable table component |
50
+ | `EntityPreview` | Compact entity preview widget |
51
+ | `VirtualTableInput` | Inline-edit input rendered inside the virtual table |
52
+ | `ArrayContainer` | Renders array/repeated property fields |
53
+ | `ReferenceWidget` | Reference (foreign key) picker widget |
54
+
55
+ ### Entity Actions
56
+
57
+ | Export | Description |
58
+ |---|---|
59
+ | `editEntityAction` | Built-in action to open an entity for editing |
60
+ | `copyEntityAction` | Built-in action to duplicate an entity |
61
+ | `deleteEntityAction` | Built-in action to delete an entity |
62
+ | `resetPasswordAction` | Action to reset a user's password |
63
+
64
+ ### Hooks
65
+
66
+ | Export | Description |
67
+ |---|---|
68
+ | `useApp` | Access the app-level context (navigation, mode, config) |
69
+ | `useSideEntityController` | Open/close entity side panels programmatically |
70
+ | `useEntitySelectionDialog` | Launch a multi-entity selection dialog |
71
+ | `useSelectionController` | Row selection state for tables |
72
+ | `useEntityHistory` | Entity change history and version revert |
73
+ | `useBreadcrumbsController` | Breadcrumb navigation state |
74
+ | `useCMSContext` | Access the CMS-level context |
75
+ | `useResolvedNavigationFrom` | Resolve navigation tree from collection configs |
76
+
77
+ ### Data Import/Export
78
+
79
+ All exports from `./data_import` and `./data_export` — utilities for importing CSV/JSON/Excel data with field mapping, and exporting collection data in multiple formats.
80
+
81
+ ### Collection Editor (Visual Schema Editor)
82
+
83
+ All exports from `./collection_editor` — the visual schema editor UI for creating and editing collection definitions (properties, relations, validation rules) from within the CMS.
84
+
85
+ Also available as a separate entry point:
86
+
87
+ ```ts
88
+ import { ... } from "@rebasepro/admin/collection_editor_ui";
89
+ ```
90
+
91
+ ### Rich Text Editor
92
+
93
+ Type exports only from the main entry point (`RebaseEditorProps`, `JSONContent`, `EditorAIController`). The full ProseMirror editor is a heavy import (~300 KB) and available as a separate entry point:
94
+
95
+ ```ts
96
+ import { RebaseEditor } from "@rebasepro/admin/editor";
97
+ ```
98
+
99
+ ### Utilities
100
+
101
+ | Export | Description |
102
+ |---|---|
103
+ | `getFieldConfig` / `getDefaultFieldConfig` | Resolve field config for a property type |
104
+ | `getIconForWidget` / `getIconForProperty` | Get the display icon for a property or widget |
105
+ | `getPropertyInPath` / `getResolvedPropertyInPath` | Navigate nested property paths |
106
+ | `getPropertiesWithPropertiesOrder` | Apply display ordering to properties |
107
+ | `getEntityPreviewKeys` / `getEntityTitlePropertyKey` | Determine preview/title fields |
108
+ | `isReferenceProperty` / `isRelationProperty` | Property type guards |
109
+ | `mergeEntityActions` / `resolveEntityAction` / `resolveEntityView` | Action & view resolution |
110
+ | Path helpers | `addInitialSlash`, `removeInitialSlash`, `removeTrailingSlash`, etc. |
111
+
112
+ ## Quick Start
113
+
114
+ ```tsx
115
+ import { RebaseCMS } from "@rebasepro/admin";
116
+
117
+ function App() {
118
+ return (
119
+ <RebaseCMS
120
+ collections={[/* your collection configs */]}
121
+ authController={authController}
122
+ dataSource={dataSource}
123
+ />
124
+ );
125
+ }
126
+ ```
127
+
128
+ ## Related Packages
129
+
130
+ - [`@rebasepro/core`](../core) — Runtime hooks, providers, auth components, and context
131
+ - [`@rebasepro/ui`](../ui) — Design system components (buttons, dialogs, inputs, etc.)
132
+ - [`@rebasepro/common`](../common) — Shared utilities, collection registry, query builder
133
+ - [`@rebasepro/types`](../types) — TypeScript type definitions
134
+ - [`@rebasepro/formex`](../formex) — Form state management
135
+ - [`@rebasepro/schema-inference`](../schema-inference) — Schema introspection from databases
@@ -1,7 +1,7 @@
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 { bo as useCollectionsConfigController, N as FieldCaption, ai as SearchIconsView, aQ as getFieldConfig, a4 as PropertyConfigBadge, aS as getFullId, a_ as idToPropertiesPath, b2 as namespaceToPropertiesOrderPath, bA as validateCollectionJson, bn as useCollectionRegistryController, l as CollectionGenerationApiError, bm as useCollectionEditorController, S as ImportFileUpload, aW as getInferenceType, T as ImportNewPropertyFieldPreview, p as DataNewPropertiesMapping, aR as getFieldId, bv as useSelectionController, aD as convertDataToEntity, y as EntityCollectionTable, bs as useNavigationStateController, bq as useImportConfig, bz as useUrlController, U as ImportSaveInProgress, aT as getFullIdPath } from "./util-ZM9gQuCv.js";
4
+ import { bm as useCollectionsConfigController, N as FieldCaption, ag as SearchIconsView, aO as getFieldConfig, a4 as PropertyConfigBadge, aQ as getFullId, aY as idToPropertiesPath, b0 as namespaceToPropertiesOrderPath, by as validateCollectionJson, bl as useCollectionRegistryController, l as CollectionGenerationApiError, bk as useCollectionEditorController, S as ImportFileUpload, aU as getInferenceType, T as ImportNewPropertyFieldPreview, p as DataNewPropertiesMapping, aP as getFieldId, bt as useSelectionController, aB as convertDataToEntity, y as EntityCollectionTable, bq as useNavigationStateController, bo as useImportConfig, bx as useUrlController, U as ImportSaveInProgress, aR as getFullIdPath } from "./util-COYYD8zr.js";
5
5
  import * as React from "react";
6
6
  import React__default, { useState, useRef, useMemo, useEffect } from "react";
7
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";
@@ -22,7 +22,7 @@ import { buildPropertyFromData, buildEntityPropertiesFromData } from "@rebasepro
22
22
  import "date-fns";
23
23
  import "date-fns/locale";
24
24
  import "fuse.js";
25
- import { b as PropertyFormDialog, d as useAIModifiedPaths, c as PropertyTree, a as PropertyForm, s as supportedFields, u as updatePropertyFromWidget, A as AIModifiedPathsProvider } from "./PropertyEditView-CvRSV-A2.js";
25
+ import { b as PropertyFormDialog, d as useAIModifiedPaths, c as PropertyTree, a as PropertyForm, s as supportedFields, u as updatePropertyFromWidget, A as AIModifiedPathsProvider } from "./PropertyEditView-ChBleIbN.js";
26
26
  import JSON5 from "json5";
27
27
  import { Highlight, themes } from "prism-react-renderer";
28
28
  const CollectionEditorSchema = z.object({
@@ -3793,14 +3793,31 @@ function pgTypeToRebaseProperty(column) {
3793
3793
  properties: {}
3794
3794
  };
3795
3795
  case "array":
3796
- case "ARRAY":
3796
+ case "ARRAY": {
3797
+ let innerType = "string";
3798
+ let colType = void 0;
3799
+ if (udt_name === "_text" || udt_name === "_varchar") {
3800
+ innerType = "string";
3801
+ colType = "text[]";
3802
+ } else if (udt_name === "_int4" || udt_name === "_int2" || udt_name === "_int8") {
3803
+ innerType = "number";
3804
+ colType = "integer[]";
3805
+ } else if (udt_name === "_bool") {
3806
+ innerType = "boolean";
3807
+ colType = "boolean[]";
3808
+ } else if (udt_name === "_numeric") {
3809
+ innerType = "number";
3810
+ colType = "numeric[]";
3811
+ }
3797
3812
  return {
3798
3813
  type: "array",
3799
3814
  name: prettifiedName,
3815
+ columnType: colType,
3800
3816
  of: {
3801
- type: "string"
3817
+ type: innerType
3802
3818
  }
3803
3819
  };
3820
+ }
3804
3821
  default:
3805
3822
  return {
3806
3823
  type: "string",
@@ -4554,4 +4571,4 @@ export {
4554
4571
  CollectionEditor,
4555
4572
  CollectionEditorDialog
4556
4573
  };
4557
- //# sourceMappingURL=CollectionEditorDialog-D0VqpLPO.js.map
4574
+ //# sourceMappingURL=CollectionEditorDialog-C8E440oK.js.map