@evoke-platform/ui-components 1.10.0-testing.15 → 1.10.0-testing.17
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/FormV2/FormRenderer.js +6 -5
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +1 -15
- package/dist/published/components/custom/FormV2/components/AccordionSections.js +7 -2
- package/dist/published/components/custom/FormV2/components/Body.d.ts +1 -1
- package/dist/published/components/custom/FormV2/components/FieldWrapper.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormContext.d.ts +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/AddressFields.d.ts +9 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/AddressFields.js +5 -5
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Criteria.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.d.ts +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Image.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +57 -66
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +2 -2
- package/dist/published/components/custom/FormV2/components/Header.d.ts +12 -4
- package/dist/published/components/custom/FormV2/components/Header.js +7 -9
- package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +14 -19
- package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrors.js +1 -1
- package/dist/published/components/custom/FormV2/components/types.d.ts +1 -0
- package/dist/published/components/custom/FormV2/components/utils.d.ts +2 -2
- package/dist/published/components/custom/FormV2/components/utils.js +7 -7
- package/dist/published/components/custom/ViewDetailsV2/InstanceEntryRenderer.d.ts +3 -0
- package/dist/published/components/custom/ViewDetailsV2/InstanceEntryRenderer.js +155 -0
- package/dist/published/components/custom/ViewDetailsV2/ViewDetailsV2Renderer.d.ts +13 -0
- package/dist/published/components/custom/ViewDetailsV2/ViewDetailsV2Renderer.js +140 -0
- package/dist/published/components/custom/ViewDetailsV2/index.d.ts +2 -0
- package/dist/published/components/custom/ViewDetailsV2/index.js +2 -0
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/components/custom/index.js +1 -0
- package/dist/published/index.d.ts +1 -1
- package/dist/published/index.js +1 -1
- package/dist/published/stories/FormRendererData.d.ts +12 -0
- package/dist/published/stories/FormRendererData.js +23 -0
- package/dist/published/stories/ViewDetailsV2Container.stories.d.ts +26 -0
- package/dist/published/stories/ViewDetailsV2Container.stories.js +37 -0
- package/dist/published/stories/ViewDetailsV2Data.d.ts +4 -0
- package/dist/published/stories/ViewDetailsV2Data.js +203 -0
- package/dist/published/stories/sharedMswHandlers.js +49 -10
- package/dist/published/theme/hooks.d.ts +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
4
|
+
import { ViewDetailsV2Container } from '../components/custom';
|
|
5
|
+
import { sharedObjectHandlers } from './sharedMswHandlers';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Custom/ViewDetailsV2Container',
|
|
8
|
+
component: ViewDetailsV2Container,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
msw: {
|
|
12
|
+
handlers: [sharedObjectHandlers],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (React.createElement(Box, { sx: { padding: '2rem', paddingBottom: 0, '& .css-x8wy7h': { bottom: -1 } } },
|
|
17
|
+
React.createElement(Story, null))),
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
const mockProps = {
|
|
21
|
+
panelLayoutId: 'genericEvokeView',
|
|
22
|
+
instanceId: 'genericEvokeViewInstanceId',
|
|
23
|
+
objectId: 'genericEvokeForm',
|
|
24
|
+
};
|
|
25
|
+
const Template = (args) => {
|
|
26
|
+
return (React.createElement(MemoryRouter, null,
|
|
27
|
+
React.createElement(ViewDetailsV2Container, { ...args })));
|
|
28
|
+
};
|
|
29
|
+
export const ViewDetails = Template.bind({});
|
|
30
|
+
ViewDetails.args = {
|
|
31
|
+
...mockProps,
|
|
32
|
+
};
|
|
33
|
+
export const ViewWithSections = Template.bind({});
|
|
34
|
+
ViewWithSections.args = {
|
|
35
|
+
...mockProps,
|
|
36
|
+
panelLayoutId: 'genericEvokeViewWithSections',
|
|
37
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
export const viewInstance = {
|
|
2
|
+
id: 'instanceId',
|
|
3
|
+
name: 'Ren Foreman',
|
|
4
|
+
multiSelect: ['2', '1', '3'],
|
|
5
|
+
address: {
|
|
6
|
+
city: 'Baltimore',
|
|
7
|
+
},
|
|
8
|
+
objectId: 'genericEvokeForm',
|
|
9
|
+
criteria: { name: 'Value' },
|
|
10
|
+
relatedObject: { id: 'mbSzyE9gpmRx9uMBEmnbh', name: 'A Phantom Menace' },
|
|
11
|
+
user: { id: 'user1', name: 'User 1' },
|
|
12
|
+
boolean: false,
|
|
13
|
+
};
|
|
14
|
+
// View definitions for ViewDetailsV2Container stories
|
|
15
|
+
export const mockGenericEvokeView = {
|
|
16
|
+
id: 'genericEvokeView',
|
|
17
|
+
name: 'Generic Evoke View',
|
|
18
|
+
entries: [
|
|
19
|
+
{
|
|
20
|
+
type: 'readonlyField',
|
|
21
|
+
propertyId: 'name',
|
|
22
|
+
display: {
|
|
23
|
+
label: 'Name',
|
|
24
|
+
prefix: 'Dr',
|
|
25
|
+
suffix: 'Jr',
|
|
26
|
+
required: true,
|
|
27
|
+
charCount: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'readonlyField',
|
|
32
|
+
propertyId: 'criteria',
|
|
33
|
+
display: {
|
|
34
|
+
label: 'Criteria',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'readonlyField',
|
|
39
|
+
propertyId: 'multiSelect',
|
|
40
|
+
display: {
|
|
41
|
+
label: 'Multi-Select',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'readonlyField',
|
|
46
|
+
propertyId: 'address.city',
|
|
47
|
+
display: {
|
|
48
|
+
label: 'Address City',
|
|
49
|
+
description: 'address city description',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'readonlyField',
|
|
54
|
+
propertyId: 'relatedObject',
|
|
55
|
+
display: {
|
|
56
|
+
label: 'Related Object',
|
|
57
|
+
mode: 'default',
|
|
58
|
+
description: 'related Object description',
|
|
59
|
+
relatedObjectDisplay: 'dropdown',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'readonlyField',
|
|
64
|
+
propertyId: 'collection',
|
|
65
|
+
display: {
|
|
66
|
+
label: 'Collection',
|
|
67
|
+
viewLayout: {
|
|
68
|
+
id: 'layoutId',
|
|
69
|
+
objectId: 'customers',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'readonlyField',
|
|
75
|
+
propertyId: 'manyToMany',
|
|
76
|
+
display: {
|
|
77
|
+
label: 'Many to Many',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'readonlyField',
|
|
82
|
+
propertyId: 'documentUpload',
|
|
83
|
+
display: {
|
|
84
|
+
label: 'Document Upload',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'readonlyField',
|
|
89
|
+
propertyId: 'user',
|
|
90
|
+
display: {
|
|
91
|
+
label: 'User',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'readonlyField',
|
|
96
|
+
propertyId: 'boolean',
|
|
97
|
+
display: {
|
|
98
|
+
label: 'Boolean',
|
|
99
|
+
booleanDisplay: 'checkbox',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
objectId: 'genericEvokeForm',
|
|
104
|
+
};
|
|
105
|
+
export const mockGenericEvokeViewWithSections = {
|
|
106
|
+
id: 'genericEvokeViewWithSections',
|
|
107
|
+
name: 'Generic Evoke View With Sections',
|
|
108
|
+
entries: [
|
|
109
|
+
{
|
|
110
|
+
type: 'sections',
|
|
111
|
+
label: 'Section',
|
|
112
|
+
sections: [
|
|
113
|
+
{
|
|
114
|
+
label: 'Section 1',
|
|
115
|
+
entries: [
|
|
116
|
+
{
|
|
117
|
+
type: 'readonlyField',
|
|
118
|
+
propertyId: 'name',
|
|
119
|
+
display: {
|
|
120
|
+
label: 'Name',
|
|
121
|
+
prefix: 'Dr',
|
|
122
|
+
suffix: 'Jr',
|
|
123
|
+
required: true,
|
|
124
|
+
charCount: true,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'readonlyField',
|
|
129
|
+
propertyId: 'documentUpload',
|
|
130
|
+
display: {
|
|
131
|
+
label: 'Document Upload',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: 'readonlyField',
|
|
136
|
+
propertyId: 'criteria',
|
|
137
|
+
display: {
|
|
138
|
+
label: 'Criteria',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
type: 'readonlyField',
|
|
143
|
+
propertyId: 'multiSelect',
|
|
144
|
+
display: {
|
|
145
|
+
label: 'Multi-Select',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
type: 'readonlyField',
|
|
150
|
+
propertyId: 'address.city',
|
|
151
|
+
display: {
|
|
152
|
+
label: 'Address City',
|
|
153
|
+
description: 'address city description',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
type: 'readonlyField',
|
|
158
|
+
propertyId: 'relatedObject',
|
|
159
|
+
display: {
|
|
160
|
+
label: 'Related Object',
|
|
161
|
+
mode: 'default',
|
|
162
|
+
description: 'related Object description',
|
|
163
|
+
relatedObjectDisplay: 'dropdown',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: 'Section 2',
|
|
170
|
+
entries: [
|
|
171
|
+
{
|
|
172
|
+
type: 'readonlyField',
|
|
173
|
+
propertyId: 'boolean',
|
|
174
|
+
display: {
|
|
175
|
+
label: 'Boolean',
|
|
176
|
+
booleanDisplay: 'checkbox',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: 'sections',
|
|
181
|
+
label: 'Section',
|
|
182
|
+
sections: [
|
|
183
|
+
{
|
|
184
|
+
label: 'Nested Section 2',
|
|
185
|
+
entries: [
|
|
186
|
+
{
|
|
187
|
+
type: 'readonlyField',
|
|
188
|
+
propertyId: 'people',
|
|
189
|
+
display: {
|
|
190
|
+
label: 'Many to Many',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
objectId: 'genericEvokeForm',
|
|
203
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { http, HttpResponse } from 'msw';
|
|
2
|
-
import { instance, mockCustomerCreateForm, mockCustomerObject, mockCustomerUpdateForm, mockEvokeForm, mockEvokeFormWithSections, mockGenericEvokeFormObject, mockInstancesForCollection, mockInstancesForRelatedObject, mockMovieCreateForm, mockMovieObject, mockPeopleGenericObject, mockPeopleGenericObjectInstances, mockPeopleObject, mockPropertiesForCriteria, users, } from './FormRendererData';
|
|
2
|
+
import { customerLayout, instance, mockCustomerCreateForm, mockCustomerObject, mockCustomerUpdateForm, mockEvokeForm, mockEvokeFormWithSections, mockGenericEvokeFormObject, mockInstancesForCollection, mockInstancesForRelatedObject, mockMovieCreateForm, mockMovieObject, mockPeopleGenericObject, mockPeopleGenericObjectInstances, mockPeopleObject, mockPropertiesForCriteria, users, } from './FormRendererData';
|
|
3
|
+
import { mockGenericEvokeView, mockGenericEvokeViewWithSections, viewInstance } from './ViewDetailsV2Data';
|
|
3
4
|
export const sharedObjectHandlers = [
|
|
4
5
|
// Object fetches
|
|
5
6
|
http.get('/api/data/objects/:objectId/effective', ({ params, request }) => {
|
|
@@ -30,8 +31,13 @@ export const sharedObjectHandlers = [
|
|
|
30
31
|
http.get('/api/data/objects/:objectId/instances/:instanceId/object', ({ params }) => {
|
|
31
32
|
const { objectId, instanceId } = params;
|
|
32
33
|
let data;
|
|
33
|
-
if (objectId === 'genericEvokeForm'
|
|
34
|
-
|
|
34
|
+
if (objectId === 'genericEvokeForm') {
|
|
35
|
+
if (instanceId === 'updateGenericEvokeFormInstanceId') {
|
|
36
|
+
data = mockGenericEvokeFormObject;
|
|
37
|
+
}
|
|
38
|
+
else if (instanceId === 'genericEvokeViewInstanceId') {
|
|
39
|
+
data = mockGenericEvokeFormObject;
|
|
40
|
+
}
|
|
35
41
|
}
|
|
36
42
|
else if (objectId === 'customers' && instanceId === 'collectionInstance') {
|
|
37
43
|
data = mockCustomerObject;
|
|
@@ -47,24 +53,47 @@ export const sharedObjectHandlers = [
|
|
|
47
53
|
http.get('/api/accessManagement/users', () => HttpResponse.json(users)),
|
|
48
54
|
// Permission fetches
|
|
49
55
|
http.get(/\/checkAccess$/, () => HttpResponse.json({ result: true })),
|
|
56
|
+
// Layout fetches
|
|
57
|
+
http.get('/api/data/objects/customers/tableLayouts/layoutId', () => HttpResponse.json(customerLayout)),
|
|
50
58
|
// General instance fetches
|
|
51
|
-
http.get('/api/data/objects/:objectId/instances/:
|
|
52
|
-
const { objectId,
|
|
59
|
+
http.get('/api/data/objects/:objectId/instances/:instanceId?', ({ params }) => {
|
|
60
|
+
const { objectId, instanceId } = params;
|
|
53
61
|
let data;
|
|
54
62
|
switch (objectId) {
|
|
55
63
|
case 'genericEvokeForm':
|
|
56
|
-
data =
|
|
64
|
+
data =
|
|
65
|
+
instanceId === 'updateGenericEvokeFormInstanceId'
|
|
66
|
+
? instance
|
|
67
|
+
: instanceId === 'genericEvokeViewInstanceId'
|
|
68
|
+
? viewInstance
|
|
69
|
+
: {};
|
|
57
70
|
break;
|
|
58
71
|
case 'movies':
|
|
59
|
-
data =
|
|
60
|
-
? mockInstancesForRelatedObject.find((inst) => inst.id ===
|
|
72
|
+
data = instanceId
|
|
73
|
+
? mockInstancesForRelatedObject.find((inst) => inst.id === instanceId)
|
|
61
74
|
: mockInstancesForRelatedObject;
|
|
62
75
|
break;
|
|
63
76
|
case 'customers':
|
|
64
|
-
data =
|
|
77
|
+
data = instanceId
|
|
78
|
+
? mockInstancesForCollection.find((inst) => inst.id === instanceId)
|
|
79
|
+
: mockInstancesForCollection;
|
|
65
80
|
break;
|
|
66
81
|
case 'peopleGenericObject':
|
|
67
|
-
data = [
|
|
82
|
+
data = [
|
|
83
|
+
{
|
|
84
|
+
id: 'cgf2',
|
|
85
|
+
name: 'Jane Doe',
|
|
86
|
+
people: {
|
|
87
|
+
id: 'person1',
|
|
88
|
+
name: 'Jane Doe',
|
|
89
|
+
},
|
|
90
|
+
genericEvokeForm: {
|
|
91
|
+
id: 'gEV7frl7i1aUEEfkp5dAT',
|
|
92
|
+
name: 'Form Guy',
|
|
93
|
+
},
|
|
94
|
+
objectId: 'peopleGenericObject',
|
|
95
|
+
},
|
|
96
|
+
];
|
|
68
97
|
break;
|
|
69
98
|
case 'people':
|
|
70
99
|
data = mockPeopleGenericObjectInstances;
|
|
@@ -92,6 +121,16 @@ export const sharedObjectHandlers = [
|
|
|
92
121
|
return HttpResponse.json({});
|
|
93
122
|
}
|
|
94
123
|
}),
|
|
124
|
+
// View fetches
|
|
125
|
+
http.get('/api/data/objects/genericEvokeForm/panelLayouts/:viewId?', ({ params, request }) => {
|
|
126
|
+
const viewId = Array.isArray(params.viewId) ? params.viewId[0] : params.viewId;
|
|
127
|
+
switch (viewId) {
|
|
128
|
+
case 'genericEvokeView':
|
|
129
|
+
return HttpResponse.json(mockGenericEvokeView);
|
|
130
|
+
case 'genericEvokeViewWithSections':
|
|
131
|
+
return HttpResponse.json(mockGenericEvokeViewWithSections);
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
95
134
|
// Action fetches
|
|
96
135
|
// Fetch for many-to-many create action when adding a value to the field
|
|
97
136
|
http.post('api/data/objects/peopleGenericObject/instances/actions', async (req) => {
|
|
@@ -137,7 +137,7 @@ export declare function useFormContext(): {
|
|
|
137
137
|
* @returns Object with boolean flags for different breakpoints
|
|
138
138
|
*/
|
|
139
139
|
setFetchedOptions: (newData: import("react-hook-form").FieldValues) => void;
|
|
140
|
-
getValues
|
|
140
|
+
getValues?: import("react-hook-form").UseFormGetValues<import("react-hook-form").FieldValues> | undefined;
|
|
141
141
|
object?: import("@evoke-platform/context").Obj | undefined;
|
|
142
142
|
errors?: import("react-hook-form").FieldValues | undefined;
|
|
143
143
|
instance?: import("react-hook-form").FieldValues | undefined;
|
|
@@ -147,7 +147,7 @@ export declare function useFormContext(): {
|
|
|
147
147
|
setExpandedSections?: import("react").Dispatch<import("react").SetStateAction<import("../components/custom/FormV2/components/types").ExpandedSection[]>> | undefined;
|
|
148
148
|
setExpandAll?: import("react").Dispatch<import("react").SetStateAction<boolean | null | undefined>> | undefined;
|
|
149
149
|
parameters?: import("@evoke-platform/context").InputParameter[] | undefined;
|
|
150
|
-
handleChange
|
|
150
|
+
handleChange?: ((name: string, value: unknown) => void | Promise<void>) | undefined;
|
|
151
151
|
onAutosave?: ((fieldId: string) => void | Promise<void>) | undefined;
|
|
152
152
|
fieldHeight?: "medium" | "small" | undefined;
|
|
153
153
|
triggerFieldReset?: boolean | undefined;
|
|
@@ -155,7 +155,7 @@ export declare function useFormContext(): {
|
|
|
155
155
|
associatedObject?: {
|
|
156
156
|
instanceId?: string | undefined;
|
|
157
157
|
propertyId?: string | undefined; /** Extra large screens (1536px and up) */
|
|
158
|
-
} | undefined;
|
|
158
|
+
} | undefined;
|
|
159
159
|
form?: import("@evoke-platform/context").EvokeForm | undefined;
|
|
160
160
|
width: number;
|
|
161
161
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evoke-platform/ui-components",
|
|
3
|
-
"version": "1.10.0-testing.
|
|
3
|
+
"version": "1.10.0-testing.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/published/index.js",
|
|
6
6
|
"module": "dist/published/index.js",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"yalc": "^1.0.0-pre.53"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@evoke-platform/context": "^1.5.0-
|
|
97
|
+
"@evoke-platform/context": "^1.5.0-testing.4",
|
|
98
98
|
"react": "^18.1.0",
|
|
99
99
|
"react-dom": "^18.1.0"
|
|
100
100
|
},
|