@pega/dx-component-builder-sdk 0.1.25 → 0.1.27

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 (30) hide show
  1. package/package.json +1 -1
  2. package/src/auth.js +2 -2
  3. package/src/cli.js +6 -0
  4. package/src/constants.js +30 -1
  5. package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +14 -2
  6. package/src/tasks/create/templates/SDK-React/field/Date/demo.stories.jsx.mustache +13 -0
  7. package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +26 -11
  8. package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.jsx.mustache +12 -0
  9. package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +32 -12
  10. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +9 -7
  11. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/demo.stories.jsx.mustache +3 -0
  12. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +29 -8
  13. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +10 -8
  14. package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +10 -7
  15. package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +16 -6
  16. package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +9 -7
  17. package/src/tasks/create/templates/SDK-React/field/Text-Email/index.tsx.mustache +9 -9
  18. package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +9 -7
  19. package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +9 -7
  20. package/src/tasks/create/templates/SDK-React/field/Text-Phone/index.tsx.mustache +9 -9
  21. package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +9 -7
  22. package/src/tasks/create/templates/SDK-React/field/TimeofDay/index.tsx.mustache +7 -5
  23. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +0 -6
  24. package/src/tasks/create/templates/SDK-React/widget/PAGE/index.tsx.mustache +0 -1
  25. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.jsx.mustache +1 -8
  26. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +14 -42
  27. package/src/tasks/create-all/index.js +456 -0
  28. package/src/tasks/delete-all/helper.js +8 -10
  29. package/src/tasks/index.js +1 -0
  30. package/src/tasks/linter/index.js +55 -30
@@ -26,7 +26,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
26
26
  testId,
27
27
  fieldMetadata,
28
28
  helperText,
29
- displayMode
29
+ displayMode,
30
+ hideLabel
30
31
  } = props;
31
32
  const helperTextToDisplay = validatemessage || helperText;
32
33
 
@@ -34,11 +35,12 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
34
35
 
35
36
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
36
37
 
