@pega/custom-dx-components 2.0.14 → 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 (118) hide show
  1. package/README.md +3 -3
  2. package/package.json +2 -2
  3. package/src/cli.js +0 -18
  4. package/src/tasks/authenticate/index.js +1 -3
  5. package/src/tasks/create/index.js +3 -6
  6. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
  7. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +18 -29
  8. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +2 -1
  9. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +67 -179
  10. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +16 -39
  11. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +1 -3
  12. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +1 -0
  13. package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js.mustache → date-utils.js} +0 -1
  14. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -1
  15. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +15 -39
  16. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +0 -2
  17. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +17 -22
  18. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +1 -2
  19. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +17 -25
  20. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +4 -3
  21. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -22
  22. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +2 -8
  23. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +17 -22
  24. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +1 -2
  25. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +14 -42
  26. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +1 -44
  27. package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
  28. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +16 -21
  29. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +16 -20
  30. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +2 -44
  31. package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
  32. package/src/tasks/create/templates/Constellation/{Template/DETAILS/StatusWork.jsx.mustache → Field/Text-Input/StatusWork.js} +1 -0
  33. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +17 -21
  34. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +3 -46
  35. package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
  36. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +17 -21
  37. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +2 -44
  38. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
  39. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +17 -19
  40. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +2 -46
  41. package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
  42. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +17 -19
  43. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +3 -174
  44. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
  45. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +16 -24
  46. package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +0 -1
  47. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +29 -14
  48. package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +77 -3
  49. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +29 -14
  50. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +74 -3
  51. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +10 -6
  52. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +8 -10
  53. package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.jsx.mustache → GetNextWork.js.mustache} +0 -6
  54. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +7 -9
  55. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +1 -4
  56. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +0 -1
  57. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
  58. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.jsx.mustache → Avatar.js.mustache} +0 -2
  59. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.jsx.mustache → Operator.js.mustache} +1 -2
  60. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
  61. package/src/tasks/delete/helper.js +0 -4
  62. package/src/tasks/delete/index.js +0 -4
  63. package/src/tasks/index.js +0 -3
  64. package/src/tasks/init/index.js +1 -1
  65. package/src/tasks/init/template/.eslintrc.json +5 -186
  66. package/src/tasks/init/template/package.json.mustache +4 -19
  67. package/src/tasks/init/template/tasks.config.json +0 -1
  68. package/src/tasks/list/index.js +0 -4
  69. package/src/tasks/{bundle → publish/bundle}/builder/index.js +0 -0
  70. package/src/tasks/{bundle → publish/bundle}/builder/modules.js +0 -0
  71. package/src/tasks/{bundle → publish/bundle}/builder/paths.js +0 -0
  72. package/src/tasks/{bundle → publish/bundle}/builder/webpack.config.js +2 -0
  73. package/src/tasks/{bundle → publish/bundle}/index.js +2 -2
  74. package/src/tasks/publish/index.js +1 -14
  75. package/src/util.js +0 -10
  76. package/src/tasks/build/helper.js +0 -123
  77. package/src/tasks/build/index.js +0 -54
  78. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +0 -21
  79. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -61
  80. package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -41
  81. package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +0 -23
  82. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +0 -23
  83. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +0 -21
  84. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +0 -23
  85. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +0 -21
  86. package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +0 -21
  87. package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +0 -67
  88. package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +0 -13
  89. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +0 -22
  90. package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.jsx +0 -26
  91. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +0 -21
  92. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +0 -20
  93. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +0 -37
  94. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +0 -22
  95. package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +0 -20
  96. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +0 -110
  97. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +0 -179
  98. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +0 -26
  99. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +0 -118
  100. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +0 -215
  101. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +0 -89
  102. package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +0 -125
  103. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +0 -92
  104. package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +0 -125
  105. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +0 -102
  106. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +0 -94
  107. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +0 -78
  108. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +0 -389
  109. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +0 -30
  110. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +0 -22
  111. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +0 -68
  112. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +0 -51
  113. package/src/tasks/delete-all/helper.js +0 -175
  114. package/src/tasks/delete-all/index.js +0 -49
  115. package/src/tasks/init/template/.eslintignore +0 -8
  116. package/src/tasks/linter/index.js +0 -46
  117. package/src/tasks/publish-all/helper.js +0 -139
  118. package/src/tasks/publish-all/index.js +0 -84
