@pega/custom-dx-components 0.26.4 → 0.26.5

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 (78) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +7 -1
  3. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +7 -0
  4. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +7 -7
  5. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.tsx.mustache +7 -0
  6. package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +16 -12
  7. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/demo.stories.tsx.mustache +7 -0
  8. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +1 -1
  9. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/demo.stories.tsx.mustache +7 -0
  10. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +15 -5
  11. package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.tsx.mustache +1 -1
  12. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +7 -0
  13. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +7 -0
  14. package/src/tasks/create/templates/Constellation/Widget/CASE/index.tsx.mustache +5 -5
  15. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +7 -0
  16. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +6 -6
  17. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +7 -0
  18. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +6 -6
  19. package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +7 -0
  20. package/src/tasks/create/templates/Launchpad/Widget/CASE/index.tsx.mustache +5 -5
  21. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +7 -0
  22. package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +6 -6
  23. package/src/tasks/export-rc/helper.js +356 -0
  24. package/src/tasks/export-rc/index.js +268 -0
  25. package/src/tasks/index.js +1 -0
  26. package/src/tasks/init/template/package.json.mustache +1 -1
  27. package/src/util.js +9 -2
  28. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +7 -0
  29. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/index.tsx +5 -5
  30. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +7 -0
  31. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/index.tsx +7 -7
  32. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +1 -1
  33. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +7 -0
  34. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +7 -0
  35. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +6 -6
  36. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +7 -0
  37. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +16 -12
  38. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/demo.stories.tsx +7 -0
  39. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/index.tsx +15 -5
  40. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +7 -0
  41. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +1 -1
  42. package/tests/assets/original/components/create/shared/PConnProps.d.ts +46 -0
  43. package/tests/assets/original/components/create/shared/create-nonce.ts +5 -0
  44. package/tests/assets/original/components/create/shared/suggestions-handler.ts +9 -0
  45. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +7 -0
  46. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/index.tsx +5 -5
  47. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +7 -0
  48. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/index.tsx +7 -7
  49. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +1 -1
  50. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +7 -0
  51. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +7 -0
  52. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +6 -6
  53. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +7 -0
  54. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +16 -12
  55. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/demo.stories.tsx +7 -0
  56. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/index.tsx +15 -5
  57. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +7 -0
  58. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +1 -1
  59. package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +46 -0
  60. package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +5 -0
  61. package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +9 -0
  62. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/demo.stories.tsx +7 -0
  63. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/index.tsx +5 -5
  64. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +7 -0
  65. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/index.tsx +6 -6
  66. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/GetNextWork.tsx +1 -1
  67. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +7 -0
  68. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +7 -0
  69. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +6 -6
  70. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/demo.stories.tsx +7 -0
  71. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/index.tsx +16 -12
  72. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/demo.stories.tsx +7 -0
  73. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/index.tsx +15 -5
  74. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/demo.stories.tsx +7 -0
  75. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +1 -1
  76. package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +46 -0
  77. package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +5 -0
  78. package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +9 -0
