@pega/custom-dx-components 0.242.16 → 0.242.17
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 +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 +0 -1
- 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/DateTime/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal/event-utils.ts.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.tsx.mustache +1 -4
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.ts.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.ts.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache +1 -4
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.ts.mustache +2 -3
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +4 -5
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/mock.ts.mustache +0 -1
- 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 -9
- package/src/tasks/create/templates/Constellation/Field/Integer/mock.ts.mustache +3 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.tsx.mustache +4 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +7 -14
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/demo.stories.tsx.mustache +4 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/embed-utils.ts.mustache +26 -23
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +10 -52
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/demo.stories.tsx.mustache +4 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +1 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.tsx.mustache +2 -3
- package/src/tasks/create/templates/Constellation/Field/Text/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.ts.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.tsx.mustache +1 -3
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/event-utils.ts.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.tsx.mustache +1 -3
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.tsx.mustache +13 -8
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.tsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS/Avatar.tsx.mustache +3 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +8 -7
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/Avatar.tsx.mustache +1 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +15 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +2 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.ts.mustache +1 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.ts.mustache +4 -8
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.tsx.mustache +67 -7
- package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +3 -3
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +4 -5
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.tsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Template/PAGE/mock.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.ts.mustache +6 -19
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +4 -6
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.tsx.mustache +1 -4
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +3 -4
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.tsx.mustache +2 -5
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +2 -3
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +4 -5
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +4 -6
- package/src/tasks/create/templates/Launchpad/Widget/CASE/index.tsx.mustache +1 -4
- package/src/tasks/create/templates/Launchpad/Widget/CASE/mock.ts.mustache +1 -1
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +3 -5
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +2 -6
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/mock.ts.mustache +0 -1
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/Avatar.tsx.mustache +1 -3
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.stories.tsx.mustache +2 -3
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/mock.ts.mustache +0 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
package/package.json
CHANGED
|
@@ -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 */}
|
|
@@ -86,7 +86,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
86
86
|
handleEvent(actions, "changeNblur", propName, event.target.checked);
|
|
87
87
|
}}
|
|
88
88
|
onBlur={(event: { target: { checked: any; }; }) => {
|
|
89
|
-
// @ts-ignore
|
|
90
89
|
pConn.getValidationApi().validate(event.target.checked);
|
|
91
90
|
}}
|
|
92
91
|
data-testid={testId}
|
|
@@ -103,8 +103,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
103
103
|
}, [validatemessage, hasSuggestions, myStatus]);
|
|
104
104
|
|
|
105
105
|
// calculate min and max range of calendar
|
|
106
|
-
|
|
107
|
-
const currentYear = getFullYear();
|
|
106
|
+
const currentYear = getFullYear(null);
|
|
108
107
|
|
|
109
108
|
const yearFromValue = getFullYear(value);
|
|
110
109
|
const maxDate = getMaxDate(
|
|
@@ -160,7 +159,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
|
|
163
|
-
if (formatter !== "" && formatExists(formatter)){
|
|
162
|
+
if (formatter !== "" && formatExists(formatter)) {
|
|
164
163
|
// @ts-ignore
|
|
165
164
|
const {variantVal, formatVal} = datetimedisplayformatter(formatter);
|
|
166
165
|
variantValue = variantVal;
|
|
@@ -224,8 +223,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
224
223
|
hideLabel={hideLabel}
|
|
225
224
|
testId={testId}
|
|
226
225
|
additionalProps={textAdditionalProps}
|
|
227
|
-
|
|
228
|
-
customFormat={getDateFormat(locale)}
|
|
226
|
+
customFormat={getDateFormat(locale, null)}
|
|
229
227
|
/>
|
|
230
228
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
231
229
|
);
|
|
@@ -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
|
import { configProps, stateProps } from './mock';
|
|
5
4
|
import {{COMPONENT_CLASS_NAME}} from './index';
|
|
@@ -29,7 +28,7 @@ window.PCore.getEnvironmentInfo = () => {
|
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
31
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
33
32
|
const props = {
|
|
34
33
|
value: configProps.value,
|
|
35
34
|
additionalProps: configProps.additionalProps,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
4
|
|
|
6
5
|
import { configProps, fieldMetadata, stateProps } from './mock';
|
|
@@ -16,7 +15,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
16
15
|
export default meta;
|
|
17
16
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
18
17
|
|
|
19
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
18
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
20
19
|
|
|
21
20
|
const props = {
|
|
22
21
|
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);
|
|
@@ -87,9 +87,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
87
87
|
}, [validatemessage, hasSuggestions, status]);
|
|
88
88
|
|
|
89
89
|
const { decimalPrecision, currencyDecimalPrecision } = props;
|
|
90
|
-
let numberOfDecimals = parseInt(decimalPrecision, 10);
|
|
90
|
+
let numberOfDecimals: number | undefined = parseInt(decimalPrecision, 10);
|
|
91
91
|
if (Number.isNaN(numberOfDecimals)) {
|
|
92
|
-
// @ts-ignore
|
|
93
92
|
numberOfDecimals = decimalPrecision === '' ? undefined : 2;
|
|
94
93
|
}
|
|
95
94
|
let noOfFractionDigits = currencyDecimalPrecision === 'auto' ? undefined : parseInt(currencyDecimalPrecision, 10);
|
|
@@ -225,14 +224,12 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
225
224
|
}
|
|
226
225
|
setDecimalValue(enteredValue);
|
|
227
226
|
if (value !== (enteredValue !== '' ? Number(enteredValue) : '')) {
|
|
228
|
-
// @ts-ignore
|
|
229
227
|
handleEvent(actions, 'change', propName, enteredValue !== '' ? Number(enteredValue) : '');
|
|
230
228
|
hasValueChange.current = true;
|
|
231
229
|
}
|
|
232
230
|
}}
|
|
233
231
|
onBlur={() => {
|
|
234
232
|
if (!value || hasValueChange.current) {
|
|
235
|
-
// @ts-ignore
|
|
236
233
|
handleEvent(actions, 'blur', propName, decimalValue !== '' ? Number(decimalValue) : '');
|
|
237
234
|
if (hasSuggestions) {
|
|
238
235
|
pConn.ignoreSuggestion("");
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.tsx.mustache
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
4
|
|
|
6
5
|
import { configProps, fieldMetadata, stateProps } from './mock';
|
|
@@ -16,7 +15,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
16
15
|
export default meta;
|
|
17
16
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
18
17
|
|
|
19
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
18
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
20
19
|
|
|
21
20
|
const props = {
|
|
22
21
|
value: Number(configProps.value),
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.ts.mustache
CHANGED
|
@@ -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);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import { useState, useEffect } from 'react';
|
|
3
2
|
import {
|
|
4
3
|
CurrencyInput as CosmosCurrency,
|
|
@@ -266,7 +265,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
266
265
|
onBlur={(enteredValue) => {
|
|
267
266
|
const parsedValue = enteredValue !== '' ? Number(enteredValue) : enteredValue;
|
|
268
267
|
if (!readOnly && (!value || value !== parsedValue)) {
|
|
269
|
-
// @ts-ignore
|
|
270
268
|
handleEvent(actions, 'changeNblur', propName, parsedValue);
|
|
271
269
|
if (hasSuggestions) {
|
|
272
270
|
pConn.ignoreSuggestion('');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
// @ts-nocheck
|
|
3
2
|
export const configProps = {
|
|
4
3
|
value: '',
|
|
5
4
|
label: 'Currency Sample',
|
|
@@ -8,7 +7,6 @@ export const configProps = {
|
|
|
8
7
|
allowDecimals: true,
|
|
9
8
|
showGroupSeparators: true,
|
|
10
9
|
alwaysShowISOCode: true,
|
|
11
|
-
placeholder: 'Currency Placeholder',
|
|
12
10
|
helperText: 'Currency Helper Text',
|
|
13
11
|
testId: 'currency-12345678',
|
|
14
12
|
hasSuggestions: false,
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.tsx.mustache
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
4
|
|
|
6
5
|
import { configProps, stateProps, fieldMetadata } from './mock';
|
|
@@ -16,7 +15,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
16
15
|
export default meta;
|
|
17
16
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
18
17
|
|
|
19
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
18
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
20
19
|
|
|
21
20
|
const props = {
|
|
22
21
|
value: configProps.value,
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.ts.mustache
CHANGED
|
@@ -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);
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache
CHANGED
|
@@ -93,9 +93,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
93
93
|
}
|
|
94
94
|
}, [validatemessage, hasSuggestions, status]);
|
|
95
95
|
|
|
96
|
-
let numberOfDecimals = parseInt(decimalPrecision, 10);
|
|
96
|
+
let numberOfDecimals : number | undefined = parseInt(decimalPrecision, 10);
|
|
97
97
|
if (Number.isNaN(numberOfDecimals)) {
|
|
98
|
-
// @ts-ignore
|
|
99
98
|
numberOfDecimals = decimalPrecision === '' ? undefined : 2;
|
|
100
99
|
}
|
|
101
100
|
|
|
@@ -246,7 +245,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
246
245
|
}
|
|
247
246
|
setPercentageValue(enteredValue);
|
|
248
247
|
if (value !== enteredValue) {
|
|
249
|
-
// @ts-ignore
|
|
250
248
|
handleEvent(actions, 'change', propName, enteredValue);
|
|
251
249
|
hasValueChange.current = true;
|
|
252
250
|
}
|
|
@@ -254,7 +252,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
254
252
|
onBlur={() => {
|
|
255
253
|
const parsedValue = percentageValue !== '' ? Number(percentageValue) : '';
|
|
256
254
|
if (!value || hasValueChange.current) {
|
|
257
|
-
// @ts-ignore
|
|
258
255
|
handleEvent(actions, 'blur', propName, parsedValue);
|
|
259
256
|
if (hasSuggestions) {
|
|
260
257
|
pConn.ignoreSuggestion("");
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
// @ts-nocheck
|
|
3
1
|
export const configProps = {
|
|
4
2
|
value: '',
|
|
5
3
|
label: 'Percentage Sample',
|
|
@@ -14,7 +12,8 @@ export const configProps = {
|
|
|
14
12
|
required: false,
|
|
15
13
|
disabled: false,
|
|
16
14
|
status: '',
|
|
17
|
-
validatemessage: ''
|
|
15
|
+
validatemessage: '',
|
|
16
|
+
placeholder: ''
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
export const stateProps = {
|
package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
4
|
|
|
6
5
|
import {{COMPONENT_CLASS_NAME}} from './index';
|
|
7
|
-
import {
|
|
6
|
+
import { configProps } from './mock';
|
|
8
7
|
|
|
9
8
|
const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
10
9
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -51,19 +50,19 @@ window.PCore.getDataPageUtils = () => {
|
|
|
51
50
|
};
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
53
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
55
54
|
|
|
56
55
|
const props = {
|
|
57
56
|
countryCode: configProps.countryCode,
|
|
58
57
|
getPConnect: () => {
|
|
59
58
|
return {
|
|
60
|
-
getValue: value => {
|
|
59
|
+
getValue: (value: any) => {
|
|
61
60
|
return value;
|
|
62
61
|
},
|
|
63
62
|
getContextName: () => {
|
|
64
63
|
return 'app/primary_1';
|
|
65
64
|
},
|
|
66
|
-
getLocalizedValue: value => {
|
|
65
|
+
getLocalizedValue: (value: any) => {
|
|
67
66
|
return value;
|
|
68
67
|
},
|
|
69
68
|
getActionsApi: () => {
|
|
@@ -119,9 +119,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
119
119
|
// only retrieve table data if table is shown
|
|
120
120
|
if (showTable) {
|
|
121
121
|
PCore.getDataPageUtils()
|
|
122
|
-
// @ts-ignore
|
|
123
122
|
.getDataAsync(dataViewName, context, params, null, null)
|
|
124
|
-
// @ts-ignore
|
|
125
123
|
.then((response: any) => {
|
|
126
124
|
setIsLoading(false);
|
|
127
125
|
// table requires an index or will get setExtraStackFrame error
|
|
@@ -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);
|
|
@@ -111,21 +111,18 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
111
111
|
|
|
112
112
|
useEffect(() => {
|
|
113
113
|
if (displayAs === 'slider' && value === '') {
|
|
114
|
-
// @ts-ignore
|
|
115
114
|
handleEvent(actions, 'change', propName, sliderDefaultValue);
|
|
116
115
|
}
|
|
117
116
|
}, [actions, displayAs, propName, sliderDefaultValue, value]);
|
|
118
117
|
|
|
119
118
|
const { decimalPrecision, currencyDecimalPrecision = 'auto', currencyISOCode = 'USD' } = props;
|
|
120
|
-
let noOfDecimals = parseInt(decimalPrecision, 10);
|
|
121
|
-
// @ts-ignore
|
|
119
|
+
let noOfDecimals : number | undefined = parseInt(decimalPrecision, 10);
|
|
122
120
|
if (Number.isNaN(noOfDecimals)) noOfDecimals = undefined;
|
|
123
121
|
let noOfFractionDigits = currencyDecimalPrecision === 'auto' ? undefined : parseInt(currencyDecimalPrecision, 10);
|
|
124
122
|
let unit;
|
|
125
123
|
let unitPlacement;
|
|
126
124
|
|
|
127
|
-
|
|
128
|
-
if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode)) {
|
|
125
|
+
if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode as string)) {
|
|
129
126
|
switch (formatter) {
|
|
130
127
|
case 'Decimal': {
|
|
131
128
|
break;
|
|
@@ -232,13 +229,11 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
232
229
|
setIntegerValue(enteredValue);
|
|
233
230
|
// const parsedValue = integerValue !== '' ? Number(integerValue) : '';
|
|
234
231
|
if (value !== (enteredValue !== '' ? Number(enteredValue) : '')) {
|
|
235
|
-
// @ts-ignore
|
|
236
232
|
handleEvent(actions, 'change', propName, enteredValue !== '' ? Number(enteredValue) : '');
|
|
237
233
|
hasValueChange.current = true;
|
|
238
234
|
}
|
|
239
235
|
// In case of stepper variation there is no blur event as component is never focussed unless forced. Need to update redux on change.
|
|
240
236
|
if (displayAs === 'stepper') {
|
|
241
|
-
// @ts-ignore
|
|
242
237
|
handleEvent(actions, 'changeNblur', propName, enteredValue !== '' ? Number(enteredValue) : '');
|
|
243
238
|
}
|
|
244
239
|
}
|
|
@@ -270,7 +265,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
270
265
|
ticks={showTicks && { [min]: `${min}`, [max]: `${max}` }}
|
|
271
266
|
onChange={(selectedValue) => {
|
|
272
267
|
onChangeHandler(selectedValue.toString());
|
|
273
|
-
// @ts-ignore
|
|
274
268
|
handleEvent(actions, 'changeNblur', propName, selectedValue);
|
|
275
269
|
}}
|
|
276
270
|
/>
|
|
@@ -297,7 +291,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
297
291
|
}}
|
|
298
292
|
onBlur={() => {
|
|
299
293
|
if (!readOnly && (hasValueChange.current || !value)) {
|
|
300
|
-
// @ts-ignore
|
|
301
294
|
handleEvent(actions, 'blur', propName, integerValue !== '' ? Number(integerValue) : '');
|
|
302
295
|
if (hasSuggestions) {
|
|
303
296
|
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 = {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
1
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
2
|
import { useState } from 'react';
|
|
5
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
4
|
|
|
@@ -17,7 +15,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
17
15
|
export default meta;
|
|
18
16
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
19
17
|
|
|
20
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
18
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
21
19
|
|
|
22
20
|
const [value, setValue] = useState(configProps.value);
|
|
23
21
|
|
|
@@ -33,10 +31,10 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
33
31
|
getStateProps: () => {
|
|
34
32
|
return stateProps;
|
|
35
33
|
},
|
|
36
|
-
getLocalizedValue: val => {
|
|
34
|
+
getLocalizedValue: (val: any) => {
|
|
37
35
|
return val;
|
|
38
36
|
},
|
|
39
|
-
getLocaleRuleNameFromKeys: (localeClass, localeContext, localeName) => {
|
|
37
|
+
getLocaleRuleNameFromKeys: (localeClass: string, localeContext: string, localeName: string) => {
|
|
40
38
|
return `${localeClass}!${localeContext}!${localeName}`;
|
|
41
39
|
},
|
|
42
40
|
getCaseInfo: () => {
|
|
@@ -51,7 +49,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
51
49
|
},
|
|
52
50
|
getActionsApi: () => {
|
|
53
51
|
return {
|
|
54
|
-
updateFieldValue: (propName, theValue) => {
|
|
52
|
+
updateFieldValue: (propName: string, theValue: any) => {
|
|
55
53
|
setValue(theValue);
|
|
56
54
|
},
|
|
57
55
|
triggerFieldChange: () => {/* nothing */}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
|
|
3
|
-
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { useState, useEffect, useRef, type Key } from 'react';
|
|
4
3
|
import { Select, Option, FieldValueList, Text, withConfiguration } from '@pega/cosmos-react-core';
|
|
5
4
|
|
|
6
5
|
import type { PConnFieldProps } from './PConnProps';
|
|
@@ -27,7 +26,7 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
|
27
26
|
alwaysShowISOCode: boolean;
|
|
28
27
|
isoCodeSelection: string;
|
|
29
28
|
additionalProps: any;
|
|
30
|
-
datasource:
|
|
29
|
+
datasource:any;
|
|
31
30
|
listType: string;
|
|
32
31
|
fieldMetadata: any;
|
|
33
32
|
onRecordChange: Function;
|
|
@@ -117,7 +116,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
117
116
|
label,
|
|
118
117
|
hideLabel = false,
|
|
119
118
|
placeholder,
|
|
120
|
-
datasource =
|
|
119
|
+
datasource = {},
|
|
121
120
|
listType,
|
|
122
121
|
validatemessage,
|
|
123
122
|
testId,
|
|
@@ -168,11 +167,9 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
168
167
|
const configProps = pConnect.getConfigProps();
|
|
169
168
|
const items: Array<any> = [];
|
|
170
169
|
const isDatapage = listType === 'datapage';
|
|
171
|
-
// @ts-ignore
|
|
172
170
|
let listSourceItems = isDatapage ? configProps.listOutput : datasource;
|
|
173
171
|
|
|
174
172
|
if (isDatapage && typeof datasource === 'object' && !Array.isArray(listSourceItems)) {
|
|
175
|
-
// @ts-ignore
|
|
176
173
|
listSourceItems = datasource.source ? datasource.source : [];
|
|
177
174
|
}
|
|
178
175
|
|
|
@@ -192,8 +189,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
192
189
|
// Loop through all of our list source items that make up the values of the dropdown
|
|
193
190
|
|
|
194
191
|
let selectedLabel = '';
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
(listSourceItems || []).forEach(
|
|
193
|
+
(item: { key: Key | null | undefined; text: string; value: string }) => {
|
|
197
194
|
selectedLabel =
|
|
198
195
|
value !== undefined &&
|
|
199
196
|
value !== null &&
|
|
@@ -203,18 +200,17 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
203
200
|
? item.text || item.value
|
|
204
201
|
: selectedLabel;
|
|
205
202
|
items.push(
|
|
203
|
+
// @ts-ignore
|
|
206
204
|
<Option key={item.key} value={item.key}>
|
|
207
205
|
{isDatapage
|
|
208
206
|
? pConnect.getLocalizedValue(
|
|
209
207
|
item.text,
|
|
210
208
|
localePath,
|
|
211
|
-
// @ts-ignore
|
|
212
209
|
pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
213
210
|
)
|
|
214
211
|
: pConnect.getLocalizedValue(
|
|
215
212
|
item.value,
|
|
216
213
|
localePath,
|
|
217
|
-
// @ts-ignore
|
|
218
214
|
pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
219
215
|
)}
|
|
220
216
|
</Option>
|
|
@@ -317,7 +313,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
317
313
|
required={required}
|
|
318
314
|
readOnly={readOnly}
|
|
319
315
|
onChange={(event) => {
|
|
320
|
-
// @ts-ignore
|
|
321
316
|
handleEvent(actions, 'changeNblur', propName, event.target.value);
|
|
322
317
|
if (hasSuggestions) {
|
|
323
318
|
pConnect.ignoreSuggestion('');
|
|
@@ -327,9 +322,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
327
322
|
onRecordChange(event);
|
|
328
323
|
}
|
|
329
324
|
}}
|
|
330
|
-
|
|
331
|
-
onBlur={(event) => {
|
|
332
|
-
// @ts-ignore
|
|
325
|
+
onBlur={(event: any) => {
|
|
333
326
|
pConnect.getValidationApi().validate(event.target.value);
|
|
334
327
|
}}
|
|
335
328
|
onResolveSuggestion={onResolveSuggestionHandler}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
1
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
2
|
import { useState } from 'react';
|
|
5
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
4
|
|
|
@@ -17,7 +15,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
17
15
|
export default meta;
|
|
18
16
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
19
17
|
|
|
20
|
-
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
18
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
|
|
21
19
|
|
|
22
20
|
const [value, setValue] = useState(configProps.value);
|
|
23
21
|
const datasourceMetadata = fieldMetadata;
|
|
@@ -40,10 +38,10 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
40
38
|
getContextName: () => {
|
|
41
39
|
return 'app/primary_1';
|
|
42
40
|
},
|
|
43
|
-
getLocalizedValue: val => {
|
|
41
|
+
getLocalizedValue: (val: any) => {
|
|
44
42
|
return val;
|
|
45
43
|
},
|
|
46
|
-
getLocaleRuleNameFromKeys: (localeClass, localeContext, localeName) => {
|
|
44
|
+
getLocaleRuleNameFromKeys: (localeClass: string, localeContext: string, localeName: string) => {
|
|
47
45
|
return `${localeClass}!${localeContext}!${localeName}`;
|
|
48
46
|
},
|
|
49
47
|
getCaseInfo: () => {
|
|
@@ -58,7 +56,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
58
56
|
},
|
|
59
57
|
getActionsApi: () => {
|
|
60
58
|
return {
|
|
61
|
-
updateFieldValue: (propName, theValue) => {
|
|
59
|
+
updateFieldValue: (propName: string, theValue: any) => {
|
|
62
60
|
setValue(theValue);
|
|
63
61
|
},
|
|
64
62
|
triggerFieldChange: () => {/* nothing */}
|