@@ -1,4 +1,8 @@
1
- /* eslint-disable no-undef */
1
+ import { createUID } from '@pega/cosmos-react-core';
2
+
3
+ //import { LazyMap as LazyComponentMap } from '../../components_map';
4
+
5
+ const LazyComponentMap = {};
2
6
 
3
7
  /**
4
8
  * Given the PConnect object of a Template component, retrieve the children
@@ -39,7 +43,78 @@ export function getAllFields(pConnect) {
39
43
  return allFields;
40
44
  }
41
45
 
46
+ /**
47
+ * A helper function to create an object consisting react component as per the type.
48
+ * This is used by CaseSummary template.
49
+ * @param {object} configObject Object containing meta information for the particular field authored
50
+ * @param {Function} getPConnect PConnect function passed along to other components.
51
+ * @param {string} displayMode displayMode string contains information about the layout of component in review mode.
52
+ */
53
+ export function prepareComponentInCaseSummary(configObject, getPConnect, displayMode) {
54
+ const { config, children } = configObject;
55
+ let { type } = configObject;
56
+ const caseSummaryComponentObject = {};
57
+ let showAddressLabel = true;
58
+ if (config && config.value === '@P .pyStatusWork') {
59
+ config.displayAsStatus = true;
60
+ type = 'TextInput'; // force the type to be TextInput for status field.
61
+ // As TextInput is loaded forcefully sometimes, TextInput component might not be available in lazy map.
62
+ // Load TextInput if it is not available.
63
+ if (!LazyComponentMap[type]) {
64
+ PCore.getAssetLoader().getLoader('component-loader')([type]);
65
+ }
66
+ }
67
+
68
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
69
+ label: config.label
70
+ }).label;
71
+ if (type === 'CaseOperator') {
72
+ switch (caseSummaryComponentObject.name) {
73
+ case 'Create operator':
74
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
75
+ createLabel: config.createLabel
76
+ }).createLabel;
77
+ break;
78
+ case 'Update operator':
79
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
80
+ updateLabel: config.updateLabel
81
+ }).updateLabel;
82
+ break;
83
+ default:
84
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
85
+ resolveLabel: config.resolveLabel
86
+ }).resolveLabel;
87
+ break;
88
+ }
89
+ } else if (type === 'Checkbox') {
90
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
91
+ label: config.caption
92
+ }).label;
93
+ } else if (type === 'Address') {
94
+ showAddressLabel = false;
95
+ }
96
+ const createdComponent = getPConnect().createComponent({
97
+ type,
98
+ children: children ? [...children] : [],
99
+ showAddressLabel,
100
+ config: {
101
+ ...config,
102
+ hideLabel: true,
103
+ key: createUID() // Need a unique key on render of the summary so that the component is recreated each time
104
+ }
105
+ });
106
+ createdComponent.props.getPConnect().setInheritedProp('displayMode', displayMode);
107
+ if (type === 'Address') {
108
+ createdComponent.props.getPConnect().setInheritedProp('showAddressLabel', showAddressLabel);
109
+ }
110
+ // createdComponent.props.getPConnect().setInheritedProp("hideLabel", true);
111
+ caseSummaryComponentObject.value = createdComponent;
112
+ if (type === 'reference') {
113
+ caseSummaryComponentObject.name = createdComponent.props.getPConnect().getInheritedProps().label;
114
+ }
42
115
 
116
+ return caseSummaryComponentObject;
117
+ }
43
118
 
