@pega/custom-dx-components 25.1.18 → 26.1.10-alpha-0.2

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 (79) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/tasks/create/index.js +3 -11
  4. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +7 -0
  5. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +7 -7
  6. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.tsx.mustache +7 -0
  7. package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +16 -12
  8. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/demo.stories.tsx.mustache +7 -0
  9. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +1 -1
  10. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/demo.stories.tsx.mustache +7 -0
  11. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +15 -5
  12. package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.tsx.mustache +1 -1
  13. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +7 -0
  14. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +7 -0
  15. package/src/tasks/create/templates/Constellation/Widget/CASE/index.tsx.mustache +5 -5
  16. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +7 -0
  17. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +6 -6
  18. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +7 -0
  19. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +6 -6
  20. package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +7 -0
  21. package/src/tasks/create/templates/Launchpad/Widget/CASE/index.tsx.mustache +5 -5
  22. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +7 -0
  23. package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +6 -6
  24. package/src/tasks/create-all/index.js +2 -11
  25. package/src/tasks/init/template/README.md +1 -1
  26. package/src/tasks/init/template/package.json.mustache +15 -16
  27. package/src/tasks/list-pub/index.js +1 -1
  28. package/src/util.js +6 -2
  29. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +7 -0
  30. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/index.tsx +5 -5
  31. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +7 -0
  32. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/index.tsx +7 -7
  33. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +1 -1
  34. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +7 -0
  35. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +7 -0
  36. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +6 -6
  37. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +7 -0
  38. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +16 -12
  39. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/demo.stories.tsx +7 -0
  40. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/index.tsx +15 -5
  41. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +7 -0
  42. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +1 -1
  43. package/tests/assets/original/components/create/shared/PConnProps.d.ts +46 -0
  44. package/tests/assets/original/components/create/shared/create-nonce.ts +5 -0
  45. package/tests/assets/original/components/create/shared/suggestions-handler.ts +9 -0
  46. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +7 -0
  47. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/index.tsx +5 -5
  48. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +7 -0
  49. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/index.tsx +7 -7
  50. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +1 -1
  51. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +7 -0
  52. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +7 -0
  53. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +6 -6
  54. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +7 -0
  55. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +16 -12
  56. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/demo.stories.tsx +7 -0
  57. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/index.tsx +15 -5
  58. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +7 -0
  59. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +1 -1
  60. package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +46 -0
  61. package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +5 -0
  62. package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +9 -0
  63. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/demo.stories.tsx +7 -0
  64. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/index.tsx +5 -5
  65. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +7 -0
  66. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/index.tsx +6 -6
  67. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/GetNextWork.tsx +1 -1
  68. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +7 -0
  69. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +7 -0
  70. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +6 -6
  71. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/demo.stories.tsx +7 -0
  72. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/index.tsx +16 -12
  73. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/demo.stories.tsx +7 -0
  74. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/index.tsx +15 -5
  75. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/demo.stories.tsx +7 -0
  76. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +1 -1
  77. package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +46 -0
  78. package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +5 -0
  79. package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +9 -0
package/src/util.js CHANGED
@@ -2670,10 +2670,14 @@ if (showDebug) addDebugLog("deleteArchives", ``, "");
2670
2670
  }
2671
2671
  }
2672
2672
 
