@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
|
@@ -21,7 +21,8 @@ export default function FreezeLayer(props) {
|
|
|
21
21
|
forwardRef,
|
|
22
22
|
isSvgMask,
|
|
23
23
|
needAutoZindex,
|
|
24
|
-
customStyle
|
|
24
|
+
customStyle,
|
|
25
|
+
onEnterComplete
|
|
25
26
|
} = props;
|
|
26
27
|
const finalStyle = mergeStyle(style, customStyle);
|
|
27
28
|
const {
|
|
@@ -42,7 +43,8 @@ export default function FreezeLayer(props) {
|
|
|
42
43
|
return /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
|
|
43
44
|
name: animationName && animationName,
|
|
44
45
|
isActive: isActive,
|
|
45
|
-
runOnMount: runOnMount
|
|
46
|
+
runOnMount: runOnMount,
|
|
47
|
+
onEnterComplete: onEnterComplete
|
|
46
48
|
}, /*#__PURE__*/React.createElement("div", {
|
|
47
49
|
style: isActive && needAutoZindex ? {
|
|
48
50
|
zIndex: `${getNextIndex()}`
|
|
@@ -58,7 +60,8 @@ export default function FreezeLayer(props) {
|
|
|
58
60
|
component: Container,
|
|
59
61
|
alignBox: "row",
|
|
60
62
|
align: align,
|
|
61
|
-
dataId: "reactFreezeLayer"
|
|
63
|
+
dataId: "reactFreezeLayer",
|
|
64
|
+
onEnterComplete: onEnterComplete
|
|
62
65
|
}, children) : isSvgMask ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : /*#__PURE__*/React.createElement(Container, {
|
|
63
66
|
alignBox: "row",
|
|
64
67
|
align: align,
|
|
@@ -14,6 +14,7 @@ export const propTypes = {
|
|
|
14
14
|
palette: PropTypes.oneOf(['dark', 'default', 'darkLight', 'plain', 'snow']),
|
|
15
15
|
runOnMount: PropTypes.bool,
|
|
16
16
|
customStyle: PropTypes.object,
|
|
17
|
-
zIndex: PropTypes.oneOf(['3', '5', '7', '10'])
|
|
17
|
+
zIndex: PropTypes.oneOf(['3', '5', '7', '10']),
|
|
18
|
+
onEnterComplete: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
|
|
18
19
|
};
|
|
19
20
|
export default propTypes;
|
package/es/utils/General.js
CHANGED
|
@@ -43,26 +43,4 @@ export function formatPhoneUrl(phone) {
|
|
|
43
43
|
|
|
44
44
|
return phone;
|
|
45
45
|
}
|
|
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
|
-
}
|
|
46
|
+
export const DUMMY_OBJECT = Object.freeze({});
|
|
@@ -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
|
}
|
|
@@ -3,53 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getAttachmentIconDetails = getAttachmentIconDetails;
|
|
7
6
|
exports.getExtensionFromFileName = getExtensionFromFileName;
|
|
8
7
|
exports.isAudioFile = isAudioFile;
|
|
9
8
|
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
|
-
|
|
20
9
|
var UNASSIGNED = 'Unassigned';
|
|
21
10
|
var BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
|
|
22
11
|
|
|
23
|
-
function isAudioFile(
|
|
24
|
-
|
|
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);
|
|
12
|
+
function isAudioFile(fileName) {
|
|
13
|
+
var extension = getExtensionFromFileName(fileName);
|
|
14
|
+
return /mp3|wav|ogg/i.test(extension);
|
|
53
15
|
}
|
|
54
16
|
|
|
55
17
|
function getExtensionFromFileName(fileName) {
|
|
@@ -63,189 +25,4 @@ function getExtensionFromFileName(fileName) {
|
|
|
63
25
|
function isBrowserSupportedFile(fileName) {
|
|
64
26
|
var extension = getExtensionFromFileName(fileName);
|
|
65
27
|
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
|
-
}
|
|
251
28
|
}
|
|
@@ -21,12 +21,8 @@ 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
|
-
|
|
26
24
|
var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
|
|
27
25
|
|
|
28
|
-
var _Button = _interopRequireDefault(require("@zohodesk/components/es/Button/Button"));
|
|
29
|
-
|
|
30
26
|
var _AttachmentImage = _interopRequireDefault(require("./AttachmentImage"));
|
|
31
27
|
|
|
32
28
|
var _Link = _interopRequireDefault(require("../Link/Link"));
|
|
@@ -39,9 +35,11 @@ var _Attachment = require("./Attachment");
|
|
|
39
35
|
|
|
40
36
|
var _General = require("../utils/General");
|
|
41
37
|
|
|
38
|
+
var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
|
|
39
|
+
|
|
42
40
|
var _utils = require("./utils");
|
|
43
41
|
|
|
44
|
-
var
|
|
42
|
+
var _audio_thumbnail = _interopRequireDefault(require("../../images/audio_thumbnail.png"));
|
|
45
43
|
|
|
46
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
47
45
|
|
|
@@ -119,8 +117,6 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
119
117
|
_this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
|
|
120
118
|
_this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
|
|
121
119
|
_this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
|
|
122
|
-
_this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
|
|
123
|
-
_this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
|
|
124
120
|
return _this;
|
|
125
121
|
}
|
|
126
122
|
|
|
@@ -171,11 +167,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
171
167
|
var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
172
168
|
var selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
173
169
|
var selectedAttachmentName = selectedAttachment.name;
|
|
174
|
-
var selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
175
170
|
(0, _utils.checkFileSourcesValidation)({
|
|
176
171
|
fileName: selectedAttachmentName,
|
|
177
|
-
viewURL: selectedAttachmentViewUrl
|
|
178
|
-
previewUrl: selectedAttachmentPreviewUrl
|
|
172
|
+
viewURL: selectedAttachmentViewUrl
|
|
179
173
|
}).then(function (fileSourceValidation) {
|
|
180
174
|
var isViewURLValid = fileSourceValidation.isViewURLValid,
|
|
181
175
|
canZoom = fileSourceValidation.canZoom;
|
|
@@ -338,32 +332,6 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
338
332
|
}])
|
|
339
333
|
};
|
|
340
334
|
}
|
|
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
|
-
}
|
|
367
335
|
}, {
|
|
368
336
|
key: "imgPreviewView",
|
|
369
337
|
value: function imgPreviewView() {
|
|
@@ -377,9 +345,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
377
345
|
isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
|
|
378
346
|
var _this$props = this.props,
|
|
379
347
|
maintainZoom = _this$props.maintainZoom,
|
|
380
|
-
dataId = _this$props.dataId
|
|
381
|
-
i18nKeys = _this$props.i18nKeys,
|
|
382
|
-
renderUnSupportedElement = _this$props.renderUnSupportedElement;
|
|
348
|
+
dataId = _this$props.dataId;
|
|
383
349
|
|
|
384
350
|
var getImgStyle = function getImgStyle(i) {
|
|
385
351
|
var position;
|
|
@@ -417,25 +383,16 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
417
383
|
_data$customClass = data.customClass,
|
|
418
384
|
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
419
385
|
_data$customProps = data.customProps,
|
|
420
|
-
customProps = _data$customProps === void 0 ? {} : _data$customProps
|
|
421
|
-
previewurl = data.previewurl,
|
|
422
|
-
type = data.type;
|
|
386
|
+
customProps = _data$customProps === void 0 ? {} : _data$customProps;
|
|
423
387
|
var _customProps$audioPro = customProps.audioProps,
|
|
424
388
|
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
425
389
|
_customProps$imagePro = customProps.imageProps,
|
|
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;
|
|
390
|
+
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
|
|
431
391
|
var _customClass$customIm = customClass.customImageClass,
|
|
432
392
|
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
433
393
|
_customClass$customCh = customClass.customChildrenClass,
|
|
434
394
|
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
435
395
|
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);
|
|
439
396
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
440
397
|
className: _AttachmentViewerModule["default"].imgBox,
|
|
441
398
|
id: "imgBox".concat(i),
|
|
@@ -446,49 +403,29 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
446
403
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
447
404
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
448
405
|
id: "imgPreviewRef".concat(i)
|
|
449
|
-
},
|
|
450
|
-
|
|
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({
|
|
406
|
+
}, (0, _Attachment.isAudioFile)(name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
407
|
+
autoPlay: true,
|
|
458
408
|
controls: true,
|
|
459
409
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
460
410
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
461
411
|
"data-test-id": "".concat(dataId, "_videoPreview")
|
|
462
|
-
},
|
|
412
|
+
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
463
413
|
src: viewUrl,
|
|
464
|
-
type: "
|
|
465
|
-
})) :
|
|
414
|
+
type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(name))
|
|
415
|
+
})) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
466
416
|
customClass: {
|
|
467
|
-
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "
|
|
417
|
+
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "\n ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
|
|
468
418
|
customChildrenClass: customChildrenClass
|
|
469
419
|
},
|
|
470
420
|
src: viewUrl,
|
|
471
421
|
onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
|
|
472
|
-
|
|
422
|
+
_this5.zoomIn(e, i, true);
|
|
473
423
|
} : undefined,
|
|
474
424
|
alt: name,
|
|
475
425
|
dataId: dataId,
|
|
476
426
|
id: "img".concat(i),
|
|
477
427
|
isCover: false
|
|
478
|
-
}, imageProps), children)
|
|
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
|
-
}))))));
|
|
428
|
+
}, imageProps), children)));
|
|
492
429
|
});
|
|
493
430
|
}
|
|
494
431
|
}, {
|
|
@@ -514,7 +451,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
514
451
|
avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
|
|
515
452
|
var totalLen = data.length;
|
|
516
453
|
var selectedAttachment = data[selectedIndex] || {};
|
|
517
|
-
var selectedImgUrl = selectedAttachment.
|
|
454
|
+
var selectedImgUrl = selectedAttachment.viewUrl;
|
|
518
455
|
var downloadUrl = selectedAttachment.downloadUrl;
|
|
519
456
|
var authorHref;
|
|
520
457
|
var authorName;
|
|
@@ -729,8 +666,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
729
666
|
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
730
667
|
_customClass$customCh2 = customClass.customChildrenClass,
|
|
731
668
|
customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
|
|
669
|
+
thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
|
|
670
|
+
|
|
732
671
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
733
|
-
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''
|
|
672
|
+
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
|
|
734
673
|
key: index,
|
|
735
674
|
onClick: _this6.changeSelectedIndex.bind(_this6, index),
|
|
736
675
|
eleRef: function eleRef(el) {
|
|
@@ -738,7 +677,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
738
677
|
},
|
|
739
678
|
dataId: "attachPreviewList",
|
|
740
679
|
"data-title": name
|
|
741
|
-
},
|
|
680
|
+
}, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
742
681
|
src: thumbnail || viewUrl,
|
|
743
682
|
size: "small",
|
|
744
683
|
alt: name,
|
|
@@ -747,7 +686,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
747
686
|
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
748
687
|
},
|
|
749
688
|
dataId: dataId
|
|
750
|
-
}, customProps), children)
|
|
689
|
+
}, customProps), children));
|
|
751
690
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
752
691
|
dataId: "attachToggle",
|
|
753
692
|
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.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
|
}
|
|
@@ -38,8 +38,7 @@ 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
|
|
42
|
-
previewUnsupportedText: _propTypes["default"].string
|
|
41
|
+
showText: _propTypes["default"].string
|
|
43
42
|
}),
|
|
44
43
|
needDownload: _propTypes["default"].string,
|
|
45
44
|
previewObj: _propTypes["default"].object,
|
|
@@ -47,7 +46,6 @@ var AttachmentViewer_propTypes = {
|
|
|
47
46
|
maintainZoom: _propTypes["default"].bool,
|
|
48
47
|
isActive: _propTypes["default"].bool,
|
|
49
48
|
dataId: _propTypes["default"].string,
|
|
50
|
-
renderUnSupportedElement: _propTypes["default"].func,
|
|
51
49
|
customProps: _propTypes["default"].shape({
|
|
52
50
|
avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
|
|
53
51
|
})
|