@pega/react-sdk-overrides 0.23.26 → 8.8.20

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 (139) hide show
  1. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
  2. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  3. package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
  9. package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
  12. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
  14. package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
  15. package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
  16. package/lib/field/Checkbox/Checkbox.tsx +41 -17
  17. package/lib/field/Currency/Currency.tsx +23 -15
  18. package/lib/field/Currency/currency-utils.ts +1 -2
  19. package/lib/field/Date/Date.tsx +31 -17
  20. package/lib/field/DateTime/DateTime.tsx +26 -15
  21. package/lib/field/Decimal/Decimal.tsx +82 -19
  22. package/lib/field/Dropdown/Dropdown.tsx +57 -14
  23. package/lib/field/Email/Email.tsx +17 -9
  24. package/lib/field/Integer/Integer.tsx +15 -7
  25. package/lib/field/Percentage/Percentage.tsx +15 -7
  26. package/lib/field/Phone/Phone.tsx +21 -12
  27. package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
  28. package/lib/field/RichText/RichText.tsx +93 -0
  29. package/lib/field/RichText/index.tsx +1 -0
  30. package/lib/field/ScalarList/ScalarList.tsx +64 -0
  31. package/lib/field/ScalarList/config-ext.json +8 -0
  32. package/lib/field/ScalarList/index.tsx +1 -0
  33. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  34. package/lib/field/SemanticLink/utils.ts +2 -1
  35. package/lib/field/TextArea/TextArea.tsx +14 -5
  36. package/lib/field/TextContent/TextContent.tsx +10 -1
  37. package/lib/field/TextInput/TextInput.tsx +40 -11
  38. package/lib/field/Time/Time.tsx +29 -26
  39. package/lib/field/URL/URL.tsx +24 -8
  40. package/lib/field/UserReference/UserReference.tsx +52 -60
  41. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
  42. package/lib/helpers/auth.js +741 -390
  43. package/lib/helpers/authManager.ts +933 -0
  44. package/lib/helpers/case-utils.tsx +103 -0
  45. package/lib/helpers/common-utils.ts +4 -0
  46. package/lib/helpers/config_access.js +63 -145
  47. package/lib/helpers/data_page.ts +2 -1
  48. package/lib/helpers/date-format-utils.ts +29 -19
  49. package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
  50. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
  51. package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
  52. package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
  53. package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
  54. package/lib/helpers/formatters/{common.js → common.ts} +4 -4
  55. package/lib/helpers/formatters/{index.js → index.ts} +3 -3
  56. package/lib/helpers/simpleTableHelpers.ts +10 -6
  57. package/lib/helpers/state-utils.tsx +47 -0
  58. package/lib/helpers/template-utils.ts +3 -4
  59. package/lib/helpers/utils.ts +12 -4
  60. package/lib/helpers/versionHelpers.ts +0 -1
  61. package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
  62. package/lib/infra/Assignment/Assignment.tsx +38 -32
  63. package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
  64. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
  65. package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
  66. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
  67. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
  68. package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
  69. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
  70. package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
  71. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
  72. package/lib/infra/MultiStep/MultiStep.tsx +24 -24
  73. package/lib/infra/NavBar/NavBar.tsx +23 -24
  74. package/lib/infra/Reference/Reference.tsx +13 -18
  75. package/lib/infra/Region/Region.tsx +8 -6
  76. package/lib/infra/RootContainer/RootContainer.tsx +32 -39
  77. package/lib/infra/Stages/Stages.tsx +15 -9
  78. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
  79. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
  80. package/lib/infra/View/View.tsx +28 -56
  81. package/lib/template/AppShell/AppShell.tsx +51 -34
  82. package/lib/template/BannerPage/BannerPage.tsx +26 -31
  83. package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
  84. package/lib/template/CaseView/CaseView.tsx +137 -100
  85. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
  86. package/lib/template/Confirmation/Confirmation.tsx +29 -52
  87. package/lib/template/DataReference/DataReference.tsx +50 -52
  88. package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
  89. package/lib/template/DefaultForm/utils/index.ts +33 -0
  90. package/lib/template/Details/Details/Details.tsx +16 -17
  91. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
  92. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
  93. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
  94. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
  95. package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
  96. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
  97. package/lib/template/ListPage/ListPage.tsx +14 -13
  98. package/lib/template/ListView/ListView.tsx +140 -152
  99. package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
  100. package/lib/template/ListView/{utils.js → utils.ts} +172 -23
  101. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
  102. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
  103. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
  104. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
  105. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
  106. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
  107. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
  108. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
  109. package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
  110. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
  111. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
  112. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
  113. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
  114. package/lib/template/SubTabs/SubTabs.tsx +10 -11
  115. package/lib/template/SubTabs/tabUtils.ts +0 -2
  116. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
  117. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
  118. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
  119. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
  120. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
  121. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
  122. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
  123. package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
  124. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
  125. package/lib/widget/Attachment/Attachment.css +15 -3
  126. package/lib/widget/Attachment/Attachment.tsx +51 -32
  127. package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
  128. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
  129. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
  130. package/lib/widget/Followers/Followers.tsx +10 -11
  131. package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
  132. package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
  133. package/lib/widget/SummaryList/SummaryList.tsx +17 -3
  134. package/lib/widget/ToDo/ToDo.tsx +69 -104
  135. package/package.json +1 -1
  136. package/lib/helpers/authManager.js +0 -631
  137. /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
  138. /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
  139. /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
