@pega/react-sdk-overrides 0.24.3 → 0.24.4
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.
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import MuiPhoneNumber from 'material-ui-phone-number';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
2
3
|
|
|
3
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
5
|
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
7
|
|
|
6
8
|
interface PhoneProps extends PConnFieldProps {
|
|
7
9
|
// If any, enter additional props that only exist on Phone here
|
|
@@ -12,6 +14,7 @@ export default function Phone(props: PhoneProps) {
|
|
|
12
14
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
13
15
|
|
|
14
16
|
const {
|
|
17
|
+
getPConnect,
|
|
15
18
|
label,
|
|
16
19
|
required,
|
|
17
20
|
disabled,
|
|
@@ -19,7 +22,6 @@ export default function Phone(props: PhoneProps) {
|
|
|
19
22
|
validatemessage,
|
|
20
23
|
status,
|
|
21
24
|
onChange,
|
|
22
|
-
onBlur,
|
|
23
25
|
readOnly,
|
|
24
26
|
testId,
|
|
25
27
|
helperText,
|
|
@@ -27,6 +29,14 @@ export default function Phone(props: PhoneProps) {
|
|
|
27
29
|
hideLabel,
|
|
28
30
|
placeholder
|
|
29
31
|
} = props;
|
|
32
|
+
|
|
33
|
+
const pConn = getPConnect();
|
|
34
|
+
const actions = pConn.getActionsApi();
|
|
35
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
36
|
+
|
|
37
|
+
const [inputValue, setInputValue] = useState(value);
|
|
38
|
+
useEffect(() => setInputValue(value), [value]);
|
|
39
|
+
|
|
30
40
|
const helperTextToDisplay = validatemessage || helperText;
|
|
31
41
|
|
|
32
42
|
let testProp = {};
|
|
@@ -69,15 +79,14 @@ export default function Phone(props: PhoneProps) {
|
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
const handleChange = inputVal => {
|
|
72
|
-
|
|
73
|
-
phoneValue = `+${phoneValue}`;
|
|
74
|
-
onChange({ value: phoneValue });
|
|
82
|
+
setInputValue(inputVal);
|
|
75
83
|
};
|
|
76
84
|
|
|
77
85
|
const handleBlur = event => {
|
|
78
86
|
const phoneValue = event?.target?.value;
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
let phoneNumber = phoneValue.split(' ').slice(1).join();
|
|
88
|
+
phoneNumber = phoneNumber ? `+${phoneValue && phoneValue.replace(/\D+/g, '')}` : '';
|
|
89
|
+
handleEvent(actions, 'changeNblur', propName, phoneNumber);
|
|
81
90
|
};
|
|
82
91
|
|
|
83
92
|
return (
|
|
@@ -94,7 +103,7 @@ export default function Phone(props: PhoneProps) {
|
|
|
94
103
|
onBlur={!readOnly ? handleBlur : undefined}
|
|
95
104
|
error={status === 'error'}
|
|
96
105
|
label={label}
|
|
97
|
-
value={
|
|
106
|
+
value={inputValue}
|
|
98
107
|
InputProps={{ ...testProp }}
|
|
99
108
|
/>
|
|
100
109
|
);
|
|
@@ -41,6 +41,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
41
41
|
const cancelAssignment = actionsAPI.cancelAssignment.bind(actionsAPI);
|
|
42
42
|
const saveAssignment = actionsAPI.saveAssignment?.bind(actionsAPI);
|
|
43
43
|
const cancelCreateStageAssignment = actionsAPI.cancelCreateStageAssignment.bind(actionsAPI);
|
|
44
|
+
const approveCase = actionsAPI.approveCase?.bind(actionsAPI);
|
|
45
|
+
const rejectCase = actionsAPI.rejectCase?.bind(actionsAPI);
|
|
44
46
|
// const showPage = actionsAPI.showPage.bind(actionsAPI);
|
|
45
47
|
|
|
46
48
|
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
@@ -212,6 +214,18 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
212
214
|
break;
|
|
213
215
|
}
|
|
214
216
|
|
|
217
|
+
case 'rejectCase': {
|
|
218
|
+
const rejectPromise = rejectCase(itemKey);
|
|
219
|
+
|
|
220
|
+
rejectPromise
|
|
221
|
+
.then(() => {})
|
|
222
|
+
.catch(() => {
|
|
223
|
+
showToast(`${localizedVal('Rejection failed!', localeCategory)}`);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
|
|
215
229
|
default:
|
|
216
230
|
break;
|
|
217
231
|
}
|
|
@@ -230,6 +244,18 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
230
244
|
break;
|
|
231
245
|
}
|
|
232
246
|
|
|
247
|
+
case 'approveCase': {
|
|
248
|
+
const approvePromise = approveCase(itemKey);
|
|
249
|
+
|
|
250
|
+
approvePromise
|
|
251
|
+
.then(() => {})
|
|
252
|
+
.catch(() => {
|
|
253
|
+
showToast(`${localizedVal('Approve failed!', localeCategory)}`);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
233
259
|
default:
|
|
234
260
|
break;
|
|
235
261
|
}
|
|
@@ -65,7 +65,6 @@ interface ListViewProps extends PConnProps {
|
|
|
65
65
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
66
66
|
|
|
67
67
|
let myRows: any[];
|
|
68
|
-
let myDisplayColumnList: any[];
|
|
69
68
|
|
|
70
69
|
let menuColumnId = '';
|
|
71
70
|
let menuColumnType = '';
|
|
@@ -119,6 +118,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
119
118
|
const rowID = compositeKeys && compositeKeys?.length === 1 ? compositeKeys[0] : defRowID;
|
|
120
119
|
|
|
121
120
|
const [arRows, setRows] = useState<any[]>([]);
|
|
121
|
+
const [rowsData, setRowsData] = useState<any[]>([]);
|
|
122
122
|
const [arColumns, setColumns] = useState<any[]>([]);
|
|
123
123
|
const [response, setResponse] = useState<any[]>([]);
|
|
124
124
|
|
|
@@ -291,16 +291,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
function getMyColumnList(arCols: any[]): string[] {
|
|
295
|
-
const myColList: string[] = [];
|
|
296
|
-
|
|
297
|
-
arCols.forEach(col => {
|
|
298
|
-
myColList.push(col.id);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
return myColList;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
294
|
/** Will return field from a filter expression */
|
|
305
295
|
function getFieldFromFilter(filter, dateRange = false) {
|
|
306
296
|
let fieldValue;
|
|
@@ -543,8 +533,8 @@ export default function ListView(props: ListViewProps) {
|
|
|
543
533
|
|
|
544
534
|
// store globally, so can be searched, filtered, etc.
|
|
545
535
|
myRows = usingDataResults;
|
|
546
|
-
myDisplayColumnList = getMyColumnList(myColumns);
|
|
547
536
|
|
|
537
|
+
setRowsData(myRows);
|
|
548
538
|
// At this point, if we have data ready to render and haven't been asked
|
|
549
539
|
// to NOT call setRows and setColumns, call them
|
|
550
540
|
if (bCallSetRowsColumns) {
|
|
@@ -604,24 +594,22 @@ export default function ListView(props: ListViewProps) {
|
|
|
604
594
|
}, [listContext]);
|
|
605
595
|
|
|
606
596
|
function searchFilter(value: string, rows: any[]) {
|
|
597
|
+
const cols = arColumns.map(ele => {
|
|
598
|
+
return ele.id;
|
|
599
|
+
});
|
|
600
|
+
|
|
607
601
|
function filterArray(el: any): boolean {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
myVal = myVal.toString();
|
|
616
|
-
}
|
|
617
|
-
if (myVal.toLowerCase().indexOf(value.toLowerCase()) >= 0) {
|
|
618
|
-
return true;
|
|
619
|
-
}
|
|
602
|
+
return Object.keys(el).some(key => {
|
|
603
|
+
// only search columns that are displayed (pzInsKey and pxRefObjectClass are added and may or may not be displayed)
|
|
604
|
+
if (cols.includes(key)) {
|
|
605
|
+
const myVal = el[key];
|
|
606
|
+
if (myVal !== null && typeof myVal !== 'undefined') {
|
|
607
|
+
const strVal = String(myVal); // Ensure myVal is a string
|
|
608
|
+
return strVal.toLowerCase().includes(value.toLowerCase());
|
|
620
609
|
}
|
|
621
610
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
return bReturn;
|
|
611
|
+
return false;
|
|
612
|
+
});
|
|
625
613
|
}
|
|
626
614
|
|
|
627
615
|
rows = rows.filter(filterArray);
|
|
@@ -631,8 +619,7 @@ export default function ListView(props: ListViewProps) {
|
|
|
631
619
|
|
|
632
620
|
function _onSearch(event: any) {
|
|
633
621
|
const searchValue = event.target.value;
|
|
634
|
-
|
|
635
|
-
const filteredRows = searchFilter(searchValue, myRows.slice());
|
|
622
|
+
const filteredRows = searchFilter(searchValue, rowsData?.slice());
|
|
636
623
|
|
|
637
624
|
setRows(filteredRows);
|
|
638
625
|
}
|
package/package.json
CHANGED