@@ -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
+ };
@@ -58,6 +58,13 @@ export const BasePegaDxilMyCaseWidget: Story = (args: any) => {
58
58
  getContextName: () => {
59
59
  return 'app/primary_1';
60
60
  },
61
+ getLocalizationService:() => {
62
+ return {
63
+ getLocalizedText: (value: any) => {
64
+ return value;
65
+ }
66
+ }
67
+ },
61
68
  getLocalizedValue: (value: any) => {
62
69
  return value;
63
70
  },
@@ -24,9 +24,9 @@ function PegaDxilMyCaseWidget(props: PegaDxilMyCaseWidgetProps) {
24
24
  const context = pConn.getContextName();
25
25
 
26
26
  const columns = [
27
- { renderer: 'date', label: pConn.getLocalizedValue('Date', '', '') },
28
- { renderer: 'description', label: pConn.getLocalizedValue('Description', '', '') },
29
- { renderer: 'user', label: pConn.getLocalizedValue('Performed by', '','') }
27
+ { renderer: 'date', label: pConn.getLocalizationService().getLocalizedText('Date') },
28
+ { renderer: 'description', label: pConn.getLocalizationService().getLocalizedText('Description') },
29
+ { renderer: 'user', label: pConn.getLocalizationService().getLocalizedText('Performed by') }
30
30
  ];
31
31
 
32
32
  useEffect(() => {
@@ -58,11 +58,11 @@ function PegaDxilMyCaseWidget(props: PegaDxilMyCaseWidgetProps) {
58
58
  return (
59
59
  <StyledPegaDxilMyCaseWidgetWrapper>
60
60
  <Table
61
- title={pConn.getLocalizedValue(label, '', '')}
61
+ title={pConn.getLocalizationService().getLocalizedText(label)}
62
62
  columns={columns}
63
63
  data={history}
64
64
  loading={isLoading}
65
- loadingMessage={pConn.getLocalizedValue('Loading case history', '', '')}
65
+ loadingMessage={pConn.getLocalizationService().getLocalizedText('Loading case history')}
66
66
  />
67
67
  </StyledPegaDxilMyCaseWidgetWrapper>
68
68
  );
@@ -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
  },
@@ -75,8 +75,8 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
75
75
 
76
76
  // setting up columns for the work list table
77
77
  const columns = [
78
- { renderer: 'countryName', label: PConnect.getLocalizedValue('Country Name', '', '') },
79
- { renderer: 'shortName', label: PConnect.getLocalizedValue('Abbreviation', '', '') }
78
+ { renderer: 'countryName', label: PConnect.getLocalizationService().getLocalizedText('Country Name') },
79
+ { renderer: 'shortName', label: PConnect.getLocalizationService().getLocalizedText('Abbreviation') }
80
80
  ];
81
81
 
82
82
  // toggle showing table and getting table data
@@ -169,11 +169,11 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
169
169
  />
170
170
  <Label style={{ margin: '0.1rem' }}>
171
171
  {' '}
172
- {PConnect.getLocalizedValue('List of countries', '', '')}{' '}
172
+ {PConnect.getLocalizationService().getLocalizedText('List of countries')}{' '}
173
173
  </Label>
174
174
  <Button
175
175
  icon
176
- label={PConnect.getLocalizedValue('Click to show/hide country list', '', '')}
176
+ label={PConnect.getLocalizationService().getLocalizedText('Click to show/hide country list')}
177
177
  variant='link'
178
178
  compact={false}
179
179
  onClick={showHideTable}
@@ -198,11 +198,11 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
198
198
  </div>
199
199
  {showTable && (
200
200
  <Table
201
- title={PConnect.getLocalizedValue('State list', '', '')}
201
+ title={PConnect.getLocalizationService().getLocalizedText('State list')}
202
202
  columns={columns}
203
203
  data={countrylist}
204
204
  loading={isLoading}
205
- loadingMessage={PConnect.getLocalizedValue('Loading country list', '', '')}
205
+ loadingMessage={PConnect.getLocalizationService().getLocalizedText('Loading country list')}
206
206
  />
207
207
  )}
208
208
  </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
  },
@@ -76,6 +76,13 @@ export const BasePegaDxilMyPageWidget: Story = (args: any) => {
76
76
  getContextName: () => {
77
77
  return 'app/primary_1';
78
78
  },
79
+ getLocalizationService:() => {
80
+ return {
81
+ getLocalizedText: (value: any) => {
82
+ return value;
83
+ }
84
+ }
85
+ },
79
86
  getLocalizedValue: (value: any) => {
80
87
  return value;
81
88
  },
@@ -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
  // going to get data for worklist to put into a table
@@ -93,11 +93,11 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
93
93
  />
94
94
  <br />
95
95
  <Table
96
- title={PConnect.getLocalizedValue('Work list', '', '')}
96
+ title={PConnect.getLocalizationService().getLocalizedText('Work list')}
97
97
  columns={columns}
98
98
  data={worklist}
99
99
  loading={isLoading}
100
- loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
100
+ loadingMessage={PConnect.getLocalizationService().getLocalizedText('Loading Work list')}
101
101
  />
102
102
  </StyledPegaDxilMyPageWidgetWrapper>
103
103
  );
@@ -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
+ ? pConnect
145
+ .getLocalizationService()
146
+ .getLocalizedDataPage(
147
+ item.value ? item.value.toString() : '',
148
+ localeName,
149
+ localePath
150
+ )
151
+ : pConnect
152
+ .getLocalizationService(
153
+ pConnect.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
+ };