@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
|
@@ -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
|
}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
+
import { getBrowserWithVersion } from "../utils/General";
|
|
1
2
|
const UNASSIGNED = 'Unassigned';
|
|
2
3
|
const BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
|
|
3
|
-
export function isAudioFile(
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export function isAudioFile(extension) {
|
|
5
|
+
return /mp3|wav|ogg|oga|m4a|weba|opus|m4b|webma|aac/i.test(extension);
|
|
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);
|
|
6
27
|
}
|
|
7
28
|
export function getExtensionFromFileName(fileName) {
|
|
8
29
|
if (fileName && fileName.indexOf(".") !== -1) {
|
|
@@ -14,4 +35,188 @@ export function getExtensionFromFileName(fileName) {
|
|
|
14
35
|
export function isBrowserSupportedFile(fileName) {
|
|
15
36
|
const extension = getExtensionFromFileName(fileName);
|
|
16
37
|
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
|
+
}
|
|
17
222
|
}
|
|
@@ -5,16 +5,17 @@ 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';
|
|
8
9
|
import { getUniqueId } from '@zohodesk/components/lib/Provider/IdProvider';
|
|
10
|
+
import Button from '@zohodesk/components/es/Button/Button';
|
|
9
11
|
import AttachmentImage from "./AttachmentImage";
|
|
10
12
|
import Link from "../Link/Link";
|
|
11
13
|
import IconButton from "../IconButton/IconButton";
|
|
12
14
|
import FreezeLayer from "../FreezeLayer/FreezeLayer";
|
|
13
|
-
import { isAudioFile, getExtensionFromFileName } from "./Attachment";
|
|
15
|
+
import { isAudioFile, getExtensionFromFileName, isVideoFile, isPdfFile, isDocsFile, isSheetFile, isPresentationFile, isEmailFile, isImageFile, getAttachmentIconDetails } from "./Attachment";
|
|
14
16
|
import { shallowDiff } from "../utils/General";
|
|
17
|
+
import { checkFileSourcesValidation, getFrameOrigin } from "./utils";
|
|
15
18
|
import style from "./AttachmentViewer.module.css";
|
|
16
|
-
import { checkFileSourcesValidation } from "./utils";
|
|
17
|
-
import audioThumbNail from "../../images/audio_thumbnail.png";
|
|
18
19
|
export default class AttachmentViewer extends Component {
|
|
19
20
|
constructor(props) {
|
|
20
21
|
super(props);
|
|
@@ -43,6 +44,8 @@ export default class AttachmentViewer extends Component {
|
|
|
43
44
|
this.getUpdateDataList = this.getUpdateDataList.bind(this);
|
|
44
45
|
this.zoomMaintain = this.zoomMaintain.bind(this);
|
|
45
46
|
this.handleMenuValidation = this.handleMenuValidation.bind(this);
|
|
47
|
+
this.getPreviewIconData = this.getPreviewIconData.bind(this);
|
|
48
|
+
this.renderIframe = this.renderIframe.bind(this);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
componentDidMount() {
|
|
@@ -91,9 +94,11 @@ export default class AttachmentViewer extends Component {
|
|
|
91
94
|
const selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
92
95
|
const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
93
96
|
const selectedAttachmentName = selectedAttachment.name;
|
|
97
|
+
const selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
94
98
|
checkFileSourcesValidation({
|
|
95
99
|
fileName: selectedAttachmentName,
|
|
96
|
-
viewURL: selectedAttachmentViewUrl
|
|
100
|
+
viewURL: selectedAttachmentViewUrl,
|
|
101
|
+
previewUrl: selectedAttachmentPreviewUrl
|
|
97
102
|
}).then(fileSourceValidation => {
|
|
98
103
|
const {
|
|
99
104
|
isViewURLValid,
|
|
@@ -250,6 +255,33 @@ export default class AttachmentViewer extends Component {
|
|
|
250
255
|
};
|
|
251
256
|
}
|
|
252
257
|
|
|
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
|
+
|
|
253
285
|
imgPreviewView() {
|
|
254
286
|
var _this = this;
|
|
255
287
|
|
|
@@ -262,7 +294,9 @@ export default class AttachmentViewer extends Component {
|
|
|
262
294
|
} = this.state;
|
|
263
295
|
const {
|
|
264
296
|
maintainZoom,
|
|
265
|
-
dataId
|
|
297
|
+
dataId,
|
|
298
|
+
i18nKeys,
|
|
299
|
+
renderUnSupportedElement
|
|
266
300
|
} = this.props;
|
|
267
301
|
|
|
268
302
|
const getImgStyle = i => {
|
|
@@ -299,17 +333,24 @@ export default class AttachmentViewer extends Component {
|
|
|
299
333
|
children,
|
|
300
334
|
dataId = 'attachViewer',
|
|
301
335
|
customClass = {},
|
|
302
|
-
customProps = {}
|
|
336
|
+
customProps = {},
|
|
337
|
+
previewurl,
|
|
338
|
+
type
|
|
303
339
|
} = data;
|
|
304
340
|
const {
|
|
305
341
|
audioProps = {},
|
|
306
|
-
imageProps = {}
|
|
342
|
+
imageProps = {},
|
|
343
|
+
videoProps = {},
|
|
344
|
+
iframeProps = {}
|
|
307
345
|
} = customProps;
|
|
308
346
|
const {
|
|
309
347
|
customImageClass = '',
|
|
310
348
|
customChildrenClass = ''
|
|
311
349
|
} = customClass;
|
|
312
350
|
const retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
351
|
+
const frameOrigin = getFrameOrigin();
|
|
352
|
+
const iframeSrc = `${previewurl}&frameorigin=${frameOrigin}`;
|
|
353
|
+
const extension = getExtensionFromFileName(name);
|
|
313
354
|
return /*#__PURE__*/React.createElement(Container, {
|
|
314
355
|
className: style.imgBox,
|
|
315
356
|
id: `imgBox${i}`,
|
|
@@ -320,32 +361,50 @@ export default class AttachmentViewer extends Component {
|
|
|
320
361
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
321
362
|
className: style.imgRef,
|
|
322
363
|
id: `imgPreviewRef${i}`
|
|
323
|
-
},
|
|
324
|
-
|
|
364
|
+
}, selectedIndex == i && /*#__PURE__*/React.createElement(React.Fragment, null, isAudioFile(extension) ? /*#__PURE__*/React.createElement("audio", {
|
|
365
|
+
controls: true,
|
|
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", {
|
|
325
374
|
controls: true,
|
|
326
375
|
className: style.zoomIn,
|
|
327
376
|
"data-id": `${dataId}_videoPreview`,
|
|
328
377
|
"data-test-id": `${dataId}_videoPreview`,
|
|
329
|
-
...
|
|
378
|
+
...videoProps
|
|
330
379
|
}, /*#__PURE__*/React.createElement("source", {
|
|
331
380
|
src: viewUrl,
|
|
332
|
-
type: `
|
|
333
|
-
})) :
|
|
381
|
+
type: `video/${extension}`
|
|
382
|
+
})) : isImageFile(extension) ? /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
334
383
|
customClass: {
|
|
335
|
-
customImageClass: `${style.img} ${style.altText}
|
|
336
|
-
${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
384
|
+
customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
337
385
|
customChildrenClass
|
|
338
386
|
},
|
|
339
387
|
src: viewUrl,
|
|
340
|
-
onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e =>
|
|
341
|
-
_this.zoomIn(e, i, true);
|
|
342
|
-
} : undefined,
|
|
388
|
+
onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e => _this.zoomIn(e, i, true) : undefined,
|
|
343
389
|
alt: name,
|
|
344
390
|
dataId: dataId,
|
|
345
391
|
id: `img${i}`,
|
|
346
392
|
isCover: false,
|
|
347
393
|
...imageProps
|
|
348
|
-
}, children)))
|
|
394
|
+
}, children) : type === "document" && previewurl != null ? _this.renderIframe(iframeSrc) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
|
|
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
|
+
}))))));
|
|
349
408
|
});
|
|
350
409
|
}
|
|
351
410
|
|
|
@@ -371,7 +430,7 @@ export default class AttachmentViewer extends Component {
|
|
|
371
430
|
} = customProps;
|
|
372
431
|
const totalLen = data.length;
|
|
373
432
|
const selectedAttachment = data[selectedIndex] || {};
|
|
374
|
-
const selectedImgUrl = selectedAttachment.viewUrl;
|
|
433
|
+
const selectedImgUrl = selectedAttachment.previewurl || selectedAttachment.viewUrl;
|
|
375
434
|
const downloadUrl = selectedAttachment.downloadUrl;
|
|
376
435
|
let authorHref;
|
|
377
436
|
let authorName;
|
|
@@ -586,16 +645,14 @@ export default class AttachmentViewer extends Component {
|
|
|
586
645
|
customImageClass = '',
|
|
587
646
|
customChildrenClass = ''
|
|
588
647
|
} = customClass;
|
|
589
|
-
thumbnail = isAudioFile(name) ? thumbnail || audioThumbNail : thumbnail; //fallback thumbnail for audio
|
|
590
|
-
|
|
591
648
|
return /*#__PURE__*/React.createElement(Box, {
|
|
592
|
-
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}`,
|
|
649
|
+
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''} ${isImageFile(name) || thumbnail ? '' : style.previewIconDiv}`,
|
|
593
650
|
key: index,
|
|
594
651
|
onClick: this.changeSelectedIndex.bind(this, index),
|
|
595
652
|
eleRef: el => this[`img_${index}`] = el,
|
|
596
653
|
dataId: "attachPreviewList",
|
|
597
654
|
"data-title": name
|
|
598
|
-
}, /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
655
|
+
}, isImageFile(name) || thumbnail ? /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
599
656
|
src: thumbnail || viewUrl,
|
|
600
657
|
size: "small",
|
|
601
658
|
alt: name,
|
|
@@ -605,7 +662,7 @@ export default class AttachmentViewer extends Component {
|
|
|
605
662
|
},
|
|
606
663
|
dataId: dataId,
|
|
607
664
|
...customProps
|
|
608
|
-
}, children));
|
|
665
|
+
}, children) : this.getPreviewIconData(name, '40'));
|
|
609
666
|
}))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
|
|
610
667
|
dataId: "attachToggle",
|
|
611
668
|
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.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
|
}
|
|
@@ -26,7 +26,8 @@ export const AttachmentViewer_propTypes = {
|
|
|
26
26
|
downloadText: PropTypes.string,
|
|
27
27
|
closeText: PropTypes.string,
|
|
28
28
|
hideText: PropTypes.string,
|
|
29
|
-
showText: PropTypes.string
|
|
29
|
+
showText: PropTypes.string,
|
|
30
|
+
previewUnsupportedText: PropTypes.string
|
|
30
31
|
}),
|
|
31
32
|
needDownload: PropTypes.string,
|
|
32
33
|
previewObj: PropTypes.object,
|
|
@@ -34,6 +35,7 @@ export const AttachmentViewer_propTypes = {
|
|
|
34
35
|
maintainZoom: PropTypes.bool,
|
|
35
36
|
isActive: PropTypes.bool,
|
|
36
37
|
dataId: PropTypes.string,
|
|
38
|
+
renderUnSupportedElement: PropTypes.func,
|
|
37
39
|
customProps: PropTypes.shape({
|
|
38
40
|
avatarProps: PropTypes.exact(AvatarProps)
|
|
39
41
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAudioFile } from "./Attachment";
|
|
1
|
+
import { isAudioFile, isDocsFile, isEmailFile, isPdfFile, isPresentationFile, isSheetFile, isVideoFile } from "./Attachment";
|
|
2
2
|
export class Zoom {
|
|
3
3
|
constructor() {
|
|
4
4
|
const matrix = [1, 0, 0, 1, 0, 0]; // current view transform
|
|
@@ -120,6 +120,16 @@ 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
|
+
}
|
|
123
133
|
export function checkAudioUrlValidity(url) {
|
|
124
134
|
return new Promise(resolve => {
|
|
125
135
|
const audio = new Audio(url);
|
|
@@ -134,11 +144,20 @@ export function checkAudioUrlValidity(url) {
|
|
|
134
144
|
});
|
|
135
145
|
}
|
|
136
146
|
;
|
|
147
|
+
export function isValidDocument(url) {
|
|
148
|
+
if (!url) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
137
154
|
export function checkFileSourcesValidation(_ref) {
|
|
138
155
|
let {
|
|
139
156
|
fileName,
|
|
140
|
-
viewURL
|
|
157
|
+
viewURL,
|
|
158
|
+
previewUrl
|
|
141
159
|
} = _ref;
|
|
160
|
+
const documentTypes = isDocsFile(fileName) || isSheetFile(fileName) || isPresentationFile(fileName) || isPdfFile(fileName) || isEmailFile(fileName);
|
|
142
161
|
|
|
143
162
|
if (isAudioFile(fileName)) {
|
|
144
163
|
const audioValidityPromise = checkAudioUrlValidity(viewURL);
|
|
@@ -146,6 +165,18 @@ export function checkFileSourcesValidation(_ref) {
|
|
|
146
165
|
isViewURLValid: isURLValid,
|
|
147
166
|
canZoom: false
|
|
148
167
|
}));
|
|
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
|
+
});
|
|
149
180
|
} else {
|
|
150
181
|
const imageValidityPromise = checkImageValidity(viewURL);
|
|
151
182
|
return imageValidityPromise.then(isURLValid => ({
|
|
@@ -153,4 +184,7 @@ export function checkFileSourcesValidation(_ref) {
|
|
|
153
184
|
canZoom: isURLValid
|
|
154
185
|
}));
|
|
155
186
|
}
|
|
187
|
+
}
|
|
188
|
+
export function getFrameOrigin() {
|
|
189
|
+
return new URL(window.location.href).origin;
|
|
156
190
|
}
|
|
@@ -28,7 +28,7 @@ import useOnboarding from "./hooks/useOnboarding";
|
|
|
28
28
|
import { DUMMY_OBJECT } from "../utils/General";
|
|
29
29
|
/** style **/
|
|
30
30
|
|
|
31
|
-
import defaultStyle from "./css/
|
|
31
|
+
import defaultStyle from "./css/Onboarding.module.css";
|
|
32
32
|
|
|
33
33
|
const Onboarding = _ref => {
|
|
34
34
|
let {
|
|
@@ -11,7 +11,7 @@ import { defaultProps } from "./props/defaultProps";
|
|
|
11
11
|
import { propTypes } from "./props/propTypes";
|
|
12
12
|
/**** Styles ****/
|
|
13
13
|
|
|
14
|
-
import defaultStyle from "./css/
|
|
14
|
+
import defaultStyle from "./css/VideoLookup.module.css";
|
|
15
15
|
export default function VideoLookup(props) {
|
|
16
16
|
const {
|
|
17
17
|
isOpened,
|
|
@@ -165,8 +165,7 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
165
165
|
const {
|
|
166
166
|
TextBoxIconProps = {},
|
|
167
167
|
TagWrapperProps = {},
|
|
168
|
-
TagProps = {}
|
|
169
|
-
ListItemProps = {}
|
|
168
|
+
TagProps = {}
|
|
170
169
|
} = customProps;
|
|
171
170
|
const isEditable = !isReadOnly;
|
|
172
171
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -301,8 +300,7 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
301
300
|
getRef: this.getSelectedItemRef,
|
|
302
301
|
isDisabled: listDisabled,
|
|
303
302
|
customProps: listItemProps,
|
|
304
|
-
customClass: listItemClass
|
|
305
|
-
...ListItemProps
|
|
303
|
+
customClass: listItemClass
|
|
306
304
|
}, isNew ? /*#__PURE__*/React.createElement(Container, {
|
|
307
305
|
alignBox: "row",
|
|
308
306
|
align: "vertical"
|
|
@@ -52,8 +52,7 @@ export const propTypes = {
|
|
|
52
52
|
customProps: PropTypes.shape({
|
|
53
53
|
TextBoxIconProps: PropTypes.object,
|
|
54
54
|
TagWrapperProps: PropTypes.object,
|
|
55
|
-
TagProps: PropTypes.object
|
|
56
|
-
ListItemProps: PropTypes.object
|
|
55
|
+
TagProps: PropTypes.object
|
|
57
56
|
}),
|
|
58
57
|
isFocus: PropTypes.bool
|
|
59
58
|
};
|