@pega/react-sdk-overrides 0.23.17 → 0.23.18
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.
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +37 -3
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -2
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +38 -56
- package/lib/field/AutoComplete/AutoComplete.tsx +6 -4
- package/lib/field/Checkbox/Checkbox.tsx +7 -5
- package/lib/field/Currency/Currency.tsx +31 -6
- package/lib/field/Currency/currency-utils.ts +76 -0
- package/lib/field/Date/Date.tsx +25 -9
- package/lib/field/DateTime/DateTime.tsx +24 -10
- package/lib/field/Decimal/Decimal.tsx +8 -6
- package/lib/field/Dropdown/Dropdown.tsx +6 -4
- package/lib/field/Email/Email.tsx +8 -8
- package/lib/field/Integer/Integer.tsx +8 -6
- package/lib/field/Percentage/Percentage.tsx +8 -6
- package/lib/field/Phone/Phone.tsx +8 -7
- package/lib/field/RadioButtons/RadioButtons.tsx +7 -5
- package/lib/field/SemanticLink/SemanticLink.tsx +6 -0
- package/lib/field/TextArea/TextArea.tsx +8 -6
- package/lib/field/TextInput/TextInput.tsx +8 -6
- package/lib/field/Time/Time.tsx +7 -5
- package/lib/field/URL/URL.tsx +8 -6
- package/lib/helpers/date-format-utils.ts +66 -0
- package/lib/helpers/formatters/Currency.js +13 -5
- package/lib/helpers/formatters/common.js +5 -1
- package/lib/helpers/formatters/index.js +5 -0
- package/lib/helpers/template-utils.ts +80 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +66 -70
- package/lib/infra/MultiStep/MultiStep.css +4 -18
- package/lib/infra/NavBar/NavBar.tsx +129 -219
- package/lib/infra/View/View.tsx +27 -20
- package/lib/template/CaseView/CaseView.tsx +2 -5
- package/lib/template/DefaultForm/DefaultForm.tsx +4 -0
- package/lib/template/Details/Details/Details.tsx +52 -21
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +63 -31
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +64 -30
- package/lib/template/ListView/DefaultViewMeta.js +222 -0
- package/lib/template/ListView/ListView.tsx +152 -48
- package/lib/template/ListView/hooks.js +97 -0
- package/lib/template/ListView/utils.js +636 -0
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +69 -42
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +69 -43
- package/lib/widget/Attachment/Attachment.css +7 -0
- package/lib/widget/Attachment/Attachment.tsx +37 -3
- package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
- package/package.json +1 -1
- package/lib/.DS_Store +0 -0
- package/lib/field/AutoComplete/.DS_Store +0 -0
- package/lib/field/Checkbox/.DS_Store +0 -0
- package/lib/field/Currency/.DS_Store +0 -0
- package/lib/field/Date/.DS_Store +0 -0
- package/lib/field/TextContent/.DS_Store +0 -0
- package/lib/infra/.DS_Store +0 -0
- package/lib/template/.DS_Store +0 -0
- package/lib/template/CaseView/.DS_Store +0 -0
- package/lib/template/SimpleTable/.DS_Store +0 -0
- package/lib/template/SimpleTable/SimpleTable/.DS_Store +0 -0
- package/lib/template/utils.ts +0 -23
|
@@ -1,53 +1,80 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
1
|
+
import React, { createElement } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Grid from '@material-ui/core/Grid';
|
|
4
|
+
import { GridSize } from '@material-ui/core/Grid';
|
|
5
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
6
|
+
import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
|
|
7
|
+
|
|
8
|
+
const COLUMN_WIDTHS = [4, 8];
|
|
5
9
|
|
|
6
10
|
export default function NarrowWideDetails(props) {
|
|
7
|
-
const {
|
|
8
|
-
const arFields: Array<any> = [];
|
|
11
|
+
const { label, showLabel, getPConnect, showHighlightedData } = props;
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const theChildrenOfChild = theChildPConn.getChildren();
|
|
13
|
-
arFields.push(theChildrenOfChild);
|
|
14
|
-
}
|
|
13
|
+
// Get the inherited props from the parent to determine label settings
|
|
14
|
+
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
// Set display mode prop and re-create the children so this part of the dom tree renders
|
|
17
|
+
// in a readonly (display) mode instead of a editable
|
|
18
|
+
getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
|
|
19
|
+
getPConnect().setInheritedProp('readOnly', true);
|
|
20
|
+
const children = getPConnect()
|
|
21
|
+
.getChildren()
|
|
22
|
+
.map((configObject, index) =>
|
|
23
|
+
createElement(createPConnectComponent(), {
|
|
24
|
+
...configObject,
|
|
25
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
26
|
+
key: index.toString()
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
31
|
+
let highlightedDataArr = [];
|
|
32
|
+
if (showHighlightedData) {
|
|
33
|
+
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
34
|
+
highlightedDataArr = highlightedData.map(field => {
|
|
35
|
+
field.config.displayMode = 'STACKED_LARGE_VAL';
|
|
20
36
|
|
|
37
|
+
// Mark as status display when using pyStatusWork
|
|
38
|
+
if (field.config.value === '@P .pyStatusWork') {
|
|
39
|
+
field.type = 'TextInput';
|
|
40
|
+
field.config.displayAsStatus = true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return getPConnect().createComponent(field);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
21
46
|
|
|
22
47
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</div>
|
|
43
|
-
}
|
|
44
|
-
</React.Fragment>
|
|
45
|
-
)
|
|
48
|
+
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
49
|
+
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
50
|
+
<Grid container spacing={1} style={{ padding: '0 0 1em' }}>
|
|
51
|
+
{highlightedDataArr.map((child, i) => (
|
|
52
|
+
<Grid item xs={COLUMN_WIDTHS[i] as GridSize} key={`hf-${i + 1}`}>
|
|
53
|
+
{child}
|
|
54
|
+
</Grid>
|
|
55
|
+
))}
|
|
56
|
+
</Grid>
|
|
57
|
+
)}
|
|
58
|
+
<Grid container spacing={1}>
|
|
59
|
+
{children.map((child, i) => (
|
|
60
|
+
<Grid item xs={COLUMN_WIDTHS[i] as GridSize} key={`r-${i + 1}`}>
|
|
61
|
+
{child}
|
|
62
|
+
</Grid>
|
|
63
|
+
))}
|
|
64
|
+
</Grid>
|
|
65
|
+
</FieldGroup>
|
|
66
|
+
);
|
|
46
67
|
}
|
|
47
68
|
|
|
69
|
+
NarrowWideDetails.defaultProps = {
|
|
70
|
+
label: undefined,
|
|
71
|
+
showLabel: true,
|
|
72
|
+
showHighlightedData: false
|
|
73
|
+
};
|
|
74
|
+
|
|
48
75
|
NarrowWideDetails.propTypes = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
76
|
+
showLabel: PropTypes.bool,
|
|
77
|
+
label: PropTypes.string,
|
|
78
|
+
getPConnect: PropTypes.func.isRequired,
|
|
79
|
+
showHighlightedData: PropTypes.bool
|
|
53
80
|
};
|
|
@@ -1,54 +1,80 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
1
|
+
import React, { createElement } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Grid from '@material-ui/core/Grid';
|
|
4
|
+
import { GridSize } from '@material-ui/core/Grid';
|
|
5
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
6
|
+
import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
|
|
7
|
+
|
|
8
|
+
const COLUMN_WIDTHS = [8, 4];
|
|
5
9
|
|
|
6
10
|
export default function WideNarrowDetails(props) {
|
|
7
|
-
const {
|
|
8
|
-
const arFields: Array<any> = [];
|
|
11
|
+
const { label, showLabel, getPConnect, showHighlightedData } = props;
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const theChildrenOfChild = theChildPConn.getChildren();
|
|
13
|
-
arFields.push(theChildrenOfChild);
|
|
14
|
-
}
|
|
13
|
+
// Get the inherited props from the parent to determine label settings
|
|
14
|
+
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
// Set display mode prop and re-create the children so this part of the dom tree renders
|
|
17
|
+
// in a readonly (display) mode instead of a editable
|
|
18
|
+
getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
|
|
19
|
+
getPConnect().setInheritedProp('readOnly', true);
|
|
20
|
+
const children = getPConnect()
|
|
21
|
+
.getChildren()
|
|
22
|
+
.map((configObject, index) =>
|
|
23
|
+
createElement(createPConnectComponent(), {
|
|
24
|
+
...configObject,
|
|
25
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
26
|
+
key: index.toString()
|
|
27
|
+
})
|
|
28
|
+
);
|
|
20
29
|
|
|
30
|
+
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
31
|
+
let highlightedDataArr = [];
|
|
32
|
+
if (showHighlightedData) {
|
|
33
|
+
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
34
|
+
highlightedDataArr = highlightedData.map(field => {
|
|
35
|
+
field.config.displayMode = 'STACKED_LARGE_VAL';
|
|
21
36
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<DetailsFields fields={arFields[0]} />
|
|
28
|
-
</div>
|
|
29
|
-
<div className="psdk-narrow-column-column">
|
|
30
|
-
<DetailsFields fields={arFields[1]} />
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
}
|
|
34
|
-
{a && b &&
|
|
35
|
-
<div className="psdk-wide-narrow-column">
|
|
36
|
-
<div className="psdk-wide-column-column">
|
|
37
|
-
{a}
|
|
38
|
-
</div>
|
|
39
|
-
<div className="psdk-narrow-column-column">
|
|
40
|
-
{b}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
}
|
|
44
|
-
</React.Fragment>
|
|
45
|
-
)
|
|
37
|
+
// Mark as status display when using pyStatusWork
|
|
38
|
+
if (field.config.value === '@P .pyStatusWork') {
|
|
39
|
+
field.type = 'TextInput';
|
|
40
|
+
field.config.displayAsStatus = true;
|
|
41
|
+
}
|
|
46
42
|
|
|
43
|
+
return getPConnect().createComponent(field);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
49
|
+
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
50
|
+
<Grid container spacing={1} style={{ padding: '0 0 1em' }}>
|
|
51
|
+
{highlightedDataArr.map((child, i) => (
|
|
52
|
+
<Grid item xs={COLUMN_WIDTHS[i] as GridSize} key={`hf-${i + 1}`}>
|
|
53
|
+
{child}
|
|
54
|
+
</Grid>
|
|
55
|
+
))}
|
|
56
|
+
</Grid>
|
|
57
|
+
)}
|
|
58
|
+
<Grid container spacing={1}>
|
|
59
|
+
{children.map((child, i) => (
|
|
60
|
+
<Grid item xs={COLUMN_WIDTHS[i] as GridSize} key={`r-${i + 1}`}>
|
|
61
|
+
{child}
|
|
62
|
+
</Grid>
|
|
63
|
+
))}
|
|
64
|
+
</Grid>
|
|
65
|
+
</FieldGroup>
|
|
66
|
+
);
|
|
47
67
|
}
|
|
48
68
|
|
|
69
|
+
WideNarrowDetails.defaultProps = {
|
|
70
|
+
label: undefined,
|
|
71
|
+
showLabel: true,
|
|
72
|
+
showHighlightedData: false
|
|
73
|
+
};
|
|
74
|
+
|
|
49
75
|
WideNarrowDetails.propTypes = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
76
|
+
showLabel: PropTypes.bool,
|
|
77
|
+
label: PropTypes.string,
|
|
78
|
+
getPConnect: PropTypes.func.isRequired,
|
|
79
|
+
showHighlightedData: PropTypes.bool
|
|
54
80
|
};
|
|
@@ -23,7 +23,7 @@ export default function Attachment(props) {
|
|
|
23
23
|
);
|
|
24
24
|
let arFileList$: Array<any> = [];
|
|
25
25
|
const pConn = getPConnect();
|
|
26
|
-
|
|
26
|
+
const caseID = PCore.getStoreValue('.pyID', 'caseInfo.content', pConn.getContextName());
|
|
27
27
|
let fileTemp: any = {};
|
|
28
28
|
|
|
29
29
|
let categoryName = '';
|
|
@@ -35,6 +35,13 @@ export default function Attachment(props) {
|
|
|
35
35
|
valueRef = valueRef.indexOf('.') === 0 ? valueRef.substring(1) : valueRef;
|
|
36
36
|
const [file, setFile] = useState(fileTemp);
|
|
37
37
|
|
|
38
|
+
const resetAttachmentStoredState = () => {
|
|
39
|
+
PCore.getStateUtils().updateState(pConn.getContextName(), 'attachmentsList', undefined, {
|
|
40
|
+
pageReference: 'context_data',
|
|
41
|
+
isArrayDeepMerge: false
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
38
45
|
const fileDownload = (data, fileName, ext) => {
|
|
39
46
|
const fileData = ext ? `${fileName}.${ext}` : fileName;
|
|
40
47
|
download(atob(data), fileData);
|
|
@@ -396,9 +403,36 @@ export default function Attachment(props) {
|
|
|
396
403
|
};
|
|
397
404
|
});
|
|
398
405
|
}
|
|
406
|
+
|
|
407
|
+
if (fileTemp) {
|
|
408
|
+
const currentAttachmentList = getCurrentAttachmentsList(pConn.getContextName());
|
|
409
|
+
const index = currentAttachmentList.findIndex(element => element.props.ID === fileTemp.props.ID);
|
|
410
|
+
let tempFiles: any = [];
|
|
411
|
+
if (index < 0) {
|
|
412
|
+
tempFiles = [fileTemp];
|
|
413
|
+
}
|
|
414
|
+
PCore.getStateUtils().updateState(
|
|
415
|
+
pConn.getContextName(),
|
|
416
|
+
'attachmentsList',
|
|
417
|
+
[...currentAttachmentList, ...tempFiles],
|
|
418
|
+
{
|
|
419
|
+
pageReference: 'context_data',
|
|
420
|
+
isArrayDeepMerge: false
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
PCore.getPubSubUtils().subscribe(
|
|
426
|
+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION,
|
|
427
|
+
resetAttachmentStoredState,
|
|
428
|
+
caseID
|
|
429
|
+
);
|
|
430
|
+
return () => {
|
|
431
|
+
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.ASSIGNMENT_SUBMISSION, caseID);
|
|
432
|
+
};
|
|
399
433
|
}
|
|
400
434
|
}
|
|
401
|
-
}, [
|
|
435
|
+
}, []);
|
|
402
436
|
|
|
403
437
|
let content = (
|
|
404
438
|
<div className='file-div'>
|
|
@@ -432,7 +466,7 @@ export default function Attachment(props) {
|
|
|
432
466
|
|
|
433
467
|
return (
|
|
434
468
|
<div className='file-upload-container'>
|
|
435
|
-
<span className='label'>{label}</span>
|
|
469
|
+
<span className={`label ${required ? 'file-label' : ''}`}>{label}</span>
|
|
436
470
|
<section>{content}</section>
|
|
437
471
|
</div>
|
|
438
472
|
);
|
|
@@ -68,7 +68,7 @@ export default function SummaryItem(props) {
|
|
|
68
68
|
onClose={handleClose}
|
|
69
69
|
>
|
|
70
70
|
{item.actions && item.actions.map((option) => (
|
|
71
|
-
<MenuItem style={{fontSize: '14px'}} key={option.id} onClick={option.onClick}>
|
|
71
|
+
<MenuItem style={{fontSize: '14px'}} key={option.id || option.text} onClick={option.onClick}>
|
|
72
72
|
{option.text}
|
|
73
73
|
</MenuItem>
|
|
74
74
|
))}
|
package/package.json
CHANGED
package/lib/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/field/Date/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
package/lib/infra/.DS_Store
DELETED
|
Binary file
|
package/lib/template/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/template/utils.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// This file is adapted from React DX components/template/utils.js
|
|
2
|
-
|
|
3
|
-
export function getAllFields(pConnect: any) {
|
|
4
|
-
const metadata = pConnect.getRawMetadata();
|
|
5
|
-
let allFields = [];
|
|
6
|
-
if (metadata.children && metadata.children.map) {
|
|
7
|
-
allFields = metadata.children.map((fields) => {
|
|
8
|
-
const children = fields.children instanceof Array ? fields.children : [];
|
|
9
|
-
return children.map((field) => field.config);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
return allFields;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function filterForFieldValueList(fields : any) {
|
|
16
|
-
return fields
|
|
17
|
-
.filter(({ visibility }) => visibility !== false)
|
|
18
|
-
.map(({ value, label }) => ({
|
|
19
|
-
id: label.toLowerCase(),
|
|
20
|
-
name: label,
|
|
21
|
-
value
|
|
22
|
-
}));
|
|
23
|
-
}
|