@forestadmin/datasource-customizer 1.48.0 → 1.49.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.
@@ -1,4 +1,4 @@
1
- import { ActionLayoutElement, CompositeId, File, Json, LayoutElementInput } from '@forestadmin/datasource-toolkit';
1
+ import { CompositeId, File, Json } from '@forestadmin/datasource-toolkit';
2
2
  type UnionKeys<T> = T extends T ? keyof T : never;
3
3
  type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
4
4
  type StrictUnion<T> = StrictUnionHelper<T, T>;
@@ -14,7 +14,7 @@ type BaseDynamicField<Type, Context, Result> = {
14
14
  description?: ValueOrHandler<Context, string>;
15
15
  isRequired?: ValueOrHandler<Context, boolean>;
16
16
  isReadOnly?: ValueOrHandler<Context, boolean>;
17
- if?: ((context: Context) => Promise<unknown>) | ((context: Context) => unknown);
17
+ if?: Handler<Context, unknown>;
18
18
  value?: ValueOrHandler<Context, Result>;
19
19
  defaultValue?: ValueOrHandler<Context, Result>;
20
20
  };
@@ -137,9 +137,18 @@ type AddressAutocompleteFieldConfiguration = {
137
137
  type RadioButtonFieldConfiguration<Context = unknown, TValue = string> = LimitedValueDynamicFieldConfiguration<Context, 'RadioGroup', TValue>;
138
138
  type CheckboxesFieldConfiguration<Context = unknown, TValue = string> = LimitedValueDynamicFieldConfiguration<Context, 'CheckboxGroup', TValue>;
139
139
  export type DynamicField<Context = unknown> = StrictUnion<BooleanDynamicField<Context> | (BooleanDynamicField<Context> & CheckboxDynamicFieldConfiguration) | CollectionDynamicField<Context> | EnumDynamicField<Context> | EnumListDynamicField<Context> | FileDynamicField<Context> | FileListDynamicField<Context> | JsonDynamicField<Context> | (JsonDynamicField<Context> & JsonEditorFieldConfiguration) | NumberDynamicField<Context> | TimeDynamicField<Context> | (NumberDynamicField<Context> & NumberInputFieldConfiguration<Context>) | (NumberDynamicField<Context> & DropdownDynamicFieldConfiguration<Context, number>) | (NumberDynamicField<Context> & DropdownDynamicSearchFieldConfiguration<Context, number>) | (NumberDynamicField<Context> & RadioButtonFieldConfiguration<Context, number>) | (NumberDynamicField<Context> & CurrencyInputFieldConfiguration<Context>) | NumberListDynamicField<Context> | (NumberListDynamicField<Context> & DropdownDynamicFieldConfiguration<Context, number>) | (NumberListDynamicField<Context> & DropdownDynamicSearchFieldConfiguration<Context, number>) | (NumberListDynamicField<Context> & CheckboxesFieldConfiguration<Context, number>) | (NumberListDynamicField<Context> & ArrayNumberInputFieldConfiguration<Context>) | StringDynamicField<Context> | (DateDynamicField<Context> & DatePickerInputFieldConfiguration<Context>) | (StringDynamicField<Context> & TextInputFieldConfiguration) | (StringDynamicField<Context> & DropdownDynamicFieldConfiguration<Context, string>) | (StringDynamicField<Context> & DropdownDynamicSearchFieldConfiguration<Context, string>) | (StringDynamicField<Context> & RadioButtonFieldConfiguration<Context, string>) | (StringDynamicField<Context> & TextAreaFieldConfiguration) | (StringDynamicField<Context> & RichTextFieldConfiguration) | (StringDynamicField<Context> & ColorPickerFieldConfiguration) | (StringDynamicField<Context> & AddressAutocompleteFieldConfiguration) | (StringDynamicField<Context> & UserDropdownFieldConfiguration) | (FileDynamicField<Context> & FilePickerFieldConfiguration) | StringListDynamicField<Context> | (StringListDynamicField<Context> & DropdownDynamicFieldConfiguration<Context, string>) | (StringListDynamicField<Context> & DropdownDynamicSearchFieldConfiguration<Context, string>) | (StringListDynamicField<Context> & CheckboxesFieldConfiguration<Context, string>) | (StringListDynamicField<Context> & ArrayTextInputFieldConfiguration) | (StringListDynamicField<Context> & UserDropdownFieldConfiguration) | (FileListDynamicField<Context> & FileListPickerFieldConfiguration)>;
140
- export type DynamicLayoutElement<Context = unknown> = Exclude<ActionLayoutElement, LayoutElementInput> & {
141
- if?: ((context: Context) => Promise<unknown>) | ((context: Context) => unknown);
140
+ type DynamicLayoutElementBase<Context> = {
141
+ type: 'Layout';
142
+ if?: Handler<Context, unknown>;
142
143
  };
144
+ type DynamicLayoutElementSeparator<Context> = DynamicLayoutElementBase<Context> & {
145
+ component: 'Separator';
146
+ };
147
+ type DynamicLayoutElementHtmlBlock<Context> = DynamicLayoutElementBase<Context> & {
148
+ component: 'HtmlBlock';
149
+ content: ValueOrHandler<Context, string>;
150
+ };
151
+ export type DynamicLayoutElement<Context = unknown> = DynamicLayoutElementSeparator<Context> | DynamicLayoutElementHtmlBlock<Context>;
143
152
  export type DynamicFormElement<Context = unknown> = DynamicField<Context> | DynamicLayoutElement<Context>;
144
153
  export {};
145
154
  //# sourceMappingURL=fields.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forestadmin/datasource-customizer",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "GPL-3.0",
6
6
  "publishConfig": {
@@ -29,7 +29,7 @@
29
29
  "@types/uuid": "^9.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "@forestadmin/datasource-toolkit": "1.35.0",
32
+ "@forestadmin/datasource-toolkit": "1.36.0",
33
33
  "antlr4": "^4.13.1-patch-1",
34
34
  "file-type": "^16.5.4",
35
35
  "luxon": "^3.2.1",