@pega/react-sdk-overrides 0.25.8 → 0.25.11
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/AlertBanner/AlertBanner.css +46 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +37 -20
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +10 -1
- package/lib/infra/Assignment/useValidationBanner.ts +29 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +4 -5
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +6 -1
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +4 -8
- package/lib/infra/DeferLoad/DeferLoad.tsx +24 -9
- package/lib/infra/NavBar/NavBar.tsx +6 -2
- package/lib/infra/Reference/Reference.tsx +5 -0
- package/lib/infra/RootContainer/RootContainer.tsx +4 -5
- package/lib/infra/View/View.tsx +5 -6
- package/lib/template/AppShell/AppShell.css +0 -4
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +10 -3
- package/lib/template/HierarchicalForm/HierarchicalForm.tsx +58 -0
- package/lib/template/HierarchicalForm/hooks.ts +224 -0
- package/lib/template/HierarchicalForm/index.tsx +1 -0
- package/lib/template/ListView/ListView.tsx +73 -15
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +16 -1
- package/lib/template/ObjectPage/index.tsx +1 -0
- package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +51 -43
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +14 -6
- package/lib/template/SimpleTable/SimpleTableSelectReadonly/SimpleTableSelectReadonly.tsx +179 -0
- package/lib/template/SimpleTable/SimpleTableSelectReadonly/index.tsx +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { createElement, Fragment, useState } from 'react';
|
|
2
|
+
import Button from '@mui/material/Button';
|
|
3
|
+
import Dialog from '@mui/material/Dialog';
|
|
4
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
5
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
6
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
7
|
+
import Link from '@mui/material/Link';
|
|
8
|
+
import Typography from '@mui/material/Typography';
|
|
9
|
+
|
|
10
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
11
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
12
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
13
|
+
import { SIMPLE_TABLE_MANUAL_READONLY } from '@pega/react-sdk-components/lib/components/field/ObjectReference/utils';
|
|
14
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
15
|
+
|
|
16
|
+
interface SimpleTableSelectReadonlyProps extends PConnProps {
|
|
17
|
+
label?: string;
|
|
18
|
+
referenceList: object[] | string;
|
|
19
|
+
readonlyContextList?: object[];
|
|
20
|
+
primaryField?: string;
|
|
21
|
+
referenceType?: string;
|
|
22
|
+
selectionKey?: string;
|
|
23
|
+
selectionList?: string;
|
|
24
|
+
hideLabel?: boolean;
|
|
25
|
+
variant?: string;
|
|
26
|
+
displayAs?: string;
|
|
27
|
+
displayMode?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function SimpleTableSelectReadonly(props: SimpleTableSelectReadonlyProps) {
|
|
31
|
+
const {
|
|
32
|
+
label = '',
|
|
33
|
+
getPConnect,
|
|
34
|
+
readonlyContextList = [],
|
|
35
|
+
primaryField = '',
|
|
36
|
+
referenceType = '',
|
|
37
|
+
selectionKey = '',
|
|
38
|
+
selectionList = '',
|
|
39
|
+
hideLabel = false,
|
|
40
|
+
displayAs = 'readonly',
|
|
41
|
+
displayMode
|
|
42
|
+
} = props;
|
|
43
|
+
|
|
44
|
+
const [modalOpen, setModalOpen] = useState(false);
|
|
45
|
+
|
|
46
|
+
const { DATA, CASE } = PCore.getConstants().RESOURCE_TYPES;
|
|
47
|
+
const pConn = getPConnect();
|
|
48
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
49
|
+
const localeCategory = 'SimpleTableSelectReadOnly';
|
|
50
|
+
const PComponent = createPConnectComponent();
|
|
51
|
+
|
|
52
|
+
const openModal = () => {
|
|
53
|
+
const rawConfig = (getPConnect().getRawMetadata() as any).config;
|
|
54
|
+
const rawFields = rawConfig?.presets?.[0].children?.[0]?.children || [];
|
|
55
|
+
|
|
56
|
+
const caseFields = rawFields
|
|
57
|
+
.filter((field: any) => field.config.value.includes(`@P .${Utils.getMappedKey('pyID')}`) || field.config.value.includes(`@P ${primaryField}`))
|
|
58
|
+
.map((field: any) => field.config.value);
|
|
59
|
+
|
|
60
|
+
const dataFields = rawFields.filter((field: any) => field.config.value.includes(`@P ${primaryField}`)).map((field: any) => field.config.value);
|
|
61
|
+
|
|
62
|
+
const defaultFields: any[] = rawConfig?.detailsDisplay || [];
|
|
63
|
+
if (defaultFields?.length === 2 && defaultFields[0].config.value === defaultFields[1].config.value) {
|
|
64
|
+
defaultFields.splice(0, 1);
|
|
65
|
+
}
|
|
66
|
+
defaultFields.forEach((field: any) => {
|
|
67
|
+
if (
|
|
68
|
+
(referenceType.toUpperCase() === CASE && !caseFields.includes(field?.config?.value)) ||
|
|
69
|
+
(referenceType.toUpperCase() === DATA && !dataFields.includes(field?.config?.value))
|
|
70
|
+
) {
|
|
71
|
+
(getPConnect().getRawMetadata() as any).config?.presets?.[0].children?.[0]?.children?.unshift(field);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
setModalOpen(true);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const closeModal = () => {
|
|
79
|
+
setModalOpen(false);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const renderModal = () => {
|
|
83
|
+
const SimpleTableManual = getComponentFromMap('SimpleTableManual');
|
|
84
|
+
|
|
85
|
+
let readonlyContextObject: { referenceList?: object[] } | undefined;
|
|
86
|
+
if (typeof props.referenceList === 'string') {
|
|
87
|
+
readonlyContextObject = { referenceList: readonlyContextList };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Dialog open={modalOpen} onClose={closeModal} maxWidth='md' fullWidth>
|
|
92
|
+
<DialogTitle>{label}</DialogTitle>
|
|
93
|
+
<DialogContent>
|
|
94
|
+
<SimpleTableManual {...props} {...readonlyContextObject} classId={SIMPLE_TABLE_MANUAL_READONLY} />
|
|
95
|
+
</DialogContent>
|
|
96
|
+
<DialogActions>
|
|
97
|
+
<Button onClick={closeModal} variant='contained'>
|
|
98
|
+
{localizedVal('Close', localeCategory)}
|
|
99
|
+
</Button>
|
|
100
|
+
</DialogActions>
|
|
101
|
+
</Dialog>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
let displayComp: any;
|
|
106
|
+
|
|
107
|
+
if (readonlyContextList && readonlyContextList.length > 0) {
|
|
108
|
+
const listLength = readonlyContextList.length;
|
|
109
|
+
const filteredList = ['combobox', 'checkboxgroup'].includes(displayAs) ? readonlyContextList : readonlyContextList.slice(0, 5);
|
|
110
|
+
|
|
111
|
+
displayComp = (
|
|
112
|
+
<div>
|
|
113
|
+
{filteredList.map((child: any, index: number) => {
|
|
114
|
+
const selectionKeyProp = selectionKey.substring(1);
|
|
115
|
+
const primaryFieldProp = primaryField?.substring(1);
|
|
116
|
+
const selectionListProp = selectionList?.substring(1);
|
|
117
|
+
const referenceLabel = child[primaryFieldProp] || '';
|
|
118
|
+
|
|
119
|
+
let resourcePayload = {};
|
|
120
|
+
let resourceParams = {};
|
|
121
|
+
let previewKey = '';
|
|
122
|
+
|
|
123
|
+
if (referenceType.toUpperCase() === CASE) {
|
|
124
|
+
previewKey = child[Utils.getMappedKey('pzInsKey')];
|
|
125
|
+
resourcePayload = { caseClassName: child.classID };
|
|
126
|
+
resourceParams = { workID: child[selectionKeyProp] };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const metadata = {
|
|
130
|
+
type: 'SemanticLink',
|
|
131
|
+
config: {
|
|
132
|
+
text: referenceLabel,
|
|
133
|
+
resourceParams,
|
|
134
|
+
resourcePayload,
|
|
135
|
+
previewKey,
|
|
136
|
+
referenceType
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const childPConnectConfig = PCore.createPConnect({
|
|
141
|
+
meta: metadata,
|
|
142
|
+
options: {
|
|
143
|
+
context: pConn.getContextName(),
|
|
144
|
+
pageReference: `${pConn.getPageReference()}.${selectionListProp}[${index}]`
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<Fragment key={child[selectionKeyProp]}>
|
|
150
|
+
{createElement(PComponent, { ...childPConnectConfig })}
|
|
151
|
+
{index + 1 !== filteredList.length && ', '}
|
|
152
|
+
</Fragment>
|
|
153
|
+
);
|
|
154
|
+
})}
|
|
155
|
+
{listLength > 5 && !['combobox', 'checkboxgroup'].includes(displayAs) && (
|
|
156
|
+
<Link component='button' onClick={openModal} underline='hover'>
|
|
157
|
+
({listLength} {localizedVal('Total', localeCategory)})
|
|
158
|
+
</Link>
|
|
159
|
+
)}
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
165
|
+
return displayComp ?? <Typography variant='body2'>---</Typography>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'baseline', gap: '0.5rem' }}>
|
|
170
|
+
{!hideLabel && label && (
|
|
171
|
+
<Typography variant='body2' color='text.secondary'>
|
|
172
|
+
{label}
|
|
173
|
+
</Typography>
|
|
174
|
+
)}
|
|
175
|
+
{displayComp}
|
|
176
|
+
{renderModal()}
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SimpleTableSelectReadonly';
|
package/package.json
CHANGED