@pega/custom-dx-components 2.0.17 → 2.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +8 -2
  4. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +11 -6
  5. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +11 -7
  6. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +2 -2
  7. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +7 -7
  8. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +9 -8
  9. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +7 -7
  10. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +7 -7
  11. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +16 -10
  12. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +9 -7
  13. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +8 -8
  14. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +7 -7
  15. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +7 -7
  16. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +6 -6
  17. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +1 -1
  18. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +6 -6
  19. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +3 -174
  20. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
  21. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +10 -5
  22. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +59 -51
  23. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +64 -59
  24. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +43 -39
  25. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +46 -46
  26. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +24 -25
  27. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +7 -7
  28. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +2 -1
  29. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +1 -1
  30. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +2 -1
  31. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +6 -6
  32. package/src/tasks/init/template/README.md +75 -59
  33. package/src/tasks/init/template/package.json.mustache +2 -2
package/README.md CHANGED
@@ -8,7 +8,7 @@ This project provides you with an environment to extend Constellation by giving
8
8
 
9
9
  Ensure you have access to the following in your system:
10
10
 
11
- - Pega Infinity Server version 8.8 or later
11
+ - Pega Infinity Server version 8.7 or later
12
12
 
13
13
  - Git version 2.30 or later
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "2.0.17",
3
+ "version": "2.0.19",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -1,3 +1,4 @@
1
+ import { useState } from 'react';
1
2
  import { withKnobs } from '@storybook/addon-knobs';
2
3
 
3
4
  import { configProps, stateProps } from './mock.stories';
@@ -11,8 +12,11 @@ export default {
11
12
  };
12
13
 
