@evoke-platform/ui-components 1.15.1 → 1.17.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/CriteriaBuilder/CriteriaBuilder.js +3 -0
- package/dist/published/components/custom/Form/utils.d.ts +2 -2
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +1 -1
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.js +15 -7
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +1 -1
- package/dist/published/components/custom/FormField/Select/Select.js +1 -1
- package/dist/published/components/custom/FormV2/FormRenderer.js +5 -5
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +20 -10
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableFieldInput.js +3 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js +1 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Image.js +1 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +2 -0
- package/dist/published/components/custom/FormV2/components/FormletRenderer.d.ts +6 -0
- package/dist/published/components/custom/FormV2/components/FormletRenderer.js +30 -0
- package/dist/published/components/custom/FormV2/components/HtmlView.js +12 -9
- package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +8 -10
- package/dist/published/components/custom/FormV2/components/utils.d.ts +6 -2
- package/dist/published/components/custom/FormV2/components/utils.js +54 -4
- package/dist/published/components/custom/FormV2/tests/FormRenderer.test.js +48 -5
- package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.js +279 -35
- package/dist/published/stories/FormRendererData.d.ts +15 -0
- package/dist/published/stories/FormRendererData.js +63 -0
- package/dist/published/stories/sharedMswHandlers.js +4 -2
- package/package.json +2 -2
|
@@ -95,7 +95,7 @@ describe('FormRendererContainer', () => {
|
|
|
95
95
|
return HttpResponse.json(rnLicense);
|
|
96
96
|
}), http.get('/api/data/objects/specialtyType/instances', () => {
|
|
97
97
|
return HttpResponse.json([rnSpecialtyType1, rnSpecialtyType2]);
|
|
98
|
-
}), http.get('/api/data/forms/specialtyForm', () => {
|
|
98
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
99
99
|
return HttpResponse.json(createSpecialtyForm);
|
|
100
100
|
}));
|
|
101
101
|
render(React.createElement(FormRendererContainer, { objectId: 'specialty', formId: 'specialtyForm', dataType: 'objectInstances', actionId: '_create', associatedObject: { propertyId: 'license', instanceId: 'rnLicense' } }));
|
|
@@ -129,7 +129,7 @@ describe('FormRendererContainer', () => {
|
|
|
129
129
|
});
|
|
130
130
|
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
131
131
|
return HttpResponse.json(specialtyObject);
|
|
132
|
-
}), http.get('/api/data/forms/specialtyForm', () => {
|
|
132
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
133
133
|
return HttpResponse.json({
|
|
134
134
|
...createSpecialtyForm,
|
|
135
135
|
actionId: '_update',
|
|
@@ -159,6 +159,250 @@ describe('FormRendererContainer', () => {
|
|
|
159
159
|
}),
|
|
160
160
|
}));
|
|
161
161
|
});
|
|
162
|
+
it('should autosave only fields configured on the form', async () => {
|
|
163
|
+
const user = userEvent.setup();
|
|
164
|
+
let autosaveRequestBody;
|
|
165
|
+
server.use(http.get('/api/data/objects/specialty/instances/test-instance', () => {
|
|
166
|
+
return HttpResponse.json({
|
|
167
|
+
id: 'test-instance',
|
|
168
|
+
name: 'Original Name',
|
|
169
|
+
specialtyType: { id: 'someSpecialtyTypeId', name: 'Some Specialty Type' },
|
|
170
|
+
license: { id: 'someLicenseId', name: 'Some License' },
|
|
171
|
+
additionalTraining: 'Board Certified',
|
|
172
|
+
});
|
|
173
|
+
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
174
|
+
return HttpResponse.json(specialtyObject);
|
|
175
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
176
|
+
return HttpResponse.json({
|
|
177
|
+
...createSpecialtyForm,
|
|
178
|
+
actionId: '_update',
|
|
179
|
+
autosaveActionId: '_autosave',
|
|
180
|
+
});
|
|
181
|
+
}), http.post('/api/data/objects/specialty/instances/test-instance/actions', async ({ request }) => {
|
|
182
|
+
const body = (await request.json());
|
|
183
|
+
if (body.actionId === '_autosave') {
|
|
184
|
+
autosaveRequestBody = body;
|
|
185
|
+
}
|
|
186
|
+
return HttpResponse.json({
|
|
187
|
+
id: 'test-instance',
|
|
188
|
+
...body.input,
|
|
189
|
+
});
|
|
190
|
+
}));
|
|
191
|
+
render(React.createElement(FormRendererContainer, { objectId: 'specialty', formId: 'specialtyForm', dataType: 'objectInstances', actionId: '_update', instanceId: 'test-instance' }));
|
|
192
|
+
const nameField = await screen.findByRole('textbox', { name: 'Name' });
|
|
193
|
+
await user.clear(nameField);
|
|
194
|
+
await user.type(nameField, 'Updated Name');
|
|
195
|
+
await user.tab();
|
|
196
|
+
await waitFor(() => {
|
|
197
|
+
expect(autosaveRequestBody).toBeDefined();
|
|
198
|
+
});
|
|
199
|
+
expect(autosaveRequestBody?.input).toEqual({
|
|
200
|
+
// Should not include additionalTraining since it's not configured on the form
|
|
201
|
+
name: 'Updated Name',
|
|
202
|
+
license: { id: 'someLicenseId', name: 'Some License' },
|
|
203
|
+
specialtyType: { id: 'someSpecialtyTypeId', name: 'Some Specialty Type' },
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
it('should include conditionally visible form fields from autosave payload', async () => {
|
|
207
|
+
const user = userEvent.setup();
|
|
208
|
+
let autosaveRequestBody;
|
|
209
|
+
const specialtyFormWithHiddenField = {
|
|
210
|
+
id: 'specialtyForm',
|
|
211
|
+
name: 'Specialty Form',
|
|
212
|
+
objectId: 'specialty',
|
|
213
|
+
actionId: '_update',
|
|
214
|
+
autosaveActionId: '_autosave',
|
|
215
|
+
entries: [
|
|
216
|
+
{
|
|
217
|
+
parameterId: 'name',
|
|
218
|
+
type: 'input',
|
|
219
|
+
display: {
|
|
220
|
+
label: 'Name',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
parameterId: 'additionalTraining',
|
|
225
|
+
type: 'input',
|
|
226
|
+
display: {
|
|
227
|
+
label: 'Additional Training',
|
|
228
|
+
visibility: {
|
|
229
|
+
operator: 'all',
|
|
230
|
+
conditions: [
|
|
231
|
+
{
|
|
232
|
+
property: 'name',
|
|
233
|
+
operator: 'eq',
|
|
234
|
+
value: 'Show Hidden',
|
|
235
|
+
isInstanceProperty: false,
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
};
|
|
243
|
+
server.use(http.get('/api/data/objects/specialty/instances/test-instance', () => {
|
|
244
|
+
return HttpResponse.json({
|
|
245
|
+
id: 'test-instance',
|
|
246
|
+
name: 'Original Name',
|
|
247
|
+
specialtyType: null,
|
|
248
|
+
license: null,
|
|
249
|
+
additionalTraining: 'Should Autosave',
|
|
250
|
+
});
|
|
251
|
+
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
252
|
+
return HttpResponse.json(specialtyObject);
|
|
253
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
254
|
+
return HttpResponse.json(specialtyFormWithHiddenField);
|
|
255
|
+
}), http.post('/api/data/objects/specialty/instances/test-instance/actions', async ({ request }) => {
|
|
256
|
+
const body = (await request.json());
|
|
257
|
+
if (body.actionId === '_autosave') {
|
|
258
|
+
autosaveRequestBody = body;
|
|
259
|
+
}
|
|
260
|
+
return HttpResponse.json({
|
|
261
|
+
id: 'test-instance',
|
|
262
|
+
...body.input,
|
|
263
|
+
});
|
|
264
|
+
}));
|
|
265
|
+
render(React.createElement(FormRendererContainer, { objectId: 'specialty', formId: 'specialtyForm', dataType: 'objectInstances', actionId: '_update', instanceId: 'test-instance' }));
|
|
266
|
+
const nameField = await screen.findByRole('textbox', { name: 'Name' });
|
|
267
|
+
await user.clear(nameField);
|
|
268
|
+
await user.type(nameField, 'Show Hidden');
|
|
269
|
+
await user.tab();
|
|
270
|
+
await waitFor(() => {
|
|
271
|
+
expect(autosaveRequestBody).toBeDefined();
|
|
272
|
+
});
|
|
273
|
+
// Should include additionalTraining since it's visible
|
|
274
|
+
expect(autosaveRequestBody?.input).toEqual({
|
|
275
|
+
name: 'Show Hidden',
|
|
276
|
+
additionalTraining: 'Should Autosave',
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
it('should exclude hidden form fields from autosave payload', async () => {
|
|
280
|
+
const user = userEvent.setup();
|
|
281
|
+
let autosaveRequestBody;
|
|
282
|
+
const specialtyFormWithHiddenField = {
|
|
283
|
+
id: 'specialtyForm',
|
|
284
|
+
name: 'Specialty Form',
|
|
285
|
+
objectId: 'specialty',
|
|
286
|
+
actionId: '_update',
|
|
287
|
+
autosaveActionId: '_autosave',
|
|
288
|
+
entries: [
|
|
289
|
+
{
|
|
290
|
+
parameterId: 'name',
|
|
291
|
+
type: 'input',
|
|
292
|
+
display: {
|
|
293
|
+
label: 'Name',
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
parameterId: 'additionalTraining',
|
|
298
|
+
type: 'input',
|
|
299
|
+
display: {
|
|
300
|
+
label: 'Additional Training',
|
|
301
|
+
visibility: {
|
|
302
|
+
operator: 'all',
|
|
303
|
+
conditions: [
|
|
304
|
+
{
|
|
305
|
+
property: 'name',
|
|
306
|
+
operator: 'eq',
|
|
307
|
+
value: 'Show Hidden',
|
|
308
|
+
isInstanceProperty: false,
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
};
|
|
316
|
+
server.use(http.get('/api/data/objects/specialty/instances/test-instance', () => {
|
|
317
|
+
return HttpResponse.json({
|
|
318
|
+
id: 'test-instance',
|
|
319
|
+
name: 'Original Name',
|
|
320
|
+
specialtyType: null,
|
|
321
|
+
license: null,
|
|
322
|
+
additionalTraining: 'Should Not Autosave',
|
|
323
|
+
});
|
|
324
|
+
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
325
|
+
return HttpResponse.json(specialtyObject);
|
|
326
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
327
|
+
return HttpResponse.json(specialtyFormWithHiddenField);
|
|
328
|
+
}), http.post('/api/data/objects/specialty/instances/test-instance/actions', async ({ request }) => {
|
|
329
|
+
const body = (await request.json());
|
|
330
|
+
if (body.actionId === '_autosave') {
|
|
331
|
+
autosaveRequestBody = body;
|
|
332
|
+
}
|
|
333
|
+
return HttpResponse.json({
|
|
334
|
+
id: 'test-instance',
|
|
335
|
+
...body.input,
|
|
336
|
+
});
|
|
337
|
+
}));
|
|
338
|
+
render(React.createElement(FormRendererContainer, { objectId: 'specialty', formId: 'specialtyForm', dataType: 'objectInstances', actionId: '_update', instanceId: 'test-instance' }));
|
|
339
|
+
const nameField = await screen.findByRole('textbox', { name: 'Name' });
|
|
340
|
+
await user.clear(nameField);
|
|
341
|
+
await user.type(nameField, 'Updated Name');
|
|
342
|
+
await user.tab();
|
|
343
|
+
await waitFor(() => {
|
|
344
|
+
expect(autosaveRequestBody).toBeDefined();
|
|
345
|
+
});
|
|
346
|
+
// Should not include additionalTraining since it's hidden
|
|
347
|
+
expect(autosaveRequestBody?.input).toEqual({
|
|
348
|
+
name: 'Updated Name',
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
it('should exclude non-configured address subfields from autosave payload', async () => {
|
|
352
|
+
const user = userEvent.setup();
|
|
353
|
+
let autosaveRequestBody;
|
|
354
|
+
server.use(http.get('/api/data/objects/license/instances/test-license', () => {
|
|
355
|
+
return HttpResponse.json({
|
|
356
|
+
id: 'test-license',
|
|
357
|
+
name: 'RN-123456',
|
|
358
|
+
address: {
|
|
359
|
+
line1: '123 Main St',
|
|
360
|
+
line2: 'Suite 200',
|
|
361
|
+
city: 'Boston',
|
|
362
|
+
county: 'Suffolk',
|
|
363
|
+
state: 'MA',
|
|
364
|
+
zipCode: '02101',
|
|
365
|
+
country: 'US',
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
}), http.get('/api/data/objects/license/instances/test-license/object', () => {
|
|
369
|
+
return HttpResponse.json(licenseObject);
|
|
370
|
+
}), http.get('/api/data/forms/licenseForm/effective', () => {
|
|
371
|
+
return HttpResponse.json({
|
|
372
|
+
...licenseForm,
|
|
373
|
+
autosaveActionId: '_autosave',
|
|
374
|
+
});
|
|
375
|
+
}), http.get('/api/data/locations/search', () => {
|
|
376
|
+
return HttpResponse.json([]);
|
|
377
|
+
}), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
378
|
+
const body = (await request.json());
|
|
379
|
+
if (body.actionId === '_autosave') {
|
|
380
|
+
autosaveRequestBody = body;
|
|
381
|
+
}
|
|
382
|
+
return HttpResponse.json({
|
|
383
|
+
id: 'test-license',
|
|
384
|
+
...body.input,
|
|
385
|
+
});
|
|
386
|
+
}));
|
|
387
|
+
render(React.createElement(FormRendererContainer, { objectId: 'license', formId: 'licenseForm', dataType: 'objectInstances', actionId: '_update', instanceId: 'test-license' }));
|
|
388
|
+
const cityField = await screen.findByRole('textbox', { name: 'City' });
|
|
389
|
+
await user.clear(cityField);
|
|
390
|
+
await user.type(cityField, 'Cambridge');
|
|
391
|
+
await user.tab();
|
|
392
|
+
await waitFor(() => {
|
|
393
|
+
expect(autosaveRequestBody).toBeDefined();
|
|
394
|
+
});
|
|
395
|
+
expect(autosaveRequestBody?.input).toEqual({
|
|
396
|
+
name: 'RN-123456',
|
|
397
|
+
// Only configured address fields should be included
|
|
398
|
+
address: {
|
|
399
|
+
line1: '123 Main St',
|
|
400
|
+
city: 'Cambridge',
|
|
401
|
+
state: 'MA',
|
|
402
|
+
zipCode: '02101',
|
|
403
|
+
},
|
|
404
|
+
});
|
|
405
|
+
});
|
|
162
406
|
it('should show saving indicator during autosave', async () => {
|
|
163
407
|
const user = userEvent.setup();
|
|
164
408
|
let resolveSave;
|
|
@@ -175,7 +419,7 @@ describe('FormRendererContainer', () => {
|
|
|
175
419
|
});
|
|
176
420
|
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
177
421
|
return HttpResponse.json(specialtyObject);
|
|
178
|
-
}), http.get('/api/data/forms/specialtyForm', () => {
|
|
422
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
179
423
|
return HttpResponse.json({
|
|
180
424
|
...createSpecialtyForm,
|
|
181
425
|
actionId: '_update',
|
|
@@ -226,7 +470,7 @@ describe('FormRendererContainer', () => {
|
|
|
226
470
|
});
|
|
227
471
|
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
228
472
|
return HttpResponse.json(specialtyObject);
|
|
229
|
-
}), http.get('/api/data/forms/specialtyForm', () => {
|
|
473
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
230
474
|
return HttpResponse.json({
|
|
231
475
|
...createSpecialtyForm,
|
|
232
476
|
actionId: '_update',
|
|
@@ -261,7 +505,7 @@ describe('FormRendererContainer', () => {
|
|
|
261
505
|
});
|
|
262
506
|
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
263
507
|
return HttpResponse.json(specialtyObject);
|
|
264
|
-
}), http.get('/api/data/forms/specialtyForm', () => {
|
|
508
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
265
509
|
return HttpResponse.json({
|
|
266
510
|
...createSpecialtyForm,
|
|
267
511
|
actionId: '_update',
|
|
@@ -306,7 +550,7 @@ describe('FormRendererContainer', () => {
|
|
|
306
550
|
});
|
|
307
551
|
}), http.get('/api/data/objects/license/instances/test-license/object', () => {
|
|
308
552
|
return HttpResponse.json(licenseObject);
|
|
309
|
-
}), http.get('/api/data/forms/licenseForm', () => {
|
|
553
|
+
}), http.get('/api/data/forms/licenseForm/effective', () => {
|
|
310
554
|
return HttpResponse.json({
|
|
311
555
|
...licenseForm,
|
|
312
556
|
autosaveActionId: '_autosave',
|
|
@@ -363,7 +607,7 @@ describe('FormRendererContainer', () => {
|
|
|
363
607
|
if (sanitizedVersion === 'true') {
|
|
364
608
|
return HttpResponse.json(licenseObject);
|
|
365
609
|
}
|
|
366
|
-
}), http.get('/api/data/forms/licenseForm', () => {
|
|
610
|
+
}), http.get('/api/data/forms/licenseForm/effective', () => {
|
|
367
611
|
return HttpResponse.json({
|
|
368
612
|
...licenseForm,
|
|
369
613
|
autosaveActionId: '_autosave',
|
|
@@ -411,7 +655,7 @@ describe('FormRendererContainer', () => {
|
|
|
411
655
|
if (sanitizedVersion === 'true') {
|
|
412
656
|
return HttpResponse.json(licenseObject);
|
|
413
657
|
}
|
|
414
|
-
}), http.get('/api/data/forms/licenseForm', () => {
|
|
658
|
+
}), http.get('/api/data/forms/licenseForm/effective', () => {
|
|
415
659
|
return HttpResponse.json({
|
|
416
660
|
...licenseForm,
|
|
417
661
|
autosaveActionId: '_autosave',
|
|
@@ -466,7 +710,7 @@ describe('FormRendererContainer', () => {
|
|
|
466
710
|
});
|
|
467
711
|
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
468
712
|
return HttpResponse.json(specialtyObject);
|
|
469
|
-
}), http.get('/api/data/forms/specialtyForm', () => {
|
|
713
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
470
714
|
return HttpResponse.json({
|
|
471
715
|
...createSpecialtyForm,
|
|
472
716
|
actionId: '_update',
|
|
@@ -488,7 +732,7 @@ describe('FormRendererContainer', () => {
|
|
|
488
732
|
});
|
|
489
733
|
}), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
|
|
490
734
|
return HttpResponse.json(specialtyObject);
|
|
491
|
-
}), http.get('/api/data/forms/specialtyForm', () => {
|
|
735
|
+
}), http.get('/api/data/forms/specialtyForm/effective', () => {
|
|
492
736
|
return HttpResponse.json({
|
|
493
737
|
...createSpecialtyForm,
|
|
494
738
|
actionId: '_update',
|
|
@@ -552,7 +796,7 @@ describe('FormRendererContainer', () => {
|
|
|
552
796
|
});
|
|
553
797
|
}), http.get('/api/data/objects/license/instances/test-license/object', () => {
|
|
554
798
|
return HttpResponse.json(licenseObject);
|
|
555
|
-
}), http.get('/api/data/forms/licenseForm', () => {
|
|
799
|
+
}), http.get('/api/data/forms/licenseForm/effective', () => {
|
|
556
800
|
return HttpResponse.json(licenseFormWithRadioButtons);
|
|
557
801
|
}), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
558
802
|
const body = (await request.json());
|
|
@@ -615,7 +859,7 @@ describe('FormRendererContainer', () => {
|
|
|
615
859
|
});
|
|
616
860
|
}), http.get('/api/data/objects/license/instances/test-license/object', () => {
|
|
617
861
|
return HttpResponse.json(licenseObject);
|
|
618
|
-
}), http.get('/api/data/forms/licenseForm', () => {
|
|
862
|
+
}), http.get('/api/data/forms/licenseForm/effective', () => {
|
|
619
863
|
return HttpResponse.json(licenseFormWithRadioButtons);
|
|
620
864
|
}), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
621
865
|
const body = (await request.json());
|
|
@@ -661,7 +905,7 @@ describe('FormRendererContainer', () => {
|
|
|
661
905
|
},
|
|
662
906
|
],
|
|
663
907
|
};
|
|
664
|
-
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json({ id: 'test-license', name: 'RN-123456', status: 'Active' })), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm', () => HttpResponse.json(licenseFormWithDropdown)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
908
|
+
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json({ id: 'test-license', name: 'RN-123456', status: 'Active' })), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm/effective', () => HttpResponse.json(licenseFormWithDropdown)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
665
909
|
const body = (await request.json());
|
|
666
910
|
autosaveActionSpy(body);
|
|
667
911
|
return HttpResponse.json({ id: 'test-license', name: 'RN-123456', status: body.input.status });
|
|
@@ -704,7 +948,7 @@ describe('FormRendererContainer', () => {
|
|
|
704
948
|
},
|
|
705
949
|
],
|
|
706
950
|
};
|
|
707
|
-
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json({ id: 'test-license', name: 'RN-123456', status: 'Active' })), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm', () => HttpResponse.json(licenseFormWithDropdown)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
951
|
+
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json({ id: 'test-license', name: 'RN-123456', status: 'Active' })), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm/effective', () => HttpResponse.json(licenseFormWithDropdown)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
708
952
|
const body = (await request.json());
|
|
709
953
|
autosaveActionSpy(body);
|
|
710
954
|
return HttpResponse.json({ id: 'test-license', name: 'RN-123456', status: body.input.status });
|
|
@@ -752,7 +996,7 @@ describe('FormRendererContainer', () => {
|
|
|
752
996
|
],
|
|
753
997
|
};
|
|
754
998
|
const licenseInstanceInitial = { id: 'test-license', name: 'RN-123456' };
|
|
755
|
-
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json(licenseInstanceInitial)), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
999
|
+
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json(licenseInstanceInitial)), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm/effective', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
756
1000
|
const body = (await request.json());
|
|
757
1001
|
autosaveActionSpy(body);
|
|
758
1002
|
return HttpResponse.json({
|
|
@@ -802,7 +1046,7 @@ describe('FormRendererContainer', () => {
|
|
|
802
1046
|
],
|
|
803
1047
|
};
|
|
804
1048
|
const licenseInstanceInitial = { id: 'test-license', name: 'RN-123456', categories: ['Electrical'] };
|
|
805
|
-
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json(licenseInstanceInitial)), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
1049
|
+
server.use(http.get('/api/data/objects/license/instances/test-license', () => HttpResponse.json(licenseInstanceInitial)), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm/effective', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
806
1050
|
const body = (await request.json());
|
|
807
1051
|
autosaveActionSpy(body);
|
|
808
1052
|
return HttpResponse.json({
|
|
@@ -857,7 +1101,7 @@ describe('FormRendererContainer', () => {
|
|
|
857
1101
|
id: 'test-license',
|
|
858
1102
|
name: 'RN-123456',
|
|
859
1103
|
categories: ['Electrical', 'Plumbing'],
|
|
860
|
-
})), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
1104
|
+
})), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm/effective', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
861
1105
|
const body = (await request.json());
|
|
862
1106
|
autosaveActionSpy(body);
|
|
863
1107
|
return HttpResponse.json({
|
|
@@ -914,7 +1158,7 @@ describe('FormRendererContainer', () => {
|
|
|
914
1158
|
id: 'test-license',
|
|
915
1159
|
name: 'RN-123456',
|
|
916
1160
|
categories: ['Electrical', 'Plumbing'],
|
|
917
|
-
})), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
1161
|
+
})), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm/effective', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
918
1162
|
const body = (await request.json());
|
|
919
1163
|
autosaveActionSpy(body);
|
|
920
1164
|
return HttpResponse.json({
|
|
@@ -969,7 +1213,7 @@ describe('FormRendererContainer', () => {
|
|
|
969
1213
|
id: 'test-license',
|
|
970
1214
|
name: 'RN-123456',
|
|
971
1215
|
categories: ['Electrical', 'Plumbing'],
|
|
972
|
-
})), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
1216
|
+
})), http.get('/api/data/objects/license/instances/test-license/object', () => HttpResponse.json(licenseObject)), http.get('/api/data/forms/licenseForm/effective', () => HttpResponse.json(licenseFormWithMultiSelect)), http.post('/api/data/objects/license/instances/test-license/actions', async ({ request }) => {
|
|
973
1217
|
const body = (await request.json());
|
|
974
1218
|
autosaveActionSpy(body);
|
|
975
1219
|
return HttpResponse.json({
|
|
@@ -1015,7 +1259,7 @@ describe('FormRendererContainer', () => {
|
|
|
1015
1259
|
],
|
|
1016
1260
|
properties: [],
|
|
1017
1261
|
};
|
|
1018
|
-
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}`, () => HttpResponse.json(form)));
|
|
1262
|
+
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}/effective`, () => HttpResponse.json(form)));
|
|
1019
1263
|
render(React.createElement(FormRendererContainer, { objectId: simpleObject.id, formId: form.id, dataType: "objectInstances" }));
|
|
1020
1264
|
await screen.findByText('Simple Form');
|
|
1021
1265
|
});
|
|
@@ -1041,7 +1285,7 @@ describe('FormRendererContainer', () => {
|
|
|
1041
1285
|
],
|
|
1042
1286
|
properties: [],
|
|
1043
1287
|
};
|
|
1044
|
-
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}`, () => HttpResponse.json(form)));
|
|
1288
|
+
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}/effective`, () => HttpResponse.json(form)));
|
|
1045
1289
|
render(React.createElement(FormRendererContainer, { objectId: simpleObject.id, formId: form.id, title: {
|
|
1046
1290
|
hidden: false,
|
|
1047
1291
|
}, dataType: "objectInstances" }));
|
|
@@ -1069,7 +1313,7 @@ describe('FormRendererContainer', () => {
|
|
|
1069
1313
|
],
|
|
1070
1314
|
properties: [],
|
|
1071
1315
|
};
|
|
1072
|
-
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}`, () => HttpResponse.json(form)));
|
|
1316
|
+
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}/effective`, () => HttpResponse.json(form)));
|
|
1073
1317
|
render(React.createElement(FormRendererContainer, { objectId: simpleObject.id, formId: form.id, title: {
|
|
1074
1318
|
hidden: true,
|
|
1075
1319
|
}, dataType: "objectInstances" }));
|
|
@@ -1099,7 +1343,7 @@ describe('FormRendererContainer', () => {
|
|
|
1099
1343
|
],
|
|
1100
1344
|
properties: [],
|
|
1101
1345
|
};
|
|
1102
|
-
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}`, () => HttpResponse.json(form)));
|
|
1346
|
+
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}/effective`, () => HttpResponse.json(form)));
|
|
1103
1347
|
render(React.createElement(FormRendererContainer, { objectId: simpleObject.id, formId: form.id, actionId: '_create' }));
|
|
1104
1348
|
await screen.findByRole('button', { name: 'Submit' });
|
|
1105
1349
|
});
|
|
@@ -1125,7 +1369,7 @@ describe('FormRendererContainer', () => {
|
|
|
1125
1369
|
],
|
|
1126
1370
|
properties: [],
|
|
1127
1371
|
};
|
|
1128
|
-
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}`, () => HttpResponse.json(form)));
|
|
1372
|
+
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}/effective`, () => HttpResponse.json(form)));
|
|
1129
1373
|
render(React.createElement(FormRendererContainer, { objectId: simpleObject.id, formId: form.id, actionId: '_create' }));
|
|
1130
1374
|
await screen.findByRole('button', { name: 'Discard Changes' });
|
|
1131
1375
|
});
|
|
@@ -1167,7 +1411,7 @@ describe('FormRendererContainer', () => {
|
|
|
1167
1411
|
},
|
|
1168
1412
|
],
|
|
1169
1413
|
};
|
|
1170
|
-
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}`, () => HttpResponse.json(form)));
|
|
1414
|
+
server.use(http.get(`/api/data/objects/${simpleObject.id}/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/${form.id}/effective`, () => HttpResponse.json(form)));
|
|
1171
1415
|
const user = userEvent.setup();
|
|
1172
1416
|
render(React.createElement(FormRendererContainer, { objectId: simpleObject.id, formId: form.id, actionId: '_create' }));
|
|
1173
1417
|
const firstNameInput = await screen.findByRole('textbox', { name: 'First Name' });
|
|
@@ -1221,7 +1465,7 @@ describe('FormRendererContainer', () => {
|
|
|
1221
1465
|
},
|
|
1222
1466
|
],
|
|
1223
1467
|
};
|
|
1224
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm`, () => HttpResponse.json(form)), http.get('/api/data/objects/simpleObject/instances/123', () => HttpResponse.json({
|
|
1468
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm/effective`, () => HttpResponse.json(form)), http.get('/api/data/objects/simpleObject/instances/123', () => HttpResponse.json({
|
|
1225
1469
|
message: 'Not Found',
|
|
1226
1470
|
}, { status: 404 })), http.get('/api/data/objects/simpleObject/instances/123/object', () => HttpResponse.json(simpleObject)));
|
|
1227
1471
|
render(React.createElement(FormRendererContainer, { formId: form.id, actionId: "_update", objectId: "simpleObject", instanceId: '123' }));
|
|
@@ -1272,7 +1516,7 @@ describe('FormRendererContainer', () => {
|
|
|
1272
1516
|
},
|
|
1273
1517
|
],
|
|
1274
1518
|
};
|
|
1275
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm`, () => HttpResponse.json(form)), http.get('/api/data/objects/simpleObject/instances/123', () => HttpResponse.json({
|
|
1519
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm/effective`, () => HttpResponse.json(form)), http.get('/api/data/objects/simpleObject/instances/123', () => HttpResponse.json({
|
|
1276
1520
|
message: 'Unauthorized',
|
|
1277
1521
|
}, { status: 403 })), http.get('/api/data/objects/simpleObject/instances/123/object', () => HttpResponse.json({
|
|
1278
1522
|
message: 'Unauthorized',
|
|
@@ -1320,7 +1564,7 @@ describe('FormRendererContainer', () => {
|
|
|
1320
1564
|
],
|
|
1321
1565
|
properties: [],
|
|
1322
1566
|
};
|
|
1323
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm`, () => HttpResponse.json(form)));
|
|
1567
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm/effective`, () => HttpResponse.json(form)));
|
|
1324
1568
|
render(React.createElement(FormRendererContainer, { formId: form.id, objectId: "simpleObject", actionId: "_create" }));
|
|
1325
1569
|
await screen.findByText('Simple Form');
|
|
1326
1570
|
});
|
|
@@ -1339,7 +1583,7 @@ describe('FormRendererContainer', () => {
|
|
|
1339
1583
|
],
|
|
1340
1584
|
properties: [],
|
|
1341
1585
|
};
|
|
1342
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/notAForm`, () => HttpResponse.json({ error: 'Not Found' }, { status: 404 })));
|
|
1586
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/notAForm/effective`, () => HttpResponse.json({ error: 'Not Found' }, { status: 404 })));
|
|
1343
1587
|
render(React.createElement(FormRendererContainer, { formId: 'notAForm', objectId: "simpleObject", dataType: "objectInstances" }));
|
|
1344
1588
|
await screen.findByText('The requested content could not be found.');
|
|
1345
1589
|
});
|
|
@@ -1365,7 +1609,7 @@ describe('FormRendererContainer', () => {
|
|
|
1365
1609
|
],
|
|
1366
1610
|
properties: [],
|
|
1367
1611
|
};
|
|
1368
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm`, () => HttpResponse.json(form)));
|
|
1612
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm/effective`, () => HttpResponse.json(form)));
|
|
1369
1613
|
render(React.createElement(FormRendererContainer, { formId: form.id, objectId: "simpleObject", dataType: "objectInstances" }));
|
|
1370
1614
|
await screen.findByText('It looks like something is missing.');
|
|
1371
1615
|
});
|
|
@@ -1391,7 +1635,7 @@ describe('FormRendererContainer', () => {
|
|
|
1391
1635
|
],
|
|
1392
1636
|
properties: [],
|
|
1393
1637
|
};
|
|
1394
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm`, () => HttpResponse.json(form)));
|
|
1638
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm/effective`, () => HttpResponse.json(form)));
|
|
1395
1639
|
render(React.createElement(FormRendererContainer, { formId: form.id, objectId: "simpleObject", actionId: "_create", dataType: "objectInstances" }));
|
|
1396
1640
|
await screen.findByText('It looks like something is missing.');
|
|
1397
1641
|
});
|
|
@@ -1421,7 +1665,7 @@ describe('FormRendererContainer', () => {
|
|
|
1421
1665
|
],
|
|
1422
1666
|
properties: [],
|
|
1423
1667
|
};
|
|
1424
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm`, () => HttpResponse.json(form)));
|
|
1668
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm/effective`, () => HttpResponse.json(form)));
|
|
1425
1669
|
render(React.createElement(FormRendererContainer, { objectId: "simpleObject", actionId: "_create", dataType: "objectInstances" }));
|
|
1426
1670
|
await screen.findByText('Simple Form');
|
|
1427
1671
|
});
|
|
@@ -1442,7 +1686,7 @@ describe('FormRendererContainer', () => {
|
|
|
1442
1686
|
],
|
|
1443
1687
|
properties: [],
|
|
1444
1688
|
};
|
|
1445
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/notAForm`, () => HttpResponse.json({ error: 'Not Found' }, { status: 404 })));
|
|
1689
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/notAForm/effective`, () => HttpResponse.json({ error: 'Not Found' }, { status: 404 })));
|
|
1446
1690
|
render(React.createElement(FormRendererContainer, { objectId: "simpleObject", actionId: "_create", dataType: "objectInstances" }));
|
|
1447
1691
|
await screen.findByText('The requested content could not be found.');
|
|
1448
1692
|
});
|
|
@@ -1488,7 +1732,7 @@ describe('FormRendererContainer', () => {
|
|
|
1488
1732
|
],
|
|
1489
1733
|
properties: [],
|
|
1490
1734
|
};
|
|
1491
|
-
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm`, () => HttpResponse.json(form)));
|
|
1735
|
+
server.use(http.get(`/api/data/objects/simpleObject/effective`, () => HttpResponse.json(simpleObject)), http.get(`/api/data/forms/simpleForm/effective`, () => HttpResponse.json(form)));
|
|
1492
1736
|
render(React.createElement(FormRendererContainer, { objectId: "simpleObject", actionId: "_create", dataType: "objectInstances" }));
|
|
1493
1737
|
await screen.findByText('It looks like something is missing.');
|
|
1494
1738
|
});
|
|
@@ -1548,7 +1792,7 @@ describe('FormRendererContainer', () => {
|
|
|
1548
1792
|
],
|
|
1549
1793
|
};
|
|
1550
1794
|
beforeEach(() => {
|
|
1551
|
-
server.use(http.get(`/api/data/objects/${validationTestObject.id}/effective`, () => HttpResponse.json(validationTestObject)), http.get(`/api/data/forms/${form.id}`, () => HttpResponse.json(form)));
|
|
1795
|
+
server.use(http.get(`/api/data/objects/${validationTestObject.id}/effective`, () => HttpResponse.json(validationTestObject)), http.get(`/api/data/forms/${form.id}/effective`, () => HttpResponse.json(form)));
|
|
1552
1796
|
});
|
|
1553
1797
|
it('should display validation errors after trying to submit the form', async () => {
|
|
1554
1798
|
const user = userEvent.setup();
|
|
@@ -121,3 +121,18 @@ export declare const customerLayout: {
|
|
|
121
121
|
};
|
|
122
122
|
objectId: string;
|
|
123
123
|
};
|
|
124
|
+
export declare const formlet: {
|
|
125
|
+
id: string;
|
|
126
|
+
name: string;
|
|
127
|
+
entries: {
|
|
128
|
+
type: string;
|
|
129
|
+
input: {
|
|
130
|
+
type: string;
|
|
131
|
+
id: string;
|
|
132
|
+
};
|
|
133
|
+
display: {
|
|
134
|
+
label: string;
|
|
135
|
+
required: boolean;
|
|
136
|
+
};
|
|
137
|
+
}[];
|
|
138
|
+
};
|