@pega/custom-dx-components 2.0.11 → 2.0.13
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 +10 -2
- 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
|
@@ -0,0 +1,179 @@
|
|
|
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
|
+
classID: 'MyCo-MyCompon-Work-MyComponents'
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const pyReviewResolved = {
|
|
100
|
+
readOnly: true,
|
|
101
|
+
template: 'Details',
|
|
102
|
+
ruleClass: 'MyCo-MyCompon-Work-MyComponents',
|
|
103
|
+
showLabel: true,
|
|
104
|
+
label: 'Details',
|
|
105
|
+
localeReference: 'MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW',
|
|
106
|
+
showHighlightedData: true,
|
|
107
|
+
highlightedData: [
|
|
108
|
+
{
|
|
109
|
+
type: 'TextInput',
|
|
110
|
+
config: {
|
|
111
|
+
value: 'New',
|
|
112
|
+
label: 'Work Status',
|
|
113
|
+
displayMode: 'STACKED_LARGE_VAL',
|
|
114
|
+
displayAsStatus: true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'TextInput',
|
|
119
|
+
config: {
|
|
120
|
+
value: 'M-1002',
|
|
121
|
+
label: 'Case ID',
|
|
122
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'DateTime',
|
|
127
|
+
config: {
|
|
128
|
+
value: '2022-12-11T20:06:27.232Z',
|
|
129
|
+
label: 'Create date/time',
|
|
130
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'UserReference',
|
|
135
|
+
config: {
|
|
136
|
+
label: 'Create Operator',
|
|
137
|
+
value: {
|
|
138
|
+
userId: 'riddn',
|
|
139
|
+
userName: 'Niall Riddell'
|
|
140
|
+
},
|
|
141
|
+
placeholder: 'Select...',
|
|
142
|
+
displayMode: 'STACKED_LARGE_VAL'
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
displayMode: 'LABELS_LEFT'
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const regionChildrenResolved = [
|
|
150
|
+
{
|
|
151
|
+
readOnly: true,
|
|
152
|
+
value: '',
|
|
153
|
+
label: 'SLA Deadline',
|
|
154
|
+
displayMode: 'LABELS_LEFT'
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
readOnly: true,
|
|
158
|
+
value: '',
|
|
159
|
+
label: 'SLA Goal',
|
|
160
|
+
displayMode: 'LABELS_LEFT'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
readOnly: true,
|
|
164
|
+
value: '',
|
|
165
|
+
label: 'SLA Start Time',
|
|
166
|
+
listType: 'associated',
|
|
167
|
+
datasource: [
|
|
168
|
+
{
|
|
169
|
+
key: 'AssignmentCreation',
|
|
170
|
+
value: 'The creation time of the Assignment'
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
key: 'CurrentTime',
|
|
174
|
+
value: 'Current Date Time'
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
displayMode: 'LABELS_LEFT'
|
|
178
|
+
}
|
|
179
|
+
];
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//import { LazyMap as LazyComponentMap } from '../../components_map';
|
|
4
|
-
|
|
5
|
-
const LazyComponentMap = {};
|
|
1
|
+
/* eslint-disable no-undef */
|
|
6
2
|
|
|
7
3
|
/**
|
|
8
4
|
* Given the PConnect object of a Template component, retrieve the children
|
|
@@ -43,78 +39,7 @@ export function getAllFields(pConnect) {
|
|
|
43
39
|
return allFields;
|
|
44
40
|
}
|
|
45
41
|
|
|
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
|
-
|
|
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
42
|
|
|
116
|
-
return caseSummaryComponentObject;
|
|
117
|
-
}
|
|
118
43
|
|
|
119
44
|
export function getFilteredFields(getPConnect) {
|
|
120
45
|
let primaryFieldsRaw;
|
|
@@ -212,8 +137,9 @@ export function getInstructions(pConnect, instructions = 'casestep') {
|
|
|
212
137
|
|
|
213
138
|
// If the annotation wasn't processed correctly, don't return any instruction text
|
|
214
139
|
if (instructions?.startsWith('@PARAGRAPH')) {
|
|
140
|
+
/* eslint-disable no-console */
|
|
215
141
|
console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.');
|
|
216
|
-
return undefined;
|
|
142
|
+
/* eslint-enable no-console */ return undefined;
|
|
217
143
|
}
|
|
218
144
|
|
|
219
145
|
// Custom instructions from the view
|
package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Status } from "@pega/cosmos-react-core";
|
|
2
|
+
|
|
3
|
+
export default function StatusWorkRenderer({ value }) {
|
|
4
|
+
let variant = "info";
|
|
5
|
+
|
|
6
|
+
const warnStrings = ["fail", "cancel", "reject", "revoke", "stopped", "warn"];
|
|
7
|
+
const infoStrings = ["open", "hold", "info", "new"];
|
|
8
|
+
const successStrings = ["resolved", "completed", "success"];
|
|
9
|
+
const pendingStrings = ["pending"];
|
|
10
|
+
|
|
11
|
+
if (new RegExp(warnStrings.join("|"), "i").test(value)) {
|
|
12
|
+
variant = "warn";
|
|
13
|
+
} else if (new RegExp(infoStrings.join("|"), "i").test(value)) {
|
|
14
|
+
variant = "info";
|
|
15
|
+
} else if (new RegExp(successStrings.join("|"), "i").test(value)) {
|
|
16
|
+
variant = "success";
|
|
17
|
+
} else if (new RegExp(pendingStrings.join("|"), "i").test(value)) {
|
|
18
|
+
variant = "pending";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Status type="rectangle" variant={variant}>
|
|
23
|
+
{value}
|
|
24
|
+
</Status>
|
|
25
|
+
);
|
|
26
|
+
}
|
package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/cosmos-react-core';
|
|
2
|
+
import {{COMPONENT_CLASS_NAME}} from './index';
|
|
3
|
+
import { pyReviewRaw, pyReviewResolved, regionChildrenResolved } from './mock.stories';
|
|
4
|
+
import StatusWorkRenderer from './StatusWork.jsx';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
8
|
+
component: {{COMPONENT_CLASS_NAME}}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const Template = args => {
|
|
12
|
+
const regionAChildren = pyReviewRaw.children[0].children.map(child => {
|
|
13
|
+
return Primary.args.getPConnect().createComponent(child);
|
|
14
|
+
});
|
|
15
|
+
const regionBChildren = pyReviewRaw.children[1].children.map(child => {
|
|
16
|
+
return Primary.args.getPConnect().createComponent(child);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<{{COMPONENT_CLASS_NAME}} {...args}>
|
|
21
|
+
{regionAChildren}
|
|
22
|
+
{regionBChildren}
|
|
23
|
+
</{{COMPONENT_CLASS_NAME}}>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Primary = Template.bind({});
|
|
28
|
+
|
|
29
|
+
Primary.args = {
|
|
30
|
+
template: 'MyCo_MyComponents_NewDetailsTemplate',
|
|
31
|
+
showHighlightedData: true,
|
|
32
|
+
label: 'Test Details',
|
|
33
|
+
showLabel: true,
|
|
34
|
+
getPConnect: () => {
|
|
35
|
+
return {
|
|
36
|
+
getChildren: () => {
|
|
37
|
+
return pyReviewRaw.children;
|
|
38
|
+
},
|
|
39
|
+
getRawMetadata: () => {
|
|
40
|
+
return pyReviewRaw;
|
|
41
|
+
},
|
|
42
|
+
getInheritedProps: () => {
|
|
43
|
+
return pyReviewRaw.config.inheritedProps;
|
|
44
|
+
},
|
|
45
|
+
createComponent: config => {
|
|
46
|
+
switch (config.config.value) {
|
|
47
|
+
case '@P .pyStatusWork':
|
|
48
|
+
return renderField(pyReviewResolved.highlightedData[0].config);
|
|
49
|
+
case '@P .pyID':
|
|
50
|
+
return renderField(pyReviewResolved.highlightedData[1].config);
|
|
51
|
+
case '@P .pxCreateDateTime':
|
|
52
|
+
return renderField(pyReviewResolved.highlightedData[2].config);
|
|
53
|
+
case '@USER .pxCreateOperator':
|
|
54
|
+
return renderField(pyReviewResolved.highlightedData[3].config);
|
|
55
|
+
case '@P .pySLADeadline':
|
|
56
|
+
return renderField(regionChildrenResolved[0]);
|
|
57
|
+
case '@P .pySLAGoal':
|
|
58
|
+
return renderField(regionChildrenResolved[1]);
|
|
59
|
+
case '@P .pySLAStartTime':
|
|
60
|
+
return renderField(regionChildrenResolved[2]);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
setInheritedProp: () => {},
|
|
64
|
+
resolveConfigProps: () => {}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const renderField = resolvedProps => {
|
|
70
|
+
const {
|
|
71
|
+
displayAsStatus = false,
|
|
72
|
+
displayMode,
|
|
73
|
+
value = '',
|
|
74
|
+
label = '',
|
|
75
|
+
theme = useTheme()
|
|
76
|
+
} = resolvedProps;
|
|
77
|
+
|
|
78
|
+
const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
|
|
79
|
+
|
|
80
|
+
let val =
|
|
81
|
+
value != '' ? (
|
|
82
|
+
<Text variant='h1' as='span'>
|
|
83
|
+
{value}
|
|
84
|
+
</Text>
|
|
85
|
+
) : (
|
|
86
|
+
''
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
if (label === 'Create date/time')
|
|
90
|
+
val = <DateTimeDisplay value={value} variant='datetime' format='long' clockFormat={null} />;
|
|
91
|
+
|
|
92
|
+
if (displayAsStatus === true) val = <StatusWorkRenderer value={value} />;
|
|
93
|
+
|
|
94
|
+
if (label === 'Create Operator')
|
|
95
|
+
val = (
|
|
96
|
+
<Button
|
|
97
|
+
variant='link'
|
|
98
|
+
style={
|
|
99
|
+
label !== null
|
|
100
|
+
? { width: 'max-content', height: theme.components.input.height }
|
|
101
|
+
: undefined
|
|
102
|
+
}
|
|
103
|
+
>
|
|
104
|
+
{value.userName}
|
|
105
|
+
</Button>
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (variant === 'inline') {
|
|
109
|
+
val = value || <span aria-hidden='true'>––</span>;
|
|
110
|
+
} else {
|
|
111
|
+
val = (
|
|
112
|
+
<Text variant='h1' as='span'>
|
|
113
|
+
{val}
|
|
114
|
+
</Text>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
|
|
118
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Grid
|
|
1
|
+
import { Fragment } from 'react';
|
|
2
|
+
import { Grid, Flex, FieldGroup } from '@pega/cosmos-react-core';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
5
5
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
@@ -13,13 +13,19 @@ import { getAllFields } from './utils';
|
|
|
13
13
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
14
14
|
export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
const { getPConnect, children, template, regionsMetadata = [], label, showLabel, showHighlightedData } = props;
|
|
18
|
-
|
|
16
|
+
const { getPConnect, children, label, showLabel, showHighlightedData } = props;
|
|
19
17
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
20
18
|
|
|
19
|
+
const numRegions = getAllFields(getPConnect)?.length;
|
|
20
|
+
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
21
|
+
const gridContainer = { "colGap": 1};
|
|
22
|
+
gridContainer.cols = gridRepeat;
|
|
23
|
+
gridContainer.alignItems = 'start';
|
|
21
24
|
|
|
22
|
-
const
|
|
25
|
+
const gridHighlightContainer = { "gap": 2};
|
|
26
|
+
gridHighlightContainer.cols = gridRepeat;
|
|
27
|
+
gridHighlightContainer.alignItems = 'start';
|
|
28
|
+
gridHighlightContainer.pad = [0, 0, 2, 0];
|
|
23
29
|
|
|
24
30
|
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
25
31
|
let highlightedDataArr = [];
|
|
@@ -44,14 +50,14 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
|
44
50
|
{{=<% %>=}}
|
|
45
51
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
46
52
|
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
47
|
-
<Grid container={
|
|
53
|
+
<Grid container={gridHighlightContainer}
|
|
48
54
|
data-testid={`highlighted-column-count-${numRegions}`}>
|
|
49
55
|
{highlightedDataArr.map((child, i) => (
|
|
50
56
|
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
51
57
|
))}
|
|
52
58
|
</Grid>
|
|
53
59
|
)}
|
|
54
|
-
<Grid container={
|
|
60
|
+
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
|
|
55
61
|
{children.map((child, i) => (
|
|
56
62
|
<Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
|
|
57
63
|
{child}
|
|
@@ -71,31 +77,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
|
71
77
|
showHighlightedData: false
|
|
72
78
|
};
|
|
73
79
|
|
|
74
|
-
// Since the fields are not part of the 'config' in Details template metadata, they need to be subscribed with additionalprops
|
|
75
|
-
const mapStateToProps = (_, ownProps) => {
|
|
76
|
-
const { getPConnect, showLabel, label } = ownProps;
|
|
77
|
-
const Allfields = getAllFields(getPConnect);
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
regionsMetadata: Allfields,
|
|
81
|
-
label,
|
|
82
|
-
showLabel,
|
|
83
|
-
getPConnect
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
80
|
|
|
87
81
|
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
88
|
-
regionsMetadata: PropTypes.arrayOf(
|
|
89
|
-
PropTypes.arrayOf(
|
|
90
|
-
PropTypes.shape({
|
|
91
|
-
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.number]),
|
|
92
|
-
label: PropTypes.string
|
|
93
|
-
})
|
|
94
|
-
)
|
|
95
|
-
).isRequired,
|
|
96
82
|
showLabel: PropTypes.bool,
|
|
97
83
|
label: PropTypes.string,
|
|
98
84
|
getPConnect: PropTypes.func.isRequired,
|
|
99
|
-
template: PropTypes.string.isRequired,
|
|
100
85
|
showHighlightedData: PropTypes.bool
|
|
101
86
|
};
|