@pega/dx-component-builder-sdk 0.25.5 → 0.242.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.
- package/package.json +2 -2
- package/src/tasks/authenticate/index.js +1 -1
- package/src/tasks/create/templates/Constellation/field/Boolean/demo.stories.tsx.mustache +2 -3
- package/src/tasks/create/templates/Constellation/field/Boolean/index.tsx.mustache +5 -4
- package/src/tasks/create/templates/Constellation/field/Boolean/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Constellation/field/Date/index.tsx.mustache +3 -5
- package/src/tasks/create/templates/Constellation/field/Integer/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/field/Integer/event-utils.ts.mustache +1 -1
- package/src/tasks/create/templates/Constellation/field/Integer/index.tsx.mustache +2 -12
- package/src/tasks/create/templates/Constellation/field/Integer/mock.ts.mustache +3 -2
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.html.mustache +2 -2
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.ts.mustache +8 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -2
- package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +31 -47
- package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +31 -38
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +4 -3
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +4 -3
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/index.tsx.mustache +11 -11
- package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +3 -2
- package/src/tasks/create/templates/SDK-React/field/Picklist-Autocomplete/index.tsx.mustache +4 -3
- package/src/tasks/create/templates/SDK-React/field/Picklist-RadioButtons/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/Text-Email/index.tsx.mustache +3 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/TimeOfDay/index.tsx.mustache +27 -21
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/template/FORM-region/demo.stories.tsx.mustache +19 -16
- package/src/tasks/create/templates/SDK-React/template/FORM-region/index.tsx.mustache +6 -6
- package/src/tasks/create/templates/SDK-React/template/PAGE/OneColumn.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +11 -10
- package/src/tasks/create/templates/SDK-React/widget/PAGE/index.tsx.mustache +25 -19
- package/src/tasks/create/templates/SDK-React/widget/PAGE/mock.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +18 -10
- package/tests/assets/sdk-a/components/create/override-sdk/designSystemExtension/operator/operator.component.ts +4 -1
- package/tests/assets/sdk-a/components/create/override-sdk/field/date-time/date-time.component.html +2 -2
- package/tests/assets/sdk-a/components/create/override-sdk/field/date-time/date-time.component.ts +9 -0
- package/tests/assets/sdk-a/components/create/override-sdk/field/percentage/percentage.component.ts +1 -1
- package/tests/assets/sdk-a/components/create/override-sdk/field/rich-text/config-ext.json +11 -0
- package/tests/assets/sdk-a/components/create/override-sdk/infra/assignment/assignment.component.ts +7 -32
- package/tests/assets/sdk-a/components/create/override-sdk/infra/flow-container/flow-container.component.html +7 -2
- package/tests/assets/sdk-a/components/create/override-sdk/infra/flow-container/flow-container.component.ts +15 -8
- package/tests/assets/sdk-a/components/create/override-sdk/infra/modal-view-container/modal-view-container.component.ts +40 -7
- package/tests/assets/sdk-a/components/create/override-sdk/template/banner-page/config-ext.json +10 -0
- package/tests/assets/sdk-a/components/create/override-sdk/template/inline-dashboard-page/config-ext.json +10 -0
- package/tests/assets/sdk-a/components/create/override-sdk/widget/quick-create/config-ext.json +10 -0
- package/tests/assets/sdk-a/components/create/override-sdk/widget/todo/todo.component.html +2 -1
- package/tests/assets/sdk-a/components/create/override-sdk/widget/todo/todo.component.ts +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.html +2 -2
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-date-time/pega-dxil-my-date-time.component.ts +8 -0
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.ts +1 -1
- package/tests/assets/sdk-a/components/createAll/override-sdk/designSystemExtension/operator/operator.component.ts +4 -1
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/date-time/date-time.component.html +2 -2
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/date-time/date-time.component.ts +9 -0
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/percentage/percentage.component.ts +1 -1
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/rich-text/config-ext.json +11 -0
- package/tests/assets/sdk-a/components/createAll/override-sdk/infra/assignment/assignment.component.ts +7 -32
- package/tests/assets/sdk-a/components/createAll/override-sdk/infra/flow-container/flow-container.component.html +7 -2
- package/tests/assets/sdk-a/components/createAll/override-sdk/infra/flow-container/flow-container.component.ts +15 -8
- package/tests/assets/sdk-a/components/createAll/override-sdk/infra/modal-view-container/modal-view-container.component.ts +40 -7
- package/tests/assets/sdk-a/components/createAll/override-sdk/template/banner-page/config-ext.json +10 -0
- package/tests/assets/sdk-a/components/createAll/override-sdk/template/inline-dashboard-page/config-ext.json +10 -0
- package/tests/assets/sdk-a/components/createAll/override-sdk/widget/quick-create/config-ext.json +10 -0
- package/tests/assets/sdk-a/components/createAll/override-sdk/widget/todo/todo.component.html +2 -1
- package/tests/assets/sdk-a/components/createAll/override-sdk/widget/todo/todo.component.ts +1 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageWidget/index.tsx +1 -1
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/PConnProps.d.ts +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/create-nonce.ts +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/demo.stories.tsx +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/event-utils.ts +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/index.tsx +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/mock.ts +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/styles.ts +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/suggestions-handler.ts +0 -0
- /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/textformat-utils.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/dx-component-builder-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.242.2",
|
|
4
4
|
"description": "Utility for building custom UI components",
|
|
5
5
|
"bin": "./bin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"sass-loader": "^13.3.3",
|
|
53
53
|
"terser-webpack-plugin": "5.3.10",
|
|
54
54
|
"ts-loader": "^9.5.1",
|
|
55
|
-
"typescript": "
|
|
55
|
+
"typescript": "~5.2.2",
|
|
56
56
|
"url-loader": "4.1.1",
|
|
57
57
|
"webpack": "^5.89.0"
|
|
58
58
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
3
|
import { useState } from 'react';
|
|
5
4
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
5
|
|
|
@@ -17,7 +16,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
17
16
|
export default meta;
|
|
18
17
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
19
18
|
|
|
20
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
19
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
21
20
|
|
|
22
21
|
const [value, setValue] = useState(configProps.value);
|
|
23
22
|
|
|
@@ -31,7 +30,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
31
30
|
},
|
|
32
31
|
getActionsApi: () => {
|
|
33
32
|
return {
|
|
34
|
-
updateFieldValue: (propName, theValue) => {
|
|
33
|
+
updateFieldValue: (propName: string, theValue: any) => {
|
|
35
34
|
setValue(theValue);
|
|
36
35
|
},
|
|
37
36
|
triggerFieldChange: () => { /* nothing */}
|
|
@@ -87,7 +87,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
87
87
|
handleEvent(actions, "changeNblur", propName, event.target.checked);
|
|
88
88
|
}}
|
|
89
89
|
onBlur={(event: { target: { checked: any; }; }) => {
|
|
90
|
-
// @ts-ignore
|
|
91
90
|
pConn.getValidationApi().validate(event.target.checked);
|
|
92
91
|
}}
|
|
93
92
|
data-testid={testId}
|
|
@@ -98,15 +97,17 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
98
97
|
|
|
99
98
|
let displayComponent;
|
|
100
99
|
if (displayMode) {
|
|
101
|
-
// @ts-ignore
|
|
102
100
|
displayComponent = (
|
|
103
|
-
// @ts-ignore
|
|
104
101
|
<BooleanDisplay value={value} trueLabel={trueLabel} falseLabel={falseLabel} />
|
|
105
102
|
);
|
|
106
103
|
}
|
|
107
104
|
|
|
108
105
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
109
|
-
return (
|
|
106
|
+
return (
|
|
107
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
108
|
+
{displayComponent}
|
|
109
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
110
|
+
);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
if (displayMode === "LABELS_LEFT") {
|
|
@@ -104,8 +104,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
104
104
|
}, [validatemessage, hasSuggestions, myStatus]);
|
|
105
105
|
|
|
106
106
|
// calculate min and max range of calendar
|
|
107
|
-
|
|
108
|
-
const currentYear = getFullYear();
|
|
107
|
+
const currentYear = getFullYear(null);
|
|
109
108
|
|
|
110
109
|
const yearFromValue = getFullYear(value);
|
|
111
110
|
const maxDate = getMaxDate(
|
|
@@ -161,7 +160,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
161
160
|
}
|
|
162
161
|
|
|
163
162
|
|
|
164
|
-
if (formatter !== "" && formatExists(formatter)){
|
|
163
|
+
if (formatter !== "" && formatExists(formatter)) {
|
|
165
164
|
// @ts-ignore
|
|
166
165
|
const {variantVal, formatVal} = datetimedisplayformatter(formatter);
|
|
167
166
|
variantValue = variantVal;
|
|
@@ -225,8 +224,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
225
224
|
hideLabel={hideLabel}
|
|
226
225
|
testId={testId}
|
|
227
226
|
additionalProps={textAdditionalProps}
|
|
228
|
-
|
|
229
|
-
customFormat={getDateFormat(locale)}
|
|
227
|
+
customFormat={getDateFormat(locale, null)}
|
|
230
228
|
/>
|
|
231
229
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
232
230
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
2
|
-
// @ts-nocheck
|
|
3
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
3
|
|
|
5
4
|
import { stateProps, configProps, fieldMetadata } from './mock';
|
|
@@ -15,7 +14,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
15
14
|
export default meta;
|
|
16
15
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
17
16
|
|
|
18
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
17
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
19
18
|
|
|
20
19
|
const props = {
|
|
21
20
|
value: configProps.value,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const handleEvent = (actions: any, eventType: string, propName: string, value: string) => {
|
|
1
|
+
const handleEvent = (actions: any, eventType: string, propName: string, value: string | number) => {
|
|
2
2
|
switch (eventType) {
|
|
3
3
|
case 'change':
|
|
4
4
|
actions.updateFieldValue(propName, value);
|
|
@@ -112,21 +112,17 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
112
112
|
|
|
113
113
|
useEffect(() => {
|
|
114
114
|
if (displayAs === 'slider' && value === '') {
|
|
115
|
-
// @ts-ignore
|
|
116
115
|
handleEvent(actions, 'change', propName, sliderDefaultValue);
|
|
117
116
|
}
|
|
118
117
|
}, [actions, displayAs, propName, sliderDefaultValue, value]);
|
|
119
118
|
|
|
120
119
|
const { decimalPrecision, currencyDecimalPrecision = 'auto', currencyISOCode = 'USD' } = props;
|
|
121
|
-
let noOfDecimals = parseInt(decimalPrecision, 10);
|
|
122
|
-
// @ts-ignore
|
|
120
|
+
let noOfDecimals : number | undefined = parseInt(decimalPrecision, 10);
|
|
123
121
|
if (Number.isNaN(noOfDecimals)) noOfDecimals = undefined;
|
|
124
122
|
let noOfFractionDigits = currencyDecimalPrecision === 'auto' ? undefined : parseInt(currencyDecimalPrecision, 10);
|
|
125
123
|
let unit;
|
|
126
|
-
let unitPlacement;
|
|
127
124
|
|
|
128
|
-
|
|
129
|
-
if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode)) {
|
|
125
|
+
if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode as string)) {
|
|
130
126
|
switch (formatter) {
|
|
131
127
|
case 'Decimal': {
|
|
132
128
|
break;
|
|
@@ -134,7 +130,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
134
130
|
case 'Percentage': {
|
|
135
131
|
showGroupSeparators = false;
|
|
136
132
|
unit = '%';
|
|
137
|
-
unitPlacement = 'after';
|
|
138
133
|
break;
|
|
139
134
|
}
|
|
140
135
|
case 'Decimal-Auto': {
|
|
@@ -180,7 +175,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
180
175
|
notation
|
|
181
176
|
}}
|
|
182
177
|
unit={unit}
|
|
183
|
-
unitPlacement={unitPlacement}
|
|
184
178
|
/>
|
|
185
179
|
);
|
|
186
180
|
|
|
@@ -233,13 +227,11 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
233
227
|
setIntegerValue(enteredValue);
|
|
234
228
|
// const parsedValue = integerValue !== '' ? Number(integerValue) : '';
|
|
235
229
|
if (value !== (enteredValue !== '' ? Number(enteredValue) : '')) {
|
|
236
|
-
// @ts-ignore
|
|
237
230
|
handleEvent(actions, 'change', propName, enteredValue !== '' ? Number(enteredValue) : '');
|
|
238
231
|
hasValueChange.current = true;
|
|
239
232
|
}
|
|
240
233
|
// In case of stepper variation there is no blur event as component is never focussed unless forced. Need to update redux on change.
|
|
241
234
|
if (displayAs === 'stepper') {
|
|
242
|
-
// @ts-ignore
|
|
243
235
|
handleEvent(actions, 'changeNblur', propName, enteredValue !== '' ? Number(enteredValue) : '');
|
|
244
236
|
}
|
|
245
237
|
}
|
|
@@ -271,7 +263,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
271
263
|
ticks={showTicks && { [min]: `${min}`, [max]: `${max}` }}
|
|
272
264
|
onChange={(selectedValue) => {
|
|
273
265
|
onChangeHandler(selectedValue.toString());
|
|
274
|
-
// @ts-ignore
|
|
275
266
|
handleEvent(actions, 'changeNblur', propName, selectedValue);
|
|
276
267
|
}}
|
|
277
268
|
/>
|
|
@@ -298,7 +289,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
298
289
|
}}
|
|
299
290
|
onBlur={() => {
|
|
300
291
|
if (!readOnly && (hasValueChange.current || !value)) {
|
|
301
|
-
// @ts-ignore
|
|
302
292
|
handleEvent(actions, 'blur', propName, integerValue !== '' ? Number(integerValue) : '');
|
|
303
293
|
if (hasSuggestions) {
|
|
304
294
|
pConn.ignoreSuggestion('');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
export const configProps = {
|
|
3
2
|
value: '',
|
|
4
3
|
label: 'Integer Sample',
|
|
@@ -12,7 +11,9 @@ export const configProps = {
|
|
|
12
11
|
required: false,
|
|
13
12
|
disabled: false,
|
|
14
13
|
status: '',
|
|
15
|
-
validatemessage: ''
|
|
14
|
+
validatemessage: '',
|
|
15
|
+
placeholder: '',
|
|
16
|
+
variant: ''
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export const stateProps = {
|
package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.html.mustache
CHANGED
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
[placeholder]="placeholder"
|
|
16
16
|
[formControl]="fieldControl"
|
|
17
17
|
(blur)="fieldOnBlur($event)"
|
|
18
|
-
(dateTimeChange)="
|
|
18
|
+
(dateTimeChange)="fieldOnDateChange($event)"
|
|
19
19
|
[value]="value$"
|
|
20
20
|
[required]="bRequired$"
|
|
21
21
|
/>
|
|
22
|
-
<mat-datepicker-toggle matSuffix [
|
|
22
|
+
<mat-datepicker-toggle matSuffix [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
|
|
23
23
|
<owl-date-time #dtPicker></owl-date-time>
|
|
24
24
|
<mat-error *ngIf="fieldControl?.invalid">{{ getErrorMessage() }}</mat-error>
|
|
25
25
|
</mat-form-field>
|
package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.ts.mustache
CHANGED
|
@@ -168,6 +168,14 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
fieldOnDateChange(event: any) {
|
|
172
|
+
if (typeof event.value === 'object') {
|
|
173
|
+
// convert date to pega "date" format
|
|
174
|
+
event.value = event.value?.toISOString();
|
|
175
|
+
}
|
|
176
|
+
this.angularPConnectData.actions?.onChange(this, { value: event.value });
|
|
177
|
+
}
|
|
178
|
+
|
|
171
179
|
fieldOnBlur(event: any) {
|
|
172
180
|
if (typeof event.value === 'object') {
|
|
173
181
|
// convert date to pega "date" format
|
|
@@ -177,7 +177,7 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
|
|
|
177
177
|
const actionsApi = this.pConn$?.getActionsApi();
|
|
178
178
|
const propName = (this.pConn$?.getStateProps() as any).value;
|
|
179
179
|
let value = event?.target?.value;
|
|
180
|
-
value = value
|
|
180
|
+
value = value ? value.replace(/%/g, '') : '';
|
|
181
181
|
if (this.currSep === ',') {
|
|
182
182
|
value = value.replace(/,/g, '');
|
|
183
183
|
} else {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable react/no-array-index-key */
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
|
-
import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@material
|
|
3
|
+
import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@mui/material';
|
|
4
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
4
5
|
|
|
5
6
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
7
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
8
|
import { insertInstruction, deleteInstruction, updateNewInstuctions } from '@pega/react-sdk-components/lib/components/helpers/instructions-utils';
|
|
8
9
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
|
-
|
|
10
|
+
|
|
10
11
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
11
12
|
|
|
12
13
|
interface {{COMPONENT_CLASS_NAME}}Props extends Omit<PConnFieldProps, 'value'> {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
3
|
+
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
4
|
+
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
5
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
6
|
+
|
|
3
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
4
8
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
5
9
|
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
6
10
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
11
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
12
|
+
|
|
8
13
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
9
14
|
|
|
10
15
|
// Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
|
|
@@ -24,22 +29,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
|
|
|
24
29
|
const TextInput = getComponentFromMap('TextInput');
|
|
25
30
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
26
31
|
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
required,
|
|
31
|
-
disabled,
|
|
32
|
-
value = '',
|
|
33
|
-
validatemessage,
|
|
34
|
-
status,
|
|
35
|
-
onChange,
|
|
36
|
-
onBlur,
|
|
37
|
-
readOnly,
|
|
38
|
-
testId,
|
|
39
|
-
helperText,
|
|
40
|
-
displayMode,
|
|
41
|
-
hideLabel
|
|
42
|
-
} = props;
|
|
32
|
+
const { getPConnect, label, required, disabled, value, validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;
|
|
33
|
+
|
|
34
|
+
const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(value) : null);
|
|
43
35
|
|
|
44
36
|
const pConn = getPConnect();
|
|
45
37
|
const actions = pConn.getActionsApi();
|
|
@@ -81,44 +73,36 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
|
|
|
81
73
|
|
|
82
74
|
const handleChange = date => {
|
|
83
75
|
if (date && date.isValid()) {
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const handleAccept = date => {
|
|
89
|
-
if (date && date.isValid()) {
|
|
76
|
+
setDateValue(date);
|
|
90
77
|
handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
|
|
91
78
|
}
|
|
92
79
|
};
|
|
93
80
|
|
|
94
81
|
return (
|
|
95
82
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
96
|
-
<
|
|
97
|
-
<
|
|
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'
|
|
83
|
+
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
84
|
+
<DatePicker
|
|
111
85
|
label={label}
|
|
112
|
-
|
|
86
|
+
disabled={disabled}
|
|
87
|
+
format={dateFormatInfo.dateFormatString}
|
|
88
|
+
value={dateValue}
|
|
89
|
+
{{! pick new delimiters for mustache }}
|
|
90
|
+
{{=<% %>=}}
|
|
91
|
+
slotProps={{
|
|
92
|
+
textField: {
|
|
93
|
+
required,
|
|
94
|
+
variant: 'outlined',
|
|
95
|
+
placeholder: dateFormatInfo.dateFormatStringLC,
|
|
96
|
+
error: status === 'error',
|
|
97
|
+
helperText: helperTextToDisplay,
|
|
98
|
+
size: 'small',
|
|
99
|
+
InputProps: { ...testProp }
|
|
100
|
+
}
|
|
101
|
+
}}
|
|
102
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
113
103
|
onChange={handleChange}
|
|
114
|
-
onBlur={!readOnly ? onBlur : undefined}
|
|
115
|
-
onAccept={handleAccept}
|
|
116
|
-
{{! pick new delimiters for mustache }}
|
|
117
|
-
{{=<% %>=}}
|
|
118
|
-
InputProps={{ ...testProp }}
|
|
119
|
-
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
120
104
|
/>
|
|
121
|
-
</
|
|
105
|
+
</LocalizationProvider>
|
|
122
106
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
123
107
|
);
|
|
124
108
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
3
|
+
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
4
|
+
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
5
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
6
|
+
|
|
3
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
4
|
-
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters
|
|
8
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
5
9
|
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
6
10
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
11
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
@@ -20,21 +24,9 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
|
|
|
20
24
|
const TextInput = getComponentFromMap('TextInput');
|
|
21
25
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
22
26
|
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
required,
|
|
27
|
-
disabled,
|
|
28
|
-
value = '',
|
|
29
|
-
validatemessage,
|
|
30
|
-
status,
|
|
31
|
-
onChange,
|
|
32
|
-
readOnly,
|
|
33
|
-
testId,
|
|
34
|
-
helperText,
|
|
35
|
-
displayMode,
|
|
36
|
-
hideLabel
|
|
37
|
-
} = props;
|
|
27
|
+
const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;
|
|
28
|
+
|
|
29
|
+
const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(value) : null);
|
|
38
30
|
|
|
39
31
|
const pConn = getPConnect();
|
|
40
32
|
const actions = pConn.getActionsApi();
|
|
@@ -69,11 +61,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
|
|
|
69
61
|
}
|
|
70
62
|
|
|
71
63
|
const handleChange = date => {
|
|
72
|
-
|
|
73
|
-
onChange({ value: changeValue });
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const handleAccept = date => {
|
|
64
|
+
setDateValue(date);
|
|
77
65
|
const changeValue = date && date.isValid() ? date.toISOString() : null;
|
|
78
66
|
handleEvent(actions, 'changeNblur', propName, changeValue);
|
|
79
67
|
};
|
|
@@ -85,28 +73,33 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
|
|
|
85
73
|
|
|
86
74
|
return (
|
|
87
75
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
fullWidth
|
|
93
|
-
autoOk
|
|
94
|
-
required={required}
|
|
76
|
+
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
77
|
+
<DateTimePicker
|
|
78
|
+
// fullWidth
|
|
79
|
+
// autoOk
|
|
95
80
|
disabled={disabled}
|
|
96
|
-
placeholder={`${dateFormatInfo.dateFormatStringLC} hh:mm a`}
|
|
97
81
|
format={`${dateFormatInfo.dateFormatString} hh:mm a`}
|
|
98
|
-
mask={`${dateFormatInfo.dateFormatMask} __:__ _m`}
|
|
82
|
+
// mask={`${dateFormatInfo.dateFormatMask} __:__ _m`}
|
|
99
83
|
minutesStep={5}
|
|
100
|
-
error={status === 'error'}
|
|
101
|
-
helperText={helperTextToDisplay}
|
|
102
|
-
size='small'
|
|
103
84
|
label={label}
|
|
104
|
-
value={
|
|
85
|
+
value={dateValue}
|
|
105
86
|
onChange={handleChange}
|
|
106
|
-
onAccept={handleAccept}
|
|
107
87
|
data-test-id={testId}
|
|
88
|
+
{{! pick new delimiters for mustache }}
|
|
89
|
+
{{=<% %>=}}
|
|
90
|
+
slotProps={{
|
|
91
|
+
textField: {
|
|
92
|
+
variant: 'outlined',
|
|
93
|
+
required,
|
|
94
|
+
placeholder: `${dateFormatInfo.dateFormatStringLC} hh:mm a`,
|
|
95
|
+
error: status === 'error',
|
|
96
|
+
helperText: helperTextToDisplay,
|
|
97
|
+
size: 'small'
|
|
98
|
+
}
|
|
99
|
+
}}
|
|
100
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
108
101
|
/>
|
|
109
|
-
</
|
|
102
|
+
</LocalizationProvider>
|
|
110
103
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
111
104
|
);
|
|
112
105
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { TextField } from '@material-ui/core';
|
|
2
1
|
import { NumericFormat } from 'react-number-format';
|
|
2
|
+
import { TextField } from '@mui/material';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils
|
|
4
|
+
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
7
7
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
8
8
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
|
+
|
|
9
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
10
11
|
|
|
11
12
|
/* Using react-number-format component here, since it allows formatting decimal values,
|
|
@@ -98,7 +99,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
|
|
|
98
99
|
return (
|
|
99
100
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
100
101
|
<NumericFormat
|
|
101
|
-
|
|
102
|
+
valueIsNumericString
|
|
102
103
|
fullWidth
|
|
103
104
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
104
105
|
helperText={helperTextToDisplay}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { TextField } from '@material-ui/core';
|
|
2
1
|
import { useState } from 'react';
|
|
3
2
|
import { NumericFormat } from 'react-number-format';
|
|
3
|
+
import { TextField } from '@mui/material';
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
5
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
6
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
7
7
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
8
8
|
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils.js';
|
|
9
|
+
|
|
9
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
10
11
|
|
|
11
12
|
/* Using react-number-format component here, since it allows formatting decimal values,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { TextField } from '@material-ui/core';
|
|
2
|
-
import { NumericFormat } from 'react-number-format';
|
|
3
1
|
import { useState } from 'react';
|
|
2
|
+
import { NumericFormat } from 'react-number-format';
|
|
3
|
+
import { TextField } from '@mui/material';
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
5
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
|
-
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils
|
|
6
|
+
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
7
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
8
8
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
9
|
+
|
|
9
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
10
11
|
|
|
11
12
|
/* Using react-number-format component here, since it allows formatting decimal values,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Tooltip, IconButton, Link } from '@material
|
|
3
|
-
import Table from '@material
|
|
4
|
-
import TableBody from '@material
|
|
5
|
-
import TableCell from '@material
|
|
6
|
-
import TableContainer from '@material
|
|
7
|
-
import TableHead from '@material
|
|
8
|
-
import TableRow from '@material
|
|
9
|
-
import Paper from '@material
|
|
2
|
+
import { Tooltip, IconButton, Link } from '@mui/material';
|
|
3
|
+
import Table from '@mui/material/Table';
|
|
4
|
+
import TableBody from '@mui/material/TableBody';
|
|
5
|
+
import TableCell from '@mui/material/TableCell';
|
|
6
|
+
import TableContainer from '@mui/material/TableContainer';
|
|
7
|
+
import TableHead from '@mui/material/TableHead';
|
|
8
|
+
import TableRow from '@mui/material/TableRow';
|
|
9
|
+
import Paper from '@mui/material/Paper';
|
|
10
10
|
|
|
11
11
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
12
12
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
@@ -14,9 +14,9 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
|
14
14
|
|
|
15
15
|
// IMPORTANT
|
|
16
16
|
// import LanguageIcon from '@mui/icons-material/Language';
|
|
17
|
-
import ArrowForwardIcon from '@
|
|
18
|
-
import LanguageIcon from '@
|
|
19
|
-
import FormatListNumberedIcon from '@
|
|
17
|
+
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
|
|
18
|
+
import LanguageIcon from '@mui/icons-material/Language';
|
|
19
|
+
import FormatListNumberedIcon from '@mui/icons-material/FormatListNumbered';
|
|
20
20
|
|
|
21
21
|
interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
22
22
|
// If any, enter additional props that only exist on this componentName
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { TextField } from '@material
|
|
1
|
+
import { TextField } from '@mui/material';
|
|
2
2
|
|
|
3
3
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
4
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
5
6
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
6
7
|
|
|
7
8
|
interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { TextField } from '@material
|
|
3
|
-
import MenuItem from '@material
|
|
2
|
+
import { TextField } from '@mui/material';
|
|
3
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
4
4
|
import isDeepEqual from 'fast-deep-equal/react';
|
|
5
5
|
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
6
6
|
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
7
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
8
8
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
9
9
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
10
|
+
|
|
10
11
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
11
12
|
|
|
12
13
|
interface IOption {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { TextField } from '@material
|
|
3
|
-
import Autocomplete from '@material
|
|
2
|
+
import { TextField } from '@mui/material';
|
|
3
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
4
4
|
import isDeepEqual from 'fast-deep-equal/react';
|
|
5
5
|
|
|
6
6
|
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
@@ -8,6 +8,7 @@ import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/d
|
|
|
8
8
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
9
9
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
10
10
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
11
|
+
|
|
11
12
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
12
13
|
|
|
13
14
|
interface IOption {
|
|
@@ -198,7 +199,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}
|
|
|
198
199
|
getOptionLabel={(option: IOption) => {
|
|
199
200
|
return option.value ? option.value : '';
|
|
200
201
|
}}
|
|
201
|
-
|
|
202
|
+
isOptionEqualToValue={(option: any) => {
|
|
202
203
|
return option.value ? option.value : '';
|
|
203
204
|
}}
|
|
204
205
|
<%={{ }}=%> {{! revert delimiters for mustache }}
|