@pega/custom-dx-components 0.25.54 → 0.25.56

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 (64) hide show
  1. package/package.json +2 -2
  2. package/src/tasks/build-comp/index.js +1 -1
  3. package/src/tasks/build-jest-assets/index.js +1 -1
  4. package/src/tasks/build-lib/helper.js +1 -1
  5. package/src/tasks/create/templates/Launchpad/Field/Text-Phone/config.json.mustache +146 -0
  6. package/src/tasks/create/templates/Launchpad/Field/Text-Phone/demo.stories.tsx.mustache +61 -0
  7. package/src/tasks/create/templates/Launchpad/Field/Text-Phone/demo.test.tsx.mustache +23 -0
  8. package/src/tasks/create/templates/Launchpad/Field/Text-Phone/event-utils.ts.mustache +18 -0
  9. package/src/tasks/create/templates/Launchpad/Field/Text-Phone/index.tsx.mustache +246 -0
  10. package/src/tasks/create/templates/Launchpad/Field/Text-Phone/mock.ts.mustache +40 -0
  11. package/src/tasks/create/templates/Launchpad/Field/Text-Phone/styles.ts.mustache +8 -0
  12. package/src/tasks/create/templates/Launchpad/Template/FORM/DefaultForm.svg +29 -0
  13. package/src/tasks/create/templates/Launchpad/Template/FORM/DetailsRender.tsx.mustache +59 -0
  14. package/src/tasks/create/templates/Launchpad/Template/FORM/config.json.mustache +45 -0
  15. package/src/tasks/create/templates/Launchpad/Template/FORM/demo.stories.tsx.mustache +255 -0
  16. package/src/tasks/create/templates/Launchpad/Template/FORM/demo.test.tsx.mustache +40 -0
  17. package/src/tasks/create/templates/Launchpad/Template/FORM/index.tsx.mustache +75 -0
  18. package/src/tasks/create/templates/Launchpad/Template/FORM/mock.ts.mustache +135 -0
  19. package/src/tasks/create/templates/Launchpad/Template/FORM/styles.ts.mustache +8 -0
  20. package/src/tasks/create/templates/Launchpad/Template/FORM-region/DetailsRender.tsx.mustache +59 -0
  21. package/src/tasks/create/templates/Launchpad/Template/FORM-region/TwoColumn.svg +38 -0
  22. package/src/tasks/create/templates/Launchpad/Template/FORM-region/config.json.mustache +27 -0
  23. package/src/tasks/create/templates/Launchpad/Template/FORM-region/demo.stories.tsx.mustache +272 -0
  24. package/src/tasks/create/templates/Launchpad/Template/FORM-region/demo.test.tsx.mustache +56 -0
  25. package/src/tasks/create/templates/Launchpad/Template/FORM-region/index.tsx.mustache +80 -0
  26. package/src/tasks/create/templates/Launchpad/Template/FORM-region/mock.ts.mustache +141 -0
  27. package/src/tasks/create/templates/Launchpad/Template/FORM-region/styles.ts.mustache +8 -0
  28. package/src/tasks/create-lib/index.js +3 -3
  29. package/src/tasks/create-version/index.js +1 -1
  30. package/src/tasks/delete/helper.js +1 -1
  31. package/src/tasks/delete-all/helper.js +2 -2
  32. package/src/tasks/delete-pub/helper.js +3 -3
  33. package/src/tasks/delete-pub/index.js +3 -3
  34. package/src/tasks/export-archive/index.js +7 -7
  35. package/src/tasks/import-archive/helper.js +6 -6
  36. package/src/tasks/import-archive/index.js +8 -8
  37. package/src/tasks/import-comp/index.js +1 -1
  38. package/src/tasks/init/template/package.json.mustache +2 -2
  39. package/src/tasks/linter/index.js +1 -1
  40. package/src/tasks/list-lib/index.js +4 -4
  41. package/src/tasks/move/index.js +7 -7
  42. package/src/tasks/publish/index.js +6 -6
  43. package/src/tasks/publish-lib/index.js +2 -2
  44. package/src/tasks/rename/index.js +2 -2
  45. package/src/tasks/rename-lib/index.js +1 -1
  46. package/src/tasks/restore-config/index.js +1 -1
  47. package/src/tasks/show-help/index.js +1 -1
  48. package/src/tasks/switch-lib/index.js +2 -2
  49. package/src/tasks/switch-version/index.js +1 -1
  50. package/src/tasks/validator/index.js +2 -2
  51. package/src/util.js +18 -18
  52. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyForm/mock.ts +0 -4
  53. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/config.json +1 -6
  54. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/mock.ts +1 -6
  55. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/mock.ts +0 -4
  56. package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +0 -9
  57. package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +0 -9
  58. /package/{tests/assets/original/components/create/shared/PConnProps.d.ts → src/tasks/create/templates/Launchpad/Field/Text-Phone/PConnProps.d.ts.mustache} +0 -0
  59. /package/{tests/assets/original/components/create/shared/create-nonce.ts → src/tasks/create/templates/Launchpad/Field/Text-Phone/create-nonce.ts.mustache} +0 -0
  60. /package/{tests/assets/original/components/create/shared/suggestions-handler.ts → src/tasks/create/templates/Launchpad/Field/Text-Phone/suggestions-handler.ts.mustache} +0 -0
  61. /package/{tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts → src/tasks/create/templates/Launchpad/Template/FORM/PConnProps.d.ts.mustache} +0 -0
  62. /package/{tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts → src/tasks/create/templates/Launchpad/Template/FORM/create-nonce.ts.mustache} +0 -0
  63. /package/{tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts → src/tasks/create/templates/Launchpad/Template/FORM-region/PConnProps.d.ts.mustache} +0 -0
  64. /package/{tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts → src/tasks/create/templates/Launchpad/Template/FORM-region/create-nonce.ts.mustache} +0 -0
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "{{COMPONENT_KEY}}",
3
+ "label": "{{COMPONENT_LABEL}}",
4
+ "description": "{{DESCRIPTION}}",
5
+ "organization": "{{ORGANIZATION}}",
6
+ "version": "{{VERSION}}",
7
+ "library": "{{LIBRARY}}",
8
+ "componentKey": "{{COMPONENT_KEY}}",
9
+ "type": "{{TYPE}}",
10
+ "subtype": {{{SUB_TYPE}}},
11
+ "subtypeLabel": "{{SUB_TYPE_LABEL}}",
12
+ "icon": "DefaultForm.svg",
13
+ "properties": [
14
+ {
15
+ "format": "SELECT",
16
+ "name": "NumCols",
17
+ "label": "Number of columns",
18
+ "defaultValue": "1",
19
+ "source": [
20
+ { "key": "1", "value": "One" },
21
+ { "key": "2", "value": "Two" },
22
+ { "key": "3", "value": "Three" }
23
+ ]
24
+ },
25
+ {
26
+ "format": "SELECT",
27
+ "name": "templateOverrideMode",
28
+ "label": "Template for embedded views",
29
+ "defaultValue": "USE_TEMPLATE",
30
+ "source": [
31
+ { "key": "USE_TEMPLATE", "value": "Use template" },
32
+ { "key": "IGNORE_TEMPLATE", "value": "Ignore template" }
33
+ ]
34
+ },
35
+ {
36
+ "format": "INSTRUCTIONS"
37
+ },
38
+ {
39
+ "name": "Fields",
40
+ "label": "Fields",
41
+ "format": "CONTENTPICKER",
42
+ "allowCreatingGroup": true
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,255 @@
1
+ /* eslint-disable react/jsx-no-useless-fragment */
2
+ // @ts-nocheck
3
+ import { useState } from 'react';
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+
6
+ import {{COMPONENT_CLASS_NAME}} from './index';
7
+ import { DateInput, Input, FieldValueList, Text, EmptyState } from '@pega/cosmos-react-core';
8
+ import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core';
9
+ import { pyReviewRaw, regionChildrenResolved } from './mock';
10
+
11
+ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
12
+ title: '{{COMPONENT_CLASS_NAME}}',
13
+ component: {{COMPONENT_CLASS_NAME}},
14
+ excludeStories: /.*Data$/,
15
+ parameters: {
16
+ type: 'Form'
17
+ }
18
+ };
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
22
+
23
+ const renderField = resolvedProps => {
24
+ const { displayMode, value = '', label = '', key, readOnly } = resolvedProps;
25
+
26
+ // eslint-disable-next-line react-hooks/rules-of-hooks
27
+ const [inputValue, setInputValue] = useState(value);
28
+ // eslint-disable-next-line react-hooks/rules-of-hooks
29
+ const [phoneValue, setPhoneValue] = useState('+16397975093');
30
+
31
+ const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
32
+
33
+ let val =
34
+ value !== '' ? (
35
+ <Text
36
+ variant='h1'
37
+ as='span'
38
+ key={key}
39
+ onChange={e => {
40
+ setInputValue(e.target.value);
41
+ }}
42
+ >
43
+ {inputValue}
44
+ </Text>
45
+ ) : (
46
+ ''
47
+ );
48
+
49
+ {{! pick new delimiters for mustache }}
50
+ {{=<% %>=}}
51
+
52
+ if (label === 'Service Date') {
53
+ val = (
54
+ <DateInput
55
+ value={inputValue}
56
+ style={{ fontSize: '14px' }}
57
+ key={key}
58
+ onChange={dateValue => {
59
+ const { valueAsISOString: date } = dateValue;
60
+ const trimmedDate = date ? date.substring(0, date.indexOf('T')) : date;
61
+ setInputValue(trimmedDate);
62
+ }}
63
+ />
64
+ );
65
+ }
66
+
67
+ if (label === 'Email') {
68
+ val = (
69
+ <Input
70
+ type='email'
71
+ value={inputValue}
72
+ style={{ fontSize: '14px' }}
73
+ key={key}
74
+ onChange={e => {
75
+ setInputValue(e.target.value);
76
+ }}
77
+ />
78
+ );
79
+ }
80
+
81
+ if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name') {
82
+ val = (
83
+ <Input
84
+ value={inputValue}
85
+ style={{ fontSize: '14px' }}
86
+ key={key}
87
+ onChange={e => {
88
+ setInputValue(e.target.value);
89
+ }}
90
+ />
91
+ );
92
+ }
93
+
94
+ if (label === 'Phone Number') {
95
+ val = (
96
+ <CosmosPhone
97
+ value={phoneValue}
98
+ style={{ fontSize: '14px' }}
99
+ key={key}
100
+ onChange={phoneVal => {
101
+ setPhoneValue(phoneVal);
102
+ }}
103
+ />
104
+ );
105
+ }
106
+
107
+ <%={{ }}=%> {{! revert delimiters for mustache }}
108
+
109
+ if (variant === 'inline') {
110
+ val = value || (
111
+ <span
112
+ aria-hidden='true'
113
+ onChange={e => {
114
+ setInputValue(e.target.value);
115
+ }}
116
+ >
117
+ &ndash;&ndash;
118
+ </span>
119
+ );
120
+ } else {
121
+ val = (
122
+ <Text
123
+ variant='h1'
124
+ as='span'
125
+ key={key}
126
+ onChange={e => {
127
+ setInputValue(e.target.value);
128
+ }}
129
+ >
130
+ {val}
131
+ </Text>
132
+ );
133
+ }
134
+
135
+ if (readOnly) {
136
+ return (
137
+ <EmptyState
138
+ key={Math.random()}
139
+ getPConnect={() => {
140
+ return {
141
+ getChildren: () => {
142
+ return [
143
+ {
144
+ getPConnect: () => {
145
+ return {
146
+ getRawMetadata: () => {
147
+ return {};
148
+ },
149
+ resolveConfigProps: props => {
150
+ return props;
151
+ },
152
+ getConfigProps: () => {
153
+ return {
154
+ value: '',
155
+ label: label,
156
+ displayMode: 'LABELS_LEFT'
157
+ };
158
+ },
159
+ getComponent: () => {
160
+ return val;
161
+ }
162
+ };
163
+ }
164
+ }
165
+ ];
166
+ }
167
+ };
168
+ }}
169
+ ></EmptyState>
170
+ );
171
+ }
172
+ return (
173
+ <FieldValueList
174
+ variant={variant}
175
+ fields={[{ name: label, value: val }]}
176
+ key={key}
177
+ />
178
+ );
179
+ };
180
+
181
+ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
182
+ const { readOnly } = args;
183
+
184
+ const props = {
185
+ readOnly: readOnly,
186
+ getPConnect: () => {
187
+ return {
188
+ getChildren: () => {
189
+ return pyReviewRaw.children;
190
+ },
191
+ getInheritedProps: () => {
192
+ return pyReviewRaw.config.inheritedProps;
193
+ },
194
+ createComponent: config => {
195
+ // eslint-disable-next-line default-case
196
+ switch (config.config.value) {
197
+ case '@P .FirstName':
198
+ return renderField({
199
+ ...regionChildrenResolved[0],
200
+ displayMode: readOnly ? 'LABELS_LEFT' : '',
201
+ readOnly
202
+ });
203
+ case '@P .MiddleName':
204
+ return renderField({
205
+ ...regionChildrenResolved[1],
206
+ displayMode: readOnly ? 'LABELS_LEFT' : '',
207
+ readOnly
208
+ });
209
+ case '@P .LastName':
210
+ return renderField({
211
+ ...regionChildrenResolved[2],
212
+ displayMode: readOnly ? 'LABELS_LEFT' : '',
213
+ readOnly
214
+ });
215
+ case '@P .Email':
216
+ return renderField({
217
+ ...regionChildrenResolved[3],
218
+ displayMode: readOnly ? 'LABELS_LEFT' : '',
219
+ readOnly
220
+ });
221
+ case '@P .PhoneNumber':
222
+ return renderField({
223
+ ...regionChildrenResolved[4],
224
+ displayMode: readOnly ? 'LABELS_LEFT' : '',
225
+ readOnly
226
+ });
227
+ case '@P .ServiceDate':
228
+ return renderField({
229
+ ...regionChildrenResolved[5],
230
+ displayMode: readOnly ? 'LABELS_LEFT' : '',
231
+ readOnly
232
+ });
233
+ }
234
+ }
235
+ };
236
+ }
237
+ };
238
+
239
+ const regionAChildren = pyReviewRaw.children[0].children.map(child => {
240
+ return props.getPConnect().createComponent(child);
241
+ });
242
+
243
+ return (
244
+ <>
245
+ <{{COMPONENT_CLASS_NAME}} {...props} {...args}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>
246
+ </>
247
+ );
248
+ };
249
+
250
+ Base{{COMPONENT_CLASS_NAME}}.args = {
251
+ readOnly: false,
252
+ showLabel: true,
253
+ label: 'Form template',
254
+ NumCols: 1,
255
+ };
@@ -0,0 +1,40 @@
1
+ // import { expect, test } from '@jest/globals';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { composeStories } from '@storybook/react';
4
+ import '@testing-library/jest-dom';
5
+
6
+ import * as DemoStories from './demo.stories';
7
+
8
+ const { Base{{COMPONENT_CLASS_NAME}} } = composeStories(DemoStories);
9
+
10
+ test('renders {{COMPONENT_CLASS_NAME}}', async () => {
11
+ render(<Base{{COMPONENT_CLASS_NAME}} />);
12
+ expect(await screen.findByText('Form template')).toBeVisible();
13
+
14
+ // labels
15
+ expect(await screen.findByText('First Name')).toBeVisible();
16
+ expect(await screen.findByText('Middle Name')).toBeVisible();
17
+ expect(await screen.findByText('Last Name')).toBeVisible();
18
+ expect(await screen.findByText('Email')).toBeVisible();
19
+ expect(await screen.findByText('Phone Number')).toBeVisible();
20
+ expect(await screen.findByText('Service Date')).toBeVisible();
21
+
22
+ const inputElements = screen.getAllByTestId(':input:control');
23
+ expect((inputElements[0] as HTMLInputElement).value).toBe('John');
24
+ expect((inputElements[1] as HTMLInputElement).value).toBe('');
25
+ expect((inputElements[2] as HTMLInputElement).value).toBe('Doe');
26
+ expect((inputElements[3] as HTMLInputElement).value).toBe('John@doe.com');
27
+
28
+ const myPhone = (screen.getByTestId(':phone-input:control') as HTMLInputElement).value;
29
+ expect(myPhone).toContain('(639) 797-5093');
30
+
31
+ const myClearMonth = (screen.getByTestId(':date-input:control-month') as HTMLInputElement).value;
32
+ expect(myClearMonth).toContain('01');
33
+
34
+ const myClearDay = (screen.getByTestId(':date-input:control-day') as HTMLInputElement).value;
35
+ expect(myClearDay).toContain('25');
36
+
37
+ const myClearYear = (screen.getByTestId(':date-input:control-year') as HTMLInputElement).value;
38
+ expect(myClearYear).toContain('2023');
39
+
40
+ });
@@ -0,0 +1,75 @@
1
+ import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
2
+
3
+
4
+ import type { PConnFieldProps } from './PConnProps';
5
+ import './create-nonce';
6
+ import DetailsRender from './DetailsRender';
7
+
8
+ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
9
+
10
+ // interface for props
11
+ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
12
+ // If any, enter additional props that only exist on TextInput here
13
+ showLabel: boolean;
14
+ NumCols: string;
15
+ children: any;
16
+ }
17
+
18
+ // props passed in combination of props from property panel (config.json) and run time props from Constellation
19
+ // any default values in config.pros should be set in defaultProps at bottom of this file
20
+ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
21
+
22
+ const { children = [], NumCols = '1', label, showLabel, getPConnect, readOnly, displayMode } = props;
23
+ const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
24
+
25
+ const nCols = parseInt(NumCols, 10);
26
+
27
+
28
+ if (readOnly && readOnly === true || displayMode && displayMode === 'DISPLAY_ONLY') {
29
+ const numRegions = '1';
30
+ const gridRepeat = 'repeat('.concat(numRegions).concat(', 1fr)');
31
+ const gridContainer = { colGap: 0, 'margin-line-start': 0 };
32
+ // @ts-ignore
33
+ gridContainer.cols = gridRepeat;
34
+ // @ts-ignore
35
+ gridContainer.gap = 2;
36
+
37
+ return (
38
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
39
+ {{! pick new delimiters for mustache }}
40
+ {{=<% %>=}}
41
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
42
+ <Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
43
+ {children.map((child: any, i: number) => (
44
+ <Flex
45
+ // @ts-ignore
46
+ container={{ direction: 'column', alignItems: 'normal', colGap: 1, rowGap: 1.5 }}
47
+ key={`r-${i + 1}`}
48
+ >
49
+ <DetailsRender child={child} />
50
+ </Flex>
51
+ ))}
52
+ </Grid>
53
+ </FieldGroup>
54
+ <%={{ }}=%> {{! revert delimiters for mustache }}
55
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
56
+ );
57
+ }
58
+ return (
59
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
60
+ {{! pick new delimiters for mustache }}
61
+ {{=<% %>=}}
62
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
63
+ <Grid container={{
64
+ cols: `repeat(${nCols}, minmax(0, 1fr))`,
65
+ gap: 2
66
+ }}>
67
+ {children}
68
+ </Grid>
69
+ </FieldGroup>
70
+ <%={{ }}=%> {{! revert delimiters for mustache }}
71
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
72
+ );
73
+ }
74
+
75
+ export default withConfiguration({{COMPONENT_CLASS_NAME}});
@@ -0,0 +1,135 @@
1
+
2
+ // @ts-nocheck
3
+ export const pyReviewRaw = {
4
+ name: 'CollectInformation',
5
+ type: 'View',
6
+ config: {
7
+ template: 'DefaultForm',
8
+ ruleClass: 'OM5W9U-SampleApp-Work-Test',
9
+ localeReference: '@LR OM5W9U-SAMPLEAPP-WORK-TEST!VIEW!COLLECTINFORMATION',
10
+ context: '@P .pyViewContext'
11
+ },
12
+ children: [
13
+ {
14
+ name: 'Fields',
15
+ type: 'Region',
16
+ children: [
17
+ {
18
+ type: 'TextInput',
19
+ config: {
20
+ value: '@P .FirstName',
21
+ label: '@L First Name',
22
+ key: 'FirstName'
23
+ }
24
+ },
25
+ {
26
+ type: 'TextInput',
27
+ config: {
28
+ value: '@P .MiddleName',
29
+ label: '@L Middle Name',
30
+ key: 'MiddleName'
31
+ }
32
+ },
33
+ {
34
+ type: 'TextInput',
35
+ config: {
36
+ value: '@P .LastName',
37
+ label: '@L Last Name',
38
+ key: 'LastName'
39
+ }
40
+ },
41
+ {
42
+ type: 'Email',
43
+ config: {
44
+ value: '@P .Email',
45
+ label: '@L Email',
46
+ key: 'Email'
47
+ }
48
+ },
49
+ {
50
+ type: 'Phone',
51
+ config: {
52
+ value: '@P .PhoneNumber',
53
+ label: '@L Phone Number',
54
+ datasource: {
55
+ },
56
+ key: 'PhoneNumber'
57
+ }
58
+ },
59
+ {
60
+ type: 'Date',
61
+ config: {
62
+ value: '@P .ServiceDate',
63
+ label: '@L Service Date',
64
+ key: 'ServiceDate'
65
+ }
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ classID: 'OM5W9U-SampleApp-Work-Test'
71
+ };
72
+
73
+ export const regionChildrenResolved = [
74
+ {
75
+ readOnly: undefined,
76
+ value: 'John',
77
+ label: 'First Name',
78
+ hasSuggestions: false,
79
+ key: 'firstName'
80
+ },
81
+ {
82
+ readOnly: undefined,
83
+ value: '',
84
+ label: 'Middle Name',
85
+ hasSuggestions: false,
86
+ key: 'middleName'
87
+ },
88
+ {
89
+ readOnly: undefined,
90
+ value: 'Doe',
91
+ label: 'Last Name',
92
+ hasSuggestions: false,
93
+ key: 'lastName'
94
+ },
95
+ {
96
+ readOnly: undefined,
97
+ value: 'John@doe.com',
98
+ label: 'Email',
99
+ hasSuggestions: false,
100
+ key: 'email'
101
+ },
102
+ {
103
+ readOnly: undefined,
104
+ value: '+16397975093',
105
+ label: 'Phone Number',
106
+ datasource: {
107
+ fields: {
108
+ value: undefined
109
+ },
110
+ source: [
111
+ {
112
+ value: '+1'
113
+ },
114
+ {
115
+ value: '+91'
116
+ },
117
+ {
118
+ value: '+48'
119
+ },
120
+ {
121
+ value: '+44'
122
+ }
123
+ ]
124
+ },
125
+ hasSuggestions: false,
126
+ key: 'phoneNumber'
127
+ },
128
+ {
129
+ readOnly: undefined,
130
+ value: '2023-01-25',
131
+ label: 'Service Date',
132
+ hasSuggestions: false,
133
+ key: 'serviceDate'
134
+ }
135
+ ];
@@ -0,0 +1,8 @@
1
+ // individual style, comment out above, and uncomment here and add styles
2
+ import styled, { css } from 'styled-components';
3
+
4
+ export default styled.div(() => {
5
+ return css`
6
+ margin: 0px 0;
7
+ `;
8
+ });
@@ -0,0 +1,59 @@
1
+ import { Fragment, type ReactElement } from 'react';
2
+ import { FieldValueList } from '@pega/cosmos-react-core';
3
+
4
+ interface DetailsRenderProps {
5
+ children?: never;
6
+ child: NonNullable<ReactElement>;
7
+ }
8
+
9
+ const DetailsRender = (props: DetailsRenderProps) => {
10
+ const { child } = props;
11
+
12
+ const kids = child.props.getPConnect().getChildren();
13
+
14
+ const displayCompArr: ReactElement[] = [];
15
+
16
+ Object.values(kids).forEach((value: any) => {
17
+ const { type } = value.getPConnect().getRawMetadata();
18
+ const { hideLabel, variant, testId, label } = value
19
+ .getPConnect()
20
+ .resolveConfigProps(value.getPConnect().getConfigProps());
21
+
22
+ let displayComp;
23
+ const key = JSON.stringify(value.getPConnect());
24
+
25
+ if (type === 'reference') {
26
+ const refElement = value.getPConnect().getComponent();
27
+
28
+ displayCompArr.push(refElement);
29
+ } else {
30
+ const element = value.getPConnect().getComponent();
31
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
32
+
33
+ const fvlStyle = {
34
+ myColGap: {
35
+ columnGap: '0',
36
+ marginLineStart: 0
37
+ }
38
+ };
39
+
40
+ // const myEl = <div>boo</div>;
41
+ displayComp = (
42
+ <Fragment key={key}>
43
+ <FieldValueList
44
+ style={fvlStyle.myColGap}
45
+ variant={hideLabel ? 'stacked' : variant}
46
+ data-testid={testId}
47
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
48
+ />
49
+ </Fragment>
50
+ );
51
+
52
+ displayCompArr.push(displayComp);
53
+ }
54
+ });
55
+
56
+ return <>{displayCompArr}</>;
57
+ };
58
+
59
+ export default DetailsRender;
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="100px" height="70px" viewBox="0 0 100 70" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>2-col icon</title>
4
+ <g id="Views" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <g id="Artboard-Copy-2" transform="translate(-198.000000, -207.000000)">
6
+ <g id="2-col--icon" transform="translate(198.000000, 207.000000)">
7
+ <rect id="bg" stroke="#A5A8BC" stroke-width="0.5" fill="#E7E9EB" x="0.25" y="0.25" width="99.5" height="69.5"></rect>
8
+ <g id="white" transform="translate(3.000000, 3.000000)" fill="#FFFFFF">
9
+ <rect id="Rectangle" x="0" y="0" width="94" height="66.5"></rect>
10
+ </g>
11
+ <g id="gray" transform="translate(6.000000, 6.000000)" fill="#8084A7">
12
+ <rect id="Rectangle" x="0" y="0" width="42" height="7.8"></rect>
13
+ <rect id="Rectangle-Copy-18" x="0" y="11.7" width="42" height="7.8"></rect>
14
+ <rect id="Rectangle-Copy-19" x="0" y="23.4" width="42" height="7.8"></rect>
15
+ <rect id="Rectangle-Copy-20" x="0" y="35.1" width="42" height="7.8"></rect>
16
+ <rect id="Rectangle-Copy-21" x="0" y="46.8" width="42" height="7.8"></rect>
17
+ <rect id="Rectangle-Copy-22" x="0" y="58.5" width="42" height="5"></rect>
18
+ <rect id="Rectangle-Copy" x="46" y="2.66453526e-15" width="42" height="7.8"></rect>
19
+ <rect id="Rectangle-Copy-27" x="46" y="11.7" width="42" height="7.8"></rect>
20
+ <rect id="Rectangle-Copy-26" x="46" y="23.4" width="42" height="7.8"></rect>
21
+ <rect id="Rectangle-Copy-25" x="46" y="35.1" width="42" height="7.8"></rect>
22
+ <rect id="Rectangle-Copy-24" x="46" y="46.8" width="42" height="7.8"></rect>
23
+ <rect id="Rectangle-Copy-23" x="46" y="58.5" width="42" height="5"></rect>
24
+ </g>
25
+ <g id="labels" transform="translate(16.000000, 11.000000)">
26
+ <circle id="Oval-Copy-3" fill="#FFFFFF" cx="10.5" cy="10.8076923" r="10.5"></circle>
27
+ <text id="A" font-family="OpenSans-Semibold, Open Sans" font-size="11" font-weight="500" fill="#56566F">
28
+ <tspan x="6.75" y="14">A</tspan>
29
+ </text>
30
+ <circle id="Oval-Copy-4" fill="#FFFFFF" cx="56.5" cy="10.8076923" r="10.5"></circle>
31
+ <text id="B" font-family="OpenSans-Semibold, Open Sans" font-size="11" font-weight="500" fill="#56566F">
32
+ <tspan x="52.75" y="14">B</tspan>
33
+ </text>
34
+ </g>
35
+ </g>
36
+ </g>
37
+ </g>
38
+ </svg>
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "{{COMPONENT_KEY}}",
3
+ "label": "{{COMPONENT_LABEL}}",
4
+ "description": "{{DESCRIPTION}}",
5
+ "organization": "{{ORGANIZATION}}",
6
+ "version": "{{VERSION}}",
7
+ "library": "{{LIBRARY}}",
8
+ "componentKey": "{{COMPONENT_KEY}}",
9
+ "type": "{{TYPE}}",
10
+ "subtype": {{{SUB_TYPE}}},
11
+ "subtypeLabel": "{{SUB_TYPE_LABEL}}",
12
+ "icon": "TwoColumn.svg",
13
+ "properties": [
14
+ {
15
+ "name": "A",
16
+ "label": "Region A",
17
+ "format": "CONTENTPICKER",
18
+ "allowCreatingGroup": true
19
+ },
20
+ {
21
+ "name": "B",
22
+ "label": "Region B",
23
+ "format": "CONTENTPICKER",
24
+ "allowCreatingGroup": true
25
+ }
26
+ ]
27
+ }