@pega/react-sdk-overrides 24.2.10 → 25.1.10
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/Banner/Banner.css +1 -1
- package/lib/designSystemExtension/Banner/Banner.tsx +10 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +53 -37
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -13
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +8 -9
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +9 -9
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +8 -9
- package/lib/designSystemExtension/Operator/Operator.tsx +21 -19
- package/lib/designSystemExtension/Pulse/Pulse.tsx +1 -1
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +32 -4
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +7 -14
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +13 -2
- package/lib/field/AutoComplete/AutoComplete.tsx +1 -1
- package/lib/field/CancelAlert/CancelAlert.css +4 -4
- package/lib/field/CancelAlert/CancelAlert.tsx +7 -10
- package/lib/field/Checkbox/Checkbox.tsx +97 -4
- package/lib/field/Currency/Currency.tsx +10 -7
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +8 -8
- package/lib/field/DateTime/DateTime.tsx +16 -13
- package/lib/field/Decimal/Decimal.tsx +10 -7
- package/lib/field/Dropdown/Dropdown.tsx +30 -25
- package/lib/field/Email/Email.tsx +11 -13
- package/lib/field/Group/Group.tsx +10 -8
- package/lib/field/Integer/Integer.tsx +5 -7
- package/lib/field/Location/Location.css +4 -0
- package/lib/field/Location/Location.tsx +258 -0
- package/lib/field/Location/config-ext.json +8 -0
- package/lib/field/Location/index.tsx +1 -0
- package/lib/field/Multiselect/utils.ts +1 -1
- package/lib/field/ObjectReference/ObjectReference.tsx +235 -0
- package/lib/field/ObjectReference/index.tsx +1 -0
- package/lib/field/ObjectReference/utils.ts +111 -0
- package/lib/field/Percentage/Percentage.tsx +9 -9
- package/lib/field/Phone/Phone.tsx +7 -5
- package/lib/field/RadioButtons/RadioButtons.tsx +47 -5
- package/lib/field/RichText/RichText.css +79 -0
- package/lib/field/RichText/RichText.tsx +3 -1
- package/lib/field/ScalarList/ScalarList.tsx +2 -4
- package/lib/field/SelectableCard/SelectableCard.tsx +175 -0
- package/lib/field/SelectableCard/index.tsx +1 -0
- package/lib/field/SelectableCard/utils.tsx +223 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +160 -28
- package/lib/field/SemanticLink/utils.ts +1 -1
- package/lib/field/TextArea/TextArea.tsx +5 -7
- package/lib/field/TextContent/TextContent.tsx +1 -2
- package/lib/field/TextInput/TextInput.tsx +5 -7
- package/lib/field/Time/Time.tsx +4 -8
- package/lib/field/URL/URL.tsx +5 -7
- package/lib/field/UserReference/UserReference.tsx +3 -6
- package/lib/helpers/attachmentShared.ts +6 -0
- package/lib/helpers/common-utils.ts +24 -2
- package/lib/helpers/data_page.ts +0 -1
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Currency.ts +20 -20
- package/lib/helpers/formatters/CurrencyMap.ts +0 -2
- package/lib/helpers/formatters/common.ts +2 -1
- package/lib/helpers/formatters/index.ts +2 -4
- package/lib/helpers/object-utils.ts +10 -0
- package/lib/helpers/simpleTableHelpers.ts +118 -6
- package/lib/helpers/utils.ts +8 -1
- package/lib/helpers/versionHelpers.ts +0 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +28 -21
- package/lib/infra/Assignment/Assignment.tsx +39 -36
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +21 -113
- package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +4 -3
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +7 -6
- package/lib/infra/Containers/SimpleView/helper.ts +1 -1
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +4 -5
- package/lib/infra/Containers/container-helpers.ts +52 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +5 -9
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -6
- package/lib/infra/DeferLoad/DeferLoad.tsx +7 -9
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
- package/lib/infra/MultiStep/MultiStep.css +48 -70
- package/lib/infra/MultiStep/MultiStep.tsx +27 -58
- package/lib/infra/NavBar/NavBar.css +1 -1
- package/lib/infra/NavBar/NavBar.tsx +43 -32
- package/lib/infra/Reference/Reference.tsx +3 -4
- package/lib/infra/Region/Region.tsx +1 -1
- package/lib/infra/RootContainer/RootContainer.tsx +3 -4
- package/lib/infra/Stages/Stages.tsx +3 -4
- package/lib/infra/View/View.tsx +4 -3
- package/lib/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
- package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
- package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +244 -0
- package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
- package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
- package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
- package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
- package/lib/template/AdvancedSearch/config-ext.json +9 -0
- package/lib/template/AdvancedSearch/index.tsx +1 -0
- package/lib/template/AppShell/AppShell.css +1 -1
- package/lib/template/AppShell/AppShell.tsx +22 -23
- package/lib/template/BannerPage/BannerPage.tsx +2 -2
- package/lib/template/CaseSummary/CaseSummary.tsx +28 -41
- package/lib/template/CaseView/CaseView.tsx +32 -38
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
- package/lib/template/Confirmation/Confirmation.tsx +3 -4
- package/lib/template/DataReference/DataReference.tsx +312 -106
- package/lib/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
- package/lib/template/DataReference/SearchForm.tsx +149 -0
- package/lib/template/DataReference/utils.ts +90 -0
- package/lib/template/DefaultForm/DefaultForm.tsx +3 -3
- package/lib/template/DefaultForm/utils/index.ts +1 -3
- package/lib/template/DefaultPage/DefaultPage.tsx +108 -0
- package/lib/template/DefaultPage/index.tsx +1 -0
- package/lib/template/Details/Details/Details.tsx +11 -11
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +2 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +11 -11
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +11 -11
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +1 -2
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +2 -5
- package/lib/template/InlineDashboard/InlineDashboard.tsx +14 -16
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
- package/lib/template/ListPage/ListPage.tsx +1 -1
- package/lib/template/ListView/ListView.tsx +285 -204
- package/lib/template/ListView/hooks.ts +1 -5
- package/lib/template/ListView/utils.ts +38 -6
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +5 -5
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +11 -11
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -7
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
- package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -3
- package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +145 -0
- package/lib/template/SelfServiceCaseView/index.tsx +1 -0
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -5
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +99 -84
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +3 -5
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +10 -2
- package/lib/template/SubTabs/SubTabs.tsx +2 -2
- package/lib/template/SubTabs/tabUtils.ts +118 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +9 -10
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +9 -10
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +5 -5
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +11 -11
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
- package/lib/template/WssNavBar/WssNavBar.css +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +6 -6
- package/lib/template/utils.tsx +58 -0
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +1 -1
- package/lib/widget/Attachment/Attachment.css +7 -8
- package/lib/widget/Attachment/Attachment.tsx +304 -231
- package/lib/widget/Attachment/Attachment.types.ts +96 -0
- package/lib/widget/Attachment/AttachmentUtils.ts +316 -0
- package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +3 -3
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +7 -6
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +30 -23
- package/lib/widget/Followers/Followers.tsx +2 -4
- package/lib/widget/QuickCreate/QuickCreate.tsx +1 -3
- package/lib/widget/SummaryItem/SummaryItem.css +9 -11
- package/lib/widget/SummaryItem/SummaryItem.tsx +3 -3
- package/lib/widget/SummaryList/SummaryList.tsx +1 -1
- package/lib/widget/ToDo/ToDo.css +1 -13
- package/lib/widget/ToDo/ToDo.tsx +38 -37
- package/package.json +1 -1
- package/lib/helpers/attachmentHelpers.ts +0 -76
- package/lib/infra/Containers/helpers.ts +0 -6
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
2
|
+
|
|
3
|
+
export const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
4
|
+
|
|
5
|
+
const getLeafNameFromPropertyName = property => property?.substr(property.lastIndexOf('.'));
|
|
6
|
+
|
|
7
|
+
const isSelfReferencedProperty = (param, referenceProp) => param === referenceProp?.split('.', 2)[1];
|
|
8
|
+
|
|
9
|
+
export const AT_FILTEREDLIST = '@FILTERED_LIST';
|
|
10
|
+
export const AT_PROPERTY = '@P';
|
|
11
|
+
export const SQUARE_BRACKET_START = '[';
|
|
12
|
+
export const SQUARE_BRACKET_END = ']';
|
|
13
|
+
|
|
14
|
+
export const SIMPLE_TABLE_MANUAL_READONLY = 'SimpleTableManualReadOnly';
|
|
15
|
+
export const PAGE = '!P!';
|
|
16
|
+
export const PAGELIST = '!PL!';
|
|
17
|
+
export const PERIOD = '.';
|
|
18
|
+
const AT = '@';
|
|
19
|
+
|
|
20
|
+
export function updatePageListPropertyValue(value) {
|
|
21
|
+
value = value.substring(0, value.indexOf(SQUARE_BRACKET_START)) + value.substring(value.indexOf(SQUARE_BRACKET_END) + 1);
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getPropertyValue(value) {
|
|
26
|
+
if (value.startsWith(AT)) {
|
|
27
|
+
value = value.substring(value.indexOf(' ') + 1);
|
|
28
|
+
if (value.startsWith(PERIOD)) value = value.substring(1);
|
|
29
|
+
}
|
|
30
|
+
if (value.includes(SQUARE_BRACKET_START)) {
|
|
31
|
+
value = updatePageListPropertyValue(value);
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const getCompositeKeys = (c11nEnv, property) => {
|
|
37
|
+
const { datasource: { parameters = {} } = {} } = c11nEnv.getFieldMetadata(property) || {};
|
|
38
|
+
return Object.values(parameters).reduce((compositeKeys: any, param) => {
|
|
39
|
+
if (isSelfReferencedProperty(property, param)) {
|
|
40
|
+
let propName = getPropertyValue(param);
|
|
41
|
+
propName = propName.substring(propName.indexOf('.'));
|
|
42
|
+
compositeKeys.push(propName);
|
|
43
|
+
}
|
|
44
|
+
return compositeKeys;
|
|
45
|
+
}, []);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const generateColumns = (config, pConn, referenceType) => {
|
|
49
|
+
const displayField = getLeafNameFromPropertyName(config.displayField);
|
|
50
|
+
const referenceProp = config.value.split('.', 2)[1];
|
|
51
|
+
const compositeKeys: any = getCompositeKeys(pConn, referenceProp);
|
|
52
|
+
let value = getLeafNameFromPropertyName(config.value);
|
|
53
|
+
|
|
54
|
+
const columns: any = [];
|
|
55
|
+
if (displayField) {
|
|
56
|
+
columns.push({
|
|
57
|
+
value: displayField,
|
|
58
|
+
display: 'true',
|
|
59
|
+
useForSearch: true,
|
|
60
|
+
primary: 'true'
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (value && compositeKeys.indexOf(value) !== -1) {
|
|
64
|
+
columns.push({
|
|
65
|
+
value,
|
|
66
|
+
setProperty: 'Associated property',
|
|
67
|
+
key: 'true'
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
const actualValue = compositeKeys.length > 0 ? compositeKeys[0] : value;
|
|
71
|
+
config.value = `@P .${referenceProp}${actualValue}`;
|
|
72
|
+
value = actualValue;
|
|
73
|
+
columns.push({
|
|
74
|
+
value: actualValue,
|
|
75
|
+
setProperty: 'Associated property',
|
|
76
|
+
key: 'true'
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
config.datasource = {
|
|
81
|
+
fields: {
|
|
82
|
+
key: getLeafNameFromPropertyName(config.value),
|
|
83
|
+
text: getLeafNameFromPropertyName(config.displayField),
|
|
84
|
+
value: getLeafNameFromPropertyName(config.value)
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
if (referenceType === 'Case') {
|
|
89
|
+
columns.push({
|
|
90
|
+
secondary: 'true',
|
|
91
|
+
display: 'true',
|
|
92
|
+
value: Utils.getMappedKey('pyID'),
|
|
93
|
+
useForSearch: true
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
compositeKeys.forEach(key => {
|
|
98
|
+
if (value !== key)
|
|
99
|
+
columns.push({
|
|
100
|
+
value: key,
|
|
101
|
+
display: 'false',
|
|
102
|
+
secondary: 'true',
|
|
103
|
+
useForSearch: false,
|
|
104
|
+
setProperty: `.${referenceProp}${key}`
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
config.columns = columns;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const getDataRelationshipContextFromKey = key => key.split('.', 2)[1];
|
|
@@ -1,8 +1,8 @@
|
|
|
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';
|
|
5
|
-
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
6
|
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
7
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
8
8
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
@@ -50,7 +50,11 @@ export default function Percentage(props: PercentageProps) {
|
|
|
50
50
|
const helperTextToDisplay = validatemessage || helperText;
|
|
51
51
|
|
|
52
52
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
53
|
-
const formattedValue = format(value, pConn.getComponentName()
|
|
53
|
+
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setValues(value.toString());
|
|
57
|
+
}, [value]);
|
|
54
58
|
|
|
55
59
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
56
60
|
|
|
@@ -66,11 +70,7 @@ export default function Percentage(props: PercentageProps) {
|
|
|
66
70
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
testProp = {
|
|
72
|
-
'data-test-id': testId
|
|
73
|
-
};
|
|
73
|
+
const testProps: any = { 'data-test-id': testId };
|
|
74
74
|
|
|
75
75
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
76
76
|
const theCurrDec = theSymbols.theDecimalIndicator;
|
|
@@ -105,7 +105,7 @@ export default function Percentage(props: PercentageProps) {
|
|
|
105
105
|
thousandSeparator={showGroupSeparators ? theCurrSep : ''}
|
|
106
106
|
decimalScale={decimalPrecision}
|
|
107
107
|
suffix='%'
|
|
108
|
-
|
|
108
|
+
slotProps={{ input: { ...readOnlyProp, inputProps: { ...testProps } } }}
|
|
109
109
|
customInput={TextField}
|
|
110
110
|
/>
|
|
111
111
|
);
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
import { MuiTelInput } from 'mui-tel-input';
|
|
3
3
|
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
|
-
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
6
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
7
7
|
|
|
8
8
|
interface PhoneProps extends PConnFieldProps {
|
|
@@ -69,9 +69,11 @@ export default function Phone(props: PhoneProps) {
|
|
|
69
69
|
error={status === 'error'}
|
|
70
70
|
label={label}
|
|
71
71
|
value={value}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
slotProps={{
|
|
73
|
+
input: {
|
|
74
|
+
readOnly: true,
|
|
75
|
+
...testProp
|
|
76
|
+
}
|
|
75
77
|
}}
|
|
76
78
|
disableDropdown={disableDropdown}
|
|
77
79
|
/>
|
|
@@ -105,7 +107,7 @@ export default function Phone(props: PhoneProps) {
|
|
|
105
107
|
error={status === 'error'}
|
|
106
108
|
label={label}
|
|
107
109
|
value={inputValue}
|
|
108
|
-
|
|
110
|
+
slotProps={{ input: { ...testProp } }}
|
|
109
111
|
/>
|
|
110
112
|
);
|
|
111
113
|
}
|
|
@@ -4,18 +4,26 @@ import { Radio, RadioGroup, FormControl, FormControlLabel, FormLabel, FormHelper
|
|
|
4
4
|
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
5
5
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
6
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
-
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
8
|
|
|
9
9
|
// Can't use RadioButtonProps until getLocaleRuleNameFromKeys is NOT private
|
|
10
10
|
interface RadioButtonsProps extends PConnFieldProps {
|
|
11
11
|
// If any, enter additional props that only exist on RadioButtons here
|
|
12
12
|
inline: boolean;
|
|
13
13
|
fieldMetadata?: any;
|
|
14
|
+
variant?: string;
|
|
15
|
+
hideFieldLabels?: boolean;
|
|
16
|
+
additionalProps?: any;
|
|
17
|
+
imagePosition?: string;
|
|
18
|
+
imageSize?: string;
|
|
19
|
+
showImageDescription?: boolean;
|
|
20
|
+
datasource?: any;
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
export default function RadioButtons(props: RadioButtonsProps) {
|
|
17
24
|
// Get emitted components from map (so we can get any override that may exist)
|
|
18
25
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
26
|
+
const SelectableCard = getComponentFromMap('SelectableCard');
|
|
19
27
|
|
|
20
28
|
const {
|
|
21
29
|
getPConnect,
|
|
@@ -29,7 +37,14 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
29
37
|
inline,
|
|
30
38
|
displayMode,
|
|
31
39
|
hideLabel,
|
|
32
|
-
fieldMetadata
|
|
40
|
+
fieldMetadata,
|
|
41
|
+
variant,
|
|
42
|
+
hideFieldLabels,
|
|
43
|
+
additionalProps,
|
|
44
|
+
datasource,
|
|
45
|
+
imagePosition,
|
|
46
|
+
imageSize,
|
|
47
|
+
showImageDescription
|
|
33
48
|
} = props;
|
|
34
49
|
const [theSelectedButton, setSelectedButton] = useState(value);
|
|
35
50
|
|
|
@@ -65,7 +80,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
65
80
|
return (
|
|
66
81
|
<FieldValueList
|
|
67
82
|
name={hideLabel ? '' : label}
|
|
68
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
69
83
|
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
70
84
|
/>
|
|
71
85
|
);
|
|
@@ -75,7 +89,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
75
89
|
return (
|
|
76
90
|
<FieldValueList
|
|
77
91
|
name={hideLabel ? '' : label}
|
|
78
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
79
92
|
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
80
93
|
variant='stacked'
|
|
81
94
|
/>
|
|
@@ -90,6 +103,36 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
90
103
|
thePConn.getValidationApi().validate(event.target.value, ''); // 2nd arg empty string until typedef marked correctly as optional
|
|
91
104
|
};
|
|
92
105
|
|
|
106
|
+
if (variant === 'card') {
|
|
107
|
+
const stateProps = thePConn.getStateProps();
|
|
108
|
+
return (
|
|
109
|
+
<div>
|
|
110
|
+
<h4 style={{ marginTop: 0, marginBottom: 0 }}>{label}</h4>
|
|
111
|
+
<div id='selectable-card' style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(200px, 100%), 1fr))', gap: '1rem' }}>
|
|
112
|
+
<SelectableCard
|
|
113
|
+
hideFieldLabels={hideFieldLabels}
|
|
114
|
+
additionalProps={additionalProps}
|
|
115
|
+
getPConnect={getPConnect}
|
|
116
|
+
dataSource={datasource}
|
|
117
|
+
image={{
|
|
118
|
+
imagePosition,
|
|
119
|
+
imageSize,
|
|
120
|
+
showImageDescription,
|
|
121
|
+
imageField: stateProps.image?.split('.').pop(),
|
|
122
|
+
imageDescription: stateProps.imageDescription?.split('.').pop()
|
|
123
|
+
}}
|
|
124
|
+
onChange={handleChange}
|
|
125
|
+
recordKey={stateProps.value?.split('.').pop()}
|
|
126
|
+
cardLabel={stateProps.primaryField?.split('.').pop()}
|
|
127
|
+
radioBtnValue={value}
|
|
128
|
+
type='radio'
|
|
129
|
+
setIsRadioCardSelected={displayMode !== 'DISPLAY_ONLY' ? setSelectedButton : undefined}
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
93
136
|
return (
|
|
94
137
|
<FormControl variant='standard' error={status === 'error'} required={required}>
|
|
95
138
|
<FormLabel component='legend'>{label}</FormLabel>
|
|
@@ -102,7 +145,6 @@ export default function RadioButtons(props: RadioButtonsProps) {
|
|
|
102
145
|
label={thePConn.getLocalizedValue(
|
|
103
146
|
theOption.value,
|
|
104
147
|
localePath,
|
|
105
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
106
148
|
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
107
149
|
)}
|
|
108
150
|
control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.tox .tox-toolbar {
|
|
2
|
+
background-color: var(--app-background-color) !important;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.tox .tox-toolbar__primary {
|
|
6
|
+
background-color: var(--app-background-color) !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tox .tox-toolbar__button {
|
|
10
|
+
color: var(--app-text-color) !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.tox .tox-toolbar__button--enabled {
|
|
14
|
+
background: var(--app-primary-color) !important;
|
|
15
|
+
color: #fff !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tox .tox-dialog {
|
|
19
|
+
background-color: var(--modal-top-color) !important;
|
|
20
|
+
color: var(--app-text-color) !important;
|
|
21
|
+
border: 1px solid var(--modal-border-color) !important;
|
|
22
|
+
padding: 20px !important;
|
|
23
|
+
box-shadow: 0 0 10px 3px var(--modal-box-shadow-color) !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.tox .tox-dialog__header {
|
|
27
|
+
background-color: var(--modal-top-color) !important;
|
|
28
|
+
color: var(--app-text-color) !important;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
border-bottom: 1px solid var(--modal-border-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tox .tox-dialog__footer {
|
|
34
|
+
background: transparent !important;
|
|
35
|
+
border-top: 1px solid var(--modal-border-color);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.tox .tox-dialog-wrap__backdrop {
|
|
39
|
+
background-color: var(--modal-background-color) !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.tox .tox-dialog__body input,
|
|
43
|
+
.tox .tox-dialog__body textarea,
|
|
44
|
+
.tox .tox-dialog__body select {
|
|
45
|
+
background: initial !important;
|
|
46
|
+
color: var(--app-text-color) !important;
|
|
47
|
+
border: 1px solid var(--app-neutral-color) !important;
|
|
48
|
+
border-radius: 4px !important;
|
|
49
|
+
padding: 6px 10px !important;
|
|
50
|
+
font-size: 1em !important;
|
|
51
|
+
font-family: inherit !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.tox .tox-dialog__body button {
|
|
55
|
+
background: transparent;
|
|
56
|
+
color: #fff !important;
|
|
57
|
+
border: none !important;
|
|
58
|
+
border-radius: 4px !important;
|
|
59
|
+
padding: 8px 16px !important;
|
|
60
|
+
font-size: 1em !important;
|
|
61
|
+
cursor: pointer !important;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.tox .tox-dialog__footer .tox-button {
|
|
65
|
+
background: var(--app-primary-color) !important;
|
|
66
|
+
color: #fff !important;
|
|
67
|
+
border: none !important;
|
|
68
|
+
border-radius: 4px !important;
|
|
69
|
+
padding: 8px 16px !important;
|
|
70
|
+
font-size: 1em !important;
|
|
71
|
+
cursor: pointer !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.tox .tox-dialog__footer .tox-button--secondary {
|
|
75
|
+
background: var(--app-secondary-color) !important;
|
|
76
|
+
color: var(--secondary-button-text-color) !important;
|
|
77
|
+
font-size: 0.875rem !important;
|
|
78
|
+
cursor: pointer !important;
|
|
79
|
+
}
|
|
@@ -2,7 +2,9 @@ import { useRef } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
|
-
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
|
+
|
|
7
|
+
import './RichText.css';
|
|
6
8
|
|
|
7
9
|
interface RichTextProps extends PConnFieldProps {
|
|
8
10
|
// If any, enter additional props that only exist on TextArea here
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/* eslint-disable react/no-array-index-key */
|
|
2
1
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
2
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
4
3
|
|
|
5
4
|
// ScalarListProps can't extend PConnFieldProps because its 'value' has a different type
|
|
6
5
|
interface ScalarListProps extends PConnProps {
|
|
@@ -36,16 +35,15 @@ export default function ScalarList(props: ScalarListProps) {
|
|
|
36
35
|
{
|
|
37
36
|
type: componentType,
|
|
38
37
|
config: {
|
|
39
|
-
// @ts-ignore - Type '{ readOnly: true; displayInModal: boolean; value: any; displayMode: string; label: string; }' is not assignable to type 'ComponentMetadataConfig'.
|
|
40
38
|
value: scalarValue,
|
|
41
39
|
displayMode: 'DISPLAY_ONLY',
|
|
42
40
|
label,
|
|
43
41
|
...restProps,
|
|
44
|
-
// @ts-ignore - Type 'string' is not assignable to type 'boolean | undefined'.
|
|
45
42
|
readOnly: 'true'
|
|
46
43
|
}
|
|
47
44
|
},
|
|
48
45
|
'',
|
|
46
|
+
// @ts-expect-error
|
|
49
47
|
'',
|
|
50
48
|
{}
|
|
51
49
|
); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Radio, Checkbox, FormControlLabel, Card, CardContent, Typography } from '@mui/material';
|
|
2
|
+
import { resolveReferenceFields } from './utils';
|
|
3
|
+
|
|
4
|
+
export default function SelectableCard(props) {
|
|
5
|
+
const {
|
|
6
|
+
getPConnect,
|
|
7
|
+
type,
|
|
8
|
+
image: { imagePosition, imageSize, showImageDescription, imageField = '', imageDescription = '' },
|
|
9
|
+
dataSource,
|
|
10
|
+
recordKey = '',
|
|
11
|
+
className,
|
|
12
|
+
cardLabel,
|
|
13
|
+
hideFieldLabels = false,
|
|
14
|
+
readOnly,
|
|
15
|
+
disabled,
|
|
16
|
+
readOnlyList = [],
|
|
17
|
+
displayMode,
|
|
18
|
+
radioBtnValue,
|
|
19
|
+
onChange,
|
|
20
|
+
onBlur,
|
|
21
|
+
onClick,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
additionalProps,
|
|
24
|
+
testId,
|
|
25
|
+
setIsRadioCardSelected,
|
|
26
|
+
showNoValue = false
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
const pConn = getPConnect();
|
|
30
|
+
|
|
31
|
+
if (showNoValue) return <Typography>No Value</Typography>;
|
|
32
|
+
|
|
33
|
+
const cardDataSource = readOnly || displayMode === 'DISPLAY_ONLY' ? readOnlyList || [] : dataSource?.source;
|
|
34
|
+
const imageDescriptionKey = showImageDescription ? imageDescription : undefined;
|
|
35
|
+
|
|
36
|
+
let radioItemSelected = false;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
{(cardDataSource || []).map(item => {
|
|
41
|
+
const resolvedFields = resolveReferenceFields(item, hideFieldLabels, recordKey, pConn);
|
|
42
|
+
|
|
43
|
+
const commonProps = {
|
|
44
|
+
id: item[recordKey],
|
|
45
|
+
key: item[recordKey],
|
|
46
|
+
fields: resolvedFields,
|
|
47
|
+
label: item[cardLabel]
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const image = item[imageField]
|
|
51
|
+
? {
|
|
52
|
+
src: item[imageField],
|
|
53
|
+
alt: showImageDescription && imageDescriptionKey ? item[imageDescriptionKey] : '',
|
|
54
|
+
style: { width: imageSize, objectPosition: imagePosition }
|
|
55
|
+
}
|
|
56
|
+
: undefined;
|
|
57
|
+
|
|
58
|
+
const cardContent = (
|
|
59
|
+
<Card className={className} style={{ display: 'flex' }} data-testid={testId}>
|
|
60
|
+
{image && <img src={image.src} alt={image.alt} style={{ width: '100px' }} />}
|
|
61
|
+
<CardContent>
|
|
62
|
+
<Typography variant='body1'>{item[cardLabel]}</Typography>
|
|
63
|
+
{commonProps.fields.map((field, index) => (
|
|
64
|
+
<Typography key={index} variant='body2'>
|
|
65
|
+
{field.value}
|
|
66
|
+
</Typography>
|
|
67
|
+
))}
|
|
68
|
+
</CardContent>
|
|
69
|
+
</Card>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
73
|
+
return cardContent;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const component = (
|
|
77
|
+
<div key={item[recordKey]} style={{ paddingTop: '15px' }}>
|
|
78
|
+
<Card className={className} style={{ display: 'flex', flexDirection: 'column', height: '100%' }} data-testid={testId}>
|
|
79
|
+
<CardContent
|
|
80
|
+
style={{
|
|
81
|
+
...((imagePosition === 'inline-start' || imagePosition === 'inline-end') && { display: 'flex', height: '100%' }),
|
|
82
|
+
...(imagePosition === 'inline-end' && { flexDirection: 'row-reverse' })
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
style={{
|
|
87
|
+
...((imagePosition === 'inline-start' || imagePosition === 'inline-end') && { width: '40%' })
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
{image && (
|
|
91
|
+
<img
|
|
92
|
+
src={image.src}
|
|
93
|
+
alt={image.alt}
|
|
94
|
+
style={{
|
|
95
|
+
width: '100%',
|
|
96
|
+
backgroundColor: 'transparent',
|
|
97
|
+
aspectRatio: '16 / 9',
|
|
98
|
+
maxHeight: '100%',
|
|
99
|
+
height: '100%',
|
|
100
|
+
objectFit: 'contain',
|
|
101
|
+
maxWidth: '100%'
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
<div
|
|
107
|
+
style={{
|
|
108
|
+
...((imagePosition === 'inline-start' || imagePosition === 'inline-end') && { width: '60%' })
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
{type === 'radio' ? (
|
|
112
|
+
<FormControlLabel
|
|
113
|
+
control={
|
|
114
|
+
<Radio
|
|
115
|
+
value={item[recordKey]}
|
|
116
|
+
checked={radioBtnValue === item[recordKey]}
|
|
117
|
+
onChange={onChange}
|
|
118
|
+
onBlur={onBlur}
|
|
119
|
+
onClick={onClick}
|
|
120
|
+
onKeyDown={onKeyDown}
|
|
121
|
+
disabled={disabled}
|
|
122
|
+
{...additionalProps}
|
|
123
|
+
/>
|
|
124
|
+
}
|
|
125
|
+
label={<Typography variant='body1'>{item[cardLabel]}</Typography>}
|
|
126
|
+
/>
|
|
127
|
+
) : (
|
|
128
|
+
<FormControlLabel
|
|
129
|
+
control={
|
|
130
|
+
<Checkbox
|
|
131
|
+
id={item[recordKey]}
|
|
132
|
+
getPConnect={getPConnect}
|
|
133
|
+
checked={readOnlyList.some(data => data[recordKey] === item[recordKey])}
|
|
134
|
+
onChange={onChange}
|
|
135
|
+
onBlur={onBlur}
|
|
136
|
+
onClick={onClick}
|
|
137
|
+
onKeyDown={onKeyDown}
|
|
138
|
+
disabled={disabled}
|
|
139
|
+
{...additionalProps}
|
|
140
|
+
/>
|
|
141
|
+
}
|
|
142
|
+
label={<Typography variant='body1'>{item[cardLabel]}</Typography>}
|
|
143
|
+
/>
|
|
144
|
+
)}
|
|
145
|
+
|
|
146
|
+
{commonProps.fields.map((field, index) => (
|
|
147
|
+
<div
|
|
148
|
+
key={index}
|
|
149
|
+
style={{
|
|
150
|
+
fontSize: '0.875rem',
|
|
151
|
+
...(field.type !== 'TextArea' && { display: 'grid', gridTemplateColumns: '1fr 1fr' }),
|
|
152
|
+
margin: '5px'
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
155
|
+
{field.name && <div>{field.name}</div>}
|
|
156
|
+
<div>{field?.value?.props.value}</div>
|
|
157
|
+
</div>
|
|
158
|
+
))}
|
|
159
|
+
</div>
|
|
160
|
+
</CardContent>
|
|
161
|
+
</Card>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
if (type === 'radio' && radioBtnValue === item[recordKey]) {
|
|
166
|
+
radioItemSelected = true;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return component;
|
|
170
|
+
})}
|
|
171
|
+
|
|
172
|
+
{type === 'radio' && setIsRadioCardSelected && setIsRadioCardSelected(radioItemSelected)}
|
|
173
|
+
</>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SelectableCard';
|