@evoke-platform/ui-components 1.8.0-testing.1 → 1.8.0-testing.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 (43) hide show
  1. package/dist/published/components/core/TextField/TextField.js +3 -2
  2. package/dist/published/components/custom/DataGrid/index.d.ts +1 -0
  3. package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +4 -0
  4. package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +4 -0
  5. package/dist/published/components/custom/Form/utils.js +76 -44
  6. package/dist/published/components/custom/FormV2/FormRenderer.d.ts +6 -2
  7. package/dist/published/components/custom/FormV2/FormRenderer.js +13 -14
  8. package/dist/published/components/custom/FormV2/FormRendererContainer.d.ts +7 -2
  9. package/dist/published/components/custom/FormV2/FormRendererContainer.js +56 -109
  10. package/dist/published/components/custom/FormV2/components/FormContext.d.ts +4 -0
  11. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.d.ts +9 -5
  12. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.js +12 -24
  13. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.d.ts +5 -1
  14. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +80 -30
  15. package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +1 -1
  16. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/InstanceLookup.js +1 -1
  17. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +51 -27
  18. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.d.ts +5 -5
  19. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +45 -7
  20. package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +8 -6
  21. package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.d.ts +3 -0
  22. package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.js +1 -3
  23. package/dist/published/components/custom/FormV2/components/types.d.ts +7 -1
  24. package/dist/published/components/custom/FormV2/components/utils.d.ts +27 -2
  25. package/dist/published/components/custom/FormV2/components/utils.js +108 -2
  26. package/dist/published/components/custom/FormV2/tests/FormRenderer.test.d.ts +1 -0
  27. package/dist/published/components/custom/FormV2/tests/FormRenderer.test.js +173 -0
  28. package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.d.ts +1 -0
  29. package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.js +96 -0
  30. package/dist/published/components/custom/FormV2/tests/test-data.d.ts +16 -0
  31. package/dist/published/components/custom/FormV2/tests/test-data.js +394 -0
  32. package/dist/published/components/custom/index.d.ts +1 -0
  33. package/dist/published/index.d.ts +1 -1
  34. package/dist/published/stories/FormRenderer.stories.d.ts +7 -0
  35. package/dist/published/stories/FormRenderer.stories.js +65 -0
  36. package/dist/published/stories/FormRendererContainer.stories.d.ts +7 -0
  37. package/dist/published/stories/FormRendererContainer.stories.js +56 -0
  38. package/dist/published/stories/FormRendererData.d.ts +116 -0
  39. package/dist/published/stories/FormRendererData.js +925 -0
  40. package/dist/published/stories/sharedMswHandlers.d.ts +1 -0
  41. package/dist/published/stories/sharedMswHandlers.js +100 -0
  42. package/dist/published/theme/hooks.d.ts +4 -0
  43. package/package.json +13 -4
