@pega/custom-dx-components 8.8.8 → 8.8.9

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.
@@ -14,6 +14,7 @@ const renderField = resolvedProps => {
14
14
  displayMode,
15
15
  value = '',
16
16
  label = '',
17
+ key,
17
18
  // eslint-disable-next-line react-hooks/rules-of-hooks
18
19
  theme = useTheme()
19
20
  } = resolvedProps;
@@ -22,7 +23,7 @@ const renderField = resolvedProps => {
22
23
 
23
24
  let val =
24
25
  value !== '' ? (
25
- <Text variant='h1' as='span'>
26
+ <Text variant='h1' as='span' key={key}>
26
27
  {value}
27
28
  </Text>
28
29
  ) : (
@@ -30,9 +31,17 @@ const renderField = resolvedProps => {
30
31
  );
31
32
 
32
33
  if (label === 'Create date/time')
33
- val = <DateTimeDisplay value={value} variant='datetime' format='long' clockFormat={null} />;
34
+ val = (
35
+ <DateTimeDisplay
36
+ value={value}
37
+ variant='datetime'
38
+ format='long'
39
+ clockFormat={null}
40
+ key={key}
41
+ />
42
+ );
34
43
 
35
- if (displayAsStatus === true) val = <StatusWorkRenderer value={value} />;
44
+ if (displayAsStatus === true) val = <StatusWorkRenderer value={value} key={key} />;
36
45
 
37
46
  if (label === 'Create Operator')
38
47
  val = (
@@ -43,24 +52,28 @@ const renderField = resolvedProps => {
43
52
  ? { width: 'max-content', height: theme.components.input.height }
44
53
  : undefined
45
54
  }
55
+ key={key}
46
56
  >
47
57
  {value.userName}
48
58
  </Button>
49
59
  );
50
60
 
51
61
  if (variant === 'inline') {
52
- val = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
62
+ val = value || (
63
+ <span aria-hidden='true' key={key}>
64
+ &ndash;&ndash;
65
+ </span>
66
+ );
53
67
  } else {
54
68
  val = (
55
- <Text variant='h1' as='span'>
69
+ <Text variant='h1' as='span' key={key}>
56
70
  {val}
57
71
  </Text>
58
72
  );
59
73
  }
60
- return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
74
+ return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} key={key} />;
61
75
  };
62
76
 
