@zohodesk/dot 1.0.0-temp-187.14 → 1.0.0-temp-200.5
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/es/Attachment/Attachment.module.css +7 -3
- package/es/AttachmentViewer/Attachment.js +208 -3
- package/es/AttachmentViewer/AttachmentViewer.js +81 -24
- package/es/AttachmentViewer/AttachmentViewer.module.css +55 -9
- package/es/AttachmentViewer/props/propTypes.js +3 -1
- package/es/AttachmentViewer/utils.js +36 -2
- package/es/Onboarding/Onboarding.js +1 -1
- package/es/VideoLookup/VideoLookup.js +1 -1
- package/es/form/fields/Fields.module.css +0 -4
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
- package/es/form/fields/TagsMultiSelect/props/propTypes.js +1 -2
- package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
- package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/es/list/DepartmentDropDown/props/propTypes.js +0 -3
- package/es/list/status/StatusListItem/StatusListItem.module.css +6 -5
- package/es/utils/General.js +23 -1
- package/lib/Attachment/Attachment.module.css +7 -3
- package/lib/AttachmentViewer/Attachment.js +226 -3
- package/lib/AttachmentViewer/AttachmentViewer.js +82 -21
- package/lib/AttachmentViewer/AttachmentViewer.module.css +55 -9
- package/lib/AttachmentViewer/props/propTypes.js +3 -1
- package/lib/AttachmentViewer/utils.js +47 -1
- package/lib/Onboarding/Onboarding.js +2 -2
- package/lib/VideoLookup/VideoLookup.js +2 -2
- package/lib/form/fields/Fields.module.css +0 -4
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
- package/lib/form/fields/TagsMultiSelect/props/propTypes.js +1 -2
- package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
- package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/lib/list/DepartmentDropDown/props/propTypes.js +0 -2
- package/lib/list/status/StatusListItem/StatusListItem.module.css +6 -5
- package/lib/utils/General.js +25 -1
- package/package.json +4 -4
- package/result.json +1 -1
- package/unittest/index.html +2 -14
- package/es/common/dot_common.module.css +0 -4
- package/lib/common/dot_common.module.css +0 -4
- /package/es/Onboarding/css/{CardOnboarding.module.css → Onboarding.module.css} +0 -0
- /package/es/VideoLookup/css/{VideoLookupStyles.module.css → VideoLookup.module.css} +0 -0
- /package/lib/Onboarding/css/{CardOnboarding.module.css → Onboarding.module.css} +0 -0
- /package/lib/VideoLookup/css/{VideoLookupStyles.module.css → VideoLookup.module.css} +0 -0
|
@@ -48,12 +48,8 @@ class DepartmentDropDown extends Component {
|
|
|
48
48
|
onSearch,
|
|
49
49
|
needSearchFetching,
|
|
50
50
|
searchStr,
|
|
51
|
-
i18nKeys
|
|
52
|
-
customProps
|
|
51
|
+
i18nKeys
|
|
53
52
|
} = this.props;
|
|
54
|
-
const {
|
|
55
|
-
ToggleDropDownProps = {}
|
|
56
|
-
} = customProps;
|
|
57
53
|
let {
|
|
58
54
|
title = 'Move Department',
|
|
59
55
|
searchEmptyText = 'No results found',
|
|
@@ -88,8 +84,7 @@ class DepartmentDropDown extends Component {
|
|
|
88
84
|
getNextOptions: getNextOptions,
|
|
89
85
|
isNextOptions: isNextOptions,
|
|
90
86
|
onSearch: onSearch,
|
|
91
|
-
needSearchFetching: needSearchFetching
|
|
92
|
-
...ToggleDropDownProps
|
|
87
|
+
needSearchFetching: needSearchFetching
|
|
93
88
|
});
|
|
94
89
|
}
|
|
95
90
|
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
.value {
|
|
37
37
|
composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
|
|
38
38
|
}
|
|
39
|
-
.multiLineValue
|
|
40
|
-
|
|
39
|
+
.multiLineValue{
|
|
40
|
+
word-break: break-word;
|
|
41
|
+
composes: clamp from '~@zohodesk/components/lib/common/common.module.css';
|
|
41
42
|
}
|
|
42
43
|
[dir=ltr] .withBorder.active {
|
|
43
44
|
border-left-color: var(--zdt_statuslistitem_default_active_border);
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
[dir=rtl] .withBorder.active {
|
|
46
47
|
border-right-color: var(--zdt_statuslistitem_default_active_border);
|
|
47
48
|
}
|
|
49
|
+
|
|
48
50
|
.default.hover, .default.effect:hover {
|
|
49
51
|
background-color: var(--zdt_statuslistitem_default_effect_bg);
|
|
50
52
|
}
|
|
@@ -88,9 +90,8 @@
|
|
|
88
90
|
}
|
|
89
91
|
/* Status Type */
|
|
90
92
|
.statusType {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
font-size: var(--zd_font_size8) ;
|
|
93
|
+
width: var(--zd_size8) ;
|
|
94
|
+
height: var(--zd_size8) ;
|
|
94
95
|
border-radius: 50%;
|
|
95
96
|
}
|
|
96
97
|
[dir=ltr] .statusType {
|
package/es/utils/General.js
CHANGED
|
@@ -43,4 +43,26 @@ export function formatPhoneUrl(phone) {
|
|
|
43
43
|
|
|
44
44
|
return phone;
|
|
45
45
|
}
|
|
46
|
-
export const DUMMY_OBJECT = Object.freeze({});
|
|
46
|
+
export const DUMMY_OBJECT = Object.freeze({});
|
|
47
|
+
export function getBrowserWithVersion() {
|
|
48
|
+
const userAgent = navigator.userAgent;
|
|
49
|
+
let tempMatch;
|
|
50
|
+
let browserMatch = userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*([\d\.]+)/i) || [];
|
|
51
|
+
|
|
52
|
+
if (userAgent.toLowerCase().indexOf('edge') !== -1) {
|
|
53
|
+
return userAgent.substring(userAgent.toLowerCase().indexOf('edge'));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (/trident/i.test(browserMatch[1])) {
|
|
57
|
+
tempMatch = /\brv[ :]+(\d+(\.\d+)?)/g.exec(userAgent) || [];
|
|
58
|
+
return `IE ${tempMatch[1] || ''}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
browserMatch = browserMatch[2] ? [browserMatch[1], browserMatch[2]] : [navigator.appName, navigator.appVersion, '-?'];
|
|
62
|
+
|
|
63
|
+
if ((tempMatch = userAgent.match(/version\/([\.\d]+)/i)) !== null) {
|
|
64
|
+
browserMatch[2] = tempMatch[1];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return browserMatch.join(' ');
|
|
68
|
+
}
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
height: 100% ;
|
|
15
15
|
width: 100% ;
|
|
16
16
|
position: absolute;
|
|
17
|
-
top:0
|
|
17
|
+
top: 0
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
[dir=ltr] .disableLayer {
|
|
21
|
-
left:0
|
|
21
|
+
left: 0
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
[dir=rtl] .disableLayer {
|
|
25
|
-
right:0
|
|
25
|
+
right: 0
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.attachmentHover {
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
height: var(--zd_size40) ;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
.attachleft {
|
|
70
|
+
padding: var(--zd_size3) ;
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
[dir=ltr] .attachleft {
|
|
70
74
|
border-right: 1px solid var(--zdt_attachment_default_border);
|
|
71
75
|
}
|
|
@@ -3,15 +3,53 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getAttachmentIconDetails = getAttachmentIconDetails;
|
|
6
7
|
exports.getExtensionFromFileName = getExtensionFromFileName;
|
|
7
8
|
exports.isAudioFile = isAudioFile;
|
|
8
9
|
exports.isBrowserSupportedFile = isBrowserSupportedFile;
|
|
10
|
+
exports.isDocsFile = isDocsFile;
|
|
11
|
+
exports.isEmailFile = isEmailFile;
|
|
12
|
+
exports.isImageFile = isImageFile;
|
|
13
|
+
exports.isPdfFile = isPdfFile;
|
|
14
|
+
exports.isPresentationFile = isPresentationFile;
|
|
15
|
+
exports.isSheetFile = isSheetFile;
|
|
16
|
+
exports.isVideoFile = isVideoFile;
|
|
17
|
+
|
|
18
|
+
var _General = require("../utils/General");
|
|
19
|
+
|
|
9
20
|
var UNASSIGNED = 'Unassigned';
|
|
10
21
|
var BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
|
|
11
22
|
|
|
12
|
-
function isAudioFile(
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
function isAudioFile(extension) {
|
|
24
|
+
return /mp3|wav|ogg|oga|m4a|weba|opus|m4b|webma|aac/i.test(extension);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isVideoFile(extension) {
|
|
28
|
+
return /mp4|webm|ogg/i.test(extension);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function isPdfFile(extension) {
|
|
32
|
+
return /pdf/i.test(extension);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isDocsFile(extension) {
|
|
36
|
+
return /docx|doc|docm|rtf|odt|dot|dotm|dotx|pages/i.test(extension);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function isSheetFile(extension) {
|
|
40
|
+
return /xlsx|numbers/i.test(extension);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function isPresentationFile(extension) {
|
|
44
|
+
return /pptx|ppt|pps|ppsx|key/i.test(extension);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isEmailFile(extension) {
|
|
48
|
+
return /eml|msg/i.test(extension);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function isImageFile(extension) {
|
|
52
|
+
return /jpeg|jpg|png|gif|bmp|ico/i.test(extension);
|
|
15
53
|
}
|
|
16
54
|
|
|
17
55
|
function getExtensionFromFileName(fileName) {
|
|
@@ -25,4 +63,189 @@ function getExtensionFromFileName(fileName) {
|
|
|
25
63
|
function isBrowserSupportedFile(fileName) {
|
|
26
64
|
var extension = getExtensionFromFileName(fileName);
|
|
27
65
|
return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function getAttachmentIconDetails(fileName, size) {
|
|
69
|
+
var extension = getExtensionFromFileName(fileName);
|
|
70
|
+
var browserName = (0, _General.getBrowserWithVersion)().toLowerCase() || '';
|
|
71
|
+
var OSName = navigator.platform.toLowerCase() || '';
|
|
72
|
+
|
|
73
|
+
switch (extension) {
|
|
74
|
+
case 'jpeg':
|
|
75
|
+
case 'jpg':
|
|
76
|
+
case 'png':
|
|
77
|
+
case 'apng':
|
|
78
|
+
case 'gif':
|
|
79
|
+
case 'bmp':
|
|
80
|
+
case 'tiff':
|
|
81
|
+
case 'tif':
|
|
82
|
+
case 'ico':
|
|
83
|
+
case 'svg':
|
|
84
|
+
case 'heic':
|
|
85
|
+
case 'webp':
|
|
86
|
+
return {
|
|
87
|
+
iconName: 'ZD-EF-fileImage',
|
|
88
|
+
iconSize: size
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
case 'txt':
|
|
92
|
+
return {
|
|
93
|
+
iconName: 'ZD-GN-fileDoc',
|
|
94
|
+
iconSize: size
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
case 'pdf':
|
|
98
|
+
return {
|
|
99
|
+
iconName: 'ZD-EF-filePdf',
|
|
100
|
+
iconSize: size
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
case 'html':
|
|
104
|
+
case 'htm':
|
|
105
|
+
case 'xhtml':
|
|
106
|
+
if (browserName.indexOf('chrome') !== -1 || browserName.indexOf('safari') !== -1) {
|
|
107
|
+
return {
|
|
108
|
+
iconName: 'ZD-EF-fileXml',
|
|
109
|
+
iconSize: size
|
|
110
|
+
};
|
|
111
|
+
} else if (browserName.indexOf('ie') !== -1 || browserName.indexOf('edge') !== -1) {
|
|
112
|
+
return {
|
|
113
|
+
iconName: 'ZD-EF-explorer',
|
|
114
|
+
iconSize: size
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
iconName: 'ZD-EF-firebox',
|
|
120
|
+
iconSize: size
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
case 'ppt':
|
|
124
|
+
case 'pps':
|
|
125
|
+
case 'odp':
|
|
126
|
+
case 'sxi':
|
|
127
|
+
case 'pptx':
|
|
128
|
+
case 'ppsx':
|
|
129
|
+
case 'pot':
|
|
130
|
+
case 'potx':
|
|
131
|
+
case 'key':
|
|
132
|
+
return {
|
|
133
|
+
iconName: 'ZD-GN-filePpt',
|
|
134
|
+
iconSize: size
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
case 'rar':
|
|
138
|
+
case 'jar':
|
|
139
|
+
case 'zip':
|
|
140
|
+
return {
|
|
141
|
+
iconName: 'ZD-EF-fileZip',
|
|
142
|
+
iconSize: size
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
case 'doc':
|
|
146
|
+
case 'docx':
|
|
147
|
+
case 'sxw':
|
|
148
|
+
case 'odt':
|
|
149
|
+
case 'docm':
|
|
150
|
+
case 'dot':
|
|
151
|
+
case 'dotm':
|
|
152
|
+
case 'dotx':
|
|
153
|
+
case 'rtf':
|
|
154
|
+
case 'pages':
|
|
155
|
+
if (OSName.indexOf('mac') !== -1 || OSName.indexOf('linux') !== -1) {
|
|
156
|
+
return {
|
|
157
|
+
iconName: 'ZD-EF-fileOffice',
|
|
158
|
+
iconSize: size
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
iconName: 'ZD-EF-fileWord',
|
|
164
|
+
iconSize: size
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
case 'xml':
|
|
168
|
+
return {
|
|
169
|
+
iconName: 'ZD-EF-fileXml',
|
|
170
|
+
iconSize: size
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
case 'xls':
|
|
174
|
+
case 'xlsx':
|
|
175
|
+
case 'xlsm':
|
|
176
|
+
case 'xlsb':
|
|
177
|
+
case 'sxc':
|
|
178
|
+
case 'ods':
|
|
179
|
+
case 'csv':
|
|
180
|
+
case 'tsv':
|
|
181
|
+
case 'numbers':
|
|
182
|
+
return {
|
|
183
|
+
iconName: 'ZD-GN-fileSheet',
|
|
184
|
+
iconSize: size
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
case 'ics':
|
|
188
|
+
return {
|
|
189
|
+
iconName: 'ZD-TK-event',
|
|
190
|
+
iconSize: size
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
case 'exe':
|
|
194
|
+
return {
|
|
195
|
+
iconName: 'ZD-EF-exe',
|
|
196
|
+
iconSize: size
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
case 'sh':
|
|
200
|
+
case 'bin':
|
|
201
|
+
return {
|
|
202
|
+
iconName: 'ZD-EF-linux',
|
|
203
|
+
iconSize: size
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
case 'css':
|
|
207
|
+
return {
|
|
208
|
+
iconName: 'ZD-EF-clrCss',
|
|
209
|
+
iconSize: size
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
case 'mp3':
|
|
213
|
+
case 'wav':
|
|
214
|
+
case 'wma':
|
|
215
|
+
case 'aac':
|
|
216
|
+
case 'm4r':
|
|
217
|
+
case 'ogg':
|
|
218
|
+
case 'opus':
|
|
219
|
+
return {
|
|
220
|
+
iconName: 'ZD-EF-fileMp3',
|
|
221
|
+
iconSize: size
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
case 'mp4':
|
|
225
|
+
case 'mkv':
|
|
226
|
+
case 'mov':
|
|
227
|
+
case 'mpeg':
|
|
228
|
+
case 'flv':
|
|
229
|
+
case 'wmv':
|
|
230
|
+
case 'avi':
|
|
231
|
+
case 'webm':
|
|
232
|
+
case 'ogv':
|
|
233
|
+
return {
|
|
234
|
+
iconName: 'ZD-EF-fileMp4',
|
|
235
|
+
iconSize: size
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
case 'eml':
|
|
239
|
+
case 'msg':
|
|
240
|
+
return {
|
|
241
|
+
iconName: 'ZD-GN-fileMail',
|
|
242
|
+
iconSize: size
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
default:
|
|
246
|
+
return {
|
|
247
|
+
iconName: 'ZD-GN-fileUnknown',
|
|
248
|
+
iconSize: size
|
|
249
|
+
};
|
|
250
|
+
}
|
|
28
251
|
}
|
|
@@ -21,8 +21,12 @@ var _Avatar = _interopRequireDefault(require("@zohodesk/components/lib/Avatar/Av
|
|
|
21
21
|
|
|
22
22
|
var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
|
|
23
23
|
|
|
24
|
+
var _Typography = _interopRequireDefault(require("@zohodesk/components/lib/Typography/Typography"));
|
|
25
|
+
|
|
24
26
|
var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
|
|
25
27
|
|
|
28
|
+
var _Button = _interopRequireDefault(require("@zohodesk/components/es/Button/Button"));
|
|
29
|
+
|
|
26
30
|
var _AttachmentImage = _interopRequireDefault(require("./AttachmentImage"));
|
|
27
31
|
|
|
28
32
|
var _Link = _interopRequireDefault(require("../Link/Link"));
|
|
@@ -35,11 +39,9 @@ var _Attachment = require("./Attachment");
|
|
|
35
39
|
|
|
36
40
|
var _General = require("../utils/General");
|
|
37
41
|
|
|
38
|
-
var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
|
|
39
|
-
|
|
40
42
|
var _utils = require("./utils");
|
|
41
43
|
|
|
42
|
-
var
|
|
44
|
+
var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
|
|
43
45
|
|
|
44
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
47
|
|
|
@@ -117,6 +119,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
117
119
|
_this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
|
|
118
120
|
_this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
|
|
119
121
|
_this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
|
|
122
|
+
_this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
|
|
123
|
+
_this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
|
|
120
124
|
return _this;
|
|
121
125
|
}
|
|
122
126
|
|
|
@@ -167,9 +171,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
167
171
|
var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
168
172
|
var selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
169
173
|
var selectedAttachmentName = selectedAttachment.name;
|
|
174
|
+
var selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
170
175
|
(0, _utils.checkFileSourcesValidation)({
|
|
171
176
|
fileName: selectedAttachmentName,
|
|
172
|
-
viewURL: selectedAttachmentViewUrl
|
|
177
|
+
viewURL: selectedAttachmentViewUrl,
|
|
178
|
+
previewUrl: selectedAttachmentPreviewUrl
|
|
173
179
|
}).then(function (fileSourceValidation) {
|
|
174
180
|
var isViewURLValid = fileSourceValidation.isViewURLValid,
|
|
175
181
|
canZoom = fileSourceValidation.canZoom;
|
|
@@ -332,6 +338,32 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
332
338
|
}])
|
|
333
339
|
};
|
|
334
340
|
}
|
|
341
|
+
}, {
|
|
342
|
+
key: "getPreviewIconData",
|
|
343
|
+
value: function getPreviewIconData(name, size, dataId) {
|
|
344
|
+
// const fileDetails = getAttachmentIconDetails(name, size);
|
|
345
|
+
var fileUnknown = {
|
|
346
|
+
iconName: 'ZD-GN-fileUnknown',
|
|
347
|
+
iconSize: '40'
|
|
348
|
+
};
|
|
349
|
+
var fileDetails = name ? (0, _Attachment.getAttachmentIconDetails)(name, size) : fileUnknown;
|
|
350
|
+
var iconName = fileDetails.iconName,
|
|
351
|
+
iconSize = fileDetails.iconSize;
|
|
352
|
+
return /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
353
|
+
iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
|
|
354
|
+
name: iconName,
|
|
355
|
+
size: iconSize,
|
|
356
|
+
"data-id": dataId
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}, {
|
|
360
|
+
key: "renderIframe",
|
|
361
|
+
value: function renderIframe(iframeSrc) {
|
|
362
|
+
return /*#__PURE__*/_react["default"].createElement("iframe", _extends({
|
|
363
|
+
src: iframeSrc,
|
|
364
|
+
className: _AttachmentViewerModule["default"].previewFrame
|
|
365
|
+
}, this.props.customProps.iframeProps));
|
|
366
|
+
}
|
|
335
367
|
}, {
|
|
336
368
|
key: "imgPreviewView",
|
|
337
369
|
value: function imgPreviewView() {
|
|
@@ -345,7 +377,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
345
377
|
isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
|
|
346
378
|
var _this$props = this.props,
|
|
347
379
|
maintainZoom = _this$props.maintainZoom,
|
|
348
|
-
dataId = _this$props.dataId
|
|
380
|
+
dataId = _this$props.dataId,
|
|
381
|
+
i18nKeys = _this$props.i18nKeys,
|
|
382
|
+
renderUnSupportedElement = _this$props.renderUnSupportedElement;
|
|
349
383
|
|
|
350
384
|
var getImgStyle = function getImgStyle(i) {
|
|
351
385
|
var position;
|
|
@@ -383,16 +417,25 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
383
417
|
_data$customClass = data.customClass,
|
|
384
418
|
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
385
419
|
_data$customProps = data.customProps,
|
|
386
|
-
customProps = _data$customProps === void 0 ? {} : _data$customProps
|
|
420
|
+
customProps = _data$customProps === void 0 ? {} : _data$customProps,
|
|
421
|
+
previewurl = data.previewurl,
|
|
422
|
+
type = data.type;
|
|
387
423
|
var _customProps$audioPro = customProps.audioProps,
|
|
388
424
|
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
389
425
|
_customProps$imagePro = customProps.imageProps,
|
|
390
|
-
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro
|
|
426
|
+
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
|
|
427
|
+
_customProps$videoPro = customProps.videoProps,
|
|
428
|
+
videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro,
|
|
429
|
+
_customProps$iframePr = customProps.iframeProps,
|
|
430
|
+
iframeProps = _customProps$iframePr === void 0 ? {} : _customProps$iframePr;
|
|
391
431
|
var _customClass$customIm = customClass.customImageClass,
|
|
392
432
|
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
393
433
|
_customClass$customCh = customClass.customChildrenClass,
|
|
394
434
|
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
395
435
|
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
436
|
+
var frameOrigin = (0, _utils.getFrameOrigin)();
|
|
437
|
+
var iframeSrc = "".concat(previewurl, "&frameorigin=").concat(frameOrigin);
|
|
438
|
+
var extension = (0, _Attachment.getExtensionFromFileName)(name);
|
|
396
439
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
397
440
|
className: _AttachmentViewerModule["default"].imgBox,
|
|
398
441
|
id: "imgBox".concat(i),
|
|
@@ -403,29 +446,49 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
403
446
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
404
447
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
405
448
|
id: "imgPreviewRef".concat(i)
|
|
406
|
-
}, (0, _Attachment.isAudioFile)(
|
|
407
|
-
|
|
449
|
+
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (0, _Attachment.isAudioFile)(extension) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
|
|
450
|
+
controls: true,
|
|
451
|
+
className: _AttachmentViewerModule["default"].zoomIn,
|
|
452
|
+
"data-id": "".concat(dataId, "_audioPreview"),
|
|
453
|
+
"data-test-id": "".concat(dataId, "_audioPreview")
|
|
454
|
+
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
455
|
+
src: previewurl,
|
|
456
|
+
type: "audio/".concat(extension)
|
|
457
|
+
})) : (0, _Attachment.isVideoFile)(extension) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
408
458
|
controls: true,
|
|
409
459
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
410
460
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
411
461
|
"data-test-id": "".concat(dataId, "_videoPreview")
|
|
412
|
-
},
|
|
462
|
+
}, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
413
463
|
src: viewUrl,
|
|
414
|
-
type: "
|
|
415
|
-
})) :
|
|
464
|
+
type: "video/".concat(extension)
|
|
465
|
+
})) : (0, _Attachment.isImageFile)(extension) ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
416
466
|
customClass: {
|
|
417
|
-
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "
|
|
467
|
+
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, " ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
|
|
418
468
|
customChildrenClass: customChildrenClass
|
|
419
469
|
},
|
|
420
470
|
src: viewUrl,
|
|
421
471
|
onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
|
|
422
|
-
_this5.zoomIn(e, i, true);
|
|
472
|
+
return _this5.zoomIn(e, i, true);
|
|
423
473
|
} : undefined,
|
|
424
474
|
alt: name,
|
|
425
475
|
dataId: dataId,
|
|
426
476
|
id: "img".concat(i),
|
|
427
477
|
isCover: false
|
|
428
|
-
}, imageProps), children)))
|
|
478
|
+
}, imageProps), children) : type === "document" && previewurl != null ? _this5.renderIframe(iframeSrc) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
479
|
+
className: _AttachmentViewerModule["default"].previewNone
|
|
480
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
481
|
+
className: _AttachmentViewerModule["default"].fileTypeImg
|
|
482
|
+
}, _this5.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
483
|
+
$ui_size: "20",
|
|
484
|
+
$ui_weight: "semibold"
|
|
485
|
+
}, i18nKeys.previewUnsupportedText), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
486
|
+
href: data.href,
|
|
487
|
+
className: _AttachmentViewerModule["default"].downloadLink
|
|
488
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
489
|
+
palette: "primaryFilled",
|
|
490
|
+
text: i18nKeys.downloadText
|
|
491
|
+
}))))));
|
|
429
492
|
});
|
|
430
493
|
}
|
|
431
494
|
}, {
|
|
@@ -451,7 +514,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
451
514
|
avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
|
|
452
515
|
var totalLen = data.length;
|
|
453
516
|
var selectedAttachment = data[selectedIndex] || {};
|
|
454
|
-
var selectedImgUrl = selectedAttachment.viewUrl;
|
|
517
|
+
var selectedImgUrl = selectedAttachment.previewurl || selectedAttachment.viewUrl;
|
|
455
518
|
var downloadUrl = selectedAttachment.downloadUrl;
|
|
456
519
|
var authorHref;
|
|
457
520
|
var authorName;
|
|
@@ -666,10 +729,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
666
729
|
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
667
730
|
_customClass$customCh2 = customClass.customChildrenClass,
|
|
668
731
|
customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
|
|
669
|
-
thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
|
|
670
|
-
|
|
671
732
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
672
|
-
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
|
|
733
|
+
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat((0, _Attachment.isImageFile)(name) || thumbnail ? '' : _AttachmentViewerModule["default"].previewIconDiv),
|
|
673
734
|
key: index,
|
|
674
735
|
onClick: _this6.changeSelectedIndex.bind(_this6, index),
|
|
675
736
|
eleRef: function eleRef(el) {
|
|
@@ -677,7 +738,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
677
738
|
},
|
|
678
739
|
dataId: "attachPreviewList",
|
|
679
740
|
"data-title": name
|
|
680
|
-
}, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
741
|
+
}, (0, _Attachment.isImageFile)(name) || thumbnail ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
681
742
|
src: thumbnail || viewUrl,
|
|
682
743
|
size: "small",
|
|
683
744
|
alt: name,
|
|
@@ -686,7 +747,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
686
747
|
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
687
748
|
},
|
|
688
749
|
dataId: dataId
|
|
689
|
-
}, customProps), children));
|
|
750
|
+
}, customProps), children) : _this6.getPreviewIconData(name, '40'));
|
|
690
751
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
691
752
|
dataId: "attachToggle",
|
|
692
753
|
onClick: _this6.togglePViewList,
|
|
@@ -79,7 +79,7 @@
|
|
|
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.6;
|
|
83
83
|
border-radius: 50%;
|
|
84
84
|
cursor: pointer;
|
|
85
85
|
}
|
|
@@ -230,14 +230,10 @@
|
|
|
230
230
|
transform: rotateX(0deg);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.
|
|
234
|
-
|
|
235
|
-
width:
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.isAudio .image {
|
|
240
|
-
opacity: 0;
|
|
233
|
+
.previewFrame {
|
|
234
|
+
height: 100% ;
|
|
235
|
+
width: 100% ;
|
|
236
|
+
border: 0;
|
|
241
237
|
}
|
|
242
238
|
|
|
243
239
|
.video {
|
|
@@ -362,4 +358,54 @@
|
|
|
362
358
|
background-color: var(--dot_mirror);
|
|
363
359
|
border: 0;
|
|
364
360
|
cursor: pointer;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.fileTypeImg {
|
|
364
|
+
margin-bottom: var(--zd_size30) ;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.previewNone {
|
|
368
|
+
color: var(--zdt_attachmentviewer_title_text);
|
|
369
|
+
text-align: center;
|
|
370
|
+
margin: auto ;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.downloadLink {
|
|
374
|
+
display: inline-block;
|
|
375
|
+
padding-top: var(--zd_size15) ;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.previewIconDiv {
|
|
379
|
+
width: var(--zd_size60) ;
|
|
380
|
+
composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.prevFooterIcon,
|
|
384
|
+
.prevIcon {
|
|
385
|
+
color: var(--zdt_attachmentviewer_title_text);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.prevFooterIcon, .prevIcon {
|
|
389
|
+
padding: var(--zd_size2) ;
|
|
390
|
+
margin: auto ;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.prevFooterIcon::before, .prevIcon::before {
|
|
394
|
+
background-color: var(--dot_mirror);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
[dir=ltr] .prevIcon::before {
|
|
398
|
+
border-radius: 10px 30px 10px 10px;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
[dir=rtl] .prevIcon::before {
|
|
402
|
+
border-radius: 30px 10px 10px 10px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
[dir=ltr] .prevFooterIcon::before {
|
|
406
|
+
border-radius: 5px 17px 5px 5px
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
[dir=rtl] .prevFooterIcon::before {
|
|
410
|
+
border-radius: 17px 5px 5px 5px
|
|
365
411
|
}
|