37
- if(displayMode === 'LABELS_LEFT'){
38
- const field = {
39
- [label]: value
40
- };
41
- return <FieldValueList item={field}/>
38
+ if (displayMode === 'LABELS_LEFT') {
39
+ return <FieldValueList name={hideLabel ? '' : label} value={value} />;
40
+ }
41
+
42
+ if (displayMode === 'STACKED_LARGE_VAL') {
43
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
42
44
  }
43
45
 
44
46
  if (readOnly) {
@@ -63,7 +65,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
63
65
  required={required}
64
66
  disabled={disabled}
65
67
  onChange={onChange}
66
- onBlur={onBlur}
68
+ onBlur={!readOnly ? onBlur : undefined}
67
69
  error={status === 'error'}
68
70
  label={label}
69
71
  value={value}
@@ -26,7 +26,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
26
26
  testId,
27
27
  fieldMetadata,
28
28
  helperText,
29
- displayMode
29
+ displayMode,
30
+ hideLabel
30
31
  } = props;
31
32
  const helperTextToDisplay = validatemessage || helperText;
32
33
 
@@ -34,11 +35,12 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
34
35
 
35
36
  let readOnlyProp = {};
36
37
 
37
- if(displayMode === 'LABELS_LEFT'){
38
- const field = {
39
- [label]: value
40
- };
41
- return <FieldValueList item={field}/>
38
+ if (displayMode === 'LABELS_LEFT') {
39
+ return <FieldValueList name={hideLabel ? '' : label} value={value} />;
40
+ }
41
+
42
+ if (displayMode === 'STACKED_LARGE_VAL') {
43
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
42
44
  }
43
45
 
44
46
  if (readOnly) {
@@ -67,7 +69,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
67
69
  required={required}
68
70
  disabled={disabled}
69
71
  onChange={onChange}
70
- onBlur={onBlur}
72
+ onBlur={!readOnly ? onBlur : undefined}
71
73
  error={status === 'error'}
72
74
  label={label}
73
75
  value={value}
@@ -25,7 +25,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
25
25
  readOnly,
26
26
  testId,
27
27
  helperText,
28
- displayMode
28
+ displayMode,
29
+ hideLabel
29
30
  } = props;
30
31
  const helperTextToDisplay = validatemessage || helperText;
31
32
 
@@ -35,11 +36,12 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
35
36
  'data-test-id': testId
36
37
  };
37
38
 
38
- if(displayMode === 'LABELS_LEFT'){
39
- const field = {
40
- [label]: value
41
- };
42
- return <FieldValueList item={field}/>
39
+ if (displayMode === 'LABELS_LEFT') {
40
+ return <FieldValueList name={hideLabel ? '' : label} value={value} />;
41
+ }
42
+
43
+ if (displayMode === 'STACKED_LARGE_VAL') {
44
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
43
45
  }
44
46
 
45
47
  if (readOnly) {
@@ -71,7 +73,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
71
73
  );
72
74
  }
73
75
 
74
-
75
76
  const handleChange = inputVal => {
76
77
  let phoneValue = inputVal && inputVal.replace(/\D+/g, '');
77
78
  phoneValue = `+${phoneValue}`;
@@ -84,7 +85,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
84
85
  onBlur(event);
85
86
  };
86
87
 
87
-
88
88
  return (
89
89
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
90
90
  <MuiPhoneNumber
@@ -97,7 +97,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
97
97
  required={required}
98
98
  disabled={disabled}
99
99
  onChange={handleChange}
100
- onBlur={handleBlur}
100
+ onBlur={!readOnly ? handleBlur : undefined}
101
101
  error={status === 'error'}
102
102
  label={label}
103
103
  value={value}
@@ -25,15 +25,17 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
25
25
  onBlur,
26
26
  readOnly,
27
27
  helperText,
28
- displayMode
28
+ displayMode,
29
+ hideLabel
29
30
  } = props;
30
31
  const helperTextToDisplay = validatemessage || helperText;
31
32
 
32
- if(displayMode === 'LABELS_LEFT'){
33
- const field = {
34
- [label]: value
35
- };
36
- return <FieldValueList item={field}/>
33
+ if (displayMode === 'LABELS_LEFT') {
34
+ return <FieldValueList name={hideLabel ? '' : label} value={value} />;
35
+ }
36
+
37
+ if (displayMode === 'STACKED_LARGE_VAL') {
38
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
37
39
  }
38
40
 
39
41
  if (readOnly) {
@@ -52,7 +54,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
52
54
  required={required}
53
55
  disabled={disabled}
54
56
  onChange={onChange}
55
- onBlur={onBlur}
57
+ onBlur={!readOnly ? onBlur : undefined}
56
58
  error={status === 'error'}
57
59
  label={label}
58
60
  value={value}
@@ -25,15 +25,17 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
25
25
  onChange,
26
26
  readOnly,
27
27
  helperText,
28
- displayMode
28
+ displayMode,
29
+ hideLabel
29
30
  } = props;
30
31
  const helperTextToDisplay = validatemessage || helperText;
31
32
 
32
33
  if (displayMode === 'LABELS_LEFT') {
33
- const field = {
34
- [label]: value
35
- };
36
- return <FieldValueList item={field} />;
34
+ return <FieldValueList name={hideLabel ? '' : label} value={value} />;
35
+ }
36
+
37
+ if (displayMode === 'STACKED_LARGE_VAL') {
38
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
37
39
  }
38
40
 
39
41
  if (readOnly) {
@@ -154,7 +154,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
154
154
  return theDataRows;
155
155
  }
156
156
 
157
-
158
157
  return (
159
158
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
160
159
  <div id="CaseHistory">
@@ -171,13 +170,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
171
170
  </div>
172
171
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
173
172
  );
174
-
175
173
  }
176
174
 
177
- {{COMPONENT_CLASS_NAME}}.defaultProps = {
178
-
179
- };
180
-
181
175
  {{COMPONENT_CLASS_NAME}}.propTypes = {
182
176
  getPConnect: PropTypes.func.isRequired
183
177
  };
@@ -37,7 +37,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
37
37
  window.open(whatsnewlink);
38
38
  }
39
39
 
