@pega/react-sdk-overrides 0.242.8 → 0.242.9
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/FieldValueList/FieldValueList.tsx +2 -2
- package/lib/field/CancelAlert/CancelAlert.tsx +0 -3
- package/lib/field/Currency/Currency.tsx +7 -4
- package/lib/field/Date/Date.tsx +5 -1
- package/lib/field/DateTime/DateTime.tsx +13 -5
- package/lib/field/Decimal/Decimal.tsx +6 -1
- package/lib/field/Dropdown/Dropdown.tsx +27 -20
- package/lib/field/Percentage/Percentage.tsx +5 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +0 -3
- package/lib/field/ScalarList/ScalarList.tsx +0 -2
- package/lib/field/Time/Time.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +1 -3
- package/lib/helpers/common-utils.ts +24 -1
- package/lib/helpers/formatters/Currency.ts +11 -16
- package/lib/helpers/formatters/common.ts +2 -1
- package/lib/helpers/formatters/index.ts +2 -4
- package/lib/infra/Assignment/Assignment.tsx +0 -4
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +4 -17
- package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
- package/lib/infra/Containers/SimpleView/helper.ts +1 -1
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +2 -3
- package/lib/infra/DashboardFilter/filterUtils.tsx +1 -3
- package/lib/infra/DeferLoad/DeferLoad.tsx +3 -3
- package/lib/infra/MultiStep/MultiStep.tsx +1 -6
- package/lib/infra/RootContainer/RootContainer.tsx +1 -1
- package/lib/template/CaseView/CaseView.tsx +5 -4
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +0 -1
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +0 -2
- package/lib/template/ListView/ListView.tsx +10 -9
- package/lib/template/ListView/utils.ts +0 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +0 -1
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +0 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +46 -54
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +2 -4
- package/lib/widget/Attachment/Attachment.tsx +0 -5
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +1 -1
- package/lib/widget/QuickCreate/QuickCreate.tsx +0 -1
- package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
- package/package.json +1 -1
- /package/lib/infra/Containers/{helpers.ts → container-helpers.ts} +0 -0
|
@@ -63,7 +63,7 @@ export default function FieldValueList(props: FieldValueListProps) {
|
|
|
63
63
|
const formattedValue = formatItemValue(value);
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
|
-
<Grid item xs={variant === 'stacked' ? 12 : 8} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
|
|
66
|
+
<Grid item xs={variant === 'stacked' || !name ? 12 : 8} className={variant === 'stacked' ? classes.noPaddingTop : ''}>
|
|
67
67
|
{isHtml ? (
|
|
68
68
|
// eslint-disable-next-line react/no-danger
|
|
69
69
|
<div dangerouslySetInnerHTML={{ __html: formattedValue }} />
|
|
@@ -78,7 +78,7 @@ export default function FieldValueList(props: FieldValueListProps) {
|
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
80
|
<Grid container spacing={4} justifyContent='space-between'>
|
|
81
|
-
{getGridItemLabel()}
|
|
81
|
+
{name ? getGridItemLabel() : null}
|
|
82
82
|
{getGridItemValue()}
|
|
83
83
|
</Grid>
|
|
84
84
|
);
|
|
@@ -58,14 +58,12 @@ export default function CancelAlert(props: CancelAlertProps) {
|
|
|
58
58
|
function cancelHandler() {
|
|
59
59
|
if (isReverseCoexistence) {
|
|
60
60
|
dismiss(true);
|
|
61
|
-
// @ts-ignore - An argument for 'payload' was not provided.
|
|
62
61
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
|
|
63
62
|
} else if (!isDataObject && !isLocalAction && !isBulkAction) {
|
|
64
63
|
disableButton(btnIds.DELETE);
|
|
65
64
|
actionsAPI
|
|
66
65
|
.deleteCaseInCreateStage(containerItemID, hideDelete)
|
|
67
66
|
.then(() => {
|
|
68
|
-
// @ts-ignore - An argument for 'payload' was not provided.
|
|
69
67
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
70
68
|
})
|
|
71
69
|
.catch(() => {
|
|
@@ -84,7 +82,6 @@ export default function CancelAlert(props: CancelAlertProps) {
|
|
|
84
82
|
actionsAPI.cancelBulkAction(containerItemID);
|
|
85
83
|
} else {
|
|
86
84
|
dismiss(true);
|
|
87
|
-
// @ts-ignore - Argument of type '{ containerItemID: string; skipReleaseLockRequest: any; }' is not assignable to parameter of type 'ContainerInfo'.
|
|
88
85
|
containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
|
|
89
86
|
}
|
|
90
87
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { NumericFormat } from 'react-number-format';
|
|
3
3
|
import { TextField } from '@mui/material';
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
@@ -45,9 +45,11 @@ export default function Currency(props: CurrrencyProps) {
|
|
|
45
45
|
const helperTextToDisplay = validatemessage || helperText;
|
|
46
46
|
const [values, setValues] = useState(value.toString());
|
|
47
47
|
|
|
48
|
-
const testProp = {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const testProp = { 'data-test-id': testId };
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setValues(value.toString());
|
|
52
|
+
}, [value]);
|
|
51
53
|
|
|
52
54
|
// currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
|
|
53
55
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
@@ -86,6 +88,7 @@ export default function Currency(props: CurrrencyProps) {
|
|
|
86
88
|
return (
|
|
87
89
|
<NumericFormat
|
|
88
90
|
valueIsNumericString
|
|
91
|
+
variant={readOnly ? 'standard' : 'outlined'}
|
|
89
92
|
label={label}
|
|
90
93
|
helperText={helperTextToDisplay}
|
|
91
94
|
placeholder={placeholder ?? ''}
|
package/lib/field/Date/Date.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
3
3
|
import dayjs, { Dayjs } from 'dayjs';
|
|
4
4
|
|
|
@@ -39,6 +39,10 @@ export default function Date(props: DateProps) {
|
|
|
39
39
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
40
40
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
41
41
|
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setDateValue(dayjs(value));
|
|
44
|
+
}, [value]);
|
|
45
|
+
|
|
42
46
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
43
47
|
const formattedDate = format(props.value, 'date', {
|
|
44
48
|
format: dateFormatInfo.dateFormatString
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
3
3
|
import dayjs, { Dayjs } from 'dayjs';
|
|
4
|
-
|
|
4
|
+
import DateFormatter from '@pega/react-sdk-components/lib/components/helpers/formatters/Date';
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
7
7
|
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
@@ -19,7 +19,10 @@ export default function DateTime(props: DateTimeProps) {
|
|
|
19
19
|
|
|
20
20
|
const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const environmentInfo = PCore.getEnvironmentInfo();
|
|
23
|
+
const timezone = environmentInfo && environmentInfo.getTimeZone();
|
|
24
|
+
|
|
25
|
+
const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null);
|
|
23
26
|
|
|
24
27
|
const pConn = getPConnect();
|
|
25
28
|
const actions = pConn.getActionsApi();
|
|
@@ -34,6 +37,10 @@ export default function DateTime(props: DateTimeProps) {
|
|
|
34
37
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
35
38
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
36
39
|
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })));
|
|
42
|
+
}, [value]);
|
|
43
|
+
|
|
37
44
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
38
45
|
const formattedDateTime = format(props.value, 'datetime', {
|
|
39
46
|
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
@@ -60,8 +67,9 @@ export default function DateTime(props: DateTimeProps) {
|
|
|
60
67
|
};
|
|
61
68
|
|
|
62
69
|
const handleChange = date => {
|
|
63
|
-
|
|
64
|
-
const changeValue =
|
|
70
|
+
const timeZoneDateTime = (dayjs as any).tz(date.format('YYYY-MM-DDTHH:mm:ss'), timezone);
|
|
71
|
+
const changeValue = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
|
|
72
|
+
setDateValue(timeZoneDateTime);
|
|
65
73
|
handleEvent(actions, 'changeNblur', propName, changeValue);
|
|
66
74
|
};
|
|
67
75
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NumericFormat } from 'react-number-format';
|
|
2
2
|
import { TextField } from '@mui/material';
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
4
|
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
@@ -58,6 +58,10 @@ export default function Decimal(props: DecimalProps) {
|
|
|
58
58
|
|
|
59
59
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
60
60
|
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
setValues(value.toString());
|
|
63
|
+
}, [value]);
|
|
64
|
+
|
|
61
65
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
62
66
|
|
|
63
67
|
if (readOnly) {
|
|
@@ -109,6 +113,7 @@ export default function Decimal(props: DecimalProps) {
|
|
|
109
113
|
}}
|
|
110
114
|
onBlur={!readOnly ? decimalOnBlur : undefined}
|
|
111
115
|
prefix={readOnly && formatter === 'Currency' ? theCurrSym : ''}
|
|
116
|
+
suffix={readOnly && formatter === 'Percentage' ? '%' : ''}
|
|
112
117
|
decimalSeparator={theCurrDec}
|
|
113
118
|
thousandSeparator={showGroupSeparators ? theCurrSep : ''}
|
|
114
119
|
decimalScale={readOnly && formatter === 'Currency' ? undefined : decimalPrecision}
|
|
@@ -137,7 +137,7 @@ export default function Dropdown(props: DropdownProps) {
|
|
|
137
137
|
}, [theDatasource]);
|
|
138
138
|
|
|
139
139
|
useEffect(() => {
|
|
140
|
-
if (
|
|
140
|
+
if (listType !== 'associated' && typeof datasource === 'string') {
|
|
141
141
|
getDataPage(datasource, parameters, context).then((results: any) => {
|
|
142
142
|
const optionsData: any[] = [];
|
|
143
143
|
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
@@ -165,25 +165,33 @@ export default function Dropdown(props: DropdownProps) {
|
|
|
165
165
|
|
|
166
166
|
let readOnlyProp = {};
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
168
|
+
const displayFn = (displayM, val) => {
|
|
169
|
+
if (displayM === 'DISPLAY_ONLY') {
|
|
170
|
+
return (
|
|
171
|
+
<FieldValueList
|
|
172
|
+
name={hideLabel ? '' : label}
|
|
173
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
174
|
+
value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (displayM === 'STACKED_LARGE_VAL') {
|
|
180
|
+
return (
|
|
181
|
+
<FieldValueList
|
|
182
|
+
name={hideLabel ? '' : label}
|
|
183
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
184
|
+
value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
185
|
+
variant='stacked'
|
|
186
|
+
/>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return null;
|
|
191
|
+
};
|
|
177
192
|
|
|
178
|
-
if (displayMode
|
|
179
|
-
return (
|
|
180
|
-
<FieldValueList
|
|
181
|
-
name={hideLabel ? '' : label}
|
|
182
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
183
|
-
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
184
|
-
variant='stacked'
|
|
185
|
-
/>
|
|
186
|
-
);
|
|
193
|
+
if (displayMode) {
|
|
194
|
+
return displayFn(displayMode, options.find(option => option.key === value)?.value || value);
|
|
187
195
|
}
|
|
188
196
|
|
|
189
197
|
if (readOnly) {
|
|
@@ -224,7 +232,6 @@ export default function Dropdown(props: DropdownProps) {
|
|
|
224
232
|
>
|
|
225
233
|
{options.map((option: any) => (
|
|
226
234
|
<MenuItem key={option.key} value={option.key}>
|
|
227
|
-
{/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
|
|
228
235
|
{thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
229
236
|
</MenuItem>
|
|
230
237
|
))}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { NumericFormat } from 'react-number-format';
|
|
3
3
|
import { TextField } from '@mui/material';
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
@@ -52,6 +52,10 @@ export default function Percentage(props: PercentageProps) {
|
|
|
52
52
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
53
53
|
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
54
54
|
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setValues(value.toString());
|
|
57
|
+
}, [value]);
|
|
58
|
+
|
|
55
59
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
56
60
|
|
|
57
61
|
if (readOnly) {
|
|
@@ -65,7 +65,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
65
65
|
return (
|
|
66
66
|
<FieldValueList
|
|
67
67
|
name={hideLabel ? '' : label}
|
|
68
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
69
68
|
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
70
69
|
/>
|
|
71
70
|
);
|
|
@@ -75,7 +74,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
75
74
|
return (
|
|
76
75
|
<FieldValueList
|
|
77
76
|
name={hideLabel ? '' : label}
|
|
78
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
79
77
|
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
80
78
|
variant='stacked'
|
|
81
79
|
/>
|
|
@@ -102,7 +100,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
102
100
|
label={thePConn.getLocalizedValue(
|
|
103
101
|
theOption.value,
|
|
104
102
|
localePath,
|
|
105
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
106
103
|
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
107
104
|
)}
|
|
108
105
|
control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
|
|
@@ -36,12 +36,10 @@ export default function ScalarList(props: ScalarListProps) {
|
|
|
36
36
|
{
|
|
37
37
|
type: componentType,
|
|
38
38
|
config: {
|
|
39
|
-
// @ts-ignore - Type '{ readOnly: true; displayInModal: boolean; value: any; displayMode: string; label: string; }' is not assignable to type 'ComponentMetadataConfig'.
|
|
40
39
|
value: scalarValue,
|
|
41
40
|
displayMode: 'DISPLAY_ONLY',
|
|
42
41
|
label,
|
|
43
42
|
...restProps,
|
|
44
|
-
// @ts-ignore - Type 'string' is not assignable to type 'boolean | undefined'.
|
|
45
43
|
readOnly: 'true'
|
|
46
44
|
}
|
|
47
45
|
},
|
package/lib/field/Time/Time.tsx
CHANGED
|
@@ -39,7 +39,7 @@ export default function Time(props: TimeProps) {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const handleChange = date => {
|
|
42
|
-
const theValue = date && date.isValid() ? date.format('HH:mm') : null;
|
|
42
|
+
const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
|
|
43
43
|
handleEvent(actions, 'changeNblur', propName, theValue);
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -80,10 +80,8 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
PCore.getRestClient()
|
|
83
|
-
// @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
|
|
84
|
-
// @ts-ignore - Expected 3 arguments, but got 2
|
|
85
83
|
.invokeRestApi('getListData', { queryPayload })
|
|
86
|
-
.then(
|
|
84
|
+
.then(res => {
|
|
87
85
|
const ddDataSource = res.data.data.map(listItem => ({
|
|
88
86
|
key: listItem.pyUserIdentifier,
|
|
89
87
|
value: listItem.pyUserName
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
1
|
export function isEmptyObject(obj: Object): boolean {
|
|
3
2
|
return Object.keys(obj).length === 0;
|
|
4
3
|
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get a localized value from the Generic Fields
|
|
7
|
+
* @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
|
|
8
|
+
* @param key - The key of the string to localize
|
|
9
|
+
* @returns The localized string or the key itself if no translation is found
|
|
10
|
+
*/
|
|
11
|
+
export function getGenericFieldsLocalizedValue(path: string, key: string): string {
|
|
12
|
+
const GENERIC_BUNDLE_KEY = PCore.getLocaleUtils().GENERIC_BUNDLE_KEY;
|
|
13
|
+
const localeStore = PCore.getLocaleUtils().localeStore[GENERIC_BUNDLE_KEY];
|
|
14
|
+
|
|
15
|
+
if (!localeStore) return key;
|
|
16
|
+
|
|
17
|
+
// Split the path and traverse the object
|
|
18
|
+
const pathParts = path.split('.');
|
|
19
|
+
let currentObj = localeStore;
|
|
20
|
+
|
|
21
|
+
for (const part of pathParts) {
|
|
22
|
+
if (!currentObj[part]) return key;
|
|
23
|
+
currentObj = currentObj[part];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return currentObj[key] || key;
|
|
27
|
+
}
|
|
@@ -5,10 +5,7 @@ import CurrencyMap from './CurrencyMap';
|
|
|
5
5
|
function NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}): string {
|
|
6
6
|
const currentLocale: string | undefined = getLocale(locale);
|
|
7
7
|
if (value !== null && value !== undefined) {
|
|
8
|
-
return Number(value).toLocaleString(currentLocale, {
|
|
9
|
-
minimumFractionDigits: decPlaces,
|
|
10
|
-
maximumFractionDigits: decPlaces
|
|
11
|
-
});
|
|
8
|
+
return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });
|
|
12
9
|
}
|
|
13
10
|
return value;
|
|
14
11
|
}
|
|
@@ -20,14 +17,16 @@ function CurrencyFormatter(
|
|
|
20
17
|
const currentLocale: string | undefined = getLocale(locale);
|
|
21
18
|
let formattedValue: string = value;
|
|
22
19
|
if (value !== null && value !== undefined && value !== '') {
|
|
23
|
-
formattedValue = NumberFormatter(value, {
|
|
24
|
-
locale: currentLocale,
|
|
25
|
-
decPlaces,
|
|
26
|
-
style,
|
|
27
|
-
currency
|
|
28
|
-
});
|
|
20
|
+
formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
// For currency other than EUR, we need to determine the country code from currency code
|
|
23
|
+
// If currency is EUR, we use the locale to determine the country code
|
|
24
|
+
let countryCode: string | undefined;
|
|
25
|
+
if (currency !== 'EUR') {
|
|
26
|
+
countryCode = currency.substring(0, 2);
|
|
27
|
+
} else {
|
|
28
|
+
countryCode = currentLocale?.split('-')[1].toUpperCase();
|
|
29
|
+
}
|
|
31
30
|
|
|
32
31
|
// If countryCode is still undefined, setting it as US
|
|
33
32
|
if (!countryCode) {
|
|
@@ -67,11 +66,7 @@ export default {
|
|
|
67
66
|
Currency: (value, options) => CurrencyFormatter(value, options),
|
|
68
67
|
'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),
|
|
69
68
|
Decimal: (value, options) => NumberFormatter(value, options),
|
|
70
|
-
'Decimal-Auto': (value, options) =>
|
|
71
|
-
NumberFormatter(value, {
|
|
72
|
-
...options,
|
|
73
|
-
decPlaces: Number.isInteger(value) ? 0 : 2
|
|
74
|
-
}),
|
|
69
|
+
'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),
|
|
75
70
|
Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),
|
|
76
71
|
Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })
|
|
77
72
|
};
|
|
@@ -7,7 +7,8 @@ export function getLocale(locale: string = '') {
|
|
|
7
7
|
return Intl.DateTimeFormat().resolvedOptions().locale;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function getCurrentTimezone(timezone
|
|
10
|
+
export function getCurrentTimezone(timezone?: string) {
|
|
11
|
+
// use timezone if specified
|
|
11
12
|
if (timezone) return timezone;
|
|
12
13
|
return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
|
|
13
14
|
}
|
|
@@ -18,10 +18,8 @@ function getDateObject(text): Date {
|
|
|
18
18
|
const day = parseInt(timeStamp.substr(6, 2), 10);
|
|
19
19
|
|
|
20
20
|
const date = new Date();
|
|
21
|
-
|
|
22
|
-
date.
|
|
23
|
-
date.setMonth(month);
|
|
24
|
-
date.setFullYear(year);
|
|
21
|
+
// Fix to handle all the dates, raised via https://github.com/pegasystems/react-sdk-components/issues/442
|
|
22
|
+
date.setFullYear(year, month, day);
|
|
25
23
|
|
|
26
24
|
if (isDateTime) {
|
|
27
25
|
const hours = parseInt(timeStamp.substr(9, 2), 10);
|
|
@@ -174,7 +174,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
174
174
|
|
|
175
175
|
savePromise
|
|
176
176
|
.then(() => {
|
|
177
|
-
// @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
|
|
178
177
|
const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
|
|
179
178
|
onSaveActionSuccess({ caseType, caseID, assignmentID });
|
|
180
179
|
})
|
|
@@ -189,10 +188,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
189
188
|
// check if create stage (modal)
|
|
190
189
|
const { PUB_SUB_EVENTS } = PCore.getConstants();
|
|
191
190
|
const { publish } = PCore.getPubSubUtils();
|
|
192
|
-
// @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
|
|
193
191
|
const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
|
|
194
192
|
const isLocalAction =
|
|
195
|
-
// @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
|
|
196
193
|
thePConn.getCaseInfo().isLocalAction() ||
|
|
197
194
|
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION && getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
|
|
198
195
|
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
|
|
@@ -275,7 +272,6 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
|
275
272
|
}
|
|
276
273
|
|
|
277
274
|
// expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
|
|
278
|
-
// @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
|
|
279
275
|
const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
|
|
280
276
|
const context = thePConn.getContextName();
|
|
281
277
|
const pageReference = thePConn.getPageReference();
|
|
@@ -6,9 +6,9 @@ import { Alert, Card, CardHeader, Avatar, Typography } from '@mui/material';
|
|
|
6
6
|
|
|
7
7
|
import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
|
|
8
8
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
9
|
-
import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
|
|
9
|
+
import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/infra/Containers/container-helpers';
|
|
10
10
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
11
|
-
import { withSimpleViewContainerRenderer } from '
|
|
11
|
+
import { withSimpleViewContainerRenderer } from '@pega/react-sdk-components/lib/components/infra/Containers/SimpleView/SimpleView';
|
|
12
12
|
|
|
13
13
|
import { addContainerItem, getToDoAssignments, showBanner, hasContainerItems } from './helpers';
|
|
14
14
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
@@ -117,12 +117,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
|
|
|
117
117
|
if (caseViewMode && caseViewMode === 'review') {
|
|
118
118
|
return true;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
if (caseViewMode && caseViewMode === 'perform') {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return true;
|
|
120
|
+
return !(caseViewMode && caseViewMode === 'perform');
|
|
126
121
|
}
|
|
127
122
|
|
|
128
123
|
function initComponent() {
|
|
@@ -181,11 +176,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
|
|
|
181
176
|
|
|
182
177
|
const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
183
178
|
// const allAssignments = [];
|
|
184
|
-
|
|
185
|
-
if (childCases && childCases.length > 0) {
|
|
186
|
-
return true;
|
|
187
|
-
}
|
|
188
|
-
return false;
|
|
179
|
+
return !!(childCases && childCases.length > 0);
|
|
189
180
|
}
|
|
190
181
|
|
|
191
182
|
function hasAssignments() {
|
|
@@ -275,10 +266,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
|
|
|
275
266
|
setHasCaseMessages(true);
|
|
276
267
|
setShowConfirm(true);
|
|
277
268
|
|
|
278
|
-
// publish this "assignmentFinished" for mashup, need to get approved as a standard
|
|
279
|
-
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
280
|
-
PCore.getPubSubUtils().publish('assignmentFinished');
|
|
281
|
-
|
|
282
269
|
// debugger;
|
|
283
270
|
setCheckSvg(Utils.getImageSrc('check', Utils.getSDKStaticConentUrl()));
|
|
284
271
|
} else {
|
|
@@ -88,11 +88,7 @@ export const hasAssignments = pConnect => {
|
|
|
88
88
|
const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
|
|
89
89
|
const childCasesAssignments = getChildCaseAssignments(pConnect);
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
if (assignments || childCasesAssignments || isCaseWideLocalAction(pConnect)) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
91
|
+
return !!(assignments || childCasesAssignments || isCaseWideLocalAction(pConnect));
|
|
96
92
|
};
|
|
97
93
|
|
|
98
94
|
export const showBanner = getPConnect => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, createElement } from 'react';
|
|
2
2
|
|
|
3
3
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
4
|
-
import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/helpers';
|
|
4
|
+
import { isContainerInitialized } from '@pega/react-sdk-components/lib/components/infra/Containers/container-helpers';
|
|
5
5
|
|
|
6
6
|
const processRootViewDetails = (rootView, containerItem, options) => {
|
|
7
7
|
const {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
2
|
-
/* eslint-disable operator-assignment */
|
|
3
2
|
import { forwardRef, PropsWithChildren, useEffect, useRef, useState } from 'react';
|
|
4
3
|
import { TextField } from '@mui/material';
|
|
5
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
@@ -20,7 +19,7 @@ interface DashboardFilterProps extends PConnProps {
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export default function DashboardFilter(props: PropsWithChildren<DashboardFilterProps>) {
|
|
23
|
-
const { children
|
|
22
|
+
const { children, name, filterProp, type = '', metadata = null, getPConnect } = props;
|
|
24
23
|
const { current: filterId } = useRef(uuidv4());
|
|
25
24
|
|
|
26
25
|
const [startDate, setStartDate] = useState(null);
|
|
@@ -35,7 +34,7 @@ export default function DashboardFilter(props: PropsWithChildren<DashboardFilter
|
|
|
35
34
|
} else if (type === 'RadioButtons') {
|
|
36
35
|
const reference = getPConnect().getFullReference() + filterProp;
|
|
37
36
|
const radList = document.getElementsByName(reference);
|
|
38
|
-
for (let i = 0; i < radList.length; i
|
|
37
|
+
for (let i = 0; i < radList.length; i += 1) {
|
|
39
38
|
if ((radList[i] as HTMLInputElement).value === '') {
|
|
40
39
|
(radList[i] as HTMLInputElement).checked = true;
|
|
41
40
|
} else {
|
|
@@ -46,7 +46,6 @@ export const createFilterComponent = (getPConnect, filterMeta, index) => {
|
|
|
46
46
|
}
|
|
47
47
|
let propInfo: any = PCore.getMetadataUtils().getPropertyMetadata(cleanedName, filterMeta.config.ruleClass);
|
|
48
48
|
if (!propInfo) {
|
|
49
|
-
// @ts-ignore - PCore.getMetadataUtils().getPropertyMetadata - An argument for 'currentClassID' was not provided.
|
|
50
49
|
propInfo = PCore.getMetadataUtils().getPropertyMetadata(cleanedName);
|
|
51
50
|
}
|
|
52
51
|
const { type: propertyType } = propInfo || { type: 'Text' };
|
|
@@ -78,11 +77,10 @@ export const buildFilterComponents = (getPConnect, allFilters) => {
|
|
|
78
77
|
const filterComponents = allFilters.children.map((filter, index) => createFilterComponent(getPConnect, filter, index));
|
|
79
78
|
if (filterComponents && filterComponents.length > 0) {
|
|
80
79
|
filterComponents.push(
|
|
81
|
-
<Grid>
|
|
80
|
+
<Grid style={{ display: 'flex', alignItems: 'center' }}>
|
|
82
81
|
<Link
|
|
83
82
|
style={{ cursor: 'pointer' }}
|
|
84
83
|
onClick={() => {
|
|
85
|
-
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
86
84
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL);
|
|
87
85
|
}}
|
|
88
86
|
underline='hover'
|
|
@@ -12,6 +12,7 @@ interface DeferLoadProps extends PConnProps {
|
|
|
12
12
|
isChildDeferLoad?: boolean;
|
|
13
13
|
isTab: boolean;
|
|
14
14
|
deferLoadId: string;
|
|
15
|
+
lastUpdateCaseTime: any;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
//
|
|
@@ -34,7 +35,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
34
35
|
}));
|
|
35
36
|
|
|
36
37
|
export default function DeferLoad(props: DeferLoadProps) {
|
|
37
|
-
const { getPConnect, name, deferLoadId, isTab } = props;
|
|
38
|
+
const { getPConnect, name, deferLoadId, isTab, lastUpdateCaseTime } = props;
|
|
38
39
|
const [content, setContent] = useState<any>(null);
|
|
39
40
|
const [isLoading, setLoading] = useState(true);
|
|
40
41
|
const [currentLoadedAssignment, setCurrentLoadedAssignment] = useState('');
|
|
@@ -113,7 +114,6 @@ export default function DeferLoad(props: DeferLoadProps) {
|
|
|
113
114
|
getPConnect()
|
|
114
115
|
.getActionsApi()
|
|
115
116
|
.showData(name, dataContext, dataContextParameters, {
|
|
116
|
-
// @ts-ignore - Type 'boolean' is not assignable to type 'string'
|
|
117
117
|
skipSemanticUrl: true,
|
|
118
118
|
// @ts-ignore
|
|
119
119
|
isDeferLoaded: true
|
|
@@ -145,7 +145,7 @@ export default function DeferLoad(props: DeferLoadProps) {
|
|
|
145
145
|
console.log(`deferload: ${error}`);
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
}, [name, getPConnect, currentLoadedAssignment]);
|
|
148
|
+
}, [name, getPConnect, currentLoadedAssignment, lastUpdateCaseTime]);
|
|
149
149
|
/* TODO Cosmos need to handle for now added a wrapper div with pos relative */
|
|
150
150
|
let deferLoadContent;
|
|
151
151
|
if (isLoading) {
|
|
@@ -71,12 +71,7 @@ export default function MultiStep(props: PropsWithChildren<MultiStepProps>) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function _showHLine(index: number): boolean {
|
|
74
|
-
|
|
75
|
-
if (index < arNavigationSteps.length - 1) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return false;
|
|
74
|
+
return index < arNavigationSteps.length - 1;
|
|
80
75
|
}
|
|
81
76
|
|
|
82
77
|
function buttonPress(sAction: string, sButtonType: string) {
|
|
@@ -179,7 +179,7 @@ export default function RootContainer(props: PropsWithChildren<RootContainerProp
|
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
if (prevRootConfig
|
|
182
|
+
if (prevRootConfig === null || !PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
|
|
183
183
|
rootView.current = createElement(createPConnectComponent(), PCore.createPConnect(currentRootConfig)) as any;
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -19,6 +19,7 @@ interface CaseViewProps extends PConnProps {
|
|
|
19
19
|
header: string;
|
|
20
20
|
showIconInHeader: boolean;
|
|
21
21
|
caseInfo: any;
|
|
22
|
+
lastUpdateCaseTime: any;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const useStyles = makeStyles(theme => ({
|
|
@@ -64,10 +65,10 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
64
65
|
showIconInHeader = true,
|
|
65
66
|
caseInfo: { availableActions = [], availableProcesses = [], hasNewAttachments, caseTypeID = '', caseTypeName = '' }
|
|
66
67
|
} = props;
|
|
68
|
+
const { lastUpdateCaseTime = getPConnect().getValue('caseInfo.lastUpdateTime') } = props;
|
|
67
69
|
|
|
68
70
|
const currentCaseID = props.caseInfo.ID;
|
|
69
71
|
let isComponentMounted = true;
|
|
70
|
-
|
|
71
72
|
const { displayOnlyFA } = useContext<any>(StoreContext);
|
|
72
73
|
|
|
73
74
|
const thePConn = getPConnect();
|
|
@@ -79,7 +80,6 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
79
80
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
80
81
|
const localeCategory = 'CaseView';
|
|
81
82
|
const localeKey = `${caseTypeID}!CASE!${caseTypeName}`.toUpperCase();
|
|
82
|
-
|
|
83
83
|
/**
|
|
84
84
|
*
|
|
85
85
|
* @param inName the metadata <em>name</em> that will cause a region to be returned
|
|
@@ -169,7 +169,6 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
169
169
|
|
|
170
170
|
useEffect(() => {
|
|
171
171
|
if (hasNewAttachments) {
|
|
172
|
-
// @ts-ignore - Argument of type 'boolean' is not assignable to parameter of type 'object'
|
|
173
172
|
PCore.getPubSubUtils().publish((PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW, true);
|
|
174
173
|
}
|
|
175
174
|
}, [hasNewAttachments]);
|
|
@@ -244,7 +243,9 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
|
244
243
|
<Grid item xs={6}>
|
|
245
244
|
{theStagesRegion}
|
|
246
245
|
{theTodoRegion}
|
|
247
|
-
{deferLoadInfo.length > 0 &&
|
|
246
|
+
{deferLoadInfo.length > 0 && (
|
|
247
|
+
<DeferLoad getPConnect={getPConnect} name={deferLoadInfo[activeVertTab].config.name} isTab lastUpdateCaseTime={lastUpdateCaseTime} />
|
|
248
|
+
)}
|
|
248
249
|
</Grid>
|
|
249
250
|
|
|
250
251
|
<Grid item xs={3}>
|
|
@@ -26,7 +26,6 @@ function DynamicTabs(props: DynamicTabsProps) {
|
|
|
26
26
|
// Get the inherited props from the parent to determine label settings
|
|
27
27
|
const propsToUse = { label, showLabel, ...pConnect.getInheritedProps() };
|
|
28
28
|
const defaultTabIndex = 0;
|
|
29
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
30
29
|
const { tablabel } = pConnect.getComponentConfig();
|
|
31
30
|
const tablabelProp = PCore.getAnnotationUtils().getPropertyName(tablabel);
|
|
32
31
|
const referenceListData: any = pConnect.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
@@ -58,7 +58,6 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
|
|
|
58
58
|
if (PCore.getPCoreVersion()?.includes('8.7')) {
|
|
59
59
|
pConn.getListActions().insert({ classID: contextClass }, referenceList.length, pageReference);
|
|
60
60
|
} else {
|
|
61
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
62
61
|
pConn.getListActions().insert({}, referenceList.length);
|
|
63
62
|
}
|
|
64
63
|
};
|
|
@@ -71,7 +70,6 @@ export default function FieldGroupTemplate(props: FieldGroupTemplateProps) {
|
|
|
71
70
|
if (PCore.getPCoreVersion()?.includes('8.7')) {
|
|
72
71
|
pConn.getListActions().deleteEntry(index, pageReference);
|
|
73
72
|
} else {
|
|
74
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
75
73
|
pConn.getListActions().deleteEntry(index);
|
|
76
74
|
}
|
|
77
75
|
};
|
|
@@ -43,6 +43,7 @@ import { filterData } from '@pega/react-sdk-components/lib/components/helpers/si
|
|
|
43
43
|
import './ListView.css';
|
|
44
44
|
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
45
45
|
import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
46
|
+
import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
46
47
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
47
48
|
|
|
48
49
|
import useInit from './hooks';
|
|
@@ -109,7 +110,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
109
110
|
});
|
|
110
111
|
|
|
111
112
|
const thePConn = getPConnect();
|
|
112
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
113
113
|
const componentConfig = thePConn.getComponentConfig();
|
|
114
114
|
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
115
115
|
|
|
@@ -222,11 +222,12 @@ export default function ListView(props: ListViewProps) {
|
|
|
222
222
|
|
|
223
223
|
type Order = 'asc' | 'desc';
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
interface Comparator<T> {
|
|
226
|
+
(a: T, b: T): number;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function getComparator<T, Key extends keyof T>(theOrder: Order, orderedBy: Key): Comparator<T> {
|
|
230
|
+
return theOrder === 'desc' ? (a: T, b: T) => descendingComparator(a, b, orderedBy) : (a: T, b: T) => -descendingComparator(a, b, orderedBy);
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
@@ -642,7 +643,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
642
643
|
|
|
643
644
|
thePConn
|
|
644
645
|
.getActionsApi()
|
|
645
|
-
// @ts-ignore
|
|
646
646
|
.openAssignment(pzInsKey, pxRefObjectClass, options)
|
|
647
647
|
.then(() => {
|
|
648
648
|
// console.log("openAssignment successful");
|
|
@@ -875,7 +875,6 @@ export default function ListView(props: ListViewProps) {
|
|
|
875
875
|
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
876
876
|
}
|
|
877
877
|
if (column.isAssignmentLink) {
|
|
878
|
-
// @ts-ignore
|
|
879
878
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
880
879
|
containerName: 'primary',
|
|
881
880
|
channelName: ''
|
|
@@ -1131,7 +1130,9 @@ export default function ListView(props: ListViewProps) {
|
|
|
1131
1130
|
})}
|
|
1132
1131
|
</TableBody>
|
|
1133
1132
|
</Table>
|
|
1134
|
-
{arRows && arRows.length === 0 &&
|
|
1133
|
+
{arRows && arRows.length === 0 && (
|
|
1134
|
+
<div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
|
|
1135
|
+
)}
|
|
1135
1136
|
</TableContainer>
|
|
1136
1137
|
)}
|
|
1137
1138
|
</>
|
|
@@ -202,7 +202,6 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
|
202
202
|
if (value.includes('[')) {
|
|
203
203
|
value = value.substring(0, value.indexOf('[')) + value.substring(value.indexOf(']') + 1);
|
|
204
204
|
}
|
|
205
|
-
// @ts-ignore - Expected 3 arguments, but got 2.
|
|
206
205
|
const meta: any = PCore.getMetadataUtils().getEmbeddedPropertyMetadata(value, classID);
|
|
207
206
|
meta.fieldID = field;
|
|
208
207
|
configEmbeddedFieldsMeta.push(meta);
|
|
@@ -87,7 +87,6 @@ export default function PromotedFilters(props: PromotedFilterProps) {
|
|
|
87
87
|
};
|
|
88
88
|
return getPConnect().getContainerManager().addTransientItem({
|
|
89
89
|
id: viewName,
|
|
90
|
-
// @ts-ignore - Property 'coreHeaders' is missing in type '{ classID: string; }' but required in type '{ coreHeaders: any; }'.
|
|
91
90
|
data: filtersWithClassID
|
|
92
91
|
});
|
|
93
92
|
}, []);
|
|
@@ -50,11 +50,9 @@ export default function SimpleTable(props: SimpleTableProps) {
|
|
|
50
50
|
|
|
51
51
|
let { contextClass } = props;
|
|
52
52
|
if (!contextClass) {
|
|
53
|
-
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
54
53
|
let listName = getPConnect().getComponentConfig().referenceList;
|
|
55
54
|
listName = PCore.getAnnotationUtils().getPropertyName(listName);
|
|
56
55
|
// was... contextClass = getPConnect().getFieldMetadata(listName)?.pageClass;
|
|
57
|
-
// @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
|
|
58
56
|
const theFieldMetadata = getPConnect().getFieldMetadata(listName);
|
|
59
57
|
if (theFieldMetadata) {
|
|
60
58
|
contextClass = theFieldMetadata.pageClass;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-nested-ternary */
|
|
2
1
|
import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
2
|
import Table from '@mui/material/Table';
|
|
4
3
|
import TableBody from '@mui/material/TableBody';
|
|
@@ -28,6 +27,7 @@ import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react
|
|
|
28
27
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
29
28
|
import { getReferenceList } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
|
|
30
29
|
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
30
|
+
import { getGenericFieldsLocalizedValue } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
31
31
|
import { buildFieldsForTable, filterData, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
32
32
|
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
33
33
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
@@ -147,7 +147,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
147
147
|
const [displayDialogDateFilter, setDisplayDialogDateFilter] = useState<string>('notequal');
|
|
148
148
|
const [displayDialogDateValue, setDisplayDialogDateValue] = useState<string>('');
|
|
149
149
|
const selectedRowIndex: any = useRef(null);
|
|
150
|
-
|
|
150
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
151
|
+
const localeCategory = 'SimpleTable';
|
|
151
152
|
const parameters = fieldMetadata?.datasource?.parameters;
|
|
152
153
|
const { referenceListStr } = getContext(getPConnect());
|
|
153
154
|
const label = labelProp || propertyLabel;
|
|
@@ -193,13 +194,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
193
194
|
});
|
|
194
195
|
|
|
195
196
|
useEffect(() => {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
buildElementsForTable();
|
|
199
|
-
}
|
|
200
|
-
}, [referenceList.length]);
|
|
201
|
-
|
|
202
|
-
useEffect(() => {
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
198
|
+
buildElementsForTable();
|
|
203
199
|
if (readOnlyMode || allowEditingInModal) {
|
|
204
200
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
205
201
|
generateRowsData();
|
|
@@ -218,7 +214,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
218
214
|
if (allowEditingInModal) {
|
|
219
215
|
getPConnect()
|
|
220
216
|
.getListActions()
|
|
221
|
-
// @ts-ignore - An argument for 'uniqueField' was not provided.
|
|
222
217
|
.initDefaultPageInstructions(
|
|
223
218
|
getPConnect().getReferenceList(),
|
|
224
219
|
fieldDefs.filter(item => item.name).map(item => item.name)
|
|
@@ -326,7 +321,6 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
326
321
|
// @ts-ignore
|
|
327
322
|
.openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
|
|
328
323
|
} else {
|
|
329
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
330
324
|
pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
|
|
331
325
|
}
|
|
332
326
|
|
|
@@ -353,12 +347,10 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
353
347
|
|
|
354
348
|
const deleteRecord = () => {
|
|
355
349
|
setEditAnchorEl(null);
|
|
356
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
357
350
|
pConn.getListActions().deleteEntry(selectedRowIndex.current);
|
|
358
351
|
};
|
|
359
352
|
|
|
360
353
|
const deleteRecordFromInlineEditable = (index: number) => {
|
|
361
|
-
// @ts-ignore - An argument for 'pageRef' was not provided.
|
|
362
354
|
pConn.getListActions().deleteEntry(index);
|
|
363
355
|
};
|
|
364
356
|
|
|
@@ -368,7 +360,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
368
360
|
const data: any = [];
|
|
369
361
|
rawFields.forEach(item => {
|
|
370
362
|
// removing label field from config to hide title in the table cell
|
|
371
|
-
item = { ...item, config: { ...item.config, label: '' } };
|
|
363
|
+
item = { ...item, config: { ...item.config, label: '', displayMode: readOnlyMode || allowEditingInModal ? 'DISPLAY_ONLY' : undefined } };
|
|
372
364
|
const referenceListData = getReferenceList(pConn);
|
|
373
365
|
const isDatapage = referenceListData.startsWith('D_');
|
|
374
366
|
const pageReferenceValue = isDatapage
|
|
@@ -416,11 +408,12 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
416
408
|
|
|
417
409
|
type Order = 'asc' | 'desc';
|
|
418
410
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
411
|
+
interface Comparator<T> {
|
|
412
|
+
(a: T, b: T): number;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function getComparator<Key extends keyof any, T extends Record<Key, any>>(theOrder: Order, orderedBy: Key): Comparator<T> {
|
|
416
|
+
return theOrder === 'desc' ? (a: T, b: T) => descendingComparator<T>(a, b, orderedBy) : (a: T, b: T) => -descendingComparator<T>(a, b, orderedBy);
|
|
424
417
|
}
|
|
425
418
|
|
|
426
419
|
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
@@ -432,7 +425,11 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
432
425
|
return a[1] - b[1];
|
|
433
426
|
});
|
|
434
427
|
|
|
435
|
-
|
|
428
|
+
const newElements = new Array(stabilizedThis.length);
|
|
429
|
+
stabilizedThis.forEach((el, index) => {
|
|
430
|
+
newElements[index] = elements[el[1]];
|
|
431
|
+
});
|
|
432
|
+
return newElements;
|
|
436
433
|
}
|
|
437
434
|
|
|
438
435
|
function _menuClick(event, columnId: string, columnType: string, labelValue: string) {
|
|
@@ -613,9 +610,10 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
613
610
|
{fieldDefs.map((field: any, index) => {
|
|
614
611
|
return (
|
|
615
612
|
<TableCell key={`head-${displayedColumns[index]}`} className={classes.tableCell}>
|
|
616
|
-
{readOnlyMode ? (
|
|
617
|
-
<div>
|
|
613
|
+
{(readOnlyMode || allowEditingInModal) && field.cellRenderer !== 'DeleteIcon' ? (
|
|
614
|
+
<div style={{ display: 'flex' }}>
|
|
618
615
|
<TableSortLabel
|
|
616
|
+
style={{ width: '75%' }}
|
|
619
617
|
active={orderBy === displayedColumns[index]}
|
|
620
618
|
direction={orderBy === displayedColumns[index] ? order : 'asc'}
|
|
621
619
|
onClick={createSortHandler(displayedColumns[index])}
|
|
@@ -627,8 +625,8 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
627
625
|
) : null}
|
|
628
626
|
</TableSortLabel>
|
|
629
627
|
<MoreIcon
|
|
628
|
+
style={{ cursor: 'pointer', zIndex: 1000 }}
|
|
630
629
|
id='menu-icon'
|
|
631
|
-
className={classes.moreIcon}
|
|
632
630
|
onClick={event => {
|
|
633
631
|
_menuClick(event, field.name, field.meta.type, field.label);
|
|
634
632
|
}}
|
|
@@ -644,6 +642,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
644
642
|
</TableHead>
|
|
645
643
|
<TableBody>
|
|
646
644
|
{editableMode &&
|
|
645
|
+
!allowEditingInModal &&
|
|
647
646
|
elements.map((row: any, index) => {
|
|
648
647
|
const theKey = `row-${index}`;
|
|
649
648
|
return (
|
|
@@ -681,53 +680,46 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
|
|
|
681
680
|
return (
|
|
682
681
|
// eslint-disable-next-line react/no-array-index-key
|
|
683
682
|
<TableRow key={index}>
|
|
684
|
-
{
|
|
683
|
+
{row.map((item, childIndex) => {
|
|
684
|
+
const theColKey = displayedColumns[childIndex];
|
|
685
685
|
return (
|
|
686
|
-
<TableCell key={
|
|
687
|
-
{
|
|
688
|
-
<div>
|
|
689
|
-
<MoreIcon
|
|
690
|
-
id='table-edit-menu-icon'
|
|
691
|
-
className={classes.moreIcon}
|
|
692
|
-
onClick={event => {
|
|
693
|
-
editMenuClick(event, index);
|
|
694
|
-
}}
|
|
695
|
-
/>
|
|
696
|
-
<Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
|
|
697
|
-
<MenuItem onClick={() => editRecord()}>Edit</MenuItem>
|
|
698
|
-
<MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
|
|
699
|
-
</Menu>
|
|
700
|
-
</div>
|
|
701
|
-
) : typeof row[colKey] === 'boolean' && !row[colKey] ? (
|
|
702
|
-
'False'
|
|
703
|
-
) : typeof row[colKey] === 'boolean' && row[colKey] ? (
|
|
704
|
-
'True'
|
|
705
|
-
) : (
|
|
706
|
-
row[colKey] || '---'
|
|
707
|
-
)}
|
|
686
|
+
<TableCell key={theColKey} className={classes.tableCell}>
|
|
687
|
+
{item}
|
|
708
688
|
</TableCell>
|
|
709
689
|
);
|
|
710
690
|
})}
|
|
691
|
+
{showDeleteButton && (
|
|
692
|
+
<TableCell key='DeleteIcon' className={classes.tableCell}>
|
|
693
|
+
<div>
|
|
694
|
+
<MoreIcon
|
|
695
|
+
id='table-edit-menu-icon'
|
|
696
|
+
className={classes.moreIcon}
|
|
697
|
+
onClick={event => {
|
|
698
|
+
editMenuClick(event, index);
|
|
699
|
+
}}
|
|
700
|
+
/>
|
|
701
|
+
<Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
|
|
702
|
+
<MenuItem onClick={() => editRecord()}>Edit</MenuItem>
|
|
703
|
+
<MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
|
|
704
|
+
</Menu>
|
|
705
|
+
</div>
|
|
706
|
+
</TableCell>
|
|
707
|
+
)}
|
|
711
708
|
</TableRow>
|
|
712
709
|
);
|
|
713
710
|
})}
|
|
714
711
|
</TableBody>
|
|
715
712
|
</Table>
|
|
716
|
-
{readOnlyMode && rowData
|
|
717
|
-
<div className='no-records' id='no-records'>
|
|
718
|
-
No records found.
|
|
719
|
-
</div>
|
|
720
|
-
)}
|
|
721
|
-
{editableMode && referenceList && referenceList.length === 0 && (
|
|
713
|
+
{((readOnlyMode && (!rowData || rowData?.length === 0)) || (editableMode && (!referenceList || referenceList?.length === 0))) && (
|
|
722
714
|
<div className='no-records' id='no-records'>
|
|
723
|
-
No records found.
|
|
715
|
+
{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}
|
|
724
716
|
</div>
|
|
725
717
|
)}
|
|
726
718
|
</TableContainer>
|
|
727
719
|
{showAddRowButton && (
|
|
728
720
|
<div style={{ fontSize: '1rem' }}>
|
|
729
721
|
<Link style={{ cursor: 'pointer' }} onClick={addRecord} underline='hover'>
|
|
730
|
-
+ Add
|
|
722
|
+
+ {localizedVal('Add', localeCategory)}
|
|
731
723
|
</Link>
|
|
732
724
|
</div>
|
|
733
725
|
)}
|
|
@@ -57,10 +57,8 @@ export default function SimpleTableSelect(props: SimpleTableSelectProps) {
|
|
|
57
57
|
|
|
58
58
|
// Need to get this written so typedefs work
|
|
59
59
|
const { datasource: { parameters: fieldParameters = {} } = {}, pageClass } = isMultiSelectMode
|
|
60
|
-
?
|
|
61
|
-
|
|
62
|
-
: // @ts-ignore - Property 'getCurrentPageFieldMetadata' is private and only accessible within class 'C11nEnv'.
|
|
63
|
-
pConn.getCurrentPageFieldMetadata(contextPageReference);
|
|
60
|
+
? pConn.getFieldMetadata(`@P .${referenceProp}`)
|
|
61
|
+
: pConn.getCurrentPageFieldMetadata(contextPageReference);
|
|
64
62
|
|
|
65
63
|
const compositeKeys: any[] = [];
|
|
66
64
|
Object.values(fieldParameters).forEach((param: any) => {
|
|
@@ -155,11 +155,9 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
155
155
|
const context = pConn.getContextName();
|
|
156
156
|
// set errors to property to block submit even on errors in file upload
|
|
157
157
|
PCore.getMessageManager().addMessages({
|
|
158
|
-
// @ts-ignore
|
|
159
158
|
messages: [
|
|
160
159
|
{
|
|
161
160
|
type: 'error',
|
|
162
|
-
// @ts-ignore - Type '{ type: string; message: string; }' is not assignable to type 'MessagesConfigObject'.
|
|
163
161
|
message: pConn.getLocalizedValue('Error with one or more files', '', '')
|
|
164
162
|
}
|
|
165
163
|
],
|
|
@@ -192,7 +190,6 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
192
190
|
const clearFieldErrorMessages = () => {
|
|
193
191
|
const fieldName = (pConn.getStateProps() as any).value;
|
|
194
192
|
const context = pConn.getContextName();
|
|
195
|
-
// @ts-ignore
|
|
196
193
|
PCore.getMessageManager().clearMessages({
|
|
197
194
|
type: PCore.getConstants().MESSAGES.MESSAGES_TYPE_ERROR,
|
|
198
195
|
property: fieldName,
|
|
@@ -231,11 +228,9 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
231
228
|
const fieldName = (pConn.getStateProps() as any).value;
|
|
232
229
|
const context = pConn.getContextName();
|
|
233
230
|
PCore.getMessageManager().addMessages({
|
|
234
|
-
// @ts-ignore
|
|
235
231
|
messages: [
|
|
236
232
|
{
|
|
237
233
|
type: 'error',
|
|
238
|
-
// @ts-ignore - Type '{ type: string; message: string; }' is not assignable to type 'MessagesConfigObject'.
|
|
239
234
|
message: pConn.getLocalizedValue('Error with one or more files', '', '')
|
|
240
235
|
}
|
|
241
236
|
],
|
|
@@ -512,7 +512,7 @@ export default function FileUtility(props: FileUtilityProps) {
|
|
|
512
512
|
>
|
|
513
513
|
<MoreVertIcon />
|
|
514
514
|
</IconButton>
|
|
515
|
-
<Menu
|
|
515
|
+
<Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
|
|
516
516
|
<MenuItem style={{ fontSize: '14px' }} onClick={onAddFilesClick}>
|
|
517
517
|
{thePConn.getLocalizedValue('Add files', '', '')}
|
|
518
518
|
</MenuItem>{' '}
|
|
@@ -35,7 +35,6 @@ export default function QuickCreate(props: QuickCreateProps) {
|
|
|
35
35
|
const defaultCases: any = [];
|
|
36
36
|
const envInfo = PCore.getEnvironmentInfo();
|
|
37
37
|
if (envInfo?.environmentInfoObject?.pyCaseTypeList) {
|
|
38
|
-
// @ts-ignore - Property 'forEach' does not exist on type 'string'
|
|
39
38
|
envInfo.environmentInfoObject.pyCaseTypeList.forEach(casetype => {
|
|
40
39
|
if (casetype.pyWorkTypeName && casetype.pyWorkTypeImplementationClassName) {
|
|
41
40
|
defaultCases.push({
|
|
@@ -73,7 +73,7 @@ export default function SummaryItem(props: SummaryItemProps) {
|
|
|
73
73
|
>
|
|
74
74
|
<MoreVertIcon />
|
|
75
75
|
</IconButton>
|
|
76
|
-
<Menu
|
|
76
|
+
<Menu id='file-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
|
|
77
77
|
{item.actions &&
|
|
78
78
|
item.actions.map(option => (
|
|
79
79
|
<MenuItem style={{ fontSize: '14px' }} key={option.id || option.text} onClick={option.onClick}>
|
package/package.json
CHANGED
|
File without changes
|