@evoke-platform/ui-components 1.8.0-dev.1 → 1.8.0-dev.11

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.
Files changed (52) hide show
  1. package/dist/published/components/core/TextField/TextField.js +3 -2
  2. package/dist/published/components/custom/DataGrid/DataGrid.d.ts +1 -0
  3. package/dist/published/components/custom/DataGrid/DataGrid.js +2 -1
  4. package/dist/published/components/custom/DataGrid/Toolbar.d.ts +1 -0
  5. package/dist/published/components/custom/DataGrid/Toolbar.js +3 -2
  6. package/dist/published/components/custom/DataGrid/index.d.ts +1 -0
  7. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +48 -39
  8. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.js +1 -1
  9. package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.d.ts +1 -1
  10. package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +22 -6
  11. package/dist/published/components/custom/Form/tests/Form.test.js +192 -2
  12. package/dist/published/components/custom/Form/tests/test-data.d.ts +7 -0
  13. package/dist/published/components/custom/Form/tests/test-data.js +138 -0
  14. package/dist/published/components/custom/Form/utils.js +76 -44
  15. package/dist/published/components/custom/FormV2/FormRenderer.d.ts +6 -2
  16. package/dist/published/components/custom/FormV2/FormRenderer.js +13 -14
  17. package/dist/published/components/custom/FormV2/FormRendererContainer.d.ts +7 -2
  18. package/dist/published/components/custom/FormV2/FormRendererContainer.js +61 -109
  19. package/dist/published/components/custom/FormV2/components/FormContext.d.ts +4 -0
  20. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.d.ts +9 -5
  21. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.js +12 -24
  22. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.d.ts +5 -1
  23. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +80 -30
  24. package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +1 -1
  25. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/InstanceLookup.js +1 -1
  26. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +51 -27
  27. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.d.ts +5 -5
  28. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +45 -7
  29. package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +8 -6
  30. package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.d.ts +3 -0
  31. package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.js +1 -3
  32. package/dist/published/components/custom/FormV2/components/types.d.ts +7 -1
  33. package/dist/published/components/custom/FormV2/components/utils.d.ts +27 -2
  34. package/dist/published/components/custom/FormV2/components/utils.js +108 -2
  35. package/dist/published/components/custom/FormV2/tests/FormRenderer.test.d.ts +1 -0
  36. package/dist/published/components/custom/FormV2/tests/FormRenderer.test.js +173 -0
  37. package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.d.ts +1 -0
  38. package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.js +96 -0
  39. package/dist/published/components/custom/FormV2/tests/test-data.d.ts +16 -0
  40. package/dist/published/components/custom/FormV2/tests/test-data.js +394 -0
  41. package/dist/published/components/custom/index.d.ts +1 -0
  42. package/dist/published/index.d.ts +1 -1
  43. package/dist/published/stories/FormRenderer.stories.d.ts +7 -0
  44. package/dist/published/stories/FormRenderer.stories.js +65 -0
  45. package/dist/published/stories/FormRendererContainer.stories.d.ts +7 -0
  46. package/dist/published/stories/FormRendererContainer.stories.js +56 -0
  47. package/dist/published/stories/FormRendererData.d.ts +116 -0
  48. package/dist/published/stories/FormRendererData.js +925 -0
  49. package/dist/published/stories/sharedMswHandlers.d.ts +1 -0
  50. package/dist/published/stories/sharedMswHandlers.js +100 -0
  51. package/dist/published/theme/hooks.d.ts +4 -0
  52. package/package.json +12 -4