44
119
  export function getFilteredFields(getPConnect) {
45
120
  let primaryFieldsRaw;
@@ -137,9 +212,8 @@ export function getInstructions(pConnect, instructions = 'casestep') {
137
212
 
138
213
  // If the annotation wasn't processed correctly, don't return any instruction text
139
214
  if (instructions?.startsWith('@PARAGRAPH')) {
140
- /* eslint-disable no-console */
141
215
  console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.');
142
- /* eslint-enable no-console */ return undefined;
216
+ return undefined;
143
217
  }
144
218
 
145
219
  // Custom instructions from the view
@@ -1,5 +1,5 @@
1
- import { Fragment } from 'react';
2
- import { Grid, Flex, FieldGroup } from '@pega/cosmos-react-core';
1
+ import { useContext, Fragment } from 'react';
2
+ import { Grid , Flex, FieldGroup } from '@pega/cosmos-react-core';
3
3
  import PropTypes from 'prop-types';
4
4
 
5
5
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
@@ -13,19 +13,13 @@ import { getAllFields } from './utils';
13
13
  // any default values in config.pros should be set in defaultProps at bottom of this file
14
14
  export default function {{COMPONENT_CLASS_NAME}}(props) {
15
15
 
16
- const { getPConnect, children, label, showLabel, showHighlightedData } = props;
16
+
17
+ const { getPConnect, children, template, regionsMetadata = [], label, showLabel, showHighlightedData } = props;
18
+
17
19
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
18
20
 
19
- const numRegions = getAllFields(getPConnect)?.length;
20
- const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
21
- const gridContainer = { "colGap": 1};
22
- gridContainer.cols = gridRepeat;
23
- gridContainer.alignItems = 'start';
24
21
 
25
- const gridHighlightContainer = { "gap": 2};
26
- gridHighlightContainer.cols = gridRepeat;
27
- gridHighlightContainer.alignItems = 'start';
28
- gridHighlightContainer.pad = [0, 0, 2, 0];
22
+ const numRegions = regionsMetadata.length;
29
23
 
30
24
  // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
31
25
  let highlightedDataArr = [];
@@ -50,14 +44,14 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
50
44
  {{=<% %>=}}
51
45
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
52
46
  {showHighlightedData && highlightedDataArr.length > 0 && (
53
- <Grid container={gridHighlightContainer}
47
+ <Grid container={{ cols:'repeat(${numRegions}, 1fr)', gap: 2, alignItems: 'start', pad: [0, 0, 2, 0] }}
54
48
  data-testid={`highlighted-column-count-${numRegions}`}>
55
49
  {highlightedDataArr.map((child, i) => (
56
50
  <Fragment key={`hf-${i + 1}`}>{child}</Fragment>
57
51
  ))}
58
52
  </Grid>
59
53
  )}
60
- <Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
54
+ <Grid container={{ cols:'repeat(${numRegions}, 1fr)', alignItems: 'start', colGap: 1 }} data-testid={`column-count-${numRegions}`} >
61
55
  {children.map((child, i) => (
62
56
  <Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
63
57
  {child}
@@ -77,10 +71,31 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
77
71
  showHighlightedData: false
78
72
  };
79
73
 
74
+ // Since the fields are not part of the 'config' in Details template metadata, they need to be subscribed with additionalprops
75
+ const mapStateToProps = (_, ownProps) => {
76
+ const { getPConnect, showLabel, label } = ownProps;
77
+ const Allfields = getAllFields(getPConnect);
78
+
79
+ return {
80
+ regionsMetadata: Allfields,
81
+ label,
82
+ showLabel,
83
+ getPConnect
84
+ };
85
+ };
80
86
 
81
87
  {{COMPONENT_CLASS_NAME}}.propTypes = {
88
+ regionsMetadata: PropTypes.arrayOf(
89
+ PropTypes.arrayOf(
90
+ PropTypes.shape({
91
+ value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.number]),
92
+ label: PropTypes.string
93
+ })
94
+ )
95
+ ).isRequired,
82
96
  showLabel: PropTypes.bool,
83
97
  label: PropTypes.string,
84
98
  getPConnect: PropTypes.func.isRequired,
99
+ template: PropTypes.string.isRequired,
85
100
  showHighlightedData: PropTypes.bool
86
101
  };
@@ -1,6 +1,8 @@
1
- /* eslint-disable no-undef */
1
+ import { createUID } from '@pega/cosmos-react-core';
2
2
 
3
+ //import { LazyMap as LazyComponentMap } from '../../components_map';
3
4
 
5
+ const LazyComponentMap = {};
4
6
 
5
7
  /**
6
8
  * Given the PConnect object of a Template component, retrieve the children
@@ -41,7 +43,78 @@ export function getAllFields(pConnect) {
41
43
  return allFields;
42
44
  }
43
45
 
46
+ /**
47
+ * A helper function to create an object consisting react component as per the type.
48
+ * This is used by CaseSummary template.
49
+ * @param {object} configObject Object containing meta information for the particular field authored
50
+ * @param {Function} getPConnect PConnect function passed along to other components.
51
+ * @param {string} displayMode displayMode string contains information about the layout of component in review mode.
52
+ */
53
+ export function prepareComponentInCaseSummary(configObject, getPConnect, displayMode) {
54
+ const { config, children } = configObject;
55
+ let { type } = configObject;
56
+ const caseSummaryComponentObject = {};
57
+ let showAddressLabel = true;
58
+ if (config && config.value === '@P .pyStatusWork') {
59
+ config.displayAsStatus = true;
60
+ type = 'TextInput'; // force the type to be TextInput for status field.
61
+ // As TextInput is loaded forcefully sometimes, TextInput component might not be available in lazy map.
62
+ // Load TextInput if it is not available.
63
+ if (!LazyComponentMap[type]) {
64
+ PCore.getAssetLoader().getLoader('component-loader')([type]);
65
+ }
66
+ }
44
67
 
68
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
69
+ label: config.label
70
+ }).label;
71
+ if (type === 'CaseOperator') {
72
+ switch (caseSummaryComponentObject.name) {
73
+ case 'Create operator':
74
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
75
+ createLabel: config.createLabel
76
+ }).createLabel;
77
+ break;
78
+ case 'Update operator':
79
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
80
+ updateLabel: config.updateLabel
81
+ }).updateLabel;
82
+ break;
83
+ default:
84
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
85
+ resolveLabel: config.resolveLabel
86
+ }).resolveLabel;
87
+ break;
88
+ }
89
+ } else if (type === 'Checkbox') {
90
+ caseSummaryComponentObject.name = getPConnect().resolveConfigProps({
91
+ label: config.caption
92
+ }).label;
93
+ } else if (type === 'Address') {
94
+ showAddressLabel = false;
95
+ }
96
+ const createdComponent = getPConnect().createComponent({
97
+ type,
98
+ children: children ? [...children] : [],
99
+ showAddressLabel,
100
+ config: {
101
+ ...config,
102
+ hideLabel: true,
103
+ key: createUID() // Need a unique key on render of the summary so that the component is recreated each time
104
+ }
105
+ });
106
+ createdComponent.props.getPConnect().setInheritedProp('displayMode', displayMode);
107
+ if (type === 'Address') {
108
+ createdComponent.props.getPConnect().setInheritedProp('showAddressLabel', showAddressLabel);
109
+ }
110
+ // createdComponent.props.getPConnect().setInheritedProp("hideLabel", true);
111
+ caseSummaryComponentObject.value = createdComponent;
112
+ if (type === 'reference') {
113
+ caseSummaryComponentObject.name = createdComponent.props.getPConnect().getInheritedProps().label;
114
+ }
115
+
116
+ return caseSummaryComponentObject;
117
+ }
45
118
 
