@pega/dx-component-builder-sdk 0.23.21 → 0.24.2

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.
Files changed (130) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +1 -1
  3. package/src/constants.js +4 -0
  4. package/src/tasks/build-all/helper.js +6 -0
  5. package/src/tasks/build-comp/helper.js +6 -0
  6. package/src/tasks/bundle/builderAngular/webpack.config.js +14 -1
  7. package/src/tasks/bundle/builderAssociated/webpack.config.js +13 -0
  8. package/src/tasks/bundle/builderReact/webpack.config.js +14 -1
  9. package/src/tasks/create/templates/Constellation/field/Boolean/index.tsx.mustache +3 -2
  10. package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/PConnProps.d.ts.mustache +46 -0
  11. package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/config.json.mustache +64 -0
  12. package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/demo.stories.tsx.mustache +99 -0
  13. package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/index.tsx.mustache +204 -0
  14. package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/mock.ts.mustache +5 -0
  15. package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/styles.ts.mustache +8 -0
  16. package/src/tasks/create/templates/Constellation/field/Picklist/index.tsx.mustache +0 -1
  17. package/src/tasks/create/templates/Constellation/field/Picklist-Autocomplete/date.ts.mustache +15 -37
  18. package/src/tasks/create/templates/Constellation/field/Picklist-Autocomplete/index.tsx.mustache +11 -0
  19. package/src/tasks/create/templates/Constellation/field/Picklist-Autocomplete/utils.ts.mustache +3 -0
  20. package/src/tasks/create/templates/Constellation/field/Text/index.tsx.mustache +94 -4
  21. package/src/tasks/create/templates/Constellation/template/DETAILS/Avatar.tsx.mustache +78 -0
  22. package/src/tasks/create/templates/Constellation/template/DETAILS/DetailsRender.tsx.mustache +55 -0
  23. package/src/tasks/create/templates/Constellation/template/DETAILS/HighlightRender.tsx.mustache +49 -0
  24. package/src/tasks/create/templates/Constellation/template/DETAILS/Operator.tsx.mustache +218 -0
  25. package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.tsx.mustache +77 -23
  26. package/src/tasks/create/templates/Constellation/template/DETAILS/index.tsx.mustache +51 -40
  27. package/src/tasks/create/templates/Constellation/template/DETAILS/mock.ts.mustache +78 -20
  28. package/src/tasks/create/templates/Constellation/template/DETAILS/styles.ts.mustache +16 -0
  29. package/src/tasks/create/templates/Constellation/template/DETAILS-region/Avatar.tsx.mustache +78 -0
  30. package/src/tasks/create/templates/Constellation/template/DETAILS-region/DetailsRender.tsx.mustache +55 -0
  31. package/src/tasks/create/templates/Constellation/template/DETAILS-region/HighlightRender.tsx.mustache +49 -0
  32. package/src/tasks/create/templates/Constellation/template/DETAILS-region/Operator.tsx.mustache +218 -0
  33. package/src/tasks/create/templates/Constellation/template/DETAILS-region/demo.stories.tsx.mustache +95 -26
  34. package/src/tasks/create/templates/Constellation/template/DETAILS-region/index.tsx.mustache +42 -39
  35. package/src/tasks/create/templates/Constellation/template/DETAILS-region/mock.ts.mustache +68 -10
  36. package/src/tasks/create/templates/Constellation/template/DETAILS-region/styles.ts.mustache +15 -0
  37. package/src/tasks/create/templates/Constellation/template/FORM/DetailsRender.tsx +59 -0
  38. package/src/tasks/create/templates/Constellation/template/FORM/index.tsx.mustache +31 -5
  39. package/src/tasks/create/templates/Constellation/template/FORM-region/DetailsRender.tsx +59 -0
  40. package/src/tasks/create/templates/Constellation/template/FORM-region/index.tsx.mustache +29 -7
  41. package/src/tasks/create/templates/Constellation/template/PAGE/GetNextWork.tsx.mustache +2 -1
  42. package/src/tasks/create/templates/Constellation/template/PAGE/localizations.json.mustache +4 -2
  43. package/src/tasks/create/templates/Constellation/widget/PAGE/demo.stories.tsx.mustache +87 -6
  44. package/src/tasks/create/templates/Constellation/widget/PAGE/index.tsx.mustache +67 -5
  45. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.html.mustache +19 -18
  46. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.ts.mustache +127 -44
  47. package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/config.json.mustache +64 -0
  48. package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/demo.stories.tsx.mustache +63 -0
  49. package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/icon-button-url.component.html.mustache +40 -0
  50. package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/icon-button-url.component.scss.mustache +24 -0
  51. package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/icon-button-url.component.spec.ts.mustache +26 -0
  52. package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/icon-button-url.component.ts.mustache +195 -0
  53. package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/mock.ts.mustache +37 -0
  54. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.html.mustache +1 -0
  55. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.ts.mustache +2 -0
  56. package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.html.mustache +1 -0
  57. package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.ts.mustache +2 -0
  58. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.scss.mustache +1 -1
  59. package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.ts.mustache +2 -2
  60. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.html.mustache +1 -1
  61. package/src/tasks/create/templates/SDK-React/field/Boolean/demo.stories.tsx.mustache +1 -1
  62. package/src/tasks/create/templates/SDK-React/field/Boolean/mock.ts.mustache +8 -8
  63. package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +2 -2
  64. package/src/tasks/create/templates/SDK-React/field/Date/mock.ts.mustache +7 -7
  65. package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +1 -1
  66. package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +2 -3
  67. package/src/tasks/create/templates/SDK-React/field/DateTime/mock.ts.mustache +6 -6
  68. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +51 -35
  69. package/src/tasks/create/templates/SDK-React/field/Decimal/mock.ts.mustache +1 -1
  70. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/config.json.mustache +1 -1
  71. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/demo.stories.tsx.mustache +1 -1
  72. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +47 -37
  73. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/mock.ts.mustache +1 -1
  74. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/config.json.mustache +1 -1
  75. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +36 -21
  76. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/mock.ts.mustache +1 -1
  77. package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/config.json.mustache +64 -0
  78. package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/demo.stories.tsx.mustache +91 -0
  79. package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/index.tsx.mustache +160 -0
  80. package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/mock.ts.mustache +4 -0
  81. package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/styles.js.mustache +7 -0
  82. package/src/tasks/create/templates/SDK-React/field/Integer/config.json.mustache +1 -1
  83. package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +19 -20
  84. package/src/tasks/create/templates/SDK-React/field/Integer/mock.ts.mustache +1 -1
  85. package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +26 -26
  86. package/src/tasks/create/templates/SDK-React/field/Picklist-RadioButtons/mock.ts.mustache +0 -1
  87. package/src/tasks/create/templates/SDK-React/field/Text/config.json.mustache +1 -1
  88. package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +0 -1
  89. package/src/tasks/create/templates/SDK-React/field/Text/mock.ts.mustache +1 -1
  90. package/src/tasks/create/templates/SDK-React/field/Text-Email/config.json.mustache +1 -1
  91. package/src/tasks/create/templates/SDK-React/field/Text-Email/mock.ts.mustache +1 -1
  92. package/src/tasks/create/templates/SDK-React/field/Text-Input/config.json.mustache +1 -1
  93. package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +0 -1
  94. package/src/tasks/create/templates/SDK-React/field/Text-Input/mock.ts.mustache +1 -1
  95. package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +1 -3
  96. package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/mock.ts.mustache +1 -1
  97. package/src/tasks/create/templates/SDK-React/field/Text-Phone/index.tsx.mustache +1 -2
  98. package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +1 -2
  99. package/src/tasks/create/templates/SDK-React/field/Text-URL/mock.ts.mustache +1 -1
  100. package/src/tasks/create/templates/SDK-React/field/TimeOfDay/demo.stories.tsx.mustache +4 -4
  101. package/src/tasks/create/templates/SDK-React/field/TimeOfDay/index.tsx.mustache +0 -2
  102. package/src/tasks/create/templates/SDK-React/field/TimeOfDay/mock.ts.mustache +6 -6
  103. package/src/tasks/create/templates/SDK-React/template/DETAILS/demo.stories.tsx.mustache +1 -7
  104. package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +4 -9
  105. package/src/tasks/create/templates/SDK-React/template/DETAILS/mock.ts.mustache +181 -165
  106. package/src/tasks/create/templates/SDK-React/template/DETAILS-region/demo.stories.tsx.mustache +1 -6
  107. package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +4 -9
  108. package/src/tasks/create/templates/SDK-React/template/DETAILS-region/mock.ts.mustache +207 -163
  109. package/src/tasks/create/templates/SDK-React/template/FORM/config.json.mustache +1 -1
  110. package/src/tasks/create/templates/SDK-React/template/FORM/demo.stories.tsx.mustache +0 -1
  111. package/src/tasks/create/templates/SDK-React/template/FORM/index.tsx.mustache +14 -16
  112. package/src/tasks/create/templates/SDK-React/template/FORM/utils.ts.mustache +1 -1
  113. package/src/tasks/create/templates/SDK-React/template/FORM-region/demo.stories.tsx.mustache +0 -2
  114. package/src/tasks/create/templates/SDK-React/template/FORM-region/mock.ts.mustache +121 -122
  115. package/src/tasks/create/templates/SDK-React/template/PAGE/OneColumn.tsx.mustache +12 -13
  116. package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.tsx.mustache +1 -1
  117. package/src/tasks/create/templates/SDK-React/template/PAGE/index.tsx.mustache +3 -5
  118. package/src/tasks/create/templates/SDK-React/template/PAGE/mock.ts.mustache +8 -9
  119. package/src/tasks/create/templates/SDK-React/widget/CASE/config.json.mustache +2 -2
  120. package/src/tasks/create/templates/SDK-React/widget/CASE/demo.stories.tsx.mustache +0 -1
  121. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +3 -3
  122. package/src/tasks/create/templates/SDK-React/widget/PAGE/config.json.mustache +43 -43
  123. package/src/tasks/create/templates/SDK-React/widget/PAGE/mock.ts.mustache +1 -1
  124. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.tsx.mustache +1 -2
  125. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +0 -1
  126. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/mock.ts.mustache +0 -1
  127. package/src/tasks/create-all/index.js +3 -0
  128. package/src/tasks/publish/helper.js +4 -0
  129. package/src/tasks/publish-all/helper.js +6 -2
  130. package/src/tasks/validator/index.js +7 -1
