@pega/custom-dx-components 2.0.15 → 2.0.16

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 (117) hide show
  1. package/package.json +2 -2
  2. package/src/cli.js +0 -18
  3. package/src/tasks/authenticate/index.js +1 -3
  4. package/src/tasks/create/index.js +3 -6
  5. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
  6. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +18 -29
  7. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +2 -1
  8. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +67 -179
  9. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +16 -40
  10. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +1 -3
  11. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +1 -0
  12. package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js.mustache → date-utils.js} +0 -1
  13. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -1
  14. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +15 -40
  15. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +0 -2
  16. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +17 -22
  17. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +1 -2
  18. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +17 -25
  19. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +4 -3
  20. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -22
  21. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +2 -8
  22. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +17 -22
  23. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +1 -2
  24. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +14 -42
  25. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +1 -44
  26. package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
  27. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +16 -21
  28. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +16 -20
  29. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +2 -44
  30. package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
  31. package/src/tasks/create/templates/Constellation/{Template/DETAILS/StatusWork.jsx.mustache → Field/Text-Input/StatusWork.js} +1 -0
  32. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +17 -21
  33. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +3 -46
  34. package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
  35. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +17 -21
  36. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +2 -44
  37. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
  38. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +17 -19
  39. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +2 -46
  40. package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
  41. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +17 -19
  42. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +3 -174
  43. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
  44. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +16 -24
  45. package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +0 -1
  46. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +29 -14
  47. package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +77 -3
  48. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +29 -14
  49. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +74 -3
  50. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +10 -6
  51. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +8 -10
  52. package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.jsx.mustache → GetNextWork.js.mustache} +0 -6
  53. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +7 -9
  54. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +1 -4
  55. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +0 -1
  56. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
  57. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.jsx.mustache → Avatar.js.mustache} +0 -2
  58. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.jsx.mustache → Operator.js.mustache} +1 -2
  59. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
  60. package/src/tasks/delete/helper.js +0 -4
  61. package/src/tasks/delete/index.js +0 -4
  62. package/src/tasks/index.js +0 -3
  63. package/src/tasks/init/index.js +1 -1
  64. package/src/tasks/init/template/.eslintrc.json +5 -186
  65. package/src/tasks/init/template/package.json.mustache +4 -19
  66. package/src/tasks/init/template/tasks.config.json +0 -1
  67. package/src/tasks/list/index.js +0 -4
  68. package/src/tasks/{bundle → publish/bundle}/builder/index.js +0 -0
  69. package/src/tasks/{bundle → publish/bundle}/builder/modules.js +0 -0
  70. package/src/tasks/{bundle → publish/bundle}/builder/paths.js +0 -0
  71. package/src/tasks/{bundle → publish/bundle}/builder/webpack.config.js +2 -0
  72. package/src/tasks/{bundle → publish/bundle}/index.js +2 -2
  73. package/src/tasks/publish/index.js +1 -14
  74. package/src/util.js +0 -10
  75. package/src/tasks/build/helper.js +0 -123
  76. package/src/tasks/build/index.js +0 -54
  77. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +0 -21
  78. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -61
  79. package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -41
  80. package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +0 -23
  81. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +0 -23
  82. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +0 -21
  83. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +0 -23
  84. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +0 -21
  85. package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +0 -21
  86. package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +0 -67
  87. package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +0 -13
  88. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +0 -22
  89. package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.jsx +0 -26
  90. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +0 -21
  91. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +0 -20
  92. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +0 -37
  93. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +0 -22
  94. package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +0 -20
  95. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +0 -110
  96. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +0 -179
  97. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +0 -26
  98. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +0 -118
  99. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +0 -215
  100. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +0 -89
  101. package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +0 -125
  102. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +0 -100
  103. package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +0 -131
  104. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +0 -102
  105. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +0 -94
  106. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +0 -78
  107. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +0 -389
  108. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +0 -30
  109. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +0 -22
  110. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +0 -68
  111. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +0 -51
  112. package/src/tasks/delete-all/helper.js +0 -175
  113. package/src/tasks/delete-all/index.js +0 -49
  114. package/src/tasks/init/template/.eslintignore +0 -8
  115. package/src/tasks/linter/index.js +0 -46
  116. package/src/tasks/publish-all/helper.js +0 -139
  117. package/src/tasks/publish-all/index.js +0 -84