13
14
  export const base{{COMPONENT_CLASS_NAME}} = () => {
15
+ // eslint-disable-next-line react-hooks/rules-of-hooks
16
+ const [value, setValue] = useState(configProps.value);
17
+
14
18
  const props = {
15
- value: configProps.value,
19
+ value,
16
20
  label: configProps.label,
17
21
  helperText: configProps.helperText,
18
22
  caption: configProps.caption,
@@ -34,7 +38,9 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
34
38
  },
35
39
  getActionsApi: () => {
36
40
  return {
37
- updateFieldValue: () => { /* nothing */},
41
+ updateFieldValue: (propName, theValue) => {
42
+ setValue(theValue);
43
+ },
38
44
  triggerFieldChange: () => { /* nothing */}
39
45
  };
40
46
  },
@@ -1,4 +1,4 @@
1
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
2
  import { configProps, stateProps } from './mock.stories';
3
3
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
4
4
 
@@ -26,8 +26,13 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
26
26
  return {
27
27
  getActionsApi: () => {
28
28
  return {
29
- updateFieldValue: () => {},
30
- triggerFieldChange: () => {}
29
+ updateFieldValue: () => {/* nothing */},
30
+ triggerFieldChange: () => {/* nothing */}
31
+ };
32
+ },
33
+ getValidationApi: () => {
34
+ return {
35
+ validate: () => {/* nothing */}
31
36
  };
32
37
  },
33
38
  getStateProps: () => {
@@ -36,9 +41,9 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
36
41
  getConfigProps: () => {
37
42
  return configProps;
38
43
  },
39
- ignoreSuggestion: () => {},
40
- acceptSuggestion: () => {},
41
- clearErrorMessages: () => {}
44
+ ignoreSuggestion: () => {/* nothing */},
45
+ acceptSuggestion: () => {/* nothing */},
46
+ clearErrorMessages: () => {/* nothing */}
42
47
  };
43
48
  },
44
49
  value: configProps.value,
@@ -1,5 +1,4 @@
1
- import { useState } from 'react';
2
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
1
+ import { withKnobs } from '@storybook/addon-knobs';
3
2
  import { configProps, stateProps } from './mock.stories';
4
3
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
5
4
 
@@ -27,8 +26,13 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
27
26
  return {
28
27
  getActionsApi: () => {
29
28
  return {
30
- updateFieldValue: () => {},
31
- triggerFieldChange: () => {}
29
+ updateFieldValue: () => {/* nothing */},
30
+ triggerFieldChange: () => {/* nothing */}
31
+ };
32
+ },
33
+ getValidationApi: () => {
34
+ return {
35
+ validate: () => {/* nothing */}
32
36
  };
33
37
  },
34
38
  getStateProps: () => {
@@ -37,9 +41,9 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
37
41
  getConfigProps: () => {
38
42
  return configProps;
39
43
  },
40
- ignoreSuggestion: () => {},
41
- acceptSuggestion: () => {},
42
- clearErrorMessages: () => {}
44
+ ignoreSuggestion: () => {/* nothing */},
45
+ acceptSuggestion: () => {/* nothing */},
46
+ clearErrorMessages: () => {/* nothing */}
43
47
  };
44
48
  },
45
49
  value: configProps.value,
@@ -5,8 +5,8 @@ export const configProps = {
5
5
  hideLabel: false,
6
6
  helperText: 'DateTime helper text',
7
7
  withSeconds: false,
8
- nextYearRange: 10,
9
- previousYearRange: 5,
8
+ nextYearRange: '10',
9
+ previousYearRange: '5',
10
10
  showWeekNumber: false,
11
11
  testId: '12345678',
12
12
  additionalProps: {},
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
20
20
  showGroupSeparators: configProps.showGroupSeparators,
21
21
  hasSuggestions: configProps.hasSuggestions,
22
22
  testId: configProps.testId,
23
- fieldMetadata: fieldMetadata,
23
+ fieldMetadata,
24
24
 
25
25
  getPConnect: () => {
26
26
  return {
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
29
29
  },
30
30
  getActionsApi: () => {
31
31
  return {
32
- updateFieldValue: () => {},
33
- triggerFieldChange: () => {}
32
+ updateFieldValue: () => {/* nothing */},
33
+ triggerFieldChange: () => {/* nothing */}
34
34
  };
35
35
  },
36
- ignoreSuggestion: () => {},
37
- acceptSuggestion: () => {},
38
- setInheritedProps: () => {},
39
- resolveConfigProps: () => {}
36
+ ignoreSuggestion: () => {/* nothing */},
37
+ acceptSuggestion: () => {/* nothing */},
38
+ setInheritedProps: () => {/* nothing */},
39
+ resolveConfigProps: () => {/* nothing */}
40
40
  };
41
41
  }
42
42
  };