@@ -1,13 +1,36 @@
1
1
  import React, { useMemo, useState, useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
- import SingleReferenceReadonly from '@pega/react-sdk-components/lib/components/template/SingleReferenceReadOnly';
4
- import MultiReferenceReadonly from '@pega/react-sdk-components/lib/components/template/MultiReferenceReadOnly';
2
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
+
4
+ // import type { PConnProps } from '../../../types/PConnProps';
5
+
6
+ // ReferenceProps can't be used until getComponentConfig() is NOT private
7
+ // interface DataReferenceProps extends PConnProps {
8
+ // // If any, enter additional props that only exist on this component
9
+ // children: Array<any>,
10
+ // label: string,
11
+ // showLabel: any,
12
+ // displayMode: string,
13
+ // allowAndPersistChangesInReviewMode: boolean,
14
+ // referenceType: string,
15
+ // selectionMode: string,
16
+ // displayAs: string,
17
+ // ruleClass: string,
18
+ // parameters: Array<string>, // need to fix
19
+ // hideLabel: boolean
20
+ // }
21
+
5
22
 
6
23
  const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
7
24
 
25
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows ~7 errors)
8
26
  declare const PCore: any;
9
27
 
10
- export default function DataReference(props) {
28
+
29
+ export default function DataReference(props /*: DataReferenceProps */) {
30
+ // Get emitted components from map (so we can get any override that may exist)
31
+ const SingleReferenceReadonly = getComponentFromMap('SingleReferenceReadOnly');
32
+ const MultiReferenceReadonly = getComponentFromMap('MultiReferenceReadOnly');
33
+
11
34
  const {
12
35
  children,
13
36
  getPConnect,
@@ -25,14 +48,14 @@ export default function DataReference(props) {
25
48
  let childrenToRender = children;
26
49
  const pConn = getPConnect();
27
50
  const [dropDownDataSource, setDropDownDataSource] = useState(null);
28
- const propsToUse = { label, showLabel, ...pConn.getInheritedProps() };
51
+ const propsToUse: any = { label, showLabel, ...pConn.getInheritedProps() };
29
52
  if (propsToUse.showLabel === false) {
30
53
  propsToUse.label = '';
31
54
  }
32
55
  const rawViewMetadata = pConn.getRawMetadata();
33
- const viewName = rawViewMetadata.name;
34
- const [firstChildMeta] = rawViewMetadata.children;
35
- const refList = rawViewMetadata.config.referenceList;
56
+ const viewName = rawViewMetadata["name"];
57
+ const [firstChildMeta] = rawViewMetadata["children"];
58
+ const refList = rawViewMetadata["config"].referenceList;
36
59
  const canBeChangedInReviewMode = allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');
37
60
  let propName;
38
61
  const isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL'].includes(displayMode);
@@ -42,7 +65,7 @@ export default function DataReference(props) {
42
65
  useEffect(() => {
43
66
  if (
44
67
  firstChildMeta?.type === "Dropdown" &&
45
- rawViewMetadata.config?.parameters
68
+ rawViewMetadata["config"]?.parameters
46
69
  ) {
47
70
  const { value, key, text } = firstChildMeta.config.datasource.fields;
48
71
  PCore.getDataApiUtils()
@@ -82,14 +105,14 @@ export default function DataReference(props) {
82
105
  delete firstChildMeta.config.readOnly;
83
106
  }
84
107
  if (firstChildMeta?.type === 'Dropdown') {
85
- firstChildMeta.config.datasource.source = rawViewMetadata.config?.parameters
108
+ firstChildMeta.config.datasource.source = rawViewMetadata["config"]?.parameters
86
109
  ? dropDownDataSource
87
110
  : '@DATASOURCE '.concat(refList).concat('.pxResults');
88
111
  } else if (firstChildMeta?.type === 'AutoComplete') {
89
112
  firstChildMeta.config.datasource = refList;
90
113
 
91
114
  /* Insert the parameters to the component only if present */
92
- if (rawViewMetadata.config?.parameters) {
115
+ if (rawViewMetadata["config"]?.parameters) {
93
116
  firstChildMeta.config.parameters = parameters;
94
117
  }
95
118
  }
@@ -107,10 +130,10 @@ export default function DataReference(props) {
107
130
  const handleSelection = event => {
108
131
  const caseKey = pConn.getCaseInfo().getKey();
109
132
  const refreshOptions = { autoDetectRefresh: true };
110
- if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName')) {
133
+ if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName', '')) { // 2nd arg empty string until typedef marked correctly
111
134
  getPConnect()
112
135
  .getActionsApi()
113
- .refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName'), null, refreshOptions);
136
+ .refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName', ''), null, refreshOptions); // 2nd arg empty string until typedef marked correctly
114
137
  PCore.getDeferLoadManager().refreshActiveComponents(pConn.getContextName());
115
138
  } else {
116
139
  const pgRef = pConn.getPageReference().replace('caseInfo.content', '');
@@ -168,8 +191,10 @@ export default function DataReference(props) {
168
191
  const recreatedFirstChild = useMemo(() => {
169
192
  const { type, config } = firstChildMeta;
170
193
  if (firstChildMeta?.type !== 'Region') {
171
- pConn.clearErrorMessages({
172
- property: propName
194
+ pConn.clearErrorMessages({ // Need to add empty string for category and context to match typdef
195
+ property: propName,
196
+ category: '',
197
+ context: ''
173
198
  });
174
199
  if (!canBeChangedInReviewMode && isDisplayModeEnabled && selectionMode === SELECTION_MODE.SINGLE) {
175
200
  return (
@@ -184,7 +209,7 @@ export default function DataReference(props) {
184
209
  referenceType={referenceType}
185
210
  hideLabel={hideLabel}
186
211
  dataRelationshipContext={
187
- rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null
212
+ rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name ? rawViewMetadata["config"].name : null
188
213
  }
189
214
  />
190
215
  );
@@ -204,7 +229,7 @@ export default function DataReference(props) {
204
229
  // In the case of a datasource with parameters you cannot load the dropdown before the parameters
205
230
  if (
206
231
  type === 'Dropdown' &&
207
- rawViewMetadata.config?.parameters &&
232
+ rawViewMetadata["config"]?.parameters &&
208
233
  dropDownDataSource === null
209
234
  ) {
210
235
  return null;
@@ -219,18 +244,19 @@ export default function DataReference(props) {
219
244
  disabled: propsToUse.disabled,
220
245
  label: propsToUse.label,
221
246
  viewName: getPConnect().getCurrentView(),
222
- parameters: rawViewMetadata.config.parameters,
247
+ parameters: rawViewMetadata["config"].parameters,
223
248
  readOnly: false,
224
- localeReference: rawViewMetadata.config.localeReference,
249
+ localeReference: rawViewMetadata["config"].localeReference,
225
250
  ...(selectionMode === SELECTION_MODE.SINGLE ? { referenceType } : ''),
226
251
  dataRelationshipContext:
227
- rawViewMetadata.config.contextClass && rawViewMetadata.config.name
228
- ? rawViewMetadata.config.name
252
+ rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name
253
+ ? rawViewMetadata["config"].name
229
254
  : null,
230
255
  hideLabel,
231
256
  onRecordChange: handleSelection
232
- }
233
- });
257
+ },
258
+ },
259
+ '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
234
260
  }
235
261
  }, [
236
262
  firstChildMeta.config?.datasource?.source,
@@ -242,7 +268,7 @@ export default function DataReference(props) {
242
268
 
243
269
  // Only include the views region for rendering when it has content
244
270
  if (firstChildMeta?.type !== 'Region') {
245
- const viewsRegion = rawViewMetadata.children[1];
271
+ const viewsRegion = rawViewMetadata["children"][1];
246
272
  if (viewsRegion?.name === 'Views' && viewsRegion.children.length) {
247
273
  childrenToRender = [recreatedFirstChild, ...children.slice(1)];
248
274
  } else {
@@ -260,31 +286,3 @@ export default function DataReference(props) {
260
286
  </div>
261
287
  );
262
288
  }
263
-
264
- DataReference.defaultProps = {
265
- label: undefined,
266
- showLabel: undefined,
267
- displayMode: undefined,
268
- allowAndPersistChangesInReviewMode: false,
269
- referenceType: '',
270
- selectionMode: '',
271
- displayAs: '',
272
- ruleClass: '',
273
- parameters: undefined,
274
- hideLabel: false
275
- };
276
-
277
- DataReference.propTypes = {
278
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
279
- getPConnect: PropTypes.func.isRequired,
280
- label: PropTypes.string,
281
- showLabel: PropTypes.func,
282
- displayMode: PropTypes.string,
283
- allowAndPersistChangesInReviewMode: PropTypes.bool,
284
- referenceType: PropTypes.string,
285
- selectionMode: PropTypes.string,
286
- displayAs: PropTypes.string,
287
- ruleClass: PropTypes.string,
288
- parameters: PropTypes.arrayOf(PropTypes.string), // need to fix
289
- hideLabel: PropTypes.bool
290
- };
@@ -1,15 +1,32 @@
1
1
  import React, { createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
2
  import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
5
3
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
+ import connectToState from '@pega/react-sdk-components/lib/components/helpers/state-utils';
5
+ import { getKeyForMappedField, mapStateToProps } from './utils';
6
+ // import type { PConnProps } from '../../../types/PConnProps';
7
+
6
8
 
7
9
  import './DefaultForm.css';
8
10
 
9
- export default function DefaultForm(props) {
10
- const { getPConnect, NumCols } = props;
11
+
12
+ // Can't use PConn props until proper props for getPConnect().getChildren()[0].getPConnect;
13
+ // interface DefaultFormProps extends PConnProps {
14
+ // // If any, enter additional props that only exist on this component
15
+ // children: Array<any>,
16
+ // NumCols: string
17
+
18
+ // }
19
+
20
+
21
+ const Child = connectToState(mapStateToProps)(props => {
22
+ const { key, visibility, ...rest } = props;
23
+
24
+ return createElement(createPConnectComponent(), { ...rest, key, visibility });
25
+ });
26
+
27
+ export default function DefaultForm(props /* : DefaultFormProps */) {
28
+ const { getPConnect, NumCols = '1' } = props;
11
29
  const instructions = getInstructions(getPConnect(), props.instructions);
12
- const instructionText = instructions?.replace(/<\/?[^>]+(>|$)/g, '');
13
30
 
14
31
  let divClass: string;
15
32
 
@@ -35,26 +52,18 @@ export default function DefaultForm(props) {
35
52
  // to take the children and create components for them, put in an array and pass as the
36
53
  // defaultForm kids
37
54
  const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
38
- const dfChildren = arChildren.map((kid, idx) =>
39
- // eslint-disable-next-line react/no-array-index-key
40
- createElement(createPConnectComponent(), { ...kid, key: idx })
41
- );
55
+ const dfChildren = arChildren.map(kid => <Child key={getKeyForMappedField(kid)} {...kid} />);
42
56
 
43
57
  return (
44
58
  <>
45
- {instructionText && (
46
- <div className='psdk-default-form-instruction-text'>{instructionText}</div>
59
+ {instructions && (
60
+ <div className='psdk-default-form-instruction-text'>
61
+ {/* server performs sanitization method for instructions html content */}
62
+ { /* eslint-disable react/no-danger */ }
63
+ <div key="instructions" id="instruction-text" dangerouslySetInnerHTML={{ __html: instructions }} />
64
+ </div>
47
65
  )}
48
66
  <div className={divClass}>{dfChildren}</div>
49
67
  </>
50
68
  );
51
69
  }
52
-
53
- DefaultForm.propTypes = {
54
- // children: PropTypes.arrayOf(PropTypes.node).isRequired,
55
- NumCols: PropTypes.string
56
- };
57
-
58
- DefaultForm.defaultProps = {
59
- NumCols: '1'
60
- };
@@ -0,0 +1,33 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+
3
+ export const mapStateToProps: any = (_, ownProps) => {
4
+ const { getPConnect } = ownProps;
5
+
6
+ return {
7
+ visibility: getPConnect().getComputedVisibility(),
8
+ getPConnect
9
+ };
10
+ };
11
+
12
+ export const getKeyForMappedField = field => {
13
+ if (Array.isArray(field)) {
14
+ return field
15
+ .map(item => {
16
+ return getKeyForMappedField(item);
17
+ })
18
+ .join('__');
19
+ }
20
+
21
+ const pConnect = field?.getPConnect?.();
22
+
23
+ if (pConnect?.meta?.type && pConnect?.meta?.config?.name) {
24
+ return `${pConnect.meta.type}_${pConnect.meta.config.name}`;
25
+ }
26
+
27
+ // Using label as a fallback if name is not defined.
28
+ if (pConnect?.meta?.type && pConnect?.meta?.config?.label) {
29
+ return `${pConnect.meta.type}_${pConnect.meta.config.label}`;
30
+ }
31
+
32
+ return uuidv4();
33
+ };
@@ -1,10 +1,21 @@
1
1
  import React, { createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import Grid from '@material-ui/core/Grid';
4
3
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+
6
+ // import type { PConnProps } from '../../../../types/PConnProps';
7
+
8
+
9
+ // Can't use PConnProps until getPConnect().getChildren() type is ok
10
+ // interface DetailsProps extends PConnProps {
11
+ // // If any, enter additional props that only exist on this component
12
+ // }
13
+
14
+
15
+ export default function Details(props /* : DetailsProps */) {
16
+ // Get emitted components from map (so we can get any override that may exist)
17
+ const FieldGroup = getComponentFromMap('FieldGroup');
6
18
 
7
- export default function Details(props) {
8
19
  const { label, showLabel, getPConnect, showHighlightedData } = props;
9
20
 
10
21
  // Get the inherited props from the parent to determine label settings
@@ -37,7 +48,8 @@ export default function Details(props) {
37
48
  field.config.displayAsStatus = true;
38
49
  }
39
50
 
40
- return getPConnect().createComponent(field);
51
+ return getPConnect().createComponent(field,
52
+ '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
41
53
  });
42
54
  }
43
55
 
@@ -62,16 +74,3 @@ export default function Details(props) {
62
74
  </FieldGroup>
63
75
  );
64
76
  }
65
-
66
- Details.defaultProps = {
67
- label: undefined,
68
- showLabel: true,
69
- showHighlightedData: false
70
- };
71
-
72
- Details.propTypes = {
73
- showLabel: PropTypes.bool,
74
- label: PropTypes.string,
75
- getPConnect: PropTypes.func.isRequired,
76
- showHighlightedData: PropTypes.bool
77
- };
@@ -1,12 +1,22 @@
1
1
  import { useState, useEffect, Fragment } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { getTransientTabs, getVisibleTabs, tabClick } from '@pega/react-sdk-components/lib/components/template/SubTabs/tabUtils';
4
3
  import React from 'react';
5
4
  import { Tab, Tabs, TextField } from '@material-ui/core';
6
5
  import { TabContext, TabPanel } from '@material-ui/lab';
6
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
 
8
- export default function DetailsSubTabs(props) {
9
- const { children, label, showLabel, getPConnect } = props;
8
+
9
+ interface DetailsSubTabsProps extends PConnProps {
10
+ // If any, enter additional props that only exist on this component
11
+ children: Array<any>,
12
+ showLabel: boolean,
13
+ label: string
14
+
15
+ }
16
+
17
+
18
+ export default function DetailsSubTabs(props: DetailsSubTabsProps) {
19
+ const { children = [], label, showLabel = true, getPConnect } = props;
10
20
  // Get the inherited props from the parent to determine label settings
11
21
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
12
22
 
@@ -50,16 +60,3 @@ export default function DetailsSubTabs(props) {
50
60
  </Fragment>
51
61
  );
52
62
  }
53
-
54
- DetailsSubTabs.defaultProps = {
55
- children: [],
56
- label: undefined,
57
- showLabel: true
58
- };
59
-
60
- DetailsSubTabs.propTypes = {
61
- children: PropTypes.arrayOf(PropTypes.node),
62
- showLabel: PropTypes.bool,
63
- label: PropTypes.string,
64
- getPConnect: PropTypes.func.isRequired
65
- };
@@ -1,11 +1,24 @@
1
1
  import React, { createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import Grid from '@material-ui/core/Grid';
4
3
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
5
 
7
- export default function DetailsThreeColumn(props) {
8
- const { label, showLabel, getPConnect, showHighlightedData } = props;
6
+ // import type { PConnProps } from '../../../../types/PConnProps';
7
+
8
+ // Can't use PConnProps until getPConnect().getChildren() type is ok
9
+ // interface DetailsThreeColumnProps extends PConnProps {
10
+ // // If any, enter additional props that only exist on this component
11
+ // showLabel: boolean,
12
+ // label: string,
13
+ // showHighlightedData: boolean
14
+ // }
15
+
16
+
17
+ export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */) {
18
+ // Get emitted components from map (so we can get any override that may exist)
19
+ const FieldGroup = getComponentFromMap('FieldGroup');
20
+
21
+ const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
9
22
 
10
23
  // Get the inherited props from the parent to determine label settings
11
24
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
@@ -37,7 +50,8 @@ export default function DetailsThreeColumn(props) {
37
50
  field.config.displayAsStatus = true;
38
51
  }
39
52
 
40
- return getPConnect().createComponent(field);
53
+ return getPConnect().createComponent(field,
54
+ '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
41
55
  });
42
56
  }
43
57
 
@@ -62,16 +76,3 @@ export default function DetailsThreeColumn(props) {
62
76
  </FieldGroup>
63
77
  );
64
78
  }
65
-
66
- DetailsThreeColumn.defaultProps = {
67
- label: undefined,
68
- showLabel: true,
69
- showHighlightedData: false
70
- };
71
-
72
- DetailsThreeColumn.propTypes = {
73
- showLabel: PropTypes.bool,
74
- label: PropTypes.string,
75
- getPConnect: PropTypes.func.isRequired,
76
- showHighlightedData: PropTypes.bool
77
- };
@@ -1,11 +1,25 @@
1
1
  import React, { createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import Grid from '@material-ui/core/Grid';
4
3
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
5
 
7
- export default function DetailsTwoColumn(props) {
8
- const { label, showLabel, getPConnect, showHighlightedData } = props;
6
+ // import type { PConnProps } from '../../../../types/PConnProps';
7
+
8
+
9
+ // Can't use PConnProps until getPConnect().getChildren() type is ok
10
+ // interface DetailsTwoColumnProps extends PConnProps {
11
+ // // If any, enter additional props that only exist on this component
12
+ // showLabel: boolean,
13
+ // label: string,
14
+ // showHighlightedData: boolean
15
+ // }
16
+
17
+
18
+ export default function DetailsTwoColumn(props /* : DetailsTwoColumnProps */) {
19
+ // Get emitted components from map (so we can get any override that may exist)
20
+ const FieldGroup = getComponentFromMap('FieldGroup');
21
+
22
+ const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
9
23
 
10
24
  // Get the inherited props from the parent to determine label settings
11
25
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
@@ -37,7 +51,8 @@ export default function DetailsTwoColumn(props) {
37
51
  field.config.displayAsStatus = true;
38
52
  }
39
53
 
40
- return getPConnect().createComponent(field);
54
+ return getPConnect().createComponent(field,
55
+ '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
41
56
  });
42
57
  }
43
58
 
@@ -62,16 +77,3 @@ export default function DetailsTwoColumn(props) {
62
77
  </FieldGroup>
63
78
  );
64
79
  }
65
-
66
- DetailsTwoColumn.defaultProps = {
67
- label: undefined,
68
- showLabel: true,
69
- showHighlightedData: false
70
- };
71
-
72
- DetailsTwoColumn.propTypes = {
73
- showLabel: PropTypes.bool,
74
- label: PropTypes.string,
75
- getPConnect: PropTypes.func.isRequired,
76
- showHighlightedData: PropTypes.bool
77
- };
@@ -1,21 +1,35 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
2
  import React, { useMemo } from 'react';
3
- import PropTypes from 'prop-types';
4
-
5
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
6
- import FieldGroupList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroupList';
7
3
  import { getReferenceList, buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
+
6
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+
8
+ interface FieldGroupTemplateProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ referenceList?: Array<any>,
11
+ contextClass: string,
12
+ renderMode?: string,
13
+ heading?: string,
14
+ lookForChildInConfig?: boolean,
15
+ displayMode?: string,
16
+ fieldHeader?: string,
17
+ allowTableEdit: boolean
18
+ }
8
19
 
9
- declare const PCore: any;
10
20
 
11
- export default function FieldGroupTemplate(props) {
21
+ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
22
+ // Get emitted components from map (so we can get any override that may exist)
23
+ const FieldGroup = getComponentFromMap('FieldGroup');
24
+ const FieldGroupList = getComponentFromMap('FieldGroupList');
25
+
12
26
  const {
13
- referenceList,
27
+ referenceList = [],
14
28
  renderMode,
15
29
  contextClass,
16
30
  getPConnect,
17
31
  lookForChildInConfig,
18
- heading,
32
+ heading = '',
19
33
  displayMode,
20
34
  fieldHeader,
21
35
  allowTableEdit: allowAddEdit
@@ -38,7 +52,7 @@ export default function FieldGroupTemplate(props) {
38
52
  if (PCore.getPCoreVersion()?.includes('8.7')) {
39
53
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length, pageReference);
40
54
  } else {
41
- pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
55
+ pConn.getListActions().insert({}, referenceList.length, null); // 3rd arg null until typedef marked correctly as optional
42
56
  }
43
57
  };
44
58
 
@@ -50,7 +64,7 @@ export default function FieldGroupTemplate(props) {
50
64
  if (PCore.getPCoreVersion()?.includes('8.7')) {
51
65
  pConn.getListActions().deleteEntry(index, pageReference);
52
66
  } else {
53
- pConn.getListActions().deleteEntry(index);
67
+ pConn.getListActions().deleteEntry(index, null); // 2nd arg null until typedef marked correctly as optional
54
68
  }
55
69
  };
56
70
  if (referenceList.length === 0 && allowAddEdit !== false) {
@@ -94,20 +108,3 @@ export default function FieldGroupTemplate(props) {
94
108
 
95
109
  return <div>{memoisedReadOnlyList}</div>;
96
110
  }
97
-
98
- FieldGroupTemplate.defaultProps = {
99
- referenceList: [],
100
- heading: undefined,
101
- contextClass: null,
102
- displayMode: undefined
103
- };
104
-
105
- FieldGroupTemplate.propTypes = {
106
- referenceList: PropTypes.arrayOf(Object),
107
- contextClass: PropTypes.string,
108
- getPConnect: PropTypes.func.isRequired,
109
- renderMode: PropTypes.string.isRequired,
110
- heading: PropTypes.string,
111
- lookForChildInConfig: PropTypes.bool,
112
- displayMode: PropTypes.string
113
- };
@@ -1,7 +1,16 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { Grid, Typography } from '@material-ui/core';
4
3
  import { makeStyles } from '@material-ui/core/styles';
4
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+
6
+ // InlineDashboard does NOT have getPConnect. So, no need to extend from PConnProps
7
+ interface InlineDashboardProps extends PConnProps {
8
+ // If any, enter additional props that only exist on this component
9
+ children: Array<any>,
10
+ title: string,
11
+ filterPosition?: string
12
+ }
13
+
5
14
 
6
15
  const useStyles = makeStyles((/* theme */) => ({
7
16
  headerStyles: {
@@ -30,7 +39,7 @@ const useStyles = makeStyles((/* theme */) => ({
30
39
  }
31
40
  }));
32
41
 
33
- export default function InlineDashboard(props) {
42
+ export default function InlineDashboard(props: InlineDashboardProps) {
34
43
  const classes = useStyles();
35
44
 
36
45
  const { children, title, filterPosition } = props;
@@ -65,8 +74,3 @@ export default function InlineDashboard(props) {
65
74
  </>
66
75
  );
67
76
  }
68
-
69
- InlineDashboard.propTypes = {
70
- children: PropTypes.arrayOf(PropTypes.node).isRequired
71
- // template: PropTypes.string.isRequired
72
- };
@@ -1,12 +1,27 @@
1
1
  import React from 'react';
2
2
  import { useMemo, Children, useEffect, useState } from 'react';
3
- import PropTypes from 'prop-types';
4
3
 
5
4
  import { buildFilterComponents } from '@pega/react-sdk-components/lib/components/infra/DashboardFilter/filterUtils';
6
- import InlineDashboard from '@pega/react-sdk-components/lib/components/template/InlineDashboard';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
6
 
8
- export default function InlineDashboardPage(props) {
9
- const { children, getPConnect } = props;
7
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+
9
+
10
+ interface InlineDashboardPageProps extends PConnProps {
11
+ // If any, enter additional props that only exist on this component
12
+ children: Array<any>,
13
+ title: string,
14
+ icon?: string,
15
+ filterPosition?: string
16
+ }
17
+
18
+
19
+ export default function InlineDashboardPage(props: InlineDashboardPageProps) {
20
+ // Get emitted components from map (so we can get any override that may exist)
21
+ const InlineDashboard = getComponentFromMap("InlineDashboard");
22
+
23
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
24
+ const { children, getPConnect, icon = '', filterPosition = 'block-start' } = props;
10
25
  const [filterComponents, setFilterComponents] = useState([]);
11
26
  const childArray = useMemo(() => {
12
27
  return Children.toArray(children);
@@ -26,16 +41,3 @@ export default function InlineDashboardPage(props) {
26
41
 
27
42
  return <InlineDashboard {...inlineProps} />;
28
43
  }
29
-
30
- InlineDashboardPage.propTypes = {
31
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
32
- getPConnect: PropTypes.func.isRequired,
33
- title: PropTypes.string.isRequired,
34
- icon: PropTypes.string,
35
- filterPosition: PropTypes.string
36
- };
37
-
38
- InlineDashboardPage.defaultProps = {
39
- icon: '',
40
- filterPosition: 'block-start'
41
- };