@@ -1,26 +0,0 @@
1
- import { Status } from "@pega/cosmos-react-core";
2
-
3
- export default function StatusWorkRenderer({ value }) {
4
- let variant = "info";
5
-
6
- const warnStrings = ["fail", "cancel", "reject", "revoke", "stopped", "warn"];
7
- const infoStrings = ["open", "hold", "info", "new"];
8
- const successStrings = ["resolved", "completed", "success"];
9
- const pendingStrings = ["pending"];
10
-
11
- if (new RegExp(warnStrings.join("|"), "i").test(value)) {
12
- variant = "warn";
13
- } else if (new RegExp(infoStrings.join("|"), "i").test(value)) {
14
- variant = "info";
15
- } else if (new RegExp(successStrings.join("|"), "i").test(value)) {
16
- variant = "success";
17
- } else if (new RegExp(pendingStrings.join("|"), "i").test(value)) {
18
- variant = "pending";
19
- }
20
-
21
- return (
22
- <Status type="rectangle" variant={variant}>
23
- {value}
24
- </Status>
25
- );
26
- }
@@ -1,118 +0,0 @@
1
- import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/cosmos-react-core';
2
- import {{COMPONENT_CLASS_NAME}} from './index';
3
- import { pyReviewRaw, pyReviewResolved, regionChildrenResolved } from './mock.stories';
4
- import StatusWorkRenderer from './StatusWork.jsx';
5
-
6
- export default {
7
- title: '{{COMPONENT_CLASS_NAME}}',
8
- component: {{COMPONENT_CLASS_NAME}}
9
- };
10
-
11
- const Template = args => {
12
- const regionAChildren = pyReviewRaw.children[0].children.map(child => {
13
- return Primary.args.getPConnect().createComponent(child);
14
- });
15
- const regionBChildren = pyReviewRaw.children[1].children.map(child => {
16
- return Primary.args.getPConnect().createComponent(child);
17
- });
18
-
19
- return (
20
- <{{COMPONENT_CLASS_NAME}} {...args}>
21
- {regionAChildren}
22
- {regionBChildren}
23
- </{{COMPONENT_CLASS_NAME}}>
24
- );
25
- };
26
-
27
- export const Primary = Template.bind({});
28
-
29
- Primary.args = {
30
- template: 'MyCo_MyComponents_NewDetailsTemplate',
31
- showHighlightedData: true,
32
- label: 'Test Details',
33
- showLabel: true,
34
- getPConnect: () => {
35
- return {
36
- getChildren: () => {
37
- return pyReviewRaw.children;
38
- },
39
- getRawMetadata: () => {
40
- return pyReviewRaw;
41
- },
42
- getInheritedProps: () => {
43
- return pyReviewRaw.config.inheritedProps;
44
- },
45
- createComponent: config => {
46
- switch (config.config.value) {
47
- case '@P .pyStatusWork':
48
- return renderField(pyReviewResolved.highlightedData[0].config);
49
- case '@P .pyID':
50
- return renderField(pyReviewResolved.highlightedData[1].config);
51
- case '@P .pxCreateDateTime':
52
- return renderField(pyReviewResolved.highlightedData[2].config);
53
- case '@USER .pxCreateOperator':
54
- return renderField(pyReviewResolved.highlightedData[3].config);
55
- case '@P .pySLADeadline':
56
- return renderField(regionChildrenResolved[0]);
57
- case '@P .pySLAGoal':
58
- return renderField(regionChildrenResolved[1]);
59
- case '@P .pySLAStartTime':
60
- return renderField(regionChildrenResolved[2]);
61
- }
62
- },
63
- setInheritedProp: () => {},
64
- resolveConfigProps: () => {}
65
- };
66
- }
67
- };
68
-
69
- const renderField = resolvedProps => {
70
- const {
71
- displayAsStatus = false,
72
- displayMode,
73
- value = '',
74
- label = '',
75
- theme = useTheme()
76
- } = resolvedProps;
77
-
78
- const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
79
-
80
- let val =
81
- value != '' ? (
82
- <Text variant='h1' as='span'>
83
- {value}
84
- </Text>
85
- ) : (
86
- ''
87
- );
88
-
89
- if (label === 'Create date/time')
90
- val = <DateTimeDisplay value={value} variant='datetime' format='long' clockFormat={null} />;
91
-
92
- if (displayAsStatus === true) val = <StatusWorkRenderer value={value} />;
93
-
94
- if (label === 'Create Operator')
95
- val = (
96
- <Button
97
- variant='link'
98
- style={
99
- label !== null
100
- ? { width: 'max-content', height: theme.components.input.height }
101
- : undefined
102
- }
103
- >
104
- {value.userName}
105
- </Button>
106
- );
107
-
108
- if (variant === 'inline') {
109
- val = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
110
- } else {
111
- val = (
112
- <Text variant='h1' as='span'>
113
- {val}
114
- </Text>
115
- );
116
- }
117
- return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
118
- };
@@ -1,215 +0,0 @@
1
- export const pyReviewRaw = {
2
- name: 'pyReview',
3
- type: 'View',
4
- config: {
5
- template: 'Details',
6
- ruleClass: 'MyCo-MyCompon-Work-MyComponents',
7
- showLabel: true,
8
- label: '@L Details',
9
- localeReference: '@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW',
10
- showHighlightedData: true,
11
- highlightedData: [
12
- {
13
- type: 'TextInput',
14
- config: {
15
- value: '@P .pyStatusWork',
16
- label: '@L Work Status',
17
- displayMode: 'STACKED_LARGE_VAL',
18
- displayAsStatus: true
19
- }
20
- },
21
- {
22
- type: 'TextInput',
23
- config: {
24
- value: '@P .pyID',
25
- label: '@L Case ID',
26
- displayMode: 'STACKED_LARGE_VAL'
27
- }
28
- },
29
- {
30
- type: 'DateTime',
31
- config: {
32
- value: '@P .pxCreateDateTime',
33
- label: '@L Create date/time',
34
- displayMode: 'STACKED_LARGE_VAL'
35
- }
36
- },
37
- {
38
- type: 'UserReference',
39
- config: {
40
- label: '@L Create Operator',
41
- value: '@USER .pxCreateOperator',
42
- placeholder: 'Select...',
43
- displayMode: 'STACKED_LARGE_VAL'
44
- }
45
- }
46
- ],
47
- inheritedProps: [
48
- {
49
- prop: 'label',
50
- value: '@L Details'
51
- },
52
- {
53
- prop: 'showLabel',
54
- value: true
55
- }
56
- ]
57
- },
58
- children: [
59
- {
60
- name: 'A',
61
- type: 'Region',
62
- getPConnect: () => {
63
- return {
64
- getRawMetadata: () => {
65
- return pyReviewRaw.children[0];
66
- }
67
- };
68
- },
69
- children: [
70
- {
71
- type: 'DateTime',
72
- config: {
73
- value: '@P .pySLADeadline',
74
- label: '@L SLA Deadline'
75
- }
76
- },
77
- {
78
- type: 'DateTime',
79
- config: {
80
- value: '@P .pySLAGoal',
81
- label: '@L SLA Goal'
82
- }
83
- },
84
- {
85
- type: 'RadioButtons',
86
- config: {
87
- value: '@P .pySLAStartTime',
88
- label: '@L SLA Start Time',
89
- listType: 'associated',
90
- datasource: '@ASSOCIATED .pySLAStartTime'
91
- }
92
- }
93
- ]
94
- },
95
- {
96
- name: 'B',
97
- type: 'Region',
98
- getPConnect: () => {
99
- return {
100
- getRawMetadata: () => {
101
- return pyReviewRaw.children[0];
102
- }
103
- };
104
- },
105
- children: [
106
- {
107
- type: 'DateTime',
108
- config: {
109
- value: '@P .pySLADeadline',
110
- label: '@L SLA Deadline'
111
- }
112
- },
113
- {
114
- type: 'DateTime',
115
- config: {
116
- value: '@P .pySLAGoal',
117
- label: '@L SLA Goal'
118
- }
119
- },
120
- {
121
- type: 'RadioButtons',
122
- config: {
123
- value: '@P .pySLAStartTime',
124
- label: '@L SLA Start Time',
125
- listType: 'associated',
126
- datasource: '@ASSOCIATED .pySLAStartTime'
127
- }
128
- }
129
- ]
130
- }
131
- ],
132
- classID: 'MyCo-MyCompon-Work-MyComponents'
133
- };
134
-
135
- export const pyReviewResolved = {
136
- readOnly: true,
137
- template: 'Details',
138
- ruleClass: 'MyCo-MyCompon-Work-MyComponents',
139
- showLabel: true,
140
- label: 'Details',
141
- localeReference: 'MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW',
142
- showHighlightedData: true,
143
- highlightedData: [
144
- {
145
- type: 'TextInput',
146
- config: {
147
- value: 'New',
148
- label: 'Work Status',
149
- displayMode: 'STACKED_LARGE_VAL',
150
- displayAsStatus: true
151
- }
152
- },
153
- {
154
- type: 'TextInput',
155
- config: {
156
- value: 'M-1002',
157
- label: 'Case ID',
158
- displayMode: 'STACKED_LARGE_VAL'
159
- }
160
- },
161
- {
162
- type: 'DateTime',
163
- config: {
164
- value: '2022-12-11T20:06:27.232Z',
165
- label: 'Create date/time',
166
- displayMode: 'STACKED_LARGE_VAL'
167
- }
168
- },
169
- {
170
- type: 'UserReference',
171
- config: {
172
- label: 'Create Operator',
173
- value: {
174
- userId: 'conns',
175
- userName: 'Sara Connor'
176
- },
177
- placeholder: 'Select...',
178
- displayMode: 'STACKED_LARGE_VAL'
179
- }
180
- }
181
- ],
182
- displayMode: 'LABELS_LEFT'
183
- };
184
-
185
- export const regionChildrenResolved = [
186
- {
187
- readOnly: true,
188
- value: '',
189
- label: 'SLA Deadline',
190
- displayMode: 'LABELS_LEFT'
191
- },
192
- {
193
- readOnly: true,
194
- value: '',
195
- label: 'SLA Goal',
196
- displayMode: 'LABELS_LEFT'
197
- },
198
- {
199
- readOnly: true,
200
- value: '',
201
- label: 'SLA Start Time',
202
- listType: 'associated',
203
- datasource: [
204
- {
205
- key: 'AssignmentCreation',
206
- value: 'The creation time of the Assignment'
207
- },
208
- {
209
- key: 'CurrentTime',
210
- value: 'Current Date Time'
211
- }
212
- ],
213
- displayMode: 'LABELS_LEFT'
214
- }
215
- ];
@@ -1,89 +0,0 @@
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,125 +0,0 @@
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
- ];
@@ -1,100 +0,0 @@
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
- };