@rebasepro/admin-types 0.10.1-canary.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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/dist/admin_collection.d.ts +464 -0
  3. package/dist/augment.d.ts +66 -0
  4. package/dist/collections.d.ts +226 -0
  5. package/dist/controllers/analytics_controller.d.ts +7 -0
  6. package/dist/controllers/auth.d.ts +110 -0
  7. package/dist/controllers/customization_controller.d.ts +61 -0
  8. package/dist/controllers/dialogs_controller.d.ts +36 -0
  9. package/dist/controllers/index.d.ts +10 -0
  10. package/dist/controllers/local_config_persistence.d.ts +20 -0
  11. package/dist/controllers/navigation.d.ts +225 -0
  12. package/dist/controllers/registry.d.ts +80 -0
  13. package/dist/controllers/side_dialogs_controller.d.ts +67 -0
  14. package/dist/controllers/side_panel_controller.d.ts +97 -0
  15. package/dist/controllers/snackbar.d.ts +24 -0
  16. package/dist/index.d.ts +18 -0
  17. package/dist/index.es.js +92 -0
  18. package/dist/index.es.js.map +1 -0
  19. package/dist/react_component_ref.d.ts +43 -0
  20. package/dist/rebase_context.d.ts +68 -0
  21. package/dist/types/breadcrumbs.d.ts +26 -0
  22. package/dist/types/builders.d.ts +15 -0
  23. package/dist/types/component_overrides.d.ts +196 -0
  24. package/dist/types/entity_actions.d.ts +105 -0
  25. package/dist/types/entity_link_builder.d.ts +7 -0
  26. package/dist/types/entity_views.d.ts +95 -0
  27. package/dist/types/export_import.d.ts +21 -0
  28. package/dist/types/formex.d.ts +40 -0
  29. package/dist/types/index.d.ts +15 -0
  30. package/dist/types/locales.d.ts +4 -0
  31. package/dist/types/modify_collections.d.ts +5 -0
  32. package/dist/types/plugins.d.ts +277 -0
  33. package/dist/types/property_config.d.ts +74 -0
  34. package/dist/types/property_options.d.ts +154 -0
  35. package/dist/types/slots.d.ts +263 -0
  36. package/dist/types/translations.d.ts +915 -0
  37. package/dist/types/user_management_delegate.d.ts +22 -0
  38. package/package.json +103 -0
  39. package/src/admin_collection.ts +582 -0
  40. package/src/augment.ts +60 -0
  41. package/src/collections.ts +256 -0
  42. package/src/controllers/analytics_controller.tsx +57 -0
  43. package/src/controllers/auth.ts +121 -0
  44. package/src/controllers/customization_controller.tsx +72 -0
  45. package/src/controllers/dialogs_controller.tsx +37 -0
  46. package/src/controllers/index.ts +10 -0
  47. package/src/controllers/local_config_persistence.tsx +22 -0
  48. package/src/controllers/navigation.ts +264 -0
  49. package/src/controllers/registry.ts +96 -0
  50. package/src/controllers/side_dialogs_controller.tsx +82 -0
  51. package/src/controllers/side_panel_controller.tsx +112 -0
  52. package/src/controllers/snackbar.ts +29 -0
  53. package/src/index.ts +20 -0
  54. package/src/react_component_ref.ts +52 -0
  55. package/src/rebase_context.ts +81 -0
  56. package/src/types/breadcrumbs.ts +27 -0
  57. package/src/types/builders.ts +18 -0
  58. package/src/types/component_overrides.ts +244 -0
  59. package/src/types/entity_actions.tsx +127 -0
  60. package/src/types/entity_link_builder.ts +8 -0
  61. package/src/types/entity_views.tsx +114 -0
  62. package/src/types/export_import.ts +26 -0
  63. package/src/types/formex.ts +45 -0
  64. package/src/types/index.ts +15 -0
  65. package/src/types/locales.ts +81 -0
  66. package/src/types/modify_collections.tsx +6 -0
  67. package/src/types/plugins.tsx +346 -0
  68. package/src/types/property_config.tsx +95 -0
  69. package/src/types/property_options.ts +169 -0
  70. package/src/types/slots.tsx +309 -0
  71. package/src/types/translations.ts +1026 -0
  72. package/src/types/user_management_delegate.ts +23 -0
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Per-property presentation options.
3
+ *
4
+ * These lived in `@rebasepro/types` next to the property types they belong to, which
5
+ * meant a BaaS install shipped `Field`, `Preview`, `columnWidth` and `hideFromCollection`
6
+ * in its type surface with nothing to render them. They are attached to the property
7
+ * types by `augment.ts` instead.
8
+ */
9
+ import type { ComponentRef, WhereFilterOp } from "@rebasepro/types";
10
+
11
+ /**
12
+ * Interface including all common properties of a CMS property.
13
+ * @group Entity properties
14
+ */
15
+ export interface AdminPropertyOptions<CustomProps = unknown> {
16
+ columnWidth?: number;
17
+ hideFromCollection?: boolean;
18
+ readOnly?: boolean;
19
+ disabled?: boolean | PropertyDisabledConfig;
20
+ widthPercentage?: number;
21
+ customProps?: CustomProps;
22
+ Field?: ComponentRef<any>;
23
+ Preview?: ComponentRef<any>;
24
+
25
+ /**
26
+ * Narrow the filter operators offered for this property in collection
27
+ * filter UIs (table header filters and the Filters dialog).
28
+ *
29
+ * The final offered set is the **intersection** of the engine's
30
+ * capabilities, the property-type defaults, and this list — you can only
31
+ * *restrict*, never enable an operator the underlying engine cannot run.
32
+ *
33
+ * Pass an empty array to disable filtering on this property entirely.
34
+ *
35
+ * @example
36
+ * // Email column: exact match, contains, and null check only
37
+ * admin: { filterOperators: ["==", "ilike", "is-null"] }
38
+ */
39
+ filterOperators?: readonly WhereFilterOp[];
40
+
41
+ /**
42
+ * Replace the filter field rendered for this property in collection
43
+ * filter UIs. The component receives `FilterFieldBindingProps`
44
+ * (property, resolved `operators`, `value`, `setValue`, …).
45
+ *
46
+ * Takes precedence over the collection-level
47
+ * `components["Collection.FilterField"]` override and the built-in
48
+ * per-type filter fields.
49
+ */
50
+ Filter?: ComponentRef<any>;
51
+ }
52
+
53
+ /**
54
+ * @group Entity properties
55
+ */
56
+ export interface AdminStringOptions extends AdminPropertyOptions {
57
+ /**
58
+ * Is this string property long enough so it should be displayed in
59
+ * a multiple line field. Defaults to false. If set to true,
60
+ * the number of lines adapts to the content
61
+ */
62
+ multiline?: boolean;
63
+ /**
64
+ * Should this string property be displayed as a markdown field. If true,
65
+ * the field is rendered as a text editor that supports markdown highlight
66
+ * syntax. It also includes a preview of the result.
67
+ */
68
+ markdown?: boolean;
69
+ /**
70
+ * Should this string be rendered as a tag instead of just text.
71
+ */
72
+ previewAsTag?: boolean;
73
+ clearable?: boolean;
74
+ /**
75
+ * How to render a string that holds a URL: a link, or one of the supported
76
+ * media types for an inline preview.
77
+ *
78
+ * Only presentation. Whether the string *is* a URL is `url` on the property
79
+ * itself, which is what the OpenAPI contract is generated from.
80
+ */
81
+ urlPreview?: PreviewType;
82
+ }
83
+
84
+ /**
85
+ * @group Entity properties
86
+ */
87
+ export interface AdminNumberOptions extends AdminPropertyOptions {
88
+ clearable?: boolean;
89
+ }
90
+
91
+ /**
92
+ * @group Entity properties
93
+ */
94
+ export interface AdminVectorOptions extends AdminPropertyOptions {
95
+ clearable?: boolean;
96
+ }
97
+
98
+ /**
99
+ * @group Entity properties
100
+ */
101
+ export interface AdminDateOptions extends AdminPropertyOptions {
102
+ /**
103
+ * Add an icon to clear the value and set it to `null`. Defaults to `false`
104
+ */
105
+ clearable?: boolean;
106
+ }
107
+
108
+ /**
109
+ * @group Entity properties
110
+ */
111
+ export interface AdminReferenceOptions extends AdminPropertyOptions {
112
+ previewProperties?: string[];
113
+ }
114
+
115
+ /**
116
+ * @group Entity properties
117
+ */
118
+ export interface AdminRelationOptions extends AdminPropertyOptions {
119
+ previewProperties?: string[];
120
+ widget?: "select" | "dialog";
121
+ }
122
+
123
+ /**
124
+ * @group Entity properties
125
+ */
126
+ export interface AdminArrayOptions extends AdminPropertyOptions {
127
+ expanded?: boolean;
128
+ minimalistView?: boolean;
129
+ }
130
+
131
+ /**
132
+ * @group Entity properties
133
+ */
134
+ export interface AdminMapOptions extends AdminPropertyOptions {
135
+ expanded?: boolean;
136
+ minimalistView?: boolean;
137
+ spreadChildren?: boolean;
138
+ }
139
+
140
+ /**
141
+ * @group Entity properties
142
+ */
143
+ export interface PropertyDisabledConfig {
144
+ /**
145
+ * Enable this flag if you would like to clear the value of the field
146
+ * when the corresponding property gets disabled.
147
+ *
148
+ * This is useful for keeping data consistency when you have conditional
149
+ * properties.
150
+ */
151
+ clearOnDisabled?: boolean;
152
+
153
+ /**
154
+ * Explanation of why this property is disabled (e.g. a different field
155
+ * needs to be enabled)
156
+ */
157
+ disabledMessage?: string;
158
+
159
+ /**
160
+ * Set this flag to true if you want to hide this field when disabled
161
+ */
162
+ hidden?: boolean;
163
+ }
164
+
165
+ /**
166
+ * Used for previewing urls if the download file is known
167
+ * @group Entity properties
168
+ */
169
+ export type PreviewType = "image" | "video" | "audio" | "file";
@@ -0,0 +1,309 @@
1
+ import React from "react";
2
+
3
+ import type { CollectionActionsProps, EntityTableController, SelectionController } from "../collections";
4
+ import type { Entity } from "@rebasepro/types";
5
+ import type { PluginFormActionProps, PluginGenericProps, PluginHomePageActionsProps, PluginHomePageAdditionalCardsProps } from "./plugins";
6
+ import type { Property } from "@rebasepro/types";
7
+ import type { RebaseContext } from "../rebase_context";
8
+ import type { AdminCollection } from "@rebasepro/admin-types";
9
+
10
+ /**
11
+ * Registry mapping slot names to their component prop types.
12
+ * Each key represents a UI extension point in the CMS.
13
+ * @group Plugins
14
+ */
15
+ export interface SlotRegistry {
16
+ // ── Home page ─────────────────────────────────────────────────────
17
+ "home.actions": PluginGenericProps;
18
+ "home.cards": PluginHomePageAdditionalCardsProps;
19
+ "home.children.start": PluginGenericProps;
20
+ "home.children.end": PluginGenericProps;
21
+ /** Compact insight widget rendered inline in a home page collection card. */
22
+ "home.card.insight": HomeCardInsightSlotProps;
23
+ "home.collection.actions": PluginHomePageActionsProps;
24
+
25
+ // ── Navigation / Drawer ───────────────────────────────────────────
26
+ /** Rendered below the logo in the sidebar drawer. */
27
+ "navigation.header": NavigationSlotProps;
28
+ /** Rendered above the collapse toggle at the bottom of the drawer. */
29
+ "navigation.footer": NavigationSlotProps;
30
+
31
+ // ── Collection view ───────────────────────────────────────────────
32
+ "collection.actions": CollectionActionsProps;
33
+ "collection.actions.start": CollectionActionsProps;
34
+ "collection.header.action": CollectionHeaderActionProps;
35
+ "collection.add-column": CollectionAddColumnProps;
36
+ "collection.error": CollectionErrorProps;
37
+ /** Extra widgets rendered inside the collection toolbar row. */
38
+ "collection.toolbar": CollectionToolbarProps;
39
+ /** Custom empty-state component when a collection has no data. */
40
+ "collection.empty-state": CollectionEmptyStateProps;
41
+ /** Insight widgets rendered above the collection table. */
42
+ "collection.insights": CollectionInsightsSlotProps;
43
+
44
+ // ── Entity / Form ─────────────────────────────────────────────────
45
+ "form.actions": PluginFormActionProps;
46
+ "form.actions.top": PluginFormActionProps;
47
+ /** Rendered before the form title / field list. */
48
+ "form.before": PluginFormActionProps;
49
+ /** Rendered after the form field list. */
50
+ "form.after": PluginFormActionProps;
51
+
52
+ // ── Entity row actions ────────────────────────────────────────────
53
+ /** Per-row actions in entity tables (e.g. bulk actions, row context menus). */
54
+ "entity.row.actions": EntityRowActionsProps;
55
+
56
+ // ── Entity field decoration ───────────────────────────────────────
57
+ /** Inject UI before an individual form field. */
58
+ "entity.field.before": EntityFieldSlotProps;
59
+ /** Inject UI after an individual form field. */
60
+ "entity.field.after": EntityFieldSlotProps;
61
+
62
+ // ── Collection filter panel ───────────────────────────────────────
63
+ /** Custom filter sidebar for a collection. */
64
+ "collection.filter-panel": CollectionFilterPanelProps;
65
+
66
+ // ── Dashboard ─────────────────────────────────────────────────────
67
+ /** Widget rendered on the dashboard / home page. */
68
+ "dashboard.widget": DashboardWidgetProps;
69
+
70
+ // ── Global ────────────────────────────────────────────────────────
71
+ /** Cross-collection search bar component. */
72
+ "global.search": GlobalSearchProps;
73
+ /** Top-level toolbar actions rendered in the shell toolbar area. */
74
+ "shell.toolbar": ShellToolbarProps;
75
+
76
+ // ── Kanban ────────────────────────────────────────────────────────
77
+ "kanban.setup": KanbanSetupProps;
78
+ "kanban.add-column": KanbanAddColumnProps;
79
+ }
80
+
81
+ /**
82
+ * Valid slot names for UI extension points.
83
+ * @group Plugins
84
+ */
85
+ export type SlotName = keyof SlotRegistry;
86
+
87
+ /**
88
+ * A single UI component contribution to a named slot.
89
+ * @group Plugins
90
+ */
91
+ export interface SlotContribution<K extends SlotName = SlotName> {
92
+ /**
93
+ * Which slot to contribute to.
94
+ */
95
+ slot: K;
96
+
97
+ /**
98
+ * The component to render in the slot.
99
+ * Typed loosely so mixed-slot arrays work.
100
+ * Type safety is provided at the `useSlot` call site.
101
+ */
102
+ Component: React.ComponentType<any>;
103
+
104
+ /**
105
+ * Additional props to merge into the slot props before rendering.
106
+ */
107
+ props?: Record<string, unknown>;
108
+
109
+ /**
110
+ * Ordering hint. Lower values render first. Defaults to 50.
111
+ */
112
+ order?: number;
113
+ }
114
+
115
+ // ── Prop interfaces for slots ─────────────────────────────────────────
116
+
117
+ /**
118
+ * Props for `navigation.header` and `navigation.footer` slots.
119
+ * @group Plugins
120
+ */
121
+ export interface NavigationSlotProps {
122
+ drawerOpen: boolean;
123
+ drawerHovered: boolean;
124
+ context: RebaseContext;
125
+ }
126
+
127
+ /**
128
+ * Props for the `collection.toolbar` slot.
129
+ * @group Plugins
130
+ */
131
+ export interface CollectionToolbarProps {
132
+ path: string;
133
+ collection: AdminCollection;
134
+ parentCollectionSlugs: string[];
135
+ parentEntityIds: string[];
136
+ tableController: EntityTableController;
137
+ selectionController: SelectionController;
138
+ }
139
+
140
+ /**
141
+ * Props for the `collection.empty-state` slot.
142
+ * @group Plugins
143
+ */
144
+ export interface CollectionEmptyStateProps {
145
+ path: string;
146
+ collection: AdminCollection;
147
+ parentCollectionSlugs: string[];
148
+ parentEntityIds: string[];
149
+ canCreate: boolean;
150
+ onNewClick?: () => void;
151
+ }
152
+
153
+ /**
154
+ * Props for the `collection.header.action` slot.
155
+ * @group Plugins
156
+ */
157
+ export interface CollectionHeaderActionProps {
158
+ property: Property;
159
+ propertyKey: string;
160
+ path: string;
161
+ parentCollectionSlugs: string[];
162
+ parentEntityIds: string[];
163
+ onHover: boolean;
164
+ collection: AdminCollection;
165
+ tableController: EntityTableController;
166
+ }
167
+
168
+ /**
169
+ * Props for the `collection.add-column` slot.
170
+ * @group Plugins
171
+ */
172
+ export interface CollectionAddColumnProps {
173
+ path: string;
174
+ parentCollectionSlugs: string[];
175
+ parentEntityIds: string[];
176
+ collection: AdminCollection;
177
+ tableController: EntityTableController;
178
+ }
179
+
180
+ /**
181
+ * Props for the `collection.error` slot.
182
+ * @group Plugins
183
+ */
184
+ export interface CollectionErrorProps {
185
+ path: string;
186
+ collection: AdminCollection;
187
+ parentCollectionSlugs?: string[];
188
+ parentEntityIds?: string[];
189
+ error: Error;
190
+ }
191
+
192
+ /**
193
+ * Props for the `kanban.setup` slot.
194
+ * @group Plugins
195
+ */
196
+ export interface KanbanSetupProps {
197
+ collection: AdminCollection;
198
+ fullPath: string;
199
+ parentCollectionSlugs: string[];
200
+ parentEntityIds: string[];
201
+ }
202
+
203
+ /**
204
+ * Props for the `kanban.add-column` slot.
205
+ * @group Plugins
206
+ */
207
+ export interface KanbanAddColumnProps {
208
+ collection: AdminCollection;
209
+ fullPath: string;
210
+ parentCollectionSlugs: string[];
211
+ parentEntityIds: string[];
212
+ columnProperty: string;
213
+ }
214
+
215
+ // ── New slot prop interfaces ──────────────────────────────────────────
216
+
217
+ /**
218
+ * Props for `entity.row.actions` slot.
219
+ * Rendered for each row in a entity collection table.
220
+ * @group Plugins
221
+ */
222
+ export interface EntityRowActionsProps {
223
+ entity: Entity;
224
+ entityId: string;
225
+ path: string;
226
+ collection: AdminCollection;
227
+ parentCollectionSlugs: string[];
228
+ parentEntityIds: string[];
229
+ selectionController: SelectionController;
230
+ context: RebaseContext;
231
+ }
232
+
233
+ /**
234
+ * Props for `entity.field.before` and `entity.field.after` slots.
235
+ * Rendered around individual form fields in the entity edit view.
236
+ * @group Plugins
237
+ */
238
+ export interface EntityFieldSlotProps {
239
+ propertyKey: string;
240
+ property: Property;
241
+ path: string;
242
+ entityId?: string | number;
243
+ collection: AdminCollection;
244
+ context: RebaseContext;
245
+ }
246
+
247
+ /**
248
+ * Props for `collection.filter-panel` slot.
249
+ * Custom filter sidebar rendered alongside the collection table.
250
+ * @group Plugins
251
+ */
252
+ export interface CollectionFilterPanelProps {
253
+ path: string;
254
+ collection: AdminCollection;
255
+ parentCollectionSlugs: string[];
256
+ parentEntityIds: string[];
257
+ tableController: EntityTableController;
258
+ context: RebaseContext;
259
+ }
260
+
261
+ /**
262
+ * Props for `dashboard.widget` slot.
263
+ * Widgets rendered on the home / dashboard page.
264
+ * @group Plugins
265
+ */
266
+ export interface DashboardWidgetProps {
267
+ context: RebaseContext;
268
+ }
269
+
270
+ /**
271
+ * Props for `global.search` slot.
272
+ * Cross-collection search bar rendered in the app shell.
273
+ * @group Plugins
274
+ */
275
+ export interface GlobalSearchProps {
276
+ context: RebaseContext;
277
+ }
278
+
279
+ /**
280
+ * Props for `shell.toolbar` slot.
281
+ * Actions rendered in the top-level toolbar / app bar area.
282
+ * @group Plugins
283
+ */
284
+ export interface ShellToolbarProps {
285
+ context: RebaseContext;
286
+ }
287
+
288
+ /**
289
+ * Props for `collection.insights` slot.
290
+ * Insight widgets rendered above the collection table.
291
+ * @group Plugins
292
+ */
293
+ export interface CollectionInsightsSlotProps {
294
+ path: string;
295
+ collection: AdminCollection;
296
+ parentCollectionSlugs: string[];
297
+ parentEntityIds: string[];
298
+ }
299
+
300
+ /**
301
+ * Props for `home.card.insight` slot.
302
+ * Compact insight rendered inline in a home page collection card.
303
+ * @group Plugins
304
+ */
305
+ export interface HomeCardInsightSlotProps {
306
+ slug: string;
307
+ collection: AdminCollection;
308
+ context: RebaseContext;
309
+ }