@@ -13,7 +13,7 @@ export default {
13
13
  export const base{{COMPONENT_CLASS_NAME}} = () => {
14
14
 
15
15
  const props = {
16
- value: configProps.value,
16
+ value: Number(configProps.value),
17
17
  placeholder: configProps.placeholder,
18
18
  label: configProps.label,
19
19
  helperText: configProps.helperText,
@@ -23,7 +23,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
23
23
  alwaysShowISOCode: configProps.alwaysShowISOCode,
24
24
  hasSuggestions: configProps.hasSuggestions,
25
25
  testId: configProps.testId,
26
- fieldMetadata: fieldMetadata,
26
+ fieldMetadata,
27
27
 
28
28
  getPConnect: () => {
29
29
  return {
@@ -32,14 +32,15 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
32
32
  },
33
33
  getActionsApi: () => {
34
34
  return {
35
- updateFieldValue: () => {},
36
- triggerFieldChange: () => {}
35
+ updateFieldValue: () => {/* nothing */},
36
+ triggerFieldChange: () => {/* nothing */}
37
37
  };
38
38
  },
39
- ignoreSuggestion: () => {},
40
- acceptSuggestion: () => {},
41
- setInheritedProps: () => {},
42
- resolveConfigProps: () => {}
39
+ ignoreSuggestion: () => {/* nothing */},
40
+ acceptSuggestion: () => {/* nothing */},
41
+ setInheritedProps: () => {/* nothing */},
42
+ resolveConfigProps: () => {/* nothing */},
43
+ clearErrorMessages: () => {/* nothing */}
43
44
  };
44
45
  }
45
46
  };
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
20
20
  showGroupSeparators: configProps.showGroupSeparators,
21
21
  hasSuggestions: configProps.hasSuggestions,
22
22
  testId: configProps.testId,
23
- fieldMetadata: fieldMetadata,
23
+ fieldMetadata,
24
24
 
25
25
  getPConnect: () => {
26
26
  return {
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
29
29
  },
30
30
  getActionsApi: () => {
31
31
  return {
32
- updateFieldValue: () => {},
33
- triggerFieldChange: () => {}
32
+ updateFieldValue: () => {/* nothing */},
33
+ triggerFieldChange: () => {/* nothing */}
34
34
  };
35
35
  },
36
- ignoreSuggestion: () => {},
37
- acceptSuggestion: () => {},
38
- setInheritedProps: () => {},
39
- resolveConfigProps: () => {}
36
+ ignoreSuggestion: () => {/* nothing */},
37
+ acceptSuggestion: () => {/* nothing */},
38
+ setInheritedProps: () => {/* nothing */},
39
+ resolveConfigProps: () => {/* nothing */}
40
40
  };
41
41
  }
42
42
  };
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
20
20
  showGroupSeparators: configProps.showGroupSeparators,
21
21
  hasSuggestions: configProps.hasSuggestions,
22
22
  testId: configProps.testId,
23
- fieldMetadata: fieldMetadata,
23
+ fieldMetadata,
24
24
 
25
25
  getPConnect: () => {
26
26
  return {
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
29
29
  },
30
30
  getActionsApi: () => {
31
31
  return {
32
- updateFieldValue: () => {},
33
- triggerFieldChange: () => {}
32
+ updateFieldValue: () => {/* nothing */},
33
+ triggerFieldChange: () => {/* nothing */}
34
34
  };
35
35
  },
36
- ignoreSuggestion: () => {},
37
- acceptSuggestion: () => {},
38
- setInheritedProps: () => {},
39
- resolveConfigProps: () => {}
36
+ ignoreSuggestion: () => {/* nothing */},
37
+ acceptSuggestion: () => {/* nothing */},
38
+ setInheritedProps: () => {/* nothing */},
39
+ resolveConfigProps: () => {/* nothing */}
40
40
  };
41
41
  }
42
42
  };
@@ -12,6 +12,7 @@ export default {
12
12
  };
13
13
 
