@pega/dx-component-builder-sdk 0.1.7 → 0.1.8
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/build/helper.js +1 -1
- package/src/tasks/create/index.js +8 -1
- package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +60 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +61 -0
- package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +41 -0
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +179 -67
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +40 -16
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +3 -1
- package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js → date-utils.js.mustache} +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +40 -15
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +2 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +22 -17
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +25 -17
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +3 -4
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +22 -17
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +8 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +22 -17
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +42 -14
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +44 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +67 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +21 -16
- package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +13 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +20 -16
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +44 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.js → StatusWork.jsx} +0 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +21 -17
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +46 -3
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +21 -17
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +44 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +19 -17
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +46 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +37 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +19 -17
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +174 -3
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +24 -16
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +110 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +3 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +179 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +3 -6
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +118 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +3 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +215 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +3 -3
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +89 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +6 -10
- package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +125 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +100 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +5 -11
- package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +131 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.js.mustache → GetNextWork.jsx.mustache} +6 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +102 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +9 -7
- package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +94 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +4 -1
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +389 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +30 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.js.mustache → Avatar.jsx.mustache} +2 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.js.mustache → Operator.jsx.mustache} +2 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +68 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +51 -0
- package/src/tasks/map/map.js +0 -7
- package/src/tasks/override/index.js +38 -9
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +0 -43
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +0 -172
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
1
|
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
3
|
-
|
|
2
|
+
import { configProps, stateProps } from './mock.stories';
|
|
4
3
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
4
|
|
|
6
5
|
export default {
|
|
@@ -9,31 +8,56 @@ export default {
|
|
|
9
8
|
component: {{COMPONENT_CLASS_NAME}}
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (!window.PCore) {
|
|
12
|
+
window.PCore = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
window.PCore.getEnvironmentInfo = () => {
|
|
16
|
+
return {
|
|
17
|
+
getLocale: () => {
|
|
18
|
+
return 'en-GB';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
14
22
|
|
|
23
|
+
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
24
|
const props = {
|
|
16
25
|
getPConnect: () => {
|
|
17
26
|
return {
|
|
18
27
|
getActionsApi: () => {
|
|
19
28
|
return {
|
|
20
|
-
updateFieldValue: (
|
|
21
|
-
|
|
22
|
-
}
|
|
29
|
+
updateFieldValue: () => {},
|
|
30
|
+
triggerFieldChange: () => {}
|
|
23
31
|
};
|
|
24
32
|
},
|
|
25
33
|
getStateProps: () => {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
34
|
+
return stateProps;
|
|
35
|
+
},
|
|
36
|
+
getConfigProps: () => {
|
|
37
|
+
return configProps;
|
|
38
|
+
},
|
|
39
|
+
ignoreSuggestion: () => {},
|
|
40
|
+
acceptSuggestion: () => {},
|
|
41
|
+
clearErrorMessages: () => {}
|
|
28
42
|
};
|
|
29
43
|
},
|
|
30
|
-
value,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
value: configProps.value,
|
|
45
|
+
validatemessage: configProps.validatemessage,
|
|
46
|
+
label: configProps.label,
|
|
47
|
+
hideLabel: configProps.hideLabel,
|
|
48
|
+
helperText: configProps.helperText,
|
|
49
|
+
nextYearRange: configProps.nextYearRange,
|
|
50
|
+
previousYearRange: configProps.previousYearRange,
|
|
51
|
+
showWeekNumber: configProps.showWeekNumber,
|
|
52
|
+
testId: configProps.testId,
|
|
53
|
+
showAsFormattedText: configProps.showAsFormattedText,
|
|
54
|
+
additionalProps: configProps.additionalProps,
|
|
55
|
+
displayMode: configProps.displayMode,
|
|
56
|
+
variant: configProps.variant,
|
|
57
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
58
|
+
disabled: configProps.disabled,
|
|
59
|
+
readOnly: configProps.readOnly,
|
|
60
|
+
required: configProps.required
|
|
37
61
|
};
|
|
38
62
|
|
|
39
63
|
return (
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
1
2
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { DateInput, FieldValueList, DateTimeDisplay, Text
|
|
3
|
+
import { DateInput, FieldValueList, DateTimeDisplay, Text, } from '@pega/cosmos-react-core';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import FormattedText from "./FormattedText.jsx";
|
|
4
6
|
|
|
5
7
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
6
8
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '2023-01-31T12:23:00.000Z',
|
|
3
|
+
validatemessage: '',
|
|
4
|
+
label: 'Date Label',
|
|
5
|
+
hideLabel: false,
|
|
6
|
+
helperText: 'Date helper text',
|
|
7
|
+
nextYearRange: '10',
|
|
8
|
+
previousYearRange: '10',
|
|
9
|
+
showWeekNumber: true,
|
|
10
|
+
testId: '12345678',
|
|
11
|
+
showAsFormattedText: true,
|
|
12
|
+
additionalProps: {},
|
|
13
|
+
displayMode: '',
|
|
14
|
+
variant: '',
|
|
15
|
+
hasSuggestions: false,
|
|
16
|
+
readOnly: false,
|
|
17
|
+
required: false,
|
|
18
|
+
disabled: false
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const stateProps = {
|
|
22
|
+
value: '.DateLabel'
|
|
23
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
3
|
-
|
|
3
|
+
import { configProps, stateProps } from './mock.stories';
|
|
4
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
@@ -9,31 +9,56 @@ export default {
|
|
|
9
9
|
component: {{COMPONENT_CLASS_NAME}}
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (!window.PCore) {
|
|
13
|
+
window.PCore = {};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
window.PCore.getEnvironmentInfo = () => {
|
|
17
|
+
return {
|
|
18
|
+
getTimeZone: () => {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
14
23
|
|
|
24
|
+
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
25
|
const props = {
|
|
16
26
|
getPConnect: () => {
|
|
17
27
|
return {
|
|
18
28
|
getActionsApi: () => {
|
|
19
29
|
return {
|
|
20
|
-
updateFieldValue: (
|
|
21
|
-
|
|
22
|
-
}
|
|
30
|
+
updateFieldValue: () => {},
|
|
31
|
+
triggerFieldChange: () => {}
|
|
23
32
|
};
|
|
24
33
|
},
|
|
25
34
|
getStateProps: () => {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
35
|
+
return stateProps;
|
|
36
|
+
},
|
|
37
|
+
getConfigProps: () => {
|
|
38
|
+
return configProps;
|
|
39
|
+
},
|
|
40
|
+
ignoreSuggestion: () => {},
|
|
41
|
+
acceptSuggestion: () => {},
|
|
42
|
+
clearErrorMessages: () => {}
|
|
28
43
|
};
|
|
29
44
|
},
|
|
30
|
-
value,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
value: configProps.value,
|
|
46
|
+
validatemessage: configProps.validatemessage,
|
|
47
|
+
label: configProps.label,
|
|
48
|
+
hideLabel: configProps.hideLabel,
|
|
49
|
+
helperText: configProps.helperText,
|
|
50
|
+
withSeconds: configProps.withSeconds,
|
|
51
|
+
nextYearRange: configProps.nextYearRange,
|
|
52
|
+
previousYearRange: configProps.previousYearRange,
|
|
53
|
+
showWeekNumber: configProps.showWeekNumber,
|
|
54
|
+
testId: configProps.testId,
|
|
55
|
+
additionalProps: configProps.additionalProps,
|
|
56
|
+
displayMode: configProps.displayMode,
|
|
57
|
+
variant: configProps.variant,
|
|
58
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
59
|
+
disabled: configProps.disabled,
|
|
60
|
+
readOnly: configProps.readOnly,
|
|
61
|
+
required: configProps.required
|
|
37
62
|
};
|
|
38
63
|
|
|
39
64
|
return (
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
1
2
|
import { useEffect, useState } from 'react';
|
|
2
3
|
import { DateTimeInput, FieldValueList, DateTimeDisplay, Text } from "@pega/cosmos-react-core";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
@@ -246,6 +247,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
246
247
|
displayMode: PropTypes.string,
|
|
247
248
|
variant: PropTypes.string,
|
|
248
249
|
formatter: PropTypes.string,
|
|
250
|
+
Format: PropTypes.string,
|
|
249
251
|
hasSuggestions: PropTypes.bool
|
|
250
252
|
};
|
|
251
253
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '2023-01-24T16:45:00.000Z',
|
|
3
|
+
validatemessage: '',
|
|
4
|
+
label: 'DateTime Label',
|
|
5
|
+
hideLabel: false,
|
|
6
|
+
helperText: 'DateTime helper text',
|
|
7
|
+
withSeconds: false,
|
|
8
|
+
nextYearRange: '10',
|
|
9
|
+
previousYearRange: '5',
|
|
10
|
+
showWeekNumber: false,
|
|
11
|
+
testId: '12345678',
|
|
12
|
+
additionalProps: {},
|
|
13
|
+
displayMode: '',
|
|
14
|
+
variant: '',
|
|
15
|
+
hasSuggestions: false,
|
|
16
|
+
readOnly: false,
|
|
17
|
+
required: false,
|
|
18
|
+
disabled: false
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const stateProps = {
|
|
22
|
+
value: '.DateTimeLabel'
|
|
23
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import { configProps, fieldMetadata, stateProps } from './mock.stories.js';
|
|
3
4
|
|
|
4
5
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
6
|
|
|
@@ -10,30 +11,34 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState('test value');
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
+
value: configProps.value,
|
|
17
|
+
placeholder: configProps.placeholder,
|
|
18
|
+
label: configProps.label,
|
|
19
|
+
helperText: configProps.helperText,
|
|
20
|
+
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
fieldMetadata: fieldMetadata,
|
|
24
|
+
|
|
16
25
|
getPConnect: () => {
|
|
17
26
|
return {
|
|
27
|
+
getStateProps: () => {
|
|
28
|
+
return stateProps;
|
|
29
|
+
},
|
|
18
30
|
getActionsApi: () => {
|
|
19
31
|
return {
|
|
20
|
-
updateFieldValue: (
|
|
21
|
-
|
|
22
|
-
}
|
|
32
|
+
updateFieldValue: () => {},
|
|
33
|
+
triggerFieldChange: () => {}
|
|
23
34
|
};
|
|
24
35
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
36
|
+
ignoreSuggestion: () => {},
|
|
37
|
+
acceptSuggestion: () => {},
|
|
38
|
+
setInheritedProps: () => {},
|
|
39
|
+
resolveConfigProps: () => {}
|
|
28
40
|
};
|
|
29
|
-
}
|
|
30
|
-
value,
|
|
31
|
-
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
-
disabled: boolean('Disabled', false),
|
|
33
|
-
readOnly: boolean('Disabled', false),
|
|
34
|
-
required: boolean('Disabled', false),
|
|
35
|
-
label: text('Label', 'Sample Label'),
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
41
|
+
}
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
return (
|
|
@@ -233,7 +233,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
233
233
|
variant: 'inline',
|
|
234
234
|
currencyISOCode: 'USD',
|
|
235
235
|
formatter: 'defaultDecimal',
|
|
236
|
-
|
|
236
|
+
isoCodeSelection: 'constant',
|
|
237
237
|
negative: 'minus-sign',
|
|
238
238
|
notation: 'standard',
|
|
239
239
|
currencyDisplay: 'symbol',
|
|
@@ -261,6 +261,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
261
261
|
variant: PropTypes.string,
|
|
262
262
|
currencyISOCode: PropTypes.string,
|
|
263
263
|
formatter: PropTypes.string,
|
|
264
|
+
isoCodeSelection: PropTypes.string,
|
|
264
265
|
negative: PropTypes.string,
|
|
265
266
|
notation: PropTypes.string,
|
|
266
267
|
currencyDisplay: PropTypes.string,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Decimal Sample',
|
|
4
|
+
showGroupSeparators: true,
|
|
5
|
+
placeholder: 'Decimal Placeholder',
|
|
6
|
+
helperText: 'Decimal Helper Text',
|
|
7
|
+
testId: 'decimal-12345678',
|
|
8
|
+
hasSuggestions: false
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const stateProps = {
|
|
12
|
+
value: '.DecimalSample',
|
|
13
|
+
hasSuggestions: false
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const fieldMetadata = {
|
|
17
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
18
|
+
type: 'Decimal',
|
|
19
|
+
displayAs: 'pxNumber',
|
|
20
|
+
label: 'Decimal sample'
|
|
21
|
+
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import { configProps, fieldMetadata, stateProps } from './mock.stories.js';
|
|
3
4
|
|
|
4
5
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
6
|
|
|
@@ -10,30 +11,37 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState('test value');
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
+
value: configProps.value,
|
|
17
|
+
placeholder: configProps.placeholder,
|
|
18
|
+
label: configProps.label,
|
|
19
|
+
helperText: configProps.helperText,
|
|
20
|
+
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
|
+
allowDecimals: configProps.allowDecimals,
|
|
22
|
+
currencyISOCode: configProps.currencyISOCode,
|
|
23
|
+
alwaysShowISOCode: configProps.alwaysShowISOCode,
|
|
24
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
25
|
+
testId: configProps.testId,
|
|
26
|
+
fieldMetadata: fieldMetadata,
|
|
27
|
+
|
|
16
28
|
getPConnect: () => {
|
|
17
29
|
return {
|
|
30
|
+
getStateProps: () => {
|
|
31
|
+
return stateProps;
|
|
32
|
+
},
|
|
18
33
|
getActionsApi: () => {
|
|
19
34
|
return {
|
|
20
|
-
updateFieldValue: (
|
|
21
|
-
|
|
22
|
-
}
|
|
35
|
+
updateFieldValue: () => {},
|
|
36
|
+
triggerFieldChange: () => {}
|
|
23
37
|
};
|
|
24
38
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
39
|
+
ignoreSuggestion: () => {},
|
|
40
|
+
acceptSuggestion: () => {},
|
|
41
|
+
setInheritedProps: () => {},
|
|
42
|
+
resolveConfigProps: () => {}
|
|
28
43
|
};
|
|
29
|
-
}
|
|
30
|
-
value,
|
|
31
|
-
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
-
disabled: boolean('Disabled', false),
|
|
33
|
-
readOnly: boolean('Disabled', false),
|
|
34
|
-
required: boolean('Disabled', false),
|
|
35
|
-
label: text('Label', 'Sample Label'),
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
44
|
+
}
|
|
37
45
|
};
|
|
38
46
|
|
|
39
47
|
return (
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
NumberDisplay,
|
|
6
6
|
FieldValueList,
|
|
7
7
|
Text,
|
|
8
|
-
useConfiguration,
|
|
9
8
|
useAfterInitialEffect
|
|
10
9
|
} from '@pega/cosmos-react-core';
|
|
11
10
|
import PropTypes from 'prop-types';
|
|
@@ -14,6 +13,8 @@ import PropTypes from 'prop-types';
|
|
|
14
13
|
import handleEvent from './event-utils';
|
|
15
14
|
import { suggestionsHandler } from './suggestions-handler';
|
|
16
15
|
|
|
16
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
17
|
+
|
|
17
18
|
const formatValue = (value) => {
|
|
18
19
|
if (!value && value !== 0) return '';
|
|
19
20
|
const [integer, decimal = ''] = value.toString().split('.');
|
|
@@ -21,9 +22,6 @@ const formatValue = (value) => {
|
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
26
|
-
|
|
27
25
|
// Duplicated runtime code from Constellation Design System Component
|
|
28
26
|
|
|
29
27
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
@@ -275,6 +273,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
275
273
|
decimalPrecision: PropTypes.number,
|
|
276
274
|
allowDecimals: PropTypes.bool,
|
|
277
275
|
currencyISOCode: PropTypes.string,
|
|
276
|
+
isoCodeSelection: PropTypes.string,
|
|
278
277
|
hideLabel: PropTypes.bool,
|
|
279
278
|
getPConnect: PropTypes.func.isRequired,
|
|
280
279
|
validatemessage: PropTypes.string,
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Currency Sample',
|
|
4
|
+
currencyISOCode: 'USD',
|
|
5
|
+
allowDecimals: true,
|
|
6
|
+
alwaysShowISOCode: true,
|
|
7
|
+
placeholder: 'Currency Placeholder',
|
|
8
|
+
helperText: 'Currency Helper Text',
|
|
9
|
+
testId: 'currency-12345678',
|
|
10
|
+
hasSuggestions: false
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const stateProps = {
|
|
14
|
+
value: '.CurrencySample',
|
|
15
|
+
hasSuggestions: false
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const fieldMetadata = {
|
|
19
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
20
|
+
type: 'Decimal',
|
|
21
|
+
displayAs: 'pxCurrency',
|
|
22
|
+
label: 'Currency sample'
|
|
23
|
+
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import { configProps, stateProps, fieldMetadata } from './mock.stories.js';
|
|
3
4
|
|
|
4
5
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
6
|
|
|
@@ -10,30 +11,34 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState('test value');
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
+
value: configProps.value,
|
|
17
|
+
placeholder: configProps.placeholder,
|
|
18
|
+
label: configProps.label,
|
|
19
|
+
helperText: configProps.helperText,
|
|
20
|
+
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
fieldMetadata: fieldMetadata,
|
|
24
|
+
|
|
16
25
|
getPConnect: () => {
|
|
17
26
|
return {
|
|
27
|
+
getStateProps: () => {
|
|
28
|
+
return stateProps;
|
|
29
|
+
},
|
|
18
30
|
getActionsApi: () => {
|
|
19
31
|
return {
|
|
20
|
-
updateFieldValue: (
|
|
21
|
-
|
|
22
|
-
}
|
|
32
|
+
updateFieldValue: () => {},
|
|
33
|
+
triggerFieldChange: () => {}
|
|
23
34
|
};
|
|
24
35
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
36
|
+
ignoreSuggestion: () => {},
|
|
37
|
+
acceptSuggestion: () => {},
|
|
38
|
+
setInheritedProps: () => {},
|
|
39
|
+
resolveConfigProps: () => {}
|
|
28
40
|
};
|
|
29
|
-
}
|
|
30
|
-
value,
|
|
31
|
-
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
-
disabled: boolean('Disabled', false),
|
|
33
|
-
readOnly: boolean('Disabled', false),
|
|
34
|
-
required: boolean('Disabled', false),
|
|
35
|
-
label: text('Label', 'Sample Label'),
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
41
|
+
}
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
return (
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
NumberInput,
|
|
4
|
+
NumberDisplay,
|
|
5
|
+
CurrencyDisplay,
|
|
6
|
+
FieldValueList,
|
|
7
|
+
Text
|
|
8
|
+
} from '@pega/cosmos-react-core';
|
|
3
9
|
import PropTypes from 'prop-types';
|
|
4
10
|
|
|
5
|
-
//
|
|
11
|
+
// includes in bundle
|
|
6
12
|
import handleEvent from './event-utils';
|
|
7
13
|
import { suggestionsHandler } from './suggestions-handler';
|
|
8
14
|
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Percentage Sample',
|
|
4
|
+
showGroupSeparators: true,
|
|
5
|
+
placeholder: 'Percentage Placeholder',
|
|
6
|
+
helperText: 'Percentage Helper Text',
|
|
7
|
+
testId: 'percentage-12345678',
|
|
8
|
+
hasSuggestions: false
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const stateProps = {
|
|
12
|
+
value: '.PercentageSample',
|
|
13
|
+
hasSuggestions: false
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const fieldMetadata = {
|
|
17
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
18
|
+
type: 'Decimal',
|
|
19
|
+
displayAs: 'pxPercentage',
|
|
20
|
+
label: 'Percentage sample'
|
|
21
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import { stateProps, configProps, fieldMetadata } from './mock.stories';
|
|
3
4
|
|
|
4
5
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
6
|
|
|
@@ -10,30 +11,34 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState('test value');
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
+
value: configProps.value,
|
|
17
|
+
placeholder: configProps.placeholder,
|
|
18
|
+
label: configProps.label,
|
|
19
|
+
helperText: configProps.helperText,
|
|
20
|
+
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
fieldMetadata: fieldMetadata,
|
|
24
|
+
|
|
16
25
|
getPConnect: () => {
|
|
17
26
|
return {
|
|
27
|
+
getStateProps: () => {
|
|
28
|
+
return stateProps;
|
|
29
|
+
},
|
|
18
30
|
getActionsApi: () => {
|
|
19
31
|
return {
|
|
20
|
-
updateFieldValue: (
|
|
21
|
-
|
|
22
|
-
}
|
|
32
|
+
updateFieldValue: () => {},
|
|
33
|
+
triggerFieldChange: () => {}
|
|
23
34
|
};
|
|
24
35
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
36
|
+
ignoreSuggestion: () => {},
|
|
37
|
+
acceptSuggestion: () => {},
|
|
38
|
+
setInheritedProps: () => {},
|
|
39
|
+
resolveConfigProps: () => {}
|
|
28
40
|
};
|
|
29
|
-
}
|
|
30
|
-
value,
|
|
31
|
-
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
-
disabled: boolean('Disabled', false),
|
|
33
|
-
readOnly: boolean('Disabled', false),
|
|
34
|
-
required: boolean('Disabled', false),
|
|
35
|
-
label: text('Label', 'Sample Label'),
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
41
|
+
}
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
return (
|
|
@@ -323,9 +323,10 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
323
323
|
variant: PropTypes.string,
|
|
324
324
|
decimalPrecision: PropTypes.number,
|
|
325
325
|
currencyISOCode: PropTypes.string,
|
|
326
|
+
isoCodeSelection: PropTypes.string,
|
|
326
327
|
formatter: PropTypes.string,
|
|
327
328
|
negative: PropTypes.string,
|
|
328
|
-
|
|
329
|
+
notation: PropTypes.string,
|
|
329
330
|
currencyDisplay: PropTypes.string,
|
|
330
331
|
currencyDecimalPrecision: PropTypes.string,
|
|
331
332
|
isTableFormatter: PropTypes.bool,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Integer Sample',
|
|
4
|
+
showGroupSeparators: true,
|
|
5
|
+
placeholder: 'Integer Placeholder',
|
|
6
|
+
helperText: 'Integer Helper Text',
|
|
7
|
+
testId: 'integer-12345678',
|
|
8
|
+
hasSuggestions: false
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const stateProps = {
|
|
12
|
+
value: '.IntegerSample',
|
|
13
|
+
hasSuggestions: false
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const fieldMetadata = {
|
|
17
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
18
|
+
type: 'Integer',
|
|
19
|
+
displayAs: 'pxInteger',
|
|
20
|
+
label: 'Integer sample'
|
|
21
|
+
};
|