@rebasepro/types 0.0.1-canary.eae7889 → 0.1.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.
- package/dist/controllers/auth.d.ts +8 -2
- package/dist/controllers/client.d.ts +13 -0
- package/dist/controllers/collection_registry.d.ts +2 -1
- package/dist/controllers/data_driver.d.ts +36 -1
- package/dist/controllers/navigation.d.ts +18 -6
- package/dist/controllers/registry.d.ts +9 -1
- package/dist/controllers/side_entity_controller.d.ts +7 -0
- package/dist/index.es.js +4 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +4 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/rebase_context.d.ts +17 -0
- package/dist/types/backend_hooks.d.ts +187 -0
- package/dist/types/collections.d.ts +31 -11
- package/dist/types/component_ref.d.ts +47 -0
- package/dist/types/cron.d.ts +1 -1
- package/dist/types/entity_views.d.ts +6 -7
- package/dist/types/formex.d.ts +40 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/plugins.d.ts +6 -3
- package/dist/types/properties.d.ts +72 -88
- package/dist/types/slots.d.ts +20 -10
- package/dist/types/translations.d.ts +6 -0
- package/package.json +1 -9
- package/src/controllers/auth.tsx +5 -2
- package/src/controllers/client.ts +15 -0
- package/src/controllers/collection_registry.ts +2 -1
- package/src/controllers/data_driver.ts +50 -1
- package/src/controllers/navigation.ts +19 -7
- package/src/controllers/registry.ts +10 -1
- package/src/controllers/side_entity_controller.tsx +8 -0
- package/src/rebase_context.tsx +18 -0
- package/src/types/backend_hooks.ts +185 -0
- package/src/types/collections.ts +32 -12
- package/src/types/component_ref.ts +57 -0
- package/src/types/cron.ts +2 -1
- package/src/types/entity_views.tsx +6 -7
- package/src/types/formex.ts +45 -0
- package/src/types/index.ts +3 -0
- package/src/types/plugins.tsx +6 -3
- package/src/types/properties.ts +89 -88
- package/src/types/slots.tsx +20 -10
- package/src/types/translations.ts +7 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Internal marker for a lazily-loaded component reference.
|
|
5
|
+
* Created by the Vite transform plugin when converting string paths
|
|
6
|
+
* to deferred `import()` calls. Users should NOT create these manually.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface LazyComponentRef<P = unknown> {
|
|
11
|
+
readonly __rebaseLazy: true;
|
|
12
|
+
readonly load: () => Promise<{ default: React.ComponentType<P> }>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A reference to a React component that can be provided in three forms:
|
|
17
|
+
*
|
|
18
|
+
* 1. **String path** (recommended for collection configs):
|
|
19
|
+
* ```ts
|
|
20
|
+
* Field: "../../frontend/src/components/MyField"
|
|
21
|
+
* ```
|
|
22
|
+
* The Vite plugin transforms this into a `LazyComponentRef` at build time.
|
|
23
|
+
* On the backend, the string stays inert and is never evaluated.
|
|
24
|
+
*
|
|
25
|
+
* 2. **Lazy import function**:
|
|
26
|
+
* ```ts
|
|
27
|
+
* Field: () => import("../../frontend/src/components/MyField")
|
|
28
|
+
* ```
|
|
29
|
+
* Standard ES dynamic import. Backend never calls the function.
|
|
30
|
+
*
|
|
31
|
+
* 3. **Direct component reference** (use only in frontend-only code):
|
|
32
|
+
* ```ts
|
|
33
|
+
* Field: MyFieldComponent
|
|
34
|
+
* ```
|
|
35
|
+
* Importing a component at the top level will pull React into the
|
|
36
|
+
* backend runtime — only safe in code that the backend never imports.
|
|
37
|
+
*
|
|
38
|
+
* @group Types
|
|
39
|
+
*/
|
|
40
|
+
export type ComponentRef<P = unknown> =
|
|
41
|
+
| React.ComponentType<P>
|
|
42
|
+
| LazyComponentRef<P>
|
|
43
|
+
| (() => Promise<{ default: React.ComponentType<P> }>)
|
|
44
|
+
| string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Type guard: checks if a value is a `LazyComponentRef` produced by the
|
|
48
|
+
* Vite transform plugin.
|
|
49
|
+
*/
|
|
50
|
+
export function isLazyComponentRef<P = unknown>(ref: unknown): ref is LazyComponentRef<P> {
|
|
51
|
+
return (
|
|
52
|
+
typeof ref === "object" &&
|
|
53
|
+
ref !== null &&
|
|
54
|
+
"__rebaseLazy" in ref &&
|
|
55
|
+
(ref as Record<string, unknown>).__rebaseLazy === true
|
|
56
|
+
);
|
|
57
|
+
}
|
package/src/types/cron.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { RebaseClient } from "../controllers/client";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Cron Job type definitions for Rebase.
|
|
3
5
|
*
|
|
@@ -44,7 +46,6 @@ export interface CronJobDefinition {
|
|
|
44
46
|
handler: (ctx: CronJobContext) => Promise<unknown> | unknown;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
import type { RebaseClient } from "../controllers/client";
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
51
|
* Context passed to each cron handler invocation.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Entity, EntityValues } from "./entities";
|
|
3
3
|
import type { EntityCollection } from "./collections";
|
|
4
|
+
import type { FormexController } from "./formex";
|
|
5
|
+
import type { ComponentRef } from "./component_ref";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Context passed to custom fields and entity views.
|
|
7
|
-
* This is the base definition — `@rebasepro/admin` re-exports a
|
|
8
|
-
* fully-typed version that narrows the `formex` field.
|
|
9
9
|
* @group Form custom fields
|
|
10
10
|
*/
|
|
11
11
|
export interface FormContext<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
@@ -50,10 +50,8 @@ export interface FormContext<M extends Record<string, unknown> = Record<string,
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* The underlying formex controller that powers the form.
|
|
53
|
-
* Prefer importing `FormContext` from `@rebasepro/admin` for the
|
|
54
|
-
* fully-typed `FormexController<M>` version.
|
|
55
53
|
*/
|
|
56
|
-
formex:
|
|
54
|
+
formex: FormexController<M>;
|
|
57
55
|
|
|
58
56
|
disabled: boolean;
|
|
59
57
|
}
|
|
@@ -64,7 +62,7 @@ export type EntityCustomView<M extends Record<string, unknown> = Record<string,
|
|
|
64
62
|
name: string;
|
|
65
63
|
tabComponent?: React.ReactNode;
|
|
66
64
|
includeActions?: boolean | "bottom";
|
|
67
|
-
Builder?:
|
|
65
|
+
Builder?: ComponentRef<EntityCustomViewParams<M>>;
|
|
68
66
|
position?: "start" | "end";
|
|
69
67
|
};
|
|
70
68
|
|
|
@@ -73,5 +71,6 @@ export interface EntityCustomViewParams<M extends Record<string, unknown> = Reco
|
|
|
73
71
|
entity?: Entity<M>;
|
|
74
72
|
modifiedValues?: EntityValues<M>;
|
|
75
73
|
formContext: FormContext<M>;
|
|
76
|
-
|
|
74
|
+
parentCollectionSlugs?: string[];
|
|
75
|
+
parentEntityIds?: string[];
|
|
77
76
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { FormEvent } from "react";
|
|
2
|
+
|
|
3
|
+
export type FormexController<T = any> = {
|
|
4
|
+
values: T;
|
|
5
|
+
initialValues: T;
|
|
6
|
+
setValues: (values: T) => void;
|
|
7
|
+
setFieldValue: (key: string, value: unknown, shouldValidate?: boolean) => void;
|
|
8
|
+
touched: Record<string, boolean>;
|
|
9
|
+
setFieldTouched: (key: string, touched: boolean, shouldValidate?: boolean) => void;
|
|
10
|
+
setTouched: (touched: Record<string, boolean>) => void;
|
|
11
|
+
dirty: boolean;
|
|
12
|
+
setDirty: (dirty: boolean) => void;
|
|
13
|
+
setSubmitCount: (submitCount: number) => void;
|
|
14
|
+
errors: Record<string, string>;
|
|
15
|
+
setFieldError: (key: string, error?: string) => void;
|
|
16
|
+
handleChange: (event: React.SyntheticEvent) => void,
|
|
17
|
+
handleBlur: (event: React.FocusEvent) => void,
|
|
18
|
+
handleSubmit: (event?: FormEvent<HTMLFormElement>) => void;
|
|
19
|
+
validate: () => void;
|
|
20
|
+
resetForm: (props?: FormexResetProps<T>) => void;
|
|
21
|
+
submitCount: number;
|
|
22
|
+
isSubmitting: boolean;
|
|
23
|
+
setSubmitting: (isSubmitting: boolean) => void;
|
|
24
|
+
isValidating: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The version of the form. This is incremented every time the form is reset
|
|
27
|
+
* or the form is submitted.
|
|
28
|
+
*/
|
|
29
|
+
version: number;
|
|
30
|
+
|
|
31
|
+
debugId?: string;
|
|
32
|
+
|
|
33
|
+
undo: () => void;
|
|
34
|
+
redo: () => void;
|
|
35
|
+
|
|
36
|
+
canUndo: boolean;
|
|
37
|
+
canRedo: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type FormexResetProps<T = any> = {
|
|
41
|
+
values?: T;
|
|
42
|
+
submitCount?: number;
|
|
43
|
+
errors?: Record<string, string>;
|
|
44
|
+
touched?: Record<string, boolean>;
|
|
45
|
+
};
|
package/src/types/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./entity_callbacks";
|
|
|
12
12
|
export * from "./entity_overrides";
|
|
13
13
|
export * from "./export_import";
|
|
14
14
|
export * from "./modify_collections";
|
|
15
|
+
export * from "./formex";
|
|
15
16
|
export * from "./websockets";
|
|
16
17
|
export * from "./backend";
|
|
17
18
|
export * from "./translations";
|
|
@@ -23,3 +24,5 @@ export * from "./property_config";
|
|
|
23
24
|
export * from "./entity_views";
|
|
24
25
|
export * from "./data_source";
|
|
25
26
|
export * from "./cron";
|
|
27
|
+
export * from "./backend_hooks";
|
|
28
|
+
export * from "./component_ref";
|
package/src/types/plugins.tsx
CHANGED
|
@@ -204,7 +204,8 @@ export interface PluginHooks {
|
|
|
204
204
|
*/
|
|
205
205
|
onColumnsReorder?: (props: {
|
|
206
206
|
fullPath: string;
|
|
207
|
-
|
|
207
|
+
parentCollectionSlugs: string[];
|
|
208
|
+
parentEntityIds: string[];
|
|
208
209
|
collection: EntityCollection;
|
|
209
210
|
newPropertiesOrder: string[];
|
|
210
211
|
}) => void;
|
|
@@ -214,7 +215,8 @@ export interface PluginHooks {
|
|
|
214
215
|
*/
|
|
215
216
|
onKanbanColumnsReorder?: (props: {
|
|
216
217
|
fullPath: string;
|
|
217
|
-
|
|
218
|
+
parentCollectionSlugs: string[];
|
|
219
|
+
parentEntityIds: string[];
|
|
218
220
|
collection: EntityCollection;
|
|
219
221
|
kanbanColumnProperty: string;
|
|
220
222
|
newColumnsOrder: string[];
|
|
@@ -306,7 +308,8 @@ export interface PluginHomePageActionsProps<EP extends object = object, M extend
|
|
|
306
308
|
export interface PluginFormActionProps<USER extends User = User, EC extends EntityCollection = EntityCollection> {
|
|
307
309
|
entityId?: string | number;
|
|
308
310
|
path: string;
|
|
309
|
-
|
|
311
|
+
parentCollectionSlugs: string[];
|
|
312
|
+
parentEntityIds: string[];
|
|
310
313
|
status: EntityStatus;
|
|
311
314
|
collection: EC;
|
|
312
315
|
disabled: boolean;
|
package/src/types/properties.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
+
import type { ComponentRef } from "./component_ref";
|
|
4
|
+
|
|
3
5
|
import type { EntityReference, EntityRelation, EntityValues, GeoPoint, Entity } from "./entities";
|
|
4
6
|
import type { Relation, JoinStep, OnAction } from "./relations";
|
|
5
7
|
import type { EntityCollection, FilterValues } from "./collections";
|
|
@@ -63,6 +65,16 @@ export type Properties = {
|
|
|
63
65
|
[key: string]: Property;
|
|
64
66
|
};
|
|
65
67
|
|
|
68
|
+
export type PostgresProperty = Exclude<Property, ReferenceProperty>;
|
|
69
|
+
export type PostgresProperties = {
|
|
70
|
+
[key: string]: PostgresProperty;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type FirebaseProperty = Exclude<Property, RelationProperty>;
|
|
74
|
+
export type FirebaseProperties = {
|
|
75
|
+
[key: string]: FirebaseProperty;
|
|
76
|
+
};
|
|
77
|
+
|
|
66
78
|
/**
|
|
67
79
|
* A helper type to infer the underlying data type from a Property definition.
|
|
68
80
|
* This is the core of the type inference system.
|
|
@@ -127,7 +139,19 @@ export type InferEntityType<P extends Properties> = {
|
|
|
127
139
|
* Interface including all common properties of a CMS property.
|
|
128
140
|
* @group Entity properties
|
|
129
141
|
*/
|
|
142
|
+
export interface BaseUIConfig<CustomProps = unknown> {
|
|
143
|
+
columnWidth?: number;
|
|
144
|
+
hideFromCollection?: boolean;
|
|
145
|
+
readOnly?: boolean;
|
|
146
|
+
disabled?: boolean | PropertyDisabledConfig;
|
|
147
|
+
widthPercentage?: number;
|
|
148
|
+
customProps?: CustomProps;
|
|
149
|
+
Field?: ComponentRef<any>;
|
|
150
|
+
Preview?: ComponentRef<any>;
|
|
151
|
+
}
|
|
152
|
+
|
|
130
153
|
export interface BaseProperty<CustomProps = unknown> {
|
|
154
|
+
ui?: BaseUIConfig<CustomProps>;
|
|
131
155
|
/**
|
|
132
156
|
* Property name (e.g. Product)
|
|
133
157
|
*/
|
|
@@ -147,30 +171,19 @@ export interface BaseProperty<CustomProps = unknown> {
|
|
|
147
171
|
propertyConfig?: string;
|
|
148
172
|
|
|
149
173
|
/**
|
|
150
|
-
*
|
|
151
|
-
* the
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
*
|
|
174
|
+
* Explicit database column name. When set, this value is used as-is
|
|
175
|
+
* for the SQL column name, bypassing any snake_case conversion of
|
|
176
|
+
* the property key.
|
|
177
|
+
*
|
|
178
|
+
* This is automatically populated by `rebase schema introspect`
|
|
179
|
+
* to guarantee an exact match with the live database schema.
|
|
180
|
+
*
|
|
181
|
+
* For manually-authored collections you can omit this — the framework
|
|
182
|
+
* will derive the column name from the property key via `toSnakeCase()`.
|
|
157
183
|
*/
|
|
158
|
-
|
|
184
|
+
columnName?: string;
|
|
159
185
|
|
|
160
|
-
/**
|
|
161
|
-
* Is this a read only property. When set to true, it gets rendered as a
|
|
162
|
-
* preview.
|
|
163
|
-
*/
|
|
164
|
-
readOnly?: boolean;
|
|
165
186
|
|
|
166
|
-
/**
|
|
167
|
-
* Is this field disabled.
|
|
168
|
-
* When set to true, it gets rendered as a
|
|
169
|
-
* disabled field. You can also specify a configuration for defining the
|
|
170
|
-
* behaviour of disabled properties (including custom messages, clear value on
|
|
171
|
-
* disabled or hide the field completely)
|
|
172
|
-
*/
|
|
173
|
-
disabled?: boolean | PropertyDisabledConfig;
|
|
174
187
|
|
|
175
188
|
/**
|
|
176
189
|
* Rules for validating this property
|
|
@@ -182,17 +195,7 @@ export interface BaseProperty<CustomProps = unknown> {
|
|
|
182
195
|
*/
|
|
183
196
|
defaultValue?: unknown;
|
|
184
197
|
|
|
185
|
-
/**
|
|
186
|
-
* A number between 0 and 100 that indicates the width of the field in the form view.
|
|
187
|
-
* It defaults to 100, but you can set it to 50 to have two fields in the same row.
|
|
188
|
-
*/
|
|
189
|
-
widthPercentage?: number;
|
|
190
198
|
|
|
191
|
-
/**
|
|
192
|
-
* Additional props that are passed to the components defined in `field`
|
|
193
|
-
* or in `preview`.
|
|
194
|
-
*/
|
|
195
|
-
customProps?: CustomProps;
|
|
196
199
|
|
|
197
200
|
|
|
198
201
|
/**
|
|
@@ -221,23 +224,22 @@ export interface BaseProperty<CustomProps = unknown> {
|
|
|
221
224
|
*/
|
|
222
225
|
callbacks?: PropertyCallbacks;
|
|
223
226
|
|
|
224
|
-
/**
|
|
225
|
-
* Custom field component to render this property in forms.
|
|
226
|
-
* Used by the CMS layer.
|
|
227
|
-
*/
|
|
228
|
-
Field?: React.ComponentType<any>;
|
|
229
227
|
|
|
230
|
-
/**
|
|
231
|
-
* Custom preview component to render this property in previews/tables.
|
|
232
|
-
* Used by the CMS layer.
|
|
233
|
-
*/
|
|
234
|
-
Preview?: React.ComponentType<any>;
|
|
235
228
|
}
|
|
236
229
|
|
|
237
230
|
/**
|
|
238
231
|
* @group Entity properties
|
|
239
232
|
*/
|
|
233
|
+
export interface StringUIConfig extends BaseUIConfig {
|
|
234
|
+
multiline?: boolean;
|
|
235
|
+
markdown?: boolean;
|
|
236
|
+
previewAsTag?: boolean;
|
|
237
|
+
clearable?: boolean;
|
|
238
|
+
url?: boolean | PreviewType;
|
|
239
|
+
}
|
|
240
|
+
|
|
240
241
|
export interface StringProperty extends BaseProperty {
|
|
242
|
+
ui?: StringUIConfig;
|
|
241
243
|
type: "string";
|
|
242
244
|
/**
|
|
243
245
|
* Optional database column type. If not set, it defaults to `varchar` or `uuid` depending on `isId` configuration.
|
|
@@ -314,10 +316,7 @@ export interface StringProperty extends BaseProperty {
|
|
|
314
316
|
* Should this string be rendered as a tag instead of just text.
|
|
315
317
|
*/
|
|
316
318
|
previewAsTag?: boolean;
|
|
317
|
-
|
|
318
|
-
* Add an icon to clear the value and set it to `null`. Defaults to `false`
|
|
319
|
-
*/
|
|
320
|
-
clearable?: boolean;
|
|
319
|
+
|
|
321
320
|
|
|
322
321
|
/**
|
|
323
322
|
* You can use this property (a string) to behave as a reference to another
|
|
@@ -331,7 +330,12 @@ export interface StringProperty extends BaseProperty {
|
|
|
331
330
|
/**
|
|
332
331
|
* @group Entity properties
|
|
333
332
|
*/
|
|
333
|
+
export interface NumberUIConfig extends BaseUIConfig {
|
|
334
|
+
clearable?: boolean;
|
|
335
|
+
}
|
|
336
|
+
|
|
334
337
|
export interface NumberProperty extends BaseProperty {
|
|
338
|
+
ui?: NumberUIConfig;
|
|
335
339
|
type: "number";
|
|
336
340
|
/**
|
|
337
341
|
* Optional database column type. Allows specifying exact database numeric types.
|
|
@@ -359,16 +363,14 @@ export interface NumberProperty extends BaseProperty {
|
|
|
359
363
|
* displayed in the dropdown.
|
|
360
364
|
*/
|
|
361
365
|
enum?: EnumValues;
|
|
362
|
-
|
|
363
|
-
* Add an icon to clear the value and set it to `null`. Defaults to `false`
|
|
364
|
-
*/
|
|
365
|
-
clearable?: boolean;
|
|
366
|
+
|
|
366
367
|
}
|
|
367
368
|
|
|
368
369
|
/**
|
|
369
370
|
* @group Entity properties
|
|
370
371
|
*/
|
|
371
372
|
export interface BooleanProperty extends BaseProperty {
|
|
373
|
+
ui?: BaseUIConfig;
|
|
372
374
|
type: "boolean";
|
|
373
375
|
/**
|
|
374
376
|
* Rules for validating this property
|
|
@@ -379,7 +381,12 @@ export interface BooleanProperty extends BaseProperty {
|
|
|
379
381
|
/**
|
|
380
382
|
* @group Entity properties
|
|
381
383
|
*/
|
|
384
|
+
export interface DateUIConfig extends BaseUIConfig {
|
|
385
|
+
clearable?: boolean;
|
|
386
|
+
}
|
|
387
|
+
|
|
382
388
|
export interface DateProperty extends BaseProperty {
|
|
389
|
+
ui?: DateUIConfig;
|
|
383
390
|
type: "date";
|
|
384
391
|
/**
|
|
385
392
|
* Optional database column type. If not set, defaults to `timestamp` with timezone.
|
|
@@ -416,6 +423,7 @@ export interface DateProperty extends BaseProperty {
|
|
|
416
423
|
* @group Entity properties
|
|
417
424
|
*/
|
|
418
425
|
export interface GeopointProperty extends BaseProperty {
|
|
426
|
+
ui?: BaseUIConfig;
|
|
419
427
|
type: "geopoint";
|
|
420
428
|
/**
|
|
421
429
|
* Rules for validating this property
|
|
@@ -426,7 +434,12 @@ export interface GeopointProperty extends BaseProperty {
|
|
|
426
434
|
/**
|
|
427
435
|
* @group Entity properties
|
|
428
436
|
*/
|
|
437
|
+
export interface ReferenceUIConfig extends BaseUIConfig {
|
|
438
|
+
previewProperties?: string[];
|
|
439
|
+
}
|
|
440
|
+
|
|
429
441
|
export interface ReferenceProperty extends BaseProperty {
|
|
442
|
+
ui?: ReferenceUIConfig;
|
|
430
443
|
type: "reference";
|
|
431
444
|
/**
|
|
432
445
|
* Marks this field as a Primary Key / Unique Identifier.
|
|
@@ -447,15 +460,10 @@ export interface ReferenceProperty extends BaseProperty {
|
|
|
447
460
|
path?: string;
|
|
448
461
|
/**
|
|
449
462
|
* Allow selection of entities that pass the given filter only.
|
|
450
|
-
* e.g. `
|
|
463
|
+
* e.g. `fixedFilter: { age: [">=", 18] }`
|
|
451
464
|
*/
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
* Properties that need to be rendered when displaying a preview of this
|
|
455
|
-
* reference. If not specified the first 3 are used. Only the first 3
|
|
456
|
-
* specified values are considered.
|
|
457
|
-
*/
|
|
458
|
-
previewProperties?: string[];
|
|
465
|
+
fixedFilter?: FilterValues<string>;
|
|
466
|
+
|
|
459
467
|
/**
|
|
460
468
|
* Should the reference include the ID of the entity. Defaults to `true`
|
|
461
469
|
*/
|
|
@@ -469,7 +477,13 @@ export interface ReferenceProperty extends BaseProperty {
|
|
|
469
477
|
/**
|
|
470
478
|
* @group Entity properties
|
|
471
479
|
*/
|
|
480
|
+
export interface RelationUIConfig extends BaseUIConfig {
|
|
481
|
+
previewProperties?: string[];
|
|
482
|
+
widget?: "select" | "dialog";
|
|
483
|
+
}
|
|
484
|
+
|
|
472
485
|
export interface RelationProperty extends BaseProperty {
|
|
486
|
+
ui?: RelationUIConfig;
|
|
473
487
|
type: "relation";
|
|
474
488
|
/**
|
|
475
489
|
* Marks this field as a Primary Key / Unique Identifier.
|
|
@@ -579,15 +593,10 @@ export interface RelationProperty extends BaseProperty {
|
|
|
579
593
|
|
|
580
594
|
/**
|
|
581
595
|
* Allow selection of entities that pass the given filter only.
|
|
582
|
-
* e.g. `
|
|
583
|
-
*/
|
|
584
|
-
forceFilter?: FilterValues<string>;
|
|
585
|
-
/**
|
|
586
|
-
* Properties that need to be rendered when displaying a preview of this
|
|
587
|
-
* reference. If not specified the first 3 are used. Only the first 3
|
|
588
|
-
* specified values are considered.
|
|
596
|
+
* e.g. `fixedFilter: { age: [">=", 18] }`
|
|
589
597
|
*/
|
|
590
|
-
|
|
598
|
+
fixedFilter?: FilterValues<string>;
|
|
599
|
+
|
|
591
600
|
/**
|
|
592
601
|
* Should the reference include the ID of the entity. Defaults to `true`
|
|
593
602
|
*/
|
|
@@ -607,7 +616,13 @@ export interface RelationProperty extends BaseProperty {
|
|
|
607
616
|
/**
|
|
608
617
|
* @group Entity properties
|
|
609
618
|
*/
|
|
619
|
+
export interface ArrayUIConfig extends BaseUIConfig {
|
|
620
|
+
expanded?: boolean;
|
|
621
|
+
minimalistView?: boolean;
|
|
622
|
+
}
|
|
623
|
+
|
|
610
624
|
export interface ArrayProperty extends BaseProperty {
|
|
625
|
+
ui?: ArrayUIConfig;
|
|
611
626
|
type: "array";
|
|
612
627
|
/**
|
|
613
628
|
* Optional database column type. Defaults to `jsonb`.
|
|
@@ -662,15 +677,7 @@ export interface ArrayProperty extends BaseProperty {
|
|
|
662
677
|
* Rules for validating this property
|
|
663
678
|
*/
|
|
664
679
|
validation?: ArrayPropertyValidationSchema;
|
|
665
|
-
|
|
666
|
-
* Should the field be initially expanded. Defaults to `true`
|
|
667
|
-
*/
|
|
668
|
-
expanded?: boolean;
|
|
669
|
-
/**
|
|
670
|
-
* Display the child properties directly, without being wrapped in an
|
|
671
|
-
* extendable panel.
|
|
672
|
-
*/
|
|
673
|
-
minimalistView?: boolean;
|
|
680
|
+
|
|
674
681
|
/**
|
|
675
682
|
* Can the elements in this array be reordered. Defaults to `true`.
|
|
676
683
|
* This prop has no effect if `disabled` is set to true.
|
|
@@ -686,7 +693,14 @@ export interface ArrayProperty extends BaseProperty {
|
|
|
686
693
|
/**
|
|
687
694
|
* @group Entity properties
|
|
688
695
|
*/
|
|
696
|
+
export interface MapUIConfig extends BaseUIConfig {
|
|
697
|
+
expanded?: boolean;
|
|
698
|
+
minimalistView?: boolean;
|
|
699
|
+
spreadChildren?: boolean;
|
|
700
|
+
}
|
|
701
|
+
|
|
689
702
|
export interface MapProperty extends BaseProperty {
|
|
703
|
+
ui?: MapUIConfig;
|
|
690
704
|
type: "map";
|
|
691
705
|
/**
|
|
692
706
|
* Optional database column type. Defaults to `jsonb`.
|
|
@@ -720,20 +734,7 @@ export interface MapProperty extends BaseProperty {
|
|
|
720
734
|
* needed
|
|
721
735
|
*/
|
|
722
736
|
pickOnlySomeKeys?: boolean;
|
|
723
|
-
|
|
724
|
-
* Display the child properties as independent columns in the collection
|
|
725
|
-
* view
|
|
726
|
-
*/
|
|
727
|
-
spreadChildren?: boolean;
|
|
728
|
-
/**
|
|
729
|
-
* Display the child properties directly, without being wrapped in an
|
|
730
|
-
* extendable panel. Note that this will also hide the title of this property.
|
|
731
|
-
*/
|
|
732
|
-
minimalistView?: boolean;
|
|
733
|
-
/**
|
|
734
|
-
* Should the field be initially expanded. Defaults to `true`
|
|
735
|
-
*/
|
|
736
|
-
expanded?: boolean;
|
|
737
|
+
|
|
737
738
|
/**
|
|
738
739
|
* Render this map as a key-value table that allows to use
|
|
739
740
|
* arbitrary keys. You don't need to define the properties in this case.
|
package/src/types/slots.tsx
CHANGED
|
@@ -129,7 +129,8 @@ export interface NavigationSlotProps {
|
|
|
129
129
|
export interface CollectionToolbarProps {
|
|
130
130
|
path: string;
|
|
131
131
|
collection: EntityCollection;
|
|
132
|
-
|
|
132
|
+
parentCollectionSlugs: string[];
|
|
133
|
+
parentEntityIds: string[];
|
|
133
134
|
tableController: EntityTableController;
|
|
134
135
|
selectionController: SelectionController;
|
|
135
136
|
}
|
|
@@ -141,7 +142,8 @@ export interface CollectionToolbarProps {
|
|
|
141
142
|
export interface CollectionEmptyStateProps {
|
|
142
143
|
path: string;
|
|
143
144
|
collection: EntityCollection;
|
|
144
|
-
|
|
145
|
+
parentCollectionSlugs: string[];
|
|
146
|
+
parentEntityIds: string[];
|
|
145
147
|
canCreate: boolean;
|
|
146
148
|
onNewClick?: () => void;
|
|
147
149
|
}
|
|
@@ -154,7 +156,8 @@ export interface CollectionHeaderActionProps {
|
|
|
154
156
|
property: Property;
|
|
155
157
|
propertyKey: string;
|
|
156
158
|
path: string;
|
|
157
|
-
|
|
159
|
+
parentCollectionSlugs: string[];
|
|
160
|
+
parentEntityIds: string[];
|
|
158
161
|
onHover: boolean;
|
|
159
162
|
collection: EntityCollection;
|
|
160
163
|
tableController: EntityTableController;
|
|
@@ -166,7 +169,8 @@ export interface CollectionHeaderActionProps {
|
|
|
166
169
|
*/
|
|
167
170
|
export interface CollectionAddColumnProps {
|
|
168
171
|
path: string;
|
|
169
|
-
|
|
172
|
+
parentCollectionSlugs: string[];
|
|
173
|
+
parentEntityIds: string[];
|
|
170
174
|
collection: EntityCollection;
|
|
171
175
|
tableController: EntityTableController;
|
|
172
176
|
}
|
|
@@ -178,7 +182,8 @@ export interface CollectionAddColumnProps {
|
|
|
178
182
|
export interface CollectionErrorProps {
|
|
179
183
|
path: string;
|
|
180
184
|
collection: EntityCollection;
|
|
181
|
-
|
|
185
|
+
parentCollectionSlugs?: string[];
|
|
186
|
+
parentEntityIds?: string[];
|
|
182
187
|
error: Error;
|
|
183
188
|
}
|
|
184
189
|
|
|
@@ -189,7 +194,8 @@ export interface CollectionErrorProps {
|
|
|
189
194
|
export interface KanbanSetupProps {
|
|
190
195
|
collection: EntityCollection;
|
|
191
196
|
fullPath: string;
|
|
192
|
-
|
|
197
|
+
parentCollectionSlugs: string[];
|
|
198
|
+
parentEntityIds: string[];
|
|
193
199
|
}
|
|
194
200
|
|
|
195
201
|
/**
|
|
@@ -199,7 +205,8 @@ export interface KanbanSetupProps {
|
|
|
199
205
|
export interface KanbanAddColumnProps {
|
|
200
206
|
collection: EntityCollection;
|
|
201
207
|
fullPath: string;
|
|
202
|
-
|
|
208
|
+
parentCollectionSlugs: string[];
|
|
209
|
+
parentEntityIds: string[];
|
|
203
210
|
columnProperty: string;
|
|
204
211
|
}
|
|
205
212
|
|
|
@@ -215,7 +222,8 @@ export interface EntityRowActionsProps {
|
|
|
215
222
|
entityId: string;
|
|
216
223
|
path: string;
|
|
217
224
|
collection: EntityCollection;
|
|
218
|
-
|
|
225
|
+
parentCollectionSlugs: string[];
|
|
226
|
+
parentEntityIds: string[];
|
|
219
227
|
selectionController: SelectionController;
|
|
220
228
|
context: RebaseContext;
|
|
221
229
|
}
|
|
@@ -242,7 +250,8 @@ export interface EntityFieldSlotProps {
|
|
|
242
250
|
export interface CollectionFilterPanelProps {
|
|
243
251
|
path: string;
|
|
244
252
|
collection: EntityCollection;
|
|
245
|
-
|
|
253
|
+
parentCollectionSlugs: string[];
|
|
254
|
+
parentEntityIds: string[];
|
|
246
255
|
tableController: EntityTableController;
|
|
247
256
|
context: RebaseContext;
|
|
248
257
|
}
|
|
@@ -282,7 +291,8 @@ export interface ShellToolbarProps {
|
|
|
282
291
|
export interface CollectionInsightsSlotProps {
|
|
283
292
|
path: string;
|
|
284
293
|
collection: EntityCollection;
|
|
285
|
-
|
|
294
|
+
parentCollectionSlugs: string[];
|
|
295
|
+
parentEntityIds: string[];
|
|
286
296
|
}
|
|
287
297
|
|
|
288
298
|
/**
|
|
@@ -61,6 +61,8 @@ export interface RebaseTranslations {
|
|
|
61
61
|
all_entries_loaded: string;
|
|
62
62
|
create_your_first_entry: string;
|
|
63
63
|
no_results_filter_sort: string;
|
|
64
|
+
/** Shown when a text search yields no results. Supports `{{search}}` interpolation. */
|
|
65
|
+
no_results_search?: string;
|
|
64
66
|
add: string;
|
|
65
67
|
remove: string;
|
|
66
68
|
copy_id: string;
|
|
@@ -522,6 +524,11 @@ export interface RebaseTranslations {
|
|
|
522
524
|
reset_password_confirmation?: string;
|
|
523
525
|
error_resetting_password?: string;
|
|
524
526
|
|
|
527
|
+
/** Permission-denied empty states */
|
|
528
|
+
no_permission_to_view_users?: string;
|
|
529
|
+
no_permission_to_view_roles?: string;
|
|
530
|
+
no_permission_description?: string;
|
|
531
|
+
|
|
525
532
|
/** Editor table-bubble */
|
|
526
533
|
add_row_before: string;
|
|
527
534
|
add_row_after: string;
|