@zohodesk/dot 1.0.0-temp-200.6 → 1.0.0-temp-210
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 +3 -7
- package/es/AttachmentViewer/Attachment.js +3 -208
- package/es/AttachmentViewer/AttachmentViewer.js +24 -81
- package/es/AttachmentViewer/AttachmentViewer.module.css +9 -55
- package/es/AttachmentViewer/props/propTypes.js +1 -3
- package/es/AttachmentViewer/utils.js +2 -36
- package/es/Drawer/Drawer.js +4 -2
- package/es/Drawer/props/defaultProps.js +2 -1
- package/es/Drawer/props/propTypes.js +2 -1
- package/es/FreezeLayer/FreezeLayer.js +6 -3
- package/es/FreezeLayer/props/defaultProps.js +2 -1
- package/es/FreezeLayer/props/propTypes.js +2 -1
- package/es/common/dot_common.module.css +4 -0
- package/es/utils/General.js +1 -23
- package/lib/Attachment/Attachment.module.css +3 -7
- package/lib/AttachmentViewer/Attachment.js +3 -226
- package/lib/AttachmentViewer/AttachmentViewer.js +21 -82
- package/lib/AttachmentViewer/AttachmentViewer.module.css +9 -55
- package/lib/AttachmentViewer/props/propTypes.js +1 -3
- package/lib/AttachmentViewer/utils.js +1 -47
- package/lib/Drawer/Drawer.js +4 -2
- package/lib/Drawer/props/defaultProps.js +2 -1
- package/lib/Drawer/props/propTypes.js +2 -1
- package/lib/FreezeLayer/FreezeLayer.js +6 -3
- package/lib/FreezeLayer/props/defaultProps.js +2 -1
- package/lib/FreezeLayer/props/propTypes.js +2 -1
- package/lib/common/dot_common.module.css +4 -0
- package/lib/utils/General.js +1 -25
- package/package.json +4 -4
- package/result.json +0 -1
- package/unittest/index.html +0 -41
|
@@ -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
|
}
|
|
@@ -1,29 +1,8 @@
|
|
|
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
|
-
export function isAudioFile(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export function isVideoFile(extension) {
|
|
8
|
-
return /mp4|webm|ogg/i.test(extension);
|
|
9
|
-
}
|
|
10
|
-
export function isPdfFile(extension) {
|
|
11
|
-
return /pdf/i.test(extension);
|
|
12
|
-
}
|
|
13
|
-
export function isDocsFile(extension) {
|
|
14
|
-
return /docx|doc|docm|rtf|odt|dot|dotm|dotx|pages/i.test(extension);
|
|
15
|
-
}
|
|
16
|
-
export function isSheetFile(extension) {
|
|
17
|
-
return /xlsx|numbers/i.test(extension);
|
|
18
|
-
}
|
|
19
|
-
export function isPresentationFile(extension) {
|
|
20
|
-
return /pptx|ppt|pps|ppsx|key/i.test(extension);
|
|
21
|
-
}
|
|
22
|
-
export function isEmailFile(extension) {
|
|
23
|
-
return /eml|msg/i.test(extension);
|
|
24
|
-
}
|
|
25
|
-
export function isImageFile(extension) {
|
|
26
|
-
return /jpeg|jpg|png|gif|bmp|ico/i.test(extension);
|
|
3
|
+
export function isAudioFile(fileName) {
|
|
4
|
+
const extension = getExtensionFromFileName(fileName);
|
|
5
|
+
return /mp3|wav|ogg/i.test(extension);
|
|
27
6
|
}
|
|
28
7
|
export function getExtensionFromFileName(fileName) {
|
|
29
8
|
if (fileName && fileName.indexOf(".") !== -1) {
|
|
@@ -35,188 +14,4 @@ export function getExtensionFromFileName(fileName) {
|
|
|
35
14
|
export function isBrowserSupportedFile(fileName) {
|
|
36
15
|
const extension = getExtensionFromFileName(fileName);
|
|
37
16
|
return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
|
|
38
|
-
}
|
|
39
|
-
export function getAttachmentIconDetails(fileName, size) {
|
|
40
|
-
const extension = getExtensionFromFileName(fileName);
|
|
41
|
-
const browserName = getBrowserWithVersion().toLowerCase() || '';
|
|
42
|
-
const OSName = navigator.platform.toLowerCase() || '';
|
|
43
|
-
|
|
44
|
-
switch (extension) {
|
|
45
|
-
case 'jpeg':
|
|
46
|
-
case 'jpg':
|
|
47
|
-
case 'png':
|
|
48
|
-
case 'apng':
|
|
49
|
-
case 'gif':
|
|
50
|
-
case 'bmp':
|
|
51
|
-
case 'tiff':
|
|
52
|
-
case 'tif':
|
|
53
|
-
case 'ico':
|
|
54
|
-
case 'svg':
|
|
55
|
-
case 'heic':
|
|
56
|
-
case 'webp':
|
|
57
|
-
return {
|
|
58
|
-
iconName: 'ZD-EF-fileImage',
|
|
59
|
-
iconSize: size
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
case 'txt':
|
|
63
|
-
return {
|
|
64
|
-
iconName: 'ZD-GN-fileDoc',
|
|
65
|
-
iconSize: size
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
case 'pdf':
|
|
69
|
-
return {
|
|
70
|
-
iconName: 'ZD-EF-filePdf',
|
|
71
|
-
iconSize: size
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
case 'html':
|
|
75
|
-
case 'htm':
|
|
76
|
-
case 'xhtml':
|
|
77
|
-
if (browserName.indexOf('chrome') !== -1 || browserName.indexOf('safari') !== -1) {
|
|
78
|
-
return {
|
|
79
|
-
iconName: 'ZD-EF-fileXml',
|
|
80
|
-
iconSize: size
|
|
81
|
-
};
|
|
82
|
-
} else if (browserName.indexOf('ie') !== -1 || browserName.indexOf('edge') !== -1) {
|
|
83
|
-
return {
|
|
84
|
-
iconName: 'ZD-EF-explorer',
|
|
85
|
-
iconSize: size
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
iconName: 'ZD-EF-firebox',
|
|
91
|
-
iconSize: size
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
case 'ppt':
|
|
95
|
-
case 'pps':
|
|
96
|
-
case 'odp':
|
|
97
|
-
case 'sxi':
|
|
98
|
-
case 'pptx':
|
|
99
|
-
case 'ppsx':
|
|
100
|
-
case 'pot':
|
|
101
|
-
case 'potx':
|
|
102
|
-
case 'key':
|
|
103
|
-
return {
|
|
104
|
-
iconName: 'ZD-GN-filePpt',
|
|
105
|
-
iconSize: size
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
case 'rar':
|
|
109
|
-
case 'jar':
|
|
110
|
-
case 'zip':
|
|
111
|
-
return {
|
|
112
|
-
iconName: 'ZD-EF-fileZip',
|
|
113
|
-
iconSize: size
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
case 'doc':
|
|
117
|
-
case 'docx':
|
|
118
|
-
case 'sxw':
|
|
119
|
-
case 'odt':
|
|
120
|
-
case 'docm':
|
|
121
|
-
case 'dot':
|
|
122
|
-
case 'dotm':
|
|
123
|
-
case 'dotx':
|
|
124
|
-
case 'rtf':
|
|
125
|
-
case 'pages':
|
|
126
|
-
if (OSName.indexOf('mac') !== -1 || OSName.indexOf('linux') !== -1) {
|
|
127
|
-
return {
|
|
128
|
-
iconName: 'ZD-EF-fileOffice',
|
|
129
|
-
iconSize: size
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
iconName: 'ZD-EF-fileWord',
|
|
135
|
-
iconSize: size
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
case 'xml':
|
|
139
|
-
return {
|
|
140
|
-
iconName: 'ZD-EF-fileXml',
|
|
141
|
-
iconSize: size
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
case 'xls':
|
|
145
|
-
case 'xlsx':
|
|
146
|
-
case 'xlsm':
|
|
147
|
-
case 'xlsb':
|
|
148
|
-
case 'sxc':
|
|
149
|
-
case 'ods':
|
|
150
|
-
case 'csv':
|
|
151
|
-
case 'tsv':
|
|
152
|
-
case 'numbers':
|
|
153
|
-
return {
|
|
154
|
-
iconName: 'ZD-GN-fileSheet',
|
|
155
|
-
iconSize: size
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
case 'ics':
|
|
159
|
-
return {
|
|
160
|
-
iconName: 'ZD-TK-event',
|
|
161
|
-
iconSize: size
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
case 'exe':
|
|
165
|
-
return {
|
|
166
|
-
iconName: 'ZD-EF-exe',
|
|
167
|
-
iconSize: size
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
case 'sh':
|
|
171
|
-
case 'bin':
|
|
172
|
-
return {
|
|
173
|
-
iconName: 'ZD-EF-linux',
|
|
174
|
-
iconSize: size
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
case 'css':
|
|
178
|
-
return {
|
|
179
|
-
iconName: 'ZD-EF-clrCss',
|
|
180
|
-
iconSize: size
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
case 'mp3':
|
|
184
|
-
case 'wav':
|
|
185
|
-
case 'wma':
|
|
186
|
-
case 'aac':
|
|
187
|
-
case 'm4r':
|
|
188
|
-
case 'ogg':
|
|
189
|
-
case 'opus':
|
|
190
|
-
return {
|
|
191
|
-
iconName: 'ZD-EF-fileMp3',
|
|
192
|
-
iconSize: size
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
case 'mp4':
|
|
196
|
-
case 'mkv':
|
|
197
|
-
case 'mov':
|
|
198
|
-
case 'mpeg':
|
|
199
|
-
case 'flv':
|
|
200
|
-
case 'wmv':
|
|
201
|
-
case 'avi':
|
|
202
|
-
case 'webm':
|
|
203
|
-
case 'ogv':
|
|
204
|
-
return {
|
|
205
|
-
iconName: 'ZD-EF-fileMp4',
|
|
206
|
-
iconSize: size
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
case 'eml':
|
|
210
|
-
case 'msg':
|
|
211
|
-
return {
|
|
212
|
-
iconName: 'ZD-GN-fileMail',
|
|
213
|
-
iconSize: size
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
default:
|
|
217
|
-
return {
|
|
218
|
-
iconName: 'ZD-GN-fileUnknown',
|
|
219
|
-
iconSize: size
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
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 { isAudioFile, getExtensionFromFileName
|
|
13
|
+
import { isAudioFile, getExtensionFromFileName } from "./Attachment";
|
|
16
14
|
import { shallowDiff } from "../utils/General";
|
|
17
|
-
import { checkFileSourcesValidation, getFrameOrigin } 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,8 +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
46
|
}
|
|
50
47
|
|
|
51
48
|
componentDidMount() {
|
|
@@ -94,11 +91,9 @@ export default class AttachmentViewer extends Component {
|
|
|
94
91
|
const selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
95
92
|
const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
96
93
|
const selectedAttachmentName = selectedAttachment.name;
|
|
97
|
-
const selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
98
94
|
checkFileSourcesValidation({
|
|
99
95
|
fileName: selectedAttachmentName,
|
|
100
|
-
viewURL: selectedAttachmentViewUrl
|
|
101
|
-
previewUrl: selectedAttachmentPreviewUrl
|
|
96
|
+
viewURL: selectedAttachmentViewUrl
|
|
102
97
|
}).then(fileSourceValidation => {
|
|
103
98
|
const {
|
|
104
99
|
isViewURLValid,
|
|
@@ -255,33 +250,6 @@ export default class AttachmentViewer extends Component {
|
|
|
255
250
|
};
|
|
256
251
|
}
|
|
257
252
|
|
|
258
|
-
getPreviewIconData(name, size, dataId) {
|
|
259
|
-
// const fileDetails = getAttachmentIconDetails(name, size);
|
|
260
|
-
const fileUnknown = {
|
|
261
|
-
iconName: 'ZD-GN-fileUnknown',
|
|
262
|
-
iconSize: '40'
|
|
263
|
-
};
|
|
264
|
-
const fileDetails = name ? getAttachmentIconDetails(name, size) : fileUnknown;
|
|
265
|
-
const {
|
|
266
|
-
iconName,
|
|
267
|
-
iconSize
|
|
268
|
-
} = fileDetails;
|
|
269
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
270
|
-
iconClass: style.prevFooterIcon,
|
|
271
|
-
name: iconName,
|
|
272
|
-
size: iconSize,
|
|
273
|
-
"data-id": dataId
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
renderIframe(iframeSrc) {
|
|
278
|
-
return /*#__PURE__*/React.createElement("iframe", {
|
|
279
|
-
src: iframeSrc,
|
|
280
|
-
className: style.previewFrame,
|
|
281
|
-
...this.props.customProps.iframeProps
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
|
|
285
253
|
imgPreviewView() {
|
|
286
254
|
var _this = this;
|
|
287
255
|
|
|
@@ -294,9 +262,7 @@ export default class AttachmentViewer extends Component {
|
|
|
294
262
|
} = this.state;
|
|
295
263
|
const {
|
|
296
264
|
maintainZoom,
|
|
297
|
-
dataId
|
|
298
|
-
i18nKeys,
|
|
299
|
-
renderUnSupportedElement
|
|
265
|
+
dataId
|
|
300
266
|
} = this.props;
|
|
301
267
|
|
|
302
268
|
const getImgStyle = i => {
|
|
@@ -333,24 +299,17 @@ export default class AttachmentViewer extends Component {
|
|
|
333
299
|
children,
|
|
334
300
|
dataId = 'attachViewer',
|
|
335
301
|
customClass = {},
|
|
336
|
-
customProps = {}
|
|
337
|
-
previewurl,
|
|
338
|
-
type
|
|
302
|
+
customProps = {}
|
|
339
303
|
} = data;
|
|
340
304
|
const {
|
|
341
305
|
audioProps = {},
|
|
342
|
-
imageProps = {}
|
|
343
|
-
videoProps = {},
|
|
344
|
-
iframeProps = {}
|
|
306
|
+
imageProps = {}
|
|
345
307
|
} = customProps;
|
|
346
308
|
const {
|
|
347
309
|
customImageClass = '',
|
|
348
310
|
customChildrenClass = ''
|
|
349
311
|
} = customClass;
|
|
350
312
|
const retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
351
|
-
const frameOrigin = getFrameOrigin();
|
|
352
|
-
const iframeSrc = `${previewurl}&frameorigin=${frameOrigin}`;
|
|
353
|
-
const extension = getExtensionFromFileName(name);
|
|
354
313
|
return /*#__PURE__*/React.createElement(Container, {
|
|
355
314
|
className: style.imgBox,
|
|
356
315
|
id: `imgBox${i}`,
|
|
@@ -361,50 +320,32 @@ export default class AttachmentViewer extends Component {
|
|
|
361
320
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
362
321
|
className: style.imgRef,
|
|
363
322
|
id: `imgPreviewRef${i}`
|
|
364
|
-
}, selectedIndex == i
|
|
365
|
-
|
|
366
|
-
className: style.zoomIn,
|
|
367
|
-
"data-id": `${dataId}_audioPreview`,
|
|
368
|
-
"data-test-id": `${dataId}_audioPreview`,
|
|
369
|
-
...audioProps
|
|
370
|
-
}, /*#__PURE__*/React.createElement("source", {
|
|
371
|
-
src: previewurl,
|
|
372
|
-
type: `audio/${extension}`
|
|
373
|
-
})) : isVideoFile(extension) ? /*#__PURE__*/React.createElement("video", {
|
|
323
|
+
}, isAudioFile(name) ? selectedIndex == i ? /*#__PURE__*/React.createElement("video", {
|
|
324
|
+
autoPlay: true,
|
|
374
325
|
controls: true,
|
|
375
326
|
className: style.zoomIn,
|
|
376
327
|
"data-id": `${dataId}_videoPreview`,
|
|
377
328
|
"data-test-id": `${dataId}_videoPreview`,
|
|
378
|
-
...
|
|
329
|
+
...audioProps
|
|
379
330
|
}, /*#__PURE__*/React.createElement("source", {
|
|
380
331
|
src: viewUrl,
|
|
381
|
-
type: `
|
|
382
|
-
})) :
|
|
332
|
+
type: `audio/${getExtensionFromFileName(name)}`
|
|
333
|
+
})) : null : /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
383
334
|
customClass: {
|
|
384
|
-
customImageClass: `${style.img} ${style.altText}
|
|
335
|
+
customImageClass: `${style.img} ${style.altText}
|
|
336
|
+
${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
385
337
|
customChildrenClass
|
|
386
338
|
},
|
|
387
339
|
src: viewUrl,
|
|
388
|
-
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,
|
|
389
343
|
alt: name,
|
|
390
344
|
dataId: dataId,
|
|
391
345
|
id: `img${i}`,
|
|
392
346
|
isCover: false,
|
|
393
347
|
...imageProps
|
|
394
|
-
}, children)
|
|
395
|
-
className: style.previewNone
|
|
396
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
397
|
-
className: style.fileTypeImg
|
|
398
|
-
}, _this.getPreviewIconData(name, '70')), /*#__PURE__*/React.createElement(Typography, {
|
|
399
|
-
$ui_size: "20",
|
|
400
|
-
$ui_weight: "semibold"
|
|
401
|
-
}, i18nKeys.previewUnsupportedText), /*#__PURE__*/React.createElement(Link, {
|
|
402
|
-
href: data.href,
|
|
403
|
-
className: style.downloadLink
|
|
404
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
405
|
-
palette: "primaryFilled",
|
|
406
|
-
text: i18nKeys.downloadText
|
|
407
|
-
}))))));
|
|
348
|
+
}, children)));
|
|
408
349
|
});
|
|
409
350
|
}
|
|
410
351
|
|
|
@@ -430,7 +371,7 @@ export default class AttachmentViewer extends Component {
|
|
|
430
371
|
} = customProps;
|
|
431
372
|
const totalLen = data.length;
|
|
432
373
|
const selectedAttachment = data[selectedIndex] || {};
|
|
433
|
-
const selectedImgUrl = selectedAttachment.
|
|
374
|
+
const selectedImgUrl = selectedAttachment.viewUrl;
|
|
434
375
|
const downloadUrl = selectedAttachment.downloadUrl;
|
|
435
376
|
let authorHref;
|
|
436
377
|
let authorName;
|
|
@@ -645,14 +586,16 @@ export default class AttachmentViewer extends Component {
|
|
|
645
586
|
customImageClass = '',
|
|
646
587
|
customChildrenClass = ''
|
|
647
588
|
} = customClass;
|
|
589
|
+
thumbnail = isAudioFile(name) ? thumbnail || audioThumbNail : thumbnail; //fallback thumbnail for audio
|
|
590
|
+
|
|
648
591
|
return /*#__PURE__*/React.createElement(Box, {
|
|
649
|
-
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}
|
|
592
|
+
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}`,
|
|
650
593
|
key: index,
|
|
651
594
|
onClick: this.changeSelectedIndex.bind(this, index),
|
|
652
595
|
eleRef: el => this[`img_${index}`] = el,
|
|
653
596
|
dataId: "attachPreviewList",
|
|
654
597
|
"data-title": name
|
|
655
|
-
},
|
|
598
|
+
}, /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
656
599
|
src: thumbnail || viewUrl,
|
|
657
600
|
size: "small",
|
|
658
601
|
alt: name,
|
|
@@ -662,7 +605,7 @@ export default class AttachmentViewer extends Component {
|
|
|
662
605
|
},
|
|
663
606
|
dataId: dataId,
|
|
664
607
|
...customProps
|
|
665
|
-
}, children)
|
|
608
|
+
}, children));
|
|
666
609
|
}))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
|
|
667
610
|
dataId: "attachToggle",
|
|
668
611
|
onClick: this.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.6364;
|
|
83
83
|
border-radius: 50%;
|
|
84
84
|
cursor: pointer;
|
|
85
85
|
}
|
|
@@ -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 {
|
|
@@ -358,54 +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
|
-
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
|
|
411
365
|
}
|
|
@@ -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,7 +34,6 @@ export const AttachmentViewer_propTypes = {
|
|
|
35
34
|
maintainZoom: PropTypes.bool,
|
|
36
35
|
isActive: PropTypes.bool,
|
|
37
36
|
dataId: PropTypes.string,
|
|
38
|
-
renderUnSupportedElement: PropTypes.func,
|
|
39
37
|
customProps: PropTypes.shape({
|
|
40
38
|
avatarProps: PropTypes.exact(AvatarProps)
|
|
41
39
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAudioFile
|
|
1
|
+
import { isAudioFile } from "./Attachment";
|
|
2
2
|
export class Zoom {
|
|
3
3
|
constructor() {
|
|
4
4
|
const matrix = [1, 0, 0, 1, 0, 0]; // current view transform
|
|
@@ -120,16 +120,6 @@ export function checkImageValidity(src) {
|
|
|
120
120
|
};
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
export function checkVideoUrlValidity(url) {
|
|
124
|
-
return new Promise(resolve => {
|
|
125
|
-
const video = document.createElement('video');
|
|
126
|
-
video.src = url;
|
|
127
|
-
|
|
128
|
-
video.oncanplaythrough = () => resolve(true);
|
|
129
|
-
|
|
130
|
-
video.onerror = () => resolve(false);
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
123
|
export function checkAudioUrlValidity(url) {
|
|
134
124
|
return new Promise(resolve => {
|
|
135
125
|
const audio = new Audio(url);
|
|
@@ -144,20 +134,11 @@ export function checkAudioUrlValidity(url) {
|
|
|
144
134
|
});
|
|
145
135
|
}
|
|
146
136
|
;
|
|
147
|
-
export function isValidDocument(url) {
|
|
148
|
-
if (!url) {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
137
|
export function checkFileSourcesValidation(_ref) {
|
|
155
138
|
let {
|
|
156
139
|
fileName,
|
|
157
|
-
viewURL
|
|
158
|
-
previewUrl
|
|
140
|
+
viewURL
|
|
159
141
|
} = _ref;
|
|
160
|
-
const documentTypes = isDocsFile(fileName) || isSheetFile(fileName) || isPresentationFile(fileName) || isPdfFile(fileName) || isEmailFile(fileName);
|
|
161
142
|
|
|
162
143
|
if (isAudioFile(fileName)) {
|
|
163
144
|
const audioValidityPromise = checkAudioUrlValidity(viewURL);
|
|
@@ -165,18 +146,6 @@ export function checkFileSourcesValidation(_ref) {
|
|
|
165
146
|
isViewURLValid: isURLValid,
|
|
166
147
|
canZoom: false
|
|
167
148
|
}));
|
|
168
|
-
} else if (isVideoFile(fileName)) {
|
|
169
|
-
const videoValidityPromise = checkVideoUrlValidity(viewURL);
|
|
170
|
-
return videoValidityPromise.then(isURLValid => ({
|
|
171
|
-
isViewURLValid: isURLValid,
|
|
172
|
-
canZoom: false
|
|
173
|
-
}));
|
|
174
|
-
} else if (documentTypes && isValidDocument(previewUrl)) {
|
|
175
|
-
const isValid = isValidDocument(previewUrl);
|
|
176
|
-
return Promise.resolve({
|
|
177
|
-
isViewURLValid: isValid,
|
|
178
|
-
canZoom: false
|
|
179
|
-
});
|
|
180
149
|
} else {
|
|
181
150
|
const imageValidityPromise = checkImageValidity(viewURL);
|
|
182
151
|
return imageValidityPromise.then(isURLValid => ({
|
|
@@ -184,7 +153,4 @@ export function checkFileSourcesValidation(_ref) {
|
|
|
184
153
|
canZoom: isURLValid
|
|
185
154
|
}));
|
|
186
155
|
}
|
|
187
|
-
}
|
|
188
|
-
export function getFrameOrigin() {
|
|
189
|
-
return new URL(window.location.href).origin;
|
|
190
156
|
}
|
package/es/Drawer/Drawer.js
CHANGED
|
@@ -233,7 +233,8 @@ export default class Drawer extends React.Component {
|
|
|
233
233
|
subDrawerActive,
|
|
234
234
|
customClass,
|
|
235
235
|
needAutoZindex,
|
|
236
|
-
innerPortalName
|
|
236
|
+
innerPortalName,
|
|
237
|
+
onEnterComplete
|
|
237
238
|
} = this.props;
|
|
238
239
|
let zindexNumber = isActive ? this.getNextIndex() : '';
|
|
239
240
|
return /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
@@ -252,7 +253,8 @@ export default class Drawer extends React.Component {
|
|
|
252
253
|
palette: palette,
|
|
253
254
|
forwardRef: forwardRef,
|
|
254
255
|
customClass: customClass,
|
|
255
|
-
needAutoZindex: needAutoZindex
|
|
256
|
+
needAutoZindex: needAutoZindex,
|
|
257
|
+
onEnterComplete: onEnterComplete
|
|
256
258
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
257
259
|
flexible: true
|
|
258
260
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
@@ -50,5 +50,6 @@ export const Drawer_propTypes = {
|
|
|
50
50
|
needFocusScope: PropTypes.bool,
|
|
51
51
|
customProps: PropTypes.object,
|
|
52
52
|
innerPortalName: PropTypes.string,
|
|
53
|
-
a11y: PropTypes.object
|
|
53
|
+
a11y: PropTypes.object,
|
|
54
|
+
onEnterComplete: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
|
|
54
55
|
};
|