@pega/react-sdk-overrides 0.23.17 → 0.23.19

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 (65) hide show
  1. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +37 -3
  2. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -2
  3. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +38 -56
  4. package/lib/field/AutoComplete/AutoComplete.tsx +6 -4
  5. package/lib/field/Checkbox/Checkbox.tsx +7 -5
  6. package/lib/field/Currency/Currency.tsx +31 -6
  7. package/lib/field/Currency/currency-utils.ts +76 -0
  8. package/lib/field/Date/Date.tsx +25 -9
  9. package/lib/field/DateTime/DateTime.tsx +24 -10
  10. package/lib/field/Decimal/Decimal.tsx +8 -6
  11. package/lib/field/Dropdown/Dropdown.tsx +6 -4
  12. package/lib/field/Email/Email.tsx +8 -8
  13. package/lib/field/Integer/Integer.tsx +8 -6
  14. package/lib/field/Percentage/Percentage.tsx +8 -6
  15. package/lib/field/Phone/Phone.tsx +8 -7
  16. package/lib/field/RadioButtons/RadioButtons.tsx +7 -5
  17. package/lib/field/SemanticLink/SemanticLink.tsx +6 -0
  18. package/lib/field/TextArea/TextArea.tsx +8 -6
  19. package/lib/field/TextInput/TextInput.tsx +8 -6
  20. package/lib/field/Time/Time.tsx +7 -5
  21. package/lib/field/URL/URL.tsx +8 -6
  22. package/lib/helpers/authManager.js +1 -0
  23. package/lib/helpers/date-format-utils.ts +66 -0
  24. package/lib/helpers/event-utils.js +1 -1
  25. package/lib/helpers/formatters/Currency.js +13 -5
  26. package/lib/helpers/formatters/common.js +5 -1
  27. package/lib/helpers/formatters/index.js +5 -0
  28. package/lib/helpers/template-utils.ts +80 -0
  29. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -72
  30. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +0 -44
  31. package/lib/infra/MultiStep/MultiStep.css +4 -18
  32. package/lib/infra/NavBar/NavBar.tsx +129 -219
  33. package/lib/infra/RootContainer/RootContainer.tsx +2 -54
  34. package/lib/infra/Stages/Stages.tsx +1 -2
  35. package/lib/infra/View/View.tsx +28 -21
  36. package/lib/template/AppShell/AppShell.tsx +2 -343
  37. package/lib/template/CaseSummary/CaseSummary.tsx +1 -1
  38. package/lib/template/CaseView/CaseView.tsx +2 -5
  39. package/lib/template/DefaultForm/DefaultForm.tsx +4 -0
  40. package/lib/template/Details/Details/Details.tsx +52 -21
  41. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +63 -31
  42. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +64 -30
  43. package/lib/template/ListView/DefaultViewMeta.js +222 -0
  44. package/lib/template/ListView/ListView.tsx +155 -94
  45. package/lib/template/ListView/hooks.js +97 -0
  46. package/lib/template/ListView/utils.js +636 -0
  47. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +69 -42
  48. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +3 -24
  49. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +69 -43
  50. package/lib/widget/Attachment/Attachment.css +7 -0
  51. package/lib/widget/Attachment/Attachment.tsx +37 -3
  52. package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
  53. package/package.json +1 -1
  54. package/lib/.DS_Store +0 -0
  55. package/lib/field/AutoComplete/.DS_Store +0 -0
  56. package/lib/field/Checkbox/.DS_Store +0 -0
  57. package/lib/field/Currency/.DS_Store +0 -0
  58. package/lib/field/Date/.DS_Store +0 -0
  59. package/lib/field/TextContent/.DS_Store +0 -0
  60. package/lib/infra/.DS_Store +0 -0
  61. package/lib/template/.DS_Store +0 -0
  62. package/lib/template/CaseView/.DS_Store +0 -0
  63. package/lib/template/SimpleTable/.DS_Store +0 -0
  64. package/lib/template/SimpleTable/SimpleTable/.DS_Store +0 -0
  65. package/lib/template/utils.ts +0 -23
