@rebasepro/cms-types 0.17.0-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 (78) hide show
  1. package/LICENSE +21 -0
  2. package/dist/admin_collection.d.ts +650 -0
  3. package/dist/augment.d.ts +81 -0
  4. package/dist/collections.d.ts +282 -0
  5. package/dist/controllers/analytics_controller.d.ts +7 -0
  6. package/dist/controllers/auth.d.ts +111 -0
  7. package/dist/controllers/customization_controller.d.ts +69 -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 +248 -0
  12. package/dist/controllers/registry.d.ts +96 -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 +45 -0
  16. package/dist/index.d.ts +18 -0
  17. package/dist/index.es.js +154 -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 +15 -0
  22. package/dist/types/builders.d.ts +15 -0
  23. package/dist/types/collection_views.d.ts +105 -0
  24. package/dist/types/component_overrides.d.ts +196 -0
  25. package/dist/types/entity_actions.d.ts +112 -0
  26. package/dist/types/entity_display.d.ts +148 -0
  27. package/dist/types/entity_link_builder.d.ts +7 -0
  28. package/dist/types/entity_views.d.ts +115 -0
  29. package/dist/types/export_import.d.ts +21 -0
  30. package/dist/types/form_layout.d.ts +126 -0
  31. package/dist/types/formex.d.ts +40 -0
  32. package/dist/types/index.d.ts +18 -0
  33. package/dist/types/locales.d.ts +4 -0
  34. package/dist/types/modify_collections.d.ts +5 -0
  35. package/dist/types/plugins.d.ts +277 -0
  36. package/dist/types/property_config.d.ts +74 -0
  37. package/dist/types/property_options.d.ts +255 -0
  38. package/dist/types/slots.d.ts +279 -0
  39. package/dist/types/translations.d.ts +989 -0
  40. package/dist/types/user_management_delegate.d.ts +22 -0
  41. package/package.json +103 -0
  42. package/src/admin_collection.ts +775 -0
  43. package/src/augment.ts +79 -0
  44. package/src/collections.ts +312 -0
  45. package/src/controllers/analytics_controller.tsx +57 -0
  46. package/src/controllers/auth.ts +122 -0
  47. package/src/controllers/customization_controller.tsx +81 -0
  48. package/src/controllers/dialogs_controller.tsx +37 -0
  49. package/src/controllers/index.ts +10 -0
  50. package/src/controllers/local_config_persistence.tsx +22 -0
  51. package/src/controllers/navigation.ts +288 -0
  52. package/src/controllers/registry.ts +114 -0
  53. package/src/controllers/side_dialogs_controller.tsx +82 -0
  54. package/src/controllers/side_panel_controller.tsx +112 -0
  55. package/src/controllers/snackbar.ts +51 -0
  56. package/src/index.ts +20 -0
  57. package/src/react_component_ref.ts +52 -0
  58. package/src/rebase_context.ts +81 -0
  59. package/src/types/breadcrumbs.ts +16 -0
  60. package/src/types/builders.ts +18 -0
  61. package/src/types/collection_views.tsx +125 -0
  62. package/src/types/component_overrides.ts +244 -0
  63. package/src/types/entity_actions.tsx +134 -0
  64. package/src/types/entity_display.ts +182 -0
  65. package/src/types/entity_link_builder.ts +8 -0
  66. package/src/types/entity_views.tsx +135 -0
  67. package/src/types/export_import.ts +26 -0
  68. package/src/types/form_layout.ts +137 -0
  69. package/src/types/formex.ts +45 -0
  70. package/src/types/index.ts +18 -0
  71. package/src/types/locales.ts +81 -0
  72. package/src/types/modify_collections.tsx +6 -0
  73. package/src/types/plugins.tsx +346 -0
  74. package/src/types/property_config.tsx +97 -0
  75. package/src/types/property_options.ts +300 -0
  76. package/src/types/slots.tsx +334 -0
  77. package/src/types/translations.ts +1104 -0
  78. package/src/types/user_management_delegate.ts +23 -0
