@plasmicapp/host 2.0.0-alpha.0 → 2.0.0-alpha.1
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/data.d.ts +1 -5
- package/dist/exports.d.ts +3 -4
- package/dist/host.esm.js +6 -17
- package/dist/host.esm.js.map +1 -1
- package/dist/index.cjs.js +5 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/prop-types.d.ts +6 -475
- package/dist/registerComponent.d.ts +8 -11
- package/dist/registerFunction.d.ts +2 -127
- package/dist/types/choice-type.d.ts +16 -0
- package/dist/types/component-types.d.ts +251 -0
- package/dist/types/container-types.d.ts +42 -0
- package/dist/types/function-types.d.ts +101 -0
- package/dist/types/misc-types.d.ts +38 -0
- package/dist/types/primitive-types.d.ts +123 -0
- package/dist/types/query-builder-types.d.ts +51 -0
- package/dist/types/shared-controls.d.ts +50 -0
- package/dist/types/type-utils.d.ts +7 -0
- package/dist/version.d.ts +1 -1
- package/package.json +4 -3
- package/registerComponent/dist/data.d.ts +1 -5
- package/registerComponent/dist/exports.d.ts +3 -4
- package/registerComponent/dist/index.cjs.js.map +1 -1
- package/registerComponent/dist/index.esm.js.map +1 -1
- package/registerComponent/dist/prop-types.d.ts +6 -475
- package/registerComponent/dist/registerComponent.d.ts +8 -11
- package/registerComponent/dist/registerFunction.d.ts +2 -127
- package/registerComponent/dist/types/choice-type.d.ts +16 -0
- package/registerComponent/dist/types/component-types.d.ts +251 -0
- package/registerComponent/dist/types/container-types.d.ts +42 -0
- package/registerComponent/dist/types/function-types.d.ts +101 -0
- package/registerComponent/dist/types/misc-types.d.ts +38 -0
- package/registerComponent/dist/types/primitive-types.d.ts +123 -0
- package/registerComponent/dist/types/query-builder-types.d.ts +51 -0
- package/registerComponent/dist/types/shared-controls.d.ts +50 -0
- package/registerComponent/dist/types/type-utils.d.ts +7 -0
- package/registerComponent/dist/version.d.ts +1 -1
- package/registerFunction/dist/data.d.ts +1 -5
- package/registerFunction/dist/exports.d.ts +3 -4
- package/registerFunction/dist/index.cjs.js.map +1 -1
- package/registerFunction/dist/index.esm.js.map +1 -1
- package/registerFunction/dist/prop-types.d.ts +6 -475
- package/registerFunction/dist/registerComponent.d.ts +8 -11
- package/registerFunction/dist/registerFunction.d.ts +2 -127
- package/registerFunction/dist/types/choice-type.d.ts +16 -0
- package/registerFunction/dist/types/component-types.d.ts +251 -0
- package/registerFunction/dist/types/container-types.d.ts +42 -0
- package/registerFunction/dist/types/function-types.d.ts +101 -0
- package/registerFunction/dist/types/misc-types.d.ts +38 -0
- package/registerFunction/dist/types/primitive-types.d.ts +123 -0
- package/registerFunction/dist/types/query-builder-types.d.ts +51 -0
- package/registerFunction/dist/types/shared-controls.d.ts +50 -0
- package/registerFunction/dist/types/type-utils.d.ts +7 -0
- package/registerFunction/dist/version.d.ts +1 -1
- package/registerGlobalContext/dist/data.d.ts +1 -5
- package/registerGlobalContext/dist/exports.d.ts +3 -4
- package/registerGlobalContext/dist/prop-types.d.ts +6 -475
- package/registerGlobalContext/dist/registerComponent.d.ts +8 -11
- package/registerGlobalContext/dist/registerFunction.d.ts +2 -127
- package/registerGlobalContext/dist/types/choice-type.d.ts +16 -0
- package/registerGlobalContext/dist/types/component-types.d.ts +251 -0
- package/registerGlobalContext/dist/types/container-types.d.ts +42 -0
- package/registerGlobalContext/dist/types/function-types.d.ts +101 -0
- package/registerGlobalContext/dist/types/misc-types.d.ts +38 -0
- package/registerGlobalContext/dist/types/primitive-types.d.ts +123 -0
- package/registerGlobalContext/dist/types/query-builder-types.d.ts +51 -0
- package/registerGlobalContext/dist/types/shared-controls.d.ts +50 -0
- package/registerGlobalContext/dist/types/type-utils.d.ts +7 -0
- package/registerGlobalContext/dist/version.d.ts +1 -1
- package/registerToken/dist/data.d.ts +1 -5
- package/registerToken/dist/exports.d.ts +3 -4
- package/registerToken/dist/prop-types.d.ts +6 -475
- package/registerToken/dist/registerComponent.d.ts +8 -11
- package/registerToken/dist/registerFunction.d.ts +2 -127
- package/registerToken/dist/types/choice-type.d.ts +16 -0
- package/registerToken/dist/types/component-types.d.ts +251 -0
- package/registerToken/dist/types/container-types.d.ts +42 -0
- package/registerToken/dist/types/function-types.d.ts +101 -0
- package/registerToken/dist/types/misc-types.d.ts +38 -0
- package/registerToken/dist/types/primitive-types.d.ts +123 -0
- package/registerToken/dist/types/query-builder-types.d.ts +51 -0
- package/registerToken/dist/types/shared-controls.d.ts +50 -0
- package/registerToken/dist/types/type-utils.d.ts +7 -0
- package/registerToken/dist/version.d.ts +1 -1
- package/registerTrait/dist/data.d.ts +1 -5
- package/registerTrait/dist/exports.d.ts +3 -4
- package/registerTrait/dist/prop-types.d.ts +6 -475
- package/registerTrait/dist/registerComponent.d.ts +8 -11
- package/registerTrait/dist/registerFunction.d.ts +2 -127
- package/registerTrait/dist/types/choice-type.d.ts +16 -0
- package/registerTrait/dist/types/component-types.d.ts +251 -0
- package/registerTrait/dist/types/container-types.d.ts +42 -0
- package/registerTrait/dist/types/function-types.d.ts +101 -0
- package/registerTrait/dist/types/misc-types.d.ts +38 -0
- package/registerTrait/dist/types/primitive-types.d.ts +123 -0
- package/registerTrait/dist/types/query-builder-types.d.ts +51 -0
- package/registerTrait/dist/types/shared-controls.d.ts +50 -0
- package/registerTrait/dist/types/type-utils.d.ts +7 -0
- package/registerTrait/dist/version.d.ts +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MaybeContextDependentConfig } from "./shared-controls";
|
|
2
|
+
export type ChoiceValue = string | number | boolean;
|
|
3
|
+
export type ChoiceObject<T = ChoiceValue> = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: T;
|
|
6
|
+
};
|
|
7
|
+
export type ChoiceOption<T extends ChoiceValue = ChoiceValue> = T | ChoiceObject<T>;
|
|
8
|
+
export type ChoiceOptions<T extends ChoiceValue = ChoiceValue> = T[] | ChoiceObject<T>[];
|
|
9
|
+
export interface ChoiceCore<Ctx extends any[], T extends ChoiceValue> {
|
|
10
|
+
type: "choice";
|
|
11
|
+
options: MaybeContextDependentConfig<Ctx, ChoiceOptions<T>>;
|
|
12
|
+
multiSelect?: MaybeContextDependentConfig<Ctx, boolean>;
|
|
13
|
+
allowSearch?: boolean;
|
|
14
|
+
filterOption?: boolean;
|
|
15
|
+
onSearch?: MaybeContextDependentConfig<Ctx, ((v: string) => void) | undefined>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CSSProperties, PlasmicElement } from "../element-types";
|
|
3
|
+
import { ChoiceCore, ChoiceValue } from "./choice-type";
|
|
4
|
+
import { ArrayTypeBaseCore, ObjectTypeBaseCore } from "./container-types";
|
|
5
|
+
import { DataPickerValueType, DataSourceCore, DynamicCore, GraphQLCore, GraphQLValue, RichDataPickerCore, RichExprEditorCore } from "./misc-types";
|
|
6
|
+
import { CardPickerCore, ClassCore, CodeStringCore, ColorCore, DateRangeStringsCore, DateStringCore, HrefCore, NumberTypeBaseCore, PlainNumberCore, PlainStringCore, RichBooleanCore, RichTextCore, SliderNumberCore, ThemeResetClassCore } from "./primitive-types";
|
|
7
|
+
import { CommonTypeBase, ContextDependentConfig, ControlExtras, Defaultable, GenericContext, InferDataType } from "./shared-controls";
|
|
8
|
+
export type ComponentControlContext<P> = GenericContext<P, // Full component props
|
|
9
|
+
// Full component props
|
|
10
|
+
InferDataType<P> | null, // Canvas data
|
|
11
|
+
ControlExtras>;
|
|
12
|
+
export type ComponentContextConfig<Props, R> = ContextDependentConfig<ComponentControlContext<Props>, R>;
|
|
13
|
+
export interface PropTypeBase<Ctx extends any[]> extends CommonTypeBase {
|
|
14
|
+
displayName?: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
readOnly?: boolean | ContextDependentConfig<Ctx, boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* If set to true, the component will be remounted when the prop value is updated.
|
|
19
|
+
* (This behavior only applies to canvas)
|
|
20
|
+
*/
|
|
21
|
+
forceRemount?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* If true, the prop can't be overriden in different variants.
|
|
24
|
+
*/
|
|
25
|
+
invariantable?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Function for whether this prop should be hidden in the right panel,
|
|
28
|
+
* given the current props for this component
|
|
29
|
+
*/
|
|
30
|
+
hidden?: ContextDependentConfig<Ctx, boolean>;
|
|
31
|
+
}
|
|
32
|
+
interface ExtendedDefaultable<Ctx extends any[], T> extends Defaultable<Ctx, T> {
|
|
33
|
+
/**
|
|
34
|
+
* Use a dynamic value expression as the default instead
|
|
35
|
+
*/
|
|
36
|
+
defaultExpr?: string;
|
|
37
|
+
defaultExprHint?: string;
|
|
38
|
+
/**
|
|
39
|
+
* This function validates whether the prop value is valid.
|
|
40
|
+
* If the value is invalid, it returns an error message. Otherwise, it returns true.
|
|
41
|
+
*/
|
|
42
|
+
validator?: (value: T, ...args: Ctx) => (string | true) | Promise<string | true>;
|
|
43
|
+
}
|
|
44
|
+
export interface Controllable {
|
|
45
|
+
/**
|
|
46
|
+
* If true, this is a prop that should only be used inside Plasmic
|
|
47
|
+
* Studio for rendering artboards; will not be actually used in
|
|
48
|
+
* generated code.
|
|
49
|
+
*/
|
|
50
|
+
editOnly?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* If specified, the value used for this prop will instead be
|
|
53
|
+
* mapped to the uncontrolledProp when generating code. This is
|
|
54
|
+
* useful if, for example, in the artboard, you want to use `value`
|
|
55
|
+
* prop to control the component, but in generated code, you want to
|
|
56
|
+
* map it to `defaultValue`.
|
|
57
|
+
*/
|
|
58
|
+
uncontrolledProp?: string;
|
|
59
|
+
}
|
|
60
|
+
export type PropTypeBaseDefault<P, T> = PropTypeBase<ComponentControlContext<P>> & ExtendedDefaultable<ComponentControlContext<P>, T> & Controllable;
|
|
61
|
+
export type PlainStringType<P> = PropTypeBaseDefault<P, string> & PlainStringCore;
|
|
62
|
+
export type CodeStringType<P> = PropTypeBaseDefault<P, string> & CodeStringCore;
|
|
63
|
+
export type RichTextType<P> = PropTypeBaseDefault<P, string> & RichTextCore;
|
|
64
|
+
export type HrefType<P> = PropTypeBaseDefault<P, string> & HrefCore;
|
|
65
|
+
export type ColorType<P> = PropTypeBaseDefault<P, string> & ColorCore;
|
|
66
|
+
export type DateStringType<P> = PropTypeBaseDefault<P, string> & DateStringCore;
|
|
67
|
+
export type DateRangeStringsType<P> = PropTypeBaseDefault<P, [string, string]> & DateRangeStringsCore;
|
|
68
|
+
export type ClassType<P> = PropTypeBase<ComponentControlContext<P>> & ClassCore;
|
|
69
|
+
export type ThemeResetClassType<P> = PropTypeBase<ComponentControlContext<P>> & ThemeResetClassCore;
|
|
70
|
+
export type CardPickerType<P> = PropTypeBaseDefault<P, string> & CardPickerCore<ComponentControlContext<P>>;
|
|
71
|
+
export type RichStringType<P> = PlainStringType<P> | CodeStringType<P> | RichTextType<P> | ColorType<P> | ClassType<P> | ThemeResetClassType<P> | CardPickerType<P> | HrefType<P>;
|
|
72
|
+
export type StringType<P> = "string" | "href" | RichStringType<P>;
|
|
73
|
+
export type RichBooleanType<P> = PropTypeBaseDefault<P, boolean> & RichBooleanCore;
|
|
74
|
+
export type BooleanType<P> = "boolean" | RichBooleanType<P>;
|
|
75
|
+
export type GraphQLType<P> = PropTypeBaseDefault<P, GraphQLValue> & GraphQLCore<ComponentControlContext<P>>;
|
|
76
|
+
export type NumberTypeBase<P> = PropTypeBaseDefault<P, number> & NumberTypeBaseCore<ComponentControlContext<P>>;
|
|
77
|
+
export type PlainNumberType<P> = NumberTypeBase<P> & PlainNumberCore<ComponentControlContext<P>>;
|
|
78
|
+
export type SliderNumberType<P> = NumberTypeBase<P> & SliderNumberCore<ComponentControlContext<P>>;
|
|
79
|
+
export type RichNumberType<P> = PlainNumberType<P> | SliderNumberType<P>;
|
|
80
|
+
export type NumberType<P> = "number" | RichNumberType<P>;
|
|
81
|
+
export type ObjectType<P> = PropTypeBaseDefault<P, Record<string, any>> & ObjectTypeBaseCore<ComponentControlContext<P>, PropType<P>>;
|
|
82
|
+
export type ArrayType<P> = PropTypeBaseDefault<P, any[]> & ArrayTypeBaseCore<ComponentControlContext<P>, PropType<P>>;
|
|
83
|
+
export type JSONLikeType<P> = "object" | ObjectType<P> | ArrayType<P>;
|
|
84
|
+
export type DataSourceType<P> = PropTypeBase<ComponentControlContext<P>> & DataSourceCore;
|
|
85
|
+
export type RichDataPickerType<P> = PropTypeBaseDefault<P, DataPickerValueType> & RichDataPickerCore<ComponentControlContext<P>>;
|
|
86
|
+
export type DataPickerType<P> = "dataPicker" | RichDataPickerType<P>;
|
|
87
|
+
export type RichExprEditorType<P> = PropTypeBaseDefault<P, DataPickerValueType> & RichExprEditorCore<ComponentControlContext<P>>;
|
|
88
|
+
export type ExprEditorType<P> = "exprEditor" | RichExprEditorType<P>;
|
|
89
|
+
export type ComponentChoiceType<P, Opt extends ChoiceValue = ChoiceValue, Val = Opt | Opt[]> = PropTypeBaseDefault<P, Val> & ChoiceCore<ComponentControlContext<P>, Opt>;
|
|
90
|
+
export interface SingleChoiceType<P, Opt extends ChoiceValue = ChoiceValue> extends ComponentChoiceType<P, Opt, Opt> {
|
|
91
|
+
multiSelect?: false;
|
|
92
|
+
}
|
|
93
|
+
export interface MultiChoiceType<P, Opt extends ChoiceValue = ChoiceValue> extends ComponentChoiceType<P, Opt, Opt[]> {
|
|
94
|
+
multiSelect: true;
|
|
95
|
+
}
|
|
96
|
+
export interface CustomChoiceType<P> extends ComponentChoiceType<P, ChoiceValue, ChoiceValue | ChoiceValue[]> {
|
|
97
|
+
multiSelect: ComponentContextConfig<P, boolean>;
|
|
98
|
+
}
|
|
99
|
+
export type ChoiceType<P> = SingleChoiceType<P> | MultiChoiceType<P> | CustomChoiceType<P>;
|
|
100
|
+
export interface FormValidationRulesType<P> extends PropTypeBaseDefault<P, any> {
|
|
101
|
+
type: "formValidationRules";
|
|
102
|
+
}
|
|
103
|
+
export interface EventHandlerType<P> extends PropTypeBase<ComponentControlContext<P>> {
|
|
104
|
+
type: "eventHandler";
|
|
105
|
+
argTypes: {
|
|
106
|
+
name: string;
|
|
107
|
+
type: ArgType<any>;
|
|
108
|
+
}[];
|
|
109
|
+
}
|
|
110
|
+
export interface RichSlotType<P> {
|
|
111
|
+
type: "slot";
|
|
112
|
+
description?: string;
|
|
113
|
+
/**
|
|
114
|
+
* The unique names of all code components that can be placed in the slot
|
|
115
|
+
*/
|
|
116
|
+
allowedComponents?: string[];
|
|
117
|
+
/**
|
|
118
|
+
* Wheter Plasmic Components with a root component included in the
|
|
119
|
+
* "allowedComponents" list are valid or not.
|
|
120
|
+
* Only used if the "allowedComponents" list is set.
|
|
121
|
+
*/
|
|
122
|
+
allowRootWrapper?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Whether the "empty slot" placeholder should be hidden in the canvas.
|
|
125
|
+
*/
|
|
126
|
+
hidePlaceholder?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the slot is repeated, i.e., is rendered multiple times using
|
|
129
|
+
* repeatedElement().
|
|
130
|
+
*/
|
|
131
|
+
isRepeated?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* A nicer, human-readable display name for your slot prop
|
|
134
|
+
*/
|
|
135
|
+
displayName?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Function for whether this slot should be hidden from the left tree,
|
|
138
|
+
* given the current props for this component
|
|
139
|
+
*/
|
|
140
|
+
hidden?: ComponentContextConfig<P, boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* If slot is a render prop (accepts a function that takes in some
|
|
143
|
+
* arguments and returns some JSX), then specify the names of the
|
|
144
|
+
* arguments expected by the render prop function.
|
|
145
|
+
*/
|
|
146
|
+
renderPropParams?: string[];
|
|
147
|
+
/**
|
|
148
|
+
* When inserting top-level "page sections", should this slot be the default target?
|
|
149
|
+
*/
|
|
150
|
+
unstable__isMainContentSlot?: boolean;
|
|
151
|
+
defaultValue?: PlasmicElement | PlasmicElement[];
|
|
152
|
+
/**
|
|
153
|
+
* When true, when you click for the first time in this slot and the component was not selected, the component itself
|
|
154
|
+
* is selected, making it easier to select the component instead of slot contents. So for
|
|
155
|
+
* instance, setting this on a Button slot ensures that clicking on the Button’s text will still select the Button and not
|
|
156
|
+
* the text element in its slot. Clicking again will deep-select the slot content. Similar in this regard to trapsFocus on components.
|
|
157
|
+
*
|
|
158
|
+
* Furthermore, the component further shows the props of whatever is in the slot on
|
|
159
|
+
* the parent component for the user's convenience. Handy for various “wrapper" components, form fields, and so on.
|
|
160
|
+
*/
|
|
161
|
+
mergeWithParent?: boolean | ComponentContextConfig<P, boolean>;
|
|
162
|
+
/**
|
|
163
|
+
* A function that returns true to hide the merged props conditionally.
|
|
164
|
+
*/
|
|
165
|
+
hiddenMergedProps?: ComponentContextConfig<P, boolean>;
|
|
166
|
+
}
|
|
167
|
+
export type SlotType<P> = "slot" | RichSlotType<P>;
|
|
168
|
+
export interface RichImageUrlType<P> extends PropTypeBaseDefault<P, string> {
|
|
169
|
+
type: "imageUrl";
|
|
170
|
+
}
|
|
171
|
+
export type ImageUrlType<P> = "imageUrl" | RichImageUrlType<P>;
|
|
172
|
+
export interface ModalProps {
|
|
173
|
+
show?: boolean;
|
|
174
|
+
children?: React.ReactNode;
|
|
175
|
+
onClose: () => void;
|
|
176
|
+
style?: CSSProperties;
|
|
177
|
+
}
|
|
178
|
+
export interface StudioOps {
|
|
179
|
+
showModal: (modalProps: Omit<ModalProps, "onClose"> & {
|
|
180
|
+
onClose?: () => void;
|
|
181
|
+
}) => void;
|
|
182
|
+
refreshQueryData: () => void;
|
|
183
|
+
appendToSlot: (element: PlasmicElement, slotName: string) => void;
|
|
184
|
+
removeFromSlotAt: (pos: number, slotName: string) => void;
|
|
185
|
+
updateProps: (newValues: any) => void;
|
|
186
|
+
updateStates: (newValues: any) => void;
|
|
187
|
+
}
|
|
188
|
+
export interface ProjectData {
|
|
189
|
+
components: {
|
|
190
|
+
name: string;
|
|
191
|
+
}[];
|
|
192
|
+
pages: {
|
|
193
|
+
name: string;
|
|
194
|
+
pageMeta: {
|
|
195
|
+
path: string;
|
|
196
|
+
};
|
|
197
|
+
}[];
|
|
198
|
+
}
|
|
199
|
+
export interface CustomControlProps<P> {
|
|
200
|
+
componentProps: P;
|
|
201
|
+
/**
|
|
202
|
+
* `contextData` can be `null` if the prop controls are rendering before
|
|
203
|
+
* the component instance itself (it will re-render once the component
|
|
204
|
+
* calls `setControlContextData`)
|
|
205
|
+
*/
|
|
206
|
+
contextData: InferDataType<P> | null;
|
|
207
|
+
/**
|
|
208
|
+
* Operations available to the editor that allow modifying the entire component.
|
|
209
|
+
* Can be null if the custom prop is used in a global context.
|
|
210
|
+
*/
|
|
211
|
+
studioOps: StudioOps | null;
|
|
212
|
+
/**
|
|
213
|
+
* Metadata from the studio project.
|
|
214
|
+
*/
|
|
215
|
+
projectData: ProjectData;
|
|
216
|
+
value: any;
|
|
217
|
+
/**
|
|
218
|
+
* Sets the value to be passed to the prop. Expects a JSON-compatible value.
|
|
219
|
+
*/
|
|
220
|
+
updateValue: (newVal: any) => void;
|
|
221
|
+
/**
|
|
222
|
+
* Full screen modal component
|
|
223
|
+
*/
|
|
224
|
+
FullscreenModal: React.ComponentType<ModalProps>;
|
|
225
|
+
/**
|
|
226
|
+
* Modal component for the side pane
|
|
227
|
+
*/
|
|
228
|
+
SideModal: React.ComponentType<ModalProps>;
|
|
229
|
+
/**
|
|
230
|
+
* The document that the component will be rendered into; instead of using
|
|
231
|
+
* `document` directly (for, say, `document.querySelector()` etc.), you
|
|
232
|
+
* should use this instead.
|
|
233
|
+
*/
|
|
234
|
+
studioDocument: typeof document;
|
|
235
|
+
}
|
|
236
|
+
export type CustomControl<P> = React.ComponentType<CustomControlProps<P>>;
|
|
237
|
+
export interface RichCustomType<P> extends PropTypeBaseDefault<P, any> {
|
|
238
|
+
type: "custom";
|
|
239
|
+
control: CustomControl<P>;
|
|
240
|
+
}
|
|
241
|
+
export type CustomType<P> = RichCustomType<P> | CustomControl<P>;
|
|
242
|
+
export interface DynamicType<P> extends PropTypeBase<ComponentControlContext<P>>, DynamicCore<ComponentControlContext<P>, PropType<P>> {
|
|
243
|
+
}
|
|
244
|
+
export type PrimitiveType<P = any> = Extract<StringType<P> | BooleanType<P> | NumberType<P> | JSONLikeType<P>, string>;
|
|
245
|
+
export type PropType<P> = StringType<P> | BooleanType<P> | GraphQLType<P> | NumberType<P> | JSONLikeType<P> | DataSourceType<P> | DataPickerType<P> | ExprEditorType<P> | FormValidationRulesType<P> | EventHandlerType<P> | ChoiceType<P> | CustomType<P> | DynamicType<P> | ImageUrlType<P> | SlotType<P> | DateStringType<P> | DateRangeStringsType<P>;
|
|
246
|
+
export type ArgType<P> = Exclude<PropType<P>, SlotType<P> | EventHandlerType<P>>;
|
|
247
|
+
export type StringCompatType<P> = DateStringType<P> | StringType<P> | ChoiceType<P> | JSONLikeType<P> | ImageUrlType<P> | CustomType<P> | DataPickerType<P>;
|
|
248
|
+
export type BoolCompatType<P> = BooleanType<P> | CustomType<P> | DataPickerType<P>;
|
|
249
|
+
export type NumberCompatType<P> = NumberType<P> | CustomType<P> | DataPickerType<P>;
|
|
250
|
+
export type RestrictPropType<T, P> = T extends string ? StringCompatType<P> : T extends boolean ? BoolCompatType<P> : T extends number ? NumberCompatType<P> : PropType<P>;
|
|
251
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ContextDependentConfig } from "./shared-controls";
|
|
2
|
+
export interface ObjectTypeBaseCore<Ctx extends any[], Values, Keys extends string = string> {
|
|
3
|
+
type: "object";
|
|
4
|
+
fields?: Record<Keys, Values>;
|
|
5
|
+
nameFunc?: (item: any, ...args: Ctx) => string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Controls how the object editor is displayed in the UI. If not specified, Plasmic will choose the appropriate display mode.
|
|
8
|
+
* - "popup": Displays the object in a popup
|
|
9
|
+
* - "inline": Displays the object fields inline
|
|
10
|
+
* - "flatten": Displays the object fields inline at the parent level. The parent label is not displayed.
|
|
11
|
+
*/
|
|
12
|
+
display?: "inline" | "popup" | "flatten";
|
|
13
|
+
}
|
|
14
|
+
export interface ArrayTypeBaseCore<Ctx extends any[], Fields> {
|
|
15
|
+
type: "array";
|
|
16
|
+
itemType?: ObjectTypeBaseCore<Ctx, Fields>;
|
|
17
|
+
/**
|
|
18
|
+
* Optional function that determines whether the user can delete a given item.
|
|
19
|
+
*/
|
|
20
|
+
unstable__canDelete?: (item: any, ...args: Ctx) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Specify how to let Plasmic know how to update its own internal representation of the data when the value has
|
|
23
|
+
* changed, or when issuing a minimalValue or shownValue that is different.
|
|
24
|
+
*
|
|
25
|
+
* Important to specify this if you are expecting any nested expression values in this data type!
|
|
26
|
+
*/
|
|
27
|
+
unstable__keyFunc?: (item: any) => any;
|
|
28
|
+
/**
|
|
29
|
+
* Specify what would be the tentative new value that is set if the user makes any changes.
|
|
30
|
+
*
|
|
31
|
+
* Useful for field mappings.
|
|
32
|
+
*
|
|
33
|
+
* For instance, consider a Table where we have a `fields` prop:
|
|
34
|
+
*
|
|
35
|
+
* - Initially, the value is undefined. But if the user makes any changes, we would want to save an array of at
|
|
36
|
+
* least three items (corresponding to, say, three columns inferred from a schema).
|
|
37
|
+
*
|
|
38
|
+
* - Let's say there are 5 columns in the value. The data schema changes, removing a column and adding two new
|
|
39
|
+
* ones. Now we would want a different minimal value, containing 6 items.
|
|
40
|
+
*/
|
|
41
|
+
unstable__minimalValue?: ContextDependentConfig<Ctx, any>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ChoiceCore, ChoiceValue } from "./choice-type";
|
|
2
|
+
import { ArrayTypeBaseCore, ObjectTypeBaseCore } from "./container-types";
|
|
3
|
+
import { DynamicCore, GraphQLCore, GraphQLValue } from "./misc-types";
|
|
4
|
+
import { DateRangeStringsCore, DateStringCore, NumberTypeBaseCore, RichBooleanCore } from "./primitive-types";
|
|
5
|
+
import { QueryBuilderCore } from "./query-builder-types";
|
|
6
|
+
import { CommonTypeBase, ContextDependentConfig, Defaultable, GenericContext } from "./shared-controls";
|
|
7
|
+
import { Nullish } from "./type-utils";
|
|
8
|
+
export type FunctionControlContext<P> = GenericContext<Partial<P>, // Partial function props
|
|
9
|
+
any>;
|
|
10
|
+
export type FunctionContextConfig<Args extends any[], R> = ContextDependentConfig<FunctionControlContext<Args>, R>;
|
|
11
|
+
export type TypeBaseDefault<Ctx extends any[], T> = CommonTypeBase & Defaultable<Ctx, T>;
|
|
12
|
+
export interface PlainStringType<T extends Nullish<string> = string> extends TypeBaseDefault<any[], T> {
|
|
13
|
+
type: "string" | `'${T}'`;
|
|
14
|
+
}
|
|
15
|
+
export type StringType<P, T extends string = string> = "string" | PlainStringType<T> | ChoiceType<P, T> | DateStringType | DateRangeStringsType | AnyType;
|
|
16
|
+
export interface PlainNumberType<T extends Nullish<number> = number> extends TypeBaseDefault<any[], T> {
|
|
17
|
+
type: "number" | `${number extends T ? number : T}`;
|
|
18
|
+
}
|
|
19
|
+
export type NumberType<P, T extends number = number> = PlainNumberType<T> | (TypeBaseDefault<FunctionControlContext<P>, T> & NumberTypeBaseCore<FunctionControlContext<P>>) | ChoiceType<P, T> | AnyType;
|
|
20
|
+
export interface PlainBooleanType<T extends Nullish<boolean> = boolean> extends TypeBaseDefault<any[], T> {
|
|
21
|
+
type: "boolean" | `${boolean extends T ? boolean : T}`;
|
|
22
|
+
}
|
|
23
|
+
export type BooleanType<P, T extends boolean = boolean> = PlainBooleanType<T> | (TypeBaseDefault<FunctionControlContext<P>, T> & RichBooleanCore) | ChoiceType<P, T> | AnyType;
|
|
24
|
+
export type GraphQLType<P> = TypeBaseDefault<FunctionControlContext<P>, any> & GraphQLCore<FunctionControlContext<P>>;
|
|
25
|
+
export interface PlainNullType extends TypeBaseDefault<any[], null> {
|
|
26
|
+
type: "null";
|
|
27
|
+
}
|
|
28
|
+
export type NullType = PlainNullType | AnyType;
|
|
29
|
+
export interface PlainUndefinedType extends TypeBaseDefault<any[], undefined> {
|
|
30
|
+
type: "undefined";
|
|
31
|
+
}
|
|
32
|
+
export type UndefinedType = PlainUndefinedType | AnyType;
|
|
33
|
+
export type ExtractObjectKeys<T extends object> = keyof T & string;
|
|
34
|
+
export type ObjectType<P, T extends object> = TypeBaseDefault<FunctionControlContext<P>, T> & ObjectTypeBaseCore<FunctionControlContext<P>, GenericType<P, any>, ExtractObjectKeys<T>>;
|
|
35
|
+
export type ArrayType<P> = TypeBaseDefault<FunctionControlContext<P>, any[]> & ArrayTypeBaseCore<FunctionControlContext<P>, GenericType<P, any>>;
|
|
36
|
+
export type QueryBuilderType<P> = TypeBaseDefault<FunctionControlContext<P>, any> & QueryBuilderCore<FunctionControlContext<P>>;
|
|
37
|
+
export interface PlainAnyType extends TypeBaseDefault<FunctionControlContext<any>, any> {
|
|
38
|
+
type: "any";
|
|
39
|
+
}
|
|
40
|
+
export type AnyType = PlainAnyType;
|
|
41
|
+
export interface PlainVoidType extends CommonTypeBase {
|
|
42
|
+
type: "void";
|
|
43
|
+
}
|
|
44
|
+
export type VoidType = PlainVoidType | AnyType;
|
|
45
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
46
|
+
type CommonType<P, T> = T extends GraphQLValue ? GraphQLType<P> : T extends null ? NullType : T extends undefined ? UndefinedType : T extends Array<any> ? ArrayType<P> : T extends object ? ObjectType<P, T> : AnyType;
|
|
47
|
+
type AnyTyping<P, T> = T extends string ? StringType<P, T> : T extends number ? NumberType<P, T> : T extends boolean ? BooleanType<P, T> : CommonType<P, T>;
|
|
48
|
+
export type ToTuple<T> = T extends any[] ? T : never;
|
|
49
|
+
export type ChoiceTypeBase<Args, Opt extends ChoiceValue = ChoiceValue> = TypeBaseDefault<FunctionControlContext<ToTuple<Args>>, Opt | Opt[]> & ChoiceCore<FunctionControlContext<ToTuple<Args>>, Opt>;
|
|
50
|
+
export interface SingleChoiceType<P, Opt extends ChoiceValue = ChoiceValue> extends ChoiceTypeBase<P, Opt> {
|
|
51
|
+
multiSelect?: false;
|
|
52
|
+
}
|
|
53
|
+
export interface MultiChoiceType<P, Opt extends ChoiceValue = ChoiceValue> extends ChoiceTypeBase<P, Opt> {
|
|
54
|
+
multiSelect: true;
|
|
55
|
+
}
|
|
56
|
+
export interface CustomChoiceType<P, Opt extends ChoiceValue = ChoiceValue> extends ChoiceTypeBase<P, Opt> {
|
|
57
|
+
multiSelect: FunctionContextConfig<ToTuple<P>, boolean>;
|
|
58
|
+
}
|
|
59
|
+
export type ChoiceType<P, T extends ChoiceValue = ChoiceValue> = SingleChoiceType<P, T> | MultiChoiceType<P, T> | CustomChoiceType<P, T>;
|
|
60
|
+
export type DateStringType = TypeBaseDefault<FunctionControlContext<string>, string> & DateStringCore;
|
|
61
|
+
export type DateRangeStringsType = TypeBaseDefault<FunctionControlContext<[string, string]>, [
|
|
62
|
+
string,
|
|
63
|
+
string
|
|
64
|
+
]> & DateRangeStringsCore;
|
|
65
|
+
export interface DynamicType<P> extends CommonTypeBase, DynamicCore<FunctionControlContext<ToTuple<P>>, GenericType<P, any>> {
|
|
66
|
+
}
|
|
67
|
+
export type RestrictedType<P, T> = IsAny<T> extends true ? AnyTyping<P, T> : [
|
|
68
|
+
T
|
|
69
|
+
] extends [string] ? StringType<P, T> : [T] extends [number] ? NumberType<P, T> : [T] extends [boolean] ? BooleanType<P, T> : T extends string | null | undefined ? Exclude<T, null | undefined> extends string ? StringType<P, T extends string ? T : string> : CommonType<P, T> : T extends number | null | undefined ? Exclude<T, null | undefined> extends number ? NumberType<P, T extends number ? T : number> : CommonType<P, T> : T extends boolean | null | undefined ? Exclude<T, null | undefined> extends boolean ? BooleanType<P, T extends boolean ? T : boolean> : CommonType<P, T> : CommonType<P, T>;
|
|
70
|
+
export type GenericType<P, T> = RestrictedType<P, T> | DynamicType<P> | QueryBuilderType<P>;
|
|
71
|
+
export interface ParamTypeBase {
|
|
72
|
+
name: string;
|
|
73
|
+
}
|
|
74
|
+
export type ParamType<P, T> = ParamTypeBase & GenericType<P, T>;
|
|
75
|
+
export type RequiredParam<P, T> = ParamTypeBase & ParamType<P, T> & {
|
|
76
|
+
isOptional?: false;
|
|
77
|
+
isRestParameter?: false;
|
|
78
|
+
};
|
|
79
|
+
export type OptionalParam<P, T> = ParamTypeBase & ParamType<P, T> & {
|
|
80
|
+
isRestParameter?: false;
|
|
81
|
+
};
|
|
82
|
+
export type RestParam<P, T> = ParamTypeBase & ParamType<P, T> & {
|
|
83
|
+
isOptional?: false;
|
|
84
|
+
isRestParameter: true;
|
|
85
|
+
};
|
|
86
|
+
type RequiredParams<T extends any[], U extends any[] = []> = Partial<T> extends T ? U : T extends [infer F, ...infer R] ? RequiredParams<R, [...U, F]> : U;
|
|
87
|
+
type OptionalParams<T extends any[]> = T extends [
|
|
88
|
+
...RequiredParams<T>,
|
|
89
|
+
...infer R
|
|
90
|
+
] ? [...R] : [];
|
|
91
|
+
type HandleRequiredParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [string | RequiredParam<P, H>, ...HandleRequiredParams<P, T>] : [];
|
|
92
|
+
type HandleOptionalParams<P, R extends any[]> = R extends [infer H, ...infer T] ? [] | [
|
|
93
|
+
string | OptionalParam<P, H | undefined>,
|
|
94
|
+
...HandleOptionalParams<P, T>
|
|
95
|
+
] : R extends [] ? [] : R extends Array<infer T> ? [] | [RestParam<P, T[]>] : [];
|
|
96
|
+
export type HandleParams<P extends any[]> = [
|
|
97
|
+
...HandleRequiredParams<P, RequiredParams<P>>,
|
|
98
|
+
...HandleOptionalParams<P, Required<OptionalParams<P>>>
|
|
99
|
+
];
|
|
100
|
+
export type HandleReturnType<P, T> = VoidType | ParamType<P, T>;
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ContextDependentConfig } from "./shared-controls";
|
|
2
|
+
export interface RichExprEditorCore<Ctx extends any[]> {
|
|
3
|
+
type: "exprEditor";
|
|
4
|
+
data?: Record<string, any> | ContextDependentConfig<Ctx, Record<string, any>>;
|
|
5
|
+
isolateEnv?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DataSourceCore {
|
|
8
|
+
type: "dataSource";
|
|
9
|
+
dataSource: "airtable" | "cms";
|
|
10
|
+
}
|
|
11
|
+
export type DataPickerValueType = string | number | (string | number)[];
|
|
12
|
+
export interface RichDataPickerCore<Ctx extends any[]> {
|
|
13
|
+
type: "dataSelector";
|
|
14
|
+
data?: Record<string, any> | ContextDependentConfig<Ctx, Record<string, any>>;
|
|
15
|
+
alwaysShowValuePathAsLabel?: boolean;
|
|
16
|
+
isolateEnv?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type GraphQLValue = {
|
|
19
|
+
query: string;
|
|
20
|
+
variables?: Record<string, any>;
|
|
21
|
+
};
|
|
22
|
+
export interface GraphQLCore<Ctx extends any[]> {
|
|
23
|
+
type: "code";
|
|
24
|
+
lang: "graphql";
|
|
25
|
+
endpoint: string | ContextDependentConfig<Ctx, string>;
|
|
26
|
+
method?: string | ContextDependentConfig<Ctx, string>;
|
|
27
|
+
headers?: object | ContextDependentConfig<Ctx, object>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Dynamic prop/param type that returns different control types based on context
|
|
31
|
+
*/
|
|
32
|
+
export interface DynamicCore<Ctx extends any[], ControlType> {
|
|
33
|
+
type: "dynamic";
|
|
34
|
+
/**
|
|
35
|
+
* Function that takes the context and returns a control type
|
|
36
|
+
*/
|
|
37
|
+
control: ContextDependentConfig<Ctx, ControlType>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CSSProperties } from "../element-types";
|
|
3
|
+
import { StyleSection } from "../registerComponent";
|
|
4
|
+
import { ContextDependentConfig } from "./shared-controls";
|
|
5
|
+
export interface RichBooleanCore {
|
|
6
|
+
type: "boolean";
|
|
7
|
+
}
|
|
8
|
+
export interface NumberTypeBaseCore<Ctx extends any[]> {
|
|
9
|
+
type: "number";
|
|
10
|
+
min?: number | ContextDependentConfig<Ctx, number>;
|
|
11
|
+
max?: number | ContextDependentConfig<Ctx, number>;
|
|
12
|
+
}
|
|
13
|
+
export interface PlainNumberCore<Ctx extends any[]> extends NumberTypeBaseCore<Ctx> {
|
|
14
|
+
control?: "default";
|
|
15
|
+
}
|
|
16
|
+
export interface SliderNumberCore<Ctx extends any[]> extends NumberTypeBaseCore<Ctx> {
|
|
17
|
+
control: "slider";
|
|
18
|
+
step?: number | ContextDependentConfig<Ctx, number>;
|
|
19
|
+
}
|
|
20
|
+
export interface PlainStringCore {
|
|
21
|
+
type: "string";
|
|
22
|
+
control?: "default" | "large" | "multiLine";
|
|
23
|
+
isLocalizable?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface CodeStringCore {
|
|
26
|
+
type: "code";
|
|
27
|
+
lang: "css" | "html" | "javascript" | "json";
|
|
28
|
+
}
|
|
29
|
+
export interface RichTextCore {
|
|
30
|
+
type: "richText";
|
|
31
|
+
}
|
|
32
|
+
export interface HrefCore {
|
|
33
|
+
type: "href";
|
|
34
|
+
}
|
|
35
|
+
export interface ColorCore {
|
|
36
|
+
type: "color";
|
|
37
|
+
/**
|
|
38
|
+
* If specified, and the user picks a color token in the Studio, then
|
|
39
|
+
* the value passed in as prop is a css variable reference, like
|
|
40
|
+
* `var(--TOKEN_ID)`, instead of the resolved hex value of the token.
|
|
41
|
+
* You should take care in using this in the proper css context --
|
|
42
|
+
* the css token is only defined if you are rendering under some
|
|
43
|
+
* Plasmic component in the DOM tree, which is usually the case,
|
|
44
|
+
* unless you are using a React portal.
|
|
45
|
+
*/
|
|
46
|
+
keepCssVar?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Prevent tokens from being selected.
|
|
49
|
+
*/
|
|
50
|
+
disableTokens?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface DateStringCore {
|
|
53
|
+
type: "dateString";
|
|
54
|
+
}
|
|
55
|
+
export interface DateRangeStringsCore {
|
|
56
|
+
type: "dateRangeStrings";
|
|
57
|
+
}
|
|
58
|
+
export interface ClassCore {
|
|
59
|
+
type: "class";
|
|
60
|
+
/**
|
|
61
|
+
* Additional css selectors that can change how this style should look.
|
|
62
|
+
* Some examples:
|
|
63
|
+
*
|
|
64
|
+
* * `:hover` -- on hover
|
|
65
|
+
* * `[data-something="blah"] -- when the element with this class has
|
|
66
|
+
* an html attribute "data-something=blah"
|
|
67
|
+
* * :component[data-something="blah"] :self -- when the root of the
|
|
68
|
+
* component has an html attribute "data-something=blah". Note that
|
|
69
|
+
* the non-standard `:component` selector is used to select the
|
|
70
|
+
* component root, and the non-standard `:self` selector is used
|
|
71
|
+
* to select the element that this class is attached to.
|
|
72
|
+
*/
|
|
73
|
+
selectors?: {
|
|
74
|
+
/**
|
|
75
|
+
* A css selector, like `:hover` or `[data-something="blah"]`.
|
|
76
|
+
*/
|
|
77
|
+
selector: string;
|
|
78
|
+
/**
|
|
79
|
+
* An optional human-friendly label for the selector, so the studio user
|
|
80
|
+
* knows what this selector means.
|
|
81
|
+
*/
|
|
82
|
+
label?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Initial styles to be applied for this selector
|
|
85
|
+
*/
|
|
86
|
+
defaultStyles?: CSSProperties;
|
|
87
|
+
}[];
|
|
88
|
+
/**
|
|
89
|
+
* If specified, then only shows these style sections for styling this class
|
|
90
|
+
*/
|
|
91
|
+
styleSections?: StyleSection[];
|
|
92
|
+
/**
|
|
93
|
+
* Initial styles to be applied for this class
|
|
94
|
+
*/
|
|
95
|
+
defaultStyles?: CSSProperties;
|
|
96
|
+
}
|
|
97
|
+
export interface ThemeResetClassCore {
|
|
98
|
+
type: "themeResetClass";
|
|
99
|
+
/**
|
|
100
|
+
* Normally, theme reset class will only target Plasmic-generated tags
|
|
101
|
+
* with the default tag styles. If you also want to target non-Plasmic-generated
|
|
102
|
+
* tags (say, rendered by your code components, or fetched as an HTML blob
|
|
103
|
+
* from somewhere), then specify `true` here.
|
|
104
|
+
*/
|
|
105
|
+
targetAllTags?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface CardPickerCore<Ctx extends any[]> {
|
|
108
|
+
type: "cardPicker";
|
|
109
|
+
modalTitle?: React.ReactNode | ContextDependentConfig<Ctx, React.ReactNode>;
|
|
110
|
+
options: {
|
|
111
|
+
value: string;
|
|
112
|
+
label?: string;
|
|
113
|
+
imgUrl: string;
|
|
114
|
+
footer?: React.ReactNode;
|
|
115
|
+
}[] | ContextDependentConfig<Ctx, {
|
|
116
|
+
value: string;
|
|
117
|
+
label?: string;
|
|
118
|
+
imgUrl: string;
|
|
119
|
+
footer?: React.ReactNode;
|
|
120
|
+
}[]>;
|
|
121
|
+
showInput?: boolean | ContextDependentConfig<Ctx, boolean>;
|
|
122
|
+
onSearch?: ContextDependentConfig<Ctx, ((value: string) => void) | undefined>;
|
|
123
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ContextDependentConfig } from "./shared-controls";
|
|
2
|
+
/**
|
|
3
|
+
* Control type for building a custom query format.
|
|
4
|
+
*
|
|
5
|
+
* This control is based on react-awesome-query-builder
|
|
6
|
+
* and returns data in JsonLogic format.
|
|
7
|
+
*
|
|
8
|
+
* If using this control type, it's recommended to install
|
|
9
|
+
* @react-awesome-query-builder/core and json-logic-js as devDependencies
|
|
10
|
+
* so that you can reference their types.
|
|
11
|
+
*
|
|
12
|
+
* References:
|
|
13
|
+
* - https://github.com/ukrbublik/react-awesome-query-builder
|
|
14
|
+
* - https://github.com/jwadhams/json-logic-js
|
|
15
|
+
* - https://jsonlogic.com/
|
|
16
|
+
*/
|
|
17
|
+
export interface QueryBuilderCore<Ctx extends any[]> {
|
|
18
|
+
type: "queryBuilder";
|
|
19
|
+
/**
|
|
20
|
+
* Return a @react-awesome-query-builder/core `Config` that will be merged
|
|
21
|
+
* with Plasmic's built-in config.
|
|
22
|
+
*
|
|
23
|
+
* https://github.com/plasmicapp/plasmic/blob/master/platform/wab/src/wab/client/components/QueryBuilder/QueryBuilderConfig.tsx
|
|
24
|
+
*
|
|
25
|
+
* At a minimum, this should return fields and their types.
|
|
26
|
+
* For configuration options, see react-awesome-query-builder docs.
|
|
27
|
+
*/
|
|
28
|
+
config: ContextDependentConfig<Ctx, SimplifiedConfig>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A simplified subset of @react-awesome-query-builder/core `Config`.
|
|
32
|
+
*/
|
|
33
|
+
interface SimplifiedConfig {
|
|
34
|
+
fields: SimplifiedFields;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A simplified subset of @react-awesome-query-builder/core `Fields`.
|
|
38
|
+
*/
|
|
39
|
+
interface SimplifiedFields {
|
|
40
|
+
[key: string]: SimplifiedField;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A simplified subset of @react-awesome-query-builder/core `FieldOrGroup`.
|
|
44
|
+
*/
|
|
45
|
+
interface SimplifiedField {
|
|
46
|
+
type: "text" | "number" | "boolean" | "date" | "time" | "datetime" | "select" | "multiselect" | "treeselect" | "treemultiselect" | string;
|
|
47
|
+
label?: string;
|
|
48
|
+
defaultValue?: unknown;
|
|
49
|
+
fieldSettings?: {};
|
|
50
|
+
}
|
|
51
|
+
export {};
|