@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.
Files changed (94) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/build/helper.js +1 -1
  3. package/src/tasks/create/index.js +8 -1
  4. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
  5. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +60 -0
  6. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +1 -2
  7. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +21 -0
  8. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +61 -0
  9. package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +41 -0
  10. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +179 -67
  11. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +40 -16
  12. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +3 -1
  13. package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +23 -0
  14. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +0 -1
  15. package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js → date-utils.js.mustache} +1 -0
  16. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +1 -0
  17. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +40 -15
  18. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +2 -0
  19. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +23 -0
  20. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +22 -17
  21. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +2 -1
  22. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +21 -0
  23. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +25 -17
  24. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +3 -4
  25. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +23 -0
  26. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +22 -17
  27. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +8 -2
  28. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +21 -0
  29. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +22 -17
  30. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +2 -1
  31. package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +21 -0
  32. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +42 -14
  33. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +44 -1
  34. package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +67 -0
  35. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +21 -16
  36. package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +13 -0
  37. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +20 -16
  38. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +44 -2
  39. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +22 -0
  40. package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.js → StatusWork.jsx} +0 -1
  41. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +21 -17
  42. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +46 -3
  43. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +21 -0
  44. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +21 -17
  45. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +44 -2
  46. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +20 -0
  47. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +19 -17
  48. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +46 -2
  49. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +37 -0
  50. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +19 -17
  51. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +174 -3
  52. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +22 -0
  53. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +24 -16
  54. package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +20 -0
  55. package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +1 -0
  56. package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +26 -0
  57. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +110 -0
  58. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +3 -5
  59. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +179 -0
  60. package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +3 -6
  61. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +26 -0
  62. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +118 -0
  63. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +3 -5
  64. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +215 -0
  65. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +3 -3
  66. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +89 -0
  67. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +6 -10
  68. package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +125 -0
  69. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +100 -0
  70. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +5 -11
  71. package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +131 -0
  72. package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.js.mustache → GetNextWork.jsx.mustache} +6 -0
  73. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +102 -0
  74. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +9 -7
  75. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +94 -0
  76. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +4 -1
  77. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +78 -0
  78. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +1 -0
  79. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +389 -0
  80. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +30 -0
  81. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +22 -0
  82. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.js.mustache → Avatar.jsx.mustache} +2 -0
  83. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.js.mustache → Operator.jsx.mustache} +2 -1
  84. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +68 -0
  85. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
  86. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +51 -0
  87. package/src/tasks/map/map.js +0 -7
  88. package/src/tasks/override/index.js +38 -9
  89. package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +0 -43
  90. package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +0 -43
  91. package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +0 -43
  92. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +0 -43
  93. package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +0 -43
  94. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +0 -172
