@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,6 +1,8 @@
1
- /* eslint-disable no-undef */
2
1
  import getDefaultViewMeta from './DefaultViewMeta';
3
2
 
3
+ // Remove this and use "real" PCore type once .d.ts is fixed (currently shows 5 errors)
4
+ declare const PCore: any;
5
+
4
6
  const USER_REFERENCE = 'UserReference';
5
7
  const PAGE = '!P!';
6
8
  const PAGELIST = '!PL!';
@@ -11,13 +13,49 @@ export const formatConstants = {
11
13
  WorkLink: 'WorkLink',
12
14
  };
13
15
 
16
+ class DataApi {
17
+ mappedPropertyToOriginalProperty: any;
18
+ originalPropertyToMappedProperty: any;
19
+ constructor() {
20
+ ;
21
+ this.originalPropertyToMappedProperty = {};
22
+ this.mappedPropertyToOriginalProperty = {};
23
+ this.setPropertyMaps = this.setPropertyMaps.bind(this);
24
+ this.getMappedProperty = this.getMappedProperty.bind(this);
25
+ this.getOriginalProperty = this.getOriginalProperty.bind(this);
26
+ }
27
+
28
+ setPropertyMaps(originalToMappedPropertyObj = {}, mappedToOriginalPropertyObj = {}) {
29
+ this.originalPropertyToMappedProperty = {
30
+ ...this.originalPropertyToMappedProperty,
31
+ ...originalToMappedPropertyObj
32
+ };
33
+ this.mappedPropertyToOriginalProperty = {
34
+ ...this.mappedPropertyToOriginalProperty,
35
+ ...mappedToOriginalPropertyObj
36
+ };
37
+ }
38
+
39
+ getMappedProperty(propertyName) {
40
+ return this.originalPropertyToMappedProperty[propertyName] ?? propertyName;
41
+ }
42
+
43
+ getOriginalProperty(propertyName) {
44
+ return this.mappedPropertyToOriginalProperty[propertyName] ?? propertyName;
45
+ }
46
+ }
47
+
14
48
  export async function getContext(componentConfig) {
15
49
  const {
16
50
  promisesArray = [], // array of promises which can be invoked paralelly,
17
51
  } = componentConfig;
18
52
  const promisesResponseArray = await Promise.all(promisesArray);
53
+ const dataApi = new DataApi();
19
54
  return {
20
55
  promisesResponseArray,
56
+ setPropertyMaps: dataApi.setPropertyMaps,
57
+ getMappedProperty: dataApi.getMappedProperty,
58
+ getOriginalProperty: dataApi.getOriginalProperty,
21
59
  };
22
60
  }
23
61
 