@@ -1,45 +1,77 @@
1
- import React from 'react';
2
- // import PropTypes from "prop-types";
1
+ import React, { createElement } from 'react';
2
+ import PropTypes from 'prop-types';
3
3
  import Grid from '@material-ui/core/Grid';
4
- import DetailsFields from '@pega/react-sdk-components/lib/components/designSystemExtension/DetailsFields';
4
+ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
+ import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
5
6
 
6
7
  export default function DetailsThreeColumn(props) {
7
- const { children } = props;
8
- const arFields: Array<any> = [];
9
-
10
- for (const child of children) {
11
- const theChildPConn = child.props.getPConnect();
12
- theChildPConn.setInheritedProp('displayMode', 'LABELS_LEFT');
13
- theChildPConn.setInheritedProp('readOnly', true);
14
- const theChildrenOfChild = theChildPConn.getChildren();
15
- arFields.push(theChildrenOfChild);
16
- }
8
+ const { label, showLabel, getPConnect, showHighlightedData } = props;
9
+
10
+ // Get the inherited props from the parent to determine label settings
11
+ const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
12
+
13
+ // Set display mode prop and re-create the children so this part of the dom tree renders
14
+ // in a readonly (display) mode instead of a editable
15
+ getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
16
+ getPConnect().setInheritedProp('readOnly', true);
17
+ const children = getPConnect()
18
+ .getChildren()
19
+ .map((configObject, index) =>
20
+ createElement(createPConnectComponent(), {
21
+ ...configObject,
22
+ // eslint-disable-next-line react/no-array-index-key
23
+ key: index.toString()
24
+ })
25
+ );
17
26
 
18
- if (arFields.length !== 3) {
19
- // eslint-disable-next-line no-console
20
- console.error(`DetailsThreeColumn expects 3 children and received ${arFields.length}`);
27
+ // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
28
+ let highlightedDataArr = [];
29
+ if (showHighlightedData) {
30
+ const { highlightedData = [] } = getPConnect().getRawMetadata().config;
31
+ highlightedDataArr = highlightedData.map(field => {
32
+ field.config.displayMode = 'STACKED_LARGE_VAL';
33
+
34
+ // Mark as status display when using pyStatusWork
35
+ if (field.config.value === '@P .pyStatusWork') {
36
+ field.type = 'TextInput';
37
+ field.config.displayAsStatus = true;
38
+ }
39
+
40
+ return getPConnect().createComponent(field);
41
+ });
21
42
  }
22
43
 
23
44
  return (
24
- <div id='DetailsThreeColumn'>
25
- <Grid container spacing={1}>
26
- <Grid item xs={4}>
27
- <DetailsFields fields={arFields[0]} />
28
- </Grid>
29
- <Grid item xs={4}>
30
- <DetailsFields fields={arFields[1]} />
31
- </Grid>
32
- <Grid item xs={4}>
33
- <DetailsFields fields={arFields[2]} />
45
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
46
+ {showHighlightedData && highlightedDataArr.length > 0 && (
47
+ <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
48
+ {highlightedDataArr.map((child, i) => (
49
+ <Grid item xs={4} key={`hf-${i + 1}`}>
50
+ {child}
51
+ </Grid>
52
+ ))}
34
53
  </Grid>
54
+ )}
55
+ <Grid container spacing={1}>
56
+ {children.map((child, i) => (
57
+ <Grid item xs={4} key={`r-${i + 1}`}>
58
+ {child}
59
+ </Grid>
60
+ ))}
35
61
  </Grid>
36
- </div>
62
+ </FieldGroup>
37
63
  );
38
64
  }
39
65
 
66
+ DetailsThreeColumn.defaultProps = {
67
+ label: undefined,
68
+ showLabel: true,
69
+ showHighlightedData: false
70
+ };
71
+
40
72
  DetailsThreeColumn.propTypes = {
41
- // showLabel: PropTypes.bool,
42
- // label: PropTypes.string,
43
- // getPConnect: PropTypes.func.isRequired,
44
- // template: PropTypes.string.isRequired
73
+ showLabel: PropTypes.bool,
74
+ label: PropTypes.string,
75
+ getPConnect: PropTypes.func.isRequired,
76
+ showHighlightedData: PropTypes.bool
45
77
  };
@@ -1,43 +1,77 @@
1
- import React from "react";
2
- // import PropTypes from "prop-types";
1
+ import React, { createElement } from 'react';
2
+ import PropTypes from 'prop-types';
3
3
  import Grid from '@material-ui/core/Grid';
4
- import DetailsFields from '@pega/react-sdk-components/lib/components/designSystemExtension/DetailsFields';
4
+ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
+ import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
5
6
 
6
7
  export default function DetailsTwoColumn(props) {
7
- const { children } = props;
8
- const arFields: Array<any> = [];
9
-
10
- for (const child of children) {
11
- const theChildPConn = child.props.getPConnect();
12
- theChildPConn.setInheritedProp('displayMode', 'LABELS_LEFT');
13
- theChildPConn.setInheritedProp('readOnly', true);
14
- const theChildrenOfChild = theChildPConn.getChildren();
15
- arFields.push(theChildrenOfChild);
16
- }
8
+ const { label, showLabel, getPConnect, showHighlightedData } = props;
17
9
 
18
- if (arFields.length !== 2) {
19
- // eslint-disable-next-line no-console
20
- console.error(`DetailsTwoColumn expects 2 children and received ${arFields.length}`);
21
- }
10
+ // Get the inherited props from the parent to determine label settings
11
+ const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
12
+
13
+ // Set display mode prop and re-create the children so this part of the dom tree renders
14
+ // in a readonly (display) mode instead of a editable
15
+ getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
16
+ getPConnect().setInheritedProp('readOnly', true);
17
+ const children = getPConnect()
18
+ .getChildren()
19
+ .map((configObject, index) =>
20
+ createElement(createPConnectComponent(), {
21
+ ...configObject,
22
+ // eslint-disable-next-line react/no-array-index-key
23
+ key: index.toString()
24
+ })
25
+ );
22
26
 
27
+ // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
28
+ let highlightedDataArr = [];
29
+ if (showHighlightedData) {
30
+ const { highlightedData = [] } = getPConnect().getRawMetadata().config;
31
+ highlightedDataArr = highlightedData.map(field => {
32
+ field.config.displayMode = 'STACKED_LARGE_VAL';
33
+
34
+ // Mark as status display when using pyStatusWork
35
+ if (field.config.value === '@P .pyStatusWork') {
36
+ field.type = 'TextInput';
37
+ field.config.displayAsStatus = true;
38
+ }
39
+
40
+ return getPConnect().createComponent(field);
41
+ });
42
+ }
23
43
 
24
44
  return (
25
- <div id="DetailsTwoColumn">
26
- <Grid container spacing={1}>
27
- <Grid item xs={6}>
28
- <DetailsFields fields={arFields[0]} />
29
- </Grid>
30
- <Grid item xs={6}>
31
- <DetailsFields fields={arFields[1]} />
45
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
46
+ {showHighlightedData && highlightedDataArr.length > 0 && (
47
+ <Grid container spacing={1} style={{ padding: '0 0 1em' }}>
48
+ {highlightedDataArr.map((child, i) => (
49
+ <Grid item xs={6} key={`hf-${i + 1}`}>
50
+ {child}
51
+ </Grid>
52
+ ))}
32
53
  </Grid>
54
+ )}
55
+ <Grid container spacing={1}>
56
+ {children.map((child, i) => (
57
+ <Grid item xs={6} key={`r-${i + 1}`}>
58
+ {child}
59
+ </Grid>
60
+ ))}
33
61
  </Grid>
34
- </div>
35
- )
62
+ </FieldGroup>
63
+ );
36
64
  }
