@pega/react-sdk-overrides 23.1.10 → 23.1.12
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/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +6 -14
- package/lib/designSystemExtension/Banner/Banner.tsx +14 -11
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +27 -22
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +14 -20
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +44 -19
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +7 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +21 -32
- package/lib/designSystemExtension/Operator/Operator.tsx +94 -82
- package/lib/designSystemExtension/Pulse/Pulse.tsx +14 -16
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +6 -5
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +14 -14
- package/lib/field/AutoComplete/AutoComplete.tsx +24 -26
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +98 -84
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +120 -63
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +25 -50
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +9 -16
- package/lib/field/Date/Date.tsx +15 -11
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +9 -9
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +33 -44
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +122 -31
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +11 -10
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +39 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +8 -7
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/MultiSelect/Multiselect.tsx +244 -0
- package/lib/field/MultiSelect/index.tsx +1 -0
- package/lib/field/MultiSelect/utils.ts +230 -0
- package/lib/field/Percentage/Percentage.tsx +46 -41
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +13 -12
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +20 -18
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +8 -7
- package/lib/field/ScalarList/ScalarList.tsx +3 -13
- package/lib/field/ScalarList/config-ext.json +1 -2
- package/lib/field/SemanticLink/SemanticLink.tsx +7 -7
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -11
- package/lib/field/TextArea/TextArea.tsx +7 -6
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +4 -6
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +9 -7
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +11 -11
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +9 -8
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +18 -16
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/attachmentHelpers.ts +13 -8
- package/lib/helpers/case-utils.tsx +4 -8
- package/lib/helpers/common-utils.ts +5 -1
- package/lib/helpers/data_page.ts +3 -7
- package/lib/helpers/date-format-utils.ts +3 -3
- package/lib/helpers/event-utils.ts +3 -3
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Boolean.ts +9 -26
- package/lib/helpers/formatters/Currency.ts +15 -21
- package/lib/helpers/formatters/CurrencyMap.ts +505 -501
- package/lib/helpers/formatters/Date.ts +20 -26
- package/lib/helpers/formatters/common.ts +1 -2
- package/lib/helpers/formatters/index.ts +26 -19
- package/lib/helpers/instructions-utils.ts +38 -0
- package/lib/helpers/reactContextHelpers.ts +2 -2
- package/lib/helpers/simpleTableHelpers.ts +59 -83
- package/lib/helpers/state-utils.tsx +5 -9
- package/lib/helpers/template-utils.ts +3 -6
- package/lib/helpers/utils.ts +5 -5
- package/lib/helpers/versionHelpers.ts +1 -4
- package/lib/infra/ActionButtons/ActionButtons.tsx +38 -29
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -79
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +13 -16
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -213
- package/lib/infra/Containers/FlowContainer/helpers.ts +34 -45
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +227 -218
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +36 -46
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -42
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -43
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -28
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +16 -30
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +176 -212
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +19 -31
- package/lib/infra/Reference/Reference.tsx +16 -18
- package/lib/infra/Region/Region.tsx +4 -6
- package/lib/infra/RootContainer/RootContainer.tsx +75 -111
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +32 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +11 -11
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +21 -28
- package/lib/infra/View/View.tsx +17 -21
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +39 -74
- package/lib/template/BannerPage/BannerPage.tsx +12 -14
- package/lib/template/CaseSummary/CaseSummary.tsx +58 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +34 -63
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +63 -19
- package/lib/template/Confirmation/Confirmation.tsx +12 -17
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +95 -121
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +13 -16
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/Details/Details/Details.tsx +19 -22
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +9 -13
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -24
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +19 -25
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +15 -14
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +15 -22
- package/lib/template/InlineDashboard/InlineDashboard.tsx +12 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +12 -16
- package/lib/template/ListPage/ListPage.tsx +5 -10
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/DefaultViewMeta.ts +1 -3
- package/lib/template/ListView/ListView.tsx +185 -175
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/hooks.ts +24 -26
- package/lib/template/ListView/utils.ts +51 -87
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +20 -20
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +25 -38
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +20 -25
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +14 -24
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +9 -19
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +14 -15
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +3 -10
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +6 -10
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +32 -28
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +37 -33
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -121
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +24 -25
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +30 -30
- package/lib/template/SubTabs/SubTabs.tsx +22 -40
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -5
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +30 -28
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +3 -10
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +30 -28
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +22 -34
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +24 -28
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +13 -21
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +8 -16
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +18 -21
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +29 -28
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +60 -1
- package/lib/widget/Attachment/Attachment.tsx +378 -405
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +64 -66
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +16 -18
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +310 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +23 -20
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +68 -42
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +58 -58
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +7 -10
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +52 -53
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -834
- package/lib/helpers/authManager.ts +0 -933
- package/lib/helpers/config_access.js +0 -186
|
@@ -1,30 +1,64 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
3
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
4
|
+
import isDeepEqual from 'fast-deep-equal/react';
|
|
4
5
|
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
6
|
+
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
5
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
8
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
-
|
|
9
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
10
|
|
|
9
11
|
interface IOption {
|
|
10
12
|
key: string;
|
|
11
13
|
value: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const flattenParameters = (params = {}) => {
|
|
17
|
+
const flatParams = {};
|
|
18
|
+
Object.keys(params).forEach(key => {
|
|
19
|
+
const { name, value: theVal } = params[key];
|
|
20
|
+
flatParams[name] = theVal;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return flatParams;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const preProcessColumns = columnList => {
|
|
27
|
+
return columnList.map(col => {
|
|
28
|
+
const tempColObj = { ...col };
|
|
29
|
+
tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
|
|
30
|
+
return tempColObj;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getDisplayFieldsMetaData = columnList => {
|
|
35
|
+
const displayColumns = columnList.filter(col => col.display === 'true');
|
|
36
|
+
const metaDataObj: any = { key: '', primary: '', secondary: [] };
|
|
37
|
+
const keyCol = columnList.filter(col => col.key === 'true');
|
|
38
|
+
metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
|
|
39
|
+
for (let index = 0; index < displayColumns.length; index += 1) {
|
|
40
|
+
if (displayColumns[index].primary === 'true') {
|
|
41
|
+
metaDataObj.primary = displayColumns[index].value;
|
|
42
|
+
} else {
|
|
43
|
+
metaDataObj.secondary.push(displayColumns[index].value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return metaDataObj;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
interface DropdownProps extends PConnFieldProps {
|
|
50
|
+
// If any, enter additional props that only exist on Dropdown here
|
|
51
|
+
datasource?: any[];
|
|
52
|
+
onRecordChange?: any;
|
|
53
|
+
fieldMetadata?: any;
|
|
54
|
+
listType: string;
|
|
55
|
+
deferDatasource?: boolean;
|
|
56
|
+
datasourceMetadata?: any;
|
|
57
|
+
parameters?: any;
|
|
58
|
+
columns: any[];
|
|
59
|
+
}
|
|
26
60
|
|
|
27
|
-
export default function Dropdown(props
|
|
61
|
+
export default function Dropdown(props: DropdownProps) {
|
|
28
62
|
// Get emitted components from map (so we can get any override that may exist)
|
|
29
63
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
30
64
|
|
|
@@ -34,39 +68,93 @@ export default function Dropdown(props /* : DropdownProps */) {
|
|
|
34
68
|
required,
|
|
35
69
|
disabled,
|
|
36
70
|
value = '',
|
|
37
|
-
datasource = [],
|
|
38
71
|
validatemessage,
|
|
39
72
|
status,
|
|
40
73
|
readOnly,
|
|
41
74
|
testId,
|
|
42
75
|
helperText,
|
|
43
76
|
displayMode,
|
|
77
|
+
deferDatasource,
|
|
78
|
+
datasourceMetadata,
|
|
44
79
|
hideLabel,
|
|
45
80
|
onRecordChange,
|
|
46
81
|
fieldMetadata
|
|
47
82
|
} = props;
|
|
48
|
-
let { placeholder =
|
|
83
|
+
let { placeholder = '' } = props;
|
|
84
|
+
const context = getPConnect().getContextName();
|
|
85
|
+
let { listType, parameters, datasource = [], columns = [] } = props;
|
|
49
86
|
placeholder = placeholder || 'Select...';
|
|
50
|
-
const [options, setOptions] = useState<
|
|
87
|
+
const [options, setOptions] = useState<IOption[]>([]);
|
|
88
|
+
const [theDatasource, setDatasource] = useState<any[] | null>(null);
|
|
51
89
|
const helperTextToDisplay = validatemessage || helperText;
|
|
52
90
|
|
|
53
91
|
const thePConn = getPConnect();
|
|
54
92
|
const actionsApi = thePConn.getActionsApi();
|
|
55
|
-
const propName = thePConn.getStateProps()
|
|
93
|
+
const propName = (thePConn.getStateProps() as any).value;
|
|
56
94
|
const className = thePConn.getCaseInfo().getClassName();
|
|
57
95
|
const refName = propName?.slice(propName.lastIndexOf('.') + 1);
|
|
58
96
|
|
|
97
|
+
if (!isDeepEqual(datasource, theDatasource)) {
|
|
98
|
+
// inbound datasource is different, so update theDatasource (to trigger useEffect)
|
|
99
|
+
setDatasource(datasource);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// convert associated to datapage listtype and transform props
|
|
103
|
+
// Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList
|
|
104
|
+
if (deferDatasource && datasourceMetadata?.datasource?.name) {
|
|
105
|
+
listType = 'datapage';
|
|
106
|
+
datasource = datasourceMetadata.datasource.name;
|
|
107
|
+
const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
|
|
108
|
+
parameters = flattenParameters(dataSourceParameters);
|
|
109
|
+
const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
|
|
110
|
+
const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
|
|
111
|
+
columns = [
|
|
112
|
+
{
|
|
113
|
+
key: 'true',
|
|
114
|
+
setProperty: 'Associated property',
|
|
115
|
+
value: valueProp
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
display: 'true',
|
|
119
|
+
primary: 'true',
|
|
120
|
+
useForSearch: true,
|
|
121
|
+
value: displayProp
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
columns = preProcessColumns(columns);
|
|
126
|
+
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (theDatasource) {
|
|
129
|
+
const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly
|
|
130
|
+
const optionsList = [...list];
|
|
131
|
+
optionsList.unshift({
|
|
132
|
+
key: placeholder,
|
|
133
|
+
value: thePConn.getLocalizedValue(placeholder, '', '')
|
|
134
|
+
}); // 2nd and 3rd args empty string until typedef marked correctly
|
|
135
|
+
setOptions(optionsList);
|
|
136
|
+
}
|
|
137
|
+
}, [theDatasource]);
|
|
138
|
+
|
|
59
139
|
useEffect(() => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
140
|
+
if (!displayMode && listType !== 'associated' && typeof datasource === 'string') {
|
|
141
|
+
getDataPage(datasource, parameters, context).then((results: any) => {
|
|
142
|
+
const optionsData: any[] = [];
|
|
143
|
+
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
144
|
+
results?.forEach(element => {
|
|
145
|
+
const val = element[displayColumn.primary]?.toString();
|
|
146
|
+
const obj = {
|
|
147
|
+
key: element[displayColumn.key] || element.pyGUID,
|
|
148
|
+
value: val
|
|
149
|
+
};
|
|
150
|
+
optionsData.push(obj);
|
|
151
|
+
});
|
|
152
|
+
setOptions(optionsData);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}, []);
|
|
68
156
|
|
|
69
|
-
const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(
|
|
157
|
+
const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;
|
|
70
158
|
|
|
71
159
|
let displayName = metaData?.datasource?.propertyForDisplayText;
|
|
72
160
|
displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
|
|
@@ -81,6 +169,7 @@ export default function Dropdown(props /* : DropdownProps */) {
|
|
|
81
169
|
return (
|
|
82
170
|
<FieldValueList
|
|
83
171
|
name={hideLabel ? '' : label}
|
|
172
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
84
173
|
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
85
174
|
/>
|
|
86
175
|
);
|
|
@@ -90,8 +179,9 @@ export default function Dropdown(props /* : DropdownProps */) {
|
|
|
90
179
|
return (
|
|
91
180
|
<FieldValueList
|
|
92
181
|
name={hideLabel ? '' : label}
|
|
182
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
93
183
|
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
94
|
-
variant=
|
|
184
|
+
variant='stacked'
|
|
95
185
|
/>
|
|
96
186
|
);
|
|
97
187
|
}
|
|
@@ -106,7 +196,7 @@ export default function Dropdown(props /* : DropdownProps */) {
|
|
|
106
196
|
'data-test-id': testId
|
|
107
197
|
};
|
|
108
198
|
|
|
109
|
-
const handleChange =
|
|
199
|
+
const handleChange = evt => {
|
|
110
200
|
const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;
|
|
111
201
|
handleEvent(actionsApi, 'changeNblur', propName, selectedValue);
|
|
112
202
|
if (onRecordChange) {
|
|
@@ -122,7 +212,7 @@ export default function Dropdown(props /* : DropdownProps */) {
|
|
|
122
212
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
123
213
|
helperText={helperTextToDisplay}
|
|
124
214
|
placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly
|
|
125
|
-
size=
|
|
215
|
+
size='small'
|
|
126
216
|
required={required}
|
|
127
217
|
disabled={disabled}
|
|
128
218
|
onChange={!readOnly ? handleChange : undefined}
|
|
@@ -134,6 +224,7 @@ export default function Dropdown(props /* : DropdownProps */) {
|
|
|
134
224
|
>
|
|
135
225
|
{options.map((option: any) => (
|
|
136
226
|
<MenuItem key={option.key} value={option.key}>
|
|
227
|
+
{/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
|
|
137
228
|
{thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
138
229
|
</MenuItem>
|
|
139
230
|
))}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TextField, InputAdornment } from '@material-ui/core';
|
|
1
|
+
import { InputAdornment, TextField } from '@material-ui/core';
|
|
3
2
|
import MailOutlineIcon from '@material-ui/icons/MailOutline';
|
|
3
|
+
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
|
-
import
|
|
5
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
6
|
|
|
7
7
|
interface EmailProps extends PConnFieldProps {
|
|
8
8
|
// If any, enter additional props that only exist on Date here
|
|
@@ -26,7 +26,8 @@ export default function Email(props: EmailProps) {
|
|
|
26
26
|
testId,
|
|
27
27
|
helperText,
|
|
28
28
|
displayMode,
|
|
29
|
-
hideLabel
|
|
29
|
+
hideLabel,
|
|
30
|
+
placeholder
|
|
30
31
|
} = props;
|
|
31
32
|
const helperTextToDisplay = validatemessage || helperText;
|
|
32
33
|
|
|
@@ -35,7 +36,7 @@ export default function Email(props: EmailProps) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
38
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
39
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
if (readOnly) {
|
|
@@ -51,10 +52,10 @@ export default function Email(props: EmailProps) {
|
|
|
51
52
|
return (
|
|
52
53
|
<TextField
|
|
53
54
|
fullWidth
|
|
54
|
-
variant=
|
|
55
|
+
variant='outlined'
|
|
55
56
|
helperText={helperTextToDisplay}
|
|
56
|
-
placeholder=
|
|
57
|
-
size=
|
|
57
|
+
placeholder={placeholder ?? ''}
|
|
58
|
+
size='small'
|
|
58
59
|
required={required}
|
|
59
60
|
disabled={disabled}
|
|
60
61
|
onChange={onChange}
|
|
@@ -62,10 +63,10 @@ export default function Email(props: EmailProps) {
|
|
|
62
63
|
error={status === 'error'}
|
|
63
64
|
label={label}
|
|
64
65
|
value={value}
|
|
65
|
-
type=
|
|
66
|
+
type='email'
|
|
66
67
|
InputProps={{
|
|
67
68
|
startAdornment: (
|
|
68
|
-
<InputAdornment position=
|
|
69
|
+
<InputAdornment position='start'>
|
|
69
70
|
<MailOutlineIcon />
|
|
70
71
|
</InputAdornment>
|
|
71
72
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Email';
|
|
1
|
+
export { default } from './Email';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactElement, useMemo } from 'react';
|
|
2
|
+
import { Grid } from '@material-ui/core';
|
|
3
|
+
import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
|
|
4
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
6
|
+
interface GroupProps extends PConnFieldProps {
|
|
7
|
+
children: ReactElement[];
|
|
8
|
+
heading: string;
|
|
9
|
+
showHeading: boolean;
|
|
10
|
+
instructions?: string;
|
|
11
|
+
collapsible: boolean;
|
|
12
|
+
type: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function Group(props: GroupProps) {
|
|
16
|
+
const { children, heading, showHeading, instructions, collapsible, displayMode, type } = props;
|
|
17
|
+
|
|
18
|
+
const isReadOnly = displayMode === 'LABELS_LEFT';
|
|
19
|
+
|
|
20
|
+
const content = useMemo(() => {
|
|
21
|
+
return (
|
|
22
|
+
<Grid container spacing={2}>
|
|
23
|
+
{children?.map(child => (
|
|
24
|
+
<Grid item xs={12} key={child.key}>
|
|
25
|
+
{child}
|
|
26
|
+
</Grid>
|
|
27
|
+
))}
|
|
28
|
+
</Grid>
|
|
29
|
+
);
|
|
30
|
+
}, [children, type, isReadOnly]);
|
|
31
|
+
|
|
32
|
+
if (!children) return null;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FieldGroup name={showHeading ? heading : undefined} collapsible={collapsible} instructions={instructions}>
|
|
36
|
+
{content}
|
|
37
|
+
</FieldGroup>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Group';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { TextField } from '@material-ui/core';
|
|
2
|
+
|
|
3
3
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
|
-
import
|
|
4
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
5
|
|
|
6
6
|
interface IntegerProps extends PConnFieldProps {
|
|
7
7
|
// If any, enter additional props that only exist on Integer here
|
|
@@ -25,7 +25,8 @@ export default function Integer(props: IntegerProps) {
|
|
|
25
25
|
testId,
|
|
26
26
|
helperText,
|
|
27
27
|
displayMode,
|
|
28
|
-
hideLabel
|
|
28
|
+
hideLabel,
|
|
29
|
+
placeholder
|
|
29
30
|
} = props;
|
|
30
31
|
const helperTextToDisplay = validatemessage || helperText;
|
|
31
32
|
|
|
@@ -36,7 +37,7 @@ export default function Integer(props: IntegerProps) {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
39
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
40
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
if (readOnly) {
|
|
@@ -71,8 +72,8 @@ export default function Integer(props: IntegerProps) {
|
|
|
71
72
|
fullWidth
|
|
72
73
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
73
74
|
helperText={helperTextToDisplay}
|
|
74
|
-
placeholder=
|
|
75
|
-
size=
|
|
75
|
+
placeholder={placeholder ?? ''}
|
|
76
|
+
size='small'
|
|
76
77
|
required={required}
|
|
77
78
|
disabled={disabled}
|
|
78
79
|
onChange={intOnChange}
|
|
@@ -80,7 +81,7 @@ export default function Integer(props: IntegerProps) {
|
|
|
80
81
|
error={status === 'error'}
|
|
81
82
|
label={label}
|
|
82
83
|
value={value}
|
|
83
|
-
type=
|
|
84
|
+
type='text'
|
|
84
85
|
inputProps={{ inputMode: 'numeric', pattern: '[0-9]*', ...testProp }}
|
|
85
86
|
/>
|
|
86
87
|
);
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { Checkbox, TextField } from '@material-ui/core';
|
|
2
|
+
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
3
|
+
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';
|
|
4
|
+
import CheckBoxIcon from '@material-ui/icons/CheckBox';
|
|
5
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { doSearch, getDisplayFieldsMetaData, useDeepMemo, preProcessColumns, getGroupDataForItemsTree } from './utils';
|
|
7
|
+
import { insertInstruction, deleteInstruction } from '@pega/react-sdk-components/lib/components/helpers/instructions-utils';
|
|
8
|
+
import { debounce } from 'throttle-debounce';
|
|
9
|
+
|
|
10
|
+
const icon = <CheckBoxOutlineBlankIcon fontSize='small' />;
|
|
11
|
+
const checkedIcon = <CheckBoxIcon fontSize='small' />;
|
|
12
|
+
|
|
13
|
+
export default function Multiselect(props) {
|
|
14
|
+
const {
|
|
15
|
+
getPConnect,
|
|
16
|
+
label,
|
|
17
|
+
placeholder,
|
|
18
|
+
referenceList,
|
|
19
|
+
selectionKey,
|
|
20
|
+
primaryField,
|
|
21
|
+
initialCaseClass,
|
|
22
|
+
showSecondaryInSearchOnly = false,
|
|
23
|
+
listType = '',
|
|
24
|
+
isGroupData = false,
|
|
25
|
+
referenceType,
|
|
26
|
+
secondaryFields,
|
|
27
|
+
groupDataSource = [],
|
|
28
|
+
parameters = {},
|
|
29
|
+
matchPosition = 'contains',
|
|
30
|
+
maxResultsDisplay,
|
|
31
|
+
groupColumnsConfig = [{}],
|
|
32
|
+
selectionList,
|
|
33
|
+
value
|
|
34
|
+
} = props;
|
|
35
|
+
let { datasource = [], columns = [{}] } = props;
|
|
36
|
+
|
|
37
|
+
if (referenceList.length > 0) {
|
|
38
|
+
datasource = referenceList;
|
|
39
|
+
columns = [
|
|
40
|
+
{
|
|
41
|
+
value: primaryField,
|
|
42
|
+
display: 'true',
|
|
43
|
+
useForSearch: true,
|
|
44
|
+
primary: 'true'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: selectionKey,
|
|
48
|
+
setProperty: selectionKey,
|
|
49
|
+
key: 'true'
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
let secondaryColumns: any = [];
|
|
53
|
+
if (secondaryFields) {
|
|
54
|
+
secondaryColumns = secondaryFields.map(secondaryField => ({
|
|
55
|
+
value: secondaryField,
|
|
56
|
+
display: 'true',
|
|
57
|
+
secondary: 'true',
|
|
58
|
+
useForSearch: 'true'
|
|
59
|
+
}));
|
|
60
|
+
} else {
|
|
61
|
+
secondaryColumns = [
|
|
62
|
+
{
|
|
63
|
+
value: selectionKey,
|
|
64
|
+
display: 'true',
|
|
65
|
+
secondary: 'true',
|
|
66
|
+
useForSearch: 'true'
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
if (referenceType === 'Case') {
|
|
71
|
+
columns = [...columns, ...secondaryColumns];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const [inputValue, setInputValue] = useState(value);
|
|
75
|
+
const [selectedItems, setSelectedItems] = useState([]);
|
|
76
|
+
|
|
77
|
+
const dataConfig = useDeepMemo(() => {
|
|
78
|
+
return {
|
|
79
|
+
dataSource: datasource,
|
|
80
|
+
groupDataSource,
|
|
81
|
+
isGroupData,
|
|
82
|
+
showSecondaryInSearchOnly,
|
|
83
|
+
parameters,
|
|
84
|
+
matchPosition,
|
|
85
|
+
listType,
|
|
86
|
+
maxResultsDisplay: maxResultsDisplay || '100',
|
|
87
|
+
columns: preProcessColumns(columns),
|
|
88
|
+
groupColumnsConfig: preProcessColumns(groupColumnsConfig)
|
|
89
|
+
};
|
|
90
|
+
}, [
|
|
91
|
+
datasource,
|
|
92
|
+
groupDataSource,
|
|
93
|
+
isGroupData,
|
|
94
|
+
showSecondaryInSearchOnly,
|
|
95
|
+
parameters,
|
|
96
|
+
matchPosition,
|
|
97
|
+
listType,
|
|
98
|
+
maxResultsDisplay,
|
|
99
|
+
columns,
|
|
100
|
+
groupColumnsConfig
|
|
101
|
+
]);
|
|
102
|
+
const groupsDisplayFieldMeta = useMemo(
|
|
103
|
+
() => (listType !== 'associated' ? getDisplayFieldsMetaData(dataConfig.groupColumnsConfig) : null),
|
|
104
|
+
[dataConfig.groupColumnsConfig]
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const itemsTreeBaseData = getGroupDataForItemsTree(groupDataSource, groupsDisplayFieldMeta, showSecondaryInSearchOnly) || [];
|
|
108
|
+
|
|
109
|
+
const [itemsTree, setItemsTree] = useState(
|
|
110
|
+
isGroupData ? getGroupDataForItemsTree(groupDataSource, groupsDisplayFieldMeta, showSecondaryInSearchOnly) : []
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const displayFieldMeta = listType !== 'associated' ? getDisplayFieldsMetaData(dataConfig.columns) : null;
|
|
114
|
+
const getCaseListBasedOnParamsDebounced: any = useRef();
|
|
115
|
+
const pConn = getPConnect();
|
|
116
|
+
const contextName = pConn.getContextName();
|
|
117
|
+
const listActions = pConn.getListActions();
|
|
118
|
+
const dataApiObj = useRef();
|
|
119
|
+
|
|
120
|
+
// main search function trigger
|
|
121
|
+
const getCaseListBasedOnParams = async (searchText, group, selectedRows, currentItemsTree, isTriggeredFromSearch = false) => {
|
|
122
|
+
if (referenceList && referenceList.length > 0) {
|
|
123
|
+
selectedRows = await listActions.getSelectedRows(true);
|
|
124
|
+
|
|
125
|
+
selectedRows =
|
|
126
|
+
selectedRows &&
|
|
127
|
+
selectedRows.map(item => {
|
|
128
|
+
return {
|
|
129
|
+
id: item[selectionKey.startsWith('.') ? selectionKey.substring(1) : selectionKey],
|
|
130
|
+
primary: item[primaryField.startsWith('.') ? primaryField.substring(1) : primaryField]
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
setSelectedItems(selectedRows);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// if items tree is null or text search is triggered then always should use fresh data object, we use the original object
|
|
137
|
+
const initalItemsTree = isTriggeredFromSearch || !currentItemsTree ? [...itemsTreeBaseData] : [...currentItemsTree];
|
|
138
|
+
const res = await doSearch(
|
|
139
|
+
searchText,
|
|
140
|
+
group,
|
|
141
|
+
initialCaseClass,
|
|
142
|
+
displayFieldMeta,
|
|
143
|
+
dataApiObj.current,
|
|
144
|
+
initalItemsTree,
|
|
145
|
+
isGroupData,
|
|
146
|
+
showSecondaryInSearchOnly,
|
|
147
|
+
selectedRows || []
|
|
148
|
+
);
|
|
149
|
+
setItemsTree(res);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (referenceList && referenceList.length > 0) {
|
|
154
|
+
pConn.setReferenceList(selectionList);
|
|
155
|
+
}
|
|
156
|
+
}, [pConn]);
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
getCaseListBasedOnParamsDebounced.current = debounce(500, getCaseListBasedOnParams);
|
|
160
|
+
}, []);
|
|
161
|
+
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (listType !== 'associated') {
|
|
164
|
+
PCore.getDataApi()
|
|
165
|
+
?.init(dataConfig, contextName)
|
|
166
|
+
.then(dataObj => {
|
|
167
|
+
dataApiObj.current = dataObj;
|
|
168
|
+
if (!isGroupData) {
|
|
169
|
+
getCaseListBasedOnParamsDebounced.current(inputValue ?? '', '', [...selectedItems], [...itemsTree]);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}, [dataConfig, listType, dataConfig.columns, inputValue, dataConfig.groupColumnsConfig, showSecondaryInSearchOnly]);
|
|
174
|
+
|
|
175
|
+
const onSearchHandler = ev => {
|
|
176
|
+
const searchText = ev.target.value;
|
|
177
|
+
setInputValue(searchText);
|
|
178
|
+
getCaseListBasedOnParamsDebounced.current(searchText, '', [...selectedItems], [...itemsTree], true);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const setSelectedItemsForReferenceList = item => {
|
|
182
|
+
// Clear error messages if any
|
|
183
|
+
const propName = pConn.getStateProps().selectionList;
|
|
184
|
+
pConn.clearErrorMessages({
|
|
185
|
+
property: propName
|
|
186
|
+
});
|
|
187
|
+
const { selected } = item;
|
|
188
|
+
if (selected) {
|
|
189
|
+
insertInstruction(pConn, selectionList, selectionKey, primaryField, item);
|
|
190
|
+
} else {
|
|
191
|
+
deleteInstruction(pConn, selectionList, selectionKey, item);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const handleChange = (event, newSelectedValues) => {
|
|
196
|
+
let clickedItem;
|
|
197
|
+
let updatedItems: any = [];
|
|
198
|
+
if (newSelectedValues && newSelectedValues.length > 0) {
|
|
199
|
+
updatedItems = newSelectedValues.map(ele => {
|
|
200
|
+
ele.selected = true;
|
|
201
|
+
return ele;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
if (newSelectedValues.length > selectedItems.length) {
|
|
205
|
+
clickedItem = newSelectedValues.filter(item => !selectedItems.some((ele: any) => ele.id === item.id));
|
|
206
|
+
} else {
|
|
207
|
+
clickedItem = selectedItems.filter((item: any) => !newSelectedValues.some((ele: any) => ele.id === item.id));
|
|
208
|
+
clickedItem[0].selected = false;
|
|
209
|
+
}
|
|
210
|
+
itemsTree.forEach(ele => {
|
|
211
|
+
ele.selected = !!updatedItems.find(item => item.id === ele.id);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
setSelectedItems(updatedItems);
|
|
215
|
+
setItemsTree(itemsTree);
|
|
216
|
+
|
|
217
|
+
setInputValue('');
|
|
218
|
+
|
|
219
|
+
// if this is a referenceList case
|
|
220
|
+
if (referenceList) setSelectedItemsForReferenceList(clickedItem[0]);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<Autocomplete
|
|
225
|
+
multiple
|
|
226
|
+
fullWidth
|
|
227
|
+
options={itemsTree}
|
|
228
|
+
disableCloseOnSelect
|
|
229
|
+
getOptionSelected={(option: any, val: any) => option?.primary === val?.primary}
|
|
230
|
+
getOptionLabel={(option: any) => option?.primary}
|
|
231
|
+
onChange={handleChange}
|
|
232
|
+
value={selectedItems}
|
|
233
|
+
renderOption={(option: any, { selected }) => (
|
|
234
|
+
<>
|
|
235
|
+
<Checkbox icon={icon} checkedIcon={checkedIcon} style={{ marginRight: 8 }} checked={selected} />
|
|
236
|
+
{option.primary}
|
|
237
|
+
</>
|
|
238
|
+
)}
|
|
239
|
+
renderInput={params => (
|
|
240
|
+
<TextField {...params} variant='outlined' fullWidth label={label} placeholder={placeholder} size='small' onChange={onSearchHandler} />
|
|
241
|
+
)}
|
|
242
|
+
/>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Multiselect';
|