@pega/custom-dx-components 2.0.11 → 2.0.12
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/README.md +73 -57
- package/package.json +1 -1
- package/src/cli.js +18 -0
- package/src/tasks/authenticate/index.js +3 -1
- package/src/tasks/build/helper.js +123 -0
- package/src/tasks/build/index.js +54 -0
- package/src/tasks/{publish/bundle → bundle}/builder/index.js +0 -0
- package/src/tasks/{publish/bundle → bundle}/builder/modules.js +0 -0
- package/src/tasks/{publish/bundle → bundle}/builder/paths.js +0 -0
- package/src/tasks/{publish/bundle → bundle}/builder/webpack.config.js +0 -2
- package/src/tasks/{publish/bundle → bundle}/index.js +2 -2
- package/src/tasks/create/index.js +6 -3
- package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +29 -18
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +61 -0
- package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +41 -0
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +179 -67
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +39 -16
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +3 -1
- package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js → date-utils.js.mustache} +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +39 -15
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +2 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +22 -17
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +25 -17
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +3 -4
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +22 -17
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +8 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +22 -17
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +42 -14
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +44 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +67 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +21 -16
- package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +13 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +20 -16
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +44 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.js → StatusWork.jsx} +0 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +21 -17
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +46 -3
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +21 -17
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +44 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +19 -17
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +46 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +37 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +19 -17
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +174 -3
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +24 -16
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +110 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +14 -29
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +179 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +3 -77
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +118 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +14 -29
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +215 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +3 -74
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +89 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +6 -10
- package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +125 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +92 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +10 -8
- package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +125 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.js.mustache → GetNextWork.jsx.mustache} +6 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +102 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +9 -7
- package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +94 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +389 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +30 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.js.mustache → Avatar.jsx.mustache} +2 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.js.mustache → Operator.jsx.mustache} +2 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +68 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +51 -0
- package/src/tasks/delete/helper.js +4 -0
- package/src/tasks/delete/index.js +4 -0
- package/src/tasks/delete-all/helper.js +175 -0
- package/src/tasks/delete-all/index.js +49 -0
- package/src/tasks/index.js +3 -0
- package/src/tasks/init/index.js +1 -1
- package/src/tasks/init/template/.eslintignore +8 -0
- package/src/tasks/init/template/.eslintrc.json +186 -5
- package/src/tasks/init/template/package.json.mustache +19 -4
- package/src/tasks/linter/index.js +46 -0
- package/src/tasks/list/index.js +4 -0
- package/src/tasks/publish/index.js +14 -1
- package/src/tasks/publish-all/helper.js +139 -0
- package/src/tasks/publish-all/index.js +84 -0
- package/src/util.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +0 -172
package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
export const pyReviewRaw = {
|
|
2
|
+
name: 'pyReview',
|
|
3
|
+
type: 'View',
|
|
4
|
+
config: {
|
|
5
|
+
template: 'Details',
|
|
6
|
+
ruleClass: 'MyCo-MyCompon-Work-MyComponents',
|
|
7
|
+
showLabel: true,
|
|
8
|
+
label: '@L Details',
|
|
9
|
+
localeReference: '@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW',
|
|
10
|
+
showHighlightedData: true,
|
|
11
|
+
highlightedData: [
|
|
12
|
+
{
|
|
13
|
+
type: 'TextInput',
|
|
14
|
+
config: {
|
|
15
|
+
value: '@P .pyStatusWork',
|
|
16
|
+
label: '@L Work Status',
|
|
17
|
+
displayMode: 'STACKED_LARGE_VAL',
|
|
18
|
+
displayAsStatus: true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'TextInput',
|
|
23
|
+
config: {
|
|
24
|
+
value: '@P .pyID',
|
|
25
|
+
label: '@L Case ID',
|
|
26
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'DateTime',
|
|
31
|
+
config: {
|
|
32
|
+
value: '@P .pxCreateDateTime',
|
|
33
|
+
label: '@L Create date/time',
|
|
34
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'UserReference',
|
|
39
|
+
config: {
|
|
40
|
+
label: '@L Create Operator',
|
|
41
|
+
value: '@USER .pxCreateOperator',
|
|
42
|
+
placeholder: 'Select...',
|
|
43
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
inheritedProps: [
|
|
48
|
+
{
|
|
49
|
+
prop: 'label',
|
|
50
|
+
value: '@L Details'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
prop: 'showLabel',
|
|
54
|
+
value: true
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
{
|
|
60
|
+
name: 'A',
|
|
61
|
+
type: 'Region',
|
|
62
|
+
getPConnect: () => {
|
|
63
|
+
return {
|
|
64
|
+
getRawMetadata: () => {
|
|
65
|
+
return pyReviewRaw.children[0];
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
{
|
|
71
|
+
type: 'DateTime',
|
|
72
|
+
config: {
|
|
73
|
+
value: '@P .pySLADeadline',
|
|
74
|
+
label: '@L SLA Deadline'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'DateTime',
|
|
79
|
+
config: {
|
|
80
|
+
value: '@P .pySLAGoal',
|
|
81
|
+
label: '@L SLA Goal'
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: 'RadioButtons',
|
|
86
|
+
config: {
|
|
87
|
+
value: '@P .pySLAStartTime',
|
|
88
|
+
label: '@L SLA Start Time',
|
|
89
|
+
listType: 'associated',
|
|
90
|
+
datasource: '@ASSOCIATED .pySLAStartTime'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'B',
|
|
97
|
+
type: 'Region',
|
|
98
|
+
getPConnect: () => {
|
|
99
|
+
return {
|
|
100
|
+
getRawMetadata: () => {
|
|
101
|
+
return pyReviewRaw.children[0];
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
children: [
|
|
106
|
+
{
|
|
107
|
+
type: 'DateTime',
|
|
108
|
+
config: {
|
|
109
|
+
value: '@P .pySLADeadline',
|
|
110
|
+
label: '@L SLA Deadline'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: 'DateTime',
|
|
115
|
+
config: {
|
|
116
|
+
value: '@P .pySLAGoal',
|
|
117
|
+
label: '@L SLA Goal'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'RadioButtons',
|
|
122
|
+
config: {
|
|
123
|
+
value: '@P .pySLAStartTime',
|
|
124
|
+
label: '@L SLA Start Time',
|
|
125
|
+
listType: 'associated',
|
|
126
|
+
datasource: '@ASSOCIATED .pySLAStartTime'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
classID: 'MyCo-MyCompon-Work-MyComponents'
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const pyReviewResolved = {
|
|
136
|
+
readOnly: true,
|
|
137
|
+
template: 'Details',
|
|
138
|
+
ruleClass: 'MyCo-MyCompon-Work-MyComponents',
|
|
139
|
+
showLabel: true,
|
|
140
|
+
label: 'Details',
|
|
141
|
+
localeReference: 'MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW',
|
|
142
|
+
showHighlightedData: true,
|
|
143
|
+
highlightedData: [
|
|
144
|
+
{
|
|
145
|
+
type: 'TextInput',
|
|
146
|
+
config: {
|
|
147
|
+
value: 'New',
|
|
148
|
+
label: 'Work Status',
|
|
149
|
+
displayMode: 'STACKED_LARGE_VAL',
|
|
150
|
+
displayAsStatus: true
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'TextInput',
|
|
155
|
+
config: {
|
|
156
|
+
value: 'M-1002',
|
|
157
|
+
label: 'Case ID',
|
|
158
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'DateTime',
|
|
163
|
+
config: {
|
|
164
|
+
value: '2022-12-11T20:06:27.232Z',
|
|
165
|
+
label: 'Create date/time',
|
|
166
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'UserReference',
|
|
171
|
+
config: {
|
|
172
|
+
label: 'Create Operator',
|
|
173
|
+
value: {
|
|
174
|
+
userId: 'riddn',
|
|
175
|
+
userName: 'Niall Riddell'
|
|
176
|
+
},
|
|
177
|
+
placeholder: 'Select...',
|
|
178
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
displayMode: 'LABELS_LEFT'
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const regionChildrenResolved = [
|
|
186
|
+
{
|
|
187
|
+
readOnly: true,
|
|
188
|
+
value: '',
|
|
189
|
+
label: 'SLA Deadline',
|
|
190
|
+
displayMode: 'LABELS_LEFT'
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
readOnly: true,
|
|
194
|
+
value: '',
|
|
195
|
+
label: 'SLA Goal',
|
|
196
|
+
displayMode: 'LABELS_LEFT'
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
readOnly: true,
|
|
200
|
+
value: '',
|
|
201
|
+
label: 'SLA Start Time',
|
|
202
|
+
listType: 'associated',
|
|
203
|
+
datasource: [
|
|
204
|
+
{
|
|
205
|
+
key: 'AssignmentCreation',
|
|
206
|
+
value: 'The creation time of the Assignment'
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
key: 'CurrentTime',
|
|
210
|
+
value: 'Current Date Time'
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
displayMode: 'LABELS_LEFT'
|
|
214
|
+
}
|
|
215
|
+
];
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
2
|
|
|
3
|
-
//import { LazyMap as LazyComponentMap } from '../../components_map';
|
|
4
3
|
|
|
5
|
-
const LazyComponentMap = {};
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Given the PConnect object of a Template component, retrieve the children
|
|
@@ -43,78 +41,7 @@ export function getAllFields(pConnect) {
|
|
|
43
41
|
return allFields;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
/**
|
|
47
|
-
* A helper function to create an object consisting react component as per the type.
|
|
48
|
-
* This is used by CaseSummary template.
|
|
49
|
-
* @param {object} configObject Object containing meta information for the particular field authored
|
|
50
|
-
* @param {Function} getPConnect PConnect function passed along to other components.
|
|
51
|
-
* @param {string} displayMode displayMode string contains information about the layout of component in review mode.
|
|
52
|
-
*/
|
|
53
|
-
export function prepareComponentInCaseSummary(configObject, getPConnect, displayMode) {
|
|
54
|
-
const { config, children } = configObject;
|
|
55
|
-
let { type } = configObject;
|
|
56
|
-
const caseSummaryComponentObject = {};
|
|
57
|
-
let showAddressLabel = true;
|
|
58
|
-
if (config && config.value === '@P .pyStatusWork') {
|
|
59
|
-
config.displayAsStatus = true;
|
|
60
|
-
type = 'TextInput'; // force the type to be TextInput for status field.
|
|
61
|
-
// As TextInput is loaded forcefully sometimes, TextInput component might not be available in lazy map.
|
|
62
|
-
// Load TextInput if it is not available.
|
|
63
|
-
if (!LazyComponentMap[type]) {
|
|
64
|
-
PCore.getAssetLoader().getLoader('component-loader')([type]);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
44
|
|
|
68
|
-
caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
|
|
69
|
-
label: config.label
|
|
70
|
-
}).label;
|
|
71
|
-
if (type === 'CaseOperator') {
|
|
72
|
-
switch (caseSummaryComponentObject.name) {
|
|
73
|
-
case 'Create operator':
|
|
74
|
-
caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
|
|
75
|
-
createLabel: config.createLabel
|
|
76
|
-
}).createLabel;
|
|
77
|
-
break;
|
|
78
|
-
case 'Update operator':
|
|
79
|
-
caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
|
|
80
|
-
updateLabel: config.updateLabel
|
|
81
|
-
}).updateLabel;
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
|
|
85
|
-
resolveLabel: config.resolveLabel
|
|
86
|
-
}).resolveLabel;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
} else if (type === 'Checkbox') {
|
|
90
|
-
caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
|
|
91
|
-
label: config.caption
|
|
92
|
-
}).label;
|
|
93
|
-
} else if (type === 'Address') {
|
|
94
|
-
showAddressLabel = false;
|
|
95
|
-
}
|
|
96
|
-
const createdComponent = getPConnect().createComponent({
|
|
97
|
-
type,
|
|
98
|
-
children: children ? [...children] : [],
|
|
99
|
-
showAddressLabel,
|
|
100
|
-
config: {
|
|
101
|
-
...config,
|
|
102
|
-
hideLabel: true,
|
|
103
|
-
key: createUID() // Need a unique key on render of the summary so that the component is recreated each time
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
createdComponent.props.getPConnect().setInheritedProp('displayMode', displayMode);
|
|
107
|
-
if (type === 'Address') {
|
|
108
|
-
createdComponent.props.getPConnect().setInheritedProp('showAddressLabel', showAddressLabel);
|
|
109
|
-
}
|
|
110
|
-
// createdComponent.props.getPConnect().setInheritedProp("hideLabel", true);
|
|
111
|
-
caseSummaryComponentObject.value = createdComponent;
|
|
112
|
-
if (type === 'reference') {
|
|
113
|
-
caseSummaryComponentObject.name = createdComponent.props.getPConnect().getInheritedProps().label;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return caseSummaryComponentObject;
|
|
117
|
-
}
|
|
118
45
|
|
|
119
46
|
export function getFilteredFields(getPConnect) {
|
|
120
47
|
let primaryFieldsRaw;
|
|
@@ -212,7 +139,9 @@ export function getInstructions(pConnect, instructions = 'casestep') {
|
|
|
212
139
|
|
|
213
140
|
// If the annotation wasn't processed correctly, don't return any instruction text
|
|
214
141
|
if (instructions?.startsWith('@PARAGRAPH')) {
|
|
142
|
+
/* eslint-disable no-console */
|
|
215
143
|
console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.');
|
|
144
|
+
/* eslint-enable no-console */
|
|
216
145
|
return undefined;
|
|
217
146
|
}
|
|
218
147
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
4
|
+
import { DateInput, Input, FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
5
|
+
import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core';
|
|
6
|
+
import { pyReviewRaw, regionChildrenResolved } from './mock.stories';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
10
|
+
decorators: [withKnobs],
|
|
11
|
+
component: {{COMPONENT_CLASS_NAME}}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = args => {
|
|
15
|
+
const regionAChildren = pyReviewRaw.children[0].children.map(child => {
|
|
16
|
+
return Primary.args.getPConnect().createComponent(child);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return <{{COMPONENT_CLASS_NAME}} {...args}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Primary = Template.bind({});
|
|
23
|
+
|
|
24
|
+
Primary.args = {
|
|
25
|
+
NumCols: 1,
|
|
26
|
+
template: 'DefaultForm',
|
|
27
|
+
getPConnect: () => {
|
|
28
|
+
return {
|
|
29
|
+
getChildren: () => {
|
|
30
|
+
return pyReviewRaw.children;
|
|
31
|
+
},
|
|
32
|
+
createComponent: config => {
|
|
33
|
+
switch (config.config.value) {
|
|
34
|
+
case '@P .FirstName':
|
|
35
|
+
return renderField(regionChildrenResolved[0]);
|
|
36
|
+
case '@P .MiddleName':
|
|
37
|
+
return renderField(regionChildrenResolved[1]);
|
|
38
|
+
case '@P .LastName':
|
|
39
|
+
return renderField(regionChildrenResolved[2]);
|
|
40
|
+
case '@P .Email':
|
|
41
|
+
return renderField(regionChildrenResolved[3]);
|
|
42
|
+
case '@P .PhoneNumber':
|
|
43
|
+
return renderField(regionChildrenResolved[4]);
|
|
44
|
+
case '@P .ServiceDate':
|
|
45
|
+
return renderField(regionChildrenResolved[5]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const renderField = resolvedProps => {
|
|
53
|
+
const { displayMode, value = '', label = '' } = resolvedProps;
|
|
54
|
+
|
|
55
|
+
const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
|
|
56
|
+
|
|
57
|
+
let val =
|
|
58
|
+
value != '' ? (
|
|
59
|
+
<Text variant='h1' as='span'>
|
|
60
|
+
{value}
|
|
61
|
+
</Text>
|
|
62
|
+
) : (
|
|
63
|
+
''
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
{{! pick new delimiteres for mustache }}
|
|
67
|
+
{{=<% %>=}}
|
|
68
|
+
|
|
69
|
+
if (label === 'Service Date') val = <DateInput value={value} style={{ fontSize: '14px' }}></DateInput>;
|
|
70
|
+
|
|
71
|
+
if (label === 'Email') val = <Input type='email' value={value} style={{ fontSize: '14px' }}></Input>;
|
|
72
|
+
|
|
73
|
+
if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name')
|
|
74
|
+
val = <Input value={value} style={{ fontSize: '14px' }}></Input>;
|
|
75
|
+
|
|
76
|
+
if (label === 'Phone Number') val = <CosmosPhone value={value} style={{ fontSize: '14px' }}></CosmosPhone>;
|
|
77
|
+
<%={{ }}=%> {{! revert delimiteres for mustache }}
|
|
78
|
+
|
|
79
|
+
if (variant === 'inline') {
|
|
80
|
+
val = value || <span aria-hidden='true'>––</span>;
|
|
81
|
+
} else {
|
|
82
|
+
val = (
|
|
83
|
+
<Text variant='h1' as='span'>
|
|
84
|
+
{val}
|
|
85
|
+
</Text>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
|
|
89
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Grid , Flex } from '@pega/cosmos-react-core';
|
|
1
|
+
import { Grid } from '@pega/cosmos-react-core';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
|
|
5
4
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
@@ -12,11 +11,11 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
|
12
11
|
export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
const {
|
|
14
|
+
const { children, NumCols } = props;
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
const nCols = parseInt(NumCols, 10);
|
|
18
17
|
|
|
19
|
-
//console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
|
|
18
|
+
// console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
|
|
20
19
|
|
|
21
20
|
return (
|
|
22
21
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
@@ -37,13 +36,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
|
37
36
|
|
|
38
37
|
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
39
38
|
NumCols: 1,
|
|
40
|
-
templateOverrideMode: 'USE_TEMPLATE',
|
|
41
39
|
children: []
|
|
42
40
|
};
|
|
43
41
|
|
|
44
42
|
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
48
|
-
template: PropTypes.string.isRequired
|
|
43
|
+
NumCols: PropTypes.number,
|
|
44
|
+
children: PropTypes.arrayOf(PropTypes.node),
|
|
49
45
|
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export const pyReviewRaw = {
|
|
2
|
+
name: 'CollectInformation',
|
|
3
|
+
type: 'View',
|
|
4
|
+
config: {
|
|
5
|
+
template: 'DefaultForm',
|
|
6
|
+
ruleClass: 'OM5W9U-SampleApp-Work-Test',
|
|
7
|
+
localeReference: '@LR OM5W9U-SAMPLEAPP-WORK-TEST!VIEW!COLLECTINFORMATION',
|
|
8
|
+
context: '@P .pyViewContext'
|
|
9
|
+
},
|
|
10
|
+
children: [
|
|
11
|
+
{
|
|
12
|
+
name: 'Fields',
|
|
13
|
+
type: 'Region',
|
|
14
|
+
children: [
|
|
15
|
+
{
|
|
16
|
+
type: 'TextInput',
|
|
17
|
+
config: {
|
|
18
|
+
value: '@P .FirstName',
|
|
19
|
+
label: '@L First Name'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'TextInput',
|
|
24
|
+
config: {
|
|
25
|
+
value: '@P .MiddleName',
|
|
26
|
+
label: '@L Middle Name'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'TextInput',
|
|
31
|
+
config: {
|
|
32
|
+
value: '@P .LastName',
|
|
33
|
+
label: '@L Last Name'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'Email',
|
|
38
|
+
config: {
|
|
39
|
+
value: '@P .Email',
|
|
40
|
+
label: '@L Email'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'Phone',
|
|
45
|
+
config: {
|
|
46
|
+
value: '@P .PhoneNumber',
|
|
47
|
+
label: '@L Phone Number',
|
|
48
|
+
datasource: {
|
|
49
|
+
source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults',
|
|
50
|
+
fields: {
|
|
51
|
+
value: '@P .pyCallingCode'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'Date',
|
|
58
|
+
config: {
|
|
59
|
+
value: '@P .ServiceDate',
|
|
60
|
+
label: '@L Service Date'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
classID: 'OM5W9U-SampleApp-Work-Test'
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const regionChildrenResolved = [
|
|
70
|
+
{
|
|
71
|
+
readOnly: undefined,
|
|
72
|
+
value: 'John',
|
|
73
|
+
label: 'First Name',
|
|
74
|
+
hasSuggestions: false
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
readOnly: undefined,
|
|
78
|
+
value: '',
|
|
79
|
+
label: 'Middle Name',
|
|
80
|
+
hasSuggestions: false
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
readOnly: undefined,
|
|
84
|
+
value: 'Doe',
|
|
85
|
+
label: 'Last Name',
|
|
86
|
+
hasSuggestions: false
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
readOnly: undefined,
|
|
90
|
+
value: 'John@doe.com',
|
|
91
|
+
label: 'Email',
|
|
92
|
+
hasSuggestions: false
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
readOnly: undefined,
|
|
96
|
+
value: '+16397975093',
|
|
97
|
+
label: 'Phone Number',
|
|
98
|
+
datasource: {
|
|
99
|
+
fields: {
|
|
100
|
+
value: undefined
|
|
101
|
+
},
|
|
102
|
+
source: [
|
|
103
|
+
{
|
|
104
|
+
value: '+1'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
value: '+91'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: '+48'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: '+44'
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
hasSuggestions: false
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
readOnly: undefined,
|
|
121
|
+
value: '2023-01-25',
|
|
122
|
+
label: 'Service Date',
|
|
123
|
+
hasSuggestions: false
|
|
124
|
+
}
|
|
125
|
+
];
|
package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
4
|
+
import { DateInput, Input, FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
5
|
+
import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core';
|
|
6
|
+
import { pyReviewRaw, regionChildrenResolved } from './mock.stories';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
10
|
+
decorators: [withKnobs],
|
|
11
|
+
component: {{COMPONENT_CLASS_NAME}}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = args => {
|
|
15
|
+
const regionAChildren = pyReviewRaw.children[0].children.map(child => {
|
|
16
|
+
return Primary.args.getPConnect().createComponent(child);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return <{{COMPONENT_CLASS_NAME}} {...args}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Primary = Template.bind({});
|
|
23
|
+
|
|
24
|
+
Primary.args = {
|
|
25
|
+
template: 'DefaultForm',
|
|
26
|
+
getPConnect: () => {
|
|
27
|
+
return {
|
|
28
|
+
getChildren: () => {
|
|
29
|
+
return pyReviewRaw.children;
|
|
30
|
+
},
|
|
31
|
+
createComponent: config => {
|
|
32
|
+
switch (config.config.value) {
|
|
33
|
+
case '@P .FirstName':
|
|
34
|
+
return renderField(regionChildrenResolved[0]);
|
|
35
|
+
case '@P .MiddleName':
|
|
36
|
+
return renderField(regionChildrenResolved[1]);
|
|
37
|
+
case '@P .LastName':
|
|
38
|
+
return renderField(regionChildrenResolved[2]);
|
|
39
|
+
case '@P .Email':
|
|
40
|
+
return renderField(regionChildrenResolved[3]);
|
|
41
|
+
case '@P .PhoneNumber':
|
|
42
|
+
return renderField(regionChildrenResolved[4]);
|
|
43
|
+
case '@P .ServiceDate':
|
|
44
|
+
return renderField(regionChildrenResolved[5]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const renderField = resolvedProps => {
|
|
52
|
+
const { displayMode, value = '', label = '' } = resolvedProps;
|
|
53
|
+
|
|
54
|
+
const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
|
|
55
|
+
|
|
56
|
+
let val =
|
|
57
|
+
value != '' ? (
|
|
58
|
+
<Text variant='h1' as='span'>
|
|
59
|
+
{value}
|
|
60
|
+
</Text>
|
|
61
|
+
) : (
|
|
62
|
+
''
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
{{! pick new delimiteres for mustache }}
|
|
66
|
+
{{=<% %>=}}
|
|
67
|
+
|
|
68
|
+
if (label === 'Service Date')
|
|
69
|
+
val = <DateInput value={value} style={{ fontSize: '14px' }}></DateInput>;
|
|
70
|
+
|
|
71
|
+
if (label === 'Email')
|
|
72
|
+
val = <Input type='email' value={value} style={{ fontSize: '14px' }}></Input>;
|
|
73
|
+
|
|
74
|
+
if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name')
|
|
75
|
+
val = <Input value={value} style={{ fontSize: '14px' }}></Input>;
|
|
76
|
+
|
|
77
|
+
if (label === 'Phone Number')
|
|
78
|
+
val = <CosmosPhone value={value} style={{ fontSize: '14px' }}></CosmosPhone>;
|
|
79
|
+
|
|
80
|
+
<%={{ }}=%> {{! revert delimiteres for mustache }}
|
|
81
|
+
|
|
82
|
+
if (variant === 'inline') {
|
|
83
|
+
val = value || <span aria-hidden='true'>––</span>;
|
|
84
|
+
} else {
|
|
85
|
+
val = (
|
|
86
|
+
<Text variant='h1' as='span'>
|
|
87
|
+
{val}
|
|
88
|
+
</Text>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
|
|
92
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Grid , Flex } from '@pega/cosmos-react-core';
|
|
1
|
+
import { Grid, Flex } from '@pega/cosmos-react-core';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
|
|
5
4
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
@@ -12,13 +11,19 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
|
12
11
|
export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
const {
|
|
14
|
+
const { children } = props;
|
|
15
|
+
|
|
16
|
+
const numRegions = children?.length;
|
|
17
|
+
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
18
|
+
const gridContainer = {"colGap" : 1};
|
|
19
|
+
gridContainer.cols = gridRepeat;
|
|
20
|
+
gridContainer.alignItems = 'start';
|
|
16
21
|
|
|
17
22
|
return (
|
|
18
23
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
19
24
|
{{! pick new delimiteres for mustache }}
|
|
20
25
|
{{=<% %>=}}
|
|
21
|
-
<Grid container={
|
|
26
|
+
<Grid container={gridContainer}>
|
|
22
27
|
{children.map((child, i) => (
|
|
23
28
|
<Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
|
|
24
29
|
{child}
|
|
@@ -36,8 +41,5 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
39
|
-
|
|
40
|
-
getPConnect: PropTypes.func.isRequired,
|
|
41
|
-
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
42
|
-
template: PropTypes.string.isRequired
|
|
44
|
+
children: PropTypes.arrayOf(PropTypes.node),
|
|
43
45
|
};
|