@pega/react-sdk-overrides 0.23.17 → 0.23.19
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/authManager.js +1 -0
- package/lib/helpers/date-format-utils.ts +66 -0
- package/lib/helpers/event-utils.js +1 -1
- 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 +67 -72
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +0 -44
- package/lib/infra/MultiStep/MultiStep.css +4 -18
- package/lib/infra/NavBar/NavBar.tsx +129 -219
- package/lib/infra/RootContainer/RootContainer.tsx +2 -54
- package/lib/infra/Stages/Stages.tsx +1 -2
- package/lib/infra/View/View.tsx +28 -21
- package/lib/template/AppShell/AppShell.tsx +2 -343
- package/lib/template/CaseSummary/CaseSummary.tsx +1 -1
- 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 +155 -94
- 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/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +3 -24
- 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
|
@@ -15,7 +15,8 @@ export default function Phone(props) {
|
|
|
15
15
|
readOnly,
|
|
16
16
|
testId,
|
|
17
17
|
helperText,
|
|
18
|
-
displayMode
|
|
18
|
+
displayMode,
|
|
19
|
+
hideLabel
|
|
19
20
|
} = props;
|
|
20
21
|
const helperTextToDisplay = validatemessage || helperText;
|
|
21
22
|
|
|
@@ -25,11 +26,12 @@ export default function Phone(props) {
|
|
|
25
26
|
'data-test-id': testId
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
30
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
34
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
if (readOnly) {
|
|
@@ -56,7 +58,6 @@ export default function Phone(props) {
|
|
|
56
58
|
);
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
|
|
60
61
|
const handleChange = inputVal => {
|
|
61
62
|
let phoneValue = inputVal && inputVal.replace(/\D+/g, '');
|
|
62
63
|
phoneValue = `+${phoneValue}`;
|
|
@@ -23,7 +23,8 @@ export default function RadioButtons(props) {
|
|
|
23
23
|
status,
|
|
24
24
|
required,
|
|
25
25
|
inline,
|
|
26
|
-
displayMode
|
|
26
|
+
displayMode,
|
|
27
|
+
hideLabel
|
|
27
28
|
} = props;
|
|
28
29
|
const [theSelectedButton, setSelectedButton] = useState(value);
|
|
29
30
|
|
|
@@ -43,10 +44,11 @@ export default function RadioButtons(props) {
|
|
|
43
44
|
}, [value]);
|
|
44
45
|
|
|
45
46
|
if (displayMode === 'LABELS_LEFT') {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
51
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
const handleChange = event => {
|
|
@@ -3,6 +3,7 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import Typography from '@material-ui/core/Typography';
|
|
4
4
|
import Grid from '@material-ui/core/Grid';
|
|
5
5
|
import { makeStyles } from '@material-ui/core/styles';
|
|
6
|
+
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
6
7
|
|
|
7
8
|
/* although this is called the SemanticLink component, we are not yet displaying as a
|
|
8
9
|
SemanticLink in SDK and only showing the value as a read only text field. */
|
|
@@ -43,6 +44,7 @@ export default function SemanticLink(props) {
|
|
|
43
44
|
text,
|
|
44
45
|
displayMode,
|
|
45
46
|
label,
|
|
47
|
+
hideLabel
|
|
46
48
|
} = props;
|
|
47
49
|
const classes = useStyles();
|
|
48
50
|
|
|
@@ -60,6 +62,10 @@ export default function SemanticLink(props) {
|
|
|
60
62
|
</Grid>
|
|
61
63
|
);
|
|
62
64
|
}
|
|
65
|
+
|
|
66
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
67
|
+
return <FieldValueList name={hideLabel ? '' : label} value={text} variant='stacked' />;
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
SemanticLink.propTypes = {
|
|
@@ -16,7 +16,8 @@ export default function TextArea(props) {
|
|
|
16
16
|
testId,
|
|
17
17
|
fieldMetadata,
|
|
18
18
|
helperText,
|
|
19
|
-
displayMode
|
|
19
|
+
displayMode,
|
|
20
|
+
hideLabel
|
|
20
21
|
} = props;
|
|
21
22
|
const helperTextToDisplay = validatemessage || helperText;
|
|
22
23
|
|
|
@@ -24,11 +25,12 @@ export default function TextArea(props) {
|
|
|
24
25
|
|
|
25
26
|
let readOnlyProp = {};
|
|
26
27
|
|
|
27
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
29
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
33
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
if (readOnly) {
|
|
@@ -16,7 +16,8 @@ export default function TextInput(props) {
|
|
|
16
16
|
testId,
|
|
17
17
|
fieldMetadata,
|
|
18
18
|
helperText,
|
|
19
|
-
displayMode
|
|
19
|
+
displayMode,
|
|
20
|
+
hideLabel
|
|
20
21
|
} = props;
|
|
21
22
|
const helperTextToDisplay = validatemessage || helperText;
|
|
22
23
|
|
|
@@ -24,11 +25,12 @@ export default function TextInput(props) {
|
|
|
24
25
|
|
|
25
26
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
26
27
|
|
|
27
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
29
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
33
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
if (readOnly) {
|
package/lib/field/Time/Time.tsx
CHANGED
|
@@ -16,15 +16,17 @@ export default function Time(props) {
|
|
|
16
16
|
onChange,
|
|
17
17
|
readOnly,
|
|
18
18
|
helperText,
|
|
19
|
-
displayMode
|
|
19
|
+
displayMode,
|
|
20
|
+
hideLabel
|
|
20
21
|
} = props;
|
|
21
22
|
const helperTextToDisplay = validatemessage || helperText;
|
|
22
23
|
|
|
23
24
|
if (displayMode === 'LABELS_LEFT') {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
29
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
if (readOnly) {
|
package/lib/field/URL/URL.tsx
CHANGED
|
@@ -18,15 +18,17 @@ export default function URLComponent(props) {
|
|
|
18
18
|
onBlur,
|
|
19
19
|
readOnly,
|
|
20
20
|
helperText,
|
|
21
|
-
displayMode
|
|
21
|
+
displayMode,
|
|
22
|
+
hideLabel
|
|
22
23
|
} = props;
|
|
23
24
|
const helperTextToDisplay = validatemessage || helperText;
|
|
24
25
|
|
|
25
|
-
if(displayMode === 'LABELS_LEFT') {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
27
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
31
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
if (readOnly) {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getLocale } from './formatters/common';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const dateFormatInfoDefault = {
|
|
5
|
+
dateFormatString: "MM/DD/YYYY",
|
|
6
|
+
dateFormatStringLong: "MMM DD, YYYY",
|
|
7
|
+
dateFormatStringLC: "mm/dd/yyyy",
|
|
8
|
+
dateFormatMask: "__/__/____"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const getDateFormatInfo = () => {
|
|
12
|
+
const theDateFormatInfo = dateFormatInfoDefault;
|
|
13
|
+
const theLocale = getLocale(); // PCore.getEnvironmentInfo().getUseLocale() || "US-en";
|
|
14
|
+
|
|
15
|
+
// NOTE: this date was chosen since it has a day larger than 12. If you change it,
|
|
16
|
+
// you'll need to change the indexOf values below!
|
|
17
|
+
const theTestDate = new Date(Date.parse('30 November 2023 12:00:00 GMT'));
|
|
18
|
+
const theTestDateLocaleString = new Intl.DateTimeFormat(theLocale).format(theTestDate);
|
|
19
|
+
|
|
20
|
+
// console.log(`theLocale: ${theLocale} theTestDateLocaleString: ${theTestDateLocaleString}`);
|
|
21
|
+
|
|
22
|
+
// Build the format string based on where '11' (mm), '30' (dd), and '2023' (yyyy) are
|
|
23
|
+
// Example: US locations are 0, 3, 6 but for NL locations are 3, 0, 6
|
|
24
|
+
const locMM = theTestDateLocaleString.indexOf('11');
|
|
25
|
+
const locDD = theTestDateLocaleString.indexOf('30');
|
|
26
|
+
const locYYYY = theTestDateLocaleString.indexOf('2023');
|
|
27
|
+
|
|
28
|
+
const arrPieces = [
|
|
29
|
+
{
|
|
30
|
+
loc: locMM,
|
|
31
|
+
format: 'MM',
|
|
32
|
+
longFormat: 'MMM',
|
|
33
|
+
placeholder: 'mm',
|
|
34
|
+
mask: '__'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
loc: locDD,
|
|
38
|
+
format: 'DD',
|
|
39
|
+
longFormat: 'DD',
|
|
40
|
+
placeholder: 'dd',
|
|
41
|
+
mask: '__'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
loc: locYYYY,
|
|
45
|
+
format: 'YYYY',
|
|
46
|
+
longFormat: 'YYYY',
|
|
47
|
+
placeholder: 'yyyy',
|
|
48
|
+
mask: '____'
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
// Sort the associative array by order of appearance (loc) of each piece
|
|
53
|
+
arrPieces.sort((a, b) => {
|
|
54
|
+
if (a.loc < b.loc) return -1;
|
|
55
|
+
if (a.loc > b.loc) return 1;
|
|
56
|
+
return 0;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Construct the structure to return...
|
|
60
|
+
theDateFormatInfo.dateFormatString = `${arrPieces[0].format}/${arrPieces[1].format}/${arrPieces[2].format}`;
|
|
61
|
+
theDateFormatInfo.dateFormatStringLong = `${arrPieces[0].longFormat} ${arrPieces[1].longFormat}, ${arrPieces[2].longFormat}`;
|
|
62
|
+
theDateFormatInfo.dateFormatStringLC = `${arrPieces[0].placeholder}/${arrPieces[1].placeholder}/${arrPieces[2].placeholder}`;
|
|
63
|
+
theDateFormatInfo.dateFormatMask = `${arrPieces[0].mask}/${arrPieces[1].mask}/${arrPieces[2].mask}`;
|
|
64
|
+
|
|
65
|
+
return theDateFormatInfo;
|
|
66
|
+
}
|
|
@@ -14,16 +14,24 @@ function NumberFormatter(value, { locale, decPlaces = 2 } = {}) {
|
|
|
14
14
|
|
|
15
15
|
function CurrencyFormatter(
|
|
16
16
|
value,
|
|
17
|
-
{ symbol = true, position, locale, decPlaces = 2 } = {}
|
|
17
|
+
{ symbol = true, position, locale, decPlaces = 2, style = "currency", currency = "USD" } = {}
|
|
18
18
|
) {
|
|
19
19
|
const currentLocale = getLocale(locale);
|
|
20
20
|
let formattedValue = value;
|
|
21
|
-
if (value !== null && value !== undefined) {
|
|
21
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
22
22
|
formattedValue = NumberFormatter(value, {
|
|
23
23
|
locale: currentLocale,
|
|
24
|
-
decPlaces
|
|
24
|
+
decPlaces,
|
|
25
|
+
style,
|
|
26
|
+
currency
|
|
25
27
|
});
|
|
26
|
-
|
|
28
|
+
|
|
29
|
+
let countryCode = currentLocale.split("-")[1].toUpperCase();
|
|
30
|
+
|
|
31
|
+
// If countryCode is still undefined, setting it as US
|
|
32
|
+
if( !countryCode ){
|
|
33
|
+
countryCode = 'US';
|
|
34
|
+
}
|
|
27
35
|
|
|
28
36
|
let code;
|
|
29
37
|
if (symbol) {
|
|
@@ -33,7 +41,7 @@ function CurrencyFormatter(
|
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
// if position is provided, change placeholder accordingly.
|
|
36
|
-
if (position) {
|
|
44
|
+
if (position && code) {
|
|
37
45
|
if (position.toLowerCase() === "before" && code.indexOf("{#}") === 0) {
|
|
38
46
|
code = code.slice(3) + code.slice(0, 3);
|
|
39
47
|
} else if (
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export function getLocale(locale) {
|
|
2
|
+
// use locale if specified
|
|
2
3
|
if (locale) return locale;
|
|
3
|
-
|
|
4
|
+
// otherwise, use operator locale if it's defined
|
|
5
|
+
if (window.PCore.getEnvironmentInfo().getUseLocale()) return window.PCore.getEnvironmentInfo().getUseLocale();
|
|
6
|
+
// fallback
|
|
7
|
+
return Intl.DateTimeFormat().resolvedOptions().locale;
|
|
4
8
|
}
|
|
5
9
|
|
|
6
10
|
export function getCurrentTimezone(timezone) {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// This file is adapted from React DX components/template/utils.js
|
|
2
|
+
|
|
3
|
+
declare const PCore: any;
|
|
4
|
+
|
|
5
|
+
export function getAllFields(pConnect: any) {
|
|
6
|
+
const metadata = pConnect.getRawMetadata();
|
|
7
|
+
let allFields = [];
|
|
8
|
+
if (metadata.children && metadata.children.map) {
|
|
9
|
+
allFields = metadata.children.map((fields) => {
|
|
10
|
+
const children = fields.children instanceof Array ? fields.children : [];
|
|
11
|
+
return children.map((field) => field.config);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return allFields;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export function filterForFieldValueList(fields : any) {
|
|
19
|
+
return fields
|
|
20
|
+
.filter(({ visibility }) => visibility !== false)
|
|
21
|
+
.map(({ value, label }) => ({
|
|
22
|
+
id: label.toLowerCase(),
|
|
23
|
+
name: label,
|
|
24
|
+
value
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Determine if the current view is the view of the case step/assignment.
|
|
31
|
+
* @param {Function} pConnect PConnect object for the component
|
|
32
|
+
*/
|
|
33
|
+
export function getIsAssignmentView(pConnect) {
|
|
34
|
+
// Get caseInfo content from the store which contains the view info about the current assignment/step
|
|
35
|
+
// TODO To be replaced with pConnect.getCaseInfo().getCurrentAssignmentView when it's available
|
|
36
|
+
const assignmentViewClass = pConnect.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID);
|
|
37
|
+
const assignmentViewName = pConnect.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENTACTION_ID);
|
|
38
|
+
|
|
39
|
+
const assignmentViewId = `${assignmentViewName}!${assignmentViewClass}`;
|
|
40
|
+
|
|
41
|
+
// Get the info about the current view from pConnect
|
|
42
|
+
const currentViewId = `${pConnect.getCurrentView()}!${pConnect.getCurrentClassID()}`;
|
|
43
|
+
|
|
44
|
+
return assignmentViewId === currentViewId;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A hook that gets the instructions content for a view.
|
|
49
|
+
* @param {Function} pConnect PConnect object for the component
|
|
50
|
+
* @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
|
|
51
|
+
*/
|
|
52
|
+
export function getInstructions(pConnect, instructions = 'casestep') {
|
|
53
|
+
const caseStepInstructions = pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
|
|
54
|
+
|
|
55
|
+
// Determine if this view is the current assignment/step view
|
|
56
|
+
const isCurrentAssignmentView = getIsAssignmentView(pConnect);
|
|
57
|
+
|
|
58
|
+
// Case step instructions
|
|
59
|
+
if (instructions === 'casestep' && isCurrentAssignmentView && caseStepInstructions?.length) {
|
|
60
|
+
return caseStepInstructions;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// No instructions
|
|
64
|
+
if (instructions === 'none') {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// If the annotation wasn't processed correctly, don't return any instruction text
|
|
69
|
+
if (instructions?.startsWith('@PARAGRAPH')) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Custom instructions from the view
|
|
74
|
+
// The raw metadata for `instructions` will be something like '@PARAGRAPH .SomeParagraphRule' but
|
|
75
|
+
// it is evaluated by core logic to the content
|
|
76
|
+
if (instructions !== 'casestep' && instructions !== 'none') {
|
|
77
|
+
return instructions;
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
@@ -286,8 +286,7 @@ export default function FlowContainer(props) {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
|
|
289
|
-
// From WC
|
|
290
|
-
|
|
289
|
+
// From SDK-WC updateSelf - so do this in useEffect that's run only when the props change...
|
|
291
290
|
useEffect(() => {
|
|
292
291
|
const localPConn = arNewChildren[0].getPConnect();
|
|
293
292
|
|
|
@@ -339,6 +338,72 @@ export default function FlowContainer(props) {
|
|
|
339
338
|
if (window.sessionStorage.getItem("okToInitFlowContainer") === "true") {
|
|
340
339
|
initContainer();
|
|
341
340
|
}
|
|
341
|
+
|
|
342
|
+
// this check in routingInfo, mimic React to check and get the internals of the
|
|
343
|
+
// flowContainer and force updates to pConnect/redux
|
|
344
|
+
if (routingInfo && loadingInfo !== undefined) {
|
|
345
|
+
|
|
346
|
+
// debugging/investigation help
|
|
347
|
+
// console.log(`${thePConn.getComponentName()}: >>routingInfo: ${JSON.stringify(routingInfo)}`);
|
|
348
|
+
|
|
349
|
+
const currentOrder = routingInfo.accessedOrder;
|
|
350
|
+
const currentItems = routingInfo.items;
|
|
351
|
+
const type = routingInfo.type;
|
|
352
|
+
if (currentOrder && currentItems) { // JA - making more similar to React version
|
|
353
|
+
const key = currentOrder[currentOrder.length - 1];
|
|
354
|
+
|
|
355
|
+
// save off itemKey to be used for finishAssignment, etc.
|
|
356
|
+
// debugger;
|
|
357
|
+
setItemKey(key);
|
|
358
|
+
|
|
359
|
+
if (currentOrder.length > 0 &&
|
|
360
|
+
currentItems[key] &&
|
|
361
|
+
currentItems[key].view &&
|
|
362
|
+
type === "single" &&
|
|
363
|
+
!Utils.isEmptyObject(currentItems[key].view)) {
|
|
364
|
+
const currentItem = currentItems[key];
|
|
365
|
+
const rootView = currentItem.view;
|
|
366
|
+
const { context } = rootView.config;
|
|
367
|
+
const config = { meta: rootView };
|
|
368
|
+
|
|
369
|
+
config["options"] = {
|
|
370
|
+
context: currentItem.context,
|
|
371
|
+
pageReference: context || localPConn.getPageReference(),
|
|
372
|
+
hasForm: true,
|
|
373
|
+
isFlowContainer: true,
|
|
374
|
+
containerName: localPConn.getContainerName(),
|
|
375
|
+
containerItemName: key,
|
|
376
|
+
parentPageReference: localPConn.getPageReference()
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const configObject = PCore.createPConnect(config);
|
|
380
|
+
|
|
381
|
+
// Since we're setting an array, need to add in an appropriate key
|
|
382
|
+
// to remove React warning.
|
|
383
|
+
configObject["key"] = config["options"].parentPageReference;
|
|
384
|
+
|
|
385
|
+
// keep track of these changes
|
|
386
|
+
const theNewChildren: Array<Object> = [];
|
|
387
|
+
theNewChildren.push(configObject);
|
|
388
|
+
setArNewChildren(theNewChildren);
|
|
389
|
+
|
|
390
|
+
// JEA - adapted from Constellation DX Components FlowContainer since we want to render children that are React components
|
|
391
|
+
const root = createElement(createPConnectComponent(), configObject);
|
|
392
|
+
setArNewChildrenAsReact([root]);
|
|
393
|
+
|
|
394
|
+
const oWorkItem = configObject.getPConnect(); // was theNewChildren[0].getPConnect()
|
|
395
|
+
const oWorkData = oWorkItem.getDataObject();
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
// check if have oWorkData, there are times due to timing of state change, when this
|
|
399
|
+
// may not be available
|
|
400
|
+
if (oWorkData) {
|
|
401
|
+
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments[0].name);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
}
|
|
342
407
|
}
|
|
343
408
|
|
|
344
409
|
// if have caseMessage show message and end
|
|
@@ -359,81 +424,11 @@ export default function FlowContainer(props) {
|
|
|
359
424
|
|
|
360
425
|
// debugger;
|
|
361
426
|
setCheckSvg(Utils.getImageSrc("check", PCore.getAssetLoader().getStaticServerUrl()));
|
|
362
|
-
return;
|
|
363
427
|
}
|
|
364
428
|
else {
|
|
365
429
|
// debugger;
|
|
366
430
|
setHasCaseMessages(false);
|
|
367
431
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
// this check in routingInfo, mimic React to check and get the internals of the
|
|
371
|
-
// flowContainer and force updates to pConnect/redux
|
|
372
|
-
if (routingInfo && loadingInfo !== undefined) {
|
|
373
|
-
|
|
374
|
-
// debugging/investigation help
|
|
375
|
-
// console.log(`${thePConn.getComponentName()}: >>routingInfo: ${JSON.stringify(routingInfo)}`);
|
|
376
|
-
|
|
377
|
-
const currentOrder = routingInfo.accessedOrder;
|
|
378
|
-
const currentItems = routingInfo.items;
|
|
379
|
-
const type = routingInfo.type;
|
|
380
|
-
if (currentOrder && currentItems) { // JA - making more similar to React version
|
|
381
|
-
const key = currentOrder[currentOrder.length - 1];
|
|
382
|
-
|
|
383
|
-
// save off itemKey to be used for finishAssignment, etc.
|
|
384
|
-
// debugger;
|
|
385
|
-
setItemKey(key);
|
|
386
|
-
|
|
387
|
-
if (currentOrder.length > 0 &&
|
|
388
|
-
currentItems[key] &&
|
|
389
|
-
currentItems[key].view &&
|
|
390
|
-
type === "single" &&
|
|
391
|
-
!Utils.isEmptyObject(currentItems[key].view)) {
|
|
392
|
-
const currentItem = currentItems[key];
|
|
393
|
-
const rootView = currentItem.view;
|
|
394
|
-
const { context } = rootView.config;
|
|
395
|
-
const config = { meta: rootView };
|
|
396
|
-
|
|
397
|
-
config["options"] = {
|
|
398
|
-
context: currentItem.context,
|
|
399
|
-
pageReference: context || localPConn.getPageReference(),
|
|
400
|
-
hasForm: true,
|
|
401
|
-
isFlowContainer: true,
|
|
402
|
-
containerName: localPConn.getContainerName(),
|
|
403
|
-
containerItemName: key,
|
|
404
|
-
parentPageReference: localPConn.getPageReference()
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
const configObject = PCore.createPConnect(config);
|
|
408
|
-
|
|
409
|
-
// Since we're setting an array, need to add in an appropriate key
|
|
410
|
-
// to remove React warning.
|
|
411
|
-
configObject["key"] = config["options"].parentPageReference;
|
|
412
|
-
|
|
413
|
-
// keep track of these changes
|
|
414
|
-
const theNewChildren: Array<Object> = [];
|
|
415
|
-
theNewChildren.push(configObject);
|
|
416
|
-
setArNewChildren(theNewChildren);
|
|
417
|
-
|
|
418
|
-
// JEA - adapted from Nebula FlowContainer since we want to render children that are React components
|
|
419
|
-
const root = createElement(createPConnectComponent(), configObject);
|
|
420
|
-
setArNewChildrenAsReact([root]);
|
|
421
|
-
|
|
422
|
-
const oWorkItem = configObject.getPConnect(); // was theNewChildren[0].getPConnect()
|
|
423
|
-
const oWorkData = oWorkItem.getDataObject();
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
// check if have oWorkData, there are times due to timing of state change, when this
|
|
427
|
-
// may not be available
|
|
428
|
-
if (oWorkData) {
|
|
429
|
-
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments[0].name);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
432
|
}, [props]);
|
|
438
433
|
|
|
439
434
|
const caseId = thePConn.getCaseSummary().content.pyID;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// Adapted from nebula ErrorBoundary (remove Cosmos dependencies)
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import PropTypes from "prop-types";
|
|
5
3
|
|
|
@@ -16,18 +14,6 @@ function ErrorBoundary(props) {
|
|
|
16
14
|
if (!getPConnect) {
|
|
17
15
|
return (
|
|
18
16
|
theErrorDiv
|
|
19
|
-
// <Flex
|
|
20
|
-
// container={{
|
|
21
|
-
// alignItems: "center",
|
|
22
|
-
// justify: "center",
|
|
23
|
-
// itemGap: 1
|
|
24
|
-
// }}
|
|
25
|
-
// >
|
|
26
|
-
// <Text status="error">
|
|
27
|
-
// <Icon name="warn-solid" />
|
|
28
|
-
// </Text>
|
|
29
|
-
// <Text data-testid="errorText">{ERROR_TEXT}</Text>
|
|
30
|
-
// </Flex>
|
|
31
17
|
);
|
|
32
18
|
}
|
|
33
19
|
|
|
@@ -43,12 +29,6 @@ function ErrorBoundary(props) {
|
|
|
43
29
|
if (pConn.getConfigProps().type === "page") {
|
|
44
30
|
return (
|
|
45
31
|
theErrorDiv
|
|
46
|
-
// <Banner
|
|
47
|
-
// data-testid="errorBanner"
|
|
48
|
-
// variant="urgent"
|
|
49
|
-
// heading="Error"
|
|
50
|
-
// messages={[ERROR_TEXT]}
|
|
51
|
-
// />
|
|
52
32
|
);
|
|
53
33
|
}
|
|
54
34
|
|
|
@@ -64,30 +44,6 @@ function ErrorBoundary(props) {
|
|
|
64
44
|
|
|
65
45
|
return (
|
|
66
46
|
theErrorDiv
|
|
67
|
-
// <Card>
|
|
68
|
-
// <CardHeader>
|
|
69
|
-
// <Text variant="h3">
|
|
70
|
-
// {pConn.getConfigProps().label || pConn.getComponentName()}
|
|
71
|
-
// </Text>
|
|
72
|
-
// </CardHeader>
|
|
73
|
-
// <CardContent
|
|
74
|
-
// direction="row"
|
|
75
|
-
// style={{ minHeight: "5rem", justifyContent: "center" }}
|
|
76
|
-
// >
|
|
77
|
-
// <Flex
|
|
78
|
-
// container={{
|
|
79
|
-
// alignItems: "center",
|
|
80
|
-
// justify: "center",
|
|
81
|
-
// itemGap: 1
|
|
82
|
-
// }}
|
|
83
|
-
// >
|
|
84
|
-
// <Text status="error">
|
|
85
|
-
// <Icon name="warn-solid" />
|
|
86
|
-
// </Text>
|
|
87
|
-
// <Text>{ERROR_TEXT}</Text>
|
|
88
|
-
// </Flex>
|
|
89
|
-
// </CardContent>
|
|
90
|
-
// </Card>
|
|
91
47
|
);
|
|
92
48
|
}
|
|
93
49
|
ErrorBoundary.propTypes = {
|