@zohodesk/dot 1.0.0-temp-187.15 → 1.0.0-temp-200.6
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 +5 -0
- 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 +4 -3
- package/es/Onboarding/__tests__/Onboarding.spec.js +12 -0
- package/es/Onboarding/__tests__/__snapshots__/Onboarding.spec.js.snap +137 -20
- package/es/Onboarding/props/propTypes.js +1 -0
- package/es/VideoLookup/VideoLookup.js +1 -1
- package/es/form/fields/Fields.module.css +0 -4
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +4 -8
- 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/StatusDropdown/StatusDropdown.js +2 -7
- package/es/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/es/list/status/StatusDropdown/props/propTypes.js +1 -4
- 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 +5 -4
- package/lib/Onboarding/__tests__/Onboarding.spec.js +12 -0
- package/lib/Onboarding/__tests__/__snapshots__/Onboarding.spec.js.snap +137 -20
- package/lib/Onboarding/props/propTypes.js +1 -0
- package/lib/VideoLookup/VideoLookup.js +2 -2
- package/lib/form/fields/Fields.module.css +0 -4
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +5 -10
- 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/StatusDropdown/StatusDropdown.js +2 -6
- package/lib/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -3
- 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 +4 -12
- 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
|
@@ -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
|
}
|
|
@@ -38,7 +38,8 @@ var AttachmentViewer_propTypes = {
|
|
|
38
38
|
downloadText: _propTypes["default"].string,
|
|
39
39
|
closeText: _propTypes["default"].string,
|
|
40
40
|
hideText: _propTypes["default"].string,
|
|
41
|
-
showText: _propTypes["default"].string
|
|
41
|
+
showText: _propTypes["default"].string,
|
|
42
|
+
previewUnsupportedText: _propTypes["default"].string
|
|
42
43
|
}),
|
|
43
44
|
needDownload: _propTypes["default"].string,
|
|
44
45
|
previewObj: _propTypes["default"].object,
|
|
@@ -46,6 +47,7 @@ var AttachmentViewer_propTypes = {
|
|
|
46
47
|
maintainZoom: _propTypes["default"].bool,
|
|
47
48
|
isActive: _propTypes["default"].bool,
|
|
48
49
|
dataId: _propTypes["default"].string,
|
|
50
|
+
renderUnSupportedElement: _propTypes["default"].func,
|
|
49
51
|
customProps: _propTypes["default"].shape({
|
|
50
52
|
avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
|
|
51
53
|
})
|
|
@@ -7,6 +7,9 @@ exports.ZoomEvent = exports.Zoom = void 0;
|
|
|
7
7
|
exports.checkAudioUrlValidity = checkAudioUrlValidity;
|
|
8
8
|
exports.checkFileSourcesValidation = checkFileSourcesValidation;
|
|
9
9
|
exports.checkImageValidity = checkImageValidity;
|
|
10
|
+
exports.checkVideoUrlValidity = checkVideoUrlValidity;
|
|
11
|
+
exports.getFrameOrigin = getFrameOrigin;
|
|
12
|
+
exports.isValidDocument = isValidDocument;
|
|
10
13
|
|
|
11
14
|
var _Attachment = require("./Attachment");
|
|
12
15
|
|
|
@@ -153,6 +156,21 @@ function checkImageValidity(src) {
|
|
|
153
156
|
});
|
|
154
157
|
}
|
|
155
158
|
|
|
159
|
+
function checkVideoUrlValidity(url) {
|
|
160
|
+
return new Promise(function (resolve) {
|
|
161
|
+
var video = document.createElement('video');
|
|
162
|
+
video.src = url;
|
|
163
|
+
|
|
164
|
+
video.oncanplaythrough = function () {
|
|
165
|
+
return resolve(true);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
video.onerror = function () {
|
|
169
|
+
return resolve(false);
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
156
174
|
function checkAudioUrlValidity(url) {
|
|
157
175
|
return new Promise(function (resolve) {
|
|
158
176
|
var audio = new Audio(url);
|
|
@@ -169,9 +187,19 @@ function checkAudioUrlValidity(url) {
|
|
|
169
187
|
|
|
170
188
|
;
|
|
171
189
|
|
|
190
|
+
function isValidDocument(url) {
|
|
191
|
+
if (!url) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
|
|
172
198
|
function checkFileSourcesValidation(_ref) {
|
|
173
199
|
var fileName = _ref.fileName,
|
|
174
|
-
viewURL = _ref.viewURL
|
|
200
|
+
viewURL = _ref.viewURL,
|
|
201
|
+
previewUrl = _ref.previewUrl;
|
|
202
|
+
var documentTypes = (0, _Attachment.isDocsFile)(fileName) || (0, _Attachment.isSheetFile)(fileName) || (0, _Attachment.isPresentationFile)(fileName) || (0, _Attachment.isPdfFile)(fileName) || (0, _Attachment.isEmailFile)(fileName);
|
|
175
203
|
|
|
176
204
|
if ((0, _Attachment.isAudioFile)(fileName)) {
|
|
177
205
|
var audioValidityPromise = checkAudioUrlValidity(viewURL);
|
|
@@ -181,6 +209,20 @@ function checkFileSourcesValidation(_ref) {
|
|
|
181
209
|
canZoom: false
|
|
182
210
|
};
|
|
183
211
|
});
|
|
212
|
+
} else if ((0, _Attachment.isVideoFile)(fileName)) {
|
|
213
|
+
var videoValidityPromise = checkVideoUrlValidity(viewURL);
|
|
214
|
+
return videoValidityPromise.then(function (isURLValid) {
|
|
215
|
+
return {
|
|
216
|
+
isViewURLValid: isURLValid,
|
|
217
|
+
canZoom: false
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
} else if (documentTypes && isValidDocument(previewUrl)) {
|
|
221
|
+
var isValid = isValidDocument(previewUrl);
|
|
222
|
+
return Promise.resolve({
|
|
223
|
+
isViewURLValid: isValid,
|
|
224
|
+
canZoom: false
|
|
225
|
+
});
|
|
184
226
|
} else {
|
|
185
227
|
var imageValidityPromise = checkImageValidity(viewURL);
|
|
186
228
|
return imageValidityPromise.then(function (isURLValid) {
|
|
@@ -190,4 +232,8 @@ function checkFileSourcesValidation(_ref) {
|
|
|
190
232
|
};
|
|
191
233
|
});
|
|
192
234
|
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function getFrameOrigin() {
|
|
238
|
+
return new URL(window.location.href).origin;
|
|
193
239
|
}
|
|
@@ -41,7 +41,7 @@ var _useOnboarding2 = _interopRequireDefault(require("./hooks/useOnboarding"));
|
|
|
41
41
|
|
|
42
42
|
var _General = require("../utils/General");
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _OnboardingModule = _interopRequireDefault(require("./css/Onboarding.module.css"));
|
|
45
45
|
|
|
46
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
47
47
|
|
|
@@ -63,7 +63,7 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
63
63
|
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
|
64
64
|
onSecondaryButtonClick = _ref.onSecondaryButtonClick,
|
|
65
65
|
customProps = _ref.customProps;
|
|
66
|
-
var style = (0, _useMergeStyle["default"])(
|
|
66
|
+
var style = (0, _useMergeStyle["default"])(_OnboardingModule["default"], customStyle);
|
|
67
67
|
|
|
68
68
|
var _useOnboarding = (0, _useOnboarding2["default"])(),
|
|
69
69
|
state = _useOnboarding.state,
|
|
@@ -219,6 +219,7 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
219
219
|
}, sliderData.map(function (item, index) {
|
|
220
220
|
var imageSource = item.imageSource,
|
|
221
221
|
videoSource = item.videoSource,
|
|
222
|
+
mediaElement = item.mediaElement,
|
|
222
223
|
heading = item.heading,
|
|
223
224
|
description = item.description,
|
|
224
225
|
_item$hasVideoPlayBut = item.hasVideoPlayButton,
|
|
@@ -243,8 +244,8 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
243
244
|
$ui_alignItems: "center",
|
|
244
245
|
$flag_fullsize: true
|
|
245
246
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
246
|
-
className: "".concat(style.innerHead, " ").concat(hasVideoPlayButton ? style.dvLayer :
|
|
247
|
-
}, renderMediaElement(imageSource, videoSourceLink, videoSourceFormat), hasVideoPlayButton && /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
247
|
+
className: "".concat(style.innerHead, " ").concat(hasVideoPlayButton ? style.dvLayer : '')
|
|
248
|
+
}, mediaElement ? mediaElement : renderMediaElement(imageSource, videoSourceLink, videoSourceFormat), hasVideoPlayButton && /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
248
249
|
$ui_displayMode: "flex",
|
|
249
250
|
$ui_justifyContent: "center",
|
|
250
251
|
$ui_alignItems: "center",
|