@pega/react-sdk-overrides 0.23.26 → 8.8.21

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 +191 -186
  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,25 @@
1
1
  import React, { useCallback, useMemo, useState, createElement, Fragment } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import Button from '@material-ui/core/Button';
4
3
 
5
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
6
- import ListView from '@pega/react-sdk-components/lib/components/template/ListView';
7
- import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
+ import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
6
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
7
  import './PromotedFilters.css';
9
8
 
10
- declare const PCore;
9
+ // import type { PConnProps } from '../../../types/PConnProps';
10
+
11
+ // Can't use PromotedFilterProps until getContainerManager() knows about addTransientItem
12
+ // Currently just expects "object"
13
+ // interface PromotedFilterProps extends PConnProps {
14
+ // // If any, enter additional props that only exist on this component
15
+ // viewName: string,
16
+ // filters: Array<any>,
17
+ // listViewProps: any,
18
+ // pageClass: string,
19
+ // parameters?: object
20
+ // }
21
+
22
+
11
23
  const localeCategory = 'SimpleTable';
12
24
  const SUPPORTED_TYPES_IN_PROMOTED_FILTERS = [
13
25
  'TextInput',
@@ -55,7 +67,10 @@ function isValidInput(input) {
55
67
  return Object.values(input).findIndex((v) => v) >= 0;
56
68
  }
57
69
 
58
- export default function PromotedFilters(props) {
70
+ export default function PromotedFilters(props /* : PromotedFilterProps */) {
71
+ // Get emitted components from map (so we can get any override that may exist)
72
+ const ListView = getComponentFromMap('ListView');
73
+
59
74
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
60
75
  const { getPConnect, viewName, filters, listViewProps, pageClass, parameters } = props;
61
76
  const [initTable, setInitTable] = useState(false);
@@ -112,7 +127,7 @@ export default function PromotedFilters(props) {
112
127
  dataViewParameters: parameters
113
128
  };
114
129
 
115
- if (!Utils.isEmptyObject(promotedFilters)) {
130
+ if (!isEmptyObject(promotedFilters)) {
116
131
  Query.query = { filter: { filterConditions: promotedFilters } };
117
132
  }
118
133
  setPayload(Query);
@@ -135,10 +150,10 @@ export default function PromotedFilters(props) {
135
150
  </div>
136
151
  <div>
137
152
  <Button key='1' type='button' onClick={clearFilterData} data-testid='clear' variant='contained' color='primary'>
138
- {localizedVal('Clear', localeCategory)}
153
+ {localizedVal('Clear', localeCategory)}
139
154
  </Button>
140
155
  <Button style={{float: 'right'}} key='2' type='submit' onClick={getFilterData} data-testid='search' variant='contained' color='primary'>
141
- {localizedVal('Search', localeCategory)}
156
+ {localizedVal('Search', localeCategory)}
142
157
  </Button>
143
158
  </div>
144
159
  {initTable && <ListView {...listViewProps} title='' payload={payload}
@@ -150,12 +165,3 @@ export default function PromotedFilters(props) {
150
165
  </Fragment>
151
166
  );
152
167
  }
153
-
154
- PromotedFilters.propTypes = {
155
- getPConnect: PropTypes.func.isRequired,
156
- viewName: PropTypes.string.isRequired,
157
- filters: PropTypes.arrayOf(PropTypes.object).isRequired,
158
- listViewProps: PropTypes.objectOf(PropTypes.any).isRequired,
159
- pageClass: PropTypes.string.isRequired,
160
- parameters: PropTypes.object
161
- };
@@ -1,23 +1,120 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
1
2
  import React from 'react';
2
- import FieldGroupTemplate from '@pega/react-sdk-components/lib/components/template/FieldGroupTemplate';
3
- import SimpleTableManual from '@pega/react-sdk-components/lib/components/template/SimpleTable/SimpleTableManual';
3
+ import { buildMetaForListView, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
4
+ import { useRef } from 'react';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
6
 
7
+ // import type { PConnProps } from '../../../../types/PConnProps';
8
+
9
+ // Can't use SimpleTableProps until getComponentConfig() and getFieldMetadata() are NOT private
10
+ // interface SimpleTableProps extends PConnProps {
11
+ // // If any, enter additional props that only exist on this component
12
+ // multiRecordDisplayAs: string,
13
+ // allowTableEdit: boolean,
14
+ // contextClass: any
15
+ // }
5
16
  declare const PCore: any;
6
17
 
7
- export default function SimpleTable(props) {
8
- const { getPConnect, multiRecordDisplayAs, allowTableEdit } = props;
18
+ export default function SimpleTable(props /* : SimpleTableProps */) {
19
+ // Get emitted components from map (so we can get any override that may exist)
20
+ const ListView = getComponentFromMap('ListView');
21
+ const FieldGroupTemplate = getComponentFromMap('FieldGroupTemplate');
22
+ const SimpleTableManual = getComponentFromMap('SimpleTableManual');
23
+
24
+ const {
25
+ getPConnect,
26
+ multiRecordDisplayAs,
27
+ allowTableEdit,
28
+ label: labelProp,
29
+ propertyLabel,
30
+ displayMode,
31
+ fieldMetadata,
32
+ hideLabel,
33
+ parameters,
34
+ isDataObject,
35
+ type,
36
+ ruleClass,
37
+ authorContext,
38
+ name
39
+ } = props;
9
40
 
10
41
  let { contextClass } = props;
11
42
  if (!contextClass) {
12
43
  let listName = getPConnect().getComponentConfig().referenceList;
13
44
  listName = PCore.getAnnotationUtils().getPropertyName(listName);
14
- contextClass = getPConnect().getFieldMetadata(listName)?.pageClass;
45
+ // was... contextClass = getPConnect().getFieldMetadata(listName)?.pageClass;
46
+ const theFieldMetadata = getPConnect().getFieldMetadata(listName);
47
+ if (theFieldMetadata) {
48
+ contextClass = theFieldMetadata['pageClass'];
49
+ } else {
50
+ contextClass = undefined;
51
+ }
15
52
  }
16
53
  if (multiRecordDisplayAs === 'fieldGroup') {
17
54
  const fieldGroupProps = { ...props, contextClass };
18
55
  return <FieldGroupTemplate {...fieldGroupProps} />;
56
+ }
57
+
58
+ const label = labelProp || propertyLabel;
59
+ const propsToUse = { label, ...getPConnect().getInheritedProps() };
60
+ const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
61
+
62
+ if (
63
+ fieldMetadata &&
64
+ fieldMetadata.type === 'Page List' &&
65
+ fieldMetadata.dataRetrievalType === 'refer'
66
+ ) {
67
+ const {
68
+ children: [{ children: rawFields }],
69
+ parameters: rawParams
70
+ } = getPConnect().getRawMetadata().config;
71
+ if (isDisplayModeEnabled && hideLabel) {
72
+ propsToUse.label = '';
73
+ }
74
+
75
+ const metaForListView = buildMetaForListView(
76
+ fieldMetadata,
77
+ rawFields,
78
+ type,
79
+ ruleClass,
80
+ name,
81
+ propsToUse.label,
82
+ isDataObject,
83
+ parameters // resolved params
84
+ );
85
+
86
+ const metaForPConnect = JSON.parse(JSON.stringify(metaForListView));
87
+ metaForPConnect.config.parameters =
88
+ rawParams ?? PCore.getMetadataUtils().getPropertyMetadata(name)?.datasource?.parameters;
89
+
90
+ const { referenceListStr: referenceList } = getContext(getPConnect());
91
+ let requiredContextForQueryInDisplayMode = {};
92
+ if (isDisplayModeEnabled) {
93
+ requiredContextForQueryInDisplayMode = {
94
+ referenceList
95
+ };
96
+ }
97
+ const options = {
98
+ context: getPConnect().getContextName(),
99
+ pageReference: getPConnect().getPageReference(),
100
+ ...requiredContextForQueryInDisplayMode
101
+ };
102
+
103
+ const refToPConnect = useRef(
104
+ PCore.createPConnect({ meta: metaForPConnect, options }).getPConnect
105
+ ).current; // getPConnect should be created only once.
106
+ /* BUG-637178 : need to send context */
107
+ const listViewProps = {
108
+ ...metaForListView.config,
109
+ getPConnect: refToPConnect,
110
+ displayMode,
111
+ fieldName: authorContext,
112
+ bInForm: true
113
+ };
114
+ const listViewComponent = <ListView {...listViewProps} />;
115
+ return listViewComponent;
19
116
  } else {
20
- const simpleTableManualProps = {...props, contextClass};
117
+ const simpleTableManualProps = { ...props, contextClass };
21
118
  if (allowTableEdit === false) {
22
119
  simpleTableManualProps.hideAddRow = true;
23
120
  simpleTableManualProps.hideDeleteRow = true;
@@ -31,6 +31,26 @@ import Select from '@material-ui/core/Select';
31
31
  import Button from '@material-ui/core/Button';
32
32
  import TextField from '@material-ui/core/TextField';
33
33
 
34
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
35
+
36
+ interface SimpleTableManualProps extends PConnProps {
37
+ // If any, enter additional props that only exist on this component
38
+ hideAddRow?: boolean,
39
+ hideDeleteRow?: boolean,
40
+ // eslint-disable-next-line react/no-unused-prop-types
41
+ disableDragDrop?: boolean
42
+ referenceList?: Array<any>,
43
+ children?: Array<any>,
44
+ renderMode?: string,
45
+ presets?: Array<any>,
46
+ label?: string,
47
+ showLabel?: boolean,
48
+ dataPageName?: string,
49
+ contextClass?: string,
50
+ propertyLabel?: string,
51
+ fieldMetadata?: any
52
+ }
53
+
34
54
  const useStyles = makeStyles((/* theme */) => ({
35
55
  label: {
36
56
  margin: '8px'
@@ -58,7 +78,6 @@ const useStyles = makeStyles((/* theme */) => ({
58
78
  }
59
79
  }));
60
80
 
61
- declare const PCore: any;
62
81
 
63
82
  let menuColumnId = '';
64
83
  let menuColumnType = '';
@@ -66,7 +85,9 @@ let menuColumnLabel = '';
66
85
 
67
86
  const filterByColumns: Array<any> = [];
68
87
  let myRows: Array<any>;
69
- export default function SimpleTableManual(props) {
88
+
89
+
90
+ export default function SimpleTableManual(props: SimpleTableManualProps) {
70
91
  const classes = useStyles();
71
92
  const {
72
93
  getPConnect,
@@ -113,7 +134,7 @@ export default function SimpleTableManual(props) {
113
134
  const resolvedList = getReferenceList(pConn);
114
135
  const pageReference = `${pConn.getPageReference()}${resolvedList}`;
115
136
  pConn.setReferenceList(resolvedList);
116
- const menuIconOverride$ = Utils.getImageSrc('trash', PCore.getAssetLoader().getStaticServerUrl());
137
+ const menuIconOverride$ = Utils.getImageSrc('trash', Utils.getSDKStaticConentUrl());
117
138
 
118
139
  const resolvedFields = children?.[0]?.children || presets?.[0].children?.[0].children;
119
140
  // NOTE: props has each child.config with datasource and value undefined
@@ -186,8 +207,8 @@ export default function SimpleTableManual(props) {
186
207
  };
187
208
 
188
209
  function generateRowsData() {
189
- // if dataPageName property value exists then make a datapage fetch call and get the list of data.
190
- if (dataPageName) {
210
+ // if referenceList is empty and dataPageName property value exists then make a datapage fetch call and get the list of data.
211
+ if (!referenceList.length && dataPageName) {
191
212
  getDataPage(dataPageName, parameters, context).then(listData => {
192
213
  const data = formatRowsData(listData);
193
214
  myRows = data;
@@ -231,7 +252,7 @@ export default function SimpleTableManual(props) {
231
252
  if (PCore.getPCoreVersion()?.includes('8.7')) {
232
253
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length, pageReference);
233
254
  } else {
234
- pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
255
+ pConn.getListActions().insert({ classID: contextClass }, referenceList.length, ''); // 3rd arg null until typedef marked correctly as optional
235
256
  }
236
257
  };
237
258
 
@@ -239,7 +260,7 @@ export default function SimpleTableManual(props) {
239
260
  if (PCore.getPCoreVersion()?.includes('8.7')) {
240
261
  pConn.getListActions().deleteEntry(index, pageReference);
241
262
  } else {
242
- pConn.getListActions().deleteEntry(index);
263
+ pConn.getListActions().deleteEntry(index, ''); // 2nd arg empty string until typedef marked correctly as optional
243
264
  }
244
265
  };
245
266
 
@@ -1,21 +1,39 @@
1
- import PropTypes from 'prop-types';
2
1
  import React from "react";
3
- import ListView from '@pega/react-sdk-components/lib/components/template/ListView';
4
- import SimpleTable from '@pega/react-sdk-components/lib/components/template/SimpleTable/SimpleTable';
2
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
+
4
+ // import type { PConnProps } from '../../../../types/PConnProps';
5
+
6
+ // Need to fix an error noted in comment below before typedefs will work correctly
7
+ // interface SimpleTableSelectProps extends PConnProps {
8
+ // // If any, enter additional props that only exist on this component
9
+ // label: string,
10
+ // referenceList: Array<object> | string,
11
+ // renderMode: string,
12
+ // showLabel: boolean,
13
+ // promptedFilters: Array<object>,
14
+ // viewName: string,
15
+ // parameters: any,
16
+ // readonlyContextList: Array<object> | string,
17
+ // dataRelationshipContext: string
18
+ // }
5
19
 
6
- import PromotedFilters from '@pega/react-sdk-components/lib/components/template/PromotedFilters';
7
20
 
8
21
  const isSelfReferencedProperty = (param, referenceProp) => {
9
22
  const [, parentPropName] = param.split('.');
10
23
  return parentPropName === referenceProp;
11
24
  };
12
- declare const PCore;
25
+
13
26
  /**
14
27
  * SimpleTable react component
15
28
  * @param {*} props - props
16
29
  */
17
- export default function SimpleTableSelect(props) {
18
- const { label, getPConnect, renderMode, showLabel, viewName, parameters, dataRelationshipContext } = props;
30
+ export default function SimpleTableSelect(props /* : SimpleTableSelectProps */) {
31
+ // Get emitted components from map (so we can get any override that may exist)
32
+ const ListView = getComponentFromMap('ListView');
33
+ const SimpleTable = getComponentFromMap('SimpleTable');
34
+ const PromotedFilters = getComponentFromMap('PromotedFilters');
35
+
36
+ const { label, getPConnect, renderMode = '', showLabel = true, viewName = '', parameters, dataRelationshipContext = null } = props;
19
37
 
20
38
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
21
39
  if (propsToUse.showLabel === false) {
@@ -40,6 +58,7 @@ export default function SimpleTableSelect(props) {
40
58
  contextPageReference = pageReference.concat('.').concat(referenceProp);
41
59
  }
42
60
 
61
+ // Need to get this written so typedefs work
43
62
  const { datasource: { parameters: fieldParameters = {} } = {}, pageClass } = isMultiSelectMode
44
63
  ? pConn.getFieldMetadata(`@P .${referenceProp}`)
45
64
  : pConn.getCurrentPageFieldMetadata(contextPageReference);
@@ -104,27 +123,3 @@ export default function SimpleTableSelect(props) {
104
123
  }
105
124
  return <ListView {...listViewProps} />;
106
125
  }
107
-
108
- SimpleTableSelect.defaultProps = {
109
- label: undefined,
110
- renderMode: '',
111
- showLabel: true,
112
- promptedFilters: [],
113
- viewName: '',
114
- parameters: undefined,
115
- readonlyContextList: [],
116
- dataRelationshipContext: null
117
- };
118
-
119
- SimpleTableSelect.propTypes = {
120
- label: PropTypes.string,
121
- getPConnect: PropTypes.func.isRequired,
122
- referenceList: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.string]).isRequired,
123
- renderMode: PropTypes.string,
124
- showLabel: PropTypes.bool,
125
- promptedFilters: PropTypes.arrayOf(PropTypes.object),
126
- viewName: PropTypes.string,
127
- parameters: PropTypes.objectOf(PropTypes.any),
128
- readonlyContextList: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.string]),
129
- dataRelationshipContext: PropTypes.string
130
- };
@@ -1,18 +1,35 @@
1
- import PropTypes from "prop-types";
1
+ import React from "react";
2
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
2
3
 
3
- export default function SingleReferenceReadOnly(props) {
4
+ // Need to fix an error noted in comment below before typedefs will work correctly
5
+ interface SingleReferenceReadOnlyProps extends PConnProps {
6
+ // If any, enter additional props that only exist on this component
7
+ config: any,
8
+ displayAs?: string,
9
+ ruleClass?: string,
10
+ label?: string,
11
+ displayMode?: string,
12
+ type: string,
13
+ referenceType?: string,
14
+ hideLabel?: boolean,
15
+ dataRelationshipContext?: string
16
+ }
17
+
18
+
19
+ export default function SingleReferenceReadOnly(props: SingleReferenceReadOnlyProps) {
4
20
  const {
5
21
  getPConnect,
6
- displayAs,
7
- ruleClass,
8
- label,
9
- type,
10
- displayMode,
11
- referenceType,
12
- hideLabel,
13
- dataRelationshipContext,
22
+ displayAs = '',
23
+ ruleClass = '',
24
+ label = '',
25
+ type = '',
26
+ displayMode = '',
27
+ referenceType = '',
28
+ hideLabel = false,
29
+ dataRelationshipContext = null,
14
30
  config
15
31
  } = props;
32
+
16
33
  const editableComponents = ["AutoComplete", "SimpleTableSelect", "Dropdown"];
17
34
 
18
35
  if (editableComponents.includes(type)) {
@@ -28,7 +45,7 @@ export default function SingleReferenceReadOnly(props) {
28
45
  };
29
46
  }
30
47
 
31
- return getPConnect().createComponent({
48
+ const component = getPConnect().createComponent({
32
49
  type: 'SemanticLink',
33
50
  config: {
34
51
  ...config,
@@ -38,29 +55,10 @@ export default function SingleReferenceReadOnly(props) {
38
55
  hideLabel,
39
56
  dataRelationshipContext
40
57
  }
41
- });
42
- }
43
-
44
- SingleReferenceReadOnly.defaultProps = {
45
- displayAs: "",
46
- ruleClass: "",
47
- label: "",
48
- displayMode: "",
49
- type: "",
50
- referenceType: "",
51
- hideLabel: false,
52
- dataRelationshipContext: null
53
- };
58
+ },
59
+ null, null, {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
54
60
 
55
- SingleReferenceReadOnly.propTypes = {
56
- config: PropTypes.object,
57
- getPConnect: PropTypes.func.isRequired,
58
- displayAs: PropTypes.string,
59
- ruleClass: PropTypes.string,
60
- label: PropTypes.string,
61
- displayMode: PropTypes.string,
62
- type: PropTypes.string,
63
- referenceType: PropTypes.string,
64
- hideLabel: PropTypes.bool,
65
- dataRelationshipContext: PropTypes.string
66
- };
61
+ return (
62
+ <React.Fragment>{component}</React.Fragment>
63
+ )
64
+ }
@@ -1,11 +1,18 @@
1
1
  import React, { Fragment, useEffect, useState } from "react";
2
- import PropTypes from "prop-types";
3
2
  import { Tab, Tabs } from "@material-ui/core";
4
3
  import { TabContext, TabPanel } from '@material-ui/lab';
5
4
  import { getTransientTabs, getVisibleTabs, tabClick } from './tabUtils';
6
5
 
7
- export default function SubTabs(props) {
8
- const { children } = props;
6
+ // SubTabs does NOT have getPConnect. So, no need to extend from PConnProps
7
+
8
+ interface SubTabsProps {
9
+ // If any, enter additional props that only exist on this component
10
+ children: Array<any>
11
+ }
12
+
13
+
14
+ export default function SubTabs(props: SubTabsProps) {
15
+ const { children = [] } = props;
9
16
 
10
17
  const defaultTabIndex = 0;
11
18
  const deferLoadedTabs = children[0];
@@ -55,11 +62,3 @@ export default function SubTabs(props) {
55
62
  </Fragment>
56
63
  );
57
64
  }
58
-
59
- SubTabs.defaultProps = {
60
- children: []
61
- }
62
-
63
- SubTabs.propTypes = {
64
- children: PropTypes.arrayOf(PropTypes.node)
65
- };
@@ -1,6 +1,4 @@
1
1
 
2
- declare const PCore;
3
-
4
2
  export const getDeferFriendlyTabs = allTabs => {
5
3
  return allTabs.map(tab => {
6
4
  const theTabCompConfig = tab.getPConnect().getConfigProps();
@@ -1,8 +1,15 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
  import { Grid, GridSize } from "@material-ui/core";
4
3
  import { makeStyles } from '@material-ui/core/styles';
5
4
 
5
+ // TwoColumn does NOT have getPConnect. So, no need to extend from PConnProps
6
+ interface TwoColumnProps {
7
+ // If any, enter additional props that only exist on this component
8
+ children: Array<any>,
9
+ templateCol?: string
10
+ }
11
+
12
+
6
13
  const useStyles = makeStyles(() => ({
7
14
  colStyles: {
8
15
  display: "grid",
@@ -11,10 +18,10 @@ const useStyles = makeStyles(() => ({
11
18
  },
12
19
  }));
13
20
 
14
- export default function TwoColumn(props) {
21
+ export default function TwoColumn(props: TwoColumnProps) {
15
22
  const classes = useStyles();
16
23
 
17
- const {children, templateCol} = props;
24
+ const {children, templateCol = '1fr 1fr' } = props;
18
25
 
19
26
  if (children.length !== 2) {
20
27
  // eslint-disable-next-line no-console
@@ -44,15 +51,3 @@ export default function TwoColumn(props) {
44
51
  </Grid>
45
52
  )
46
53
  }
47
-
48
- TwoColumn.propTypes = {
49
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
50
- // title: PropTypes.string,
51
- templateCol: PropTypes.string,
52
- // icon: PropTypes.string
53
- };
54
-
55
- TwoColumn.defaultProps = {
56
- templateCol: "1fr 1fr",
57
- // icon: ""
58
- };
@@ -1,13 +1,20 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
2
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
+
4
+ // TwoColumnPage does NOT have getPConnect. So, no need to extend from PConnProps
5
+ interface TwoColumnPageProps{
6
+ // If any, enter additional props that only exist on this component
7
+ children: Array<any>
8
+ }
3
9
 
4
- import TwoColumn from '@pega/react-sdk-components/lib/components/template/TwoColumn/TwoColumn';
5
10
 
6
11
  /*
7
12
  * The wrapper handles knowing how to take in just children
8
13
  * and mapping to the TwoColumn template.
9
14
  */
10
- export default function TwoColumnPage(props) {
15
+ export default function TwoColumnPage(props: TwoColumnPageProps) {
16
+ // Get emitted components from map (so we can get any override that may exist)
17
+ const TwoColumn = getComponentFromMap('TwoColumn');
11
18
 
12
19
  return (
13
20
  <TwoColumn
@@ -15,10 +22,3 @@ export default function TwoColumnPage(props) {
15
22
  />
16
23
  );
17
24
  }
18
-
19
- TwoColumnPage.propTypes = {
20
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
21
- };
22
-
23
- TwoColumnPage.defaultProps = {
24
- };
@@ -1,8 +1,15 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
  import { Grid, GridSize } from "@material-ui/core";
4
3
  import { makeStyles } from '@material-ui/core/styles';
5
4
 
5
+ // TwoColumnTab does NOT have getPConnect. So, no need to extend from PConnProps
6
+ interface TwoColumnTabProps {
7
+ // If any, enter additional props that only exist on this component
8
+ children: Array<any>,
9
+ templateCol?: string
10
+ }
11
+
12
+
6
13
  const useStyles = makeStyles(() => ({
7
14
  colStyles: {
8
15
  display: "grid",
@@ -11,10 +18,10 @@ const useStyles = makeStyles(() => ({
11
18
  },
12
19
  }));
13
20
 
14
- export default function TwoColumnTab(props) {
21
+ export default function TwoColumnTab(props:TwoColumnTabProps) {
15
22
  const classes = useStyles();
16
23
 
17
- const {children, templateCol} = props;
24
+ const {children, templateCol = '1fr 1fr'} = props;
18
25
 
19
26
  if (children.length !== 2) {
20
27
  // eslint-disable-next-line no-console
@@ -44,12 +51,3 @@ export default function TwoColumnTab(props) {
44
51
  </Grid>
45
52
  )
46
53
  }
47
-
48
- TwoColumnTab.propTypes = {
49
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
50
- templateCol: PropTypes.string,
51
- };
52
-
53
- TwoColumnTab.defaultProps = {
54
- templateCol: "1fr 1fr",
55
- };
@@ -1,10 +1,24 @@
1
1
  import React from "react";
2
-
3
2
  import './WideNarrow.css';
4
3
 
5
- export default function WideNarrow(props) {
4
+ // WideNarrow does NOT have getPConnect. So, no need to extend from PConnProps
5
+ interface WideNarrowProps {
6
+ // If any, enter additional props that only exist on this component
7
+ a: any,
8
+ b: any,
9
+ children?: Array<any>,
10
+ // eslint-disable-next-line react/no-unused-prop-types
11
+ title?: string,
12
+ // eslint-disable-next-line react/no-unused-prop-types
13
+ cols?: string,
14
+ // eslint-disable-next-line react/no-unused-prop-types
15
+ icon?: string
16
+ }
17
+
18
+
19
+ export default function WideNarrow(props: WideNarrowProps) {
6
20
  // const {a, b /*, cols, icon, title */ } = props;
7
- const { a, b, children } = props;
21
+ const { a, b, children = [] } = props;
8
22
 
9
23
  return (
10
24
  <React.Fragment>