@@ -0,0 +1,173 @@
1
+ import * as matchers from '@testing-library/jest-dom/matchers';
2
+ import { render, screen, waitFor, within } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { isEqual, set } from 'lodash';
5
+ import { http, HttpResponse } from 'msw';
6
+ import { setupServer } from 'msw/node';
7
+ import React from 'react';
8
+ import { MemoryRouter } from 'react-router-dom';
9
+ import { expect, it } from 'vitest';
10
+ import FormRenderer from '../FormRenderer';
11
+ import { createSpecialtyForm, jsonLogicDisplayTestSpecialtyForm, licenseObject, npLicense, npSpecialtyType1, npSpecialtyType2, rnLicense, rnSpecialtyType1, rnSpecialtyType2, simpleConditionDisplayTestSpecialtyForm, specialtyObject, specialtyTypeObject, } from './test-data';
12
+ expect.extend(matchers);
13
+ const removePoppers = () => {
14
+ const portalSelectors = ['.MuiAutocomplete-popper'];
15
+ portalSelectors.forEach((selector) => {
16
+ // eslint-disable-next-line testing-library/no-node-access
17
+ document.querySelectorAll(selector).forEach((el) => el.remove());
18
+ });
19
+ };
20
+ describe('Form component', () => {
21
+ let server;
22
+ beforeAll(() => {
23
+ server = setupServer(http.get('/api/data/objects/specialtyType/effective', () => HttpResponse.json(specialtyTypeObject)), http.get('/api/data/objects/specialtyType/effective', (req) => {
24
+ const sanitizedVersion = new URL(req.request.url).searchParams.get('sanitizedVersion');
25
+ if (sanitizedVersion === 'true') {
26
+ return HttpResponse.json(specialtyTypeObject);
27
+ }
28
+ }), http.get('/api/data/objects/license/effective', (req) => {
29
+ const sanitizedVersion = new URL(req.request.url).searchParams.get('sanitizedVersion');
30
+ if (sanitizedVersion === 'true') {
31
+ return HttpResponse.json(licenseObject);
32
+ }
33
+ }), http.get('/api/data/objects/specialty/effective', (req) => {
34
+ const sanitizedVersion = new URL(req.request.url).searchParams.get('sanitizedVersion');
35
+ if (sanitizedVersion === 'true') {
36
+ return HttpResponse.json(specialtyObject);
37
+ }
38
+ }), http.get('/data/objects/license/effective', () => HttpResponse.json(licenseObject)), http.get('/api/data/objects/license/instances', () => {
39
+ return HttpResponse.json([rnLicense, npLicense]);
40
+ }), http.get('/api/data/objects/specialtyType/instances', (req) => {
41
+ const filter = new URL(req.request.url).searchParams.get('filter');
42
+ if (filter) {
43
+ const whereFilter = JSON.parse(filter).where;
44
+ // The two objects in the array of conditions in the "where" filter represent the potential filters that can be applied when retrieving "specialty" instances.
45
+ // The first object is for the the validation criteria, but it is empty if the "license" field, which is referenced in the validation criteria, hasn't been filled out yet.
46
+ // The second object is for the search criteria which the user enters in the "specialty" field, but it is empty if no search text has been entered.
47
+ if (isEqual(whereFilter, { and: [{}, {}] }))
48
+ return HttpResponse.json([
49
+ rnSpecialtyType1,
50
+ rnSpecialtyType2,
51
+ npSpecialtyType1,
52
+ npSpecialtyType2,
53
+ ]);
54
+ else if (isEqual(whereFilter, { and: [{ 'licenseType.id': 'rnLicenseType' }, {}] }))
55
+ return HttpResponse.json([rnSpecialtyType1, rnSpecialtyType2]);
56
+ else if (isEqual(whereFilter, { and: [{ 'licenseType.id': 'npLicenseType' }, {}] }))
57
+ return HttpResponse.json([npSpecialtyType1, npSpecialtyType2]);
58
+ }
59
+ }));
60
+ server.listen();
61
+ });
62
+ afterAll(() => {
63
+ server.close();
64
+ });
65
+ afterEach(() => {
66
+ server.resetHandlers();
67
+ removePoppers();
68
+ });
69
+ describe('validation criteria', () => {
70
+ it(`filters related object field with validation criteria that references a related object's nested data`, async () => {
71
+ const user = userEvent.setup();
72
+ server.use(http.get('/data/objects/license/instances/rnLicense', (req) => {
73
+ const expand = new URL(req.request.url).searchParams.get('expand');
74
+ if (expand === 'licenseType.id') {
75
+ return HttpResponse.json(rnLicense);
76
+ }
77
+ }));
78
+ const FormWithState = () => {
79
+ const [formData, setFormData] = React.useState({});
80
+ const handleChange = (id, value) => {
81
+ setFormData((prev) => {
82
+ const newData = { ...prev };
83
+ set(newData, id, value);
84
+ return newData;
85
+ });
86
+ };
87
+ try {
88
+ return React.createElement(FormRenderer, { form: createSpecialtyForm, value: formData, onChange: handleChange });
89
+ }
90
+ catch (err) {
91
+ console.error('Render error:', err);
92
+ return React.createElement("div", null, "Render error");
93
+ }
94
+ };
95
+ render(React.createElement(MemoryRouter, null,
96
+ React.createElement(FormWithState, null)));
97
+ const license = await screen.findByRole('combobox', { name: 'License' });
98
+ // Step 1: Open Specialty Type and verify all options
99
+ await user.click(await screen.findByRole('combobox', { name: 'Specialty Type' }));
100
+ let openAutocomplete = await screen.findByRole('listbox');
101
+ await within(openAutocomplete).findByRole('option', { name: 'RN Specialty Type #1' });
102
+ await within(openAutocomplete).findByRole('option', { name: 'RN Specialty Type #2' });
103
+ await within(openAutocomplete).findByRole('option', { name: 'NP Specialty Type #1' });
104
+ await within(openAutocomplete).findByRole('option', { name: 'NP Specialty Type #2' });
105
+ await user.keyboard('{Escape}');
106
+ // Step 2: Select a license
107
+ await user.click(license);
108
+ await user.keyboard('{ArrowDown}');
109
+ await user.keyboard('{Enter}');
110
+ // Step 3: Open Specialty Type again and verify filtered options
111
+ await user.click(await screen.findByRole('combobox', { name: 'Specialty Type' }));
112
+ openAutocomplete = await screen.findByRole('listbox');
113
+ await within(openAutocomplete).findByRole('option', { name: 'RN Specialty Type #1' });
114
+ await within(openAutocomplete).findByRole('option', { name: 'RN Specialty Type #2' });
115
+ await waitFor(() => expect(within(openAutocomplete).queryByRole('option', { name: 'NP Specialty Type #1' })).not.toBeInTheDocument());
116
+ await waitFor(() => expect(within(openAutocomplete).queryByRole('option', { name: 'NP Specialty Type #2' })).not.toBeInTheDocument());
117
+ await user.keyboard('{Escape}');
118
+ await waitFor(() => {
119
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
120
+ });
121
+ });
122
+ });
123
+ describe('visibility configuration', () => {
124
+ it('shows fields based on instance data using JsonLogic', async () => {
125
+ server.use(http.get('/data/objects/license/instances/rnLicense', () => HttpResponse.json(rnLicense)));
126
+ render(React.createElement(MemoryRouter, null,
127
+ React.createElement(FormRenderer, { form: jsonLogicDisplayTestSpecialtyForm, onChange: () => { }, instance: {
128
+ id: '123',
129
+ objectId: 'specialty',
130
+ name: 'Test Specialty Object Instance',
131
+ } })));
132
+ // Validate that specialty type dropdown renders
133
+ await screen.findByRole('combobox', { name: 'Specialty Type' });
134
+ });
135
+ it('hides fields based on instance data using JsonLogic', async () => {
136
+ server.use(http.get('/data/objects/license/instances/rnLicense', () => HttpResponse.json(rnLicense)));
137
+ render(React.createElement(MemoryRouter, null,
138
+ React.createElement(FormRenderer, { form: jsonLogicDisplayTestSpecialtyForm, onChange: () => { }, instance: {
139
+ id: '123',
140
+ objectId: 'specialty',
141
+ name: 'Test Specialty Object Instance -- hidden',
142
+ } })));
143
+ // Validate that license dropdown renders
144
+ await screen.findByRole('combobox', { name: 'License' });
145
+ // Validate that specialty type dropdown does not render
146
+ expect(screen.queryByRole('combobox', { name: 'Specialty Type' })).not.toBeInTheDocument();
147
+ });
148
+ it('shows fields based on instance data using simple conditions', async () => {
149
+ server.use(http.get('/data/objects/license/instances/rnLicense', () => HttpResponse.json(rnLicense)));
150
+ render(React.createElement(MemoryRouter, null,
151
+ React.createElement(FormRenderer, { form: simpleConditionDisplayTestSpecialtyForm, onChange: () => { }, instance: {
152
+ id: '123',
153
+ objectId: 'specialty',
154
+ name: 'Test Specialty Object Instance',
155
+ } })));
156
+ // Validate that specialty type dropdown renders
157
+ await screen.findByRole('combobox', { name: 'Specialty Type' });
158
+ });
159
+ it('hides fields based on instance data using simple conditions', async () => {
160
+ server.use(http.get('/data/objects/license/instances/rnLicense', () => HttpResponse.json(rnLicense)));
161
+ render(React.createElement(MemoryRouter, null,
162
+ React.createElement(FormRenderer, { form: simpleConditionDisplayTestSpecialtyForm, onChange: () => { }, instance: {
163
+ id: '123',
164
+ objectId: 'specialty',
165
+ name: 'Test Specialty Object Instance -- hidden',
166
+ } })));
167
+ // Validate that license dropdown renders
168
+ await screen.findByRole('combobox', { name: 'License' });
169
+ // Validate that specialty type dropdown does not render
170
+ expect(screen.queryByRole('combobox', { name: 'Specialty Type' })).not.toBeInTheDocument();
171
+ });
172
+ });
173
+ });
@@ -0,0 +1,96 @@
1
+ import * as matchers from '@testing-library/jest-dom/matchers';
2
+ import { render, screen, waitFor, within } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { isEqual } from 'lodash';
5
+ import { http, HttpResponse } from 'msw';
6
+ import { setupServer } from 'msw/node';
7
+ import React from 'react';
8
+ import { MemoryRouter } from 'react-router-dom';
9
+ import { expect, it } from 'vitest';
10
+ import FormRendererContainer from '../FormRendererContainer';
11
+ import { createSpecialtyForm, licenseObject, npLicense, npSpecialtyType1, npSpecialtyType2, rnLicense, rnSpecialtyType1, rnSpecialtyType2, specialtyObject, specialtyTypeObject, } from './test-data';
12
+ expect.extend(matchers);
13
+ const removePoppers = () => {
14
+ const portalSelectors = ['.MuiAutocomplete-popper'];
15
+ portalSelectors.forEach((selector) => {
16
+ // eslint-disable-next-line testing-library/no-node-access
17
+ document.querySelectorAll(selector).forEach((el) => el.remove());
18
+ });
19
+ };
20
+ describe('Form component', () => {
21
+ let server;
22
+ beforeAll(() => {
23
+ server = setupServer(http.get('/api/data/objects/specialtyType/effective', () => HttpResponse.json(specialtyTypeObject)), http.get('/api/data/objects/specialtyType/effective', (req) => {
24
+ const sanitizedVersion = new URL(req.request.url).searchParams.get('sanitizedVersion');
25
+ if (sanitizedVersion === 'true') {
26
+ return HttpResponse.json(specialtyTypeObject);
27
+ }
28
+ }), http.get('/api/data/objects/license/effective', (req) => {
29
+ const sanitizedVersion = new URL(req.request.url).searchParams.get('sanitizedVersion');
30
+ if (sanitizedVersion === 'true') {
31
+ return HttpResponse.json(licenseObject);
32
+ }
33
+ }), http.get('/api/data/objects/specialty/effective', (req) => {
34
+ const sanitizedVersion = new URL(req.request.url).searchParams.get('sanitizedVersion');
35
+ if (sanitizedVersion === 'true') {
36
+ return HttpResponse.json(specialtyObject);
37
+ }
38
+ }), http.get('/data/objects/license/effective', () => HttpResponse.json(licenseObject)), http.get('/api/data/objects/license/instances', () => {
39
+ return HttpResponse.json([rnLicense, npLicense]);
40
+ }), http.get('/api/data/objects/specialtyType/instances', (req) => {
41
+ const filter = new URL(req.request.url).searchParams.get('filter');
42
+ if (filter) {
43
+ const whereFilter = JSON.parse(filter).where;
44
+ // The two objects in the array of conditions in the "where" filter represent the potential filters that can be applied when retrieving "specialty" instances.
45
+ // The first object is for the the validation criteria, but it is empty if the "license" field, which is referenced in the validation criteria, hasn't been filled out yet.
46
+ // The second object is for the search criteria which the user enters in the "specialty" field, but it is empty if no search text has been entered.
47
+ if (isEqual(whereFilter, { and: [{}, {}] }))
48
+ return HttpResponse.json([
49
+ rnSpecialtyType1,
50
+ rnSpecialtyType2,
51
+ npSpecialtyType1,
52
+ npSpecialtyType2,
53
+ ]);
54
+ else if (isEqual(whereFilter, { and: [{ 'licenseType.id': 'rnLicenseType' }, {}] }))
55
+ return HttpResponse.json([rnSpecialtyType1, rnSpecialtyType2]);
56
+ else if (isEqual(whereFilter, { and: [{ 'licenseType.id': 'npLicenseType' }, {}] }))
57
+ return HttpResponse.json([npSpecialtyType1, npSpecialtyType2]);
58
+ }
59
+ }));
60
+ server.listen();
61
+ });
62
+ afterAll(() => {
63
+ server.close();
64
+ });
65
+ afterEach(() => {
66
+ server.resetHandlers();
67
+ removePoppers();
68
+ });
69
+ describe('validation criteria', () => {
70
+ it(`filters related object field with validation criteria that references a defaulted related object's nested data`, async () => {
71
+ const user = userEvent.setup();
72
+ server.use(http.get('/api/data/objects/license/instances/rnLicense', () => {
73
+ return HttpResponse.json(rnLicense);
74
+ }), http.get('api/data/forms/specialtyForm', () => {
75
+ return HttpResponse.json(createSpecialtyForm);
76
+ }));
77
+ render(React.createElement(MemoryRouter, null,
78
+ React.createElement(FormRendererContainer, { objectId: 'specialty', formId: 'specialtyForm', dataType: 'objectInstances', actionId: '_create', associatedObject: { propertyId: 'license', instanceId: 'rnLicense' } })));
79
+ // Validate that the license field is hidden
80
+ await waitFor(() => expect(screen.queryByRole('combobox', { name: 'License' })).not.toBeInTheDocument());
81
+ // Validate that specialty type dropdown is only rendering specialty types that are associated with the selected license.
82
+ const specialtyType = await screen.findByRole('combobox', { name: 'Specialty Type' });
83
+ await new Promise((r) => setTimeout(r, 5000));
84
+ await user.click(specialtyType);
85
+ const openAutocomplete = await screen.findByRole('listbox');
86
+ await within(openAutocomplete).findByRole('option', { name: 'RN Specialty Type #1' });
87
+ await within(openAutocomplete).findByRole('option', { name: 'RN Specialty Type #2' });
88
+ await waitFor(() => expect(within(openAutocomplete).queryByRole('option', { name: 'NP Specialty Type #1' })).not.toBeInTheDocument());
89
+ await waitFor(() => expect(within(openAutocomplete).queryByRole('option', { name: 'NP Specialty Type #2' })).not.toBeInTheDocument());
90
+ await user.keyboard('{Escape}');
91
+ await waitFor(() => {
92
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
93
+ });
94
+ });
95
+ });
96
+ });
@@ -0,0 +1,16 @@
1
+ import { EvokeForm, Obj, ObjectInstance } from '@evoke-platform/context';
2
+ export declare const createSpecialtyForm: EvokeForm;
3
+ export declare const simpleConditionDisplayTestSpecialtyForm: EvokeForm;
4
+ export declare const jsonLogicDisplayTestSpecialtyForm: EvokeForm;
5
+ export declare const licenseObject: Obj;
6
+ export declare const licenseTypeObject: Obj;
7
+ export declare const specialtyObject: Obj;
8
+ export declare const specialtyTypeObject: Obj;
9
+ export declare const rnLicense: ObjectInstance;
10
+ export declare const npLicense: ObjectInstance;
11
+ export declare const rnLicenseType: ObjectInstance;
12
+ export declare const npLicesneType: ObjectInstance;
13
+ export declare const rnSpecialtyType1: ObjectInstance;
14
+ export declare const rnSpecialtyType2: ObjectInstance;
15
+ export declare const npSpecialtyType1: ObjectInstance;
16
+ export declare const npSpecialtyType2: ObjectInstance;
@@ -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
+ };