14
14
  export const base{{COMPONENT_CLASS_NAME}} = () => {
15
+ // eslint-disable-next-line react-hooks/rules-of-hooks
15
16
  const [value, setValue] = useState(configProps.value);
16
17
 
17
18
  const props = {
@@ -22,7 +23,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
22
23
  datasource: configProps.datasource,
23
24
  testId: configProps.testId,
24
25
  hasSuggestions: configProps.hasSuggestions,
25
- fieldMetadata: fieldMetadata,
26
+ fieldMetadata,
26
27
 
27
28
  getPConnect: () => {
28
29
  return {
@@ -32,8 +33,8 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
32
33
  getStateProps: () => {
33
34
  return stateProps;
34
35
  },
35
- getLocalizedValue: value => {
36
- return value;
36
+ getLocalizedValue: val => {
37
+ return val;
37
38
  },
38
39
  getLocaleRuleNameFromKeys: (localeClass, localeContext, localeName) => {
39
40
  return `${localeClass}!${localeContext}!${localeName}`;
@@ -50,16 +51,21 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
50
51
  },
51
52
  getActionsApi: () => {
52
53
  return {
53
- updateFieldValue: (propName, value) => {
54
- setValue(value);
54
+ updateFieldValue: (propName, theValue) => {
55
+ setValue(theValue);
55
56
  },
56
- triggerFieldChange: () => {}
57
+ triggerFieldChange: () => {/* nothing */}
57
58
  };
58
59
  },
59
- ignoreSuggestion: () => {},
60
- acceptSuggestion: () => {},
61
- setInheritedProps: () => {},
62
- resolveConfigProps: () => {}
60
+ getValidationApi: () => {
61
+ return {
62
+ validate: () => {/* nothing */}
63
+ };
64
+ },
65
+ ignoreSuggestion: () => {/* nothing */},
66
+ acceptSuggestion: () => {/* nothing */},
67
+ setInheritedProps: () => {/* nothing */},
68
+ resolveConfigProps: () => {/* nothing */}
63
69
  };
64
70
  }
65
71
  };
@@ -12,7 +12,7 @@ export default {
12
12
  };
13
13
 
14
14
  export const base{{COMPONENT_CLASS_NAME}} = () => {
15
-
15
+ // eslint-disable-next-line react-hooks/rules-of-hooks
16
16
  const [value, setValue] = useState(configProps.value);
17
17
 
18
18
  const props = {
@@ -29,14 +29,16 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
29
29
  },
30
30
  getActionsApi: () => {
31
31
  return {
32
- updateFieldValue: () => {},
33
- triggerFieldChange: () => {}
32
+ updateFieldValue: (propName, theValue) => {
33
+ setValue(theValue);
34
+ },
35
+ triggerFieldChange: () => {/* nothing */}
34
36
  };
35
37
  },
36
- ignoreSuggestion: () => {},
37
- acceptSuggestion: () => {},
38
- setInheritedProps: () => {},
39
- resolveConfigProps: () => {}
38
+ ignoreSuggestion: () => {/* nothing */},
39
+ acceptSuggestion: () => {/* nothing */},
40
+ setInheritedProps: () => {/* nothing */},
41
+ resolveConfigProps: () => {/* nothing */}
40
42
  };
41
43
  }
42
44
  };
@@ -1,4 +1,4 @@
1
- import { withKnobs, text, boolean } from '@storybook/addon-knobs';
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
2
 
3
3
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
4
4
 
@@ -19,7 +19,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
19
19
  helperText: configProps.helperText,
20
20
  testId: configProps.testId,
21
21
  hasSuggestions: configProps.hasSuggestions,
22
- fieldMetadata: fieldMetadata,
22
+ fieldMetadata,
23
23
 
24
24
  getPConnect: () => {
25
25
  return {
@@ -28,14 +28,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
28
28
  },
29
29
  getActionsApi: () => {
30
30
  return {
31
- updateFieldValue: () => {},
32
- triggerFieldChange: () => {}
31
+ updateFieldValue: () => {/* nothing */},
32
+ triggerFieldChange: () => {/* nothing */}
33
33
  };
34
34
  },
35
- ignoreSuggestion: () => {},
36
- acceptSuggestion: () => {},
37
- setInheritedProps: () => {},
38
- resolveConfigProps: () => {}
35
+ ignoreSuggestion: () => {/* nothing */},
36
+ acceptSuggestion: () => {/* nothing */},
37
+ setInheritedProps: () => {/* nothing */},
38
+ resolveConfigProps: () => {/* nothing */}
39
39
  };
40
40
  }
41
41
  };
@@ -19,7 +19,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
19
19
  helperText: configProps.helperText,
20
20
  testId: configProps.testId,
21
21
  hasSuggestions: configProps.hasSuggestions,
22
- fieldMetadata: fieldMetadata,
22
+ fieldMetadata,
23
23
 