37
65
 
66
+ DetailsTwoColumn.defaultProps = {
67
+ label: undefined,
68
+ showLabel: true,
69
+ showHighlightedData: false
70
+ };
71
+
38
72
  DetailsTwoColumn.propTypes = {
39
- // showLabel: PropTypes.bool,
40
- // label: PropTypes.string,
41
- // getPConnect: PropTypes.func.isRequired,
42
- // template: PropTypes.string.isRequired
73
+ showLabel: PropTypes.bool,
74
+ label: PropTypes.string,
75
+ getPConnect: PropTypes.func.isRequired,
76
+ showHighlightedData: PropTypes.bool
43
77
  };
@@ -0,0 +1,222 @@
1
+ const LOCALIZATON_ANNOTATION = '@L ';
2
+ const PROPERTY_ANNOTATION = '@P .';
3
+ const USER_ANNOTATION = '@USER .';
4
+ const ASSOCIATED_ANNOTATION = '@ASSOCIATED .';
5
+ const ASSOCIATION_ANNOTATION = '@CA ';
6
+
7
+ const getDefaultConfig = (fieldMeta, classID, show) => {
8
+ const {
9
+ name,
10
+ label,
11
+ fieldID,
12
+ fieldType,
13
+ dataType,
14
+ type,
15
+ classID: fieldMetaClassID,
16
+ displayAs,
17
+ displayAsLink,
18
+ category,
19
+ associationClassID,
20
+ associationID
21
+ } = fieldMeta;
22
+ return {
23
+ value: (associationClassID ? ASSOCIATION_ANNOTATION : PROPERTY_ANNOTATION).concat(fieldID),
24
+ label: LOCALIZATON_ANNOTATION.concat(name || label),
25
+ fieldType,
26
+ propertyType: dataType || type,
27
+ classID: classID || fieldMetaClassID,
28
+ displayAs,
29
+ displayAsLink,
30
+ category,
31
+ show,
32
+ ...(associationClassID ? { associationLabel: LOCALIZATON_ANNOTATION.concat(category) } : {}),
33
+ associationID
34
+ };
35
+ };
36
+
37
+
38
+ export default function getDefaultViewMeta(fieldMeta, classID, showField) {
39
+ const { type, name, displayAs, fieldID, isUserReference, associationID, datasource, label, fieldType } =
40
+ fieldMeta;
41
+ const mapperKey = type && displayAs ? type.concat(':').concat(displayAs) : type;
42
+ const defaultConfig = getDefaultConfig(fieldMeta, classID, showField);
43
+ let viewMeta;
44
+ switch (mapperKey) {
45
+ case 'True-False:pxCheckbox':
46
+ viewMeta = {
47
+ type: 'Checkbox',
48
+ config: {
49
+ ...defaultConfig,
50
+ trueLabel: '@L Yes',
51
+ falseLabel: '@L No',
52
+ caption: LOCALIZATON_ANNOTATION.concat(name || label),
53
+ label: undefined
54
+ }
55
+ };
56
+ break;
57
+ case 'Decimal:pxCurrency':
58
+ viewMeta = {
59
+ type: 'Currency',
60
+ config: defaultConfig
61
+ };
62
+ break;
63
+ case 'Date Time:pxDateTime':
64
+ case 'Date & time:pxDateTime':
65
+ viewMeta = {
66
+ type: 'DateTime',
67
+ config: defaultConfig
68
+ };
69
+ break;
70
+ case 'Date:pxDateTime':
71
+ case 'Date only:pxDateTime':
72
+ viewMeta = {
73
+ type: 'Date',
74
+ config: defaultConfig
75
+ };
76
+ break;
77
+ case 'Decimal:pxNumber':
78
+ viewMeta = {
79
+ type: 'Decimal',
80
+ config: defaultConfig
81
+ };
82
+ break;
83
+ case 'Text:pxEmail':
84
+ viewMeta = {
85
+ type: 'Email',
86
+ config: defaultConfig
87
+ };
88
+ break;
89
+ case 'Integer:pxInteger':
90
+ viewMeta = {
91
+ type: 'Integer',
92
+ config: defaultConfig
93
+ };
94
+ break;
95
+ case 'Decimal:pxPercentage':
96
+ viewMeta = {
97
+ type: 'Percentage',
98
+ config: defaultConfig
99
+ };
100
+ break;
101
+ case 'Text:pxPhone':
102
+ viewMeta = {
103
+ type: 'Phone',
104
+ config: {
105
+ ...defaultConfig,
106
+ datasource: {
107
+ source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults',
108
+ fields: {
109
+ value: '@P .pyCallingCode'
110
+ }
111
+ }
112
+ }
113
+ };
114
+ break;
115
+ case 'TimeOfDay:pxDateTime':
116
+ viewMeta = {
117
+ type: 'Time',
118
+ config: defaultConfig
119
+ };
120
+ break;
121
+ case 'Text:pxURL':
122
+ case 'Text:pxUrl':
123
+ viewMeta = {
124
+ type: 'URL',
125
+ config: defaultConfig
126
+ };
127
+ break;
128
+ case 'Text:pxTextArea':
129
+ viewMeta = {
130
+ type: 'TextArea',
131
+ config: defaultConfig
132
+ };
133
+ break;
134
+ case 'Text:pxRichTextEditor':
135
+ viewMeta = {
136
+ type: 'RichText',
137
+ config: defaultConfig
138
+ };
139
+ break;
140
+ case 'Text:pxAutoComplete':
141
+ if (isUserReference || fieldType === 'User reference') {
142
+ viewMeta = {
143
+ type: 'UserReference',
144
+ config: {
145
+ ...defaultConfig,
146
+ value: USER_ANNOTATION.concat(fieldID),
147
+ placeholder: 'Select...',
148
+ displayAs: 'Search box',
149
+ associationID,
150
+ associationLabel: undefined
151
+ }
152
+ };
153
+ } else {
154
+ const { tableType = '' } = datasource || {};
155
+ viewMeta = {
156
+ type: 'AutoComplete',
157
+ config: {
158
+ ...defaultConfig,
159
+ placeholder: 'Select...',
160
+ listType: 'associated',
161
+ datasource: ASSOCIATED_ANNOTATION.concat(fieldID),
162
+ deferDatasource: tableType === 'DataPage'
163
+ }
164
+ };
165
+ }
166
+ break;
167
+ case 'Text:pxDropdown':
168
+ if (isUserReference || fieldType === 'User reference') {
169
+ viewMeta = {
170
+ type: 'UserReference',
171
+ config: {
172
+ ...defaultConfig,
173
+ value: USER_ANNOTATION.concat(fieldID),
174
+ placeholder: 'Select...',
175
+ displayAs: 'Drop-down list',
176
+ associationID,
177
+ associationLabel: undefined
178
+ }
179
+ };
180
+ } else {
181
+ const { tableType = '' } = datasource || {};
182
+ viewMeta = {
183
+ type: 'Dropdown',
184
+ config: {
185
+ ...defaultConfig,
186
+ placeholder: 'Select...',
187
+ listType: 'associated',
188
+ datasource: ASSOCIATED_ANNOTATION.concat(fieldID),
189
+ deferDatasource: tableType === 'DataPage'
190
+ }
191
+ };
192
+ }
193
+ break;
194
+ case 'Text:pxRadioButtons':
195
+ {
196
+ const { tableType = '' } = datasource || {};
197
+ viewMeta = {
198
+ type: 'RadioButtons',
199
+ config: {
200
+ ...defaultConfig,
201
+ placeholder: 'Select...',
202
+ listType: 'associated',
203
+ datasource: ASSOCIATED_ANNOTATION.concat(fieldID),
204
+ deferDatasource: tableType === 'DataPage'
205
+ }
206
+ };
207
+ }
208
+ break;
209
+ case 'Text:pxTextInput':
210
+ viewMeta = {
211
+ type: 'TextInput',
212
+ config: defaultConfig
213
+ };
214
+ break;
215
+ default:
216
+ viewMeta = {
217
+ type,
218
+ config: defaultConfig
219
+ };
220
+ }
221
+ return viewMeta;
222
+ }