@pcg/dynamic-components 1.0.0-alpha.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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +1816 -0
- package/dist/index.js +1564 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.cjs +14 -0
- package/package.json +30 -0
- package/src/assertions/basic.ts +58 -0
- package/src/assertions/containers.ts +76 -0
- package/src/assertions/index.ts +6 -0
- package/src/assertions/paths.ts +12 -0
- package/src/assertions/rich-text.ts +16 -0
- package/src/assertions/yjs.ts +25 -0
- package/src/data-objects/data-object.ts +34 -0
- package/src/data-objects/index.ts +3 -0
- package/src/data-objects/rich-text.ts +38 -0
- package/src/dynamic-components/fractional-indexing.ts +321 -0
- package/src/dynamic-components/index.ts +6 -0
- package/src/dynamic-components/paths.ts +194 -0
- package/src/dynamic-components/registry/chats.ts +24 -0
- package/src/dynamic-components/registry/content.ts +118 -0
- package/src/dynamic-components/registry/forms.ts +525 -0
- package/src/dynamic-components/registry/index.ts +6 -0
- package/src/dynamic-components/registry/layout.ts +86 -0
- package/src/dynamic-components/registry/uikit-dynamic-component.ts +84 -0
- package/src/dynamic-components/tools.ts +195 -0
- package/src/dynamic-components/types.ts +237 -0
- package/src/index.ts +7 -0
- package/src/paths/array-keys.ts +164 -0
- package/src/paths/array-ops.ts +124 -0
- package/src/paths/basic-ops.ts +181 -0
- package/src/paths/constants.ts +1 -0
- package/src/paths/index.ts +7 -0
- package/src/paths/tools.ts +42 -0
- package/src/paths/types.ts +133 -0
- package/src/y-components/index.ts +3 -0
- package/src/y-components/tools.ts +234 -0
- package/src/y-components/types.ts +19 -0
- package/src/y-tools/array-path-ops.ts +240 -0
- package/src/y-tools/basic-path-ops.ts +189 -0
- package/src/y-tools/index.ts +6 -0
- package/src/y-tools/tools.ts +122 -0
- package/src/y-tools/types.ts +32 -0
- package/src/y-tools/y-array-keys.ts +47 -0
- package/tests/assertions/basic-types.test.ts +78 -0
- package/tests/assertions/containers.test.ts +72 -0
- package/tests/assertions/paths.test.ts +23 -0
- package/tests/assertions/yjs.test.ts +33 -0
- package/tests/dynamic-components/paths.test.ts +171 -0
- package/tests/dynamic-components/tools.test.ts +121 -0
- package/tests/paths/array-keys.test.ts +182 -0
- package/tests/paths/array-ops.test.ts +164 -0
- package/tests/paths/basic-ops.test.ts +263 -0
- package/tests/paths/tools.test.ts +55 -0
- package/tests/y-components/tools.test.ts +198 -0
- package/tests/y-tools/array-base-ops.test.ts +55 -0
- package/tests/y-tools/array-path-ops.test.ts +95 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +13 -0
- package/tsdown.config.ts +18 -0
- package/vitest.config.ts +19 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { DynamicComponent, ValidationRules } from '../types.js';
|
|
2
|
+
|
|
3
|
+
export type ISizeType = 'middle' | 'large';
|
|
4
|
+
|
|
5
|
+
export enum IImageRenditionType {
|
|
6
|
+
ORIGINAL = 'ORIGINAL',
|
|
7
|
+
MAIN_2X = 'MAIN_2X',
|
|
8
|
+
MAIN = 'MAIN',
|
|
9
|
+
SMALL = 'SMALL',
|
|
10
|
+
MAIN_LEGACY = 'MAIN_LEGACY',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IRenditionOptions {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
type: IImageRenditionType;
|
|
17
|
+
mimeType?: string;
|
|
18
|
+
quality?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* HIDDEN INPUT */
|
|
22
|
+
export interface DHiddenInput extends DynamicComponent {
|
|
23
|
+
component: 'hidden-input';
|
|
24
|
+
props: {
|
|
25
|
+
name?: string;
|
|
26
|
+
rules?: ValidationRules;
|
|
27
|
+
testId?: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* COMPUTED VALUE */
|
|
32
|
+
export interface DComputedValue extends DynamicComponent {
|
|
33
|
+
component: 'computed-value';
|
|
34
|
+
props: {
|
|
35
|
+
name?: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
type: 'string' | 'number';
|
|
39
|
+
expression: string;
|
|
40
|
+
rules?: ValidationRules;
|
|
41
|
+
visible?: string;
|
|
42
|
+
testId?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const isComputedValueComponent = (component: DynamicComponent): component is DComputedValue => component.component === 'computed-value';
|
|
47
|
+
|
|
48
|
+
/* TEXT INPUT */
|
|
49
|
+
export interface DTextInput extends DynamicComponent {
|
|
50
|
+
component: 'text-input';
|
|
51
|
+
props: {
|
|
52
|
+
name?: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
hint?: string;
|
|
56
|
+
clearable?: boolean;
|
|
57
|
+
maska?: string;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
readonly?: boolean;
|
|
60
|
+
rules?: ValidationRules;
|
|
61
|
+
visible?: string;
|
|
62
|
+
testId?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const isTextInputComponent = (component: DynamicComponent): component is DTextInput => component.component === 'text-input';
|
|
67
|
+
|
|
68
|
+
/* CONFIRM DELATION INPUT */
|
|
69
|
+
export interface DConfirmDeletionInput extends DynamicComponent {
|
|
70
|
+
component: 'confirm-deletion-input';
|
|
71
|
+
props: {
|
|
72
|
+
title?: string;
|
|
73
|
+
text?: string;
|
|
74
|
+
keyWord: string;
|
|
75
|
+
testId?: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const isConfirmDeletionInputComponent = (component: DynamicComponent):
|
|
80
|
+
component is DConfirmDeletionInput => component.component === 'confirm-deletion-input';
|
|
81
|
+
|
|
82
|
+
/* TEXTAREA */
|
|
83
|
+
export interface DTextarea extends DynamicComponent {
|
|
84
|
+
component: 'textarea';
|
|
85
|
+
props: {
|
|
86
|
+
name?: string;
|
|
87
|
+
label?: string;
|
|
88
|
+
placeholder?: string;
|
|
89
|
+
hint?: string;
|
|
90
|
+
rows?: number;
|
|
91
|
+
autosize?: boolean;
|
|
92
|
+
lineBreak?: boolean;
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
readonly?: boolean;
|
|
95
|
+
rules?: ValidationRules;
|
|
96
|
+
visible?: string;
|
|
97
|
+
testId?: string;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const isTextareaComponent = (component: DynamicComponent): component is DTextarea => component.component === 'textarea';
|
|
102
|
+
|
|
103
|
+
/* HEADING */
|
|
104
|
+
export interface DHeading extends DynamicComponent {
|
|
105
|
+
component: 'heading';
|
|
106
|
+
props: {
|
|
107
|
+
text: string;
|
|
108
|
+
visible?: string;
|
|
109
|
+
testId?: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const isHeadingComponent = (component: DynamicComponent): component is DHeading => component.component === 'heading';
|
|
114
|
+
|
|
115
|
+
/* RICH TEXT EDITOR */
|
|
116
|
+
export interface DRichTextEditor extends DynamicComponent {
|
|
117
|
+
component: 'rich-text-editor';
|
|
118
|
+
props: {
|
|
119
|
+
name?: string;
|
|
120
|
+
label?: string;
|
|
121
|
+
placeholder?: string;
|
|
122
|
+
minHeight?: number;
|
|
123
|
+
maxLength?: number;
|
|
124
|
+
rules?: ValidationRules;
|
|
125
|
+
visible?: string;
|
|
126
|
+
testId?: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const isRichTextEditorComponent = (component: DynamicComponent): component is DRichTextEditor => component.component === 'rich-text-editor';
|
|
131
|
+
|
|
132
|
+
/* DATE */
|
|
133
|
+
export interface DDateTimePicker extends DynamicComponent {
|
|
134
|
+
component: 'date-time-picker';
|
|
135
|
+
props: {
|
|
136
|
+
name?: string;
|
|
137
|
+
label?: string;
|
|
138
|
+
placeholder?: string;
|
|
139
|
+
hint?: string;
|
|
140
|
+
type?: 'year' | 'month' | 'date' | 'dates' | 'week' | 'datetime' | 'datetimerange' | 'daterange' | 'monthrange';
|
|
141
|
+
readonly?: boolean;
|
|
142
|
+
format?: string;
|
|
143
|
+
clearable?: boolean;
|
|
144
|
+
rules?: {
|
|
145
|
+
required?: boolean;
|
|
146
|
+
};
|
|
147
|
+
visible?: string;
|
|
148
|
+
testId?: string;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export const isDateTimePickerComponent = (component: DynamicComponent): component is DDateTimePicker => {
|
|
153
|
+
return component.component === 'date-time-picker';
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/* NUMBER */
|
|
157
|
+
export interface DNumberInput extends DynamicComponent {
|
|
158
|
+
component: 'number-input';
|
|
159
|
+
props: {
|
|
160
|
+
name?: string;
|
|
161
|
+
label?: string;
|
|
162
|
+
placeholder?: string;
|
|
163
|
+
hint?: string;
|
|
164
|
+
autosize?: boolean;
|
|
165
|
+
readonly?: boolean;
|
|
166
|
+
rules?: ValidationRules;
|
|
167
|
+
visible?: string;
|
|
168
|
+
testId?: string;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const isNumberInputComponent = (component: DynamicComponent): component is DNumberInput => {
|
|
173
|
+
return component.component === 'number-input';
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/* SLUG */
|
|
177
|
+
export interface DSlug extends DynamicComponent {
|
|
178
|
+
component: 'slug';
|
|
179
|
+
props: {
|
|
180
|
+
name?: string;
|
|
181
|
+
source?: string;
|
|
182
|
+
maxLength?: number;
|
|
183
|
+
readonly?: boolean;
|
|
184
|
+
rules?: {
|
|
185
|
+
required?: boolean;
|
|
186
|
+
};
|
|
187
|
+
visible?: string;
|
|
188
|
+
testId?: string;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export const isSlugComponent = (component: DynamicComponent): component is DSlug => {
|
|
193
|
+
return component.component === 'slug';
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/* Image Uploader DynamicComponent */
|
|
197
|
+
export interface DImageUploader extends DynamicComponent {
|
|
198
|
+
component: 'image-uploader';
|
|
199
|
+
props: {
|
|
200
|
+
name?: string;
|
|
201
|
+
label?: string;
|
|
202
|
+
renditions: {
|
|
203
|
+
id: string;
|
|
204
|
+
position: string;
|
|
205
|
+
width: number;
|
|
206
|
+
height: number;
|
|
207
|
+
type: IImageRenditionType;
|
|
208
|
+
}[];
|
|
209
|
+
btnText?: string;
|
|
210
|
+
size?: ISizeType;
|
|
211
|
+
rounded?: ISizeType;
|
|
212
|
+
zoomable?: boolean;
|
|
213
|
+
downloadable?: boolean;
|
|
214
|
+
height?: number;
|
|
215
|
+
width?: number;
|
|
216
|
+
tooltipContent?: string;
|
|
217
|
+
hideTooltip?: boolean;
|
|
218
|
+
maxFileSize?: number;
|
|
219
|
+
readonly?: boolean;
|
|
220
|
+
visible?: string;
|
|
221
|
+
rules?: {
|
|
222
|
+
required?: boolean;
|
|
223
|
+
};
|
|
224
|
+
testId?: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export const isImageUploaderComponent = (component: DynamicComponent): component is DImageUploader => {
|
|
229
|
+
return component.component === 'image-uploader';
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export interface DRawImageUploader extends DynamicComponent {
|
|
233
|
+
component: 'raw-image-uploader';
|
|
234
|
+
props: {
|
|
235
|
+
name?: string;
|
|
236
|
+
label?: string;
|
|
237
|
+
btnText?: string;
|
|
238
|
+
size?: ISizeType;
|
|
239
|
+
rounded?: boolean;
|
|
240
|
+
zoomable?: boolean;
|
|
241
|
+
downloadable?: boolean;
|
|
242
|
+
height?: number;
|
|
243
|
+
width?: number;
|
|
244
|
+
hideTooltip?: boolean;
|
|
245
|
+
tooltipContent?: string;
|
|
246
|
+
maxFileSize?: number;
|
|
247
|
+
visible?: string;
|
|
248
|
+
readonly?: boolean;
|
|
249
|
+
rules?: {
|
|
250
|
+
required?: boolean;
|
|
251
|
+
};
|
|
252
|
+
testId?: string;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export const isRawImageUploaderComponent = (component: DynamicComponent): component is DRawImageUploader => {
|
|
257
|
+
return component.component === 'raw-image-uploader';
|
|
258
|
+
};
|
|
259
|
+
export interface DRawImagesUploader extends DynamicComponent {
|
|
260
|
+
component: 'raw-images-uploader';
|
|
261
|
+
props: {
|
|
262
|
+
name?: string;
|
|
263
|
+
label?: string;
|
|
264
|
+
btnText?: string;
|
|
265
|
+
size?: ISizeType;
|
|
266
|
+
rounded?: boolean;
|
|
267
|
+
zoomable?: boolean;
|
|
268
|
+
downloadable?: boolean;
|
|
269
|
+
height?: number;
|
|
270
|
+
width?: number;
|
|
271
|
+
tooltipContent?: string;
|
|
272
|
+
hideTooltip?: boolean;
|
|
273
|
+
maxFileSize?: number;
|
|
274
|
+
visible?: string;
|
|
275
|
+
readonly?: boolean;
|
|
276
|
+
rules?: {
|
|
277
|
+
required?: boolean;
|
|
278
|
+
max?: number;
|
|
279
|
+
};
|
|
280
|
+
testId?: string;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export const isRawImagesUploaderComponent = (component: DynamicComponent): component is DRawImagesUploader => {
|
|
285
|
+
return component.component === 'raw-images-uploader';
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export interface DSimpleImageUploader extends DynamicComponent {
|
|
289
|
+
component: 'simple-image-uploader';
|
|
290
|
+
props: {
|
|
291
|
+
name?: string;
|
|
292
|
+
label?: string;
|
|
293
|
+
rendition: {
|
|
294
|
+
width: number;
|
|
295
|
+
height: number;
|
|
296
|
+
type: IImageRenditionType;
|
|
297
|
+
};
|
|
298
|
+
btnText?: string;
|
|
299
|
+
size?: ISizeType;
|
|
300
|
+
rounded?: boolean;
|
|
301
|
+
zoomable?: boolean;
|
|
302
|
+
downloadable?: boolean;
|
|
303
|
+
width: number;
|
|
304
|
+
height: number;
|
|
305
|
+
hideTooltip?: boolean;
|
|
306
|
+
tooltipContent?: string;
|
|
307
|
+
maxFileSize?: number;
|
|
308
|
+
readonly?: boolean;
|
|
309
|
+
visible?: string;
|
|
310
|
+
rules?: {
|
|
311
|
+
required?: boolean;
|
|
312
|
+
};
|
|
313
|
+
testId?: string;
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export const isSimpleImageUploaderComponent = (component: DynamicComponent): component is DSimpleImageUploader => {
|
|
318
|
+
return component.component === 'simple-image-uploader';
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/* UPLOAD */
|
|
322
|
+
// export interface DUpload extends DynamicComponent {
|
|
323
|
+
// component: 'upload';
|
|
324
|
+
// props: {
|
|
325
|
+
// fileType: string;
|
|
326
|
+
// listType?: 'text' | 'picture' | 'picture-card';
|
|
327
|
+
// limit?: number;
|
|
328
|
+
// multiple?: boolean;
|
|
329
|
+
// rules?: {
|
|
330
|
+
// required?: boolean;
|
|
331
|
+
// };
|
|
332
|
+
// };
|
|
333
|
+
// }
|
|
334
|
+
|
|
335
|
+
/* MONACO */
|
|
336
|
+
// export interface DMonaco extends DynamicComponent {
|
|
337
|
+
// component: 'monaco';
|
|
338
|
+
// props: {
|
|
339
|
+
// height?: number;
|
|
340
|
+
// rules?: {
|
|
341
|
+
// required?: boolean;
|
|
342
|
+
// };
|
|
343
|
+
// };
|
|
344
|
+
// }
|
|
345
|
+
|
|
346
|
+
/* CONTENTFLOW */
|
|
347
|
+
// export interface DDesigner extends DynamicComponent {
|
|
348
|
+
// component: 'designer';
|
|
349
|
+
// props: {
|
|
350
|
+
// name?: string;
|
|
351
|
+
// };
|
|
352
|
+
// }
|
|
353
|
+
|
|
354
|
+
/* RADIO GROUP */
|
|
355
|
+
export interface DRadioGroup extends DynamicComponent {
|
|
356
|
+
component: 'radio-group';
|
|
357
|
+
props: {
|
|
358
|
+
name?: string;
|
|
359
|
+
label?: string;
|
|
360
|
+
cols?: number;
|
|
361
|
+
direction?: 'col' | 'row';
|
|
362
|
+
items: {
|
|
363
|
+
id: string;
|
|
364
|
+
position: string;
|
|
365
|
+
value: unknown;
|
|
366
|
+
label: string;
|
|
367
|
+
}[];
|
|
368
|
+
readonly?: boolean;
|
|
369
|
+
rules?: {
|
|
370
|
+
required?: boolean;
|
|
371
|
+
};
|
|
372
|
+
visible?: string;
|
|
373
|
+
testId?: string;
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export const isRadioGroupComponent = (component: DynamicComponent): component is DRadioGroup => {
|
|
378
|
+
return component.component === 'radio-group';
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
/* SELECT */
|
|
382
|
+
export interface DSelect extends DynamicComponent {
|
|
383
|
+
component: 'select';
|
|
384
|
+
props: {
|
|
385
|
+
name?: string;
|
|
386
|
+
label?: string;
|
|
387
|
+
placeholder?: string;
|
|
388
|
+
hint?: string;
|
|
389
|
+
clearable?: boolean;
|
|
390
|
+
options: {
|
|
391
|
+
id: string;
|
|
392
|
+
position: string;
|
|
393
|
+
value: unknown;
|
|
394
|
+
label: string;
|
|
395
|
+
imageUrl?: string;
|
|
396
|
+
disabled?: boolean;
|
|
397
|
+
}[];
|
|
398
|
+
readonly?: boolean;
|
|
399
|
+
multiple?: boolean;
|
|
400
|
+
rules?: {
|
|
401
|
+
required?: boolean;
|
|
402
|
+
max?: number;
|
|
403
|
+
};
|
|
404
|
+
visible?: string;
|
|
405
|
+
testId?: string;
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export const isSelectComponent = (cmp: DynamicComponent): cmp is DSelect => cmp.component === 'select';
|
|
410
|
+
|
|
411
|
+
/* ENTITY */
|
|
412
|
+
export interface DEntitySelect extends DynamicComponent {
|
|
413
|
+
component: 'entity-select';
|
|
414
|
+
props: {
|
|
415
|
+
name?: string;
|
|
416
|
+
label?: string;
|
|
417
|
+
placeholder?: string;
|
|
418
|
+
hint?: string;
|
|
419
|
+
entityType: string;
|
|
420
|
+
labelKey?: string;
|
|
421
|
+
idKey?: string;
|
|
422
|
+
filter?: Record<string, unknown>;
|
|
423
|
+
limit?: number;
|
|
424
|
+
multiple?: boolean;
|
|
425
|
+
visible?: string;
|
|
426
|
+
clearable?: boolean;
|
|
427
|
+
rules?: {
|
|
428
|
+
required?: boolean;
|
|
429
|
+
};
|
|
430
|
+
readonly?: boolean;
|
|
431
|
+
excludeIds?: string[];
|
|
432
|
+
imageUrlKey?: string;
|
|
433
|
+
defaultImageUrl?: string;
|
|
434
|
+
testId?: string;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export const isEntitySelectComponent = (cmp: DynamicComponent): cmp is DEntitySelect => cmp.component === 'entity-select';
|
|
439
|
+
|
|
440
|
+
/* CHECKBOX */
|
|
441
|
+
export interface DCheckbox extends DynamicComponent {
|
|
442
|
+
component: 'checkbox';
|
|
443
|
+
props: {
|
|
444
|
+
name?: string;
|
|
445
|
+
label?: string;
|
|
446
|
+
readonly?: boolean;
|
|
447
|
+
rules?: {
|
|
448
|
+
required?: boolean;
|
|
449
|
+
};
|
|
450
|
+
visible?: string;
|
|
451
|
+
testId?: string;
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export const isCheckboxComponent = (component: DynamicComponent): component is DCheckbox => {
|
|
456
|
+
return component.component === 'checkbox';
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
/* CHECKBOX GROUP */
|
|
460
|
+
export interface DCheckboxGroup extends DynamicComponent {
|
|
461
|
+
component: 'checkbox-group';
|
|
462
|
+
props: {
|
|
463
|
+
name?: string;
|
|
464
|
+
label?: string;
|
|
465
|
+
orientation?: 'horizontal' | 'vertical';
|
|
466
|
+
items: {
|
|
467
|
+
id: string;
|
|
468
|
+
position: string;
|
|
469
|
+
value: unknown;
|
|
470
|
+
label: string;
|
|
471
|
+
}[];
|
|
472
|
+
readonly?: boolean;
|
|
473
|
+
visible?: string;
|
|
474
|
+
rules?: {
|
|
475
|
+
required?: boolean;
|
|
476
|
+
};
|
|
477
|
+
testId?: string;
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export const isCheckboxGroupComponent = (component: DynamicComponent): component is DCheckboxGroup => {
|
|
482
|
+
return component.component === 'checkbox';
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
/* SWITCH */
|
|
486
|
+
export interface DSwitch extends DynamicComponent {
|
|
487
|
+
component: 'switch';
|
|
488
|
+
props: {
|
|
489
|
+
name?: string;
|
|
490
|
+
label?: string;
|
|
491
|
+
readonly?: boolean;
|
|
492
|
+
visible?: string;
|
|
493
|
+
rules?: {
|
|
494
|
+
required?: boolean;
|
|
495
|
+
};
|
|
496
|
+
testId?: string;
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export const isSwitchComponent = (component: DynamicComponent): component is DSwitch => {
|
|
501
|
+
return component.component === 'switch';
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
/* File Uploader */
|
|
505
|
+
export interface DFileUploader extends DynamicComponent {
|
|
506
|
+
component: 'file-uploader';
|
|
507
|
+
props: {
|
|
508
|
+
name?: string;
|
|
509
|
+
label?: string;
|
|
510
|
+
accept?: string;
|
|
511
|
+
placeholder?: string;
|
|
512
|
+
maxFileSize?: number;
|
|
513
|
+
downloadable?: boolean;
|
|
514
|
+
readonly?: boolean;
|
|
515
|
+
visible?: string;
|
|
516
|
+
rules?: {
|
|
517
|
+
required?: boolean;
|
|
518
|
+
};
|
|
519
|
+
testId?: string;
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export const isFileUploaderComponent = (component: DynamicComponent): component is DFileUploader => {
|
|
524
|
+
return component.component === 'file-uploader';
|
|
525
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { DynamicComponent, ValidationRules } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/* ROW & COLUMS */
|
|
4
|
+
export interface DColumn extends DynamicComponent {
|
|
5
|
+
component: 'column';
|
|
6
|
+
props: {
|
|
7
|
+
size: number;
|
|
8
|
+
visible?: string;
|
|
9
|
+
justifySelf?: 'start' | 'center' | 'end' | 'stretch';
|
|
10
|
+
placeSelf?: 'start' | 'center' | 'end' | 'stretch';
|
|
11
|
+
components: DynamicComponent[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const isColumnComponent = (component: DynamicComponent): component is DColumn => {
|
|
16
|
+
return component.component === 'column';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export interface DRow extends DynamicComponent {
|
|
20
|
+
component: 'row';
|
|
21
|
+
props: {
|
|
22
|
+
components: DColumn[];
|
|
23
|
+
visible?: string;
|
|
24
|
+
placeItems?: 'start' | 'center' | 'end' | 'stretch';
|
|
25
|
+
justifyItems?: 'start' | 'center' | 'end' | 'stretch';
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const isRowComponent = (component: DynamicComponent): component is DRow => {
|
|
30
|
+
return component.component === 'row';
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/* COLLECTION */
|
|
34
|
+
export interface DCollection extends DynamicComponent {
|
|
35
|
+
component: 'collection';
|
|
36
|
+
props: {
|
|
37
|
+
name?: string;
|
|
38
|
+
heading: string;
|
|
39
|
+
components: DynamicComponent[];
|
|
40
|
+
rules?: ValidationRules;
|
|
41
|
+
readonly?: boolean;
|
|
42
|
+
visible?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const isCollectionComponent = (component: DynamicComponent): component is DCollection => {
|
|
47
|
+
return component.component === 'collection';
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/* REPEATABLE COLLECTION */
|
|
51
|
+
export interface DRepeatableCollection extends DynamicComponent {
|
|
52
|
+
component: 'repeatable-collection';
|
|
53
|
+
props: {
|
|
54
|
+
name?: string;
|
|
55
|
+
heading: string;
|
|
56
|
+
collectionTitle?: string;
|
|
57
|
+
|
|
58
|
+
useTabs?: boolean;
|
|
59
|
+
cols?: number;
|
|
60
|
+
tabName?: string;
|
|
61
|
+
confirmDeletion?: boolean;
|
|
62
|
+
addButtonText?: string;
|
|
63
|
+
readonly?: boolean;
|
|
64
|
+
components: DynamicComponent[];
|
|
65
|
+
visible?: string;
|
|
66
|
+
rules?: {
|
|
67
|
+
required?: boolean;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const isRepeatableCollectionComponent = (component: DynamicComponent): component is DRepeatableCollection => {
|
|
73
|
+
return component.component === 'repeatable-collection';
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/* RowSettings */
|
|
77
|
+
export interface DRowSettings extends DynamicComponent {
|
|
78
|
+
component: 'row-settings';
|
|
79
|
+
props: {
|
|
80
|
+
label?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const isRowSettingsComponent = (component: DynamicComponent): component is DRowSettings => {
|
|
85
|
+
return component.component === 'row-settings';
|
|
86
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { DChatTextMessage } from './chats.js';
|
|
2
|
+
import {
|
|
3
|
+
DBiblePassage,
|
|
4
|
+
DBibleQuote,
|
|
5
|
+
DEmbedCode,
|
|
6
|
+
DImage,
|
|
7
|
+
DRichText,
|
|
8
|
+
} from './content.js';
|
|
9
|
+
import type {
|
|
10
|
+
DCheckbox,
|
|
11
|
+
DCheckboxGroup,
|
|
12
|
+
DComputedValue,
|
|
13
|
+
DConfirmDeletionInput,
|
|
14
|
+
DDateTimePicker,
|
|
15
|
+
DEntitySelect,
|
|
16
|
+
DFileUploader,
|
|
17
|
+
DHeading,
|
|
18
|
+
DHiddenInput,
|
|
19
|
+
DImageUploader,
|
|
20
|
+
DNumberInput,
|
|
21
|
+
DRadioGroup,
|
|
22
|
+
DRawImagesUploader,
|
|
23
|
+
DRawImageUploader,
|
|
24
|
+
DRichTextEditor,
|
|
25
|
+
DSelect,
|
|
26
|
+
DSimpleImageUploader,
|
|
27
|
+
DSlug,
|
|
28
|
+
DSwitch,
|
|
29
|
+
DTextarea,
|
|
30
|
+
DTextInput,
|
|
31
|
+
} from './forms.js';
|
|
32
|
+
import {
|
|
33
|
+
DCollection,
|
|
34
|
+
DColumn,
|
|
35
|
+
DRepeatableCollection,
|
|
36
|
+
DRow,
|
|
37
|
+
DRowSettings,
|
|
38
|
+
} from './layout.js';
|
|
39
|
+
|
|
40
|
+
export type FormDynamicComponent =
|
|
41
|
+
DTextInput
|
|
42
|
+
| DCheckbox
|
|
43
|
+
| DTextarea
|
|
44
|
+
| DSelect
|
|
45
|
+
| DEntitySelect
|
|
46
|
+
| DRadioGroup
|
|
47
|
+
| DCheckboxGroup
|
|
48
|
+
| DFileUploader
|
|
49
|
+
| DImageUploader
|
|
50
|
+
| DSimpleImageUploader
|
|
51
|
+
| DRawImageUploader
|
|
52
|
+
| DSlug
|
|
53
|
+
| DEmbedCode
|
|
54
|
+
| DRichTextEditor
|
|
55
|
+
| DNumberInput
|
|
56
|
+
| DSwitch
|
|
57
|
+
| DHeading
|
|
58
|
+
| DRawImagesUploader
|
|
59
|
+
| DDateTimePicker
|
|
60
|
+
| DComputedValue
|
|
61
|
+
| DHiddenInput
|
|
62
|
+
| DConfirmDeletionInput
|
|
63
|
+
|
|
64
|
+
export type UiKitContentDynamicComponent =
|
|
65
|
+
DRichText
|
|
66
|
+
| DEmbedCode
|
|
67
|
+
| DImage
|
|
68
|
+
| DBibleQuote
|
|
69
|
+
| DBiblePassage;
|
|
70
|
+
|
|
71
|
+
export type UiKitLayoutDynamicComponent =
|
|
72
|
+
DRow
|
|
73
|
+
| DColumn
|
|
74
|
+
| DRowSettings
|
|
75
|
+
| DCollection
|
|
76
|
+
| DRepeatableCollection;
|
|
77
|
+
|
|
78
|
+
export type UiKitChatDynamicComponent =
|
|
79
|
+
DChatTextMessage;
|
|
80
|
+
|
|
81
|
+
export type UiKitDynamicComponent = FormDynamicComponent
|
|
82
|
+
| UiKitContentDynamicComponent
|
|
83
|
+
| UiKitLayoutDynamicComponent
|
|
84
|
+
| UiKitChatDynamicComponent;
|