@@ -0,0 +1,89 @@
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
+
3
+ import {{COMPONENT_CLASS_NAME}} from './index.jsx';
4
+ import { DateInput, Input, FieldValueList, Text } from '@pega/cosmos-react-core';
5
+ import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core';
6
+ import { pyReviewRaw, regionChildrenResolved } from './mock.stories';
7
+
8
+ export default {
9
+ title: '{{COMPONENT_CLASS_NAME}}',
10
+ decorators: [withKnobs],
11
+ component: {{COMPONENT_CLASS_NAME}}
12
+ };
13
+
14
+ const Template = args => {
15
+ const regionAChildren = pyReviewRaw.children[0].children.map(child => {
16
+ return Primary.args.getPConnect().createComponent(child);
17
+ });
18
+
19
+ return <{{COMPONENT_CLASS_NAME}} {...args}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>;
20
+ };
21
+
22
+ export const Primary = Template.bind({});
23
+
24
+ Primary.args = {
25
+ NumCols: 1,
26
+ template: 'DefaultForm',
27
+ getPConnect: () => {
28
+ return {
29
+ getChildren: () => {
30
+ return pyReviewRaw.children;
31
+ },
32
+ createComponent: config => {
33
+ switch (config.config.value) {
34
+ case '@P .FirstName':
35
+ return renderField(regionChildrenResolved[0]);
36
+ case '@P .MiddleName':
37
+ return renderField(regionChildrenResolved[1]);
38
+ case '@P .LastName':
39
+ return renderField(regionChildrenResolved[2]);
40
+ case '@P .Email':
41
+ return renderField(regionChildrenResolved[3]);
42
+ case '@P .PhoneNumber':
43
+ return renderField(regionChildrenResolved[4]);
44
+ case '@P .ServiceDate':
45
+ return renderField(regionChildrenResolved[5]);
46
+ }
47
+ }
48
+ };
49
+ }
50
+ };
51
+
52
+ const renderField = resolvedProps => {
53
+ const { displayMode, value = '', label = '' } = resolvedProps;
54
+
55
+ const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
56
+
57
+ let val =
58
+ value != '' ? (
59
+ <Text variant='h1' as='span'>
60
+ {value}
61
+ </Text>
62
+ ) : (
63
+ ''
64
+ );
65
+
66
+ {{! pick new delimiteres for mustache }}
67
+ {{=<% %>=}}
68
+
69
+ if (label === 'Service Date') val = <DateInput value={value} style={{ fontSize: '14px' }}></DateInput>;
70
+
71
+ if (label === 'Email') val = <Input type='email' value={value} style={{ fontSize: '14px' }}></Input>;
72
+
73
+ if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name')
74
+ val = <Input value={value} style={{ fontSize: '14px' }}></Input>;
75
+
76
+ if (label === 'Phone Number') val = <CosmosPhone value={value} style={{ fontSize: '14px' }}></CosmosPhone>;
77
+ <%={{ }}=%> {{! revert delimiteres for mustache }}
78
+
79
+ if (variant === 'inline') {
80
+ val = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
81
+ } else {
82
+ val = (
83
+ <Text variant='h1' as='span'>
84
+ {val}
85
+ </Text>
86
+ );
87
+ }
88
+ return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
89
+ };
@@ -1,5 +1,4 @@
1
- import { useContext } from 'react';
2
- import { Grid , Flex } from '@pega/cosmos-react-core';
1
+ import { Grid } from '@pega/cosmos-react-core';
3
2
  import PropTypes from 'prop-types';
4
3
 