46
119
  export function getFilteredFields(getPConnect) {
47
120
  let primaryFieldsRaw;
@@ -139,9 +212,7 @@ export function getInstructions(pConnect, instructions = 'casestep') {
139
212
 
140
213
  // If the annotation wasn't processed correctly, don't return any instruction text
141
214
  if (instructions?.startsWith('@PARAGRAPH')) {
142
- /* eslint-disable no-console */
143
215
  console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.');
144
- /* eslint-enable no-console */
145
216
  return undefined;
146
217
  }
147
218
 
@@ -1,4 +1,5 @@
1
- import { Grid } from '@pega/cosmos-react-core';
1
+ import { useContext } from 'react';
2
+ import { Grid , Flex } from '@pega/cosmos-react-core';
2
3
  import PropTypes from 'prop-types';
3
4
 
4
5
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
@@ -11,11 +12,11 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
11
12
  export default function {{COMPONENT_CLASS_NAME}}(props) {
12
13
 
13
14
 
14
- const { children, NumCols } = props;
15
+ const { getPConnect, children, template, label, NumCols } = props;
15
16
 
16
- const nCols = parseInt(NumCols, 10);
17
+ let nCols = parseInt(NumCols);
17
18
 
18
- // console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
19
+ //console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
19
20
 
20
21
  return (
21
22
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
@@ -36,10 +37,13 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
36
37
 
37
38
  {{COMPONENT_CLASS_NAME}}.defaultProps = {
38
39
  NumCols: 1,
40
+ templateOverrideMode: 'USE_TEMPLATE',
39
41
  children: []
40
42
  };
41
43
 
42
44
  {{COMPONENT_CLASS_NAME}}.propTypes = {
43
- NumCols: PropTypes.number,
44
- children: PropTypes.arrayOf(PropTypes.node),
45
+ label: PropTypes.string,
46
+ getPConnect: PropTypes.func.isRequired,
47
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
48
+ template: PropTypes.string.isRequired
45
49
  };
@@ -1,4 +1,5 @@
1
- import { Grid, Flex } from '@pega/cosmos-react-core';
1
+ import { useContext } from 'react';
2
+ import { Grid , Flex } from '@pega/cosmos-react-core';
2
3
  import PropTypes from 'prop-types';
3
4
 
4
5
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
@@ -11,19 +12,13 @@ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
11
12
  export default function {{COMPONENT_CLASS_NAME}}(props) {
12
13
 
13
14
 
14
- const { children } = props;
15
-
16
- const numRegions = children?.length;
17
- const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
18
- const gridContainer = {"colGap" : 1};
19
- gridContainer.cols = gridRepeat;
20
- gridContainer.alignItems = 'start';
15
+ const { getPConnect, children, template, label } = props;
21
16
 
22
17
  return (
23
18
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
24
19
  {{! pick new delimiteres for mustache }}
25
20
  {{=<% %>=}}
26
- <Grid container={gridContainer}>
21
+ <Grid container={{ cols:'repeat(2, 1fr)', alignItems: 'start', colGap: 1 }}>
27
22
  {children.map((child, i) => (
28
23
  <Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
29
24
  {child}
@@ -41,5 +36,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
41
36
  };
42
37
 
43
38
  {{COMPONENT_CLASS_NAME}}.propTypes = {
44
- children: PropTypes.arrayOf(PropTypes.node),
39
+ label: PropTypes.string,
40
+ getPConnect: PropTypes.func.isRequired,
41
+ children: PropTypes.arrayOf(PropTypes.node).isRequired,
42
+ template: PropTypes.string.isRequired
45
43
  };
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  import { Button, useToaster } from '@pega/cosmos-react-core';
3
2
 
4
3
  export default function GetNextWork(props) {
@@ -9,16 +8,11 @@ export default function GetNextWork(props) {
9
8
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
10
9
 
11
10
  const getNextWork = () => {
12
-
13
- // alert('Get next work clicked');
14
-
15
11
  getPConnect()
16
12
  .getActionsApi()
17
13
  .getNextWork()
18
14
  .catch((err) => {
19
- /* eslint-disable no-console */
20
15
  console.log(err);
21
- /* eslint-enable no-console */
22
16
  if (err[0].status === 404) {
23
17
  toasterCtx.push({
24
18
  content: localizedVal('No task currently available')
@@ -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';
4
5
  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.jsx';
12
+ import GetNextWork from './GetNextWork';
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,9 +27,7 @@ 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
- // add back in icon when working
31
- // const { children, title, icon, useConfigurableLayout, getPConnect, enableGetNextWork } = props;
32
- const { children, title, useConfigurableLayout, getPConnect, enableGetNextWork } = props;
30
+ const { children, title, icon, useConfigurableLayout, getPConnect, enableGetNextWork } = props;
33
31
  const childArray = useMemo(() => {
34
32
  return Children.toArray(children);
35
33
  }, [children]);
@@ -58,13 +56,13 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
58
56
  }
59
57
 
60
58
  {{COMPONENT_CLASS_NAME}}.defaultProps = {
61
- /* icon: '', */
59
+ icon: '',
62
60
  useConfigurableLayout: false
63
61
  };
64
62
 
65
63
  {{COMPONENT_CLASS_NAME}}.propTypes = {
66
64
  children: PropTypes.arrayOf(PropTypes.node).isRequired,
67
65
  title: PropTypes.string.isRequired,
68
- /* icon: PropTypes.string, */
66
+ icon: PropTypes.string,
69
67
  useConfigurableLayout: PropTypes.bool
70
68
  };
@@ -1,7 +1,6 @@
1
- /* eslint-disable no-undef */
2
1
  import { createUID } from '@pega/cosmos-react-core';
3
2
 
4
- // import { LazyMap as LazyComponentMap } from '../../components_map';
3
+ //import { LazyMap as LazyComponentMap } from '../../components_map';
5
4
 
6
5
  const LazyComponentMap = {};
7
6
 
@@ -213,9 +212,7 @@ export function getInstructions(pConnect, instructions = 'casestep') {
213
212
 
214
213
  // If the annotation wasn't processed correctly, don't return any instruction text
215
214
  if (instructions?.startsWith('@PARAGRAPH')) {
216
- /* eslint-disable no-console */
217
215
  console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.');
218
- /* eslint-enable no-console */
219
216
  return undefined;
220
217
  }
221
218
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  import { useState, useEffect } from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import { Table, Text } from '@pega/cosmos-react-core';
@@ -32,17 +32,17 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
32
32
  }
33
33
 
34
34
  {{COMPONENT_CLASS_NAME}}.defaultProps = {
35
- header: '',
36
- description: '',
37
- image: '',
38
- datasource: [],
39
- whatsnewlink: ''
40
- };
41
-
42
- {{COMPONENT_CLASS_NAME}}.propTypes = {
43
35
  header: PropTypes.string,
44
36
  description: PropTypes.string,
45
37
  datasource: PropTypes.instanceOf(Object),
46
38
  whatsnewlink: PropTypes.string,
47
39
  image: PropTypes.string
48
40
  };
41
+
42
+ {{COMPONENT_CLASS_NAME}}.propTypes = {
43
+ header: '',
44
+ description: '',
45
+ image: '',
46
+ datasource: [],
47
+ whatsnewlink: ''
48
+ };
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-undef */
2
- /* eslint-disable react-hooks/rules-of-hooks */
3
1
  import { useEffect, useState } from 'react';
4
2
  import PropTypes from 'prop-types';
5
3
  import { Avatar as CosmosAvatar } from '@pega/cosmos-react-core';
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-undef */
2
1
  import { useState, useEffect, Fragment } from 'react';
3
2
  import {
4
3
  Link,
@@ -14,7 +13,7 @@ import {
14
13
  import { Glimpse } from '@pega/cosmos-react-work';
15
14
  import PropTypes from 'prop-types';
16
15
 
17
- import Avatar from './Avatar.jsx';
16
+ import Avatar from './Avatar';
18
17
 
19
18
  const Operator = (props) => {
20
19
  const { id, name, label, testId, helperText, externalUser, metaObj } = props;
@@ -1,10 +1,9 @@
1
- /* eslint-disable no-nested-ternary */
2
- import { Fragment } from 'react';
1
+ import { Fragment, memo } from 'react';
3
2
  import { DateTimeDisplay, Card, CardHeader, CardContent, Flex } from '@pega/cosmos-react-core';
4
3
  import PropTypes from 'prop-types';
5
4
 
6
5
  // includes in bundle
7
- import Operator from './Operator.jsx';
6
+ import Operator from './Operator';
8
7
 
9
8
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
10
9
 
@@ -28,7 +27,8 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
28
27
  resolveLabel,
29
28
  resolveOperator,
30
29
  resolveDateTime,
31
- hideLabel
30
+ hideLabel,
31
+ defVal
32
32
  } = props;
33
33
 
34
34
 
@@ -84,13 +84,13 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
84
84
  resolveLabel: null,
85
85
  resolveOperator: null,
86
86
  resolveDateTime: null,
87
- hideLabel: false
87
+ hideLabel: false,
88
+ defVal: '––'
88
89
  };
89
90
 
90
91
  {{COMPONENT_CLASS_NAME}}.propTypes = {
91
92
  getPConnect: PropTypes.func.isRequired,
92
93
  label: PropTypes.string,
93
- title: PropTypes.string,
94
94
  createLabel: PropTypes.string,
95
95
  updateLabel: PropTypes.string,
96
96
  resolveLabel: PropTypes.string,
@@ -105,6 +105,6 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
105
105
 
106
106
  // as objects are there in props, shallow comparision fails & re-rendering of comp happens even with
107
107
  // same key value pairs in obj. hence using custom comparison function on when to re-render
108
- // const comparisonFn = (prevProps, nextProps) => {
109
- // return prevProps.updateDateTime === nextProps.updateDateTime;
110
- // };
108
+ //const comparisonFn = (prevProps, nextProps) => {
109
+ // return prevProps.updateDateTime === nextProps.updateDateTime;
110
+ //};
@@ -13,8 +13,6 @@ import {
13
13
  } from '../../util.js';
14
14
  import { getComponentsFromServer } from '../list/helper.js';
15
15
 
16
-
17
-
18
16
  export const SOURCE_OF_COMPONENT_TYPES = {
19
17
  SERVER: 'Server',
20
18
  LOCAL: 'Local'
@@ -94,8 +92,6 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
94
92
  choices: choicesArr
95
93
  });
96
94
  await deleteServerComponent(answers.componentToDelete);
97
-
98
-
99
95
  } else {
100
96
  console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
101
97
  }
@@ -9,8 +9,6 @@ import {
9
9
  getDeleteComponentsQuestions
10
10
  } from './helper.js';
11
11
 
12
- import { showVersion } from '../../util.js';
13
-
14
12
  const deleteComponentsFn = async (sourceOfComponents, answers) => {
15
13
  switch (sourceOfComponents) {
16
14
  case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
@@ -29,8 +27,6 @@ const deleteComponentsFn = async (sourceOfComponents, answers) => {
29
27
  };
30
28
 
31
29
  export default async options => {
32
- showVersion();
33
-
34
30
  let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
35
31
  if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
36
32
  sourceOfComponentsOption = options.params[3];
@@ -1,12 +1,9 @@
1
1
  export { default as createComponent } from './create/index.js';
2
2
  export { default as deleteComponent } from './delete/index.js';
3
- export { default as deleteAllComponents } from './delete-all/index.js';
4
3
  export { default as initProject } from './init/index.js';
5
4
  export { default as publishComponent } from './publish/index.js';
6
- export { default as publishAllComponents } from './publish-all/index.js';
7
5
  export { default as listComponents } from './list/index.js';
8
6
  export { default as updateComponent } from './update/index.js';
9
7
  export { default as validate } from './validator/index.js';
10
8
  export { default as authenticate } from './authenticate/index.js';
11
9
  export { default as upgrade } from './upgrade/index.js';
12
- export { default as buildComponent } from './build/index.js';
@@ -123,7 +123,7 @@ export default async options => {
123
123
  },
124
124
  {
125
125
  title: installDependenciesText,
126
- task: () => execPromise('npm i --force --production=false', { cwd: options.targetDirectory })
126
+ task: () => execPromise('npm i --production=false', { cwd: options.targetDirectory })
127
127
  }
128
128
  ],
129
129
  {