@pega/custom-dx-components 2.0.23 → 2.0.25
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/README.md +1 -1
- package/package.json +3 -6
- package/src/cli.js +0 -18
- package/src/constants.js +2 -32
- package/src/tasks/authenticate/helper.js +5 -63
- package/src/tasks/authenticate/index.js +50 -107
- package/src/tasks/create/index.js +63 -59
- 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 +16 -33
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +67 -179
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +17 -46
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +1 -3
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js.mustache → date-utils.js} +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +17 -46
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +17 -26
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +4 -3
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +2 -8
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +16 -50
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +1 -44
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +16 -23
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +2 -44
- package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.jsx → StatusWork.js} +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +3 -46
- package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +2 -44
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +3 -47
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-URL/{text-url.jsx.mustache → text-url.js.mustache} +1 -2
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +17 -30
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +29 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +77 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +29 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +74 -3
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +10 -6
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +8 -10
- package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.jsx.mustache → GetNextWork.js.mustache} +0 -6
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +7 -9
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +1 -4
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.jsx.mustache → Avatar.js.mustache} +0 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.jsx.mustache → Operator.js.mustache} +1 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
- package/src/tasks/delete/helper.js +0 -4
- package/src/tasks/delete/index.js +0 -4
- package/src/tasks/index.js +0 -3
- package/src/tasks/init/index.js +3 -3
- package/src/tasks/init/template/.eslintrc.json +5 -186
- package/src/tasks/init/template/README.md +59 -75
- package/src/tasks/init/template/package.json.mustache +6 -21
- package/src/tasks/init/template/tasks.config.json +2 -5
- package/src/tasks/list/index.js +0 -4
- package/src/tasks/{bundle → publish/bundle}/builder/webpack.config.js +2 -0
- package/src/tasks/{bundle → publish/bundle}/index.js +2 -2
- package/src/tasks/publish/index.js +1 -14
- package/src/util.js +6 -11
- package/src/auth.js +0 -563
- package/src/tasks/build/helper.js +0 -123
- package/src/tasks/build/index.js +0 -54
- package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -61
- package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -41
- package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +0 -67
- package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +0 -13
- package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +0 -22
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +0 -20
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +0 -37
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +0 -22
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +0 -20
- package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +0 -26
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +0 -118
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +0 -179
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +0 -26
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +0 -123
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +0 -215
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +0 -93
- package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +0 -125
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +0 -100
- package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +0 -131
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +0 -101
- package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +0 -94
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +0 -78
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +0 -390
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +0 -30
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +0 -68
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +0 -51
- package/src/tasks/delete-all/helper.js +0 -175
- package/src/tasks/delete-all/index.js +0 -49
- package/src/tasks/init/template/.eslintignore +0 -8
- package/src/tasks/linter/index.js +0 -46
- package/src/tasks/publish-all/helper.js +0 -139
- package/src/tasks/publish-all/index.js +0 -84
- /package/src/tasks/{bundle → publish/bundle}/builder/index.js +0 -0
- /package/src/tasks/{bundle → publish/bundle}/builder/modules.js +0 -0
- /package/src/tasks/{bundle → publish/bundle}/builder/paths.js +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { configProps, fieldMetadata, stateProps } from './mock.stories.js';
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
4
3
|
|
|
5
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
6
5
|
|
|
@@ -11,34 +10,30 @@ export default {
|
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
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,
|
|
24
|
-
|
|
25
16
|
getPConnect: () => {
|
|
26
17
|
return {
|
|
27
|
-
getStateProps: () => {
|
|
28
|
-
return stateProps;
|
|
29
|
-
},
|
|
30
18
|
getActionsApi: () => {
|
|
31
19
|
return {
|
|
32
|
-
updateFieldValue: () => {
|
|
33
|
-
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
34
23
|
};
|
|
35
24
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
resolveConfigProps: () => {/* nothing */}
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
40
28
|
};
|
|
41
|
-
}
|
|
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')
|
|
42
37
|
};
|
|
43
38
|
|
|
44
39
|
return (
|
|
@@ -233,7 +233,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
233
233
|
variant: 'inline',
|
|
234
234
|
currencyISOCode: 'USD',
|
|
235
235
|
formatter: 'defaultDecimal',
|
|
236
|
-
|
|
236
|
+
isoCodeSelectiopn: 'constant',
|
|
237
237
|
negative: 'minus-sign',
|
|
238
238
|
notation: 'standard',
|
|
239
239
|
currencyDisplay: 'symbol',
|
|
@@ -261,7 +261,6 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
261
261
|
variant: PropTypes.string,
|
|
262
262
|
currencyISOCode: PropTypes.string,
|
|
263
263
|
formatter: PropTypes.string,
|
|
264
|
-
isoCodeSelection: PropTypes.string,
|
|
265
264
|
negative: PropTypes.string,
|
|
266
265
|
notation: PropTypes.string,
|
|
267
266
|
currencyDisplay: PropTypes.string,
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { configProps, fieldMetadata, stateProps } from './mock.stories.js';
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
4
3
|
|
|
5
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
6
5
|
|
|
@@ -11,38 +10,30 @@ export default {
|
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
+
const [value, setValue] = useState('test value');
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
-
value: Number(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,
|
|
27
|
-
|
|
28
16
|
getPConnect: () => {
|
|
29
17
|
return {
|
|
30
|
-
getStateProps: () => {
|
|
31
|
-
return stateProps;
|
|
32
|
-
},
|
|
33
18
|
getActionsApi: () => {
|
|
34
19
|
return {
|
|
35
|
-
updateFieldValue: () => {
|
|
36
|
-
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
37
23
|
};
|
|
38
24
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
resolveConfigProps: () => {/* nothing */},
|
|
43
|
-
clearErrorMessages: () => {/* nothing */}
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
44
28
|
};
|
|
45
|
-
}
|
|
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')
|
|
46
37
|
};
|
|
47
38
|
|
|
48
39
|
return (
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
NumberDisplay,
|
|
6
6
|
FieldValueList,
|
|
7
7
|
Text,
|
|
8
|
+
useConfiguration,
|
|
8
9
|
useAfterInitialEffect
|
|
9
10
|
} from '@pega/cosmos-react-core';
|
|
10
11
|
import PropTypes from 'prop-types';
|
|
@@ -13,8 +14,6 @@ import PropTypes from 'prop-types';
|
|
|
13
14
|
import handleEvent from './event-utils';
|
|
14
15
|
import { suggestionsHandler } from './suggestions-handler';
|
|
15
16
|
|
|
16
|
-
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
17
|
-
|
|
18
17
|
const formatValue = (value) => {
|
|
19
18
|
if (!value && value !== 0) return '';
|
|
20
19
|
const [integer, decimal = ''] = value.toString().split('.');
|
|
@@ -22,6 +21,9 @@ const formatValue = (value) => {
|
|
|
22
21
|
};
|
|
23
22
|
|
|
24
23
|
|
|
24
|
+
|
|
25
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
26
|
+
|
|
25
27
|
// Duplicated runtime code from Constellation Design System Component
|
|
26
28
|
|
|
27
29
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
@@ -273,7 +275,6 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
273
275
|
decimalPrecision: PropTypes.number,
|
|
274
276
|
allowDecimals: PropTypes.bool,
|
|
275
277
|
currencyISOCode: PropTypes.string,
|
|
276
|
-
isoCodeSelection: PropTypes.string,
|
|
277
278
|
hideLabel: PropTypes.bool,
|
|
278
279
|
getPConnect: PropTypes.func.isRequired,
|
|
279
280
|
validatemessage: PropTypes.string,
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { configProps, stateProps, fieldMetadata } from './mock.stories.js';
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
4
3
|
|
|
5
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
6
5
|
|
|
@@ -11,34 +10,30 @@ export default {
|
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
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,
|
|
24
|
-
|
|
25
16
|
getPConnect: () => {
|
|
26
17
|
return {
|
|
27
|
-
getStateProps: () => {
|
|
28
|
-
return stateProps;
|
|
29
|
-
},
|
|
30
18
|
getActionsApi: () => {
|
|
31
19
|
return {
|
|
32
|
-
updateFieldValue: () => {
|
|
33
|
-
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
34
23
|
};
|
|
35
24
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
resolveConfigProps: () => {/* nothing */}
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
40
28
|
};
|
|
41
|
-
}
|
|
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')
|
|
42
37
|
};
|
|
43
38
|
|
|
44
39
|
return (
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
NumberInput,
|
|
4
|
-
NumberDisplay,
|
|
5
|
-
CurrencyDisplay,
|
|
6
|
-
FieldValueList,
|
|
7
|
-
Text
|
|
8
|
-
} from '@pega/cosmos-react-core';
|
|
2
|
+
import { NumberInput, NumberDisplay, CurrencyDisplay, FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
9
3
|
import PropTypes from 'prop-types';
|
|
10
4
|
|
|
11
|
-
//
|
|
5
|
+
//inlcudes in bundle
|
|
12
6
|
import handleEvent from './event-utils';
|
|
13
7
|
import { suggestionsHandler } from './suggestions-handler';
|
|
14
8
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { stateProps, configProps, fieldMetadata } from './mock.stories';
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
4
3
|
|
|
5
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
6
5
|
|
|
@@ -11,34 +10,30 @@ export default {
|
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
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,
|
|
24
|
-
|
|
25
16
|
getPConnect: () => {
|
|
26
17
|
return {
|
|
27
|
-
getStateProps: () => {
|
|
28
|
-
return stateProps;
|
|
29
|
-
},
|
|
30
18
|
getActionsApi: () => {
|
|
31
19
|
return {
|
|
32
|
-
updateFieldValue: () => {
|
|
33
|
-
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
34
23
|
};
|
|
35
24
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
resolveConfigProps: () => {/* nothing */}
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
40
28
|
};
|
|
41
|
-
}
|
|
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')
|
|
42
37
|
};
|
|
43
38
|
|
|
44
39
|
return (
|
|
@@ -323,10 +323,9 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
323
323
|
variant: PropTypes.string,
|
|
324
324
|
decimalPrecision: PropTypes.number,
|
|
325
325
|
currencyISOCode: PropTypes.string,
|
|
326
|
-
isoCodeSelection: PropTypes.string,
|
|
327
326
|
formatter: PropTypes.string,
|
|
328
327
|
negative: PropTypes.string,
|
|
329
|
-
|
|
328
|
+
notations: PropTypes.string,
|
|
330
329
|
currencyDisplay: PropTypes.string,
|
|
331
330
|
currencyDecimalPrecision: PropTypes.string,
|
|
332
331
|
isTableFormatter: PropTypes.bool,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
-
|
|
4
|
-
import { configProps, rawMetadata, fieldMetadata, stateProps } from './mock.stories.js';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
5
3
|
|
|
6
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
7
5
|
|
|
@@ -12,62 +10,30 @@ export default {
|
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
|
-
|
|
16
|
-
const [value, setValue] = useState(configProps.value);
|
|
13
|
+
const [value, setValue] = useState('test value');
|
|
17
14
|
|
|
18
15
|
const props = {
|
|
19
|
-
value,
|
|
20
|
-
placeholder: configProps.placeholder,
|
|
21
|
-
label: configProps.label,
|
|
22
|
-
helperText: configProps.helperText,
|
|
23
|
-
datasource: configProps.datasource,
|
|
24
|
-
testId: configProps.testId,
|
|
25
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
26
|
-
fieldMetadata,
|
|
27
|
-
|
|
28
16
|
getPConnect: () => {
|
|
29
17
|
return {
|
|
30
|
-
getConfigProps: () => {
|
|
31
|
-
return configProps;
|
|
32
|
-
},
|
|
33
|
-
getStateProps: () => {
|
|
34
|
-
return stateProps;
|
|
35
|
-
},
|
|
36
|
-
getLocalizedValue: val => {
|
|
37
|
-
return val;
|
|
38
|
-
},
|
|
39
|
-
getLocaleRuleNameFromKeys: (localeClass, localeContext, localeName) => {
|
|
40
|
-
return `${localeClass}!${localeContext}!${localeName}`;
|
|
41
|
-
},
|
|
42
|
-
getCaseInfo: () => {
|
|
43
|
-
return {
|
|
44
|
-
getClassName: () => {
|
|
45
|
-
return 'DIXL-MediaCo-Work-NewService';
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
getRawMetadata: () => {
|
|
50
|
-
return rawMetadata;
|
|
51
|
-
},
|
|
52
18
|
getActionsApi: () => {
|
|
53
19
|
return {
|
|
54
|
-
updateFieldValue: (propName,
|
|
55
|
-
setValue(
|
|
56
|
-
}
|
|
57
|
-
triggerFieldChange: () => {/* nothing */}
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
getValidationApi: () => {
|
|
61
|
-
return {
|
|
62
|
-
validate: () => {/* nothing */}
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
63
23
|
};
|
|
64
24
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
resolveConfigProps: () => {/* nothing */}
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
69
28
|
};
|
|
70
|
-
}
|
|
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')
|
|
71
37
|
};
|
|
72
38
|
|
|
73
39
|
return (
|
|
@@ -3,54 +3,11 @@ import { Select, Option, FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
5
5
|
// includes in bundle
|
|
6
|
+
import {formatExists,textFormatter} from "./picklist";
|
|
6
7
|
import handleEvent from "./event-utils";
|
|
7
8
|
import { suggestionsHandler } from './suggestions-handler';
|
|
8
9
|
|
|
9
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
10
|
-
import {EmailDisplay, PhoneDisplay, URLDisplay } from "@pega/cosmos-react-core";
|
|
11
|
-
|
|
12
|
-
export const formatExists = (formatterVal) => {
|
|
13
|
-
const formatterValues = [
|
|
14
|
-
"TextInput",
|
|
15
|
-
"WorkStatus",
|
|
16
|
-
"RichText",
|
|
17
|
-
"Email",
|
|
18
|
-
"Phone",
|
|
19
|
-
"URL",
|
|
20
|
-
"Operator"
|
|
21
|
-
];
|
|
22
|
-
let isformatter = false;
|
|
23
|
-
if (formatterValues.includes(formatterVal)) {
|
|
24
|
-
isformatter = true;
|
|
25
|
-
}
|
|
26
|
-
return isformatter;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export const textFormatter = (formatter,value) => {
|
|
31
|
-
let displayComponent = null;
|
|
32
|
-
switch(formatter){
|
|
33
|
-
case "TextInput" : {
|
|
34
|
-
displayComponent = value;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
case "Email" : {
|
|
38
|
-
displayComponent = (<EmailDisplay value={value} displayText={value} variant="link" />);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
case "Phone" : {
|
|
42
|
-
displayComponent = (<PhoneDisplay value={value} variant="link" />);
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
case "URL" : {
|
|
46
|
-
displayComponent = (<URLDisplay target="_blank" value={value} displayText={value} variant="link" />);
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
// no default
|
|
50
|
-
}
|
|
51
|
-
return displayComponent;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
11
|
|
|
55
12
|
export const setDefaultValue = (dropdownOptions, pConnect, propName) => {
|
|
56
13
|
// calculate the default option and set it to dropdown
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {EmailDisplay, PhoneDisplay, URLDisplay } from "@pega/cosmos-react-core";
|
|
2
|
+
|
|
3
|
+
export const formatExists = (formatterVal) => {
|
|
4
|
+
const formatterValues = [
|
|
5
|
+
"TextInput",
|
|
6
|
+
"WorkStatus",
|
|
7
|
+
"RichText",
|
|
8
|
+
"Email",
|
|
9
|
+
"Phone",
|
|
10
|
+
"URL",
|
|
11
|
+
"Operator"
|
|
12
|
+
];
|
|
13
|
+
let isformatter = false;
|
|
14
|
+
if (formatterValues.includes(formatterVal)) {
|
|
15
|
+
isformatter = true;
|
|
16
|
+
}
|
|
17
|
+
return isformatter;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export const textFormatter = (formatter,value) => {
|
|
22
|
+
let displayComponent = null;
|
|
23
|
+
switch(formatter){
|
|
24
|
+
case "TextInput" : {
|
|
25
|
+
displayComponent = value;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case "Email" : {
|
|
29
|
+
displayComponent = (<EmailDisplay value={value} displayText={value} variant="link" />);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case "Phone" : {
|
|
33
|
+
displayComponent = (<PhoneDisplay value={value} variant="link" />);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case "URL" : {
|
|
37
|
+
displayComponent = (<URLDisplay target="_blank" value={value} displayText={value} variant="link" />);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
// no default
|
|
41
|
+
}
|
|
42
|
+
return displayComponent;
|
|
43
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
-
|
|
4
|
-
import { stateProps, configProps } from './mock.stories';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
5
3
|
|
|
6
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
7
5
|
|
|
@@ -12,35 +10,30 @@ export default {
|
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
|
-
|
|
16
|
-
const [value, setValue] = useState(configProps.value);
|
|
13
|
+
const [value, setValue] = useState('test value');
|
|
17
14
|
|
|
18
15
|
const props = {
|
|
19
|
-
value,
|
|
20
|
-
placeholder: configProps.placeholder,
|
|
21
|
-
label: configProps.label,
|
|
22
|
-
testId: configProps.testId,
|
|
23
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
24
|
-
|
|
25
16
|
getPConnect: () => {
|
|
26
17
|
return {
|
|
27
|
-
getStateProps: () => {
|
|
28
|
-
return stateProps;
|
|
29
|
-
},
|
|
30
18
|
getActionsApi: () => {
|
|
31
19
|
return {
|
|
32
|
-
updateFieldValue: (propName,
|
|
33
|
-
setValue(
|
|
34
|
-
}
|
|
35
|
-
triggerFieldChange: () => {/* nothing */}
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
36
23
|
};
|
|
37
24
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
resolveConfigProps: () => {/* nothing */}
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
42
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
|
return (
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
2
3
|
|
|
3
4
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
4
5
|
|
|
5
|
-
import { stateProps, configProps, fieldMetadata } from './mock.stories';
|
|
6
|
-
|
|
7
6
|
export default {
|
|
8
7
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
9
8
|
decorators: [withKnobs],
|
|
@@ -11,33 +10,30 @@ export default {
|
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
+
const [value, setValue] = useState('test value');
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
-
value: configProps.value,
|
|
17
|
-
label: configProps.label,
|
|
18
|
-
placeholder: configProps.placeholder,
|
|
19
|
-
helperText: configProps.helperText,
|
|
20
|
-
testId: configProps.testId,
|
|
21
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
-
fieldMetadata,
|
|
23
|
-
|
|
24
16
|
getPConnect: () => {
|
|
25
17
|
return {
|
|
26
|
-
getStateProps: () => {
|
|
27
|
-
return stateProps;
|
|
28
|
-
},
|
|
29
18
|
getActionsApi: () => {
|
|
30
19
|
return {
|
|
31
|
-
updateFieldValue: () => {
|
|
32
|
-
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
33
23
|
};
|
|
34
24
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
resolveConfigProps: () => {/* nothing */}
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
39
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
|
return (
|