@pega/dx-component-builder-sdk 0.23.14 → 0.23.15

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 (156) hide show
  1. package/package.json +1 -1
  2. package/src/constants.js +8 -0
  3. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.html.mustache +5 -1
  4. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.ts.mustache +6 -0
  5. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.html.mustache +5 -1
  6. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.ts.mustache +7 -0
  7. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.ts.mustache +2 -1
  8. package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.scss.mustache +14 -5
  9. package/src/tasks/create/templates/SDK-React/field/Boolean/demo.stories.tsx.mustache +8 -4
  10. package/src/tasks/create/templates/SDK-React/field/Date/demo.stories.tsx.mustache +17 -15
  11. package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +15 -14
  12. package/src/tasks/create/templates/SDK-React/field/Decimal/demo.stories.tsx.mustache +15 -14
  13. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +1 -1
  14. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/demo.stories.tsx.mustache +14 -12
  15. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/demo.stories.tsx.mustache +2 -2
  16. package/src/tasks/create/templates/SDK-React/field/Integer/demo.stories.tsx.mustache +3 -3
  17. package/src/tasks/create/templates/SDK-React/field/Picklist/demo.stories.tsx.mustache +2 -3
  18. package/src/tasks/create/templates/SDK-React/field/Picklist-Autocomplete/demo.stories.tsx.mustache +3 -3
  19. package/src/tasks/create/templates/SDK-React/field/Picklist-RadioButtons/demo.stories.tsx.mustache +6 -4
  20. package/src/tasks/create/templates/SDK-React/field/Text/demo.stories.tsx.mustache +8 -4
  21. package/src/tasks/create/templates/SDK-React/field/Text-Email/demo.stories.tsx.mustache +8 -4
  22. package/src/tasks/create/templates/SDK-React/field/Text-Input/demo.stories.tsx.mustache +8 -4
  23. package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/demo.stories.tsx.mustache +8 -5
  24. package/src/tasks/create/templates/SDK-React/field/Text-Phone/demo.stories.tsx.mustache +6 -4
  25. package/src/tasks/create/templates/SDK-React/field/Text-URL/demo.stories.tsx.mustache +8 -4
  26. package/src/tasks/create/templates/SDK-React/field/TimeOfDay/demo.stories.tsx.mustache +6 -4
  27. package/src/tasks/create/templates/SDK-React/template/DETAILS/demo.stories.tsx.mustache +22 -22
  28. package/src/tasks/create/templates/SDK-React/template/DETAILS-region/demo.stories.tsx.mustache +17 -17
  29. package/src/tasks/create/templates/SDK-React/template/FORM/demo.stories.tsx.mustache +30 -18
  30. package/src/tasks/create/templates/SDK-React/template/FORM-region/demo.stories.tsx.mustache +50 -24
  31. package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.tsx.mustache +37 -21
  32. package/src/tasks/create/templates/SDK-React/widget/CASE/demo.stories.tsx.mustache +22 -10
  33. package/src/tasks/create/templates/SDK-React/widget/PAGE/demo.stories.tsx.mustache +3 -4
  34. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.tsx.mustache +21 -9
  35. package/tests/assets/sdk-a/components/create/override-sdk/designSystemExtension/field-group/field-group.component.html +21 -0
  36. package/tests/assets/sdk-a/components/create/override-sdk/designSystemExtension/field-group/field-group.component.scss +18 -0
  37. package/tests/assets/sdk-a/components/create/override-sdk/designSystemExtension/field-group/field-group.component.spec.ts +21 -0
  38. package/tests/assets/sdk-a/components/create/override-sdk/designSystemExtension/field-group/field-group.component.ts +24 -0
  39. package/tests/assets/sdk-a/components/create/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.html +8 -2
  40. package/tests/assets/sdk-a/components/create/override-sdk/field/check-box/check-box.component.html +5 -1
  41. package/tests/assets/sdk-a/components/create/override-sdk/field/check-box/check-box.component.ts +6 -0
  42. package/tests/assets/sdk-a/components/create/override-sdk/field/date/date.component.html +5 -1
  43. package/tests/assets/sdk-a/components/create/override-sdk/field/date/date.component.ts +7 -0
  44. package/tests/assets/sdk-a/components/create/override-sdk/field/group/config-ext.json +8 -0
  45. package/tests/assets/sdk-a/components/create/override-sdk/field/group/group.component.html +25 -0
  46. package/tests/assets/sdk-a/components/create/override-sdk/field/group/group.component.scss +0 -0
  47. package/tests/assets/sdk-a/components/create/override-sdk/field/group/group.component.spec.ts +21 -0
  48. package/tests/assets/sdk-a/components/create/override-sdk/field/group/group.component.ts +84 -0
  49. package/tests/assets/sdk-a/components/create/override-sdk/template/app-shell/app-shell.component.ts +2 -2
  50. package/tests/assets/sdk-a/components/create/override-sdk/template/case-view/case-view.component.ts +1 -1
  51. package/tests/assets/sdk-a/components/create/override-sdk/template/default-form/default-form.component.scss +9 -5
  52. package/tests/assets/sdk-a/components/create/override-sdk/template/details/details.component.ts +2 -1
  53. package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.html +5 -1
  54. package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-boolean/pega-dxil-my-boolean.component.ts +6 -0
  55. package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.html +5 -1
  56. package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.ts +7 -0
  57. package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-details/pega-dxil-my-details.component.ts +2 -1
  58. package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-form/pega-dxil-my-form.component.scss +14 -5
  59. package/tests/assets/sdk-a/components/createAll/override-sdk/designSystemExtension/field-group/field-group.component.html +21 -0
  60. package/tests/assets/sdk-a/components/createAll/override-sdk/designSystemExtension/field-group/field-group.component.scss +18 -0
  61. package/tests/assets/sdk-a/components/createAll/override-sdk/designSystemExtension/field-group/field-group.component.spec.ts +21 -0
  62. package/tests/assets/sdk-a/components/createAll/override-sdk/designSystemExtension/field-group/field-group.component.ts +24 -0
  63. package/tests/assets/sdk-a/components/createAll/override-sdk/designSystemExtension/material-details-fields/material-details-fields.component.html +8 -2
  64. package/tests/assets/sdk-a/components/createAll/override-sdk/field/check-box/check-box.component.html +5 -1
  65. package/tests/assets/sdk-a/components/createAll/override-sdk/field/check-box/check-box.component.ts +6 -0
  66. package/tests/assets/sdk-a/components/createAll/override-sdk/field/date/date.component.html +5 -1
  67. package/tests/assets/sdk-a/components/createAll/override-sdk/field/date/date.component.ts +7 -0
  68. package/tests/assets/sdk-a/components/createAll/override-sdk/field/group/config-ext.json +8 -0
  69. package/tests/assets/sdk-a/components/createAll/override-sdk/field/group/group.component.html +25 -0
  70. package/tests/assets/sdk-a/components/createAll/override-sdk/field/group/group.component.scss +0 -0
  71. package/tests/assets/sdk-a/components/createAll/override-sdk/field/group/group.component.spec.ts +21 -0
  72. package/tests/assets/sdk-a/components/createAll/override-sdk/field/group/group.component.ts +84 -0
  73. package/tests/assets/sdk-a/components/createAll/override-sdk/template/app-shell/app-shell.component.ts +2 -2
  74. package/tests/assets/sdk-a/components/createAll/override-sdk/template/case-view/case-view.component.ts +1 -1
  75. package/tests/assets/sdk-a/components/createAll/override-sdk/template/default-form/default-form.component.scss +9 -5
  76. package/tests/assets/sdk-a/components/createAll/override-sdk/template/details/details.component.ts +2 -1
  77. package/tests/assets/sdk-r/components/create/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +8 -4
  78. package/tests/assets/sdk-r/components/create/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx +15 -16
  79. package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/FieldGroup/FieldGroup.tsx +35 -6
  80. package/tests/assets/sdk-r/components/create/override-sdk/field/Checkbox/Checkbox.tsx +7 -4
  81. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/Group.tsx +37 -0
  82. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/config-ext.json +8 -0
  83. package/tests/assets/sdk-r/components/create/override-sdk/field/Group/index.tsx +1 -0
  84. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +14 -1
  85. package/tests/assets/sdk-r/components/create/override-sdk/template/DefaultForm/DefaultForm.css +6 -2
  86. package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +19 -1
  87. package/tests/assets/sdk-r/components/create/override-sdk/widget/FileUtility/FileUtility.tsx +22 -16
  88. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/PConnProps.d.ts +46 -0
  89. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.tsx +54 -0
  90. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/index.tsx +73 -0
  91. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/mock.ts +15 -0
  92. package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/styles.ts +15 -0
  93. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/demo.stories.tsx +8 -4
  94. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +23 -21
  95. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/demo.stories.tsx +14 -12
  96. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +0 -1
  97. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDate/demo.stories.tsx +17 -15
  98. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDate/index.tsx +21 -23
  99. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/demo.stories.tsx +15 -14
  100. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/index.tsx +20 -22
  101. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/demo.stories.tsx +15 -14
  102. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +1 -2
  103. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyEmail/demo.stories.tsx +8 -4
  104. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyEmail/index.tsx +23 -24
  105. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyInteger/demo.stories.tsx +3 -3
  106. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyInteger/index.tsx +0 -1
  107. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyParagraph/demo.stories.tsx +8 -5
  108. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyParagraph/index.tsx +18 -19
  109. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -2
  110. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +0 -1
  111. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPhone/demo.stories.tsx +6 -4
  112. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPhone/index.tsx +33 -34
  113. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -3
  114. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyPicklist/index.tsx +0 -1
  115. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyRadiobuttons/demo.stories.tsx +6 -4
  116. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyRadiobuttons/index.tsx +22 -23
  117. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MySearchbox/demo.stories.tsx +3 -3
  118. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MySearchbox/index.tsx +28 -29
  119. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/config.json +83 -0
  120. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +59 -0
  121. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx +101 -0
  122. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/mock.ts +16 -0
  123. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/styles.js +7 -0
  124. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyText/demo.stories.tsx +8 -4
  125. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyText/index.tsx +15 -16
  126. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTextInput/demo.stories.tsx +8 -4
  127. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTextInput/index.tsx +15 -16
  128. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +6 -4
  129. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTimeOfDay/index.tsx +1 -2
  130. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyURL/demo.stories.tsx +8 -4
  131. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyURL/index.tsx +16 -17
  132. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyDetails/demo.stories.tsx +22 -22
  133. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyDetails/index.tsx +16 -17
  134. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyForm/demo.stories.tsx +56 -18
  135. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyForm/index.tsx +3 -4
  136. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyPage/demo.stories.tsx +37 -21
  137. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyPage/index.tsx +4 -5
  138. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +17 -17
  139. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnDetails/index.tsx +16 -17
  140. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +50 -24
  141. package/tests/assets/sdk-r/components/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnForm/index.tsx +8 -9
  142. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/demo.stories.tsx +22 -10
  143. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyCaseWidget/index.tsx +10 -11
  144. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +21 -9
  145. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/index.tsx +34 -34
  146. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageWidget/demo.stories.tsx +3 -4
  147. package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageWidget/index.tsx +23 -24
  148. package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/FieldGroup/FieldGroup.tsx +35 -6
  149. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Checkbox/Checkbox.tsx +7 -4
  150. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/Group.tsx +37 -0
  151. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/config-ext.json +8 -0
  152. package/tests/assets/sdk-r/components/createAll/override-sdk/field/Group/index.tsx +1 -0
  153. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +14 -1
  154. package/tests/assets/sdk-r/components/createAll/override-sdk/template/DefaultForm/DefaultForm.css +6 -2
  155. package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +19 -1
  156. package/tests/assets/sdk-r/components/createAll/override-sdk/widget/FileUtility/FileUtility.tsx +22 -16