24
24
  getPConnect: () => {
25
25
  return {
@@ -28,14 +28,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
28
28
  },
29
29
  getActionsApi: () => {
30
30
  return {
31
- updateFieldValue: () => {},
32
- triggerFieldChange: () => {}
31
+ updateFieldValue: () => {/* nothing */},
32
+ triggerFieldChange: () => {/* nothing */}
33
33
  };
34
34
  },
35
- ignoreSuggestion: () => {},
36
- acceptSuggestion: () => {},
37
- setInheritedProps: () => {},
38
- resolveConfigProps: () => {}
35
+ ignoreSuggestion: () => {/* nothing */},
36
+ acceptSuggestion: () => {/* nothing */},
37
+ setInheritedProps: () => {/* nothing */},
38
+ resolveConfigProps: () => {/* nothing */}
39
39
  };
40
40
  }
41
41
  };
@@ -19,7 +19,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
19
19
  helperText: configProps.helperText,
20
20
  testId: configProps.testId,
21
21
  hasSuggestions: configProps.hasSuggestions,
22
- fieldMetadata: fieldMetadata,
22
+ fieldMetadata,
23
23
 
24
24
  getPConnect: () => {
25
25
  return {
@@ -28,14 +28,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
28
28
  },
29
29
  getActionsApi: () => {
30
30
  return {
31
- updateFieldValue: () => {},
32
- triggerFieldChange: () => {}
31
+ updateFieldValue: () => {/* nothing */},
32
+ triggerFieldChange: () => {/* nothing */}
33
33
  };
34
34
  },
35
- ignoreSuggestion: () => {},
36
- acceptSuggestion: () => {},
37
- setInheritedProps: () => {},
38
- resolveConfigProps: () => {}
35
+ ignoreSuggestion: () => {/* nothing */},
36
+ acceptSuggestion: () => {/* nothing */},
37
+ setInheritedProps: () => {/* nothing */},
38
+ resolveConfigProps: () => {/* nothing */}
39
39
  };
40
40
  }
41
41
  };
@@ -26,14 +26,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
26
26
  },
27
27
  getActionsApi: () => {
28
28
  return {
29
- updateFieldValue: () => {},
30
- triggerFieldChange: () => {}
29
+ updateFieldValue: () => {/* nothing */},
30
+ triggerFieldChange: () => {/* nothing */}
31
31
  };
32
32
  },
33
- ignoreSuggestion: () => {},
34
- acceptSuggestion: () => {},
35
- setInheritedProps: () => {},
36
- resolveConfigProps: () => {}
33
+ ignoreSuggestion: () => {/* nothing */},
34
+ acceptSuggestion: () => {/* nothing */},
35
+ setInheritedProps: () => {/* nothing */},
36
+ resolveConfigProps: () => {/* nothing */}
37
37
  };
38
38
  }
39
39
  };
@@ -245,7 +245,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
245
245
  {{COMPONENT_CLASS_NAME}}.propTypes = {
246
246
  value: PropTypes.string,
247
247
  placeholder: PropTypes.string,
248
- datasource: PropTypes.node,
248
+ datasource: PropTypes.objectOf(PropTypes.any),
249
249
  label: PropTypes.string.isRequired,
250
250
  hideLabel: PropTypes.bool,
251
251
  getPConnect: PropTypes.func.isRequired,
@@ -26,14 +26,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
26
26
  },
27
27
  getActionsApi: () => {
28
28
  return {
29
- updateFieldValue: () => {},
30
- triggerFieldChange: () => {}
29
+ updateFieldValue: () => {/* nothing */},
30
+ triggerFieldChange: () => {/* nothing */}
31
31
  };
32
32
  },
33
- ignoreSuggestion: () => {},
34
- acceptSuggestion: () => {},
35
- setInheritedProps: () => {},
36
- resolveConfigProps: () => {}
33
+ ignoreSuggestion: () => {/* nothing */},
34
+ acceptSuggestion: () => {/* nothing */},
35
+ setInheritedProps: () => {/* nothing */},
36
+ resolveConfigProps: () => {/* nothing */}
37
37
  };
38
38
  }
39
39
  };