@evoke-platform/ui-components 1.8.0-testing.9 → 1.8.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/published/components/custom/DataGrid/DataGrid.d.ts +1 -0
- package/dist/published/components/custom/DataGrid/DataGrid.js +2 -1
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +1 -0
- package/dist/published/components/custom/DataGrid/Toolbar.js +3 -2
- package/dist/published/components/custom/DataGrid/index.d.ts +1 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +47 -40
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.js +1 -1
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ActionDialog.d.ts +2 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ActionDialog.js +2 -2
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.d.ts +2 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.js +2 -2
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.d.ts +1 -1
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +18 -6
- package/dist/published/components/custom/Form/tests/Form.test.js +192 -2
- package/dist/published/components/custom/Form/tests/test-data.d.ts +7 -0
- package/dist/published/components/custom/Form/tests/test-data.js +138 -0
- package/dist/published/components/custom/FormV2/FormRenderer.d.ts +2 -2
- package/dist/published/components/custom/FormV2/FormRendererContainer.d.ts +3 -2
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +1 -1
- package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +1 -2
- package/dist/published/components/custom/FormV2/components/utils.d.ts +1 -1
- package/dist/published/components/custom/FormV2/components/utils.js +1 -1
- package/dist/published/components/custom/FormV2/tests/FormRenderer.test.d.ts +1 -0
- package/dist/published/components/custom/FormV2/tests/FormRenderer.test.js +173 -0
- package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.d.ts +1 -0
- package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.js +96 -0
- package/dist/published/components/custom/FormV2/tests/test-data.d.ts +16 -0
- package/dist/published/components/custom/FormV2/tests/test-data.js +394 -0
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/index.d.ts +1 -1
- package/dist/published/stories/FormRenderer.stories.d.ts +7 -0
- package/dist/published/stories/FormRenderer.stories.js +65 -0
- package/dist/published/stories/FormRendererContainer.stories.d.ts +7 -0
- package/dist/published/stories/FormRendererContainer.stories.js +56 -0
- package/dist/published/stories/FormRendererData.d.ts +116 -0
- package/dist/published/stories/FormRendererData.js +925 -0
- package/dist/published/stories/sharedMswHandlers.d.ts +1 -0
- package/dist/published/stories/sharedMswHandlers.js +100 -0
- package/package.json +10 -4
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
//Forms
|
|
2
|
+
export const createSpecialtyForm = {
|
|
3
|
+
id: 'specialtyForm',
|
|
4
|
+
name: 'Specialty Form',
|
|
5
|
+
objectId: 'specialty',
|
|
6
|
+
actionId: '_create',
|
|
7
|
+
entries: [
|
|
8
|
+
{
|
|
9
|
+
parameterId: 'name',
|
|
10
|
+
type: 'input',
|
|
11
|
+
display: {
|
|
12
|
+
label: 'Name',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
parameterId: 'specialtyType',
|
|
17
|
+
type: 'input',
|
|
18
|
+
display: {
|
|
19
|
+
label: 'Specialty Type',
|
|
20
|
+
relatedObjectDisplay: 'dropdown',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
parameterId: 'license',
|
|
25
|
+
type: 'input',
|
|
26
|
+
display: {
|
|
27
|
+
label: 'License',
|
|
28
|
+
relatedObjectDisplay: 'dropdown',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
export const simpleConditionDisplayTestSpecialtyForm = {
|
|
34
|
+
id: 'specialtyForm',
|
|
35
|
+
name: 'Specialty Form',
|
|
36
|
+
objectId: 'specialty',
|
|
37
|
+
actionId: 'simpleConditionDisplayTest',
|
|
38
|
+
entries: [
|
|
39
|
+
{
|
|
40
|
+
parameterId: 'specialtyType',
|
|
41
|
+
type: 'input',
|
|
42
|
+
display: {
|
|
43
|
+
label: 'Specialty Type',
|
|
44
|
+
relatedObjectDisplay: 'dropdown',
|
|
45
|
+
visibility: {
|
|
46
|
+
operator: 'all',
|
|
47
|
+
conditions: [
|
|
48
|
+
{
|
|
49
|
+
property: 'name',
|
|
50
|
+
operator: 'eq',
|
|
51
|
+
value: 'Test Specialty Object Instance',
|
|
52
|
+
isInstanceProperty: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
parameterId: 'license',
|
|
60
|
+
type: 'input',
|
|
61
|
+
display: {
|
|
62
|
+
label: 'License',
|
|
63
|
+
relatedObjectDisplay: 'dropdown',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
export const jsonLogicDisplayTestSpecialtyForm = {
|
|
69
|
+
id: 'specialtyForm',
|
|
70
|
+
name: 'Specialty Form',
|
|
71
|
+
objectId: 'specialty',
|
|
72
|
+
actionId: 'jsonLogicDisplayTest',
|
|
73
|
+
entries: [
|
|
74
|
+
{
|
|
75
|
+
parameterId: 'specialtyType',
|
|
76
|
+
type: 'input',
|
|
77
|
+
display: {
|
|
78
|
+
label: 'Specialty Type',
|
|
79
|
+
relatedObjectDisplay: 'dropdown',
|
|
80
|
+
visibility: {
|
|
81
|
+
'===': [
|
|
82
|
+
{
|
|
83
|
+
var: 'instance.name',
|
|
84
|
+
},
|
|
85
|
+
'Test Specialty Object Instance',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
parameterId: 'license',
|
|
92
|
+
type: 'input',
|
|
93
|
+
display: {
|
|
94
|
+
label: 'License',
|
|
95
|
+
relatedObjectDisplay: 'dropdown',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
// Objects
|
|
101
|
+
export const licenseObject = {
|
|
102
|
+
id: 'license',
|
|
103
|
+
name: 'License',
|
|
104
|
+
properties: [
|
|
105
|
+
{
|
|
106
|
+
id: 'name',
|
|
107
|
+
name: 'License Number',
|
|
108
|
+
type: 'string',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'status',
|
|
112
|
+
name: 'Status',
|
|
113
|
+
type: 'string',
|
|
114
|
+
enum: ['Active', 'Inactive'],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'licenseType',
|
|
118
|
+
name: 'License Type',
|
|
119
|
+
type: 'object',
|
|
120
|
+
objectId: 'licenseType',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
actions: [
|
|
124
|
+
{
|
|
125
|
+
id: '_update',
|
|
126
|
+
name: 'Update',
|
|
127
|
+
type: 'update',
|
|
128
|
+
outputEvent: 'License Updated',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: '_delete',
|
|
132
|
+
name: 'Delete',
|
|
133
|
+
type: 'delete',
|
|
134
|
+
outputEvent: 'License Deleted',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: '_create',
|
|
138
|
+
name: 'Create',
|
|
139
|
+
type: 'create',
|
|
140
|
+
outputEvent: 'License Created',
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
};
|
|
144
|
+
export const licenseTypeObject = {
|
|
145
|
+
id: 'licenseType',
|
|
146
|
+
name: 'License Type',
|
|
147
|
+
properties: [
|
|
148
|
+
{
|
|
149
|
+
id: 'name',
|
|
150
|
+
name: 'Name',
|
|
151
|
+
type: 'string',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'licenseNumberPrefix',
|
|
155
|
+
name: 'License Number Prefix',
|
|
156
|
+
type: 'string',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
actions: [
|
|
160
|
+
{
|
|
161
|
+
id: '_update',
|
|
162
|
+
name: 'Update',
|
|
163
|
+
type: 'update',
|
|
164
|
+
outputEvent: 'License Type Updated',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: '_delete',
|
|
168
|
+
name: 'Delete',
|
|
169
|
+
type: 'delete',
|
|
170
|
+
outputEvent: 'License Type Deleted',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: '_create',
|
|
174
|
+
name: 'Create',
|
|
175
|
+
type: 'create',
|
|
176
|
+
outputEvent: 'License Type Created',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
};
|
|
180
|
+
export const specialtyObject = {
|
|
181
|
+
id: 'specialty',
|
|
182
|
+
name: 'Specialty',
|
|
183
|
+
properties: [
|
|
184
|
+
{
|
|
185
|
+
id: 'name',
|
|
186
|
+
name: 'Name',
|
|
187
|
+
type: 'string',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: 'specialtyType',
|
|
191
|
+
name: 'Specialty Type',
|
|
192
|
+
type: 'object',
|
|
193
|
+
objectId: 'specialtyType',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: 'license',
|
|
197
|
+
name: 'License',
|
|
198
|
+
type: 'object',
|
|
199
|
+
objectId: 'license',
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
actions: [
|
|
203
|
+
{
|
|
204
|
+
id: '_update',
|
|
205
|
+
name: 'Update',
|
|
206
|
+
type: 'update',
|
|
207
|
+
outputEvent: 'Specialty Updated',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: '_delete',
|
|
211
|
+
name: 'Delete',
|
|
212
|
+
type: 'delete',
|
|
213
|
+
outputEvent: 'Specialty Deleted',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: '_create',
|
|
217
|
+
name: 'Create',
|
|
218
|
+
type: 'create',
|
|
219
|
+
outputEvent: 'Specialty Created',
|
|
220
|
+
parameters: [
|
|
221
|
+
{
|
|
222
|
+
id: 'name',
|
|
223
|
+
name: 'Name',
|
|
224
|
+
type: 'string',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: 'specialtyType',
|
|
228
|
+
name: 'Specialty Type',
|
|
229
|
+
type: 'object',
|
|
230
|
+
objectId: 'specialtyType',
|
|
231
|
+
validation: {
|
|
232
|
+
criteria: {
|
|
233
|
+
$and: [{ 'licenseType.id': '{{{input.license.licenseType.id}}}' }],
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 'license',
|
|
239
|
+
name: 'License',
|
|
240
|
+
type: 'object',
|
|
241
|
+
objectId: 'license',
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 'jsonLogicDisplayTest',
|
|
247
|
+
name: 'JsonLogic Display Test',
|
|
248
|
+
type: 'update',
|
|
249
|
+
outputEvent: 'Specialty Updated',
|
|
250
|
+
parameters: [
|
|
251
|
+
{
|
|
252
|
+
id: 'specialtyType',
|
|
253
|
+
name: 'Specialty Type',
|
|
254
|
+
type: 'object',
|
|
255
|
+
objectId: 'specialtyType',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: 'license',
|
|
259
|
+
name: 'License',
|
|
260
|
+
type: 'object',
|
|
261
|
+
objectId: 'license',
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: 'simpleConditionDisplayTest',
|
|
267
|
+
name: 'Simple Condition Display Test',
|
|
268
|
+
type: 'update',
|
|
269
|
+
outputEvent: 'Specialty Updated',
|
|
270
|
+
parameters: [
|
|
271
|
+
{
|
|
272
|
+
id: 'specialtyType',
|
|
273
|
+
name: 'Specialty Type',
|
|
274
|
+
type: 'object',
|
|
275
|
+
objectId: 'specialtyType',
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: 'license',
|
|
279
|
+
name: 'License',
|
|
280
|
+
type: 'object',
|
|
281
|
+
objectId: 'license',
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
};
|
|
287
|
+
export const specialtyTypeObject = {
|
|
288
|
+
id: 'specialtyType',
|
|
289
|
+
name: 'Specialty Type',
|
|
290
|
+
properties: [
|
|
291
|
+
{
|
|
292
|
+
id: 'name',
|
|
293
|
+
name: 'Name',
|
|
294
|
+
type: 'string',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: 'licenseType',
|
|
298
|
+
name: 'License Type',
|
|
299
|
+
type: 'object',
|
|
300
|
+
objectId: 'licenseType',
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
actions: [
|
|
304
|
+
{
|
|
305
|
+
id: '_update',
|
|
306
|
+
name: 'Update',
|
|
307
|
+
type: 'update',
|
|
308
|
+
outputEvent: 'Specialty Type Updated',
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
id: '_delete',
|
|
312
|
+
name: 'Delete',
|
|
313
|
+
type: 'delete',
|
|
314
|
+
outputEvent: 'Specialty Type Deleted',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
id: '_create',
|
|
318
|
+
name: 'Create',
|
|
319
|
+
type: 'create',
|
|
320
|
+
outputEvent: 'Specialty Type Created',
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
};
|
|
324
|
+
// Instances
|
|
325
|
+
export const rnLicense = {
|
|
326
|
+
id: 'rnLicense',
|
|
327
|
+
objectId: 'license',
|
|
328
|
+
name: 'RN License',
|
|
329
|
+
licenseType: {
|
|
330
|
+
id: 'rnLicenseType',
|
|
331
|
+
name: 'RN License Type',
|
|
332
|
+
},
|
|
333
|
+
status: 'Active',
|
|
334
|
+
};
|
|
335
|
+
export const npLicense = {
|
|
336
|
+
id: 'npLicense',
|
|
337
|
+
objectId: 'license',
|
|
338
|
+
name: 'NP License',
|
|
339
|
+
licenseType: {
|
|
340
|
+
id: 'npLicenseType',
|
|
341
|
+
name: 'NP License Type',
|
|
342
|
+
},
|
|
343
|
+
status: 'Active',
|
|
344
|
+
};
|
|
345
|
+
export const rnLicenseType = {
|
|
346
|
+
id: 'rnLicenseType',
|
|
347
|
+
objectId: 'licenseType',
|
|
348
|
+
name: 'RN License Type',
|
|
349
|
+
licenseNumberPrefix: 'RN',
|
|
350
|
+
};
|
|
351
|
+
export const npLicesneType = {
|
|
352
|
+
id: 'npLicenseType',
|
|
353
|
+
objectId: 'licenseType',
|
|
354
|
+
name: 'NP License Type',
|
|
355
|
+
licenseNumberPrefix: 'NP',
|
|
356
|
+
};
|
|
357
|
+
export const rnSpecialtyType1 = {
|
|
358
|
+
id: 'specialtyType1',
|
|
359
|
+
objectId: 'specialtyType',
|
|
360
|
+
name: 'RN Specialty Type #1',
|
|
361
|
+
int: 1,
|
|
362
|
+
licenseType: {
|
|
363
|
+
id: 'rnLicenseType',
|
|
364
|
+
name: 'RN License Type',
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
export const rnSpecialtyType2 = {
|
|
368
|
+
id: 'specialtyType2',
|
|
369
|
+
objectId: 'specialtyType',
|
|
370
|
+
name: 'RN Specialty Type #2',
|
|
371
|
+
int: 1,
|
|
372
|
+
licenseType: {
|
|
373
|
+
id: 'rnLicenseType',
|
|
374
|
+
name: 'RN License Type',
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
export const npSpecialtyType1 = {
|
|
378
|
+
id: 'specialtyType3',
|
|
379
|
+
objectId: 'specialtyType',
|
|
380
|
+
name: 'NP Specialty Type #1',
|
|
381
|
+
licenseType: {
|
|
382
|
+
id: 'npLicenseType',
|
|
383
|
+
name: 'NP License Type',
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
export const npSpecialtyType2 = {
|
|
387
|
+
id: 'specialtyType4',
|
|
388
|
+
objectId: 'specialtyType',
|
|
389
|
+
name: 'NP Specialty Type #2',
|
|
390
|
+
licenseType: {
|
|
391
|
+
id: 'npLicenseType',
|
|
392
|
+
name: 'NP License Type',
|
|
393
|
+
},
|
|
394
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { BuilderGrid } from './BuilderGrid';
|
|
2
2
|
export { CriteriaBuilder, getReadableQuery } from './CriteriaBuilder';
|
|
3
3
|
export { DataGrid } from './DataGrid';
|
|
4
|
+
export type { GridSortModel } from './DataGrid';
|
|
4
5
|
export { ErrorComponent } from './ErrorComponent';
|
|
5
6
|
export { Form } from './Form';
|
|
6
7
|
export type { FormRef } from './Form';
|
|
@@ -3,7 +3,7 @@ export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTime
|
|
|
3
3
|
export * from './colors';
|
|
4
4
|
export * from './components/core';
|
|
5
5
|
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormContext, FormField, FormRenderer, FormRendererContainer, getReadableQuery, HistoryLog, MenuBar, MultiSelect, RecursiveEntryRenderer, RepeatableField, ResponsiveOverflow, RichTextViewer, UserAvatar, } from './components/custom';
|
|
6
|
-
export type { FormRef } from './components/custom';
|
|
6
|
+
export type { FormRef, GridSortModel } from './components/custom';
|
|
7
7
|
export { NumericFormat } from './components/custom/FormField/InputFieldComponent';
|
|
8
8
|
export { Box, Container, Grid, Stack } from './components/layout';
|
|
9
9
|
export * from './theme';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
|
+
import { FormRenderer } from '../components/custom';
|
|
3
|
+
declare const _default: ComponentMeta<typeof FormRenderer>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Editable: ComponentStory<typeof FormRenderer>;
|
|
6
|
+
export declare const NoButtons: ComponentStory<typeof FormRenderer>;
|
|
7
|
+
export declare const DocumentForm: ComponentStory<typeof FormRenderer>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { set } from 'lodash';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
5
|
+
import { FormRenderer } from '../components/custom';
|
|
6
|
+
import { formatSubmission } from '../components/custom/FormV2/components/utils';
|
|
7
|
+
import { docFormData, documentInstance, formData, instance, mockDocEvokeForm, mockEvokeForm } from './FormRendererData';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Custom/FormRenderer',
|
|
10
|
+
component: FormRenderer,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'fullscreen',
|
|
13
|
+
},
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (React.createElement(Box, { sx: { padding: '2rem', paddingBottom: 0, '& .css-x8wy7h': { bottom: 0 } } },
|
|
16
|
+
React.createElement(Story, null))),
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
// Functions for story props
|
|
20
|
+
async function onSave(data) {
|
|
21
|
+
console.log('raw data', data);
|
|
22
|
+
const formattedSubmission = await formatSubmission(structuredClone(data));
|
|
23
|
+
console.log('formatted data', formattedSubmission);
|
|
24
|
+
}
|
|
25
|
+
function onValidationChange(error) {
|
|
26
|
+
console.log('error', error);
|
|
27
|
+
}
|
|
28
|
+
const mockProps = {
|
|
29
|
+
onSubmit: onSave,
|
|
30
|
+
hideButtons: false,
|
|
31
|
+
fieldHeight: 'medium',
|
|
32
|
+
form: mockEvokeForm,
|
|
33
|
+
instance: instance,
|
|
34
|
+
onValidationChange: onValidationChange,
|
|
35
|
+
};
|
|
36
|
+
const Template = (args) => {
|
|
37
|
+
const [formDataState, setFormDataState] = React.useState(args.form.id === 'documentForm' ? docFormData : formData);
|
|
38
|
+
const handleChange = React.useCallback((field, value) => {
|
|
39
|
+
setFormDataState((prev) => {
|
|
40
|
+
const newData = { ...prev };
|
|
41
|
+
set(newData, field, value);
|
|
42
|
+
return newData;
|
|
43
|
+
});
|
|
44
|
+
}, []);
|
|
45
|
+
function onCancel() {
|
|
46
|
+
setFormDataState(formData);
|
|
47
|
+
}
|
|
48
|
+
return (React.createElement(MemoryRouter, null,
|
|
49
|
+
React.createElement(FormRenderer, { ...args, value: formDataState, onChange: handleChange, onCancel: onCancel })));
|
|
50
|
+
};
|
|
51
|
+
export const Editable = Template.bind({});
|
|
52
|
+
Editable.args = {
|
|
53
|
+
...mockProps,
|
|
54
|
+
};
|
|
55
|
+
export const NoButtons = Template.bind({});
|
|
56
|
+
NoButtons.args = {
|
|
57
|
+
...mockProps,
|
|
58
|
+
hideButtons: true,
|
|
59
|
+
};
|
|
60
|
+
export const DocumentForm = Template.bind({});
|
|
61
|
+
DocumentForm.args = {
|
|
62
|
+
...mockProps,
|
|
63
|
+
form: mockDocEvokeForm,
|
|
64
|
+
instance: documentInstance,
|
|
65
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
|
+
import { FormRendererContainer } from '../components/custom';
|
|
3
|
+
declare const _default: ComponentMeta<typeof FormRendererContainer>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Editable: ComponentStory<typeof FormRendererContainer>;
|
|
6
|
+
export declare const NoButtons: ComponentStory<typeof FormRendererContainer>;
|
|
7
|
+
export declare const DocumentForm: ComponentStory<typeof FormRendererContainer>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { http, HttpResponse } from 'msw';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
5
|
+
import { FormRendererContainer } from '../components/custom';
|
|
6
|
+
import { documentInstance } from './FormRendererData';
|
|
7
|
+
import { sharedObjectHandlers } from './sharedMswHandlers';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Custom/FormRendererContainer',
|
|
10
|
+
component: FormRendererContainer,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'fullscreen',
|
|
13
|
+
msw: {
|
|
14
|
+
handlers: [
|
|
15
|
+
...sharedObjectHandlers,
|
|
16
|
+
// Document fetch
|
|
17
|
+
http.get('api/data/objects/genericEvokeForm/instances/updateGenericEvokeFormInstanceId/documents/documentInstanceId', () => HttpResponse.json(documentInstance)),
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
decorators: [
|
|
22
|
+
(Story) => (React.createElement(Box, { sx: { padding: '2rem', paddingBottom: 0, '& .css-x8wy7h': { bottom: -1 } } },
|
|
23
|
+
React.createElement(Story, null))),
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
const mockProps = {
|
|
27
|
+
formId: 'updateGenericEvokeForm',
|
|
28
|
+
instanceId: 'updateGenericEvokeFormInstanceId',
|
|
29
|
+
dataType: 'objectInstances',
|
|
30
|
+
display: {
|
|
31
|
+
fieldHeight: 'medium',
|
|
32
|
+
},
|
|
33
|
+
actionId: '_update',
|
|
34
|
+
stickyFooter: true,
|
|
35
|
+
objectId: 'genericEvokeForm',
|
|
36
|
+
};
|
|
37
|
+
const Template = (args) => {
|
|
38
|
+
return (React.createElement(MemoryRouter, null,
|
|
39
|
+
React.createElement(FormRendererContainer, { ...args })));
|
|
40
|
+
};
|
|
41
|
+
export const Editable = Template.bind({});
|
|
42
|
+
Editable.args = {
|
|
43
|
+
...mockProps,
|
|
44
|
+
};
|
|
45
|
+
export const NoButtons = Template.bind({});
|
|
46
|
+
NoButtons.args = {
|
|
47
|
+
...mockProps,
|
|
48
|
+
hideButtons: true,
|
|
49
|
+
};
|
|
50
|
+
export const DocumentForm = Template.bind({});
|
|
51
|
+
DocumentForm.args = {
|
|
52
|
+
...mockProps,
|
|
53
|
+
formId: 'documentForm',
|
|
54
|
+
documentId: 'documentInstanceId',
|
|
55
|
+
dataType: 'documents',
|
|
56
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { EvokeForm, Obj, ObjectInstance } from '@evoke-platform/context';
|
|
2
|
+
import { Document } from '../components/custom/FormV2/components/types';
|
|
3
|
+
export declare const formData: {
|
|
4
|
+
name: string;
|
|
5
|
+
multiSelect: string[];
|
|
6
|
+
address: {
|
|
7
|
+
city: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const instance: ObjectInstance;
|
|
11
|
+
export declare const documentInstance: Document;
|
|
12
|
+
export declare const docFormData: {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
contentType: string;
|
|
16
|
+
size: number;
|
|
17
|
+
uploadedDate: string;
|
|
18
|
+
type: string;
|
|
19
|
+
view_permission: string;
|
|
20
|
+
versionId: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const mockGenericEvokeFormObject: Obj;
|
|
23
|
+
export declare const mockMovieObject: Obj;
|
|
24
|
+
export declare const mockCustomerObject: Obj;
|
|
25
|
+
export declare const mockPeopleGenericObject: Obj;
|
|
26
|
+
export declare const mockPeopleObject: Obj;
|
|
27
|
+
export declare const mockEvokeForm: EvokeForm;
|
|
28
|
+
export declare const mockCustomerUpdateForm: EvokeForm;
|
|
29
|
+
export declare const mockCustomerCreateForm: EvokeForm;
|
|
30
|
+
export declare const mockMovieCreateForm: EvokeForm;
|
|
31
|
+
export declare const mockDocEvokeForm: EvokeForm;
|
|
32
|
+
export declare const mockPropertiesForCriteria: ({
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
required: boolean;
|
|
37
|
+
searchable: boolean;
|
|
38
|
+
enum?: undefined;
|
|
39
|
+
objectId?: undefined;
|
|
40
|
+
relatedPropertyId?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
type: string;
|
|
45
|
+
enum: string[];
|
|
46
|
+
required?: undefined;
|
|
47
|
+
searchable?: undefined;
|
|
48
|
+
objectId?: undefined;
|
|
49
|
+
relatedPropertyId?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
type: string;
|
|
54
|
+
required?: undefined;
|
|
55
|
+
searchable?: undefined;
|
|
56
|
+
enum?: undefined;
|
|
57
|
+
objectId?: undefined;
|
|
58
|
+
relatedPropertyId?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
type: string;
|
|
63
|
+
objectId: string;
|
|
64
|
+
required?: undefined;
|
|
65
|
+
searchable?: undefined;
|
|
66
|
+
enum?: undefined;
|
|
67
|
+
relatedPropertyId?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
type: string;
|
|
72
|
+
objectId: string;
|
|
73
|
+
relatedPropertyId: string;
|
|
74
|
+
required?: undefined;
|
|
75
|
+
searchable?: undefined;
|
|
76
|
+
enum?: undefined;
|
|
77
|
+
})[];
|
|
78
|
+
export declare const mockInstancesForRelatedObject: {
|
|
79
|
+
id: string;
|
|
80
|
+
objectId: string;
|
|
81
|
+
name: string;
|
|
82
|
+
runTime: string;
|
|
83
|
+
description: string;
|
|
84
|
+
}[];
|
|
85
|
+
export declare const mockInstancesForCollection: {
|
|
86
|
+
version: number;
|
|
87
|
+
id: string;
|
|
88
|
+
objectId: string;
|
|
89
|
+
genericEvokeForm: {
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
};
|
|
93
|
+
name: string;
|
|
94
|
+
decimal: number;
|
|
95
|
+
livingPlace: {
|
|
96
|
+
city: string;
|
|
97
|
+
line1: string;
|
|
98
|
+
line2: string;
|
|
99
|
+
state: string;
|
|
100
|
+
zipCode: string;
|
|
101
|
+
county: string;
|
|
102
|
+
};
|
|
103
|
+
}[];
|
|
104
|
+
export declare const mockPeopleGenericObjectInstances: {
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
people: {
|
|
108
|
+
id: string;
|
|
109
|
+
name: string;
|
|
110
|
+
};
|
|
111
|
+
genericEvokeForm: {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
};
|
|
115
|
+
objectId: string;
|
|
116
|
+
}[];
|