@evoke-platform/ui-components 1.8.0-dev.0 → 1.8.0-dev.10
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/core/TextField/TextField.js +3 -2
- package/dist/published/components/custom/DataGrid/DataGrid.d.ts +2 -0
- package/dist/published/components/custom/DataGrid/DataGrid.js +3 -1
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +2 -0
- package/dist/published/components/custom/DataGrid/Toolbar.js +4 -3
- package/dist/published/components/custom/DataGrid/index.d.ts +1 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +4 -0
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +4 -0
- package/dist/published/components/custom/Form/utils.js +76 -44
- package/dist/published/components/custom/FormV2/FormRenderer.d.ts +6 -2
- package/dist/published/components/custom/FormV2/FormRenderer.js +13 -14
- package/dist/published/components/custom/FormV2/FormRendererContainer.d.ts +7 -2
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +61 -109
- package/dist/published/components/custom/FormV2/components/FormContext.d.ts +4 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.d.ts +9 -5
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.js +12 -24
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.d.ts +5 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +80 -30
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/InstanceLookup.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +51 -27
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.d.ts +5 -5
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +45 -7
- package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +8 -6
- package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.d.ts +3 -0
- package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.js +1 -3
- package/dist/published/components/custom/FormV2/components/types.d.ts +7 -1
- package/dist/published/components/custom/FormV2/components/utils.d.ts +27 -2
- package/dist/published/components/custom/FormV2/components/utils.js +108 -2
- 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/dist/published/theme/hooks.d.ts +4 -0
- package/package.json +12 -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-dev.
|
|
3
|
+
"version": "1.8.0-dev.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/published/index.js",
|
|
6
6
|
"module": "dist/published/index.js",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"icons.ts",
|
|
10
10
|
"colors.ts"
|
|
11
11
|
],
|
|
12
|
-
"sideEffects":
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"*.css"
|
|
14
|
+
],
|
|
13
15
|
"exports": {
|
|
14
16
|
".": "./dist/published/index.js",
|
|
15
17
|
"./colors": "./dist/published/colors/index.js",
|
|
@@ -22,7 +24,7 @@
|
|
|
22
24
|
"build": "rm -rf ./dist && tsc && npm run copy-styles",
|
|
23
25
|
"build:cjs": "tsc --module CommonJS --outDir dist/cjs",
|
|
24
26
|
"prepublish": "rm -rf ./dist && tsc && npm run copy-styles",
|
|
25
|
-
"storybook": "start-storybook -p 6006",
|
|
27
|
+
"storybook": "npx msw init .storybook/public --save && start-storybook -p 6006",
|
|
26
28
|
"build-storybook": "build-storybook",
|
|
27
29
|
"lint": "npm run prettier:check && npm run eslint",
|
|
28
30
|
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
|
|
@@ -78,6 +80,8 @@
|
|
|
78
80
|
"husky": "^8.0.3",
|
|
79
81
|
"is-ci": "^3.0.1",
|
|
80
82
|
"lint-staged": "^13.0.1",
|
|
83
|
+
"msw": "^2.10.4",
|
|
84
|
+
"msw-storybook-addon": "^2.0.5",
|
|
81
85
|
"prettier": "^3.0.0",
|
|
82
86
|
"react": "^18.1.0",
|
|
83
87
|
"react-dom": "^18.1.0",
|
|
@@ -120,7 +124,6 @@
|
|
|
120
124
|
"formiojs": "^4.21.7",
|
|
121
125
|
"html-react-parser": "^5.1.18",
|
|
122
126
|
"luxon": "^2.5.2",
|
|
123
|
-
"msw": "^2.7.3",
|
|
124
127
|
"nanoid": "^5.0.8",
|
|
125
128
|
"nanoid-dictionary": "^4.3.0",
|
|
126
129
|
"no-eval-handlebars": "^1.0.2",
|
|
@@ -141,5 +144,10 @@
|
|
|
141
144
|
"*.{js,jsx,ts,tsx,json,css,md}": [
|
|
142
145
|
"npm run lint:fix"
|
|
143
146
|
]
|
|
147
|
+
},
|
|
148
|
+
"msw": {
|
|
149
|
+
"workerDirectory": [
|
|
150
|
+
".storybook\\public"
|
|
151
|
+
]
|
|
144
152
|
}
|
|
145
153
|
}
|