@@ -32,7 +70,7 @@ export async function getContext(componentConfig) {
32
70
  * getFieldNameFromEmbeddedFieldName('!P!Organisation:Name') return 'Organisation.Name'
33
71
  * getFieldNameFromEmbeddedFieldName('!PL!Employees:Name') return 'Employees.Name'
34
72
  */
35
- export function getFieldNameFromEmbeddedFieldName(propertyName) {
73
+ export function getFieldNameFromEmbeddedFieldName(propertyName) {
36
74
  let value = propertyName;
37
75
  if (value.startsWith(PAGE) || value.startsWith(PAGELIST)) {
38
76
  value = value.substring(value.lastIndexOf('!') + 1);
@@ -47,7 +85,7 @@ export async function getContext(componentConfig) {
47
85
  * @ignore
48
86
  * @param {Array} metaFields Fields metadata Array. Contains metadata of all the fields.
49
87
  */
50
- export function updateMetaEmbeddedFieldID(metaFields) {
88
+ export function updateMetaEmbeddedFieldID(metaFields) {
51
89
  return metaFields.forEach((metaField) => {
52
90
  if (metaField.fieldID?.startsWith(PAGE) || metaField.fieldID?.startsWith(PAGELIST)) {
53
91
  metaField.fieldID = getFieldNameFromEmbeddedFieldName(metaField.fieldID);
@@ -63,6 +101,94 @@ export const isEmbeddedField = (field) => {
63
101
  return field?.indexOf('.') > 0;
64
102
  };
65
103
 
104
+ /**
105
+ * [isPageListProperty]
106
+ * Description - checking if propertyName is pageList or not
107
+ * @ignore
108
+ * @param {string} propertyName PropertyName
109
+ * @returns {boolean} true if property is pageList else false
110
+ *
111
+ * @example <caption>Example for isPageListProperty </caption>
112
+ * isPageListProperty('!PL!Employees.Name') return true
113
+ * isPageListProperty('!P!Employees.Name') return false
114
+ * isPageListProperty('Name') return false
115
+ */
116
+ export function isPageListProperty(propertyName) {
117
+ return propertyName.startsWith(PAGELIST);
118
+ }
119
+
120
+ export const isPageListInPath = (propertyName, currentClassID) => {
121
+ if (!propertyName.includes('.')) {
122
+ return false;
123
+ }
124
+ const [first, ...rest] = propertyName.split('.');
125
+ const metadata = PCore.getMetadataUtils().getPropertyMetadata(first, currentClassID);
126
+ if (metadata?.type === 'Page List') {
127
+ return true;
128
+ }
129
+ return isPageListInPath(rest.join('.'), metadata?.pageClass);
130
+ };
131
+
132
+ /**
133
+ * [getEmbeddedFieldName]
134
+ * Description - converting normal field name to embedded field starting with !P! or !PL!
135
+ * @ignore
136
+ * @param {string} propertyName Field name
137
+ * @param {string} classID classID of datapage
138
+ * @returns {string} returns converted string with !P! or !PL! and :
139
+ *
140
+ * @example <caption>Example for getEmbeddedFieldName </caption>
141
+ * For page property, getEmbeddedFieldName('Organisation.Name') return '!P!Organisation:Name'
142
+ * For pageList property, getEmbeddedFieldName('Employees.Name') return '!PL!Employees:Name'
143
+ */
144
+
145
+ export function getEmbeddedFieldName(propertyName, classID) {
146
+ let value = propertyName;
147
+ if (isPageListInPath(value, classID)) {
148
+ value = `!PL!${value.replace(/\./g, ':')}`;
149
+ } else {
150
+ value = `!P!${value.replace(/\./g, ':')}`;
151
+ }
152
+ return value;
153
+ }
154
+
155
+ /**
156
+ * [preparePropertyMaps]
157
+ * Description - preparing maps for property names and set it in dataApi context
158
+ * @ignore
159
+ * @param {Array} fields fields array
160
+ * @param {string} classID classID of datapage
161
+ * @param {string} context dataApi context
162
+ * @returns {boolean} true if pageListProperty is present
163
+ */
164
+ export function preparePropertyMaps(fields, classID, context) {
165
+ const { setPropertyMaps } = context;
166
+ const maps = fields.reduce(
167
+ (acc, field) => {
168
+ let { value } = field.config;
169
+ if (value.startsWith('@')) {
170
+ value = value.substring(value.indexOf(' ') + 1);
171
+ if (value[0] === '.') value = value.substring(1);
172
+ }
173
+ let name = value;
174
+ // Preparing name for embedded property
175
+ if (isEmbeddedField(name)) {
176
+ name = getEmbeddedFieldName(name, classID);
177
+ }
178
+ if (isPageListProperty(name) && !acc[2]) {
179
+ acc[2] = true;
180
+ }
181
+ acc[0][value] = name;
182
+ acc[1][name] = value;
183
+
184
+ return acc;
185
+ },
186
+ [{}, {}, false]
187
+ );
188
+ setPropertyMaps(maps[0], maps[1]);
189
+ return maps[2];
190
+ }
191
+
66
192
  /**
67
193
  * [getConfigEmbeddedFieldsMeta]
68
194
  * Description - Get the metadata for configured embedded fields
@@ -72,7 +198,7 @@ export const isEmbeddedField = (field) => {
72
198
  * @returns {Array} Metadata of configured embedded fields
73
199
  */
74
200
  export function getConfigEmbeddedFieldsMeta(configFields, classID) {
75
- const configEmbeddedFieldsMeta = [];
201
+ const configEmbeddedFieldsMeta: Array<any> = [];
76
202
  configFields.forEach((field) => {
77
203
  let value = field;
78
204
  if (isEmbeddedField(value)) {
@@ -115,7 +241,7 @@ const oldToNewFieldTypeMapping = {
115
241
  * @ignore
116
242
  * @param {Array} metaFields Fields metadata Array. Contains metadata of all the fields.
117
243
  */
118
- function updateFieldType(metaFields) {
244
+ function updateFieldType(metaFields) {
119
245
  metaFields.forEach((metaField) => {
120
246
  if (metaField.type) metaField.type = oldToNewFieldTypeMapping[metaField.type] || metaField.type;
121
247
  });
@@ -141,7 +267,7 @@ function getPresetMetaAttribute(attribute) {
141
267
  * @param {string} classID Class ID from the response
142
268
  * @returns {Array} List of fields with updated meta objects.
143
269
  */
144
- function generateViewMetaData(rawFields, classID, showField) {
270
+ function generateViewMetaData(rawFields, classID, showField) {
145
271
  return rawFields.map((item) => getDefaultViewMeta(item, classID, showField));
146
272
  }
147
273
 
@@ -155,7 +281,7 @@ function getPresetMetaAttribute(attribute) {
155
281
  * @param {string} classID Class ID from the response
156
282
  * @returns {Array} List of all fields with their meta updated.
157
283
  */
158
- function getConfigFields(configFields, primaryFields, metaFields, classID) {
284
+ function getConfigFields(configFields, primaryFields, metaFields, classID) {
159
285
  const presetConfigFields = configFields;
160
286
  const primaryFieldsViewIndex = presetConfigFields.findIndex((field) => field.config.value === 'pyPrimaryFields');
161
287
  if (!primaryFields || !primaryFields.length) {
@@ -172,7 +298,7 @@ function getPresetMetaAttribute(attribute) {
172
298
  (primaryField) =>
173
299
  !presetConfigFields.some((presetConfigField) => presetConfigField.config.value.split('.')[1] === primaryField)
174
300
  );
175
- const uncommonFieldsRawMeta = [];
301
+ const uncommonFieldsRawMeta: Array<any> = [];
176
302
  uncommonFieldsList.forEach((uncommonField) => {
177
303
  const uncommonFieldMeta = metaFields.find((metaField) => metaField.fieldID === uncommonField);
178
304
  if (uncommonFieldMeta) uncommonFieldsRawMeta.push(uncommonFieldMeta);
@@ -196,7 +322,7 @@ function getPresetMetaAttribute(attribute) {
196
322
  * @param {Array} metaFields List of all metafields
197
323
  * @returns {object} Table config object
198
324
  */
199
- export function getTableConfigFromPresetMeta(
325
+ export function getTableConfigFromPresetMeta(
200
326
  presetMeta,
201
327
  isMetaWithPresets,
202
328
  getPConnect,
@@ -281,7 +407,7 @@ function getPresetMetaAttribute(attribute) {
281
407
  * @param {object} response -
282
408
  * @returns {Set} Set of columns from the report response
283
409
  */
284
- function getReportColumns(response) {
410
+ function getReportColumns(response) {
285
411
  const {
286
412
  data: { data: reportColumns }
287
413
  } = response;
@@ -305,7 +431,7 @@ function getPresetMetaAttribute(attribute) {
305
431
  * config.value - Raw value
306
432
  * @returns {string} value - Value with out any annotations or "."
307
433
  */
308
- function getConfigFieldValue(config) {
434
+ function getConfigFieldValue(config) {
309
435
  let { value } = config;
310
436
  if (value.startsWith('@')) {
311
437
  value = value.substring(value.indexOf(' ') + 1);
@@ -340,7 +466,7 @@ function prepareConfigFields(configFields, pushToComponentsList) {
340
466
  * @param {string} fieldID Filter
341
467
  * @returns {object} config with its field value equal to fieldID, which means an authored field
342
468
  */
343
- function findAuthoredField(configFields, fieldID) {
469
+ function findAuthoredField(configFields, fieldID) {
344
470
  return configFields.find((configField) => {
345
471
  const val = getConfigFieldValue(configField.config);
346
472
  return val === fieldID;
@@ -355,7 +481,7 @@ function prepareConfigFields(configFields, pushToComponentsList) {
355
481
  * @param {object} item Field item to copy displayAs and category information
356
482
  * @param {string} classId classID from the response
357
483
  */
358
- function findAndUpdateAuthoredFieldConfig(configFields, item, classId) {
484
+ function findAndUpdateAuthoredFieldConfig(configFields, item, classId) {
359
485
  const authoredField = findAuthoredField(configFields, item.fieldID);
360
486
  if (authoredField?.config) {
361
487
  if (item.displayAs) {
@@ -387,7 +513,7 @@ function prepareConfigFields(configFields, pushToComponentsList) {
387
513
  * @param {boolean} showDynamicFields Flag indicating whether fields are fetched dynamically at runtime
388
514
  * @returns {boolean} true If the field is an extra field else false.
389
515
  */
390
- function isAnExtraField(configFields, configFieldSet, reportColumnsSet, item, classId, showDynamicFields) {
516
+ function isAnExtraField(configFields, configFieldSet, reportColumnsSet, item, classId, showDynamicFields) {
391
517
  // Is the field already present in authoring metadata?
392
518
  // Mutates config fields to copy displayAs and category information
393
519
  if (configFieldSet.has(item.fieldID)) {
@@ -411,7 +537,7 @@ function prepareConfigFields(configFields, pushToComponentsList) {
411
537
  * @param {boolean} showDynamicFields Flag indicating whether fields are fetched dynamically at runtime
412
538
  * @returns {Array} List of extra fields with their meta updated.
413
539
  */
414
- function prepareExtraFields(
540
+ function prepareExtraFields(
415
541
  metaFields,
416
542
  configFields,
417
543
  configFieldSet,
@@ -444,8 +570,8 @@ function populateRenderingOptions(name, config, field) {
444
570
  }
445
571
  }
446
572
  export function initializeColumns(
447
- fields = [],
448
- getMappedProperty
573
+ fields: Array<any> = [],
574
+ getMappedProperty: any = null
449
575
  ) {
450
576
  return fields.map((field, originalColIndex) => {
451
577
  let name = field.config.value;
@@ -495,9 +621,9 @@ export const getItemKey = (fields) => {
495
621
  };
496
622
 
497
623
  export function preparePatchQueryFields(fields, isDataObject = false, classID = '') {
498
- const queryFields = [];
624
+ const queryFields: Array<any> = [];
499
625
  fields.forEach((field) => {
500
- const patchFields = [];
626
+ const patchFields: Array<any> = [];
501
627
  if (field.cellRenderer === 'WorkLink') {
502
628
  if (field.customObject && field.customObject.isAssignmentLink) {
503
629
  const associationName = field.name.includes(':') ? `${field.name.split(':')[0]}:` : '';
@@ -530,6 +656,23 @@ export function preparePatchQueryFields(fields, isDataObject = false, classID =
530
656
  return queryFields;
531
657
  }
532
658
 
659
+ /**
660
+ * Update the renderer type for the properties of type Page.
661
+ */
662
+ export function updatePageFieldsConfig(configFields, parentClassID) {
663
+ return configFields.forEach((item) => {
664
+ const {
665
+ type,
666
+ config: { value }
667
+ } = item;
668
+ const propertyName = PCore.getAnnotationUtils().getPropertyName(value);
669
+ if (isEmbeddedField(value) && !isPageListInPath(propertyName, parentClassID)) {
670
+ item.config.componentType = type;
671
+ item.type = 'PagePropertyRenderer';
672
+ }
673
+ });
674
+ }
675
+
533
676
  export const readContextResponse = async (context, params) => {
534
677
  const {
535
678
  getPConnect,
@@ -542,7 +685,7 @@ export const readContextResponse = async (context, params) => {
542
685
  } = params;
543
686
  const { promisesResponseArray, apiContext: otherContext } = context;
544
687
  // eslint-disable-next-line sonarjs/no-unused-collection
545
- const listOfComponents = [];
688
+ const listOfComponents: Array<any> = [];
546
689
  const {
547
690
  data: { fields: metaFields, classID, isQueryable }
548
691
  } = promisesResponseArray[0];
@@ -562,7 +705,7 @@ export const readContextResponse = async (context, params) => {
562
705
 
563
706
 
564
707
  if (isDataObject) {
565
- const compositeKeys = [];
708
+ const compositeKeys: Array<any> = [];
566
709
  const dataViewName = PCore.getDataTypeUtils().getSavableDataPage(classID);
567
710
  const dataPageKeys = PCore.getDataTypeUtils().getDataPageKeys(dataViewName);
568
711
  dataPageKeys?.forEach((item) =>
@@ -617,13 +760,19 @@ export const readContextResponse = async (context, params) => {
617
760
  showDynamicFields
618
761
  );
619
762
 
763
+ if (isQueryable) {
764
+ updatePageFieldsConfig(configFields, classID);
765
+ preparePropertyMaps([...configFields, ...extraFields], classID, context);
766
+ }
767
+
768
+ const { getMappedProperty } = context;
620
769
 
621
770
  fields = initializeColumns(
622
- [...configFields, ...extraFields],
771
+ [...configFields, ...extraFields], getMappedProperty
623
772
  );
624
773
  const patchQueryFields = preparePatchQueryFields(fields, isDataObject, classID);
625
774
  const itemKey = getItemKey(fields);
626
- tableConfig = { fieldDefs: fields, patchQueryFields, itemKey, isQueryable}
775
+ tableConfig = { fieldDefs: fields, patchQueryFields, itemKey, isQueryable };
627
776
  });
628
777
  const meta = tableConfig;
629
778
  setListContext({
@@ -1,9 +1,15 @@
1
- import PropTypes from "prop-types";
2
1
  import React from "react";
2
+ import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
3
 
4
- declare const PCore;
5
- export default function MultiReferenceReadOnly(props) {
6
- const { getPConnect, label, hideLabel, config } = props;
4
+ interface MultiReferenceReadOnlyProps extends PConnProps {
5
+ config: { referenceList: any, readonlyContextList: any },
6
+ label: string,
7
+ hideLabel: boolean
8
+ }
9
+
10
+
11
+ export default function MultiReferenceReadOnly(props: MultiReferenceReadOnlyProps) {
12
+ const { getPConnect, label = '', hideLabel = false, config } = props;
7
13
  const { referenceList, readonlyContextList } = config;
8
14
 
9
15
  // When referenceList does not contain selected values, it should be replaced with readonlyContextList while calling SimpleTableManual
@@ -22,21 +28,10 @@ export default function MultiReferenceReadOnly(props) {
22
28
  label,
23
29
  hideLabel
24
30
  }
25
- });
31
+ },
32
+ null, null, {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
26
33
 
27
34
  return (
28
35
  <React.Fragment>{component}</React.Fragment>
29
36
  )
30
37
  }
31
-
32
- MultiReferenceReadOnly.defaultProps = {
33
- label: "",
34
- hideLabel: false
35
- };
36
-
37
- MultiReferenceReadOnly.propTypes = {
38
- config: PropTypes.object.isRequired,
39
- getPConnect: PropTypes.func.isRequired,
40
- label: PropTypes.string,
41
- hideLabel: PropTypes.bool
42
- };
@@ -2,7 +2,22 @@ import React from "react";
2
2
 
3
3
  import './NarrowWide.css';
4
4
 
5
- export default function NarrowWide(props) {
5
+ // NarrowWide does NOT have getPConnect. So, no need to extend from PConnProps
6
+ interface NarrowWideProps {
7
+ // If any, enter additional props that only exist on this component
8
+ a: any,
9
+ b: any,
10
+ children?: Array<any>,
11
+ // eslint-disable-next-line react/no-unused-prop-types
12
+ title?: string,
13
+ // eslint-disable-next-line react/no-unused-prop-types
14
+ cols?: string,
15
+ // eslint-disable-next-line react/no-unused-prop-types
16
+ icon?: string
17
+ }
18
+
19
+
20
+ export default function NarrowWide(props: NarrowWideProps) {
6
21
  // const {a, b /*, cols, icon, title */ } = props;
7
22
  const {a, b, children} = props;
8
23
 
@@ -1,14 +1,27 @@
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 { GridSize } from '@material-ui/core/Grid';
5
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
6
- import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
5
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+
7
+ // import type { PConnProps } from '../../../../types/PConnProps';
8
+
9
+ // Can't use PConnProps until getPConnect().getChildren() type is ok
10
+ // interface NarrowWideDetailsProps 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
+
7
17
 
8
18
  const COLUMN_WIDTHS = [4, 8];
9
19
 
10
- export default function NarrowWideDetails(props) {
11
- const { label, showLabel, getPConnect, showHighlightedData } = props;
20
+ export default function NarrowWideDetails(props /* : NarrowWideDetailsProps */) {
21
+ // Get emitted components from map (so we can get any override that may exist)
22
+ const FieldGroup = getComponentFromMap('FieldGroup');
23
+
24
+ const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
12
25
 
13
26
  // Get the inherited props from the parent to determine label settings
14
27
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
@@ -40,7 +53,8 @@ export default function NarrowWideDetails(props) {
40
53
  field.config.displayAsStatus = true;
41
54
  }
42
55
 
43
- return getPConnect().createComponent(field);
56
+ return getPConnect().createComponent(field,
57
+ '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
44
58
  });
45
59
  }
46
60
 
@@ -65,16 +79,3 @@ export default function NarrowWideDetails(props) {
65
79
  </FieldGroup>
66
80
  );
67
81
  }
68
-
69
- NarrowWideDetails.defaultProps = {
70
- label: undefined,
71
- showLabel: true,
72
- showHighlightedData: false
73
- };
74
-
75
- NarrowWideDetails.propTypes = {
76
- showLabel: PropTypes.bool,
77
- label: PropTypes.string,
78
- getPConnect: PropTypes.func.isRequired,
79
- showHighlightedData: PropTypes.bool
80
- };
@@ -2,7 +2,15 @@ import React from "react";
2
2
 
3
3
  import './NarrowWideForm.css';
4
4
 
5
- export default function NarrowWideForm(props) {
5
+ // NarrowWideForm does NOT have getPConnect. So, no need to extend from PConnProps
6
+
7
+ interface NarrowWideFormProps {
8
+ // If any, enter additional props that only exist on this component
9
+ children: Array<any>
10
+ }
11
+
12
+
13
+ export default function NarrowWideForm(props: NarrowWideFormProps) {
6
14
  const {children} = props;
7
15
 
8
16
  return (
@@ -1,15 +1,27 @@
1
1
  import React, { Children } from "react";
2
- import PropTypes from "prop-types";
3
-
4
2
  // import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
5
- import NarrowWide from '@pega/react-sdk-components/lib/components/template/NarrowWide/NarrowWide';
3
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
+
5
+
6
+ // NarrowWidePage does NOT have getPConnect. So, no need to extend from PConnProps
7
+ interface NarrowWidePageProps {
8
+ // If any, enter additional props that only exist on this component
9
+ children: Array<any>,
10
+ title: string,
11
+ templateCol: string,
12
+ icon: string
13
+ }
14
+
6
15
 
7
16
  /*
8
17
  * The wrapper handles knowing how to take in just children and mapping
9
18
  * to the Cosmos template.
10
19
  */
11
- export default function NarrowWidePage(props) {
12
- const { children, title, templateCol, icon } = props;
20
+ export default function NarrowWidePage(props: NarrowWidePageProps) {
21
+ // Get emitted components from map (so we can get any override that may exist)
22
+ const NarrowWide = getComponentFromMap('NarrowWide');
23
+
24
+ const { children, title, templateCol = '1fr 1fr', icon = '' } = props;
13
25
  const childArray = Children.toArray(children);
14
26
 
15
27
  return (
@@ -24,15 +36,3 @@ export default function NarrowWidePage(props) {
24
36
  </div>
25
37
  );
26
38
  }
27
-
28
- NarrowWidePage.propTypes = {
29
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
30
- title: PropTypes.string.isRequired,
31
- templateCol: PropTypes.string,
32
- icon: PropTypes.string
33
- };
34
-
35
- NarrowWidePage.defaultProps = {
36
- templateCol: "1fr 1fr",
37
- icon: ""
38
- };
@@ -1,8 +1,14 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
  import { Grid } from "@material-ui/core";
4
3
  import { makeStyles } from '@material-ui/core/styles';
5
4
 
5
+ // OneColumn does NOT have getPConnect. So, no need to extend from PConnProps
6
+ interface OneColumnProps{
7
+ // If any, enter additional props that only exist on this component
8
+ children: Array<any>
9
+ }
10
+
11
+
6
12
  const useStyles = makeStyles((/* theme */) => ({
7
13
  colStyles: {
8
14
  display: "grid",
@@ -12,7 +18,7 @@ const useStyles = makeStyles((/* theme */) => ({
12
18
  }));
13
19
 
14
20
 
15
- export default function OneColumn(props) {
21
+ export default function OneColumn(props: OneColumnProps) {
16
22
  const classes = useStyles();
17
23
 
18
24
  const { children} = props;
@@ -25,8 +31,3 @@ export default function OneColumn(props) {
25
31
  </Grid>
26
32
  )
27
33
  }
28
-
29
- OneColumn.propTypes = {
30
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
31
- // template: PropTypes.string.isRequired
32
- };
@@ -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
+ // OneColumnPage does NOT have getPConnect. So, no need to extend from PConnProps
5
+ interface OneColumnPageProps{
6
+ // If any, enter additional props that only exist on this component
7
+ children: Array<any>
8
+ }
3
9
 
4
- import OneColumn from '@pega/react-sdk-components/lib/components/template/OneColumn/OneColumn';
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 OneColumnPage(props) {
15
+ export default function OneColumnPage(props: OneColumnPageProps) {
16
+ // Get emitted components from map (so we can get any override that may exist)
17
+ const OneColumn = getComponentFromMap('OneColumn');
11
18
 
12
19
  return (
13
20
  <OneColumn
@@ -15,10 +22,3 @@ export default function OneColumnPage(props) {
15
22
  />
16
23
  );
17
24
  }
18
-
19
- OneColumnPage.propTypes = {
20
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
21
- };
22
-
23
- OneColumnPage.defaultProps = {
24
- };
@@ -1,7 +1,10 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
 
4
- export default function OneColumnTab(props) {
3
+ interface OneColumnTabProps{
4
+ // If any, enter additional props that only exist on this component
5
+ children: Array<any>
6
+ }
7
+ export default function OneColumnTab(props: OneColumnTabProps) {
5
8
  const { children} = props;
6
9
 
7
10
  return (
@@ -10,8 +13,3 @@ export default function OneColumnTab(props) {
10
13
  </div>
11
14
  )
12
15
  }
13
-
14
- OneColumnTab.propTypes = {
15
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
16
- // template: PropTypes.string.isRequired
17
- };