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