40
-
41
40
  return (
42
41
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
43
42
  <Card title="AppAnnouncement" className={classes.root}>
@@ -27,14 +27,7 @@ window.PCore.getUserApi = () => {
27
27
  export const Base{{COMPONENT_CLASS_NAME}} = () => {
28
28
 
29
29
  const props = {
30
- label: configProps.label,
31
- createLabel: configProps.createLabel,
32
- updateLabel: configProps.updateLabel,
33
- createOperator: configProps.createOperator,
34
- updateOperator: configProps.updateOperator,
35
- createDateTime: configProps.createDateTime,
36
- updateDateTime: configProps.updateDateTime,
37
- hideLabel: configProps.hideLabel,
30
+ caseOpConfig: configProps,
38
31
 
39
32
  getPConnect: () => {
40
33
  return {
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/no-unused-prop-types */
2
1
  import React, {useState} from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import TextField from '@material-ui/core/TextField';
@@ -11,7 +10,7 @@ import { makeStyles } from '@material-ui/core/styles';
11
10
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
12
11
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
13
12
 
14
- declare const PCore;
13
+ declare const PCore: any;
15
14
 
16
15
  const useStyles = makeStyles((theme) => ({
17
16
  root: {
@@ -32,36 +31,25 @@ const useStyles = makeStyles((theme) => ({
32
31
  // any default values in config.pros should be set in defaultProps at bottom of this file
33
32
  export default function {{COMPONENT_CLASS_NAME}}(props) {
34
33
  // const componentName = "Operator";
35
- const {
36
- label,
37
- createLabel,
38
- updateLabel,
39
- createOperator,
40
- updateOperator,
41
- createDateTime,
42
- updateDateTime
43
- } = props;
44
-
45
-
34
+ const { caseOpConfig } = props;
46
35
  const classes = useStyles();
47
36
 
48
-
49
- const fieldLabel = label.toLowerCase();
37
+ const fieldLabel = caseOpConfig.label.toLowerCase();
50
38
  let caseOpLabel = "---";
51
39
  let caseOpName = "---";
52
40
  let caseOpId = "";
53
41
  let caseTime = null;
54
42
 
55
43
  if (fieldLabel === "create operator") {
56
- caseOpLabel = createLabel;
57
- caseOpName = createOperator.userName;
58
- caseTime = createDateTime;
59
- caseOpId = createOperator.userId;
44
+ caseOpLabel = caseOpConfig.createLabel;
45
+ caseOpName = caseOpConfig.createOperator.userName;
46
+ caseTime = caseOpConfig.createDateTime;
47
+ caseOpId = caseOpConfig.createOperator.userId;
60
48
  } else if (fieldLabel === "update operator") {
61
- caseOpLabel = updateLabel;
62
- caseOpName = updateOperator.userName;
63
- caseTime = updateDateTime;
64
- caseOpId = updateOperator.userId;
49
+ caseOpLabel = caseOpConfig.updateLabel;
50
+ caseOpName = caseOpConfig.updateOperator.userName;
51
+ caseTime = caseOpConfig.updateDateTime;
52
+ caseOpId = caseOpConfig.updateOperator.userId;
65
53
  }
66
54
 
67
55
  // Popover-related
@@ -188,6 +176,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
188
176
  {{=<% %>=}}
189
177
  InputProps={{
190
178
  readOnly: true,
179
+ disableUnderline: true,
191
180
  inputProps: {style: {cursor: 'pointer'}}
192
181
  }}
193
182
  <%={{ }}=%> {{! revert delimiteres for mustache }}
@@ -210,30 +199,13 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
210
199
  {getPopoverGrid()}
211
200
  </Popover>
212
201
  </React.Fragment>
213
- </Styled{{COMPONENT_CLASS_NAME}}Wrapper>;
202
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>;
214
203
 
215
204
  }
216
205
 
217
206
  {{COMPONENT_CLASS_NAME}}.defaultProps = {
218
- createLabel: null,
219
- updateLabel: null,
220
- createOperator: null,
221
- updateOperator: null,
222
- createDateTime: null,
223
- updateDateTime: null
224
207
  };
225
208
 
226
209
  {{COMPONENT_CLASS_NAME}}.propTypes = {
227
- getPConnect: PropTypes.func.isRequired,
228
- label: PropTypes.string,
229
- createLabel: PropTypes.string,
230
- updateLabel: PropTypes.string,
231
- resolveLabel: PropTypes.string,
232
- createOperator: PropTypes.objectOf(PropTypes.any),
233
- updateOperator: PropTypes.objectOf(PropTypes.any),
234
- resolveOperator: PropTypes.objectOf(PropTypes.any),
235
- createDateTime: PropTypes.string,
236
- updateDateTime: PropTypes.string,
237
- resolveDateTime: PropTypes.string,
238
- hideLabel: PropTypes.bool
210
+ caseOpConfig: PropTypes.object.isRequired,
239
211
  };