@@ -0,0 +1 @@
1
+ export declare const sharedObjectHandlers: import("msw/lib/core/handlers/HttpHandler").HttpHandler[];
@@ -0,0 +1,100 @@
1
+ import { http, HttpResponse } from 'msw';
2
+ import { instance, mockCustomerCreateForm, mockCustomerObject, mockCustomerUpdateForm, mockEvokeForm, mockGenericEvokeFormObject, mockInstancesForCollection, mockInstancesForRelatedObject, mockMovieCreateForm, mockMovieObject, mockPeopleGenericObject, mockPeopleGenericObjectInstances, mockPeopleObject, mockPropertiesForCriteria, } from './FormRendererData';
3
+ export const sharedObjectHandlers = [
4
+ // Object fetches
5
+ http.get('/api/data/objects/:objectId/effective', ({ params, request }) => {
6
+ const { objectId } = params;
7
+ let data;
8
+ switch (objectId) {
9
+ case 'genericEvokeForm':
10
+ data = mockGenericEvokeFormObject;
11
+ break;
12
+ case 'movies':
13
+ data = mockMovieObject;
14
+ break;
15
+ case 'people':
16
+ data = mockPeopleObject;
17
+ break;
18
+ case 'customers':
19
+ data = mockCustomerObject;
20
+ break;
21
+ case 'peopleGenericObject':
22
+ data = mockPeopleGenericObject;
23
+ break;
24
+ default:
25
+ data = {};
26
+ }
27
+ return HttpResponse.json(data);
28
+ }),
29
+ // Object fetch by instanceId
30
+ http.get('/api/data/objects/:objectId/instances/:instanceId/object', ({ params }) => {
31
+ const { objectId, instanceId } = params;
32
+ let data;
33
+ if (objectId === 'genericEvokeForm' && instanceId === 'updateGenericEvokeFormInstanceId') {
34
+ data = mockGenericEvokeFormObject;
35
+ }
36
+ else if (objectId === 'customers' && instanceId === 'collectionInstance') {
37
+ data = mockCustomerObject;
38
+ }
39
+ else {
40
+ data = {};
41
+ }
42
+ return HttpResponse.json(data);
43
+ }),
44
+ // Property fetch for criteria field properties
45
+ http.get('/api/data/objects/genericEvokeForm/effective/properties?fields', () => HttpResponse.json(mockPropertiesForCriteria)),
46
+ // Permission fetches
47
+ http.get(/\/checkAccess$/, () => HttpResponse.json({ result: true })),
48
+ // General instance fetches
49
+ http.get('/api/data/objects/:objectId/instances/:id?', ({ params }) => {
50
+ const { objectId, id } = params;
51
+ let data;
52
+ switch (objectId) {
53
+ case 'genericEvokeForm':
54
+ data = id === 'updateGenericEvokeFormInstanceId' ? instance : {};
55
+ break;
56
+ case 'movies':
57
+ data = id
58
+ ? mockInstancesForRelatedObject.find((inst) => inst.id === id)
59
+ : mockInstancesForRelatedObject;
60
+ break;
61
+ case 'customers':
62
+ data = id ? mockInstancesForCollection.find((inst) => inst.id === id) : mockInstancesForCollection;
63
+ break;
64
+ case 'peopleGenericObject':
65
+ data = [];
66
+ break;
67
+ case 'people':
68
+ data = mockPeopleGenericObjectInstances;
69
+ break;
70
+ default:
71
+ data = [];
72
+ }
73
+ return HttpResponse.json(data);
74
+ }),
75
+ // Form fetches
76
+ http.get('/api/data/forms/:formId?', ({ params, request }) => {
77
+ const formId = Array.isArray(params.formId) ? params.formId[0] : params.formId;
78
+ switch (formId) {
79
+ case 'customerUpdateForm':
80
+ return HttpResponse.json(mockCustomerUpdateForm);
81
+ case 'customerCreateForm':
82
+ return HttpResponse.json(mockCustomerCreateForm);
83
+ case 'movieCreateForm':
84
+ return HttpResponse.json(mockMovieCreateForm);
85
+ case 'updateGenericEvokeForm':
86
+ return HttpResponse.json(mockEvokeForm);
87
+ default:
88
+ return HttpResponse.json({});
89
+ }
90
+ }),
91
+ // Action fetches
92
+ // Fetch for many-to-many create action when adding a value to the field
93
+ http.post('api/data/objects/peopleGenericObject/instances/actions', async (req) => {
94
+ const body = await req.request.json();
95
+ const customerInstance = body.input?.people;
96
+ const customerId = customerInstance.id;
97
+ return HttpResponse.json(mockPeopleGenericObjectInstances.find((inst) => inst?.id === customerId));
98
+ }),
99
+ http.post('/api/data/objects/peopleGenericObject/instances/:id/actions', ({ params }) => HttpResponse.json(mockPeopleGenericObjectInstances.find((inst) => inst.id === params.id) ?? {})),
100
+ ];
@@ -126,4 +126,8 @@ export declare function useFormContext(): {
126
126
  fieldHeight?: "medium" | "small" | undefined;
127
127
  triggerFieldReset?: boolean | undefined;
128
128
  showSubmitError?: boolean | undefined;
129
+ associatedObject?: {
130
+ instanceId?: string | undefined;
131
+ propertyId?: string | undefined;
132
+ } | undefined;
129
133
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.8.0-testing.1",
3
+ "version": "1.8.0-testing.11",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",
@@ -9,6 +9,9 @@
9
9
  "icons.ts",
10
10
  "colors.ts"
11
11
  ],
12
+ "sideEffects": [
13
+ "*.css"
14
+ ],
12
15
  "exports": {
13
16
  ".": "./dist/published/index.js",
14
17
  "./colors": "./dist/published/colors/index.js",
@@ -21,7 +24,7 @@
21
24
  "build": "rm -rf ./dist && tsc && npm run copy-styles",
22
25
  "build:cjs": "tsc --module CommonJS --outDir dist/cjs",
23
26
  "prepublish": "rm -rf ./dist && tsc && npm run copy-styles",
24
- "storybook": "start-storybook -p 6006",
27
+ "storybook": "npx msw init .storybook/public --save && start-storybook -p 6006",
25
28
  "build-storybook": "build-storybook",
26
29
  "lint": "npm run prettier:check && npm run eslint",
27
30
  "lint:fix": "npm run eslint:fix && npm run prettier:fix",
@@ -77,6 +80,8 @@
77
80
  "husky": "^8.0.3",
78
81
  "is-ci": "^3.0.1",
79
82
  "lint-staged": "^13.0.1",
83
+ "msw": "^2.10.4",
84
+ "msw-storybook-addon": "^2.0.5",
80
85
  "prettier": "^3.0.0",
81
86
  "react": "^18.1.0",
82
87
  "react-dom": "^18.1.0",
@@ -87,7 +92,7 @@
87
92
  "yalc": "^1.0.0-pre.53"
88
93
  },
89
94
  "peerDependencies": {
90
- "@evoke-platform/context": "^1.3.1-0",
95
+ "@evoke-platform/context": "^1.3.2-0",
91
96
  "react": "^18.1.0",
92
97
  "react-dom": "^18.1.0"
93
98
  },
@@ -119,7 +124,6 @@
119
124
  "formiojs": "^4.21.7",
120
125
  "html-react-parser": "^5.1.18",
121
126
  "luxon": "^2.5.2",
122
- "msw": "^2.7.3",
123
127
  "nanoid": "^5.0.8",
124
128
  "nanoid-dictionary": "^4.3.0",
125
129
  "no-eval-handlebars": "^1.0.2",
@@ -140,5 +144,10 @@
140
144
  "*.{js,jsx,ts,tsx,json,css,md}": [
141
145
  "npm run lint:fix"
142
146
  ]
147
+ },
148
+ "msw": {
149
+ "workerDirectory": [
150
+ ".storybook\\public"
151
+ ]
143
152
  }
144
153
  }