63
-
64
77
  export const base{{COMPONENT_CLASS_NAME}} = () => {
65
78
  const props = {
66
79
  template: 'MyCo_MyComponents_NewDetailsTemplate',
@@ -15,7 +15,8 @@ export const pyReviewRaw = {
15
15
  value: '@P .pyStatusWork',
16
16
  label: '@L Work Status',
17
17
  displayMode: 'STACKED_LARGE_VAL',
18
- displayAsStatus: true
18
+ displayAsStatus: true,
19
+ key: 'pyStatusWork'
19
20
  }
20
21
  },
21
22
  {
@@ -23,7 +24,8 @@ export const pyReviewRaw = {
23
24
  config: {
24
25
  value: '@P .pyID',
25
26
  label: '@L Case ID',
26
- displayMode: 'STACKED_LARGE_VAL'
27
+ displayMode: 'STACKED_LARGE_VAL',
28
+ key: 'pyID'
27
29
  }
28
30
  },
29
31
  {
@@ -31,7 +33,8 @@ export const pyReviewRaw = {
31
33
  config: {
32
34
  value: '@P .pxCreateDateTime',
33
35
  label: '@L Create date/time',
34
- displayMode: 'STACKED_LARGE_VAL'
36
+ displayMode: 'STACKED_LARGE_VAL',
37
+ key: 'pxCreateDateTime'
35
38
  }
36
39
  },
37
40
  {
@@ -40,7 +43,8 @@ export const pyReviewRaw = {
40
43
  label: '@L Create Operator',
41
44
  value: '@USER .pxCreateOperator',
42
45
  placeholder: 'Select...',
43
- displayMode: 'STACKED_LARGE_VAL'
46
+ displayMode: 'STACKED_LARGE_VAL',
47
+ key: 'pxCreateOperator'
44
48
  }
45
49
  }
46
50
  ],
@@ -59,6 +63,7 @@ export const pyReviewRaw = {
59
63
  {
60
64
  name: 'A',
61
65
  type: 'Region',
66
+ key: 'A',
62
67
  getPConnect: () => {
63
68
  return {
64
69
  getRawMetadata: () => {
@@ -71,14 +76,16 @@ export const pyReviewRaw = {
71
76
  type: 'DateTime',
72
77
  config: {
73
78
  value: '@P .pySLADeadline',
74
- label: '@L SLA Deadline'
79
+ label: '@L SLA Deadline',
80
+ key: 'pySLADeadline'
75
81
  }
76
82
  },
77
83
  {
78
84
  type: 'DateTime',
79
85
  config: {
80
86
  value: '@P .pySLAGoal',
81
- label: '@L SLA Goal'
87
+ label: '@L SLA Goal',
88
+ key: 'pySLAGoal'
82
89
  }
83
90
  },
84
91
  {
@@ -87,7 +94,8 @@ export const pyReviewRaw = {
87
94
  value: '@P .pySLAStartTime',
88
95
  label: '@L SLA Start Time',
89
96
  listType: 'associated',
90
- datasource: '@ASSOCIATED .pySLAStartTime'
97
+ datasource: '@ASSOCIATED .pySLAStartTime',
98
+ key: 'pySLAStartTime'
91
99
  }
92
100
  }
93
101
  ]
@@ -95,6 +103,7 @@ export const pyReviewRaw = {
95
103
  {
96
104
  name: 'B',
97
105
  type: 'Region',
106
+ key: 'B',
98
107
  getPConnect: () => {
99
108
  return {
100
109
  getRawMetadata: () => {
@@ -107,14 +116,16 @@ export const pyReviewRaw = {
107
116
  type: 'DateTime',
108
117
  config: {
109
118
  value: '@P .pySLADeadline',
110
- label: '@L SLA Deadline'
119
+ label: '@L SLA Deadline',
120
+ key: 'pySLADeadline'
111
121
  }
112
122
  },
113
123
  {
114
124
  type: 'DateTime',
115
125
  config: {
116
126
  value: '@P .pySLAGoal',
117
- label: '@L SLA Goal'
127
+ label: '@L SLA Goal',
128
+ key: 'pySLAGoal'
118
129
  }
119
130
  },
120
131
  {
@@ -123,7 +134,8 @@ export const pyReviewRaw = {
123
134
  value: '@P .pySLAStartTime',
124
135
  label: '@L SLA Start Time',
125
136
  listType: 'associated',
126
- datasource: '@ASSOCIATED .pySLAStartTime'
137
+ datasource: '@ASSOCIATED .pySLAStartTime',
138
+ key: 'pySLAStartTime'
127
139
  }
128
140
  }
129
141
  ]
@@ -187,13 +199,15 @@ export const regionChildrenResolved = [
187
199
  readOnly: true,
188
200
  value: '',
189
201
  label: 'SLA Deadline',
190
- displayMode: 'LABELS_LEFT'
202
+ displayMode: 'LABELS_LEFT',
203
+ key: 'SLA Deadline'
191
204
  },
192
205
  {
193
206
  readOnly: true,
194
207
  value: '',
195
208
  label: 'SLA Goal',
196
- displayMode: 'LABELS_LEFT'
209
+ displayMode: 'LABELS_LEFT',
210
+ key: 'SLA Goal'
197
211
  },
198
212
  {
199
213
  readOnly: true,
@@ -210,6 +224,7 @@ export const regionChildrenResolved = [
210
224
  value: 'Current Date Time'
211
225
  }
212
226
  ],
213
- displayMode: 'LABELS_LEFT'
227
+ displayMode: 'LABELS_LEFT',
228
+ key: 'SLA Start Time'
214
229
  }
215
230
  ];
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
2
+ import { useState } from 'react';
1
3
  import { withKnobs } from '@storybook/addon-knobs';
2
4
 
3
5
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
@@ -12,14 +14,24 @@ export default {
12
14
  };
13
15
 
14
16
  const renderField = resolvedProps => {
15
- const { displayMode, value = '', label = '' } = resolvedProps;
17
+ const { displayMode, value = '', label = '', key } = resolvedProps;
18
+
19
+ const [inputValue, setInputValue] = useState(value);
20
+ const [phoneValue, setPhoneValue] = useState('+16397975093');
16
21
 
17
22
  const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
18
23
 
19
24
  let val =
20
25
  value !== '' ? (
21
- <Text variant='h1' as='span'>
22
- {value}
26
+ <Text
27
+ variant='h1'
28
+ as='span'
29
+ key={key}
30
+ onChange={e => {
31
+ setInputValue(e.target.value);
32
+ }}
33
+ >
34
+ {inputValue}
23
35
  </Text>
24
36
  ) : (
25
37
  ''
@@ -28,29 +40,93 @@ const renderField = resolvedProps => {
28
40
  {{! pick new delimiteres for mustache }}
29
41
  {{=<% %>=}}
30
42
 
31
- if (label === 'Service Date') val = <DateInput value={value} style={{ fontSize: '14px' }}></DateInput>;
43
+ if (label === 'Service Date')
44
+ val = (
45
+ <DateInput
46
+ value={inputValue}
47
+ style={{ fontSize: '14px' }}
48
+ key={key}
49
+ onChange={dateValue => {
50
+ const { valueAsISOString: date } = dateValue;
51
+ const trimmedDate = date ? date.substring(0, date.indexOf('T')) : date;
52
+ setInputValue(trimmedDate);
53
+ }}
54
+ ></DateInput>
55
+ );
32
56
 
33
- if (label === 'Email') val = <Input type='email' value={value} style={{ fontSize: '14px' }}></Input>;
57
+ if (label === 'Email')
58
+ val = (
59
+ <Input
60
+ type='email'
61
+ value={inputValue}
62
+ style={{ fontSize: '14px' }}
63
+ key={key}
64
+ onChange={e => {
65
+ setInputValue(e.target.value);
66
+ }}
67
+ ></Input>
68
+ );
34
69
 
35
70
  if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name')
36
- val = <Input value={value} style={{ fontSize: '14px' }}></Input>;
71
+ val = (
72
+ <Input
73
+ value={inputValue}
74
+ style={{ fontSize: '14px' }}
75
+ key={key}
76
+ onChange={e => {
77
+ setInputValue(e.target.value);
78
+ }}
79
+ ></Input>
80
+ );
81
+
82
+ if (label === 'Phone Number')
83
+ val = (
84
+ <CosmosPhone
85
+ value={phoneValue}
86
+ style={{ fontSize: '14px' }}
87
+ key={key}
88
+ onChange={phoneVal => {
89
+ setPhoneValue(phoneVal);
90
+ }}
91
+ ></CosmosPhone>
92
+ );
37
93
 
38
- if (label === 'Phone Number') val = <CosmosPhone value={value} style={{ fontSize: '14px' }}></CosmosPhone>;
39
94
  <%={{ }}=%> {{! revert delimiteres for mustache }}
40
95
 
41
96
  if (variant === 'inline') {
42
- val = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
97
+ val = value || (
98
+ <span
99
+ aria-hidden='true'
100
+ onChange={e => {
101
+ setInputValue(e.target.value);
102
+ }}
103
+ >
104
+ &ndash;&ndash;
105
+ </span>
106
+ );
43
107
  } else {
44
108
  val = (
45
- <Text variant='h1' as='span'>
109
+ <Text
110
+ variant='h1'
111
+ as='span'
112
+ key={key}
113
+ onChange={e => {
114
+ setInputValue(e.target.value);
115
+ }}
116
+ >
46
117
  {val}
47
118
  </Text>
48
119
  );
49
120
  }
50
- return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
121
+ return (
122
+ <FieldValueList
123
+ variant={variant}
124
+ fields={[{ name: label, value: val }]}
125
+ key={key}
126
+ />
127
+ );
51
128
  };
52
129
 
53
-
54
130
  export const base{{COMPONENT_CLASS_NAME}} = () => {
55
131
  const props = {
56
132
  NumCols: 1,
@@ -86,8 +162,8 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
86
162
  });
87
163
 
88
164
  return (
89
- <>
90
- <{{COMPONENT_CLASS_NAME}} {...props}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>
91
- </>
165
+ <>
166
+ <{{COMPONENT_CLASS_NAME}} {...props}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>
167
+ </>
92
168
  );
93
169
  };
@@ -16,28 +16,32 @@ export const pyReviewRaw = {
16
16
  type: 'TextInput',
17
17
  config: {
18
18
  value: '@P .FirstName',
19
- label: '@L First Name'
19
+ label: '@L First Name',
20
+ key: 'FirstName'
20
21
  }
21
22
  },
22
23
  {
23
24
  type: 'TextInput',
24
25
  config: {
25
26
  value: '@P .MiddleName',
26
- label: '@L Middle Name'
27
+ label: '@L Middle Name',
28
+ key: 'MiddleName'
27
29
  }
28
30
  },
29
31
  {
30
32
  type: 'TextInput',
31
33
  config: {
32
34
  value: '@P .LastName',
33
- label: '@L Last Name'
35
+ label: '@L Last Name',
36
+ key: 'LastName'
34
37
  }
35
38
  },
36
39
  {
37
40
  type: 'Email',
38
41
  config: {
39
42
  value: '@P .Email',
40
- label: '@L Email'
43
+ label: '@L Email',
44
+ key: 'Email'
41
45
  }
42
46
  },
43
47
  {
@@ -50,14 +54,16 @@ export const pyReviewRaw = {
50
54
  fields: {
51
55
  value: '@P .pyCallingCode'
52
56
  }
53
- }
57
+ },
58
+ key: 'PhoneNumber'
54
59
  }
55
60
  },
56
61
  {
57
62
  type: 'Date',
58
63
  config: {
59
64
  value: '@P .ServiceDate',
60
- label: '@L Service Date'
65
+ label: '@L Service Date',
66
+ key: 'ServiceDate'
61
67
  }
62
68
  }
63
69
  ]
@@ -71,25 +77,29 @@ export const regionChildrenResolved = [
71
77
  readOnly: undefined,
72
78
  value: 'John',
73
79
  label: 'First Name',
74
- hasSuggestions: false
80
+ hasSuggestions: false,
81
+ key: 'firstName'
75
82
  },
76
83
  {
77
84
  readOnly: undefined,
78
85
  value: '',
79
86
  label: 'Middle Name',
80
- hasSuggestions: false
87
+ hasSuggestions: false,
88
+ key: 'middleName'
81
89
  },
82
90
  {
83
91
  readOnly: undefined,
84
92
  value: 'Doe',
85
93
  label: 'Last Name',
86
- hasSuggestions: false
94
+ hasSuggestions: false,
95
+ key: 'lastName'
87
96
  },
88
97
  {
89
98
  readOnly: undefined,
90
99
  value: 'John@doe.com',
91
100
  label: 'Email',
92
- hasSuggestions: false
101
+ hasSuggestions: false,
102
+ key: 'email'
93
103
  },
94
104
  {
95
105
  readOnly: undefined,
@@ -114,12 +124,14 @@ export const regionChildrenResolved = [
114
124
  }
115
125
  ]
116
126
  },
117
- hasSuggestions: false
127
+ hasSuggestions: false,
128
+ key: 'phoneNumber'
118
129
  },
119
130
  {
120
131
  readOnly: undefined,
121
132
  value: '2023-01-25',
122
133
  label: 'Service Date',
123
- hasSuggestions: false
134
+ hasSuggestions: false,
135
+ key: 'serviceDate'
124
136
  }
125
137
  ];
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
2
+ import { useState } from 'react';
1
3
  import { withKnobs } from '@storybook/addon-knobs';
2
4
 
3
5
  import {{COMPONENT_CLASS_NAME}} from './index.jsx';
@@ -12,14 +14,25 @@ export default {
12
14
  };
13
15
 
14
16
  const renderField = resolvedProps => {
15
- const { displayMode, value = '', label = '' } = resolvedProps;
17
+ const { displayMode, value = '', label = '', key } = resolvedProps;
18
+
19
+ const [inputValue, setInputValue] = useState(value);
20
+ const [phoneValue, setPhoneValue] = useState('+16397975093');
21
+
16
22
 
17
23
  const variant = displayMode === 'LABELS_LEFT' ? 'inline' : 'stacked';
18
24
 
19
25
  let val =
20
26
  value !== '' ? (
21
- <Text variant='h1' as='span'>
22
- {value}
27
+ <Text
28
+ variant='h1'
29
+ as='span'
30
+ key={key}
31
+ onChange={e => {
32
+ setInputValue(e.target.value);
33
+ }}
34
+ >
35
+ {inputValue}
23
36
  </Text>
24
37
  ) : (
25
38
  ''
@@ -29,32 +42,97 @@ const renderField = resolvedProps => {
29
42
  {{=<% %>=}}
30
43
 
31
44
  if (label === 'Service Date')
32
- val = <DateInput value={value} style={{ fontSize: '14px' }}></DateInput>;
45
+ val = (
46
+ <DateInput
47
+ value={inputValue}
48
+ style={{ fontSize: '14px' }}
49
+ key={key}
50
+ onChange={dateVal => {
51
+ const { valueAsISOString: date } = dateVal;
52
+ const trimmedDate = date ? date.substring(0, date.indexOf('T')) : date;
53
+ setInputValue(trimmedDate);
54
+ }}
55
+ ></DateInput>
56
+ );
33
57
 
34
58
  if (label === 'Email')
35
- val = <Input type='email' value={value} style={{ fontSize: '14px' }}></Input>;
59
+ val = (
60
+ <Input
61
+ type='email'
62
+ value={inputValue}
63
+ style={{ fontSize: '14px' }}
64
+ key={key}
65
+ onChange={e => {
66
+ setInputValue(e.target.value);
67
+ }}
68
+ ></Input>
69
+ );
36
70
 
37
71
  if (label === 'First Name' || label === 'Last Name' || label === 'Middle Name')
38
- val = <Input value={value} style={{ fontSize: '14px' }}></Input>;
72
+ val = (
73
+ <Input
74
+ value={inputValue}
75
+ style={{ fontSize: '14px' }}
76
+ key={key}
77
+ onChange={e => {
78
+ setInputValue(e.target.value);
79
+ }}
80
+ ></Input>
81
+ );
39
82
 
40
83
  if (label === 'Phone Number')
41
- val = <CosmosPhone value={value} style={{ fontSize: '14px' }}></CosmosPhone>;
84
+ val = (
85
+ <CosmosPhone
86
+ value={phoneValue}
87
+ showCountryCode
88
+ style={{ fontSize: '14px' }}
89
+ key={key}
90
+ onChange={phoneVal => {
91
+ setPhoneValue(phoneVal);
92
+ }}
93
+ ></CosmosPhone>
94
+ );
42
95
 
43
96
  <%={{ }}=%> {{! revert delimiteres for mustache }}
44
97
 
45
98
  if (variant === 'inline') {
46
- val = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
99
+ val = value || (
100
+ <span
101
+ aria-hidden='true'
102
+ key={key}
103
+ onChange={e => {
104
+ setInputValue(e.target.value);
105
+ }}
106
+ >
107
+ &ndash;&ndash;
108
+ </span>
109
+ );
47
110
  } else {
48
111
  val = (
49
- <Text variant='h1' as='span'>
112
+ <Text
113
+ variant='h1'
114
+ as='span'
115
+ key={key}
116
+ onChange={e => {
117
+ setInputValue(e.target.value);
118
+ }}
119
+ >
50
120
  {val}
51
121
  </Text>
52
122
  );
53
123
  }
54
- return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} />;
124
+ return (
125
+ <FieldValueList
126
+ variant={variant}
127
+ fields={[{ name: label, value: val }]}
128
+ key={key}
129
+ onChange={() => {
130
+ /* nothing */
131
+ }}
132
+ />
133
+ );
55
134
  };
56
135
 
57
-
58
136
  export const base{{COMPONENT_CLASS_NAME}} = () => {
59
137
  const props = {
60
138
  template: 'DefaultForm',
@@ -16,21 +16,24 @@ export const pyReviewRaw = {
16
16
  type: 'TextInput',
17
17
  config: {
18
18
  value: '@P .FirstName',
19
- label: '@L First Name'
19
+ label: '@L First Name',
20
+ key: 'FirstName'
20
21
  }
21
22
  },
22
23
  {
23
24
  type: 'TextInput',
24
25
  config: {
25
26
  value: '@P .MiddleName',
26
- label: '@L Middle Name'
27
+ label: '@L Middle Name',
28
+ key: 'MiddleName'
27
29
  }
28
30
  },
29
31
  {
30
32
  type: 'TextInput',
31
33
  config: {
32
34
  value: '@P .LastName',
33
- label: '@L Last Name'
35
+ label: '@L Last Name',
36
+ key: 'LastName'
34
37
  }
35
38
  }
36
39
  ]
@@ -43,7 +46,8 @@ export const pyReviewRaw = {
43
46
  type: 'Email',
44
47
  config: {
45
48
  value: '@P .Email',
46
- label: '@L Email'
49
+ label: '@L Email',
50
+ key: 'Email'
47
51
  }
48
52
  },
49
53
  {
@@ -56,14 +60,16 @@ export const pyReviewRaw = {
56
60
  fields: {
57
61
  value: '@P .pyCallingCode'
58
62
  }
59
- }
63
+ },
64
+ key: 'PhoneNumber'
60
65
  }
61
66
  },
62
67
  {
63
68
  type: 'Date',
64
69
  config: {
65
70
  value: '@P .ServiceDate',
66
- label: '@L Service Date'
71
+ label: '@L Service Date',
72
+ key: 'ServiceDate'
67
73
  }
68
74
  }
69
75
  ]
@@ -77,25 +83,29 @@ export const regionChildrenResolved = [
77
83
  readOnly: undefined,
78
84
  value: 'John',
79
85
  label: 'First Name',
80
- hasSuggestions: false
86
+ hasSuggestions: false,
87
+ key: 'First Name'
81
88
  },
82
89
  {
83
90
  readOnly: undefined,
84
91
  value: '',
85
92
  label: 'Middle Name',
86
- hasSuggestions: false
93
+ hasSuggestions: false,
94
+ key: 'Middle Name'
87
95
  },
88
96
  {
89
97
  readOnly: undefined,
90
98
  value: 'Doe',
91
99
  label: 'Last Name',
92
- hasSuggestions: false
100
+ hasSuggestions: false,
101
+ key: 'Last Name'
93
102
  },
94
103
  {
95
104
  readOnly: undefined,
96
105
  value: 'John@doe.com',
97
106
  label: 'Email',
98
- hasSuggestions: false
107
+ hasSuggestions: false,
108
+ key: 'Email'
99
109
  },
100
110
  {
101
111
  readOnly: undefined,
@@ -120,12 +130,14 @@ export const regionChildrenResolved = [
120
130
  }
121
131
  ]
122
132
  },
123
- hasSuggestions: false
133
+ hasSuggestions: false,
134
+ key: 'Phone Number'
124
135
  },
125
136
  {
126
137
  readOnly: undefined,
127
138
  value: '2023-01-25',
128
139
  label: 'Service Date',
129
- hasSuggestions: false
140
+ hasSuggestions: false,
141
+ key: 'Service Date'
130
142
  }
131
143
  ];