5
4
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
@@ -12,11 +11,11 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
12
11
  export default function {{COMPONENT_CLASS_NAME}}(props) {
13
12
 
14
13
 
15
- const { getPConnect, children, template, label, NumCols } = props;
14
+ const { children, NumCols } = props;
16
15
 
17
- let nCols = parseInt(NumCols);
16
+ const nCols = parseInt(NumCols, 10);
18
17
 
19
- //console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
18
+ // console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
20
19
 
21
20
  return (
22
21
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
@@ -37,13 +36,10 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
37
36
 
38
37
  {{COMPONENT_CLASS_NAME}}.defaultProps = {
39
38
  NumCols: 1,
40
- templateOverrideMode: 'USE_TEMPLATE',
41
39
  children: []
42
40
  };
43
41
 
44
42
  {{COMPONENT_CLASS_NAME}}.propTypes = {
45
- label: PropTypes.string,
46
- getPConnect: PropTypes.func.isRequired,
47
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
48
- template: PropTypes.string.isRequired
43
+ NumCols: PropTypes.number,
44
+ children: PropTypes.arrayOf(PropTypes.node),
49
45
  };
@@ -0,0 +1,125 @@
1
+ export const pyReviewRaw = {
2
+ name: 'CollectInformation',
3
+ type: 'View',
4
+ config: {
5
+ template: 'DefaultForm',
6
+ ruleClass: 'OM5W9U-SampleApp-Work-Test',
7
+ localeReference: '@LR OM5W9U-SAMPLEAPP-WORK-TEST!VIEW!COLLECTINFORMATION',
8
+ context: '@P .pyViewContext'
9
+ },
10
+ children: [
11
+ {
12
+ name: 'Fields',
13
+ type: 'Region',
14
+ children: [
15
+ {
16
+ type: 'TextInput',
17
+ config: {
18
+ value: '@P .FirstName',
19
+ label: '@L First Name'
20
+ }
21
+ },
22
+ {
23
+ type: 'TextInput',
24
+ config: {
25
+ value: '@P .MiddleName',
26
+ label: '@L Middle Name'
27
+ }
28
+ },
29
+ {
30
+ type: 'TextInput',
31
+ config: {
32
+ value: '@P .LastName',
33
+ label: '@L Last Name'
34
+ }
35
+ },
36
+ {
37
+ type: 'Email',
38
+ config: {
39
+ value: '@P .Email',
40
+ label: '@L Email'
41
+ }
42
+ },
43
+ {
44
+ type: 'Phone',
45
+ config: {
46
+ value: '@P .PhoneNumber',
47
+ label: '@L Phone Number',
48
+ datasource: {
49
+ source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults',
50
+ fields: {
51
+ value: '@P .pyCallingCode'
52
+ }
53
+ }
54
+ }
55
+ },
56
+ {
57
+ type: 'Date',
58
+ config: {
59
+ value: '@P .ServiceDate',
60
+ label: '@L Service Date'
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ ],
66
+ classID: 'OM5W9U-SampleApp-Work-Test'
67
+ };
68
+
69
+ export const regionChildrenResolved = [
70
+ {
71
+ readOnly: undefined,
72
+ value: 'John',
73
+ label: 'First Name',
74
+ hasSuggestions: false
75
+ },
76
+ {
77
+ readOnly: undefined,
78
+ value: '',
79
+ label: 'Middle Name',
80
+ hasSuggestions: false
81
+ },
82
+ {
83
+ readOnly: undefined,
84
+ value: 'Doe',
85
+ label: 'Last Name',
86
+ hasSuggestions: false
87
+ },
88
+ {
89
+ readOnly: undefined,
90
+ value: 'John@doe.com',
91
+ label: 'Email',
92
+ hasSuggestions: false
93
+ },
94
+ {
95
+ readOnly: undefined,
96
+ value: '+16397975093',
97
+ label: 'Phone Number',
98
+ datasource: {
99
+ fields: {
100
+ value: undefined
101
+ },
102
+ source: [
103
+ {
104
+ value: '+1'
105
+ },
106
+ {
107
+ value: '+91'
108
+ },
109
+ {
110
+ value: '+48'
111
+ },
112
+ {
113
+ value: '+44'
114
+ }
115
+ ]
116
+ },
117
+ hasSuggestions: false
118
+ },
119
+ {
120
+ readOnly: undefined,
121
+ value: '2023-01-25',
122
+ label: 'Service Date',
123
+ hasSuggestions: false
124
+ }
125
+ ];
@@ -0,0 +1,100 @@
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
+
3
+ import {{COMPONENT_CLASS_NAME}} from './index.jsx';
4
+ import { DateInput, Input, FieldValueList, Text } from '@pega/cosmos-react-core';
5
+ import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core';
6
+ import { pyReviewRaw, regionChildrenResolved } from './mock.stories';
7
+
8
+ export default {
9
+ title: '{{COMPONENT_CLASS_NAME}}',
10
+ decorators: [withKnobs],
11
+ component: {{COMPONENT_CLASS_NAME}}
12
+ };
13
+
14
+ const Template = args => {
15
+ const regionAChildren = pyReviewRaw.children[0].children.map(child => {
16
+ return Primary.args.getPConnect().createComponent(child);
17
+ });
18
+ const regionBChildren = pyReviewRaw.children[1].children.map(child => {
19
+ return Primary.args.getPConnect().createComponent(child);
20
+ });
21
+
22
+ return (
23
+ <{{COMPONENT_CLASS_NAME}} {...args}>
24
+ {regionAChildren}
25
+ {regionBChildren}
26
+ </{{COMPONENT_CLASS_NAME}}>
27
+ );
28
+ };
29
+
30
+ export const Primary = Template.bind({});
31
+
32
+ Primary.args = {
33
+ template: 'DefaultForm',
34
+ getPConnect: () => {
35
+ return {
36
+ getChildren: () => {
37
+ return pyReviewRaw.children;
38
+ },
39
+ createComponent: config => {
40
+ switch (config.config.value) {
41
+ case '@P .FirstName':
42
+ return renderField(regionChildrenResolved[0]);
43
+ case '@P .MiddleName':
44
+ return renderField(regionChildrenResolved[1]);
45
+ case '@P .LastName':
46
+ return renderField(regionChildrenResolved[2]);
47
+ case '@P .Email':
48
+ return renderField(regionChildrenResolved[3]);
49
+ case '@P .PhoneNumber':
50
+ return renderField(regionChildrenResolved[4]);
51
+ case '@P .ServiceDate':
52
+ return renderField(regionChildrenResolved[5]);
53
+ }
54
+ }
55
+ };
56
+ }
57
+ };
58
+
59
+ const renderField = resolvedProps => {
60
+ const { displayMode, value = '', label = '' } = resolvedProps;
61
+
62
+ const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
63
+
64
+ let val =
65
+ value != '' ? (
66
+ <Text variant='h1' as='span'>
67
+ {value}
68
+ </Text>
69
+ ) : (
70
+ ''
71
+ );
72
+
73
+ {{! pick new delimiteres for mustache }}
74
+ {{=<% %>=}}
75
+
76
+ if (label === 'Service Date')
77
+ val = <DateInput value={value} style={{ fontSize: '14px' }}></DateInput>;
78
+
79
+ if (label === 'Email')
80
+ val = <Input type='email' value={value} style={{ fontSize: '14px' }}></Input>;
81
+
82
+ if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name')
83
+ val = <Input value={value} style={{ fontSize: '14px' }}></Input>;
84
+
85
+ if (label === 'Phone Number')
86
+ val = <CosmosPhone value={value} style={{ fontSize: '14px' }}></CosmosPhone>;
87
+
88
+ <%={{ }}=%> {{! revert delimiteres for mustache }}
89
+
90
+ if (variant === 'inline') {
91
+ val = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
92
+ } else {
93
+ val = (
94
+ <Text variant='h1' as='span'>
95
+ {val}
96
+ </Text>
97
+ );
98
+ }
99
+ return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
100
+ };
@@ -1,5 +1,4 @@
1
- import { useContext } from 'react';
2
- import { Grid , Flex } from '@pega/cosmos-react-core';
1
+ import { Grid, Flex } from '@pega/cosmos-react-core';
3
2
  import PropTypes from 'prop-types';
4
3
 
5
4
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
@@ -12,15 +11,13 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
12
11
  export default function {{COMPONENT_CLASS_NAME}}(props) {
13
12
 
14
13
 
15
- const { getPConnect, children, template, label } = props;
14
+ const { children } = props;
16
15
 
17
16
  const numRegions = children?.length;
18
- const gridRepeat = 'repeat(' + numRegions + ', 1fr)';
19
- let gridContainer = {};
17
+ const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
18
+ const gridContainer = {"colGap" : 1};
20
19
  gridContainer.cols = gridRepeat;
21
20
  gridContainer.alignItems = 'start';
22
- gridContainer.colGap = 1;
23
-
24
21
 
25
22
  return (
26
23
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
@@ -44,8 +41,5 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
44
41
  };
45
42
 
46
43
  {{COMPONENT_CLASS_NAME}}.propTypes = {
47
- label: PropTypes.string,
48
- getPConnect: PropTypes.func.isRequired,
49
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
50
- template: PropTypes.string.isRequired
44
+ children: PropTypes.arrayOf(PropTypes.node),
51
45
  };
@@ -0,0 +1,131 @@
1
+ export const pyReviewRaw = {
2
+ name: 'CollectInformation',
3
+ type: 'View',
4
+ config: {
5
+ template: 'DefaultForm',
6
+ ruleClass: 'OM5W9U-SampleApp-Work-Test',
7
+ localeReference: '@LR OM5W9U-SAMPLEAPP-WORK-TEST!VIEW!COLLECTINFORMATION',
8
+ context: '@P .pyViewContext'
9
+ },
10
+ children: [
11
+ {
12
+ name: 'A',
13
+ type: 'Region',
14
+ children: [
15
+ {
16
+ type: 'TextInput',
17
+ config: {
18
+ value: '@P .FirstName',
19
+ label: '@L First Name'
20
+ }
21
+ },
22
+ {
23
+ type: 'TextInput',
24
+ config: {
25
+ value: '@P .MiddleName',
26
+ label: '@L Middle Name'
27
+ }
28
+ },
29
+ {
30
+ type: 'TextInput',
31
+ config: {
32
+ value: '@P .LastName',
33
+ label: '@L Last Name'
34
+ }
35
+ }
36
+ ]
37
+ },
38
+ {
39
+ name: 'B',
40
+ type: 'Region',
41
+ children: [
42
+ {
43
+ type: 'Email',
44
+ config: {
45
+ value: '@P .Email',
46
+ label: '@L Email'
47
+ }
48
+ },
49
+ {
50
+ type: 'Phone',
51
+ config: {
52
+ value: '@P .PhoneNumber',
53
+ label: '@L Phone Number',
54
+ datasource: {
55
+ source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults',
56
+ fields: {
57
+ value: '@P .pyCallingCode'
58
+ }
59
+ }
60
+ }
61
+ },
62
+ {
63
+ type: 'Date',
64
+ config: {
65
+ value: '@P .ServiceDate',
66
+ label: '@L Service Date'
67
+ }
68
+ }
69
+ ]
70
+ }
71
+ ],
72
+ classID: 'OM5W9U-SampleApp-Work-Test'
73
+ };
74
+
75
+ export const regionChildrenResolved = [
76
+ {
77
+ readOnly: undefined,
78
+ value: 'John',
79
+ label: 'First Name',
80
+ hasSuggestions: false
81
+ },
82
+ {
83
+ readOnly: undefined,
84
+ value: '',
85
+ label: 'Middle Name',
86
+ hasSuggestions: false
87
+ },
88
+ {
89
+ readOnly: undefined,
90
+ value: 'Doe',
91
+ label: 'Last Name',
92
+ hasSuggestions: false
93
+ },
94
+ {
95
+ readOnly: undefined,
96
+ value: 'John@doe.com',
97
+ label: 'Email',
98
+ hasSuggestions: false
99
+ },
100
+ {
101
+ readOnly: undefined,
102
+ value: '+16397975093',
103
+ label: 'Phone Number',
104
+ datasource: {
105
+ fields: {
106
+ value: undefined
107
+ },
108
+ source: [
109
+ {
110
+ value: '+1'
111
+ },
112
+ {
113
+ value: '+91'
114
+ },
115
+ {
116
+ value: '+48'
117
+ },
118
+ {
119
+ value: '+44'
120
+ }
121
+ ]
122
+ },
123
+ hasSuggestions: false
124
+ },
125
+ {
126
+ readOnly: undefined,
127
+ value: '2023-01-25',
128
+ label: 'Service Date',
129
+ hasSuggestions: false
130
+ }
131
+ ];
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-undef */
1
2
  import { Button, useToaster } from '@pega/cosmos-react-core';
2
3
 
3
4
  export default function GetNextWork(props) {
@@ -8,11 +9,16 @@ export default function GetNextWork(props) {
8
9
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
9
10
 
10
11
  const getNextWork = () => {
12
+
13
+ // alert('Get next work clicked');
14
+
11
15
  getPConnect()
12
16
  .getActionsApi()
13
17
  .getNextWork()
14
18
  .catch((err) => {
19
+ /* eslint-disable no-console */
15
20
  console.log(err);
21
+ /* eslint-enable no-console */
16
22
  if (err[0].status === 404) {
17
23
  toasterCtx.push({
18
24
  content: localizedVal('No task currently available')
@@ -0,0 +1,102 @@
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
+
3
+ import { AppAnnouncement as PegaAppAnnouncement } from '@pega/cosmos-react-work';
4
+
5
+ import {{COMPONENT_CLASS_NAME}} from './index.jsx';
6
+ import { pyHome1Resolved, pyHome1Raw } from './mock.stories.js';
7
+
8
+ export default {
9
+ title: '{{COMPONENT_CLASS_NAME}}',
10
+ decorators: [withKnobs],
11
+ component: {{COMPONENT_CLASS_NAME}}
12
+ };
13
+
14
+ export const base{{COMPONENT_CLASS_NAME}} = () => {
15
+ if (!window.PCore) {
16
+ window.PCore = {};
17
+ }
18
+
19
+ window.PCore.getLocaleUtils = () => {
20
+ return {
21
+ getLocaleValue: val => {
22
+ return val;
23
+ }
24
+ };
25
+ };
26
+
27
+ const configProps = pyHome1Resolved.children[0].children[0].config;
28
+
29
+ const props = {
30
+ useConfigurableLayout: false,
31
+ enableGetNextWork: pyHome1Raw.config.enableGetNextWork,
32
+ icon: pyHome1Raw.config.icon,
33
+ title: 'Page Template',
34
+
35
+ getPConnect: () => {
36
+ return {
37
+ getStateProps: () => {
38
+ return {};
39
+ },
40
+ getActionsApi: () => {
41
+ return {
42
+ getNextWork: () => {
43
+ return new Promise(resolve => {
44
+ resolve({});
45
+ });
46
+ },
47
+ updateFieldValue: () => {},
48
+ triggerFieldChange: () => {}
49
+ };
50
+ },
51
+ getChildren: () => {
52
+ return pyHome1Raw.children;
53
+ },
54
+ getComponentName: () => {
55
+ return '';
56
+ },
57
+ getLocalizedValue: value => {
58
+ return value;
59
+ },
60
+ getRawMetadata: () => {
61
+ return pyHome1Raw;
62
+ },
63
+ createComponent: config => {
64
+ switch (config.type) {
65
+ case 'AppAnnouncement':
66
+ return (
67
+ <PegaAppAnnouncement
68
+ heading='Announcements'
69
+ description={configProps.description}
70
+ whatsNewLink={configProps.whatsnewlink}
71
+ image={configProps.image.replace(/ /g, '+')}
72
+ datasource={configProps.datasource}
73
+ label={configProps.label}
74
+ getPConnect={() => {
75
+ return {
76
+ getChildren: () => {
77
+ return pyHome1Resolved.children;
78
+ }
79
+ };
80
+ }}
81
+ />
82
+ );
83
+ }
84
+ },
85
+ ignoreSuggestion: () => {},
86
+ acceptSuggestion: () => {},
87
+ setInheritedProps: () => {},
88
+ resolveConfigProps: () => {}
89
+ };
90
+ }
91
+ };
92
+
93
+ const regionAChildren = pyHome1Raw.children[0].children.map(child => {
94
+ return props.getPConnect().createComponent(child);
95
+ });
96
+
97
+ return (
98
+ <>
99
+ <{{COMPONENT_CLASS_NAME}} {...props}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>
100
+ </>
101
+ );
102
+ };
@@ -1,19 +1,19 @@
1
1
  import { useMemo, Children } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { OneColumnPage as OneColumn } from '@pega/cosmos-react-core';
4
- import { registerIcon } from '@pega/cosmos-react-core';
5
4
  import { ConfigurableLayout } from '@pega/cosmos-react-work'
5
+ // import { registerIcon } from '@pega/cosmos-react-core';
6
6
 
7
7
  // temp
8
- //import * as headlineIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/headline.icon';
8
+ // import * as headlineIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/headline.icon';
9
9
 
10
10
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
11
11
 
12
- import GetNextWork from './GetNextWork';
12
+ import GetNextWork from './GetNextWork.jsx';
13
13
  import { getLayoutDataFromRegion } from './utils';
14
14
 
15
15
  // temp
16
- //registerIcon(headlineIcon);
16
+ // registerIcon(headlineIcon);
17
17
 
18
18
  // currently getting 'icon' from props is not supported with iconRegistry
19
19
  // have to manually get icon, so can't determine a runtime for now
@@ -27,7 +27,9 @@ import { getLayoutDataFromRegion } from './utils';
27
27
  // any default values in config.pros should be set in defaultProps at bottom of this file
28
28
  export default function {{COMPONENT_CLASS_NAME}}(props) {
29
29
 
30
- const { children, title, icon, useConfigurableLayout, getPConnect, enableGetNextWork } = props;
30
+ // add back in icon when working
31
+ // const { children, title, icon, useConfigurableLayout, getPConnect, enableGetNextWork } = props;
32
+ const { children, title, useConfigurableLayout, getPConnect, enableGetNextWork } = props;
31
33
  const childArray = useMemo(() => {
32
34
  return Children.toArray(children);
33
35
  }, [children]);
@@ -56,13 +58,13 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
56
58
  }
57
59
 
58
60
  {{COMPONENT_CLASS_NAME}}.defaultProps = {
59
- icon: '',
61
+ /* icon: '', */
60
62
  useConfigurableLayout: false
61
63
  };
62
64
 
63
65
  {{COMPONENT_CLASS_NAME}}.propTypes = {
64
66
  children: PropTypes.arrayOf(PropTypes.node).isRequired,
65
67
  title: PropTypes.string.isRequired,
66
- icon: PropTypes.string,
68
+ /* icon: PropTypes.string, */
67
69
  useConfigurableLayout: PropTypes.bool
68
70
  };