@@ -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: any;
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, children, label, showLabel = true, showHighlightedData = false } = props;
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
36
  const gridRepeat = "repeat(".concat(numRegions.toString()).concat(", 1fr)");
29
- const gridContainer = { "colGap": 1};
30
- // @ts-ignore
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.config.displayMode = 'STACKED_LARGE_VAL';
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
- {{! pick new delimiters for mustache }}
65
- {{=<% %>=}}
55
+ {{! pick new delimiters for mustache }}
56
+ {{=<% %>=}}
66
57
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
67
58
  {showHighlightedData && highlightedDataArr.length > 0 && (
68
- <Grid container={gridHighlightContainer}
69
- data-testid={`highlighted-column-count-${numRegions}`}>
70
- {highlightedDataArr.map((child: any, i: number) => (
71
- <Fragment key={`hf-${i + 1}`}>{child}</Fragment>
72
- ))}
73
- </Grid>
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 container={gridContainer} data-testid={`column-count-${numRegions}`} >
71
+ <Grid
72
+ as={StyledDetailsGridContainer}
73
+ container={gridContainer}
74
+ data-testid={`column-count-${numRegions}`} >
76
75
  {children.map((child: any, i: number) => (
77
- <Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
78
- {child}
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
- <%={{ }}=%> {{! revert delimiters for mustache }}
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
+ });
@@ -0,0 +1,59 @@
1
+ import { Fragment, ReactElement } from 'react';
2
+ import { FieldValueList } from '@pega/cosmos-react-core';
3
+
4
+ interface DetailsRenderProps {
5
+ children?: never;
6
+ child: NonNullable<ReactElement>;
7
+ }
8
+
9
+ const DetailsRender = (props: DetailsRenderProps) => {
10
+ const { child } = props;
11
+
12
+ const kids = child.props.getPConnect().getChildren();
13
+
14
+ const displayCompArr: ReactElement[] = [];
15
+
16
+ Object.values(kids).forEach((value: any) => {
17
+ const { type } = value.getPConnect().getRawMetadata();
18
+ const { hideLabel, variant, testId, label } = value
19
+ .getPConnect()
20
+ .resolveConfigProps(value.getPConnect().getConfigProps());
21
+
22
+ let displayComp;
23
+ const key = JSON.stringify(value.getPConnect());
24
+
25
+ if (type === 'reference') {
26
+ const refElement = value.getPConnect().getComponent();
27
+
28
+ displayCompArr.push(refElement);
29
+ } else {
30
+ const element = value.getPConnect().getComponent();
31
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
32
+
33
+ const fvlStyle = {
34
+ myColGap: {
35
+ columnGap: '0',
36
+ marginLineStart: 0
37
+ }
38
+ };
39
+
40
+ // const myEl = <div>boo</div>;
41
+ displayComp = (
42
+ <Fragment key={key}>
43
+ <FieldValueList
44
+ style={fvlStyle.myColGap}
45
+ variant={hideLabel ? 'stacked' : variant}
46
+ data-testid={testId}
47
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
48
+ />
49
+ </Fragment>
50
+ );
51
+
52
+ displayCompArr.push(displayComp);
53
+ }
54
+ });
55
+
56
+ return <>{displayCompArr}</>;
57
+ };
58
+
59
+ export default DetailsRender;
@@ -1,7 +1,8 @@
1
- import { Grid, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
1
+ import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
2
2
 
3
3
 
4
4
  import type { PConnFieldProps } from './PConnProps';
5
+ import DetailsRender from './DetailsRender';
5
6
 
6
7
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
7
8
 
@@ -13,19 +14,44 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
13
14
  children: any;
14
15
  }
15
16
 
16
- // Duplicated runtime code from Constellation Design System Component
17
-
18
17
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
19
18
  // any default values in config.pros should be set in defaultProps at bottom of this file
20
19
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
21
20
 
22
- const { children = [], NumCols = '1', label, showLabel, getPConnect } = props;
21
+ const { children = [], NumCols = '1', label, showLabel, getPConnect, readOnly, displayMode } = props;
23
22
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
24
23
 
25
24
  const nCols = parseInt(NumCols, 10);
26
25
 
27
- // console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
28
26
 
27
+ if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
28
+ const numRegions = '1';
29
+ const gridRepeat = 'repeat('.concat(numRegions).concat(', 1fr)');
30
+ const gridContainer = { colGap: 0, 'margin-line-start': 0 };
31
+ // @ts-ignore
32
+ gridContainer.cols = gridRepeat;
33
+
34
+ return (
35
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
36
+ {{! pick new delimiters for mustache }}
37
+ {{=<% %>=}}
38
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
39
+ <Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
40
+ {children.map((child: any, i: number) => (
41
+ <Flex
42
+ // @ts-ignore
43
+ container={{ direction: 'column', alignItems: 'normal', colGap: 1, rowGap: 1.5 }}
44
+ key={`r-${i + 1}`}
45
+ >
46
+ <DetailsRender child={child} />
47
+ </Flex>
48
+ ))}
49
+ </Grid>
50
+ </FieldGroup>
51
+ <%={{ }}=%> {{! revert delimiters for mustache }}
52
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
53
+ );
54
+ }
29
55
  return (
30
56
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
31
57
  {{! pick new delimiters for mustache }}
@@ -0,0 +1,59 @@
1
+ import { Fragment, ReactElement } from 'react';
2
+ import { FieldValueList } from '@pega/cosmos-react-core';
3
+
4
+ interface DetailsRenderProps {
5
+ children?: never;
6
+ child: NonNullable<ReactElement>;
7
+ }
8
+
9
+ const DetailsRender = (props: DetailsRenderProps) => {
10
+ const { child } = props;
11
+
12
+ const kids = child.props.getPConnect().getChildren();
13
+
14
+ const displayCompArr: ReactElement[] = [];
15
+
16
+ Object.values(kids).forEach((value: any) => {
17
+ const { type } = value.getPConnect().getRawMetadata();
18
+ const { hideLabel, variant, testId, label } = value
19
+ .getPConnect()
20
+ .resolveConfigProps(value.getPConnect().getConfigProps());
21
+
22
+ let displayComp;
23
+ const key = JSON.stringify(value.getPConnect());
24
+
25
+ if (type === 'reference') {
26
+ const refElement = value.getPConnect().getComponent();
27
+
28
+ displayCompArr.push(refElement);
29
+ } else {
30
+ const element = value.getPConnect().getComponent();
31
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
32
+
33
+ const fvlStyle = {
34
+ myColGap: {
35
+ columnGap: '0',
36
+ marginLineStart: 0
37
+ }
38
+ };
39
+
40
+ // const myEl = <div>boo</div>;
41
+ displayComp = (
42
+ <Fragment key={key}>
43
+ <FieldValueList
44
+ style={fvlStyle.myColGap}
45
+ variant={hideLabel ? 'stacked' : variant}
46
+ data-testid={testId}
47
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
48
+ />
49
+ </Fragment>
50
+ );
51
+
52
+ displayCompArr.push(displayComp);
53
+ }
54
+ });
55
+
56
+ return <>{displayCompArr}</>;
57
+ };
58
+
59
+ export default DetailsRender;
@@ -1,6 +1,7 @@
1
1
  import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
2
2
 
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import DetailsRender from './DetailsRender';
4
5
 
5
6
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
6
7
 
@@ -11,19 +12,17 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
11
12
  children: any;
12
13
  }
13
14
 
14
- // Duplicated runtime code from Constellation Design System Component
15
-
16
15
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
17
16
  // any default values in config.pros should be set in defaultProps at bottom of this file
18
17
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
19
18
 
20
19
 
21
- const { children = [], label, showLabel, getPConnect } = props;
20
+ const { children = [], label, showLabel, getPConnect, readOnly, displayMode } = props;
22
21
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
23
22
 
24
23
  const numRegions = children?.length;
25
24
  const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
26
- const gridContainer = {"colGap" : 1};
25
+ const gridContainer = {"colGap" : 6};
27
26
  // @ts-ignore
28
27
  gridContainer.cols = gridRepeat;
29
28
  // @ts-ignore
@@ -33,10 +32,33 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
33
32
  // @ts-ignore
34
33
  flexContainer.gap = 2;
35
34
 
35
+ if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
36
+ return (
37
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
38
+ {{! pick new delimiters for mustache }}
39
+ {{=<% %>=}}
40
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
41
+ <Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
42
+ {children.map((child: any, i: number) => (
43
+ <Flex
44
+ // @ts-ignore
45
+ container={{ direction: 'column', alignItems: 'normal', colGap: 1, rowGap: 1.5 }}
46
+ key={`r-${i + 1}`}
47
+ >
48
+ <DetailsRender child={child} />
49
+ </Flex>
50
+ ))}
51
+ </Grid>
52
+ </FieldGroup>
53
+ <%={{ }}=%> {{! revert delimiters for mustache }}
54
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
55
+ );
56
+ }
57
+
36
58
  return (
37
59
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
38
- {{! pick new delimiters for mustache }}
39
- {{=<% %>=}}
60
+ {{! pick new delimiters for mustache }}
61
+ {{=<% %>=}}
40
62
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
41
63
  <Grid container={gridContainer}>
42
64
  {children.map((child: any, i: number) => (
@@ -47,7 +69,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
47
69
  ))}
48
70
  </Grid>
49
71
  </FieldGroup>
50
- <%={{ }}=%> {{! revert delimiters for mustache }}
72
+ <%={{ }}=%> {{! revert delimiters for mustache }}
51
73
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
52
74
  );
53
75
 
@@ -18,6 +18,7 @@ export default function GetNextWork(props: {{COMPONENT_CLASS_NAME}}WorkProps) {
18
18
  const toasterCtx = useToaster();
19
19
 
20
20
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
21
+ const localeCategory = 'Case';
21
22
 
22
23
  const getNextWork = () => {
23
24
 
@@ -30,7 +31,7 @@ export default function GetNextWork(props: {{COMPONENT_CLASS_NAME}}WorkProps) {
30
31
  console.log(err);
31
32
  if (err[0].status === 404) {
32
33
  toasterCtx.push({
33
- content: localizedVal('No task currently available')
34
+ content: localizedVal('No task currently available', localeCategory)
34
35
  });
35
36
  }
36
37
  });
@@ -1,4 +1,6 @@
1
1
  {
2
- "Get next work" : "Get next work",
3
- "No task currently available" : "No task currently available"
2
+ "fields" : {
3
+ "Get next work" : "Get next work",
4
+ "No task currently available" : "No task currently available"
5
+ }
4
6
  }
@@ -17,17 +17,98 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
17
17
  export default meta;
18
18
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
19
19
 
20
+ if (!window.PCore) {
21
+ window.PCore = {};
22
+ }
23
+
24
+ const worklistData = {
25
+ data: {
26
+ data: [
27
+ {
28
+ pxProcessName: 'Loan',
29
+ pxRefObjectInsName: ' A-8002',
30
+ pyAssignmentStatus: 'New',
31
+ pxTaskLabel: 'Details'
32
+ },
33
+ {
34
+ pxProcessName: 'Loan',
35
+ pxRefObjectInsName: ' A-7001',
36
+ pyAssignmentStatus: 'Open',
37
+ pxTaskLabel: 'Info'
38
+ },
39
+ {
40
+ pxProcessName: 'Loan',
41
+ pxRefObjectInsName: ' A-9000',
42
+ pyAssignmentStatus: 'Open',
43
+ pxTaskLabel: 'Amount'
44
+ }
45
+ ]
46
+ }
47
+ };
48
+
49
+ window.PCore.getDataApiUtils = () => {
50
+ return {
51
+ getData: () => {
52
+ return new Promise(resolve => {
53
+ resolve(worklistData);
54
+ });
55
+ },
56
+ getDataAsync: () => {
57
+ return new Promise(resolve => {
58
+ resolve(worklistData);
59
+ });
60
+ }
61
+ };
62
+ };
63
+
64
+
65
+
20
66
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
21
67
 
22
68
  const props = {
23
- image: configProps.image
69
+ ...configProps,
70
+ getPConnect: () => {
71
+ return {
72
+ getValue: value => {
73
+ return value;
74
+ },
75
+ getContextName: () => {
76
+ return 'app/primary_1';
77
+ },
78
+ getLocalizedValue: value => {
79
+ return value;
80
+ },
81
+ getActionsApi: () => {
82
+ return {
83
+ updateFieldValue: () => {
84
+ /* nothing */
85
+ },
86
+ triggerFieldChange: () => {
87
+ /* nothing */
88
+ }
89
+ };
90
+ },
91
+ ignoreSuggestion: () => {
92
+ /* nothing */
93
+ },
94
+ acceptSuggestion: () => {
95
+ /* nothing */
96
+ },
97
+ setInheritedProps: () => {
98
+ /* nothing */
99
+ },
100
+ resolveConfigProps: () => {
101
+ /* nothing */
102
+ }
103
+ };
104
+ }
24
105
  };
25
106
 
26
- return (
27
- <>
28
- <{{COMPONENT_CLASS_NAME}} {...props} {...args} />
29
- </>
30
- );
107
+ return (
108
+ <>
109
+ <{{COMPONENT_CLASS_NAME}} {...props} {...args} />
110
+ </>
111
+ );
31
112
  };
32
113
 
33
114
  Base{{COMPONENT_CLASS_NAME}}.args = {