@@ -30,6 +30,7 @@ import { getReferenceList } from '@pega/react-sdk-components/lib/components/help
30
30
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
31
31
  import { buildFieldsForTable, filterData, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
32
32
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
33
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
33
34
 
34
35
  interface SimpleTableManualProps extends PConnProps {
35
36
  // If any, enter additional props that only exist on this component
@@ -171,6 +172,10 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
171
172
  const bUseSeparateViewForEdit = editModeConfig ? editModeConfig.useSeparateViewForEdit : useSeparateViewForEdit;
172
173
  const editView = editModeConfig ? editModeConfig.editView : viewForEditModal;
173
174
 
175
+ const fieldsWithPropNames = rawFields.map((field, index) => {
176
+ return { ...resolvedFields[index], propName: field.config.value.replace('@P .', '') };
177
+ });
178
+
174
179
  useEffect(() => {
175
180
  if (editableMode && !allowEditingInModal) {
176
181
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -197,6 +202,19 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
197
202
  return field.name ? field.name : field.cellRenderer;
198
203
  });
199
204
 
205
+ const getFormattedValue = (val, key) => {
206
+ const rawField = fieldsWithPropNames.find(item => item.propName === key);
207
+ let options = {};
208
+ if (rawField && ['Boolean', 'Checkbox'].includes(rawField.type)) {
209
+ const { trueLabel, falseLabel } = rawField.config;
210
+ options = {
211
+ trueLabel,
212
+ falseLabel
213
+ };
214
+ }
215
+ return rawField ? format(val, rawField.type, options) : val;
216
+ };
217
+
200
218
  // console.log(`SimpleTable displayedColumns:`);
201
219
  // console.log(displayedColumns);
202
220
 
@@ -209,7 +227,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
209
227
  for (const key of refKeys) {
210
228
  valBuilder = valBuilder[key];
211
229
  }
212
- return valBuilder;
230
+ return getFormattedValue(valBuilder, inColKey);
213
231
  }
214
232
 
215
233
  const formatRowsData = data => {
@@ -346,23 +346,29 @@ export default function FileUtility(props: FileUtilityProps) {
346
346
  if (fileData.attachedFiles && fileData.attachedFiles.length > 0) {
347
347
  setProgress(true);
348
348
  }
349
- for (const file of fileData.attachedFiles) {
350
- attachmentUtils
351
- .uploadAttachment(file, onUploadProgress, errorHandler, thePConn.getContextName())
352
- .then((fileResponse: any) => {
353
- if (fileResponse.type === 'File') {
354
- (attachmentUtils.linkAttachmentsToCase(caseID, [fileResponse], 'File', thePConn.getContextName()) as Promise<any>)
355
- .then(() => {
356
- setFileData(current => {
357
- return { ...current, fileList: [], attachedFiles: [] };
358
- });
359
- getAttachments();
360
- })
361
- .catch();
349
+
350
+ Promise.allSettled(
351
+ fileData.attachedFiles.map(file => attachmentUtils.uploadAttachment(file, onUploadProgress, errorHandler, thePConn.getContextName()))
352
+ )
353
+ .then((fileResponses: any) => {
354
+ const uploadedFiles: any = [];
355
+ fileResponses.forEach(fileResponse => {
356
+ if (fileResponse.status === 'fulfilled') {
357
+ uploadedFiles.push(fileResponse.value);
362
358
  }
363
- })
364
- .catch();
365
- }
359
+ });
360
+ if (uploadedFiles.length > 0) {
361
+ (attachmentUtils.linkAttachmentsToCase(caseID, uploadedFiles, 'File', thePConn.getContextName()) as Promise<any>)
362
+ .then(() => {
363
+ setFileData(current => {
364
+ return { ...current, fileList: [], attachedFiles: [] };
365
+ });
366
+ getAttachments();
367
+ })
368
+ .catch();
369
+ }
370
+ })
371
+ .catch();
366
372
  }
367
373
 
368
374
  function onAddLinksClick() {
@@ -0,0 +1,46 @@
1
+ import {PConnect } from '@pega/pcore-pconnect-typedefs';
2
+
3
+ // PConnProps.d.ts
4
+ // This gives us a place to have each component (which is most DX Components) that is
5
+ // expected to have a getPConnect extend its props (from BaseProps)
6
+ // such that every component will be expected to have a getPConnect() function
7
+ // that returns a PConnect object. (new/better way of doing .propTypes).
8
+ // This PConnProps can be extended to include other props that we know are in every component
9
+ export interface PConnProps {
10
+ // getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
11
+ getPConnect: () => typeof PConnect;
12
+
13
+ // Allow any/all other key/value pairs in the BaseProps for now
14
+ // TODO: refine which other props are always expected for various component
15
+ // types and consider further interface "subclassing". For example, we may
16
+ // want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
17
+ // and any other props that every Form component expects.
18
+ // For example, see the PConnFieldProps below.
19
+ // NOTE: if you uncomment the line below, the PConnProps type will allow
20
+ // otherwise undefined types to appear. This can be helpful for debugging
21
+ // or when adding new components whose types aren't yet known.
22
+ // [key: string]: any;
23
+ }
24
+
25
+
26
+ // PConnFieldProps extends PConnProps to bring in the common properties that are
27
+ // associated with most field components (ex: Dropdown, TextInput, etc.) in the
28
+ // components/field directory
29
+ export interface PConnFieldProps extends PConnProps {
30
+ label: string,
31
+ required: boolean,
32
+ disabled: boolean,
33
+ value: any,
34
+ validatemessage: string,
35
+ status?: string,
36
+ onChange?: any,
37
+ onBlur?: any,
38
+ readOnly: boolean,
39
+ testId: string,
40
+ helperText: string,
41
+ displayMode?: string,
42
+ hideLabel: boolean,
43
+ placeholder?: string,
44
+ fieldMetadata?: any,
45
+ additionalProps?: any
46
+ }
@@ -0,0 +1,54 @@
1
+
2
+ /* eslint-disable react/jsx-no-useless-fragment */
3
+ // @ts-nocheck
4
+ import { useState } from 'react';
5
+ import { withKnobs } from '@storybook/addon-knobs';
6
+
7
+ import { stateProps, configProps } from './mock';
8
+
9
+ import PegaDxilMyTestText from './index';
10
+
11
+ export default {
12
+ title: 'PegaDxilMyTestText',
13
+ decorators: [withKnobs],
14
+ component: PegaDxilMyTestText
15
+ };
16
+
17
+ export const BasePegaDxilMyTestText = () => {
18
+
19
+ const [value, setValue] = useState(configProps.value);
20
+
21
+ const props = {
22
+ value,
23
+ placeholder: configProps.placeholder,
24
+ label: configProps.label,
25
+ testId: configProps.testId,
26
+ hasSuggestions: configProps.hasSuggestions,
27
+
28
+ getPConnect: () => {
29
+ return {
30
+ getStateProps: () => {
31
+ return stateProps;
32
+ },
33
+ getActionsApi: () => {
34
+ return {
35
+ updateFieldValue: (propName, theValue) => {
36
+ setValue(theValue);
37
+ },
38
+ triggerFieldChange: () => {/* nothing */}
39
+ };
40
+ },
41
+ ignoreSuggestion: () => {/* nothing */},
42
+ acceptSuggestion: () => {/* nothing */},
43
+ setInheritedProps: () => {/* nothing */},
44
+ resolveConfigProps: () => {/* nothing */}
45
+ };
46
+ }
47
+ };
48
+
49
+ return (
50
+ <>
51
+ <PegaDxilMyTestText {...props} />
52
+ </>
53
+ );
54
+ };
@@ -0,0 +1,73 @@
1
+ import PropTypes from 'prop-types';
2
+ import { Input } from '@pega/cosmos-react-core';
3
+
4
+ import type { PConnFieldProps } from './PConnProps';
5
+
6
+ import StyledPegaDxilMyTestTextWrapper from './styles';
7
+
8
+ // interface for props
9
+ interface PegaDxilMyTestTextProps extends PConnFieldProps {
10
+ // If any, enter additional props that only exist on TextInput here
11
+
12
+ }
13
+
14
+ // interface for StateProps object
15
+ interface StateProps {
16
+ value: string;
17
+ hasSuggestions: boolean;
18
+ }
19
+
20
+ // Duplicated runtime code from Constellation Design System Component
21
+
22
+ // props passed in combination of props from property panel (config.json) and run time props from Constellation
23
+ // any default values in config.pros should be set in defaultProps at bottom of this file
24
+ export default function PegaDxilMyTestText(props: PegaDxilMyTestTextProps) {
25
+ const { getPConnect, value, placeholder, disabled, readOnly, required, label, hideLabel, testId } = props;
26
+
27
+ const pConn = getPConnect();
28
+ const actions = pConn.getActionsApi();
29
+ const stateProps = pConn.getStateProps() as StateProps;
30
+ const propName: string = stateProps.value;
31
+
32
+ const handleOnChange = (event: any) => {
33
+ const { value: updatedValue } = event.target;
34
+ actions.updateFieldValue(propName, updatedValue);
35
+ };
36
+
37
+ return (
38
+ <StyledPegaDxilMyTestTextWrapper>
39
+ <Input
40
+ type='text'
41
+ value={value}
42
+ label={label}
43
+ labelHidden={hideLabel}
44
+ placeholder={placeholder}
45
+ disabled={disabled}
46
+ readOnly={readOnly}
47
+ required={required}
48
+ onChange={handleOnChange}
49
+ testId={testId}
50
+ />
51
+ </StyledPegaDxilMyTestTextWrapper>
52
+ );
53
+ };
54
+
55
+ PegaDxilMyTestText.defaultProps = {
56
+ value: '',
57
+ placeholder: '',
58
+ disabled: false,
59
+ readOnly: false,
60
+ required: false,
61
+ testId: ''
62
+ };
63
+
64
+ PegaDxilMyTestText.propTypes = {
65
+ label: PropTypes.string,
66
+ value: PropTypes.string,
67
+ placeholder: PropTypes.string,
68
+ getPConnect: PropTypes.func.isRequired,
69
+ disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
70
+ readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
71
+ required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
72
+ testId: PropTypes.string
73
+ };
@@ -0,0 +1,15 @@
1
+
2
+ // @ts-nocheck
3
+ export const configProps = {
4
+ value: '',
5
+ label: 'Text Sample',
6
+ placeholder: 'Text Placeholder',
7
+ helperText: 'Text Helper Text',
8
+ testId: 'Text-12345678',
9
+ hasSuggestions: false
10
+ };
11
+
12
+ export const stateProps = {
13
+ value: '.TextSample',
14
+ hasSuggestions: false
15
+ };
@@ -0,0 +1,15 @@
1
+
2
+ // utilizing theming, comment out, if want individual style
3
+ import styled from 'styled-components';
4
+ import { Configuration } from '@pega/cosmos-react-core';
5
+
6
+ export default styled(Configuration)``;
7
+
8
+ // individual style, comment out above, and uncomment here and add styles
9
+ // import styled, { css } from 'styled-components';
10
+ //
11
+ // export default styled.div(() => {
12
+ // return css`
13
+ // margin: 0px 0;
14
+ // `;
15
+ // });
@@ -14,7 +14,7 @@ const meta: Meta<typeof PegaDxilMyBoolean> = {
14
14
  export default meta;
15
15
  type Story = StoryObj<typeof PegaDxilMyBoolean>;
16
16
 
17
- export const BasePegaDxilMyBoolean: Story = (args) => {
17
+ export const BasePegaDxilMyBoolean: Story = args => {
18
18
  const [value, setValue] = useState(configProps.value);
19
19
 
20
20
  const props = {
@@ -35,12 +35,16 @@ export const BasePegaDxilMyBoolean: Story = (args) => {
35
35
  updateFieldValue: (propName, theValue) => {
36
36
  setValue(theValue);
37
37
  },
38
- triggerFieldChange: () => { /* nothing */}
38
+ triggerFieldChange: () => {
39
+ /* nothing */
40
+ }
39
41
  };
40
42
  },
41
43
  getValidationApi: () => {
42
44
  return {
43
- validate: () => { /* nothing */}
45
+ validate: () => {
46
+ /* nothing */
47
+ }
44
48
  };
45
49
  }
46
50
  };
@@ -60,5 +64,5 @@ BasePegaDxilMyBoolean.args = {
60
64
  status: configProps.status,
61
65
  hideLabel: configProps.hideLabel,
62
66
  displayMode: configProps.displayMode,
63
- validatemessage: configProps.validatemessage,
67
+ validatemessage: configProps.validatemessage
64
68
  };
@@ -2,28 +2,28 @@ import { useState, useEffect } from 'react';
2
2
  import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText } from '@material-ui/core';
3
3
 
4
4
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
5
- import StyledPegaDxilMyBooleanWrapper from './styles';
6
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
6
  import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
+ import StyledPegaDxilMyBooleanWrapper from './styles';
8
8
 
9
9
  interface PegaDxilMyBooleanProps extends Omit<PConnFieldProps, 'value'> {
10
10
  // If any, enter additional props that only exist on this componentName
11
11
  value?: boolean;
12
12
  // eslint-disable-next-line react/no-unused-prop-types
13
13
  caption?: string;
14
+ trueLabel?: string;
15
+ falseLabel?: string;
14
16
  }
15
17
 
16
18
  // Duplicated runtime code from React SDK
17
19
 
18
20
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
19
- // any default values in config.pros should be set in defaultProps at bottom of this file
20
21
  export default function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
21
22
  // Get emitted components from map (so we can get any override that may exist)
22
23
  const FieldValueList = getComponentFromMap('FieldValueList');
23
24
 
24
25
  const {
25
26
  getPConnect,
26
- label,
27
27
  value = false,
28
28
  readOnly,
29
29
  testId,
@@ -33,7 +33,9 @@ export default function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
33
33
  helperText,
34
34
  validatemessage,
35
35
  displayMode,
36
- hideLabel
36
+ hideLabel,
37
+ trueLabel,
38
+ falseLabel
37
39
  } = props;
38
40
  const helperTextToDisplay = validatemessage || helperText;
39
41
 
@@ -50,11 +52,11 @@ export default function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
50
52
  }, [value]);
51
53
 
52
54
  if (displayMode === 'LABELS_LEFT') {
53
- return <FieldValueList name={hideLabel ? '' : label} value={value.toString()} />;
55
+ return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} />;
54
56
  }
55
57
 
56
58
  if (displayMode === 'STACKED_LARGE_VAL') {
57
- return <FieldValueList name={hideLabel ? '' : label} value={value.toString()} variant='stacked' />;
59
+ return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} variant='stacked' />;
58
60
  }
59
61
 
60
62
  const handleChange = event => {
@@ -62,7 +64,7 @@ export default function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
62
64
  };
63
65
 
64
66
  const handleBlur = event => {
65
- thePConn.getValidationApi().validate(event.target.checked, ''); // 2nd arg empty string until typedef marked correctly as optional
67
+ thePConn.getValidationApi().validate(event.target.checked);
66
68
  };
67
69
 
68
70
  let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
@@ -75,20 +77,20 @@ export default function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
75
77
 
76
78
  return (
77
79
  <StyledPegaDxilMyBooleanWrapper>
78
- <FormControl required={required} error={status === 'error'}>
79
- <FormGroup>
80
- <FormControlLabel
81
- control={theCheckbox}
82
- checked={checked}
83
- onChange={!readOnly ? handleChange : undefined}
84
- onBlur={!readOnly ? handleBlur : undefined}
85
- label={caption}
86
- labelPlacement='end'
87
- data-test-id={testId}
88
- />
89
- </FormGroup>
90
- <FormHelperText>{helperTextToDisplay}</FormHelperText>
91
- </FormControl>
80
+ <FormControl required={required} error={status === 'error'}>
81
+ <FormGroup>
82
+ <FormControlLabel
83
+ control={theCheckbox}
84
+ checked={checked}
85
+ onChange={!readOnly ? handleChange : undefined}
86
+ onBlur={!readOnly ? handleBlur : undefined}
87
+ label={caption}
88
+ labelPlacement='end'
89
+ data-test-id={testId}
90
+ />
91
+ </FormGroup>
92
+ <FormHelperText>{helperTextToDisplay}</FormHelperText>
93
+ </FormControl>
92
94
  </StyledPegaDxilMyBooleanWrapper>
93
95
  );
94
96
  }
@@ -7,14 +7,14 @@ import { configProps, fieldMetadata } from './mock';
7
7
  window.PCore = {
8
8
  ...window.PCore,
9
9
  getEnvironmentInfo: (): any => {
10
- return {
11
- getUseLocale: () => {
12
- return 'en-GB';
13
- },
14
- getLocale: () => {
15
- return 'en-GB';
16
- }
17
- };
10
+ return {
11
+ getUseLocale: () => {
12
+ return 'en-GB';
13
+ },
14
+ getLocale: () => {
15
+ return 'en-GB';
16
+ }
17
+ };
18
18
  }
19
19
  };
20
20
 
@@ -27,7 +27,7 @@ const meta: Meta<typeof PegaDxilMyCurrency> = {
27
27
  export default meta;
28
28
  type Story = StoryObj<typeof PegaDxilMyCurrency>;
29
29
 
30
- export const BasePegaDxilMyCurrency: Story = (args) => {
30
+ export const BasePegaDxilMyCurrency: Story = args => {
31
31
  const [value, setValue] = useState(configProps.value);
32
32
 
33
33
  const props = {
@@ -41,7 +41,9 @@ export const BasePegaDxilMyCurrency: Story = (args) => {
41
41
  updateFieldValue: (propName, theValue) => {
42
42
  setValue(theValue?.toString());
43
43
  },
44
- triggerFieldChange: () => {/* nothing */}
44
+ triggerFieldChange: () => {
45
+ /* nothing */
46
+ }
45
47
  };
46
48
  },
47
49
  getStateProps: () => {
@@ -60,7 +62,7 @@ export const BasePegaDxilMyCurrency: Story = (args) => {
60
62
  }
61
63
  };
62
64
 
63
- return <PegaDxilMyCurrency {...props} {...args} />
65
+ return <PegaDxilMyCurrency {...props} {...args} />;
64
66
  };
65
67
 
66
68
  BasePegaDxilMyCurrency.args = {
@@ -73,5 +75,5 @@ BasePegaDxilMyCurrency.args = {
73
75
  status: configProps.status,
74
76
  hideLabel: configProps.hideLabel,
75
77
  displayMode: configProps.displayMode,
76
- validatemessage: configProps.validatemessage,
78
+ validatemessage: configProps.validatemessage
77
79
  };
@@ -19,7 +19,6 @@ interface PegaDxilMyCurrencyProps extends PConnFieldProps {
19
19
  // Duplicated runtime code from React SDK
20
20
 
21
21
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
22
- // any default values in config.pros should be set in defaultProps at bottom of this file
23
22
  export default function PegaDxilMyCurrency(props: PegaDxilMyCurrencyProps) {
24
23
  // Get emitted components from map (so we can get any override that may exist)
25
24
  const FieldValueList = getComponentFromMap('FieldValueList');
@@ -9,21 +9,21 @@ window.PCore = {
9
9
  ...window.PCore,
10
10
  getLocaleUtils: (): any => {
11
11
  return {
12
- getLocaleValue: (value) => {
12
+ getLocaleValue: value => {
13
13
  return value;
14
14
  }
15
- }
15
+ };
16
16
  },
17
17
  getEnvironmentInfo: (): any => {
18
- return {
19
- getUseLocale: () => {
20
- return 'en-GB';
21
- },
22
- getLocale: () => {
23
- return 'en-GB';
24
- }
25
- };
26
- }
18
+ return {
19
+ getUseLocale: () => {
20
+ return 'en-GB';
21
+ },
22
+ getLocale: () => {
23
+ return 'en-GB';
24
+ }
25
+ };
26
+ }
27
27
  };
28
28
 
29
29
  const meta: Meta<typeof PegaDxilMyDate> = {
@@ -35,7 +35,7 @@ const meta: Meta<typeof PegaDxilMyDate> = {
35
35
  export default meta;
36
36
  type Story = StoryObj<typeof PegaDxilMyDate>;
37
37
 
38
- export const BasePegaDxilMyDate: Story = (args) => {
38
+ export const BasePegaDxilMyDate: Story = args => {
39
39
  const [value, setValue] = useState(configProps.value);
40
40
 
41
41
  const props = {
@@ -47,7 +47,9 @@ export const BasePegaDxilMyDate: Story = (args) => {
47
47
  updateFieldValue: (propName, theValue) => {
48
48
  setValue(theValue);
49
49
  },
50
- triggerFieldChange: () => {/* nothing */}
50
+ triggerFieldChange: () => {
51
+ /* nothing */
52
+ }
51
53
  };
52
54
  },
53
55
  getStateProps: () => {
@@ -60,7 +62,7 @@ export const BasePegaDxilMyDate: Story = (args) => {
60
62
  }
61
63
  };
62
64
 
63
- return <PegaDxilMyDate {...props} {...args} />
65
+ return <PegaDxilMyDate {...props} {...args} />;
64
66
  };
65
67
 
66
68
  BasePegaDxilMyDate.args = {
@@ -73,5 +75,5 @@ BasePegaDxilMyDate.args = {
73
75
  status: configProps.status,
74
76
  hideLabel: configProps.hideLabel,
75
77
  displayMode: configProps.displayMode,
76
- validatemessage: configProps.validatemessage,
78
+ validatemessage: configProps.validatemessage
77
79
  };
@@ -16,11 +16,9 @@ interface PegaDxilMyDateProps extends PConnFieldProps {
16
16
  // If any, enter additional props that only exist on this componentName
17
17
  }
18
18
 
19
-
20
19
  // Duplicated runtime code from React SDK
21
20
 
22
21
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
23
- // any default values in config.pros should be set in defaultProps at bottom of this file
24
22
  export default function PegaDxilMyDate(props: PegaDxilMyDateProps) {
25
23
  // Get emitted components from map (so we can get any override that may exist)
26
24
  const TextInput = getComponentFromMap('TextInput');
@@ -96,27 +94,27 @@ export default function PegaDxilMyDate(props: PegaDxilMyDateProps) {
96
94
  return (
97
95
  <StyledPegaDxilMyDateWrapper>
98
96
  <MuiPickersUtilsProvider utils={DayjsUtils}>
99
- <KeyboardDatePicker
100
- disableToolbar
101
- variant='inline'
102
- inputVariant='outlined'
103
- placeholder={dateFormatInfo.dateFormatStringLC}
104
- format={dateFormatInfo.dateFormatString}
105
- mask={dateFormatInfo.dateFormatMask}
106
- fullWidth
107
- autoOk
108
- required={required}
109
- disabled={disabled}
110
- error={status === 'error'}
111
- helperText={helperTextToDisplay}
112
- size='small'
113
- label={label}
114
- value={value || null}
115
- onChange={handleChange}
116
- onBlur={!readOnly ? onBlur : undefined}
117
- onAccept={handleAccept}
118
- InputProps={{ ...testProp }}
119
- />
97
+ <KeyboardDatePicker
98
+ disableToolbar
99
+ variant='inline'
100
+ inputVariant='outlined'
101
+ placeholder={dateFormatInfo.dateFormatStringLC}
102
+ format={dateFormatInfo.dateFormatString}
103
+ mask={dateFormatInfo.dateFormatMask}
104
+ fullWidth
105
+ autoOk
106
+ required={required}
107
+ disabled={disabled}
108
+ error={status === 'error'}
109
+ helperText={helperTextToDisplay}
110
+ size='small'
111
+ label={label}
112
+ value={value || null}
113
+ onChange={handleChange}
114
+ onBlur={!readOnly ? onBlur : undefined}
115
+ onAccept={handleAccept}
116
+ InputProps={{ ...testProp }}
117
+ />
120
118
  </MuiPickersUtilsProvider>
121
119
  </StyledPegaDxilMyDateWrapper>
122
120
  );