@pega/dx-component-builder-sdk 0.23.20 → 0.24.1
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/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/constants.js +4 -0
- package/src/tasks/build-all/helper.js +6 -0
- package/src/tasks/build-comp/helper.js +6 -0
- package/src/tasks/bundle/builderAngular/webpack.config.js +14 -1
- package/src/tasks/bundle/builderAssociated/webpack.config.js +13 -0
- package/src/tasks/bundle/builderReact/webpack.config.js +14 -1
- package/src/tasks/create/templates/Constellation/field/Boolean/index.tsx.mustache +3 -2
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/PConnProps.d.ts.mustache +46 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/config.json.mustache +64 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/demo.stories.tsx.mustache +99 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/index.tsx.mustache +204 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/mock.ts.mustache +5 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/styles.ts.mustache +8 -0
- package/src/tasks/create/templates/Constellation/field/Picklist-Autocomplete/index.tsx.mustache +11 -0
- package/src/tasks/create/templates/Constellation/field/Picklist-Autocomplete/utils.ts.mustache +3 -0
- package/src/tasks/create/templates/Constellation/field/Text/index.tsx.mustache +94 -4
- package/src/tasks/create/templates/Constellation/template/DETAILS/Avatar.tsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/DetailsRender.tsx.mustache +55 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/HighlightRender.tsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/Operator.tsx.mustache +218 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.tsx.mustache +77 -23
- package/src/tasks/create/templates/Constellation/template/DETAILS/index.tsx.mustache +51 -40
- package/src/tasks/create/templates/Constellation/template/DETAILS/mock.ts.mustache +78 -20
- package/src/tasks/create/templates/Constellation/template/DETAILS/styles.ts.mustache +16 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/Avatar.tsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/DetailsRender.tsx.mustache +55 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/HighlightRender.tsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/Operator.tsx.mustache +218 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/demo.stories.tsx.mustache +95 -26
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/index.tsx.mustache +43 -40
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/mock.ts.mustache +68 -10
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/styles.ts.mustache +15 -0
- package/src/tasks/create/templates/Constellation/template/FORM/DetailsRender.tsx +59 -0
- package/src/tasks/create/templates/Constellation/template/FORM/index.tsx.mustache +31 -5
- package/src/tasks/create/templates/Constellation/template/FORM-region/DetailsRender.tsx +59 -0
- package/src/tasks/create/templates/Constellation/template/FORM-region/index.tsx.mustache +29 -7
- package/src/tasks/create/templates/Constellation/template/PAGE/GetNextWork.tsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/template/PAGE/localizations.json.mustache +4 -2
- package/src/tasks/create/templates/Constellation/widget/PAGE/demo.stories.tsx.mustache +87 -6
- package/src/tasks/create/templates/Constellation/widget/PAGE/index.tsx.mustache +67 -5
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/config.json.mustache +64 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/demo.stories.tsx.mustache +42 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/mock.ts.mustache +17 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.html.mustache +29 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.spec.ts.mustache +26 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.ts.mustache +179 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/config.json.mustache +64 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/demo.stories.tsx.mustache +58 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/index.tsx.mustache +79 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/mock.ts.mustache +16 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +1 -1
- package/src/tasks/create-all/index.js +3 -0
- package/src/tasks/publish/helper.js +4 -0
- package/src/tasks/publish-all/helper.js +6 -2
- package/src/tasks/validator/index.js +7 -1
- package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +2 -2
- package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/FieldValueList/FieldValueList.tsx +10 -4
- package/tests/assets/sdk-r/components/create/override-sdk/field/RichText/RichText.tsx +2 -2
- package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.tsx +1 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/ListView/ListView.tsx +2 -2
- package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyDetails/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +3 -0
- package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +2 -2
- package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/FieldValueList/FieldValueList.tsx +10 -4
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/RichText/RichText.tsx +2 -2
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.tsx +1 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/ListView/ListView.tsx +2 -2
package/src/tasks/create/templates/Constellation/template/DETAILS-region/Operator.tsx.mustache
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { useState, useEffect, Fragment } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Link,
|
|
5
|
+
Button,
|
|
6
|
+
Popover,
|
|
7
|
+
useOuterEvent,
|
|
8
|
+
useElement,
|
|
9
|
+
Progress,
|
|
10
|
+
FormField,
|
|
11
|
+
useTheme,
|
|
12
|
+
withConfiguration
|
|
13
|
+
} from '@pega/cosmos-react-core';
|
|
14
|
+
import { Glimpse } from '@pega/cosmos-react-work';
|
|
15
|
+
import { EmailDisplay } from '@pega/cosmos-react-core';
|
|
16
|
+
|
|
17
|
+
import type { PConnFieldProps } from './PConnProps';
|
|
18
|
+
|
|
19
|
+
import Avatar from './Avatar';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// interface for props
|
|
23
|
+
interface {{COMPONENT_CLASS_NAME}}OperatorProps extends PConnFieldProps {
|
|
24
|
+
// If any, enter additional props that only exist on TextInput here
|
|
25
|
+
name: string;
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
metaObj: any;
|
|
29
|
+
externalUser: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let pTarget = null;
|
|
33
|
+
|
|
34
|
+
function Operator(props: {{COMPONENT_CLASS_NAME}}OperatorProps) {
|
|
35
|
+
const { id, name, label, testId, helperText, externalUser, metaObj } = props;
|
|
36
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
37
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
38
|
+
const [popoverEl, setPopoverEl] = useElement(null);
|
|
39
|
+
const [popoverContent, setpopoverContent] = useState(null);
|
|
40
|
+
const theme: any = useTheme();
|
|
41
|
+
|
|
42
|
+
/* If the id has changed, we need to reset the popover */
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
pTarget = null;
|
|
45
|
+
}, [id]);
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
{{! pick new delimiters for mustache }}
|
|
49
|
+
{{=<% %>=}}
|
|
50
|
+
|
|
51
|
+
const OperatorPreview = () => {
|
|
52
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
53
|
+
const localeCategory = 'Operator';
|
|
54
|
+
setpopoverContent(
|
|
55
|
+
<Progress variant='ring' message={localizedVal('Loading operator...', localeCategory)} placement='local' />
|
|
56
|
+
);
|
|
57
|
+
if (externalUser && externalUser.classID !== 'Data-Party-Operator') {
|
|
58
|
+
const fields = [
|
|
59
|
+
{
|
|
60
|
+
id: 'pyFirstName',
|
|
61
|
+
name: localizedVal('Name', localeCategory),
|
|
62
|
+
value: externalUser.name
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'pyEmail1',
|
|
66
|
+
name: localizedVal('Email', localeCategory),
|
|
67
|
+
value:
|
|
68
|
+
externalUser.email !== '' ? <Link href={`mailto:${externalUser.email}`}>{externalUser.email}</Link> : ''
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'pyPhoneNumber',
|
|
72
|
+
name: localizedVal('Phone', localeCategory),
|
|
73
|
+
value: externalUser.phone !== '' ? <Link href={`tel:${externalUser.phone}`}>{externalUser.phone}</Link> : ''
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
setIsLoading(false);
|
|
77
|
+
setpopoverContent(
|
|
78
|
+
<Glimpse
|
|
79
|
+
visual={
|
|
80
|
+
<Avatar
|
|
81
|
+
metaObj={{
|
|
82
|
+
name: externalUser.name
|
|
83
|
+
}}
|
|
84
|
+
/>
|
|
85
|
+
}
|
|
86
|
+
primary={externalUser.name}
|
|
87
|
+
secondary={[externalUser.position]}
|
|
88
|
+
fields={fields}
|
|
89
|
+
target={pTarget}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
} else {
|
|
93
|
+
return PCore.getUserApi()
|
|
94
|
+
.getOperatorDetails(id, true)
|
|
95
|
+
.then(res => {
|
|
96
|
+
if (res.data?.pyOperatorInfo) {
|
|
97
|
+
const fields = [];
|
|
98
|
+
const data = res.data;
|
|
99
|
+
if (data.pyOperatorInfo && data.pyOperatorInfo.pyUserName) {
|
|
100
|
+
fields.push({
|
|
101
|
+
id: 'Name',
|
|
102
|
+
name: localizedVal('Name', localeCategory),
|
|
103
|
+
value: data.pyOperatorInfo.pyUserName
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (data.pyOperatorInfo && data.pyOperatorInfo.pyEmailAddress) {
|
|
107
|
+
fields.push({
|
|
108
|
+
id: 'Email',
|
|
109
|
+
name: localizedVal('Email address', localeCategory),
|
|
110
|
+
value: <EmailDisplay value={data.pyOperatorInfo.pyEmailAddress} />
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const opAvatar = (
|
|
114
|
+
<Avatar
|
|
115
|
+
metaObj={{
|
|
116
|
+
image: '',
|
|
117
|
+
name: data.pyOperatorInfo.pyUserName
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
setIsLoading(false);
|
|
123
|
+
setpopoverContent(
|
|
124
|
+
<Glimpse
|
|
125
|
+
heading={{
|
|
126
|
+
primary: data.pyOperatorInfo.pyUserName,
|
|
127
|
+
secondary: data.pyOperatorInfo.pyEmailAddress,
|
|
128
|
+
visual: opAvatar
|
|
129
|
+
}}
|
|
130
|
+
fields={fields}
|
|
131
|
+
target={pTarget}
|
|
132
|
+
onDismiss={() => {pTarget = null;}}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
141
|
+
|
|
142
|
+
const clickAction = (e: any) => {
|
|
143
|
+
|
|
144
|
+
setIsOpen(!isOpen);
|
|
145
|
+
if (pTarget === null) {
|
|
146
|
+
pTarget = e.currentTarget;
|
|
147
|
+
OperatorPreview();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const hidePopover = () => {
|
|
152
|
+
if (isOpen) {
|
|
153
|
+
setIsOpen(false);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
useOuterEvent('mousedown', [popoverEl], hidePopover); // Call the method on clicking outside these elements
|
|
158
|
+
|
|
159
|
+
const hideOnEscape = (e: any) => {
|
|
160
|
+
if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const comp = (
|
|
164
|
+
<Fragment>
|
|
165
|
+
{metaObj ? (
|
|
166
|
+
<Button
|
|
167
|
+
variant='text'
|
|
168
|
+
aria-haspopup
|
|
169
|
+
aria-expanded={isOpen}
|
|
170
|
+
onClick={clickAction}
|
|
171
|
+
onKeyDown={hideOnEscape}
|
|
172
|
+
data-test-id={testId}
|
|
173
|
+
style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
|
|
174
|
+
>
|
|
175
|
+
<Avatar {...props} />
|
|
176
|
+
</Button>
|
|
177
|
+
) : (
|
|
178
|
+
<Button
|
|
179
|
+
variant='link'
|
|
180
|
+
aria-haspopup
|
|
181
|
+
aria-expanded={isOpen}
|
|
182
|
+
onClick={clickAction}
|
|
183
|
+
onKeyDown={hideOnEscape}
|
|
184
|
+
data-test-id={testId}
|
|
185
|
+
style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
|
|
186
|
+
>
|
|
187
|
+
{name}
|
|
188
|
+
</Button>
|
|
189
|
+
)}
|
|
190
|
+
|
|
191
|
+
{isOpen && (
|
|
192
|
+
<Popover
|
|
193
|
+
ref={setPopoverEl}
|
|
194
|
+
groupId='operator'
|
|
195
|
+
target={pTarget}
|
|
196
|
+
placement='bottom-start'
|
|
197
|
+
style={isLoading ? { position: 'relative', width: '10rem', minHeight: '4rem' } : undefined}
|
|
198
|
+
strategy='fixed'
|
|
199
|
+
>
|
|
200
|
+
{popoverContent}
|
|
201
|
+
</Popover>
|
|
202
|
+
)}
|
|
203
|
+
</Fragment>
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
if (label !== null) {
|
|
207
|
+
return (
|
|
208
|
+
<FormField label={label} info={helperText}>
|
|
209
|
+
{comp}
|
|
210
|
+
</FormField>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return comp;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
export default withConfiguration(Operator);
|
package/src/tasks/create/templates/Constellation/template/DETAILS-region/demo.stories.tsx.mustache
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable no-nested-ternary */
|
|
2
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
-
import { Text, FieldValueList,
|
|
5
|
+
import { Text, FieldValueList, DateTimeDisplay, useTheme } from '@pega/cosmos-react-core';
|
|
6
6
|
import {{COMPONENT_CLASS_NAME}} from './index';
|
|
7
|
-
import { pyReviewRaw, pyReviewResolved, regionChildrenResolved } from './mock';
|
|
7
|
+
import { pyReviewRaw, pyReviewResolved, regionChildrenResolved, operatorDetails, configProps } from './mock';
|
|
8
8
|
import StatusWorkRenderer from './StatusWork';
|
|
9
|
+
import Operator from './Operator';
|
|
9
10
|
|
|
10
11
|
const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
11
12
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -18,6 +19,33 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
18
19
|
|
|
19
20
|
export default meta;
|
|
20
21
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
22
|
+
|
|
23
|
+
if (!window.PCore) {
|
|
24
|
+
window.PCore = {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
window.PCore.getLocaleUtils = () => {
|
|
28
|
+
return {
|
|
29
|
+
getLocaleValue: value => {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
window.PCore.getUserApi = () => {
|
|
36
|
+
return {
|
|
37
|
+
getOperatorDetails: () => {
|
|
38
|
+
return new Promise(resolve => {
|
|
39
|
+
resolve(operatorDetails);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const Region = () => {
|
|
46
|
+
return <></>;
|
|
47
|
+
};
|
|
48
|
+
|
|
21
49
|
const renderField = resolvedProps => {
|
|
22
50
|
const {
|
|
23
51
|
displayAsStatus = false,
|
|
@@ -25,7 +53,7 @@ const renderField = resolvedProps => {
|
|
|
25
53
|
value = '',
|
|
26
54
|
label = '',
|
|
27
55
|
key,
|
|
28
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
56
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks, @typescript-eslint/no-unused-vars
|
|
29
57
|
theme = useTheme()
|
|
30
58
|
} = resolvedProps;
|
|
31
59
|
|
|
@@ -53,19 +81,30 @@ const renderField = resolvedProps => {
|
|
|
53
81
|
|
|
54
82
|
if (displayAsStatus === true) val = <StatusWorkRenderer value={value} key={key} />;
|
|
55
83
|
|
|
84
|
+
const [_label] =
|
|
85
|
+
label === 'Create operator'
|
|
86
|
+
? [configProps.createLabel, configProps.createOperator, configProps.createDateTime]
|
|
87
|
+
: label === 'Update operator'
|
|
88
|
+
? [configProps.updateLabel, configProps.updateOperator, configProps.updateDateTime]
|
|
89
|
+
: [configProps.resolveLabel, configProps.resolveOperator, configProps.resolveDateTime];
|
|
90
|
+
|
|
56
91
|
if (label === 'Create Operator')
|
|
57
92
|
val = (
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
|
|
93
|
+
<Operator
|
|
94
|
+
label={configProps.hideLabel ? '' : _label}
|
|
95
|
+
name={configProps.createOperator.userName}
|
|
96
|
+
id={configProps.createOperator.userId}
|
|
97
|
+
value={undefined}
|
|
98
|
+
validatemessage=''
|
|
99
|
+
hideLabel={false}
|
|
100
|
+
readOnly={false}
|
|
101
|
+
required={false}
|
|
102
|
+
disabled={false}
|
|
103
|
+
externalUser={undefined}
|
|
104
|
+
metaObj={undefined}
|
|
105
|
+
testId=''
|
|
106
|
+
helperText=''
|
|
107
|
+
/>
|
|
69
108
|
);
|
|
70
109
|
|
|
71
110
|
if (variant === 'inline') {
|
|
@@ -122,24 +161,54 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
122
161
|
setInheritedProp: () => {
|
|
123
162
|
/* nothing */
|
|
124
163
|
},
|
|
125
|
-
resolveConfigProps:
|
|
126
|
-
|
|
164
|
+
resolveConfigProps: config => {
|
|
165
|
+
return config;
|
|
127
166
|
}
|
|
128
167
|
};
|
|
129
168
|
}
|
|
130
169
|
};
|
|
131
170
|
|
|
132
|
-
const regionAChildren = pyReviewRaw.children[0].children.map(child => {
|
|
133
|
-
return props.getPConnect().createComponent(child);
|
|
134
|
-
});
|
|
135
|
-
const regionBChildren = pyReviewRaw.children[1].children.map(child => {
|
|
136
|
-
return props.getPConnect().createComponent(child);
|
|
137
|
-
});
|
|
138
171
|
|
|
139
172
|
return (
|
|
140
173
|
<{{COMPONENT_CLASS_NAME}} {...props} {...args}>
|
|
141
|
-
|
|
142
|
-
|
|
174
|
+
<Region
|
|
175
|
+
{...{
|
|
176
|
+
getPConnect: () => ({
|
|
177
|
+
setInheritedProp: () => {},
|
|
178
|
+
getChildren: () =>
|
|
179
|
+
pyReviewRaw.children[0].children.map((child, index) => {
|
|
180
|
+
return {
|
|
181
|
+
getPConnect: () => ({
|
|
182
|
+
getRawMetadata: () => pyReviewRaw.children[0].children[index],
|
|
183
|
+
getConfigProps: () => {},
|
|
184
|
+
resolveConfigProps: () => regionChildrenResolved[index],
|
|
185
|
+
getComponent: () =>
|
|
186
|
+
props.getPConnect().createComponent(pyReviewRaw.children[0].children[index])
|
|
187
|
+
})
|
|
188
|
+
};
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
<Region
|
|
194
|
+
{...{
|
|
195
|
+
getPConnect: () => ({
|
|
196
|
+
setInheritedProp: () => {},
|
|
197
|
+
getChildren: () =>
|
|
198
|
+
pyReviewRaw.children[1].children.map((child, index) => {
|
|
199
|
+
return {
|
|
200
|
+
getPConnect: () => ({
|
|
201
|
+
getRawMetadata: () => pyReviewRaw.children[1].children[index],
|
|
202
|
+
getConfigProps: () => {},
|
|
203
|
+
resolveConfigProps: () => regionChildrenResolved[index],
|
|
204
|
+
getComponent: () =>
|
|
205
|
+
props.getPConnect().createComponent(pyReviewRaw.children[1].children[index])
|
|
206
|
+
})
|
|
207
|
+
};
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
}}
|
|
211
|
+
/>
|
|
143
212
|
</{{COMPONENT_CLASS_NAME}}>
|
|
144
213
|
);
|
|
145
214
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Fragment } from 'react';
|
|
2
|
-
import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
|
|
1
|
+
import { Fragment, Children, ReactElement } from 'react';
|
|
2
|
+
import { Grid, Flex, FieldGroup, withConfiguration, GridContainerProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { PConnFieldProps } from './PConnProps';
|
|
4
|
+
import DetailsRender from './DetailsRender';
|
|
5
|
+
import HighlightRender from './HighlightRender';
|
|
4
6
|
|
|
5
|
-
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
7
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper, { StyledDetailsGridContainer, StyledHighlightedFieldsHrLine } from './styles';
|
|
6
8
|
|
|
7
9
|
// includes in bundle
|
|
8
10
|
import { getAllFields } from './utils';
|
|
@@ -12,34 +14,31 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
|
12
14
|
// If any, enter additional props that only exist on TextInput here
|
|
13
15
|
showLabel: boolean;
|
|
14
16
|
showHighlightedData: boolean;
|
|
15
|
-
children:
|
|
17
|
+
children: ReactElement[];
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
// Duplicated runtime code from Constellation Design System Component
|
|
19
|
-
|
|
20
20
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
21
21
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
22
22
|
function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
23
23
|
|
|
24
|
-
const { getPConnect,
|
|
24
|
+
const { getPConnect, label, children, showLabel = true, showHighlightedData = false } = props;
|
|
25
25
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
26
26
|
|
|
27
|
+
// update children with readonly
|
|
28
|
+
Children.toArray(children).forEach(child => {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
child.props.getPConnect().setInheritedProp('readOnly', true);
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
child.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
33
|
+
});
|
|
34
|
+
|
|
27
35
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
28
|
-
const gridRepeat = "repeat(".concat(numRegions
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
37
|
+
|
|
38
|
+
const gridContainer: GridContainerProps = { colGap: 6 };
|
|
31
39
|
gridContainer.cols = gridRepeat;
|
|
32
|
-
// @ts-ignore
|
|
33
40
|
gridContainer.alignItems = 'start';
|
|
34
41
|
|
|
35
|
-
const gridHighlightContainer = { "gap": 2};
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
gridHighlightContainer.cols = gridRepeat;
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
gridHighlightContainer.alignItems = 'start';
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
gridHighlightContainer.pad = [0, 0, 2, 0];
|
|
42
|
-
|
|
43
42
|
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
44
43
|
let highlightedDataArr = [];
|
|
45
44
|
if (showHighlightedData) {
|
|
@@ -47,40 +46,44 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
47
46
|
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
48
47
|
// @ts-ignore
|
|
49
48
|
highlightedDataArr = highlightedData.map((field) => {
|
|
50
|
-
field
|
|
51
|
-
|
|
52
|
-
// Mark as status display when using pyStatusWork
|
|
53
|
-
if (field.config.value === '@P .pyStatusWork') {
|
|
54
|
-
field.type = 'TextInput';
|
|
55
|
-
field.config.displayAsStatus = true;
|
|
56
|
-
}
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
return getPConnect().createComponent(field);
|
|
49
|
+
return <HighlightRender field={field} getPConnect={props.getPConnect} />;
|
|
59
50
|
});
|
|
60
51
|
}
|
|
61
52
|
|
|
62
53
|
return (
|
|
63
54
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
{{! pick new delimiters for mustache }}
|
|
56
|
+
{{=<% %>=}}
|
|
66
57
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
67
58
|
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
<>
|
|
60
|
+
<Flex
|
|
61
|
+
container={{ direction: 'row', alignItems: 'start', colGap: 10 }}
|
|
62
|
+
data-testid={`highlighted-column-count-${numRegions}`}
|
|
63
|
+
>
|
|
64
|
+
{highlightedDataArr.map((child: any, i: number) => (
|
|
65
|
+
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
66
|
+
))}
|
|
67
|
+
</Flex>
|
|
68
|
+
<StyledHighlightedFieldsHrLine />
|
|
69
|
+
</>
|
|
74
70
|
)}
|
|
75
|
-
<Grid
|
|
71
|
+
<Grid
|
|
72
|
+
as={StyledDetailsGridContainer}
|
|
73
|
+
container={gridContainer}
|
|
74
|
+
data-testid={`column-count-${numRegions}`} >
|
|
76
75
|
{children.map((child: any, i: number) => (
|
|
77
|
-
<Flex
|
|
78
|
-
|
|
76
|
+
<Flex
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
container={{ direction: 'column', alignItems: 'normal', colGap: 1, rowGap: 1.5 }}
|
|
79
|
+
key={`r-${i + 1}`}
|
|
80
|
+
>
|
|
81
|
+
<DetailsRender child={child} />
|
|
79
82
|
</Flex>
|
|
80
83
|
))}
|
|
81
84
|
</Grid>
|
|
82
85
|
</FieldGroup>
|
|
83
|
-
|
|
86
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
84
87
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
85
88
|
);
|
|
86
89
|
|
|
@@ -16,6 +16,7 @@ export const pyReviewRaw = {
|
|
|
16
16
|
config: {
|
|
17
17
|
value: '@P .pyStatusWork',
|
|
18
18
|
label: '@L Work Status',
|
|
19
|
+
hideLabel: true,
|
|
19
20
|
displayMode: 'STACKED_LARGE_VAL',
|
|
20
21
|
displayAsStatus: true,
|
|
21
22
|
key: 'pyStatusWork'
|
|
@@ -26,6 +27,7 @@ export const pyReviewRaw = {
|
|
|
26
27
|
config: {
|
|
27
28
|
value: '@P .pyID',
|
|
28
29
|
label: '@L Case ID',
|
|
30
|
+
hideLabel: true,
|
|
29
31
|
displayMode: 'STACKED_LARGE_VAL',
|
|
30
32
|
key: 'pyID'
|
|
31
33
|
}
|
|
@@ -35,6 +37,7 @@ export const pyReviewRaw = {
|
|
|
35
37
|
config: {
|
|
36
38
|
value: '@P .pxCreateDateTime',
|
|
37
39
|
label: '@L Create date/time',
|
|
40
|
+
hideLabel: true,
|
|
38
41
|
displayMode: 'STACKED_LARGE_VAL',
|
|
39
42
|
key: 'pxCreateDateTime'
|
|
40
43
|
}
|
|
@@ -43,6 +46,7 @@ export const pyReviewRaw = {
|
|
|
43
46
|
type: 'UserReference',
|
|
44
47
|
config: {
|
|
45
48
|
label: '@L Create Operator',
|
|
49
|
+
hideLabel: true,
|
|
46
50
|
value: '@USER .pxCreateOperator',
|
|
47
51
|
placeholder: 'Select...',
|
|
48
52
|
displayMode: 'STACKED_LARGE_VAL',
|
|
@@ -160,7 +164,6 @@ export const pyReviewResolved = {
|
|
|
160
164
|
config: {
|
|
161
165
|
value: 'New',
|
|
162
166
|
label: 'Work Status',
|
|
163
|
-
displayMode: 'STACKED_LARGE_VAL',
|
|
164
167
|
displayAsStatus: true
|
|
165
168
|
}
|
|
166
169
|
},
|
|
@@ -168,16 +171,14 @@ export const pyReviewResolved = {
|
|
|
168
171
|
type: 'TextInput',
|
|
169
172
|
config: {
|
|
170
173
|
value: 'M-1002',
|
|
171
|
-
label: 'Case ID'
|
|
172
|
-
displayMode: 'STACKED_LARGE_VAL'
|
|
174
|
+
label: 'Case ID'
|
|
173
175
|
}
|
|
174
176
|
},
|
|
175
177
|
{
|
|
176
178
|
type: 'DateTime',
|
|
177
179
|
config: {
|
|
178
180
|
value: '2022-12-11T20:06:27.232Z',
|
|
179
|
-
label: 'Create date/time'
|
|
180
|
-
displayMode: 'STACKED_LARGE_VAL'
|
|
181
|
+
label: 'Create date/time'
|
|
181
182
|
}
|
|
182
183
|
},
|
|
183
184
|
{
|
|
@@ -188,8 +189,7 @@ export const pyReviewResolved = {
|
|
|
188
189
|
userId: 'conns',
|
|
189
190
|
userName: 'Sara Connor'
|
|
190
191
|
},
|
|
191
|
-
placeholder: 'Select...'
|
|
192
|
-
displayMode: 'STACKED_LARGE_VAL'
|
|
192
|
+
placeholder: 'Select...'
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
],
|
|
@@ -199,22 +199,25 @@ export const pyReviewResolved = {
|
|
|
199
199
|
export const regionChildrenResolved = [
|
|
200
200
|
{
|
|
201
201
|
readOnly: true,
|
|
202
|
-
value: '',
|
|
202
|
+
value: 'Deadline',
|
|
203
203
|
label: 'SLA Deadline',
|
|
204
|
+
hideLabel: true,
|
|
204
205
|
displayMode: 'LABELS_LEFT',
|
|
205
206
|
key: 'SLA Deadline'
|
|
206
207
|
},
|
|
207
208
|
{
|
|
208
209
|
readOnly: true,
|
|
209
|
-
value: '',
|
|
210
|
+
value: 'Goal',
|
|
210
211
|
label: 'SLA Goal',
|
|
212
|
+
hideLabel: true,
|
|
211
213
|
displayMode: 'LABELS_LEFT',
|
|
212
214
|
key: 'SLA Goal'
|
|
213
215
|
},
|
|
214
216
|
{
|
|
215
217
|
readOnly: true,
|
|
216
|
-
value: '',
|
|
218
|
+
value: 'Start Time',
|
|
217
219
|
label: 'SLA Start Time',
|
|
220
|
+
hideLabel: true,
|
|
218
221
|
listType: 'associated',
|
|
219
222
|
datasource: [
|
|
220
223
|
{
|
|
@@ -230,3 +233,58 @@ export const regionChildrenResolved = [
|
|
|
230
233
|
key: 'SLA Start Time'
|
|
231
234
|
}
|
|
232
235
|
];
|
|
236
|
+
|
|
237
|
+
export const operatorDetails = {
|
|
238
|
+
data: {
|
|
239
|
+
pzLoadTime: 'January 18, 2023 10:33:19 AM EST',
|
|
240
|
+
pzPageNameHash: '_pa1519192551088960pz',
|
|
241
|
+
pyOperatorInfo: {
|
|
242
|
+
pyUserName: 'french DigV2',
|
|
243
|
+
pyPosition: '',
|
|
244
|
+
pyImageInsKey: '',
|
|
245
|
+
pySkills: [
|
|
246
|
+
{
|
|
247
|
+
pySkillName: '',
|
|
248
|
+
pzIndexOwnerKey: 'DATA-ADMIN-OPERATOR-ID FRENCHTEST.DIGV2',
|
|
249
|
+
pySkillRating: 0
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
pyReportToUserName: '',
|
|
253
|
+
pyReportTo: '',
|
|
254
|
+
pyOrganization: 'DXIL',
|
|
255
|
+
pyTitle: '',
|
|
256
|
+
pyLabel: 'frenchTest.DigV2',
|
|
257
|
+
pyEmailAddress: 'User@DigV2',
|
|
258
|
+
pyTelephone: ''
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
status: 200,
|
|
262
|
+
statusText: '',
|
|
263
|
+
headers: {
|
|
264
|
+
'content-length': '435',
|
|
265
|
+
'content-type': 'application/json;charset=UTF-8'
|
|
266
|
+
},
|
|
267
|
+
request: {}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export const configProps = {
|
|
271
|
+
label: 'Create operator',
|
|
272
|
+
createLabel: 'Created',
|
|
273
|
+
updateLabel: 'Updated',
|
|
274
|
+
updateDateTime: '2023-01-16T14:53:33.280Z',
|
|
275
|
+
createDateTime: '2023-01-16T14:53:33.198Z',
|
|
276
|
+
updateOperator: {
|
|
277
|
+
userId: 'admin@mediaco',
|
|
278
|
+
userName: 'admin'
|
|
279
|
+
},
|
|
280
|
+
createOperator: {
|
|
281
|
+
userId: 'admin@mediaco',
|
|
282
|
+
userName: 'admin'
|
|
283
|
+
},
|
|
284
|
+
resolveLabel: '',
|
|
285
|
+
resolveOperator: '',
|
|
286
|
+
resolveDateTime: '',
|
|
287
|
+
hideLabel: true,
|
|
288
|
+
key: '_532zx1dah',
|
|
289
|
+
displayMode: 'LABELS_LEFT'
|
|
290
|
+
};
|
|
@@ -6,3 +6,18 @@ export default styled.div(() => {
|
|
|
6
6
|
margin: 0px 0;
|
|
7
7
|
`;
|
|
8
8
|
});
|
|
9
|
+
|
|
10
|
+
export const StyledDetailsGridContainer = styled.div(() => {
|
|
11
|
+
return css`
|
|
12
|
+
margin-line-start: 1;
|
|
13
|
+
`;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const StyledHighlightedFieldsHrLine = styled.hr(() => {
|
|
17
|
+
return css`
|
|
18
|
+
line: {
|
|
19
|
+
margin: '0.75rem 0';
|
|
20
|
+
opacity: '50%'
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
});
|