@zohodesk/dot 1.0.0-temp-200.8 → 1.0.0-temp-213
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/.cli/propValidation_report.html +1 -1
- package/README.md +4 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -1
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -1
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -1
- package/es/ActionButton/ActionButton.module.css +2 -2
- package/es/AlphabeticList/AlphabeticList.module.css +2 -2
- package/es/Attachment/Attachment.module.css +4 -8
- package/es/AttachmentViewer/Attachment.js +0 -50
- package/es/AttachmentViewer/AttachmentViewer.js +26 -112
- package/es/AttachmentViewer/AttachmentViewer.module.css +18 -41
- package/es/AttachmentViewer/props/defaultProps.js +1 -1
- package/es/AttachmentViewer/props/propTypes.js +1 -9
- package/es/AttachmentViewer/utils.js +13 -80
- package/es/ChannelIcon/ChannelIcon.module.css +2 -2
- package/es/DotProvider/hooks/useDotProvider.js +2 -2
- package/es/Drawer/Drawer.module.css +1 -1
- package/es/FormAction/FormAction.module.css +1 -1
- package/es/IconButton/IconButton.module.css +2 -2
- package/es/Message/Message.js +1 -1
- package/es/Message/Message.module.css +1 -1
- package/es/MessageBanner/MessageBanner.module.css +1 -1
- package/es/Onboarding/CarouselDots/CarouselDot/css/CarouselDot.module.css +3 -3
- package/es/Onboarding/css/Onboarding.module.css +2 -2
- package/es/PlusIcon/PlusIcon.module.css +1 -1
- package/es/TagWithIcon/TagWithIcon.module.css +2 -2
- package/es/ToastMessage/ToastMessage.module.css +8 -8
- package/es/Upload/Upload.module.css +1 -1
- package/es/avatar/AvatarClose/AvatarClose.module.css +3 -3
- package/es/avatar/AvatarCollision/AvatarCollision.module.css +3 -3
- package/es/avatar/AvatarIcon/AvatarIcon.module.css +1 -1
- package/es/avatar/AvatarStatus/AvatarStatus.module.css +2 -2
- package/es/avatar/AvatarThread/AvatarThread.module.css +2 -2
- package/es/avatar/AvatarUser/AvatarUser.module.css +3 -3
- package/es/avatar/AvatarWithTeam/AvatarWithTeam.module.css +1 -1
- package/es/common/dot_common.module.css +4 -0
- package/es/deprecated/SelectDropdown/SelectDropdown.module.css +2 -2
- package/es/dropdown/ToggleDropDown/ToggleDropDown.module.css +1 -1
- package/es/errorstate/EmptyStates.module.css +1 -1
- package/es/errorstate/WillBack/WillBack.module.css +1 -1
- package/es/form/fields/Fields.module.css +9 -9
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +2 -2
- package/es/form/fields/TextEditorWrapper/TextEditorWrapper.js +1 -1
- package/es/form/layout/Section/ModuleFormSection.module.css +1 -1
- package/es/layout/SetupDetailLayout/SetupDetailLayout.module.css +4 -4
- package/es/layout/SubtabLayout/SubtabLayout.module.css +1 -1
- package/es/list/DotNew/DotNew.module.css +1 -1
- package/es/list/ListStencils/ListStencils.module.css +3 -3
- package/es/list/SecondaryText/SecondaryText.module.css +4 -4
- package/es/list/SecondryPanel/SecondryPanel.module.css +1 -1
- package/es/list/Subject/Subject.module.css +2 -2
- package/es/list/TagNew/TagNew.module.css +1 -1
- package/es/list/Thread/Thread.module.css +1 -1
- package/es/list/listCommon.module.css +3 -3
- package/es/list/status/StatusDropdown/StatusDropdown.js +2 -2
- package/es/list/status/StatusDropdown/StatusDropdown.module.css +1 -1
- package/es/list/status/StatusListItem/StatusListItem.module.css +2 -2
- package/es/lookup/EmptyPage/LookupEmptyPage.module.css +1 -1
- package/es/lookup/Section/LookupSection.module.css +1 -1
- package/es/lookup/header/Title/LookupTitle.module.css +1 -1
- package/es/lookup/header/ViewDropDown/ViewDropDown.module.css +4 -4
- package/es/lookup/header/lookupHeaderCommon.module.css +1 -1
- package/es/setup/header/Link/HeaderLink.module.css +2 -2
- package/es/setup/helptips/Title/HelpTipsTitle.module.css +1 -1
- package/es/setup/table/Text/TableText.module.css +4 -4
- package/es/utils/General.js +1 -23
- package/es/version2/GlobalNotification/GlobalNotification.module.css +2 -2
- package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +1 -1
- package/es/version2/lookup/AlertLookup/AlertLookupNew.module.css +4 -4
- package/es/version2/lookup/alertLookupCommonNew.module.css +1 -1
- package/es/version2/notification/DesktopNotification/DesktopNotification.module.css +6 -6
- package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +2 -2
- package/lib/ActionButton/ActionButton.module.css +2 -2
- package/lib/AlphabeticList/AlphabeticList.module.css +2 -2
- package/lib/Attachment/Attachment.module.css +4 -8
- package/lib/AttachmentViewer/Attachment.js +0 -60
- package/lib/AttachmentViewer/AttachmentViewer.js +23 -125
- package/lib/AttachmentViewer/AttachmentViewer.module.css +18 -41
- package/lib/AttachmentViewer/props/defaultProps.js +1 -1
- package/lib/AttachmentViewer/props/propTypes.js +1 -9
- package/lib/AttachmentViewer/utils.js +8 -85
- package/lib/ChannelIcon/ChannelIcon.module.css +2 -2
- package/lib/DotProvider/hooks/useDotProvider.js +2 -2
- package/lib/Drawer/Drawer.module.css +1 -1
- package/lib/FormAction/FormAction.module.css +1 -1
- package/lib/IconButton/IconButton.module.css +2 -2
- package/lib/Message/Message.js +2 -2
- package/lib/Message/Message.module.css +1 -1
- package/lib/MessageBanner/MessageBanner.module.css +1 -1
- package/lib/Onboarding/CarouselDots/CarouselDot/css/CarouselDot.module.css +3 -3
- package/lib/Onboarding/css/Onboarding.module.css +2 -2
- package/lib/PlusIcon/PlusIcon.module.css +1 -1
- package/lib/TagWithIcon/TagWithIcon.module.css +2 -2
- package/lib/ToastMessage/ToastMessage.module.css +8 -8
- package/lib/Upload/Upload.module.css +1 -1
- package/lib/avatar/AvatarClose/AvatarClose.module.css +3 -3
- package/lib/avatar/AvatarCollision/AvatarCollision.module.css +3 -3
- package/lib/avatar/AvatarIcon/AvatarIcon.module.css +1 -1
- package/lib/avatar/AvatarStatus/AvatarStatus.module.css +2 -2
- package/lib/avatar/AvatarThread/AvatarThread.module.css +2 -2
- package/lib/avatar/AvatarUser/AvatarUser.module.css +3 -3
- package/lib/avatar/AvatarWithTeam/AvatarWithTeam.module.css +1 -1
- package/lib/common/dot_common.module.css +4 -0
- package/lib/deprecated/SelectDropdown/SelectDropdown.module.css +2 -2
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.module.css +1 -1
- package/lib/errorstate/EmptyStates.module.css +1 -1
- package/lib/errorstate/WillBack/WillBack.module.css +1 -1
- package/lib/form/fields/Fields.module.css +9 -9
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +2 -2
- package/lib/form/fields/TextEditorWrapper/TextEditorWrapper.js +2 -2
- package/lib/form/layout/Section/ModuleFormSection.module.css +1 -1
- package/lib/layout/SetupDetailLayout/SetupDetailLayout.module.css +4 -4
- package/lib/layout/SubtabLayout/SubtabLayout.module.css +1 -1
- package/lib/list/DotNew/DotNew.module.css +1 -1
- package/lib/list/ListStencils/ListStencils.module.css +3 -3
- package/lib/list/SecondaryText/SecondaryText.module.css +4 -4
- package/lib/list/SecondryPanel/SecondryPanel.module.css +1 -1
- package/lib/list/Subject/Subject.module.css +2 -2
- package/lib/list/TagNew/TagNew.module.css +1 -1
- package/lib/list/Thread/Thread.module.css +1 -1
- package/lib/list/listCommon.module.css +3 -3
- package/lib/list/status/StatusDropdown/StatusDropdown.js +3 -3
- package/lib/list/status/StatusDropdown/StatusDropdown.module.css +1 -1
- package/lib/list/status/StatusListItem/StatusListItem.module.css +2 -2
- package/lib/lookup/EmptyPage/LookupEmptyPage.module.css +1 -1
- package/lib/lookup/Section/LookupSection.module.css +1 -1
- package/lib/lookup/header/Title/LookupTitle.module.css +1 -1
- package/lib/lookup/header/ViewDropDown/ViewDropDown.module.css +4 -4
- package/lib/lookup/header/lookupHeaderCommon.module.css +1 -1
- package/lib/setup/header/Link/HeaderLink.module.css +2 -2
- package/lib/setup/helptips/Title/HelpTipsTitle.module.css +1 -1
- package/lib/setup/table/Text/TableText.module.css +4 -4
- package/lib/utils/General.js +1 -25
- package/lib/version2/GlobalNotification/GlobalNotification.module.css +2 -2
- package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +1 -1
- package/lib/version2/lookup/AlertLookup/AlertLookupNew.module.css +4 -4
- package/lib/version2/lookup/alertLookupCommonNew.module.css +1 -1
- package/lib/version2/notification/DesktopNotification/DesktopNotification.module.css +6 -6
- package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +2 -2
- package/package.json +19 -15
- package/result.json +0 -1
- package/unittest/index.html +0 -37
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
# 1.7.18
|
|
6
|
+
|
|
7
|
+
- Added UNSAFE_ prefix to deprecated lifecycle methods: componentWillMount, componentWillReceiveProps, and componentWillUpdate.
|
|
8
|
+
|
|
5
9
|
# 1.7.17
|
|
6
10
|
|
|
7
11
|
- **ToggleDropDown** - SecondaryValue supported for listitems and searchFields prop supported
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
--zdt_gridstencils_default_border: hsla(218, 23.08%, calc(22.94% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
222
222
|
--zdt_gridstencils_after_bg: hsla(217, 23.23%, calc(19.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
223
223
|
--zdt_gridstencils_listbar_bg: hsla(217, 23.23%, calc(19.41% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
224
|
-
--zdt_gridstencils_listbar_gradient_bg: linear-gradient(to left, #383f55 0, #414961 20%, #414961 40%, #383f55 100%);
|
|
224
|
+
--zdt_gridstencils_listbar_gradient_bg /* rtl:as:background-image */: linear-gradient(to left, #383f55 0, #414961 20%, #414961 40%, #383f55 100%);
|
|
225
225
|
|
|
226
226
|
/* icons */
|
|
227
227
|
--zdt_icons_default: hsla(217, 13.73%, calc(70.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
--zdt_gridstencils_default_border: hsla(0, 0.00%, calc(94.51% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
222
222
|
--zdt_gridstencils_after_bg: hsla(0, 0.00%, calc(92.16% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
223
223
|
--zdt_gridstencils_listbar_bg: hsla(210, 12.50%, calc(96.86% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
224
|
-
--zdt_gridstencils_listbar_gradient_bg: linear-gradient(to left, var(--zd_smoke78) 0, #edeef1 20%, var(--zd_smoke78) 40%, var(--zd_smoke78) 100%);
|
|
224
|
+
--zdt_gridstencils_listbar_gradient_bg /* rtl:as:background-image */: linear-gradient(to left, var(--zd_smoke78) 0, #edeef1 20%, var(--zd_smoke78) 40%, var(--zd_smoke78) 100%);
|
|
225
225
|
|
|
226
226
|
/* icons */
|
|
227
227
|
--zdt_icons_default: hsla(220, 10.45%, calc(39.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
--zdt_gridstencils_default_border: hsla(0, 2.33%, calc(8.43% + var(--zdc_default_inverse_medium)), calc(1 + var(--zdc_alpha_low)));
|
|
222
222
|
--zdt_gridstencils_after_bg: hsla(0, 0.00%, calc(16.86% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
223
223
|
--zdt_gridstencils_listbar_bg: hsla(0, 0.00%, calc(16.86% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
224
|
-
--zdt_gridstencils_listbar_gradient_bg: linear-gradient(to left, #212121 0, #262626 20%, #262626 40%, #212121 100%);
|
|
224
|
+
--zdt_gridstencils_listbar_gradient_bg /* rtl:as:background-image */: linear-gradient(to left, #212121 0, #262626 20%, #262626 40%, #212121 100%);
|
|
225
225
|
|
|
226
226
|
/* icons */
|
|
227
227
|
--zdt_icons_default: hsla(0, 0.00%, calc(60.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
@@ -114,14 +114,14 @@
|
|
|
114
114
|
|
|
115
115
|
.txt,
|
|
116
116
|
.subTxt {
|
|
117
|
-
composes: dotted from '~@zohodesk/components/
|
|
117
|
+
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
118
118
|
/* css:theme-validation:ignore */
|
|
119
119
|
color: var(--buttonText);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
.arrowWrapper {
|
|
123
123
|
position: relative;
|
|
124
|
-
composes: offSelection from '~@zohodesk/components/
|
|
124
|
+
composes: offSelection from '~@zohodesk/components/es/common/common.module.css';
|
|
125
125
|
cursor: pointer;
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
}
|
|
6
6
|
.container {
|
|
7
7
|
composes: varClass;
|
|
8
|
-
composes: h100 from '~@zohodesk/components/
|
|
8
|
+
composes: h100 from '~@zohodesk/components/es/common/common.module.css';
|
|
9
9
|
list-style: none;
|
|
10
10
|
pointer-events: initial;
|
|
11
11
|
margin: 0 ;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
padding: var(--zd_size3) 0 ;
|
|
28
28
|
}
|
|
29
29
|
.heading {
|
|
30
|
-
composes: dotted from '~@zohodesk/components/
|
|
30
|
+
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
31
31
|
max-width: 100% ;
|
|
32
32
|
}
|
|
33
33
|
.list {
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
height: 100% ;
|
|
15
15
|
width: 100% ;
|
|
16
16
|
position: absolute;
|
|
17
|
-
top:
|
|
17
|
+
top:0
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
[dir=ltr] .disableLayer {
|
|
21
|
-
left:
|
|
21
|
+
left:0
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
[dir=rtl] .disableLayer {
|
|
25
|
-
right:
|
|
25
|
+
right:0
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.attachmentHover {
|
|
@@ -66,10 +66,6 @@
|
|
|
66
66
|
height: var(--zd_size40) ;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.attachleft {
|
|
70
|
-
padding: var(--zd_size3) ;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
69
|
[dir=ltr] .attachleft {
|
|
74
70
|
border-right: 1px solid var(--zdt_attachment_default_border);
|
|
75
71
|
}
|
|
@@ -119,7 +115,7 @@
|
|
|
119
115
|
|
|
120
116
|
.atatchName,
|
|
121
117
|
.attachSize {
|
|
122
|
-
composes: dotted from '~@zohodesk/components/
|
|
118
|
+
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
.medium .attachSize {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getBrowserWithVersion } from "../utils/General";
|
|
2
1
|
const UNASSIGNED = 'Unassigned';
|
|
3
2
|
const BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
|
|
4
3
|
export function isAudioFile(fileName) {
|
|
@@ -15,53 +14,4 @@ export function getExtensionFromFileName(fileName) {
|
|
|
15
14
|
export function isBrowserSupportedFile(fileName) {
|
|
16
15
|
const extension = getExtensionFromFileName(fileName);
|
|
17
16
|
return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
|
|
18
|
-
}
|
|
19
|
-
export function getAttachmentIconDetails(fileName) {
|
|
20
|
-
const extension = getExtensionFromFileName(fileName)?.toLowerCase();
|
|
21
|
-
if (!extension) return 'ZD-GN-fileUnknown';
|
|
22
|
-
const imageExtensions = ['jpeg', 'jpg', 'png', 'apng', 'gif', 'bmp', 'tiff', 'tif', 'ico', 'svg', 'heic', 'webp'];
|
|
23
|
-
const docExtensions = ['txt'];
|
|
24
|
-
const pdfExtensions = ['pdf'];
|
|
25
|
-
const htmlExtensions = ['html', 'htm', 'xhtml'];
|
|
26
|
-
const pptExtensions = ['ppt', 'pps', 'odp', 'sxi', 'pptx', 'ppsx', 'pot', 'potx', 'key'];
|
|
27
|
-
const zipExtensions = ['rar', 'jar', 'zip'];
|
|
28
|
-
const wordExtensions = ['doc', 'docx', 'sxw', 'odt', 'docm', 'dot', 'dotm', 'dotx', 'rtf', 'pages'];
|
|
29
|
-
const xmlExtensions = ['xml'];
|
|
30
|
-
const sheetExtensions = ['xls', 'xlsx', 'xlsm', 'xlsb', 'sxc', 'ods', 'csv', 'tsv', 'numbers'];
|
|
31
|
-
const audioExtensions = ['mp3', 'wav', 'wma', 'aac', 'm4r', 'ogg', 'opus'];
|
|
32
|
-
const videoExtensions = ['mp4', 'mkv', 'mov', 'mpeg', 'flv', 'wmv', 'avi', 'webm', 'ogv'];
|
|
33
|
-
const mailExtensions = ['eml', 'msg'];
|
|
34
|
-
const linuxExtensions = ['sh', 'bin'];
|
|
35
|
-
const cssExtensions = ['css'];
|
|
36
|
-
const exeExtensions = ['exe'];
|
|
37
|
-
const eventExtensions = ['ics'];
|
|
38
|
-
if (imageExtensions.includes(extension)) return 'ZD-EF-fileImage';
|
|
39
|
-
if (docExtensions.includes(extension)) return 'ZD-GN-fileDoc';
|
|
40
|
-
if (pdfExtensions.includes(extension)) return 'ZD-EF-filePdf';
|
|
41
|
-
if (pptExtensions.includes(extension)) return 'ZD-GN-filePpt';
|
|
42
|
-
if (zipExtensions.includes(extension)) return 'ZD-EF-fileZip';
|
|
43
|
-
|
|
44
|
-
if (wordExtensions.includes(extension)) {
|
|
45
|
-
const OSName = navigator.platform?.toLowerCase() || '';
|
|
46
|
-
return OSName.includes('mac') || OSName.includes('linux') ? 'ZD-EF-fileOffice' : 'ZD-EF-fileWord';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (xmlExtensions.includes(extension)) return 'ZD-EF-fileXml';
|
|
50
|
-
if (sheetExtensions.includes(extension)) return 'ZD-GN-fileSheet';
|
|
51
|
-
if (audioExtensions.includes(extension)) return 'ZD-EF-fileMp3';
|
|
52
|
-
if (videoExtensions.includes(extension)) return 'ZD-EF-fileMp4';
|
|
53
|
-
if (mailExtensions.includes(extension)) return 'ZD-GN-fileMail';
|
|
54
|
-
if (linuxExtensions.includes(extension)) return 'ZD-EF-linux';
|
|
55
|
-
if (cssExtensions.includes(extension)) return 'ZD-EF-clrCss';
|
|
56
|
-
if (exeExtensions.includes(extension)) return 'ZD-EF-exe';
|
|
57
|
-
if (eventExtensions.includes(extension)) return 'ZD-TK-event';
|
|
58
|
-
|
|
59
|
-
if (htmlExtensions.includes(extension)) {
|
|
60
|
-
const browser = getBrowserWithVersion()?.toLowerCase() || '';
|
|
61
|
-
if (browser.includes('chrome') || browser.includes('safari')) return 'ZD-EF-fileXml';
|
|
62
|
-
if (browser.includes('ie') || browser.includes('edge')) return 'ZD-EF-explorer';
|
|
63
|
-
return 'ZD-EF-firebox';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return 'ZD-GN-fileUnknown';
|
|
67
17
|
}
|
|
@@ -5,17 +5,16 @@ import { Container, Box } from '@zohodesk/components/lib/Layout';
|
|
|
5
5
|
import { Icon } from '@zohodesk/icons';
|
|
6
6
|
import Avatar from '@zohodesk/components/lib/Avatar/Avatar';
|
|
7
7
|
import { ResponsiveReceiver } from '@zohodesk/components/lib/Responsive/CustomResponsive';
|
|
8
|
-
import Typography from '@zohodesk/components/lib/Typography/Typography';
|
|
9
8
|
import { getUniqueId } from '@zohodesk/components/lib/Provider/IdProvider';
|
|
10
|
-
import Button from '@zohodesk/components/es/Button/Button';
|
|
11
9
|
import AttachmentImage from "./AttachmentImage";
|
|
12
10
|
import Link from "../Link/Link";
|
|
13
11
|
import IconButton from "../IconButton/IconButton";
|
|
14
12
|
import FreezeLayer from "../FreezeLayer/FreezeLayer";
|
|
15
|
-
import {
|
|
13
|
+
import { isAudioFile, getExtensionFromFileName } from "./Attachment";
|
|
16
14
|
import { shallowDiff } from "../utils/General";
|
|
17
|
-
import { checkFileSourcesValidation, FILE_EXTENSIONS } from "./utils";
|
|
18
15
|
import style from "./AttachmentViewer.module.css";
|
|
16
|
+
import { checkFileSourcesValidation } from "./utils";
|
|
17
|
+
import audioThumbNail from "../../images/audio_thumbnail.png";
|
|
19
18
|
export default class AttachmentViewer extends Component {
|
|
20
19
|
constructor(props) {
|
|
21
20
|
super(props);
|
|
@@ -44,26 +43,6 @@ export default class AttachmentViewer extends Component {
|
|
|
44
43
|
this.getUpdateDataList = this.getUpdateDataList.bind(this);
|
|
45
44
|
this.zoomMaintain = this.zoomMaintain.bind(this);
|
|
46
45
|
this.handleMenuValidation = this.handleMenuValidation.bind(this);
|
|
47
|
-
this.getPreviewIconData = this.getPreviewIconData.bind(this);
|
|
48
|
-
this.renderIframe = this.renderIframe.bind(this);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
isImageFileType(fileName) {
|
|
52
|
-
const extension = getExtensionFromFileName(fileName)?.toLowerCase();
|
|
53
|
-
if (!extension) return false;
|
|
54
|
-
return FILE_EXTENSIONS.image.map(ext => ext.toLowerCase()).includes(extension);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
isVideoFileType(fileName) {
|
|
58
|
-
const extension = getExtensionFromFileName(fileName)?.toLowerCase();
|
|
59
|
-
if (!extension) return false;
|
|
60
|
-
return FILE_EXTENSIONS.video.map(ext => ext.toLowerCase()).includes(extension);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
isAudioFileType(fileName) {
|
|
64
|
-
const extension = getExtensionFromFileName(fileName)?.toLowerCase();
|
|
65
|
-
if (!extension) return false;
|
|
66
|
-
return FILE_EXTENSIONS.audio.map(ext => ext.toLowerCase()).includes(extension);
|
|
67
46
|
}
|
|
68
47
|
|
|
69
48
|
componentDidMount() {
|
|
@@ -108,19 +87,13 @@ export default class AttachmentViewer extends Component {
|
|
|
108
87
|
data,
|
|
109
88
|
selectedIndex
|
|
110
89
|
} = this.state;
|
|
111
|
-
const {
|
|
112
|
-
allowedPreviewExtensionsData
|
|
113
|
-
} = this.props;
|
|
114
90
|
const selectedAttachment = data[selectedIndex] || {};
|
|
115
91
|
const selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
116
92
|
const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
117
93
|
const selectedAttachmentName = selectedAttachment.name;
|
|
118
|
-
const selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
119
94
|
checkFileSourcesValidation({
|
|
120
95
|
fileName: selectedAttachmentName,
|
|
121
|
-
viewURL: selectedAttachmentViewUrl
|
|
122
|
-
previewUrl: selectedAttachmentPreviewUrl,
|
|
123
|
-
allowedPreviewExtensionsData
|
|
96
|
+
viewURL: selectedAttachmentViewUrl
|
|
124
97
|
}).then(fileSourceValidation => {
|
|
125
98
|
const {
|
|
126
99
|
isViewURLValid,
|
|
@@ -277,37 +250,7 @@ export default class AttachmentViewer extends Component {
|
|
|
277
250
|
};
|
|
278
251
|
}
|
|
279
252
|
|
|
280
|
-
|
|
281
|
-
const fileUnknown = {
|
|
282
|
-
iconName: 'ZD-GN-fileUnknown',
|
|
283
|
-
iconSize: '40'
|
|
284
|
-
};
|
|
285
|
-
const fileIconName = getAttachmentIconDetails(name);
|
|
286
|
-
const fileDetails = name ? {
|
|
287
|
-
iconName: fileIconName,
|
|
288
|
-
iconSize: size
|
|
289
|
-
} : fileUnknown;
|
|
290
|
-
const {
|
|
291
|
-
iconName,
|
|
292
|
-
iconSize
|
|
293
|
-
} = fileDetails;
|
|
294
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
295
|
-
iconClass: style.prevFooterIcon,
|
|
296
|
-
name: iconName,
|
|
297
|
-
size: iconSize,
|
|
298
|
-
"data-id": dataId
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
renderIframe(previewurl) {
|
|
303
|
-
return /*#__PURE__*/React.createElement("iframe", {
|
|
304
|
-
src: previewurl,
|
|
305
|
-
className: style.previewFrame,
|
|
306
|
-
...this.props.customProps.iframeProps
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
imgPreviewView(downloadUrl) {
|
|
253
|
+
imgPreviewView() {
|
|
311
254
|
var _this = this;
|
|
312
255
|
|
|
313
256
|
const {
|
|
@@ -319,9 +262,7 @@ export default class AttachmentViewer extends Component {
|
|
|
319
262
|
} = this.state;
|
|
320
263
|
const {
|
|
321
264
|
maintainZoom,
|
|
322
|
-
dataId
|
|
323
|
-
i18nKeys,
|
|
324
|
-
renderUnSupportedElement
|
|
265
|
+
dataId
|
|
325
266
|
} = this.props;
|
|
326
267
|
|
|
327
268
|
const getImgStyle = i => {
|
|
@@ -358,25 +299,17 @@ export default class AttachmentViewer extends Component {
|
|
|
358
299
|
children,
|
|
359
300
|
dataId = 'attachViewer',
|
|
360
301
|
customClass = {},
|
|
361
|
-
customProps = {}
|
|
362
|
-
previewurl,
|
|
363
|
-
type
|
|
302
|
+
customProps = {}
|
|
364
303
|
} = data;
|
|
365
304
|
const {
|
|
366
305
|
audioProps = {},
|
|
367
|
-
imageProps = {}
|
|
368
|
-
videoProps = {}
|
|
306
|
+
imageProps = {}
|
|
369
307
|
} = customProps;
|
|
370
308
|
const {
|
|
371
309
|
customImageClass = '',
|
|
372
310
|
customChildrenClass = ''
|
|
373
311
|
} = customClass;
|
|
374
312
|
const retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
375
|
-
const extension = getExtensionFromFileName(name);
|
|
376
|
-
const {
|
|
377
|
-
previewUnsupportedText = "Preview not available for the selected file type.",
|
|
378
|
-
downloadText = "Download"
|
|
379
|
-
} = i18nKeys;
|
|
380
313
|
return /*#__PURE__*/React.createElement(Container, {
|
|
381
314
|
className: style.imgBox,
|
|
382
315
|
id: `imgBox${i}`,
|
|
@@ -387,52 +320,32 @@ export default class AttachmentViewer extends Component {
|
|
|
387
320
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
388
321
|
className: style.imgRef,
|
|
389
322
|
id: `imgPreviewRef${i}`
|
|
390
|
-
}, selectedIndex == i
|
|
391
|
-
|
|
392
|
-
className: style.zoomIn,
|
|
393
|
-
"data-id": `${dataId}_audioPreview`,
|
|
394
|
-
"data-test-id": `${dataId}_audioPreview`,
|
|
395
|
-
...audioProps
|
|
396
|
-
}, /*#__PURE__*/React.createElement("source", {
|
|
397
|
-
src: previewurl,
|
|
398
|
-
type: `audio/${extension}`
|
|
399
|
-
})) : _this.isVideoFileType(name) ? /*#__PURE__*/React.createElement("video", {
|
|
323
|
+
}, isAudioFile(name) ? selectedIndex == i ? /*#__PURE__*/React.createElement("video", {
|
|
324
|
+
autoPlay: true,
|
|
400
325
|
controls: true,
|
|
401
326
|
className: style.zoomIn,
|
|
402
327
|
"data-id": `${dataId}_videoPreview`,
|
|
403
328
|
"data-test-id": `${dataId}_videoPreview`,
|
|
404
|
-
...
|
|
329
|
+
...audioProps
|
|
405
330
|
}, /*#__PURE__*/React.createElement("source", {
|
|
406
331
|
src: viewUrl,
|
|
407
|
-
type: `
|
|
408
|
-
})) :
|
|
332
|
+
type: `audio/${getExtensionFromFileName(name)}`
|
|
333
|
+
})) : null : /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
409
334
|
customClass: {
|
|
410
|
-
customImageClass: `${style.img} ${style.altText}
|
|
335
|
+
customImageClass: `${style.img} ${style.altText}
|
|
336
|
+
${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
411
337
|
customChildrenClass
|
|
412
338
|
},
|
|
413
339
|
src: viewUrl,
|
|
414
|
-
onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e =>
|
|
340
|
+
onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e => {
|
|
341
|
+
_this.zoomIn(e, i, true);
|
|
342
|
+
} : undefined,
|
|
415
343
|
alt: name,
|
|
416
344
|
dataId: dataId,
|
|
417
345
|
id: `img${i}`,
|
|
418
346
|
isCover: false,
|
|
419
347
|
...imageProps
|
|
420
|
-
}, children)
|
|
421
|
-
className: style.previewNone
|
|
422
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
423
|
-
className: style.fileTypeImg
|
|
424
|
-
}, _this.getPreviewIconData(name, '70')), /*#__PURE__*/React.createElement(Typography, {
|
|
425
|
-
$ui_size: "20",
|
|
426
|
-
$ui_weight: "semibold"
|
|
427
|
-
}, previewUnsupportedText), /*#__PURE__*/React.createElement(Link, {
|
|
428
|
-
href: downloadUrl,
|
|
429
|
-
className: style.downloadLink,
|
|
430
|
-
hasReload: true,
|
|
431
|
-
download: true
|
|
432
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
433
|
-
palette: "primaryFilled",
|
|
434
|
-
text: downloadText
|
|
435
|
-
}))))));
|
|
348
|
+
}, children)));
|
|
436
349
|
});
|
|
437
350
|
}
|
|
438
351
|
|
|
@@ -458,7 +371,7 @@ export default class AttachmentViewer extends Component {
|
|
|
458
371
|
} = customProps;
|
|
459
372
|
const totalLen = data.length;
|
|
460
373
|
const selectedAttachment = data[selectedIndex] || {};
|
|
461
|
-
const selectedImgUrl = selectedAttachment.
|
|
374
|
+
const selectedImgUrl = selectedAttachment.viewUrl;
|
|
462
375
|
const downloadUrl = selectedAttachment.downloadUrl;
|
|
463
376
|
let authorHref;
|
|
464
377
|
let authorName;
|
|
@@ -613,7 +526,7 @@ export default class AttachmentViewer extends Component {
|
|
|
613
526
|
eleRef: this.setImgBoxRef,
|
|
614
527
|
scroll: "both",
|
|
615
528
|
flexible: true
|
|
616
|
-
}, this.imgPreviewView(
|
|
529
|
+
}, this.imgPreviewView()), /*#__PURE__*/React.createElement(Box, {
|
|
617
530
|
className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${totalLen === selectedIndex + 1 ? style.hidden : ''}`,
|
|
618
531
|
onClick: this.changeSelectedIndex.bind(this, selectedIndex + 1),
|
|
619
532
|
"data-title": i18nKeys.nextText,
|
|
@@ -669,19 +582,20 @@ export default class AttachmentViewer extends Component {
|
|
|
669
582
|
let {
|
|
670
583
|
thumbnail
|
|
671
584
|
} = item;
|
|
672
|
-
const isImageFileType = this.isImageFileType(name) || thumbnail;
|
|
673
585
|
const {
|
|
674
586
|
customImageClass = '',
|
|
675
587
|
customChildrenClass = ''
|
|
676
588
|
} = customClass;
|
|
589
|
+
thumbnail = isAudioFile(name) ? thumbnail || audioThumbNail : thumbnail; //fallback thumbnail for audio
|
|
590
|
+
|
|
677
591
|
return /*#__PURE__*/React.createElement(Box, {
|
|
678
|
-
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}
|
|
592
|
+
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}`,
|
|
679
593
|
key: index,
|
|
680
594
|
onClick: this.changeSelectedIndex.bind(this, index),
|
|
681
595
|
eleRef: el => this[`img_${index}`] = el,
|
|
682
596
|
dataId: "attachPreviewList",
|
|
683
597
|
"data-title": name
|
|
684
|
-
},
|
|
598
|
+
}, /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
685
599
|
src: thumbnail || viewUrl,
|
|
686
600
|
size: "small",
|
|
687
601
|
alt: name,
|
|
@@ -691,7 +605,7 @@ export default class AttachmentViewer extends Component {
|
|
|
691
605
|
},
|
|
692
606
|
dataId: dataId,
|
|
693
607
|
...customProps
|
|
694
|
-
}, children)
|
|
608
|
+
}, children));
|
|
695
609
|
}))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
|
|
696
610
|
dataId: "attachToggle",
|
|
697
611
|
onClick: this.togglePViewList,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
height: var(--zd_size40) ;
|
|
3
3
|
position: relative;
|
|
4
4
|
z-index: 1;
|
|
5
|
-
composes: alignVertical from '~@zohodesk/components/
|
|
5
|
+
composes: alignVertical from '~@zohodesk/components/es/common/common.module.css';
|
|
6
6
|
background-color: var(--zdt_attachmentviewer_header_bg);
|
|
7
7
|
padding: 0 var(--zd_size15) ;
|
|
8
8
|
border-bottom: 1px solid var(--zdt_attachmentviewer_header_border);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
.title {
|
|
12
12
|
max-width: 50% ;
|
|
13
|
-
composes: dotted from '~@zohodesk/components/
|
|
13
|
+
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
[dir=ltr] .title {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
.count {
|
|
25
25
|
position: absolute;
|
|
26
|
-
composes: xMiddle from '~@zohodesk/components/
|
|
26
|
+
composes: xMiddle from '~@zohodesk/components/es/common/common.module.css';
|
|
27
27
|
padding: 0 var(--zd_size10) ;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
font-size: var(--zd_font_size22) ;
|
|
80
80
|
height: var(--zd_size38) ;
|
|
81
81
|
width: var(--zd_size38) ;
|
|
82
|
-
line-height: 1.
|
|
82
|
+
line-height: 1.6364;
|
|
83
83
|
border-radius: 50%;
|
|
84
84
|
cursor: pointer;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.preview {
|
|
88
|
-
composes: posrel from '~@zohodesk/components/
|
|
88
|
+
composes: posrel from '~@zohodesk/components/es/common/common.module.css';
|
|
89
89
|
text-align: center;
|
|
90
90
|
margin: var(--zd_size20) 0 ;
|
|
91
91
|
}
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
max-height: 100% ;
|
|
95
95
|
max-width: 90% ;
|
|
96
96
|
position: absolute;
|
|
97
|
-
composes: middleBoth from '~@zohodesk/components/
|
|
97
|
+
composes: middleBoth from '~@zohodesk/components/es/common/common.module.css';
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
.zoomOut {
|
|
@@ -230,10 +230,14 @@
|
|
|
230
230
|
transform: rotateX(0deg);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.
|
|
234
|
-
|
|
235
|
-
width:
|
|
236
|
-
|
|
233
|
+
.isAudio {
|
|
234
|
+
composes: audioImage from '../common/dot_common.module.css';
|
|
235
|
+
width: var(--zd_size100) ;
|
|
236
|
+
background-size: 100% 100%;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.isAudio .image {
|
|
240
|
+
opacity: 0;
|
|
237
241
|
}
|
|
238
242
|
|
|
239
243
|
.video {
|
|
@@ -269,7 +273,7 @@
|
|
|
269
273
|
height: 100% ;
|
|
270
274
|
max-width: 100% ;
|
|
271
275
|
max-height: 100% ;
|
|
272
|
-
composes: dflex from '~@zohodesk/components/
|
|
276
|
+
composes: dflex from '~@zohodesk/components/es/common/common.module.css';
|
|
273
277
|
}
|
|
274
278
|
|
|
275
279
|
.img {
|
|
@@ -302,7 +306,7 @@
|
|
|
302
306
|
|
|
303
307
|
.spinLoad {
|
|
304
308
|
position: absolute;
|
|
305
|
-
composes: middleBoth from '~@zohodesk/components/
|
|
309
|
+
composes: middleBoth from '~@zohodesk/components/es/common/common.module.css';
|
|
306
310
|
height: var(--zd_size18) ;
|
|
307
311
|
width: var(--zd_size18) ;
|
|
308
312
|
cursor: progress
|
|
@@ -312,7 +316,7 @@
|
|
|
312
316
|
height: 100% ;
|
|
313
317
|
width: 100% ;
|
|
314
318
|
composes: rotate from '../common/dot_animation.module.css';
|
|
315
|
-
composes: infinite from '~@zohodesk/components/
|
|
319
|
+
composes: infinite from '~@zohodesk/components/es/common/animation.module.css';
|
|
316
320
|
border: 2px solid var(--zdt_attachmentviewer_loader_border);
|
|
317
321
|
border-top-color: var(--zdt_attachmentviewer_loader_border_top);
|
|
318
322
|
border-radius: 50%;
|
|
@@ -348,7 +352,7 @@
|
|
|
348
352
|
.authorName {
|
|
349
353
|
font-size: var(--zd_font_size15) ;
|
|
350
354
|
color: var(--zdt_attachmentviewer_title_text);
|
|
351
|
-
composes: dotted from '~@zohodesk/components/
|
|
355
|
+
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
352
356
|
margin: 0 var(--zd_size10) ;
|
|
353
357
|
}
|
|
354
358
|
|
|
@@ -358,31 +362,4 @@
|
|
|
358
362
|
background-color: var(--dot_mirror);
|
|
359
363
|
border: 0;
|
|
360
364
|
cursor: pointer;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.fileTypeImg {
|
|
364
|
-
margin-bottom: var(--zd_size30) ;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.previewNone {
|
|
368
|
-
color: var(--zdt_attachmentviewer_title_text);
|
|
369
|
-
max-width: 70% ;
|
|
370
|
-
text-align: center;
|
|
371
|
-
margin: auto ;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
.downloadLink {
|
|
375
|
-
display: inline-block;
|
|
376
|
-
padding-top: var(--zd_size15) ;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
.previewIconDiv {
|
|
380
|
-
width: var(--zd_size60) ;
|
|
381
|
-
composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.prevFooterIcon {
|
|
385
|
-
color: var(--zdt_attachmentviewer_title_text);
|
|
386
|
-
padding: var(--zd_size2) ;
|
|
387
|
-
margin: auto ;
|
|
388
365
|
}
|
|
@@ -8,9 +8,9 @@ export const AttachmentImage_defaultProps = {
|
|
|
8
8
|
export const AttachmentViewer_defaultProps = {
|
|
9
9
|
responsiveId: "Helmet",
|
|
10
10
|
needDownload: true,
|
|
11
|
+
i18nKeys: {},
|
|
11
12
|
maintainZoom: false,
|
|
12
13
|
isActive: false,
|
|
13
14
|
dataId: 'AttachmentViewer',
|
|
14
|
-
i18nKeys: {},
|
|
15
15
|
customProps: {}
|
|
16
16
|
};
|
|
@@ -26,8 +26,7 @@ export const AttachmentViewer_propTypes = {
|
|
|
26
26
|
downloadText: PropTypes.string,
|
|
27
27
|
closeText: PropTypes.string,
|
|
28
28
|
hideText: PropTypes.string,
|
|
29
|
-
showText: PropTypes.string
|
|
30
|
-
previewUnsupportedText: PropTypes.string
|
|
29
|
+
showText: PropTypes.string
|
|
31
30
|
}),
|
|
32
31
|
needDownload: PropTypes.string,
|
|
33
32
|
previewObj: PropTypes.object,
|
|
@@ -35,13 +34,6 @@ export const AttachmentViewer_propTypes = {
|
|
|
35
34
|
maintainZoom: PropTypes.bool,
|
|
36
35
|
isActive: PropTypes.bool,
|
|
37
36
|
dataId: PropTypes.string,
|
|
38
|
-
allowedPreviewExtensionsData: PropTypes.shape({
|
|
39
|
-
audio: PropTypes.arrayOf(PropTypes.string),
|
|
40
|
-
video: PropTypes.arrayOf(PropTypes.string),
|
|
41
|
-
image: PropTypes.arrayOf(PropTypes.string),
|
|
42
|
-
document: PropTypes.arrayOf(PropTypes.string)
|
|
43
|
-
}),
|
|
44
|
-
renderUnSupportedElement: PropTypes.func,
|
|
45
37
|
customProps: PropTypes.shape({
|
|
46
38
|
avatarProps: PropTypes.exact(AvatarProps)
|
|
47
39
|
})
|