@pega/react-sdk-overrides 0.23.25 → 0.23.27
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 +39 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.css +4 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +33 -16
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
- package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +6 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
- package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +29 -19
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +27 -38
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -18
- package/lib/field/Date/Date.tsx +33 -15
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +22 -11
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +64 -17
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +154 -18
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +16 -7
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +37 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +15 -6
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/Percentage/Percentage.tsx +14 -6
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +17 -7
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +96 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +63 -0
- package/lib/field/ScalarList/config-ext.json +7 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -10
- package/lib/field/TextArea/TextArea.tsx +15 -5
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +9 -2
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +41 -10
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +21 -18
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +23 -6
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +52 -58
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
- package/lib/helpers/case-utils.tsx +99 -0
- package/lib/helpers/common-utils.ts +8 -0
- package/lib/helpers/data_page.ts +3 -6
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
- package/lib/helpers/formatters/Boolean.ts +21 -0
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
- package/lib/helpers/formatters/CurrencyMap.ts +915 -0
- package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
- package/lib/helpers/formatters/{common.js → common.ts} +3 -4
- package/lib/helpers/formatters/{index.js → index.ts} +22 -22
- package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
- package/lib/helpers/simpleTableHelpers.ts +65 -85
- package/lib/helpers/state-utils.tsx +43 -0
- package/lib/helpers/template-utils.ts +4 -8
- package/lib/helpers/utils.ts +16 -8
- package/lib/helpers/versionHelpers.ts +1 -5
- package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -84
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
- package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
- 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 +49 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +180 -216
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +28 -43
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +82 -125
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +38 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +34 -65
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +51 -69
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +122 -114
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
- package/lib/template/Confirmation/Confirmation.tsx +25 -53
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -140
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +24 -28
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
- 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 +79 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
- package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
- package/lib/template/ListPage/ListPage.tsx +12 -16
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
- package/lib/template/ListView/ListView.tsx +245 -306
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
- package/lib/template/ListView/{utils.js → utils.ts} +202 -91
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
- 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 +17 -19
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
- package/lib/template/SubTabs/SubTabs.tsx +26 -45
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -7
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
- 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 +29 -27
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
- 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 +16 -18
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
- 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 +33 -17
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +75 -4
- package/lib/widget/Attachment/Attachment.tsx +370 -388
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +27 -25
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +15 -4
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +80 -116
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -483
- package/lib/helpers/authManager.js +0 -631
- package/lib/helpers/config_access.js +0 -268
- package/lib/helpers/formatters/Boolean.js +0 -38
- package/lib/helpers/formatters/CurrencyMap.js +0 -908
- package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import TextField from '@material-ui/core/TextField';
|
|
3
|
+
|
|
3
4
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
|
|
6
|
+
import download from 'downloadjs';
|
|
7
|
+
// import SummaryList from '../../SummaryList';
|
|
8
|
+
// import ActionButtonsForFileUtil from '../ActionButtonsForFileUtil';
|
|
7
9
|
import './FileUtility.css';
|
|
8
|
-
import
|
|
10
|
+
import { IconButton, Menu, MenuItem, Button, CircularProgress } from '@material-ui/core';
|
|
9
11
|
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
10
|
-
|
|
12
|
+
|
|
11
13
|
import { validateMaxSize } from '@pega/react-sdk-components/lib/components/helpers/attachmentHelpers';
|
|
12
|
-
import {
|
|
14
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
15
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
interface FileUtilityProps extends PConnProps {
|
|
18
|
+
// If any, enter additional props that only exist on this component
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default function FileUtility(props: FileUtilityProps) {
|
|
22
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
23
|
+
const SummaryList = getComponentFromMap('SummaryList');
|
|
24
|
+
const ActionButtonsForFileUtil = getComponentFromMap('ActionButtonsForFileUtil');
|
|
15
25
|
|
|
16
|
-
export default function FileUtility(props) {
|
|
17
26
|
const { getPConnect } = props;
|
|
18
27
|
const thePConn = getPConnect();
|
|
19
28
|
const required = true;
|
|
@@ -22,8 +31,8 @@ export default function FileUtility(props) {
|
|
|
22
31
|
count: 0
|
|
23
32
|
};
|
|
24
33
|
const [list, setList] = useState(listTemp);
|
|
25
|
-
const headerSvgIcon$ = Utils.getImageSrc('paper-clip',
|
|
26
|
-
const closeSvgIcon = Utils.getImageSrc(
|
|
34
|
+
const headerSvgIcon$ = Utils.getImageSrc('paper-clip', Utils.getSDKStaticConentUrl());
|
|
35
|
+
const closeSvgIcon = Utils.getImageSrc('times', Utils.getSDKStaticConentUrl());
|
|
27
36
|
const configProps: any = thePConn.resolveConfigProps(thePConn.getConfigProps());
|
|
28
37
|
|
|
29
38
|
const header = configProps.label;
|
|
@@ -31,79 +40,94 @@ export default function FileUtility(props) {
|
|
|
31
40
|
showfileModal: false,
|
|
32
41
|
fileList: [],
|
|
33
42
|
attachedFiles: [],
|
|
34
|
-
fileMainButtons: [
|
|
35
|
-
|
|
43
|
+
fileMainButtons: [
|
|
44
|
+
{
|
|
45
|
+
actionID: 'attach',
|
|
46
|
+
jsAction: 'attachFiles',
|
|
47
|
+
name: thePConn.getLocalizedValue('Attach files', '', '')
|
|
48
|
+
}
|
|
49
|
+
], // 2nd and 3rd args empty string until typedef marked correctly
|
|
50
|
+
fileSecondaryButtons: [
|
|
51
|
+
{
|
|
52
|
+
actionID: 'cancel',
|
|
53
|
+
jsAction: 'cancel',
|
|
54
|
+
name: thePConn.getLocalizedValue('Cancel', '', '')
|
|
55
|
+
}
|
|
56
|
+
] // 2nd and 3rd args empty string until typedef marked correctly
|
|
36
57
|
};
|
|
37
58
|
const [fileData, setFileData] = useState(fileTemp);
|
|
38
59
|
const linkTemp = {
|
|
39
60
|
showLinkModal: false,
|
|
40
61
|
linksList: [],
|
|
41
62
|
attachedLinks: [],
|
|
42
|
-
linkMainButtons: [
|
|
43
|
-
|
|
63
|
+
linkMainButtons: [
|
|
64
|
+
{
|
|
65
|
+
actionID: 'attach',
|
|
66
|
+
jsAction: 'attachLinks',
|
|
67
|
+
name: thePConn.getLocalizedValue('Attach links', '', '')
|
|
68
|
+
}
|
|
69
|
+
], // 2nd and 3rd args empty string until typedef marked correctly
|
|
70
|
+
linkSecondaryButtons: [
|
|
71
|
+
{
|
|
72
|
+
actionID: 'cancel',
|
|
73
|
+
jsAction: 'cancel',
|
|
74
|
+
name: thePConn.getLocalizedValue('Cancel', '', '')
|
|
75
|
+
}
|
|
76
|
+
] // 2nd and 3rd args empty string until typedef marked correctly
|
|
44
77
|
};
|
|
45
78
|
const [linkData, setLinkData] = useState(linkTemp);
|
|
46
79
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
47
80
|
const open = Boolean(anchorEl);
|
|
48
|
-
const [link, setLink] = useState({title: '', url: '', disable: true});
|
|
81
|
+
const [link, setLink] = useState({ title: '', url: '', disable: true });
|
|
49
82
|
const [inProgress, setProgress] = useState(false);
|
|
50
83
|
const [showViewAllModal, setViewAll] = useState(false);
|
|
51
84
|
const [vaItems, setFullAttachments] = useState([]);
|
|
52
85
|
|
|
53
|
-
function addAttachments(attsFromResp:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
return attsFromResp;
|
|
86
|
+
function addAttachments(attsFromResp: any[] = []) {
|
|
87
|
+
attsFromResp = attsFromResp.map(respAtt => {
|
|
88
|
+
const updatedAtt = {
|
|
89
|
+
...respAtt,
|
|
90
|
+
meta: `${respAtt.category} . ${Utils.generateDateTime(respAtt.createTime, 'DateTime-Since')}, ${respAtt.createdBy}`
|
|
91
|
+
};
|
|
92
|
+
if (updatedAtt.type === 'FILE') {
|
|
93
|
+
updatedAtt.nameWithExt = updatedAtt.fileName;
|
|
94
|
+
}
|
|
95
|
+
return updatedAtt;
|
|
96
|
+
});
|
|
97
|
+
return attsFromResp;
|
|
67
98
|
}
|
|
68
99
|
|
|
69
|
-
function getListUtilityItemProps({
|
|
70
|
-
att,
|
|
71
|
-
cancelFile,
|
|
72
|
-
downloadFile,
|
|
73
|
-
deleteFile,
|
|
74
|
-
removeFile
|
|
75
|
-
}) {
|
|
100
|
+
function getListUtilityItemProps({ att, cancelFile, downloadFile, deleteFile, removeFile }) {
|
|
76
101
|
let actions;
|
|
77
102
|
|
|
78
|
-
|
|
79
103
|
if (att.progress && att.progress !== 100) {
|
|
80
104
|
actions = [
|
|
81
105
|
{
|
|
82
106
|
id: `Cancel-${att.ID}`,
|
|
83
|
-
text:
|
|
84
|
-
icon:
|
|
107
|
+
text: thePConn.getLocalizedValue('Cancel', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
|
|
108
|
+
icon: 'times',
|
|
85
109
|
onClick: cancelFile
|
|
86
110
|
}
|
|
87
111
|
];
|
|
88
112
|
} else if (att.links) {
|
|
89
|
-
const isFile = att.type ===
|
|
90
|
-
const ID = att.ID.replace(/\s/gi,
|
|
113
|
+
const isFile = att.type === 'FILE';
|
|
114
|
+
const ID = att.ID.replace(/\s/gi, '');
|
|
91
115
|
const actionsMap = new Map([
|
|
92
116
|
[
|
|
93
|
-
|
|
117
|
+
'download',
|
|
94
118
|
{
|
|
95
119
|
id: `download-${ID}`,
|
|
96
|
-
text: isFile ?
|
|
97
|
-
icon: isFile ?
|
|
120
|
+
text: isFile ? thePConn.getLocalizedValue('Download', '', '') : thePConn.getLocalizedValue('Open', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
|
|
121
|
+
icon: isFile ? 'download' : 'open',
|
|
98
122
|
onClick: downloadFile
|
|
99
123
|
}
|
|
100
124
|
],
|
|
101
125
|
[
|
|
102
|
-
|
|
126
|
+
'delete',
|
|
103
127
|
{
|
|
104
128
|
id: `Delete-${ID}`,
|
|
105
|
-
text:
|
|
106
|
-
icon:
|
|
129
|
+
text: thePConn.getLocalizedValue('Delete', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
|
|
130
|
+
icon: 'trash',
|
|
107
131
|
onClick: deleteFile
|
|
108
132
|
}
|
|
109
133
|
]
|
|
@@ -118,8 +142,8 @@ export default function FileUtility(props) {
|
|
|
118
142
|
actions = [
|
|
119
143
|
{
|
|
120
144
|
id: `Remove-${att.ID}`,
|
|
121
|
-
text:
|
|
122
|
-
icon:
|
|
145
|
+
text: thePConn.getLocalizedValue('Remove', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
|
|
146
|
+
icon: 'trash',
|
|
123
147
|
onClick: removeFile
|
|
124
148
|
}
|
|
125
149
|
];
|
|
@@ -129,13 +153,13 @@ export default function FileUtility(props) {
|
|
|
129
153
|
id: att.ID,
|
|
130
154
|
visual: {
|
|
131
155
|
icon: Utils.getIconForAttachment(att),
|
|
132
|
-
progress: att.progress === 100 ? undefined: att.progress
|
|
156
|
+
progress: att.progress === 100 ? undefined : att.progress
|
|
133
157
|
},
|
|
134
158
|
primary: {
|
|
135
159
|
type: att.type,
|
|
136
160
|
name: att.name,
|
|
137
|
-
icon:
|
|
138
|
-
click: downloadFile
|
|
161
|
+
icon: 'open',
|
|
162
|
+
click: downloadFile
|
|
139
163
|
},
|
|
140
164
|
secondary: {
|
|
141
165
|
text: att.meta
|
|
@@ -147,35 +171,37 @@ export default function FileUtility(props) {
|
|
|
147
171
|
function fileDownload(data, fileName, ext) {
|
|
148
172
|
const file = ext ? `${fileName}.${ext}` : fileName;
|
|
149
173
|
download(atob(data), file);
|
|
150
|
-
}
|
|
174
|
+
}
|
|
151
175
|
|
|
152
176
|
function downloadAttachedFile(att: any) {
|
|
153
177
|
const attachUtils = PCore.getAttachmentUtils();
|
|
154
|
-
const {ID, name, extension, type} = att;
|
|
178
|
+
const { ID, name, extension, type } = att;
|
|
155
179
|
const context = thePConn.getContextName();
|
|
156
180
|
|
|
157
181
|
attachUtils
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
data
|
|
182
|
+
// @ts-ignore - 3rd parameter "responseEncoding" is optional
|
|
183
|
+
.downloadAttachment(ID, context)
|
|
184
|
+
.then((content: any) => {
|
|
185
|
+
if (type === 'FILE') {
|
|
186
|
+
fileDownload(content.data, name, extension);
|
|
187
|
+
} else if (type === 'URL') {
|
|
188
|
+
let { data } = content;
|
|
189
|
+
if (!/^(http|https):\/\//.test(data)) {
|
|
190
|
+
data = `//${data}`;
|
|
191
|
+
}
|
|
192
|
+
window.open(content.data, '_blank');
|
|
166
193
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
})
|
|
170
|
-
.catch();
|
|
194
|
+
})
|
|
195
|
+
.catch();
|
|
171
196
|
}
|
|
172
197
|
|
|
173
198
|
function deleteAttachedFile(att: any) {
|
|
174
199
|
const attachUtils = PCore.getAttachmentUtils();
|
|
175
|
-
const {ID} = att;
|
|
200
|
+
const { ID } = att;
|
|
176
201
|
const context = thePConn.getContextName();
|
|
177
202
|
|
|
178
|
-
attachUtils
|
|
203
|
+
attachUtils
|
|
204
|
+
.deleteAttachment(ID, context)
|
|
179
205
|
.then(() => {
|
|
180
206
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
181
207
|
getAttachments();
|
|
@@ -184,60 +210,57 @@ export default function FileUtility(props) {
|
|
|
184
210
|
}
|
|
185
211
|
|
|
186
212
|
const getAttachments = () => {
|
|
187
|
-
|
|
188
213
|
const attachmentUtils = PCore.getAttachmentUtils();
|
|
189
|
-
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
|
|
214
|
+
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
|
|
190
215
|
|
|
191
|
-
if (caseID && caseID !==
|
|
216
|
+
if (caseID && caseID !== '') {
|
|
192
217
|
const attPromise = attachmentUtils.getCaseAttachments(caseID, thePConn.getContextName());
|
|
193
218
|
|
|
194
|
-
attPromise
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
removeFile: null
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
const viewAllarItems: any = arFullListAttachments.map((att) => {
|
|
208
|
-
return getListUtilityItemProps({
|
|
209
|
-
att,
|
|
210
|
-
downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
|
|
211
|
-
cancelFile: null,
|
|
212
|
-
deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
|
|
213
|
-
removeFile: null
|
|
214
|
-
});
|
|
219
|
+
attPromise.then((resp: any) => {
|
|
220
|
+
const arFullListAttachments = addAttachments(resp);
|
|
221
|
+
const attachmentsCount = arFullListAttachments.length;
|
|
222
|
+
const arItems: any = arFullListAttachments.slice(0, 3).map(att => {
|
|
223
|
+
return getListUtilityItemProps({
|
|
224
|
+
att,
|
|
225
|
+
downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
|
|
226
|
+
cancelFile: null,
|
|
227
|
+
deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
|
|
228
|
+
removeFile: null
|
|
215
229
|
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
230
|
+
});
|
|
231
|
+
const viewAllarItems: any = arFullListAttachments.map(att => {
|
|
232
|
+
return getListUtilityItemProps({
|
|
233
|
+
att,
|
|
234
|
+
downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
|
|
235
|
+
cancelFile: null,
|
|
236
|
+
deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
|
|
237
|
+
removeFile: null
|
|
219
238
|
});
|
|
220
|
-
setFullAttachments(viewAllarItems);
|
|
221
239
|
});
|
|
240
|
+
setProgress(false);
|
|
241
|
+
setList(current => {
|
|
242
|
+
return { ...current, count: attachmentsCount, data: arItems };
|
|
243
|
+
});
|
|
244
|
+
setFullAttachments(viewAllarItems);
|
|
245
|
+
});
|
|
222
246
|
}
|
|
223
|
-
}
|
|
247
|
+
};
|
|
224
248
|
|
|
225
249
|
useEffect(() => {
|
|
226
250
|
getAttachments();
|
|
227
251
|
}, []);
|
|
228
252
|
|
|
229
|
-
|
|
230
253
|
useEffect(() => {
|
|
231
254
|
PCore.getPubSubUtils().subscribe(
|
|
232
|
-
PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
|
|
255
|
+
(PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
|
|
233
256
|
getAttachments,
|
|
234
|
-
|
|
257
|
+
'caseAttachmentsUpdateFromCaseview'
|
|
235
258
|
);
|
|
236
259
|
|
|
237
260
|
return () => {
|
|
238
261
|
PCore.getPubSubUtils().unsubscribe(
|
|
239
|
-
PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
|
|
240
|
-
|
|
262
|
+
(PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
|
|
263
|
+
'caseAttachmentsUpdateFromCaseview'
|
|
241
264
|
);
|
|
242
265
|
};
|
|
243
266
|
}, []);
|
|
@@ -245,19 +268,19 @@ export default function FileUtility(props) {
|
|
|
245
268
|
function setNewFiles(arFiles) {
|
|
246
269
|
let index = 0;
|
|
247
270
|
for (const file of arFiles) {
|
|
248
|
-
if (!validateMaxSize(file, 5)) {
|
|
271
|
+
if (!validateMaxSize(file, '5')) {
|
|
249
272
|
file.error = true;
|
|
250
|
-
file.meta =
|
|
273
|
+
file.meta = 'File is too big. Max allowed size is 5MB.';
|
|
251
274
|
}
|
|
252
275
|
file.mimeType = file.type;
|
|
253
276
|
file.icon = Utils.getIconFromFileType(file.type);
|
|
254
277
|
file.ID = `${new Date().getTime()}I${index}`;
|
|
255
|
-
index+=1;
|
|
278
|
+
index += 1;
|
|
256
279
|
}
|
|
257
280
|
return arFiles;
|
|
258
281
|
}
|
|
259
282
|
|
|
260
|
-
function getFiles(arFiles:
|
|
283
|
+
function getFiles(arFiles: any[]): any[] {
|
|
261
284
|
return setNewFiles(arFiles);
|
|
262
285
|
}
|
|
263
286
|
|
|
@@ -276,14 +299,12 @@ export default function FileUtility(props) {
|
|
|
276
299
|
removeFile: null
|
|
277
300
|
});
|
|
278
301
|
});
|
|
279
|
-
setFileData(
|
|
280
|
-
return {...current, fileList: arFileList$, attachedFiles: myFiles}
|
|
302
|
+
setFileData(current => {
|
|
303
|
+
return { ...current, fileList: arFileList$, attachedFiles: myFiles };
|
|
281
304
|
});
|
|
282
305
|
}
|
|
283
306
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const handleClick = (event) => {
|
|
307
|
+
const handleClick = event => {
|
|
287
308
|
setAnchorEl(event.currentTarget);
|
|
288
309
|
};
|
|
289
310
|
|
|
@@ -292,8 +313,8 @@ export default function FileUtility(props) {
|
|
|
292
313
|
};
|
|
293
314
|
|
|
294
315
|
function onAddFilesClick() {
|
|
295
|
-
setFileData(
|
|
296
|
-
return {...current, showfileModal: true}
|
|
316
|
+
setFileData(current => {
|
|
317
|
+
return { ...current, showfileModal: true };
|
|
297
318
|
});
|
|
298
319
|
setAnchorEl(null);
|
|
299
320
|
}
|
|
@@ -304,82 +325,78 @@ export default function FileUtility(props) {
|
|
|
304
325
|
if (item !== null) {
|
|
305
326
|
attachedFiles = attachedFiles.filter(ele => ele.ID !== item.id);
|
|
306
327
|
fileList = fileList.filter(ele => ele.id !== item.id);
|
|
307
|
-
setFileData(
|
|
308
|
-
return {...current, fileList, attachedFiles}
|
|
328
|
+
setFileData(current => {
|
|
329
|
+
return { ...current, fileList, attachedFiles };
|
|
309
330
|
});
|
|
310
331
|
}
|
|
311
332
|
}
|
|
312
333
|
|
|
313
334
|
function closeFilePopup() {
|
|
314
|
-
setFileData(
|
|
315
|
-
return {...current, showfileModal: false}
|
|
335
|
+
setFileData(current => {
|
|
336
|
+
return { ...current, showfileModal: false };
|
|
316
337
|
});
|
|
317
338
|
}
|
|
318
339
|
|
|
319
340
|
function onAttachFiles() {
|
|
320
341
|
const attachmentUtils = PCore.getAttachmentUtils();
|
|
321
|
-
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
|
|
342
|
+
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
|
|
322
343
|
const onUploadProgress = () => {};
|
|
323
344
|
const errorHandler = () => {};
|
|
324
|
-
closeFilePopup()
|
|
325
|
-
if (fileData.attachedFiles && fileData.attachedFiles.length > 0
|
|
345
|
+
closeFilePopup();
|
|
346
|
+
if (fileData.attachedFiles && fileData.attachedFiles.length > 0) {
|
|
326
347
|
setProgress(true);
|
|
327
348
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
.uploadAttachment(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
getAttachments();
|
|
349
|
-
})
|
|
350
|
-
.catch();
|
|
349
|
+
|
|
350
|
+
Promise.allSettled(
|
|
351
|
+
fileData.attachedFiles.map(file => attachmentUtils.uploadAttachment(file, onUploadProgress, errorHandler, thePConn.getContextName()))
|
|
352
|
+
)
|
|
353
|
+
.then((fileResponses: any) => {
|
|
354
|
+
const uploadedFiles: any = [];
|
|
355
|
+
fileResponses.forEach(fileResponse => {
|
|
356
|
+
if (fileResponse.status === 'fulfilled') {
|
|
357
|
+
uploadedFiles.push(fileResponse.value);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
if (uploadedFiles.length > 0) {
|
|
361
|
+
(attachmentUtils.linkAttachmentsToCase(caseID, uploadedFiles, 'File', thePConn.getContextName()) as Promise<any>)
|
|
362
|
+
.then(() => {
|
|
363
|
+
setFileData(current => {
|
|
364
|
+
return { ...current, fileList: [], attachedFiles: [] };
|
|
365
|
+
});
|
|
366
|
+
getAttachments();
|
|
367
|
+
})
|
|
368
|
+
.catch();
|
|
351
369
|
}
|
|
352
370
|
})
|
|
353
371
|
.catch();
|
|
354
|
-
}
|
|
355
372
|
}
|
|
356
373
|
|
|
357
374
|
function onAddLinksClick() {
|
|
358
|
-
setLinkData(
|
|
359
|
-
return {...current, showLinkModal: true}
|
|
375
|
+
setLinkData(current => {
|
|
376
|
+
return { ...current, showLinkModal: true };
|
|
360
377
|
});
|
|
361
378
|
setAnchorEl(null);
|
|
362
379
|
}
|
|
363
380
|
|
|
364
381
|
function closeAddLinksPopup() {
|
|
365
|
-
setLinkData(
|
|
366
|
-
return {...current, showLinkModal: false}
|
|
382
|
+
setLinkData(current => {
|
|
383
|
+
return { ...current, showLinkModal: false };
|
|
367
384
|
});
|
|
368
385
|
}
|
|
369
386
|
|
|
370
|
-
const fieldlinkOnChange =
|
|
387
|
+
const fieldlinkOnChange = event => {
|
|
371
388
|
const title = event.target.value;
|
|
372
|
-
setLink(
|
|
373
|
-
const updatedData = {...current, title};
|
|
389
|
+
setLink(current => {
|
|
390
|
+
const updatedData = { ...current, title };
|
|
374
391
|
updatedData.disable = !(updatedData.title && updatedData.url);
|
|
375
392
|
return updatedData;
|
|
376
393
|
});
|
|
377
|
-
}
|
|
394
|
+
};
|
|
378
395
|
|
|
379
396
|
function fieldurlOnChange(event) {
|
|
380
397
|
const url = event.target.value;
|
|
381
|
-
setLink(
|
|
382
|
-
const updatedData = {...current, url}
|
|
398
|
+
setLink(current => {
|
|
399
|
+
const updatedData = { ...current, url };
|
|
383
400
|
updatedData.disable = !(updatedData.title && updatedData.url);
|
|
384
401
|
return updatedData;
|
|
385
402
|
});
|
|
@@ -390,12 +407,12 @@ export default function FileUtility(props) {
|
|
|
390
407
|
const localList: any = linkData.linksList.slice();
|
|
391
408
|
const url = link.url;
|
|
392
409
|
if (!/^(http|https):\/\//.test(link.url)) {
|
|
393
|
-
link.url
|
|
410
|
+
link.url = `http://${link.url}`;
|
|
394
411
|
}
|
|
395
412
|
|
|
396
413
|
// list for display
|
|
397
414
|
let oLink: any = {};
|
|
398
|
-
oLink.icon =
|
|
415
|
+
oLink.icon = 'chain';
|
|
399
416
|
oLink.ID = `${new Date().getTime()}`;
|
|
400
417
|
oLink = getListUtilityItemProps({
|
|
401
418
|
att: oLink,
|
|
@@ -404,11 +421,11 @@ export default function FileUtility(props) {
|
|
|
404
421
|
deleteFile: null,
|
|
405
422
|
removeFile: null
|
|
406
423
|
});
|
|
407
|
-
oLink.type =
|
|
424
|
+
oLink.type = 'URL';
|
|
408
425
|
oLink.primary.type = oLink.type;
|
|
409
|
-
oLink.visual.icon =
|
|
426
|
+
oLink.visual.icon = 'chain';
|
|
410
427
|
oLink.primary.name = link.title;
|
|
411
|
-
oLink.primary.icon =
|
|
428
|
+
oLink.primary.icon = 'open';
|
|
412
429
|
oLink.secondary.text = url;
|
|
413
430
|
|
|
414
431
|
localList.push(oLink);
|
|
@@ -422,11 +439,15 @@ export default function FileUtility(props) {
|
|
|
422
439
|
attachedLink.url = url;
|
|
423
440
|
|
|
424
441
|
attachedListTemp.push(attachedLink);
|
|
425
|
-
setLinkData(
|
|
426
|
-
return {
|
|
442
|
+
setLinkData(current => {
|
|
443
|
+
return {
|
|
444
|
+
...current,
|
|
445
|
+
linksList: localList,
|
|
446
|
+
attachedLinks: attachedListTemp
|
|
447
|
+
};
|
|
427
448
|
});
|
|
428
449
|
// clear values
|
|
429
|
-
setLink({title: '', url: '', disable: true});
|
|
450
|
+
setLink({ title: '', url: '', disable: true });
|
|
430
451
|
}
|
|
431
452
|
|
|
432
453
|
function removeLinksFromList(item: any) {
|
|
@@ -435,133 +456,190 @@ export default function FileUtility(props) {
|
|
|
435
456
|
if (item !== null) {
|
|
436
457
|
attachedLinks = attachedLinks.filter(ele => ele.id !== item.id);
|
|
437
458
|
linksList = linksList.filter(ele => ele.id !== item.id);
|
|
438
|
-
setLinkData(
|
|
439
|
-
return {...current, linksList, attachedLinks}
|
|
459
|
+
setLinkData(current => {
|
|
460
|
+
return { ...current, linksList, attachedLinks };
|
|
440
461
|
});
|
|
441
462
|
}
|
|
442
463
|
}
|
|
443
464
|
|
|
444
465
|
function onAttachLinks() {
|
|
445
466
|
const attachmentUtils = PCore.getAttachmentUtils();
|
|
446
|
-
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
|
|
467
|
+
const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
|
|
447
468
|
const links = linkData.attachedLinks;
|
|
448
469
|
closeAddLinksPopup();
|
|
449
470
|
const linksToAttach = links.map((item: any) => ({
|
|
450
|
-
type:
|
|
451
|
-
category:
|
|
471
|
+
type: 'URL',
|
|
472
|
+
category: 'URL',
|
|
452
473
|
url: item.url,
|
|
453
474
|
name: item.linkTitle
|
|
454
475
|
}));
|
|
455
476
|
|
|
456
477
|
if (linksToAttach && linksToAttach.length > 0) {
|
|
457
478
|
setProgress(true);
|
|
458
|
-
attachmentUtils
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
.catch(setProgress(false));
|
|
479
|
+
(attachmentUtils.linkAttachmentsToCase(caseID, linksToAttach, 'URL', thePConn.getContextName()) as Promise<any>)
|
|
480
|
+
.then(() => {
|
|
481
|
+
setLinkData(current => {
|
|
482
|
+
return { ...current, linksList: [], attachedLinks: [] };
|
|
483
|
+
});
|
|
484
|
+
getAttachments();
|
|
485
|
+
})
|
|
486
|
+
.catch(() => setProgress(false));
|
|
467
487
|
}
|
|
468
488
|
}
|
|
469
489
|
|
|
470
490
|
return (
|
|
471
|
-
<div className=
|
|
472
|
-
{inProgress && (
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
491
|
+
<div className='psdk-utility'>
|
|
492
|
+
{inProgress && (
|
|
493
|
+
<div className='progress-div'>
|
|
494
|
+
<CircularProgress />
|
|
495
|
+
</div>
|
|
496
|
+
)}
|
|
497
|
+
<div className='psdk-header'>
|
|
498
|
+
<img className='psdk-file-utility-card-svg-icon' src={headerSvgIcon$} />
|
|
499
|
+
<div className='header-text'>{header}</div>
|
|
500
|
+
<div className='psdk-utility-count' id='attachments-count'>
|
|
501
|
+
{list.count}
|
|
502
|
+
</div>
|
|
503
|
+
<div style={{ flexGrow: 1 }} />
|
|
478
504
|
<div>
|
|
479
505
|
<IconButton
|
|
480
|
-
id=
|
|
506
|
+
id='long-button'
|
|
481
507
|
aria-controls={open ? 'simple-menu' : undefined}
|
|
482
508
|
aria-expanded={open ? 'true' : undefined}
|
|
483
|
-
aria-haspopup=
|
|
509
|
+
aria-haspopup='true'
|
|
484
510
|
onClick={handleClick}
|
|
485
511
|
>
|
|
486
|
-
|
|
512
|
+
<MoreVertIcon />
|
|
487
513
|
</IconButton>
|
|
488
|
-
<Menu style={{marginTop: '3rem'}}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
514
|
+
<Menu style={{ marginTop: '3rem' }} id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
|
|
515
|
+
<MenuItem style={{ fontSize: '14px' }} onClick={onAddFilesClick}>
|
|
516
|
+
{thePConn.getLocalizedValue('Add files', '', '')}
|
|
517
|
+
</MenuItem>{' '}
|
|
518
|
+
{/* 2nd and 3rd args empty string until typedef marked correctly */}
|
|
519
|
+
<MenuItem style={{ fontSize: '14px' }} onClick={onAddLinksClick}>
|
|
520
|
+
{thePConn.getLocalizedValue('Add links', '', '')}
|
|
521
|
+
</MenuItem>{' '}
|
|
522
|
+
{/* 2nd and 3rd args empty string until typedef marked correctly */}
|
|
497
523
|
</Menu>
|
|
498
524
|
</div>
|
|
499
525
|
</div>
|
|
500
|
-
{list.data.length > 0 && (
|
|
501
|
-
<
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
526
|
+
{list.data.length > 0 && (
|
|
527
|
+
<div style={{ marginTop: '1rem' }}>
|
|
528
|
+
<SummaryList arItems$={list.data} />
|
|
529
|
+
</div>
|
|
530
|
+
)}
|
|
531
|
+
{list.count > 3 && (
|
|
532
|
+
<div className='psdk-utility-view-all'>
|
|
533
|
+
<Button style={{ textTransform: 'none' }} color='primary' onClick={() => setViewAll(true)}>
|
|
534
|
+
View all
|
|
535
|
+
</Button>
|
|
536
|
+
</div>
|
|
537
|
+
)}
|
|
506
538
|
{fileData.showfileModal && (
|
|
507
|
-
<div className=
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
539
|
+
<div className='psdk-dialog-background'>
|
|
540
|
+
<div className='psdk-modal-file-top'>
|
|
541
|
+
<h3>{thePConn.getLocalizedValue('Add local files', '', '')}</h3>
|
|
542
|
+
<div className='psdk-modal-body'>
|
|
543
|
+
<div className='psdk-modal-file-selector'>
|
|
544
|
+
<label htmlFor='upload-files'>
|
|
545
|
+
<input style={{ display: 'none' }} id='upload-files' name='upload-files' type='file' multiple onChange={uploadMyFiles} />
|
|
546
|
+
<Button variant='outlined' color='primary' component='span'>
|
|
547
|
+
{thePConn.getLocalizedValue('Attach files', '', '')}
|
|
548
|
+
</Button>{' '}
|
|
549
|
+
{/* 2nd and 3rd args empty string until typedef marked correctly */}
|
|
550
|
+
</label>
|
|
551
|
+
</div>
|
|
552
|
+
{fileData.fileList.length > 0 && (
|
|
553
|
+
<div style={{ marginTop: '1rem' }}>
|
|
554
|
+
<SummaryList menuIconOverride$='trash' arItems$={fileData.fileList} menuIconOverrideAction$={removeFileFromList} />
|
|
555
|
+
</div>
|
|
556
|
+
)}
|
|
557
|
+
{fileData.fileList.length === 0 && <div />}
|
|
558
|
+
<ActionButtonsForFileUtil
|
|
559
|
+
arMainButtons={fileData.fileMainButtons}
|
|
560
|
+
arSecondaryButtons={fileData.fileSecondaryButtons}
|
|
561
|
+
primaryAction={onAttachFiles}
|
|
562
|
+
secondaryAction={closeFilePopup}
|
|
563
|
+
/>
|
|
516
564
|
</div>
|
|
517
|
-
{fileData.fileList.length > 0 && (<div style={{marginTop: '1rem'}}>
|
|
518
|
-
<SummaryList menuIconOverride$='trash' arItems$={fileData.fileList} menuIconOverrideAction$={removeFileFromList}></SummaryList>
|
|
519
|
-
</div>)}
|
|
520
|
-
{fileData.fileList.length === 0 && (<div></div>)}
|
|
521
|
-
<ActionButtonsForFileUtil arMainButtons={fileData.fileMainButtons} arSecondaryButtons={fileData.fileSecondaryButtons}
|
|
522
|
-
primaryAction={onAttachFiles} secondaryAction={closeFilePopup}></ActionButtonsForFileUtil>
|
|
523
565
|
</div>
|
|
524
566
|
</div>
|
|
525
|
-
</div>
|
|
526
567
|
)}
|
|
527
568
|
{linkData.showLinkModal && (
|
|
528
|
-
<div className=
|
|
529
|
-
<div className=
|
|
530
|
-
<h3>Add links</h3>
|
|
531
|
-
<div className=
|
|
532
|
-
<div className=
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
569
|
+
<div className='psdk-dialog-background'>
|
|
570
|
+
<div className='psdk-modal-file-top'>
|
|
571
|
+
<h3>{thePConn.getLocalizedValue('Add links', '', '')}</h3> {/* 2nd and 3rd args empty string until typedef marked correctly */}
|
|
572
|
+
<div className='psdk-modal-body'>
|
|
573
|
+
<div className='psdk-modal-links-row'>
|
|
574
|
+
<div className='psdk-links-two-column'>
|
|
575
|
+
<div className='psdk-modal-link-data'>
|
|
576
|
+
<TextField
|
|
577
|
+
fullWidth
|
|
578
|
+
variant='outlined'
|
|
579
|
+
label='Link title'
|
|
580
|
+
size='small'
|
|
581
|
+
required={required}
|
|
582
|
+
value={link.title}
|
|
583
|
+
onChange={fieldlinkOnChange}
|
|
584
|
+
/>
|
|
540
585
|
</div>
|
|
541
|
-
<div className=
|
|
542
|
-
<
|
|
586
|
+
<div className='psdk-modal-link-data'>
|
|
587
|
+
<TextField
|
|
588
|
+
fullWidth
|
|
589
|
+
variant='outlined'
|
|
590
|
+
label='URL'
|
|
591
|
+
size='small'
|
|
592
|
+
required={required}
|
|
593
|
+
value={link.url}
|
|
594
|
+
onChange={fieldurlOnChange}
|
|
595
|
+
/>
|
|
543
596
|
</div>
|
|
544
597
|
</div>
|
|
545
|
-
|
|
546
|
-
<
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
598
|
+
<div className='psdk-modal-link-add'>
|
|
599
|
+
<Button
|
|
600
|
+
className='psdk-add-link-action'
|
|
601
|
+
color='primary'
|
|
602
|
+
variant='contained'
|
|
603
|
+
component='span'
|
|
604
|
+
onClick={addLink}
|
|
605
|
+
disabled={link.disable}
|
|
606
|
+
>
|
|
607
|
+
{thePConn.getLocalizedValue('Add link', '', '')}
|
|
608
|
+
</Button>{' '}
|
|
609
|
+
{/* 2nd and 3rd args empty string until typedef marked correctly */}
|
|
610
|
+
</div>
|
|
611
|
+
</div>
|
|
612
|
+
{linkData.linksList.length > 0 && (
|
|
613
|
+
<div style={{ marginTop: '1rem' }}>
|
|
614
|
+
<SummaryList menuIconOverride$='trash' arItems$={linkData.linksList} menuIconOverrideAction$={removeLinksFromList} />
|
|
615
|
+
</div>
|
|
616
|
+
)}
|
|
617
|
+
<ActionButtonsForFileUtil
|
|
618
|
+
arMainButtons={linkData.linkMainButtons}
|
|
619
|
+
arSecondaryButtons={linkData.linkSecondaryButtons}
|
|
620
|
+
primaryAction={onAttachLinks}
|
|
621
|
+
secondaryAction={closeAddLinksPopup}
|
|
622
|
+
/>
|
|
550
623
|
</div>
|
|
551
624
|
</div>
|
|
552
625
|
</div>
|
|
553
626
|
)}
|
|
554
|
-
{showViewAllModal && (
|
|
555
|
-
<div className=
|
|
556
|
-
<div className=
|
|
557
|
-
|
|
627
|
+
{showViewAllModal && (
|
|
628
|
+
<div className='psdk-dialog-background'>
|
|
629
|
+
<div className='psdk-modal-file-top'>
|
|
630
|
+
<div className='psdk-view-all-header'>
|
|
631
|
+
<h3>{thePConn.getLocalizedValue('Attachments', '', '')}</h3> {/* 2nd and 3rd args empty string until typedef marked correctly */}
|
|
558
632
|
{/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
|
|
559
|
-
<button type=
|
|
633
|
+
<button type='button' className='psdk-close-button' onClick={() => setViewAll(false)}>
|
|
634
|
+
<img className='psdk-utility-card-actions-svg-icon' src={closeSvgIcon} />
|
|
635
|
+
</button>
|
|
636
|
+
</div>
|
|
637
|
+
<div className='psdk-view-all-body'>
|
|
638
|
+
<SummaryList arItems$={vaItems} />
|
|
639
|
+
</div>
|
|
560
640
|
</div>
|
|
561
|
-
<div className="psdk-view-all-body"><SummaryList arItems$={vaItems}></SummaryList></div>
|
|
562
641
|
</div>
|
|
563
|
-
|
|
642
|
+
)}
|
|
564
643
|
</div>
|
|
565
|
-
|
|
566
|
-
)
|
|
644
|
+
);
|
|
567
645
|
}
|