2673
- export const checkLibraryAndArchives = async () => {
2673
+ export const checkLibraryAndArchives = async (checkArch = true) => {
2674
2674
  if (showDebug) addDebugLog("checkLibraryAndArchives", ``, "");
2675
2675
  const isLibraryBased = getLibraryBased();
2676
- const hasArch = await hasArchives();
2676
+ let hasArch = true;
2677
+ if (checkArch) {
2678
+ hasArch = await hasArchives();
2679
+
2680
+ }
2677
2681
 
2678
2682
  if (isLibraryBased && !hasArch) {
2679
2683
  console.log(chalk.yellow('\nPlease create/import a library before proceeding.'));
@@ -56,6 +56,13 @@ export const BasePegaDxilMyCaseWidget: Story = (args: any) => {
56
56
  getContextName: () => {
57
57
  return 'app/primary_1';
58
58
  },
59
+ getLocalizationService:() => {
60
+ return {
61
+ getLocalizedText: (value: any) => {
62
+ return value;
63
+ }
64
+ }
65
+ },
59
66
  getLocalizedValue: (value: any) => {
60
67
  return value;
61
68
  },
@@ -26,9 +26,9 @@ function PegaDxilMyCaseWidget(props: PegaDxilMyCaseWidgetProps) {
26
26
  const context = pConn.getContextName();
27
27
 
28
28
  const columns = [
29
- { renderer: 'date', label: pConn.getLocalizedValue('Date', '', '') },
30
- { renderer: 'description', label: pConn.getLocalizedValue('Description', '', '') },
31
- { renderer: 'user', label: pConn.getLocalizedValue('Performed by', '','') }
29
+ { renderer: 'date', label: pConn.getLocalizationService().getLocalizedText('Date') },
30
+ { renderer: 'description', label: pConn.getLocalizationService().getLocalizedText('Description') },
31
+ { renderer: 'user', label: pConn.getLocalizationService().getLocalizedText('Performed by') }
32
32
  ];
33
33
 
34
34
  useEffect(() => {
@@ -60,11 +60,11 @@ function PegaDxilMyCaseWidget(props: PegaDxilMyCaseWidgetProps) {
60
60
  return (
61
61
  <StyledPegaDxilMyCaseWidgetWrapper>
62
62
  <Table
63
- title={pConn.getLocalizedValue(label, '', '')}
63
+ title={pConn.getLocalizationService().getLocalizedText(label)}
64
64
  columns={columns}
65
65
  data={history}
66
66
  loading={isLoading}
67
- loadingMessage={pConn.getLocalizedValue('Loading case history', '', '')}
67
+ loadingMessage={pConn.getLocalizationService().getLocalizedText('Loading case history')}
68
68
  />
69
69
  </StyledPegaDxilMyCaseWidgetWrapper>
70
70
  );
@@ -62,6 +62,13 @@ export const BasePegaDxilMyIconButtonUrl: Story = (args: any) => {
62
62
  getContextName: () => {
63
63
  return 'app/primary_1';
64
64
  },
65
+ getLocalizationService:() => {
66
+ return {
67
+ getLocalizedText: (value: any) => {
68
+ return value;
69
+ }
70
+ }
71
+ },
65
72
  getLocalizedValue: (value: any) => {
66
73
  return value;
67
74
  },
@@ -78,8 +78,8 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
78
78
 
79
79
  // setting up columns for the work list table
80
80
  const columns = [
81
- { renderer: 'stateName', label: PConnect.getLocalizedValue('State name', '', '') },
82
- { renderer: 'stateCode', label: PConnect.getLocalizedValue('State code', '', '') }
81
+ { renderer: 'stateName', label: PConnect.getLocalizationService().getLocalizedText('State name') },
82
+ { renderer: 'stateCode', label: PConnect.getLocalizationService().getLocalizedText('State code') }
83
83
  ];
84
84
 
85
85
  // toggle showing table and getting table data
@@ -170,12 +170,12 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
170
170
  />
171
171
  <Label style={{ margin: '0.1rem' }}>
172
172
  {' '}
173
- {PConnect.getLocalizedValue('State list for', '', '')}{' '}
174
- {PConnect.getLocalizedValue(`${countryCode}`, '', '')}{' '}
173
+ {PConnect.getLocalizationService().getLocalizedText('State list for')}{' '}
174
+ {PConnect.getLocalizationService().getLocalizedText(`${countryCode}`)}{' '}
175
175
  </Label>
176
176
  <Button
177
177
  icon
178
- label={PConnect.getLocalizedValue('Click to show/hide state list', '', '')}
178
+ label={PConnect.getLocalizationService().getLocalizedText('Click to show/hide state list')}
179
179
  variant='link'
180
180
  compact={false}
181
181
  onClick={showHideTable}
@@ -200,11 +200,11 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
200
200
  </div>
201
201
  {showTable && (
202
202
  <Table
203
- title={PConnect.getLocalizedValue('State list', '', '')}
203
+ title={PConnect.getLocalizationService().getLocalizedText('State list')}
204
204
  columns={columns}
205
205
  data={statelist}
206
206
  loading={isLoading}
207
- loadingMessage={PConnect.getLocalizedValue('Loading state list', '', '')}
207
+ loadingMessage={PConnect.getLocalizationService().getLocalizedText('Loading state list')}
208
208
  />
209
209
  )}
210
210
  </StyledPegaDxilMyIconButtonUrlWrapper>
@@ -38,7 +38,7 @@ export default function GetNextWork(props: PegaDxilMyPageWorkProps) {
38
38
 
39
39
  return (
40
40
  <Button variant={variant} onClick={getNextWork}>
41
- {getPConnect().getLocalizedValue('Get next work', '', '')}
41
+ {getPConnect().getLocalizationService().getLocalizedText('Get next work')}
42
42
  </Button>
43
43
  );
44
44
  }
@@ -61,6 +61,13 @@ export const BasePegaDxilMyPage: Story = (args: any) => {
61
61
  getComponentName: () => {
62
62
  return '';
63
63
  },
64
+ getLocalizationService:() => {
65
+ return {
66
+ getLocalizedText: (value: any) => {
67
+ return value;
68
+ }
69
+ }
70
+ },
64
71
  getLocalizedValue: (value: any) => {
65
72
  return value;
66
73
  },
@@ -74,6 +74,13 @@ export const BasePegaDxilMyPageWidget: Story = (args: any) => {
74
74
  getContextName: () => {
75
75
  return 'app/primary_1';
76
76
  },
77
+ getLocalizationService:() => {
78
+ return {
79
+ getLocalizedText: (value: any) => {
80
+ return value;
81
+ }
82
+ }
83
+ },
77
84
  getLocalizedValue: (value: any) => {
78
85
  return value;
79
86
  },
@@ -36,10 +36,10 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
36
36
 
37
37
  // setting up columns for the work list table
38
38
  const columns = [
39
- { renderer: 'caseType', label: PConnect.getLocalizedValue('Case type', '', '') },
40
- { renderer: 'insKey', label: PConnect.getLocalizedValue('Key', '', '') },
41
- { renderer: 'status', label: PConnect.getLocalizedValue('Status', '', '') },
42
- { renderer: 'stage', label: PConnect.getLocalizedValue('Stage', '', '') }
39
+ { renderer: 'caseType', label: PConnect.getLocalizationService().getLocalizedText('Case type') },
40
+ { renderer: 'insKey', label: PConnect.getLocalizationService().getLocalizedText('Key') },
41
+ { renderer: 'status', label: PConnect.getLocalizationService().getLocalizedText('Status') },
42
+ { renderer: 'stage', label: PConnect.getLocalizationService().getLocalizedText('Stage') }
43
43
  ];
44
44
 
45
45
  const myRef = useRef(null);
@@ -96,11 +96,11 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
96
96
  />
97
97
  <br />
98
98
  <Table
99
- title={PConnect.getLocalizedValue('Work list', '', '')}
99
+ title={PConnect.getLocalizationService().getLocalizedText('Work list')}
100
100
  columns={columns}
101
101
  data={worklist}
102
102
  loading={isLoading}
103
- loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
103
+ loadingMessage={PConnect.getLocalizationService().getLocalizedText('Loading Work list')}
104
104
  />
105
105
  </StyledPegaDxilMyPageWidgetWrapper>
106
106
  );
@@ -31,6 +31,13 @@ export const BasePegaDxilMyPicklist: Story = (args: any) => {
31
31
  getStateProps: () => {
32
32
  return stateProps;
33
33
  },
34
+ getLocalizationService:() => {
35
+ return {
36
+ getLocalizedText: (value: any) => {
37
+ return value;
38
+ }
39
+ }
40
+ },
34
41
  getLocalizedValue: (val: any) => {
35
42
  return val;
36
43
  },
@@ -94,7 +94,7 @@ const pushPlaceholderOption = (placeholder: string, listSourceItems: Array<any>,
94
94
  if (placeholder) {
95
95
  items.push(
96
96
  <Option key={placeholder} value=''>
97
- {pConnect.getLocalizedValue(placeholder)}
97
+ {pConnect.getLocalizationService().getLocalizedText(placeholder)}
98
98
  </Option>
99
99
  );
100
100
  } else if (!listSourceItems) {
@@ -167,6 +167,8 @@ function PegaDxilMyPicklist(props: PegaDxilMyPicklistProps) {
167
167
  const configProps = pConnect.getConfigProps();
168
168
  const items: Array<any> = [];
169
169
  const isDatapage = listType === 'datapage';
170
+ const isDatapageLocale = localeContext === 'datapage';
171
+
170
172
  let listSourceItems = isDatapage ? configProps.listOutput : datasource;
171
173
 
172
174
  if (isDatapage && typeof datasource === 'object' && !Array.isArray(listSourceItems)) {
@@ -202,17 +204,19 @@ function PegaDxilMyPicklist(props: PegaDxilMyPicklistProps) {
202
204
  items.push(
203
205
  // @ts-ignore
204
206
  <Option key={item.key} value={item.key}>
205
- {isDatapage
206
- ? pConnect.getLocalizedValue(
207
- item.text,
208
- localePath,
209
- pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
210
- )
211
- : pConnect.getLocalizedValue(
212
- item.value,
213
- localePath,
214
- pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
215
- )}
207
+ {isDatapageLocale
208
+ ? pConnect
209
+ .getLocalizationService()
210
+ .getLocalizedDataPage(
211
+ item.value ? item.value.toString() : '',
212
+ localeName,
213
+ localePath
214
+ )
215
+ : pConnect
216
+ .getLocalizationService(
217
+ pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
218
+ )
219
+ .getLocalizedText(item.value ? item.value.toString() : '')}
216
220
  </Option>
217
221
  );
218
222
  });
@@ -34,6 +34,13 @@ export const BasePegaDxilMyRadiobuttons: Story = (args: any) => {
34
34
  getPageReference: () => {
35
35
  return 'caseInfo.content';
36
36
  },
37
+ getLocalizationService:() => {
38
+ return {
39
+ getLocalizedText: (value: any) => {
40
+ return value;
41
+ }
42
+ }
43
+ },
37
44
  getLocalizedValue: (val: any) => {
38
45
  return val;
39
46
  },
@@ -106,6 +106,8 @@ function PegaDxilMyRadiobuttons(props: PegaDxilMyRadiobuttonsProps) {
106
106
 
107
107
  const items: Array<any> = [];
108
108
  const isDatapage = listType === 'datapage';
109
+ const isDatapageLocale = localeContext === 'datapage';
110
+
109
111
  const listSource = isDatapage ? configProps.listOutput : datasource;
110
112
  let autoFocusProp = additionalProps?.autoFocus
111
113
  ? {
@@ -138,11 +140,19 @@ function PegaDxilMyRadiobuttons(props: PegaDxilMyRadiobuttonsProps) {
138
140
  id={`${fullReference}.${item.key}`}
139
141
  value={item.key}
140
142
  key={`${fullReference}.${item.key}`}
141
- label={pConn.getLocalizedValue(
142
- isDatapage ? item.text : item.value,
143
- localePath,
144
- pConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
145
- )}
143
+ label={isDatapageLocale
144
+ ? pConn
145
+ .getLocalizationService()
146
+ .getLocalizedDataPage(
147
+ item.value ? item.value.toString() : '',
148
+ localeName,
149
+ localePath
150
+ )
151
+ : pConn
152
+ .getLocalizationService(
153
+ pConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
154
+ )
155
+ .getLocalizedText(item.value ? item.value.toString() : '')}
146
156
  name={fullReference}
147
157
  />
148
158
  );
@@ -38,6 +38,13 @@ export const BasePegaDxilMySearchbox: Story = (args: any) => {
38
38
  getContextName: () => {
39
39
  return 'app/primary_1';
40
40
  },
41
+ getLocalizationService:() => {
42
+ return {
43
+ getLocalizedText: (value: any) => {
44
+ return value;
45
+ }
46
+ }
47
+ },
41
48
  getLocalizedValue: (val: any) => {
42
49
  return val;
43
50
  },
@@ -1126,7 +1126,7 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
1126
1126
  selected: item.items ? undefined : !!item.selected || item.id === selected?.id
1127
1127
  })),
1128
1128
  onItemClick: selectItem,
1129
- emptyText: pConn.getLocalizedValue('No items'),
1129
+ emptyText: pConn.getLocalizationService().getLocalizedText('No items'),
1130
1130
  loading,
1131
1131
  loadMore,
1132
1132
  footer: createNewRecord ? (
@@ -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,5 @@
1
+ // @ts-ignore
2
+ if (window?.__webpack_nonce__) {
3
+ // @ts-ignore
4
+ __webpack_nonce__ = window.__webpack_nonce__;
5
+ }
@@ -0,0 +1,9 @@
1
+ export const suggestionsHandler = (accepted: boolean, pConn: any, setStatus: any) => {
2
+ if (accepted) {
3
+ pConn.acceptSuggestion();
4
+ setStatus('success');
5
+ } else {
6
+ pConn.ignoreSuggestion();
7
+ setStatus(undefined);
8
+ }
9
+ };
@@ -56,6 +56,13 @@ export const BasePegaDxilMyCaseWidget: Story = (args: any) => {
56
56
  getContextName: () => {
57
57
  return 'app/primary_1';
58
58
  },
59
+ getLocalizationService:() => {
60
+ return {
61
+ getLocalizedText: (value: any) => {
62
+ return value;
63
+ }
64
+ }
65
+ },
59
66
  getLocalizedValue: (value: any) => {
60
67
  return value;
61
68
  },
@@ -26,9 +26,9 @@ function PegaDxilMyCaseWidget(props: PegaDxilMyCaseWidgetProps) {
26
26
  const context = pConn.getContextName();
27
27
 
28
28
  const columns = [
29
- { renderer: 'date', label: pConn.getLocalizedValue('Date', '', '') },
30
- { renderer: 'description', label: pConn.getLocalizedValue('Description', '', '') },
31
- { renderer: 'user', label: pConn.getLocalizedValue('Performed by', '','') }
29
+ { renderer: 'date', label: pConn.getLocalizationService().getLocalizedText('Date') },
30
+ { renderer: 'description', label: pConn.getLocalizationService().getLocalizedText('Description') },
31
+ { renderer: 'user', label: pConn.getLocalizationService().getLocalizedText('Performed by') }
32
32
  ];
33
33
 
34
34
  useEffect(() => {
@@ -60,11 +60,11 @@ function PegaDxilMyCaseWidget(props: PegaDxilMyCaseWidgetProps) {
60
60
  return (
61
61
  <StyledPegaDxilMyCaseWidgetWrapper>
62
62
  <Table
63
- title={pConn.getLocalizedValue(label, '', '')}
63
+ title={pConn.getLocalizationService().getLocalizedText(label)}
64
64
  columns={columns}
65
65
  data={history}
66
66
  loading={isLoading}
67
- loadingMessage={pConn.getLocalizedValue('Loading case history', '', '')}
67
+ loadingMessage={pConn.getLocalizationService().getLocalizedText('Loading case history')}
68
68
  />
69
69
  </StyledPegaDxilMyCaseWidgetWrapper>
70
70
  );
@@ -62,6 +62,13 @@ export const BasePegaDxilMyIconButtonUrl: Story = (args: any) => {
62
62
  getContextName: () => {
63
63
  return 'app/primary_1';
64
64
  },
65
+ getLocalizationService:() => {
66
+ return {
67
+ getLocalizedText: (value: any) => {
68
+ return value;
69
+ }
70
+ }
71
+ },
65
72
  getLocalizedValue: (value: any) => {
66
73
  return value;
67
74
  },
@@ -78,8 +78,8 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
78
78
 
79
79
  // setting up columns for the work list table
80
80
  const columns = [
81
- { renderer: 'stateName', label: PConnect.getLocalizedValue('State name', '', '') },
82
- { renderer: 'stateCode', label: PConnect.getLocalizedValue('State code', '', '') }
81
+ { renderer: 'stateName', label: PConnect.getLocalizationService().getLocalizedText('State name') },
82
+ { renderer: 'stateCode', label: PConnect.getLocalizationService().getLocalizedText('State code') }
83
83
  ];
84
84
 
85
85
  // toggle showing table and getting table data
@@ -170,12 +170,12 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
170
170
  />
171
171
  <Label style={{ margin: '0.1rem' }}>
172
172
  {' '}
173
- {PConnect.getLocalizedValue('State list for', '', '')}{' '}
174
- {PConnect.getLocalizedValue(`${countryCode}`, '', '')}{' '}
173
+ {PConnect.getLocalizationService().getLocalizedText('State list for')}{' '}
174
+ {PConnect.getLocalizationService().getLocalizedText(`${countryCode}`)}{' '}
175
175
  </Label>
176
176
  <Button
177
177
  icon
178
- label={PConnect.getLocalizedValue('Click to show/hide state list', '', '')}
178
+ label={PConnect.getLocalizationService().getLocalizedText('Click to show/hide state list')}
179
179
  variant='link'
180
180
  compact={false}
181
181
  onClick={showHideTable}
@@ -200,11 +200,11 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
200
200
  </div>
201
201
  {showTable && (
202
202
  <Table
203
- title={PConnect.getLocalizedValue('State list', '', '')}
203
+ title={PConnect.getLocalizationService().getLocalizedText('State list')}
204
204
  columns={columns}
205
205
  data={statelist}
206
206
  loading={isLoading}
207
- loadingMessage={PConnect.getLocalizedValue('Loading state list', '', '')}
207
+ loadingMessage={PConnect.getLocalizationService().getLocalizedText('Loading state list')}
208
208
  />
209
209
  )}
210
210
  </StyledPegaDxilMyIconButtonUrlWrapper>
@@ -38,7 +38,7 @@ export default function GetNextWork(props: PegaDxilMyPageWorkProps) {
38
38
 
39
39
  return (
40
40
  <Button variant={variant} onClick={getNextWork}>
41
- {getPConnect().getLocalizedValue('Get next work', '', '')}
41
+ {getPConnect().getLocalizationService().getLocalizedText('Get next work')}
42
42
  </Button>
43
43
  );
44
44
  }
@@ -61,6 +61,13 @@ export const BasePegaDxilMyPage: Story = (args: any) => {
61
61
  getComponentName: () => {
62
62
  return '';
63
63
  },
64
+ getLocalizationService:() => {
65
+ return {
66
+ getLocalizedText: (value: any) => {
67
+ return value;
68
+ }
69
+ }
70
+ },
64
71
  getLocalizedValue: (value: any) => {
65
72
  return value;
66
73
  },
@@ -74,6 +74,13 @@ export const BasePegaDxilMyPageWidget: Story = (args: any) => {
74
74
  getContextName: () => {
75
75
  return 'app/primary_1';
76
76
  },
77
+ getLocalizationService:() => {
78
+ return {
79
+ getLocalizedText: (value: any) => {
80
+ return value;
81
+ }
82
+ }
83
+ },
77
84
  getLocalizedValue: (value: any) => {
78
85
  return value;
79
86
  },
@@ -36,10 +36,10 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
36
36
 
37
37
  // setting up columns for the work list table
38
38
  const columns = [
39
- { renderer: 'caseType', label: PConnect.getLocalizedValue('Case type', '', '') },
40
- { renderer: 'insKey', label: PConnect.getLocalizedValue('Key', '', '') },
41
- { renderer: 'status', label: PConnect.getLocalizedValue('Status', '', '') },
42
- { renderer: 'stage', label: PConnect.getLocalizedValue('Stage', '', '') }
39
+ { renderer: 'caseType', label: PConnect.getLocalizationService().getLocalizedText('Case type') },
40
+ { renderer: 'insKey', label: PConnect.getLocalizationService().getLocalizedText('Key') },
41
+ { renderer: 'status', label: PConnect.getLocalizationService().getLocalizedText('Status') },
42
+ { renderer: 'stage', label: PConnect.getLocalizationService().getLocalizedText('Stage') }
43
43
  ];
44
44
 
45
45
  const myRef = useRef(null);
@@ -96,11 +96,11 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
96
96
  />
97
97
  <br />
98
98
  <Table
99
- title={PConnect.getLocalizedValue('Work list', '', '')}
99
+ title={PConnect.getLocalizationService().getLocalizedText('Work list')}
100
100
  columns={columns}
101
101
  data={worklist}
102
102
  loading={isLoading}
103
- loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
103
+ loadingMessage={PConnect.getLocalizationService().getLocalizedText('Loading Work list')}
104
104
  />
105
105
  </StyledPegaDxilMyPageWidgetWrapper>
106
106
  );
@@ -31,6 +31,13 @@ export const BasePegaDxilMyPicklist: Story = (args: any) => {
31
31
  getStateProps: () => {
32
32
  return stateProps;
33
33
  },
34
+ getLocalizationService:() => {
35
+ return {
36
+ getLocalizedText: (value: any) => {
37
+ return value;
38
+ }
39
+ }
40
+ },
34
41
  getLocalizedValue: (val: any) => {
35
42
  return val;
36
43
  },
@@ -94,7 +94,7 @@ const pushPlaceholderOption = (placeholder: string, listSourceItems: Array<any>,
94
94
  if (placeholder) {
95
95
  items.push(
96
96
  <Option key={placeholder} value=''>
97
- {pConnect.getLocalizedValue(placeholder)}
97
+ {pConnect.getLocalizationService().getLocalizedText(placeholder)}
98
98
  </Option>
99
99
  );
100
100
  } else if (!listSourceItems) {
@@ -167,6 +167,8 @@ function PegaDxilMyPicklist(props: PegaDxilMyPicklistProps) {
167
167
  const configProps = pConnect.getConfigProps();
168
168
  const items: Array<any> = [];
169
169
  const isDatapage = listType === 'datapage';
170
+ const isDatapageLocale = localeContext === 'datapage';
171
+
170
172
  let listSourceItems = isDatapage ? configProps.listOutput : datasource;
171
173
 
172
174
  if (isDatapage && typeof datasource === 'object' && !Array.isArray(listSourceItems)) {
@@ -202,17 +204,19 @@ function PegaDxilMyPicklist(props: PegaDxilMyPicklistProps) {
202
204
  items.push(
203
205
  // @ts-ignore
204
206
  <Option key={item.key} value={item.key}>
205
- {isDatapage
206
- ? pConnect.getLocalizedValue(
207
- item.text,
208
- localePath,
209
- pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
210
- )
211
- : pConnect.getLocalizedValue(
212
- item.value,
213
- localePath,
214
- pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
215
- )}
207
+ {isDatapageLocale
208
+ ? pConnect
209
+ .getLocalizationService()
210
+ .getLocalizedDataPage(
211
+ item.value ? item.value.toString() : '',
212
+ localeName,
213
+ localePath
214
+ )
215
+ : pConnect
216
+ .getLocalizationService(
217
+ pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
218
+ )
219
+ .getLocalizedText(item.value ? item.value.toString() : '')}
216
220
  </Option>
217
221
  );
218
222
  });
@@ -34,6 +34,13 @@ export const BasePegaDxilMyRadiobuttons: Story = (args: any) => {
34
34
  getPageReference: () => {
35
35
  return 'caseInfo.content';
36
36
  },
37
+ getLocalizationService:() => {
38
+ return {
39
+ getLocalizedText: (value: any) => {
40
+ return value;
41
+ }
42
+ }
43
+ },
37
44
  getLocalizedValue: (val: any) => {
38
45
  return val;
39
46
  },