@zohodesk/dot 1.0.0-temp-213 → 1.0.0-temp-215
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 +8 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +7 -7
- package/assets/Appearance/dark/themes/blue/blue_DotCTA_DarkModifyCategory.module.css +13 -0
- package/assets/Appearance/dark/themes/green/green_DotCTA_DarkModifyCategory.module.css +13 -0
- package/assets/Appearance/dark/themes/orange/orange_DotCTA_DarkModifyCategory.module.css +13 -0
- package/assets/Appearance/dark/themes/red/red_DotCTA_DarkModifyCategory.module.css +13 -0
- package/assets/Appearance/dark/themes/yellow/yellow_DotCTA_DarkModifyCategory.module.css +13 -0
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +13 -13
- package/assets/Appearance/light/themes/blue/blue_DotCTA_LightModifyCategory.module.css +13 -0
- package/assets/Appearance/light/themes/green/green_DotCTA_LightModifyCategory.module.css +13 -0
- package/assets/Appearance/light/themes/orange/orange_DotCTA_LightModifyCategory.module.css +13 -0
- package/assets/Appearance/light/themes/red/red_DotCTA_LightModifyCategory.module.css +13 -0
- package/assets/Appearance/light/themes/yellow/yellow_DotCTA_LightModifyCategory.module.css +13 -0
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +5 -5
- package/assets/Appearance/pureDark/themes/blue/blue_DotCTA_PureDarkModifyCategory.module.css +13 -0
- package/assets/Appearance/pureDark/themes/green/green_DotCTA_PureDarkModifyCategory.module.css +13 -0
- package/assets/Appearance/pureDark/themes/orange/orange_DotCTA_PureDarkModifyCategory.module.css +13 -0
- package/assets/Appearance/pureDark/themes/red/red_DotCTA_PureDarkModifyCategory.module.css +13 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_DotCTA_PureDarkModifyCategory.module.css +13 -0
- package/es/Attachment/Attachment.module.css +7 -3
- package/es/AttachmentViewer/Attachment.js +106 -1
- package/es/AttachmentViewer/AttachmentViewer.js +114 -28
- package/es/AttachmentViewer/AttachmentViewer.module.css +32 -9
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +15 -16
- package/es/AttachmentViewer/props/defaultProps.js +1 -1
- package/es/AttachmentViewer/props/propTypes.js +9 -1
- package/es/AttachmentViewer/utils.js +98 -13
- package/es/form/fields/Fields.module.css +3 -0
- package/es/form/fields/RadioField/RadioField.js +1 -1
- package/es/lookup/Lookup/Lookup.js +2 -1
- package/es/lookup/Lookup/Lookup.module.css +6 -1
- package/es/lookup/Lookup/props/propTypes.js +1 -0
- package/es/utils/General.js +23 -1
- package/lib/Attachment/Attachment.module.css +7 -3
- package/lib/AttachmentViewer/Attachment.js +109 -1
- package/lib/AttachmentViewer/AttachmentViewer.js +121 -25
- package/lib/AttachmentViewer/AttachmentViewer.module.css +32 -9
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +15 -16
- package/lib/AttachmentViewer/props/defaultProps.js +1 -1
- package/lib/AttachmentViewer/props/propTypes.js +9 -1
- package/lib/AttachmentViewer/utils.js +102 -8
- package/lib/form/fields/Fields.module.css +3 -0
- package/lib/form/fields/RadioField/RadioField.js +1 -1
- package/lib/lookup/Lookup/Lookup.js +2 -1
- package/lib/lookup/Lookup/Lookup.module.css +6 -1
- package/lib/lookup/Lookup/props/propTypes.js +1 -0
- package/lib/utils/General.js +25 -1
- package/package.json +12 -13
- package/result.json +1 -0
- package/unittest/index.html +45 -0
- package/es/common/dot_common.module.css +0 -4
- package/lib/common/dot_common.module.css +0 -4
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
height: 100% ;
|
|
15
15
|
width: 100% ;
|
|
16
16
|
position: absolute;
|
|
17
|
-
top:0
|
|
17
|
+
top: 0
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
[dir=ltr] .disableLayer {
|
|
21
|
-
left:0
|
|
21
|
+
left: 0
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
[dir=rtl] .disableLayer {
|
|
25
|
-
right:0
|
|
25
|
+
right: 0
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.attachmentHover {
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
height: var(--zd_size40) ;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
.attachleft {
|
|
70
|
+
padding: var(--zd_size3) ;
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
[dir=ltr] .attachleft {
|
|
70
74
|
border-right: 1px solid var(--zdt_attachment_default_border);
|
|
71
75
|
}
|
|
@@ -3,10 +3,16 @@
|
|
|
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;
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
var _General = require("../utils/General");
|
|
12
|
+
|
|
13
|
+
var _utils = require("./utils");
|
|
14
|
+
|
|
15
|
+
// const UNASSIGNED = 'Unassigned';
|
|
10
16
|
var BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
|
|
11
17
|
|
|
12
18
|
function isAudioFile(fileName) {
|
|
@@ -25,4 +31,106 @@ function getExtensionFromFileName(fileName) {
|
|
|
25
31
|
function isBrowserSupportedFile(fileName) {
|
|
26
32
|
var extension = getExtensionFromFileName(fileName);
|
|
27
33
|
return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getAttachmentIconDetails(fileName) {
|
|
37
|
+
var extension = (getExtensionFromFileName(fileName) || '').toLowerCase();
|
|
38
|
+
|
|
39
|
+
if (!extension) {
|
|
40
|
+
return 'ZD-GN-fileUnknown';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var image = _utils.SUPPORTED_FILE_EXTENSIONS.image,
|
|
44
|
+
doc = _utils.SUPPORTED_FILE_EXTENSIONS.doc,
|
|
45
|
+
pdf = _utils.SUPPORTED_FILE_EXTENSIONS.pdf,
|
|
46
|
+
html = _utils.SUPPORTED_FILE_EXTENSIONS.html,
|
|
47
|
+
ppt = _utils.SUPPORTED_FILE_EXTENSIONS.ppt,
|
|
48
|
+
zip = _utils.SUPPORTED_FILE_EXTENSIONS.zip,
|
|
49
|
+
word = _utils.SUPPORTED_FILE_EXTENSIONS.word,
|
|
50
|
+
xml = _utils.SUPPORTED_FILE_EXTENSIONS.xml,
|
|
51
|
+
sheet = _utils.SUPPORTED_FILE_EXTENSIONS.sheet,
|
|
52
|
+
audio = _utils.SUPPORTED_FILE_EXTENSIONS.audio,
|
|
53
|
+
video = _utils.SUPPORTED_FILE_EXTENSIONS.video,
|
|
54
|
+
mail = _utils.SUPPORTED_FILE_EXTENSIONS.mail,
|
|
55
|
+
linux = _utils.SUPPORTED_FILE_EXTENSIONS.linux,
|
|
56
|
+
css = _utils.SUPPORTED_FILE_EXTENSIONS.css,
|
|
57
|
+
exe = _utils.SUPPORTED_FILE_EXTENSIONS.exe,
|
|
58
|
+
event = _utils.SUPPORTED_FILE_EXTENSIONS.event;
|
|
59
|
+
|
|
60
|
+
if (image.includes(extension)) {
|
|
61
|
+
return 'ZD-EF-fileImage';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (doc.includes(extension)) {
|
|
65
|
+
return 'ZD-GN-fileDoc';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (pdf.includes(extension)) {
|
|
69
|
+
return 'ZD-EF-filePdf';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (ppt.includes(extension)) {
|
|
73
|
+
return 'ZD-GN-filePpt';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (zip.includes(extension)) {
|
|
77
|
+
return 'ZD-EF-fileZip';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (word.includes(extension)) {
|
|
81
|
+
var OSName = (navigator.platform || '').toLowerCase();
|
|
82
|
+
return OSName.includes('mac') || OSName.includes('linux') ? 'ZD-EF-fileOffice' : 'ZD-EF-fileWord';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (xml.includes(extension)) {
|
|
86
|
+
return 'ZD-EF-fileXml';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (sheet.includes(extension)) {
|
|
90
|
+
return 'ZD-GN-fileSheet';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (audio.includes(extension)) {
|
|
94
|
+
return 'ZD-EF-fileMp3';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (video.includes(extension)) {
|
|
98
|
+
return 'ZD-EF-fileMp4';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (mail.includes(extension)) {
|
|
102
|
+
return 'ZD-GN-fileMail';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (linux.includes(extension)) {
|
|
106
|
+
return 'ZD-EF-linux';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (css.includes(extension)) {
|
|
110
|
+
return 'ZD-EF-clrCss';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (exe.includes(extension)) {
|
|
114
|
+
return 'ZD-EF-exe';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (event.includes(extension)) {
|
|
118
|
+
return 'ZD-TK-event';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (html.includes(extension)) {
|
|
122
|
+
var browser = ((0, _General.getBrowserWithVersion)() || '').toLowerCase();
|
|
123
|
+
|
|
124
|
+
if (browser.includes('chrome') || browser.includes('safari')) {
|
|
125
|
+
return 'ZD-EF-fileXml';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (browser.includes('ie') || browser.includes('edge')) {
|
|
129
|
+
return 'ZD-EF-explorer';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return 'ZD-EF-firebox';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return 'ZD-GN-fileUnknown';
|
|
28
136
|
}
|
|
@@ -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,10 +119,39 @@ 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
|
|
|
123
127
|
_createClass(AttachmentViewer, [{
|
|
128
|
+
key: "isImageFileType",
|
|
129
|
+
value: function isImageFileType(fileName) {
|
|
130
|
+
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
131
|
+
if (!extension) return false;
|
|
132
|
+
return _utils.FILE_EXTENSIONS.image.map(function (ext) {
|
|
133
|
+
return ext.toLowerCase();
|
|
134
|
+
}).includes(extension);
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "isVideoFileType",
|
|
138
|
+
value: function isVideoFileType(fileName) {
|
|
139
|
+
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
140
|
+
if (!extension) return false;
|
|
141
|
+
return _utils.FILE_EXTENSIONS.video.map(function (ext) {
|
|
142
|
+
return ext.toLowerCase();
|
|
143
|
+
}).includes(extension);
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "isAudioFileType",
|
|
147
|
+
value: function isAudioFileType(fileName) {
|
|
148
|
+
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
149
|
+
if (!extension) return false;
|
|
150
|
+
return _utils.FILE_EXTENSIONS.audio.map(function (ext) {
|
|
151
|
+
return ext.toLowerCase();
|
|
152
|
+
}).includes(extension);
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
124
155
|
key: "componentDidMount",
|
|
125
156
|
value: function componentDidMount() {
|
|
126
157
|
this.handleMenuValidation();
|
|
@@ -163,13 +194,17 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
163
194
|
var _this$state = this.state,
|
|
164
195
|
data = _this$state.data,
|
|
165
196
|
selectedIndex = _this$state.selectedIndex;
|
|
197
|
+
var allowedPreviewExtensionsData = this.props.allowedPreviewExtensionsData;
|
|
166
198
|
var selectedAttachment = data[selectedIndex] || {};
|
|
167
|
-
var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
168
|
-
|
|
199
|
+
var selectedAttachmentViewUrl = selectedAttachment.viewUrl; // const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
200
|
+
|
|
169
201
|
var selectedAttachmentName = selectedAttachment.name;
|
|
202
|
+
var selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
170
203
|
(0, _utils.checkFileSourcesValidation)({
|
|
171
204
|
fileName: selectedAttachmentName,
|
|
172
|
-
viewURL: selectedAttachmentViewUrl
|
|
205
|
+
viewURL: selectedAttachmentViewUrl,
|
|
206
|
+
previewUrl: selectedAttachmentPreviewUrl,
|
|
207
|
+
allowedPreviewExtensionsData: allowedPreviewExtensionsData
|
|
173
208
|
}).then(function (fileSourceValidation) {
|
|
174
209
|
var isViewURLValid = fileSourceValidation.isViewURLValid,
|
|
175
210
|
canZoom = fileSourceValidation.canZoom;
|
|
@@ -332,9 +367,38 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
332
367
|
}])
|
|
333
368
|
};
|
|
334
369
|
}
|
|
370
|
+
}, {
|
|
371
|
+
key: "getPreviewIconData",
|
|
372
|
+
value: function getPreviewIconData(name, size, dataId) {
|
|
373
|
+
var fileUnknown = {
|
|
374
|
+
iconName: 'ZD-GN-fileUnknown',
|
|
375
|
+
iconSize: '40'
|
|
376
|
+
};
|
|
377
|
+
var fileIconName = (0, _Attachment.getAttachmentIconDetails)(name);
|
|
378
|
+
var fileDetails = name ? {
|
|
379
|
+
iconName: fileIconName,
|
|
380
|
+
iconSize: size
|
|
381
|
+
} : fileUnknown;
|
|
382
|
+
var iconName = fileDetails.iconName,
|
|
383
|
+
iconSize = fileDetails.iconSize;
|
|
384
|
+
return /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
385
|
+
iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
|
|
386
|
+
name: iconName,
|
|
387
|
+
size: iconSize,
|
|
388
|
+
"data-id": dataId
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}, {
|
|
392
|
+
key: "renderIframe",
|
|
393
|
+
value: function renderIframe(previewurl) {
|
|
394
|
+
return /*#__PURE__*/_react["default"].createElement("iframe", _extends({
|
|
395
|
+
src: previewurl,
|
|
396
|
+
className: _AttachmentViewerModule["default"].previewFrame
|
|
397
|
+
}, this.props.customProps.iframeProps));
|
|
398
|
+
}
|
|
335
399
|
}, {
|
|
336
400
|
key: "imgPreviewView",
|
|
337
|
-
value: function imgPreviewView() {
|
|
401
|
+
value: function imgPreviewView(downloadUrl) {
|
|
338
402
|
var _this5 = this;
|
|
339
403
|
|
|
340
404
|
var _this$state3 = this.state,
|
|
@@ -345,7 +409,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
345
409
|
isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
|
|
346
410
|
var _this$props = this.props,
|
|
347
411
|
maintainZoom = _this$props.maintainZoom,
|
|
348
|
-
dataId = _this$props.dataId
|
|
412
|
+
dataId = _this$props.dataId,
|
|
413
|
+
i18nKeys = _this$props.i18nKeys,
|
|
414
|
+
renderUnSupportedElement = _this$props.renderUnSupportedElement;
|
|
349
415
|
|
|
350
416
|
var getImgStyle = function getImgStyle(i) {
|
|
351
417
|
var position;
|
|
@@ -383,16 +449,25 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
383
449
|
_data$customClass = data.customClass,
|
|
384
450
|
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
385
451
|
_data$customProps = data.customProps,
|
|
386
|
-
customProps = _data$customProps === void 0 ? {} : _data$customProps
|
|
452
|
+
customProps = _data$customProps === void 0 ? {} : _data$customProps,
|
|
453
|
+
previewurl = data.previewurl,
|
|
454
|
+
type = data.type;
|
|
387
455
|
var _customProps$audioPro = customProps.audioProps,
|
|
388
456
|
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
389
457
|
_customProps$imagePro = customProps.imageProps,
|
|
390
|
-
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro
|
|
458
|
+
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
|
|
459
|
+
_customProps$videoPro = customProps.videoProps,
|
|
460
|
+
videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
|
|
391
461
|
var _customClass$customIm = customClass.customImageClass,
|
|
392
462
|
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
393
463
|
_customClass$customCh = customClass.customChildrenClass,
|
|
394
464
|
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
395
465
|
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
466
|
+
var extension = (0, _Attachment.getExtensionFromFileName)(name);
|
|
467
|
+
var _i18nKeys$previewUnsu = i18nKeys.previewUnsupportedText,
|
|
468
|
+
previewUnsupportedText = _i18nKeys$previewUnsu === void 0 ? "Preview not available for the selected file type." : _i18nKeys$previewUnsu,
|
|
469
|
+
_i18nKeys$downloadTex = i18nKeys.downloadText,
|
|
470
|
+
downloadText = _i18nKeys$downloadTex === void 0 ? "Download" : _i18nKeys$downloadTex;
|
|
396
471
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
397
472
|
className: _AttachmentViewerModule["default"].imgBox,
|
|
398
473
|
id: "imgBox".concat(i),
|
|
@@ -403,29 +478,51 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
403
478
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
404
479
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
405
480
|
id: "imgPreviewRef".concat(i)
|
|
406
|
-
}, (
|
|
407
|
-
|
|
481
|
+
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this5.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
|
|
482
|
+
controls: true,
|
|
483
|
+
className: _AttachmentViewerModule["default"].zoomIn,
|
|
484
|
+
"data-id": "".concat(dataId, "_audioPreview"),
|
|
485
|
+
"data-test-id": "".concat(dataId, "_audioPreview")
|
|
486
|
+
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
487
|
+
src: previewurl || viewUrl,
|
|
488
|
+
type: "audio/".concat(extension)
|
|
489
|
+
})) : _this5.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
408
490
|
controls: true,
|
|
409
491
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
410
492
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
411
493
|
"data-test-id": "".concat(dataId, "_videoPreview")
|
|
412
|
-
},
|
|
494
|
+
}, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
413
495
|
src: viewUrl,
|
|
414
|
-
type: "
|
|
415
|
-
})) :
|
|
496
|
+
type: "video/".concat(extension)
|
|
497
|
+
})) : _this5.isImageFileType(name) || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
416
498
|
customClass: {
|
|
417
|
-
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "
|
|
499
|
+
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
500
|
customChildrenClass: customChildrenClass
|
|
419
501
|
},
|
|
420
502
|
src: viewUrl,
|
|
421
503
|
onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
|
|
422
|
-
_this5.zoomIn(e, i, true);
|
|
504
|
+
return _this5.zoomIn(e, i, true);
|
|
423
505
|
} : undefined,
|
|
424
506
|
alt: name,
|
|
425
507
|
dataId: dataId,
|
|
426
508
|
id: "img".concat(i),
|
|
427
509
|
isCover: false
|
|
428
|
-
}, imageProps), children)))
|
|
510
|
+
}, imageProps), children) : type === "document" && previewurl != null ? _this5.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
511
|
+
className: _AttachmentViewerModule["default"].previewNone
|
|
512
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
513
|
+
className: _AttachmentViewerModule["default"].fileTypeImg
|
|
514
|
+
}, _this5.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
515
|
+
$ui_size: "20",
|
|
516
|
+
$ui_weight: "semibold"
|
|
517
|
+
}, previewUnsupportedText), downloadUrl ? /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
518
|
+
href: downloadUrl,
|
|
519
|
+
className: _AttachmentViewerModule["default"].downloadLink,
|
|
520
|
+
hasReload: true,
|
|
521
|
+
download: true
|
|
522
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
523
|
+
palette: "primaryFilled",
|
|
524
|
+
text: downloadText
|
|
525
|
+
})) : null))));
|
|
429
526
|
});
|
|
430
527
|
}
|
|
431
528
|
}, {
|
|
@@ -451,7 +548,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
451
548
|
avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
|
|
452
549
|
var totalLen = data.length;
|
|
453
550
|
var selectedAttachment = data[selectedIndex] || {};
|
|
454
|
-
var selectedImgUrl = selectedAttachment.viewUrl;
|
|
551
|
+
var selectedImgUrl = selectedAttachment.previewurl || selectedAttachment.viewUrl;
|
|
455
552
|
var downloadUrl = selectedAttachment.downloadUrl;
|
|
456
553
|
var authorHref;
|
|
457
554
|
var authorName;
|
|
@@ -606,7 +703,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
606
703
|
eleRef: _this6.setImgBoxRef,
|
|
607
704
|
scroll: "both",
|
|
608
705
|
flexible: true
|
|
609
|
-
}, _this6.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
706
|
+
}, _this6.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
610
707
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
611
708
|
onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
|
|
612
709
|
"data-title": i18nKeys.nextText,
|
|
@@ -662,14 +759,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
662
759
|
_item$customProps = item.customProps,
|
|
663
760
|
customProps = _item$customProps === void 0 ? {} : _item$customProps;
|
|
664
761
|
var thumbnail = item.thumbnail;
|
|
762
|
+
var isImageFileType = _this6.isImageFileType(name) || thumbnail;
|
|
665
763
|
var _customClass$customIm2 = customClass.customImageClass,
|
|
666
764
|
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
667
765
|
_customClass$customCh2 = customClass.customChildrenClass,
|
|
668
766
|
customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
|
|
669
|
-
thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
|
|
670
|
-
|
|
671
767
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
672
|
-
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
|
|
768
|
+
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
|
|
673
769
|
key: index,
|
|
674
770
|
onClick: _this6.changeSelectedIndex.bind(_this6, index),
|
|
675
771
|
eleRef: function eleRef(el) {
|
|
@@ -677,7 +773,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
677
773
|
},
|
|
678
774
|
dataId: "attachPreviewList",
|
|
679
775
|
"data-title": name
|
|
680
|
-
}, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
776
|
+
}, isImageFileType || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
681
777
|
src: thumbnail || viewUrl,
|
|
682
778
|
size: "small",
|
|
683
779
|
alt: name,
|
|
@@ -686,7 +782,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
686
782
|
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
687
783
|
},
|
|
688
784
|
dataId: dataId
|
|
689
|
-
}, customProps), children));
|
|
785
|
+
}, customProps), children) : _this6.getPreviewIconData(name, '40'));
|
|
690
786
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
691
787
|
dataId: "attachToggle",
|
|
692
788
|
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,31 @@
|
|
|
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
|
+
max-width: 70% ;
|
|
370
|
+
text-align: center;
|
|
371
|
+
margin: auto ;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.downloadLink {
|
|
375
|
+
display: inline-block;
|
|
376
|
+
padding-top: var(--zd_size15) ;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.previewIconDiv {
|
|
380
|
+
width: var(--zd_size60) ;
|
|
381
|
+
composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.prevFooterIcon {
|
|
385
|
+
color: var(--zdt_attachmentviewer_title_text);
|
|
386
|
+
padding: var(--zd_size2) ;
|
|
387
|
+
margin: auto ;
|
|
365
388
|
}
|
|
@@ -237,7 +237,7 @@ exports[`AttachmentViewer rendering the when isActive is true 1`] = `
|
|
|
237
237
|
data-test-id="containerComponent"
|
|
238
238
|
>
|
|
239
239
|
<div
|
|
240
|
-
class="imgItem selected
|
|
240
|
+
class="imgItem selected shrinkOff"
|
|
241
241
|
data-id="attachPreviewList"
|
|
242
242
|
data-selector-id="box"
|
|
243
243
|
data-test-id="attachPreviewList"
|
|
@@ -254,7 +254,7 @@ exports[`AttachmentViewer rendering the when isActive is true 1`] = `
|
|
|
254
254
|
</div>
|
|
255
255
|
</div>
|
|
256
256
|
<div
|
|
257
|
-
class="imgItem
|
|
257
|
+
class="imgItem shrinkOff"
|
|
258
258
|
data-id="attachPreviewList"
|
|
259
259
|
data-selector-id="box"
|
|
260
260
|
data-test-id="attachPreviewList"
|
|
@@ -271,7 +271,7 @@ exports[`AttachmentViewer rendering the when isActive is true 1`] = `
|
|
|
271
271
|
</div>
|
|
272
272
|
</div>
|
|
273
273
|
<div
|
|
274
|
-
class="imgItem
|
|
274
|
+
class="imgItem shrinkOff"
|
|
275
275
|
data-id="attachPreviewList"
|
|
276
276
|
data-selector-id="box"
|
|
277
277
|
data-test-id="attachPreviewList"
|
|
@@ -288,7 +288,7 @@ exports[`AttachmentViewer rendering the when isActive is true 1`] = `
|
|
|
288
288
|
</div>
|
|
289
289
|
</div>
|
|
290
290
|
<div
|
|
291
|
-
class="imgItem
|
|
291
|
+
class="imgItem shrinkOff"
|
|
292
292
|
data-id="attachPreviewList"
|
|
293
293
|
data-selector-id="box"
|
|
294
294
|
data-test-id="attachPreviewList"
|
|
@@ -305,7 +305,7 @@ exports[`AttachmentViewer rendering the when isActive is true 1`] = `
|
|
|
305
305
|
</div>
|
|
306
306
|
</div>
|
|
307
307
|
<div
|
|
308
|
-
class="imgItem
|
|
308
|
+
class="imgItem shrinkOff"
|
|
309
309
|
data-id="attachPreviewList"
|
|
310
310
|
data-selector-id="box"
|
|
311
311
|
data-test-id="attachPreviewList"
|
|
@@ -322,7 +322,7 @@ exports[`AttachmentViewer rendering the when isActive is true 1`] = `
|
|
|
322
322
|
</div>
|
|
323
323
|
</div>
|
|
324
324
|
<div
|
|
325
|
-
class="imgItem
|
|
325
|
+
class="imgItem shrinkOff"
|
|
326
326
|
data-id="attachPreviewList"
|
|
327
327
|
data-selector-id="box"
|
|
328
328
|
data-test-id="attachPreviewList"
|
|
@@ -339,21 +339,20 @@ exports[`AttachmentViewer rendering the when isActive is true 1`] = `
|
|
|
339
339
|
</div>
|
|
340
340
|
</div>
|
|
341
341
|
<div
|
|
342
|
-
class="imgItem shrinkOff"
|
|
342
|
+
class="imgItem previewIconDiv shrinkOff"
|
|
343
343
|
data-id="attachPreviewList"
|
|
344
344
|
data-selector-id="box"
|
|
345
345
|
data-test-id="attachPreviewList"
|
|
346
346
|
data-title="slack5.mp3"
|
|
347
347
|
>
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
data-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
</div>
|
|
348
|
+
<i
|
|
349
|
+
aria-hidden="true"
|
|
350
|
+
class="zd_font_icons basic icon-fileMp3 prevFooterIcon "
|
|
351
|
+
data-id="fontIcon"
|
|
352
|
+
data-selector-id="fontIcon"
|
|
353
|
+
data-test-id="fontIcon"
|
|
354
|
+
style="--zd-iconfont-size: var(--zd_font_size40);"
|
|
355
|
+
/>
|
|
357
356
|
</div>
|
|
358
357
|
</div>
|
|
359
358
|
</div>
|
|
@@ -15,10 +15,10 @@ exports.AttachmentImage_defaultProps = AttachmentImage_defaultProps;
|
|
|
15
15
|
var AttachmentViewer_defaultProps = {
|
|
16
16
|
responsiveId: "Helmet",
|
|
17
17
|
needDownload: true,
|
|
18
|
-
i18nKeys: {},
|
|
19
18
|
maintainZoom: false,
|
|
20
19
|
isActive: false,
|
|
21
20
|
dataId: 'AttachmentViewer',
|
|
21
|
+
i18nKeys: {},
|
|
22
22
|
customProps: {}
|
|
23
23
|
};
|
|
24
24
|
exports.AttachmentViewer_defaultProps = AttachmentViewer_defaultProps;
|
|
@@ -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,13 @@ var AttachmentViewer_propTypes = {
|
|
|
46
47
|
maintainZoom: _propTypes["default"].bool,
|
|
47
48
|
isActive: _propTypes["default"].bool,
|
|
48
49
|
dataId: _propTypes["default"].string,
|
|
50
|
+
allowedPreviewExtensionsData: _propTypes["default"].shape({
|
|
51
|
+
audio: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
52
|
+
video: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
53
|
+
image: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
54
|
+
document: _propTypes["default"].arrayOf(_propTypes["default"].string)
|
|
55
|
+
}),
|
|
56
|
+
renderUnSupportedElement: _propTypes["default"].func,
|
|
49
57
|
customProps: _propTypes["default"].shape({
|
|
50
58
|
avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
|
|
51
59
|
})
|