@@ -0,0 +1,126 @@
1
+ import type { ColumnKey } from "../admin_collection.js";
2
+ /**
3
+ * The number of columns the form grid is divided into. A field's
4
+ * {@link AdminPropertyOptions.span} is expressed against this.
5
+ *
6
+ * Fixed rather than configurable on purpose: the whole point of a span is that
7
+ * two fields written by two different people line up, and they only do that if
8
+ * everyone is counting against the same grid.
9
+ *
10
+ * @group Models
11
+ */
12
+ export declare const FORM_GRID_COLUMNS = 4;
13
+ /**
14
+ * How wide a field sits on the {@link FORM_GRID_COLUMNS}-column form grid.
15
+ *
16
+ * `4` is the full width of the main column. A field always takes at least a
17
+ * whole row on narrow layouts (the side panel, the split pane, mobile), where
18
+ * the grid collapses to one column and spans are ignored.
19
+ *
20
+ * @group Entity properties
21
+ */
22
+ export type PropertySpan = 1 | 2 | 3 | 4;
23
+ /**
24
+ * A titled group of fields in the main column of the form.
25
+ *
26
+ * @group Models
27
+ */
28
+ export interface FormSection<M extends Record<string, unknown> = Record<string, unknown>> {
29
+ /**
30
+ * Stable identity for this section. Used as the React key and to remember
31
+ * the collapsed state across visits, so renaming `title` does not lose it.
32
+ */
33
+ key: string;
34
+ /**
35
+ * Shown above the group. A section with no title renders its fields with no
36
+ * heading and no rule — useful for the first group, which rarely needs one.
37
+ */
38
+ title?: string;
39
+ /**
40
+ * Property and additional-field keys in this section, in render order.
41
+ *
42
+ * Keys naming a property that does not exist, is hidden, or has been routed
43
+ * to {@link FormLayoutConfig.sidebar} are skipped. Any property *not* named
44
+ * by a section lands in the last section that has no explicit title, or in
45
+ * an untitled trailing group if there is none — a new column is never
46
+ * silently dropped from the form.
47
+ */
48
+ properties: ColumnKey<M>[];
49
+ /**
50
+ * Start collapsed. Defaults to `false`.
51
+ *
52
+ * Only meaningful when the section can be collapsed at all; a section with
53
+ * no `title` has nothing to click, so this is ignored there.
54
+ */
55
+ collapsed?: boolean;
56
+ /**
57
+ * Can the user collapse this section. Defaults to `true` for a titled
58
+ * section, `false` for an untitled one.
59
+ *
60
+ * A section holding a required field is still collapsible — but a
61
+ * validation error inside a collapsed section expands it, so an error can
62
+ * never hide.
63
+ */
64
+ collapsible?: boolean;
65
+ /**
66
+ * How this section arranges itself in the **read-only** view of a record.
67
+ * Defaults to `"grid"` — the same grid the form uses.
68
+ *
69
+ * `"summary"` stacks the fields as right-aligned label/value rows with the
70
+ * last one emphasised, which is what a run of related figures wants: a
71
+ * subtotal, a tax, a discount and a total are one calculation, and four
72
+ * equal cells on a four-column grid is the one arrangement that says they
73
+ * are unrelated. Opt in per section — nothing about a group of numbers tells
74
+ * us it adds up, so this is never derived.
75
+ *
76
+ * Read-only only, and named for it. The form goes on rendering the grid:
77
+ * a summary row is a reading arrangement, and shrinking a control to fit one
78
+ * would make the fields harder to edit to make them prettier to skim.
79
+ */
80
+ readVariant?: "grid" | "summary";
81
+ }
82
+ /**
83
+ * How the generated form is laid out.
84
+ *
85
+ * Everything here is optional, and the defaults are the point: with no config
86
+ * at all the layout is derived from the properties themselves —
87
+ *
88
+ * - the id and the `createdAt`/`updatedAt` timestamps go to the rail, read-only
89
+ * - short enums, booleans, dates and numbers take a narrow span
90
+ * - long text, markdown, arrays, maps and storage fields take the full width
91
+ * - everything else takes half
92
+ *
93
+ * so a collection that never mentions `form` still gets a two-column layout
94
+ * rather than one flat run of full-width fields. Use this block when the
95
+ * derived answer is wrong for your domain.
96
+ *
97
+ * @group Models
98
+ */
99
+ export interface FormLayoutConfig<M extends Record<string, unknown> = Record<string, unknown>> {
100
+ /**
101
+ * Property keys shown in the metadata rail beside the main column instead
102
+ * of in it — status, ownership, publication dates, flags.
103
+ *
104
+ * The rail is narrow and does not use the grid, so `span` is ignored for
105
+ * these. On layouts too narrow for a rail (the side panel, the split pane,
106
+ * mobile) they render as an ordinary leading section, so nothing is lost.
107
+ *
108
+ * Set to `[]` to suppress the derived rail entirely and keep every field in
109
+ * the main column.
110
+ */
111
+ sidebar?: ColumnKey<M>[];
112
+ /**
113
+ * Groups for the main column. When omitted, every field lands in a single
114
+ * untitled group, which is the pre-existing behaviour.
115
+ */
116
+ sections?: FormSection<M>[];
117
+ /**
118
+ * Show the read-only record block (id, created, updated) at the foot of the
119
+ * rail. Defaults to `true` when a rail is shown.
120
+ *
121
+ * This is what replaces `hideIdFromForm` for most collections: the id stops
122
+ * being a field in the middle of the form and becomes a copyable line of
123
+ * metadata.
124
+ */
125
+ showRecordMeta?: boolean;
126
+ }
@@ -0,0 +1,40 @@
1
+ import React, { FormEvent } from "react";
2
+ export type FormexController<T = unknown> = {
3
+ values: T;
4
+ initialValues: T;
5
+ setValues: (values: T) => void;
6
+ setFieldValue: (key: string, value: unknown, shouldValidate?: boolean) => void;
7
+ touched: Record<string, boolean>;
8
+ setFieldTouched: (key: string, touched: boolean, shouldValidate?: boolean) => void;
9
+ setTouched: (touched: Record<string, boolean>) => void;
10
+ dirty: boolean;
11
+ setDirty: (dirty: boolean) => void;
12
+ setSubmitCount: (submitCount: number) => void;
13
+ errors: Record<string, string>;
14
+ setFieldError: (key: string, error?: string) => void;
15
+ handleChange: (event: React.SyntheticEvent) => void;
16
+ handleBlur: (event: React.FocusEvent) => void;
17
+ handleSubmit: (event?: FormEvent<HTMLFormElement>) => void;
18
+ validate: () => void;
19
+ resetForm: (props?: FormexResetProps<T>) => void;
20
+ submitCount: number;
21
+ isSubmitting: boolean;
22
+ setSubmitting: (isSubmitting: boolean) => void;
23
+ isValidating: boolean;
24
+ /**
25
+ * The version of the form. This is incremented every time the form is reset
26
+ * or the form is submitted.
27
+ */
28
+ version: number;
29
+ debugId?: string;
30
+ undo: () => void;
31
+ redo: () => void;
32
+ canUndo: boolean;
33
+ canRedo: boolean;
34
+ };
35
+ export type FormexResetProps<T = unknown> = {
36
+ values?: T;
37
+ submitCount?: number;
38
+ errors?: Record<string, string>;
39
+ touched?: Record<string, boolean>;
40
+ };
@@ -0,0 +1,18 @@
1
+ export * from "./breadcrumbs.js";
2
+ export * from "./builders.js";
3
+ export * from "./collection_views.js";
4
+ export * from "./component_overrides.js";
5
+ export * from "./entity_actions.js";
6
+ export * from "./entity_link_builder.js";
7
+ export * from "./entity_display.js";
8
+ export * from "./entity_views.js";
9
+ export * from "./export_import.js";
10
+ export * from "./form_layout.js";
11
+ export * from "./formex.js";
12
+ export * from "./locales.js";
13
+ export * from "./modify_collections.js";
14
+ export * from "./plugins.js";
15
+ export * from "./property_config.js";
16
+ export * from "./slots.js";
17
+ export * from "./translations.js";
18
+ export * from "./user_management_delegate.js";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @group Models
3
+ */
4
+ export type Locale = "af" | "ar" | "arDZ" | "arMA" | "arSA" | "az" | "be" | "bg" | "bn" | "ca" | "cs" | "cy" | "da" | "de" | "el" | "enAU" | "enCA" | "enGB" | "enIN" | "enNZ" | "enUS" | "eo" | "es" | "et" | "eu" | "faIR" | "fi" | "fil" | "fr" | "frCA" | "frCH" | "gd" | "gl" | "gu" | "he" | "hi" | "hr" | "hu" | "hy" | "id" | "is" | "it" | "ja" | "ka" | "kk" | "kn" | "ko" | "lb" | "lt" | "lv" | "mk" | "ms" | "mt" | "nb" | "nl" | "nlBE" | "nn" | "pl" | "pt" | "ptBR" | "ro" | "ru" | "sk" | "sl" | "sr" | "srLatn" | "sv" | "ta" | "te" | "th" | "tr" | "ug" | "uk" | "uz" | "vi" | "zhCN" | "zhTW";
@@ -0,0 +1,5 @@
1
+ import type { AdminCollection } from "@rebasepro/cms-types";
2
+ export type ModifyCollectionProps = {
3
+ collection: AdminCollection;
4
+ parentPaths: string[];
5
+ };
@@ -0,0 +1,277 @@
1
+ import React, { PropsWithChildren } from "react";
2
+ import type { EntityStatus } from "@rebasepro/types";
3
+ import type { InferPropertyType, Property } from "@rebasepro/types";
4
+ import type { FormContext } from "./entity_views.js";
5
+ import type { RebaseContext } from "../rebase_context.js";
6
+ import type { NavigationGroupMapping, AppView } from "../controllers/navigation.js";
7
+ import type { User } from "@rebasepro/types";
8
+ import type { SlotContribution } from "./slots.js";
9
+ import type { AdminCollection } from "@rebasepro/cms-types";
10
+ /**
11
+ * Props interface for custom field components.
12
+ *
13
+ * The `@rebasepro/cms` package re-exports a narrower version of this
14
+ * interface that adds `formex` and layout-specific fields. This base
15
+ * definition captures the core contract that every field renderer must
16
+ * satisfy, regardless of where it is rendered.
17
+ *
18
+ * @typeParam P - The property type this field is bound to
19
+ * @typeParam CustomProps - Extra props injected via the property's `customProps`
20
+ * @typeParam M - The entity model type
21
+ * @group Form custom fields
22
+ */
23
+ export interface FieldProps<P extends Property = Property, CustomProps = unknown, M extends Record<string, unknown> = Record<string, unknown>> {
24
+ /** Key of the property (e.g. "user.name" for a nested path) */
25
+ propertyKey: string;
26
+ /** Current value of this field */
27
+ value: InferPropertyType<P> | null;
28
+ /** Set value of field directly */
29
+ setValue: (value: InferPropertyType<P> | null, shouldValidate?: boolean) => void;
30
+ /** Set value of a different field directly */
31
+ setFieldValue: (propertyKey: string, value: unknown, shouldValidate?: boolean) => void;
32
+ /** Is the form currently submitting */
33
+ isSubmitting?: boolean;
34
+ /** Should this field show the error indicator */
35
+ showError?: boolean;
36
+ /** Error message for this field, or undefined if valid */
37
+ error?: string;
38
+ /** Has this field been touched */
39
+ touched?: boolean;
40
+ /** Property related to this field */
41
+ property: P;
42
+ /** Should this field include a description */
43
+ includeDescription?: boolean;
44
+ /** Flag to indicate that the underlying value has been updated in the driver */
45
+ underlyingValueHasChanged?: boolean;
46
+ /** Is this field part of an array */
47
+ partOfArray?: boolean;
48
+ /** Is this field part of a block */
49
+ partOfBlock?: boolean;
50
+ /** Display the child properties directly, without being wrapped in an extendable panel */
51
+ minimalistView?: boolean;
52
+ /** Should this field autofocus on mount */
53
+ autoFocus?: boolean;
54
+ /** Additional properties set by the developer */
55
+ customProps?: CustomProps;
56
+ /** Additional values related to the state of the form or the entity */
57
+ context: FormContext<M>;
58
+ /** Flag to indicate if this field should be disabled */
59
+ disabled?: boolean;
60
+ /** Size of the field */
61
+ size?: "small" | "medium" | "large";
62
+ /** Callback when internal property state changes (e.g. panel expansion) */
63
+ onPropertyChange?: (property: Partial<Property>) => void;
64
+ }
65
+ /**
66
+ * Interface used to define plugins for Rebase.
67
+ * Plugins contribute UI via **slots**, wrap subtrees with **providers**,
68
+ * and inject behavioral logic via **hooks**.
69
+ * @group Core
70
+ */
71
+ export interface RebasePlugin {
72
+ /**
73
+ * Unique key identifying this plugin.
74
+ */
75
+ key: string;
76
+ /**
77
+ * If true, no admin content is shown until this plugin finishes loading.
78
+ */
79
+ loading?: boolean;
80
+ /**
81
+ * UI slot contributions rendered at the matching extension points.
82
+ */
83
+ slots?: SlotContribution[];
84
+ /**
85
+ * HOC providers wrapping root or form content.
86
+ * Providers with `scope: "root"` wrap the entire admin below RebaseContext.
87
+ * Providers with `scope: "form"` wrap each entity form/edit view.
88
+ */
89
+ providers?: PluginProvider[];
90
+ /**
91
+ * Behavioral hooks (non-UI) — collection modification, search blocking,
92
+ * column reordering, navigation entries, etc.
93
+ */
94
+ hooks?: PluginHooks;
95
+ /**
96
+ * Field wrapping for custom field rendering (e.g. data enhancement).
97
+ */
98
+ fieldBuilder?: FieldBuilderConfig;
99
+ /**
100
+ * Views to be automatically added to the navigation.
101
+ */
102
+ views?: AppView[];
103
+ /**
104
+ * Optional lifecycle hooks. Called by the Rebase runtime
105
+ * at appropriate points in the app lifecycle.
106
+ */
107
+ lifecycle?: PluginLifecycle;
108
+ }
109
+ /**
110
+ * A HOC provider that wraps a subtree of the admin.
111
+ * @group Plugins
112
+ */
113
+ export interface PluginProvider {
114
+ /**
115
+ * `"root"` — wraps the entire admin below RebaseContext.
116
+ * `"form"` — wraps each entity form / edit view.
117
+ */
118
+ scope: "root" | "form";
119
+ /**
120
+ * The provider component. Must accept `children`.
121
+ * Typed loosely because extra props are passed via the `props` field;
122
+ * strict signatures cause contravariance issues.
123
+ */
124
+ Component: React.ComponentType<PropsWithChildren<Record<string, unknown>>>;
125
+ /**
126
+ * Additional props passed to the Component.
127
+ */
128
+ props?: Record<string, unknown>;
129
+ }
130
+ /**
131
+ * Behavioral hooks that a plugin can provide.
132
+ * These are non-UI extension points for modifying admin behavior.
133
+ * @group Plugins
134
+ */
135
+ export interface PluginHooks {
136
+ /**
137
+ * Modify a single collection before it is rendered (synchronous).
138
+ */
139
+ modifyCollection?: (collection: AdminCollection) => AdminCollection;
140
+ /**
141
+ * Async version of modifyCollection — supports fetching remote config.
142
+ * Runs during navigation resolution. If provided alongside `modifyCollection`,
143
+ * the sync version runs first, then the async version.
144
+ */
145
+ modifyCollectionAsync?: (collection: AdminCollection) => Promise<AdminCollection>;
146
+ /**
147
+ * Modify, add or remove collections.
148
+ */
149
+ injectCollections?: (collections: AdminCollection[]) => AdminCollection[];
150
+ /**
151
+ * Callback called when columns are reordered via drag and drop.
152
+ */
153
+ onColumnsReorder?: (props: {
154
+ fullPath: string;
155
+ parentCollectionSlugs: string[];
156
+ parentEntityIds: string[];
157
+ collection: AdminCollection;
158
+ newPropertiesOrder: string[];
159
+ }) => void;
160
+ /**
161
+ * Callback called when Kanban board columns are reordered.
162
+ */
163
+ onKanbanColumnsReorder?: (props: {
164
+ fullPath: string;
165
+ parentCollectionSlugs: string[];
166
+ parentEntityIds: string[];
167
+ collection: AdminCollection;
168
+ kanbanColumnProperty: string;
169
+ newColumnsOrder: string[];
170
+ }) => void;
171
+ /**
172
+ * Navigation entries contributed by this plugin.
173
+ */
174
+ navigationEntries?: NavigationGroupMapping[];
175
+ /**
176
+ * Callback when navigation entry order changes (e.g. drag-and-drop).
177
+ */
178
+ onNavigationEntriesUpdate?: (entries: NavigationGroupMapping[]) => void;
179
+ /**
180
+ * Allow reordering collections in the home page via drag and drop.
181
+ */
182
+ allowDragAndDrop?: boolean;
183
+ }
184
+ /**
185
+ * Lifecycle hooks for plugins. Called by the Rebase runtime
186
+ * at appropriate points in the app lifecycle.
187
+ * @group Plugins
188
+ */
189
+ export interface PluginLifecycle {
190
+ /**
191
+ * Called once when the plugin is mounted in the Rebase tree.
192
+ * Can return a Promise for async initialization.
193
+ */
194
+ onMount?: (context: RebaseContext) => void | Promise<void>;
195
+ /**
196
+ * Called when the plugin is unmounted from the Rebase tree.
197
+ * Use this for cleanup (subscriptions, timers, etc.).
198
+ */
199
+ onUnmount?: () => void;
200
+ /**
201
+ * Called whenever the authentication state changes.
202
+ * Receives the new user (or null on sign-out).
203
+ */
204
+ onAuthStateChange?: (user: User | null) => void;
205
+ /**
206
+ * Called when a collection's visible entities change.
207
+ * Useful for analytics, caching, or cross-plugin coordination.
208
+ */
209
+ onCollectionChange?: (slug: string, entities: unknown[]) => void;
210
+ }
211
+ /**
212
+ * Configuration for wrapping form field components.
213
+ * @group Plugins
214
+ */
215
+ export interface FieldBuilderConfig {
216
+ /**
217
+ * Returns a wrapped field component, or null to skip wrapping.
218
+ */
219
+ wrap: <T>(params: PluginFieldBuilderParams) => React.ComponentType<FieldProps<Property>> | null;
220
+ /**
221
+ * Optional guard — return false to skip wrapping for this field.
222
+ */
223
+ enabled?: (params: PluginFieldBuilderParams) => boolean;
224
+ }
225
+ /**
226
+ * Props passed to home page collection card action components.
227
+ * @group Models
228
+ */
229
+ export interface PluginHomePageActionsProps<EP extends object = object, M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User, EC extends AdminCollection<M> = AdminCollection<M>> {
230
+ slug: string;
231
+ collection: EC;
232
+ context: RebaseContext<USER>;
233
+ }
234
+ /**
235
+ * Props passed to form action components in entity edit/form views.
236
+ * @group Models
237
+ */
238
+ export interface PluginFormActionProps<USER extends User = User, EC extends AdminCollection = AdminCollection> {
239
+ entityId?: string | number;
240
+ path: string;
241
+ parentCollectionSlugs: string[];
242
+ parentEntityIds: string[];
243
+ status: EntityStatus;
244
+ collection: EC;
245
+ disabled: boolean;
246
+ formContext?: FormContext;
247
+ context: RebaseContext<USER>;
248
+ openEntityMode?: "side_panel" | "full_screen" | "split" | "dialog";
249
+ }
250
+ /**
251
+ * Parameters passed to the field builder wrap function.
252
+ * @group Models
253
+ */
254
+ export type PluginFieldBuilderParams<M extends Record<string, unknown> = Record<string, unknown>, EC extends AdminCollection<M> = AdminCollection<M>> = {
255
+ fieldConfigId: string;
256
+ propertyKey: string;
257
+ property: Property;
258
+ Field: React.ComponentType<FieldProps<Property, unknown, M>>;
259
+ plugin: RebasePlugin;
260
+ path?: string;
261
+ collection?: EC;
262
+ };
263
+ /**
264
+ * Generic props passed to plugin components that just need admin context.
265
+ * @group Models
266
+ */
267
+ export interface PluginGenericProps<USER extends User = User> {
268
+ context: RebaseContext<USER>;
269
+ }
270
+ /**
271
+ * Props for additional card components in the home page.
272
+ * @group Models
273
+ */
274
+ export interface PluginHomePageAdditionalCardsProps<USER extends User = User> {
275
+ group?: string;
276
+ context: RebaseContext<USER>;
277
+ }
@@ -0,0 +1,74 @@
1
+ import React from "react";
2
+ import { ArrayProperty, MapProperty, StringProperty, NumberProperty, BooleanProperty, DateProperty, GeopointProperty, ReferenceProperty, RelationProperty, VectorProperty, BinaryProperty } from "@rebasepro/types";
3
+ import { BaseProperty } from "@rebasepro/types";
4
+ type AdminBasePropertyNoName = Omit<BaseProperty, "name">;
5
+ export type ConfigProperty = (Omit<StringProperty, "name"> & {
6
+ name?: string;
7
+ } & AdminBasePropertyNoName) | (Omit<NumberProperty, "name"> & {
8
+ name?: string;
9
+ } & AdminBasePropertyNoName) | (Omit<BooleanProperty, "name"> & {
10
+ name?: string;
11
+ } & AdminBasePropertyNoName) | (Omit<DateProperty, "name"> & {
12
+ name?: string;
13
+ } & AdminBasePropertyNoName) | (Omit<GeopointProperty, "name"> & {
14
+ name?: string;
15
+ } & AdminBasePropertyNoName) | (Omit<ReferenceProperty, "name"> & {
16
+ name?: string;
17
+ } & AdminBasePropertyNoName) | (Omit<RelationProperty, "name"> & {
18
+ name?: string;
19
+ } & AdminBasePropertyNoName) | (Omit<ArrayProperty, "name" | "of" | "oneOf"> & {
20
+ name?: string;
21
+ of?: ConfigProperty | ConfigProperty[];
22
+ oneOf?: {
23
+ properties: Record<string, ConfigProperty>;
24
+ typeField?: string;
25
+ valueField?: string;
26
+ propertiesOrder?: string[];
27
+ };
28
+ } & AdminBasePropertyNoName) | (Omit<MapProperty, "name" | "properties"> & {
29
+ name?: string;
30
+ properties?: Record<string, ConfigProperty>;
31
+ } & AdminBasePropertyNoName) | (Omit<VectorProperty, "name"> & {
32
+ name?: string;
33
+ } & AdminBasePropertyNoName) | (Omit<BinaryProperty, "name"> & {
34
+ name?: string;
35
+ } & AdminBasePropertyNoName);
36
+ /**
37
+ * This is the configuration object for a property.
38
+ * These configs are generated by default for the properties defined in your
39
+ * collections' configuration, but you can define your own to be used.
40
+ */
41
+ export type PropertyConfig = {
42
+ /**
43
+ * Key used to identify this property config.
44
+ */
45
+ key: PropertyConfigId | string;
46
+ /**
47
+ * Name of this field type.
48
+ * This is not the name of the property.
49
+ */
50
+ name: string;
51
+ /**
52
+ * Default config for the property.
53
+ * This property or builder will be used as the base values for the resulting property.
54
+ * You can also use a builder function to generate the base property.
55
+ */
56
+ property: ConfigProperty;
57
+ /**
58
+ * Optional icon to be used in the field selector.
59
+ * Use a 24x24 component, in order not to break the layout.
60
+ * Any Rebase icon can be used.
61
+ */
62
+ Icon?: React.ComponentType;
63
+ /**
64
+ * CSS color, used only in some plugins like the field selector.
65
+ * e.g. "#2d7ff9"
66
+ */
67
+ color?: string;
68
+ /**
69
+ * Description of this field type.
70
+ */
71
+ description?: string;
72
+ };
73
+ export type PropertyConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "user_select" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "multi_references" | "relation" | "switch" | "date_time" | "repeat" | "custom_array" | "block" | "vector_input" | "geopoint" | "binary";
74
+ export {};