@zohodesk/dot 1.0.0-temp-232 → 1.0.0-temp-230.4
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/README.md +14 -2
- package/es/ActionButton/__tests__/ActionButton.spec.js +5 -4
- package/es/AttachmentViewer/AttachmentImage.js +3 -1
- package/es/AttachmentViewer/AttachmentViewer.js +340 -265
- package/es/AttachmentViewer/AttachmentViewer.module.css +8 -15
- package/es/AttachmentViewer/__tests__/AttachmentViewer.spec.js +104 -100
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +778 -1
- package/es/AttachmentViewer/props/defaultProps.js +4 -2
- package/es/AttachmentViewer/props/propTypes.js +9 -2
- package/es/AttachmentViewer/utils.js +7 -6
- package/es/AudioPlayer/utils/utils.js +5 -2
- package/es/DotProvider/hooks/useDotProvider.js +15 -14
- package/es/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +16 -21
- package/es/DotProvider/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +4 -3
- package/es/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +5 -4
- package/es/DotProvider/utils/errorValidation.js +6 -5
- package/es/DotProvider/utils/getAssetsImportPromises.js +5 -4
- package/es/Drawer/Drawer.js +8 -6
- package/es/FreezeLayer/css/cssJSLogic.js +5 -4
- package/es/Hooks/Dragger/useDragger.js +6 -5
- package/es/Hooks/Dragger/utils/DraggerUtil.js +8 -7
- package/es/Hooks/useFreezeLayer.js +5 -4
- package/es/Link/Link.js +4 -3
- package/es/Link/props/propTypes.js +1 -0
- package/es/Onboarding/CarouselDots/CarouselDots.js +32 -29
- package/es/Onboarding/Onboarding.js +24 -23
- package/es/Onboarding/hooks/useOnboarding.js +5 -4
- package/es/Onboarding/hooks/useOnboardingSlider.js +6 -5
- package/es/deprecated/SelectDropdown/SelectDropdown.js +47 -43
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +225 -214
- package/es/errorstate/Inconvenience/Inconvenience.js +36 -32
- package/es/errorstate/NoRequestFound/NoRequestFound.js +36 -32
- package/es/errorstate/PermissionPlay/PermissionPlay.js +35 -31
- package/es/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +36 -32
- package/es/errorstate/UnableToProcess/UnableToProcess.js +36 -32
- package/es/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +36 -32
- package/es/errorstate/WillBack/WillBack.js +34 -30
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +85 -81
- package/es/list/status/StatusDropdown/StatusDropdown.js +113 -109
- package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +4 -3
- package/es/lookup/header/Search/Search.js +5 -4
- package/es/lookup/header/Search/__tests__/Search.spec.js +4 -3
- package/es/lookup/header/ViewDropDown/ViewDropDown.js +75 -67
- package/es/utils/General.js +7 -2
- package/es/utils/editorUtils.js +5 -1
- package/es/version2/lookup/AlertHeader/AlertHeader.js +3 -5
- package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +0 -24
- package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +0 -34
- package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +5 -4
- package/es/version2/lookup/AlertHeader/props/propTypes.js +1 -2
- package/es/version2/notification/DesktopNotification/DesktopNotification.js +63 -59
- package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +44 -40
- package/lib/AttachmentViewer/AttachmentImage.js +3 -1
- package/lib/AttachmentViewer/AttachmentViewer.js +164 -97
- package/lib/AttachmentViewer/AttachmentViewer.module.css +8 -15
- package/lib/AttachmentViewer/__tests__/AttachmentViewer.spec.js +100 -100
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +778 -1
- package/lib/AttachmentViewer/props/defaultProps.js +6 -2
- package/lib/AttachmentViewer/props/propTypes.js +9 -2
- package/lib/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +3 -9
- package/lib/Link/Link.js +4 -3
- package/lib/Link/props/propTypes.js +1 -0
- package/lib/version2/lookup/AlertHeader/AlertHeader.js +2 -5
- package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +0 -26
- package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +0 -34
- package/lib/version2/lookup/AlertHeader/props/propTypes.js +1 -2
- package/package.json +5 -5
|
@@ -15,7 +15,7 @@ var _propTypes = require("./props/propTypes");
|
|
|
15
15
|
|
|
16
16
|
var _Layout = require("@zohodesk/components/es/Layout");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _Icon = _interopRequireDefault(require("@zohodesk/icons/es/Icon"));
|
|
19
19
|
|
|
20
20
|
var _Avatar = _interopRequireDefault(require("@zohodesk/components/es/Avatar/Avatar"));
|
|
21
21
|
|
|
@@ -35,11 +35,13 @@ var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
|
|
|
35
35
|
|
|
36
36
|
var _FreezeLayer = _interopRequireDefault(require("../FreezeLayer/FreezeLayer"));
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _utils = require("@zohodesk/utils");
|
|
39
39
|
|
|
40
40
|
var _General = require("../utils/General");
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _Attachment = require("./Attachment");
|
|
43
|
+
|
|
44
|
+
var _utils2 = require("./utils");
|
|
43
45
|
|
|
44
46
|
var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
|
|
45
47
|
|
|
@@ -121,6 +123,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
121
123
|
_this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
|
|
122
124
|
_this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
|
|
123
125
|
_this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
|
|
126
|
+
_this.getRenderImageFrameCustomClass = _this.getRenderImageFrameCustomClass.bind(_assertThisInitialized(_this));
|
|
127
|
+
_this.renderImageFrame = _this.renderImageFrame.bind(_assertThisInitialized(_this));
|
|
124
128
|
return _this;
|
|
125
129
|
}
|
|
126
130
|
|
|
@@ -129,7 +133,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
129
133
|
value: function isImageFileType(fileName) {
|
|
130
134
|
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
131
135
|
if (!extension) return false;
|
|
132
|
-
return
|
|
136
|
+
return _utils2.FILE_EXTENSIONS.image.map(function (ext) {
|
|
133
137
|
return ext.toLowerCase();
|
|
134
138
|
}).includes(extension);
|
|
135
139
|
}
|
|
@@ -138,7 +142,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
138
142
|
value: function isVideoFileType(fileName) {
|
|
139
143
|
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
140
144
|
if (!extension) return false;
|
|
141
|
-
return
|
|
145
|
+
return _utils2.FILE_EXTENSIONS.video.map(function (ext) {
|
|
142
146
|
return ext.toLowerCase();
|
|
143
147
|
}).includes(extension);
|
|
144
148
|
}
|
|
@@ -147,7 +151,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
147
151
|
value: function isAudioFileType(fileName) {
|
|
148
152
|
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
149
153
|
if (!extension) return false;
|
|
150
|
-
return
|
|
154
|
+
return _utils2.FILE_EXTENSIONS.audio.map(function (ext) {
|
|
151
155
|
return ext.toLowerCase();
|
|
152
156
|
}).includes(extension);
|
|
153
157
|
}
|
|
@@ -159,13 +163,22 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
159
163
|
}, {
|
|
160
164
|
key: "componentDidUpdate",
|
|
161
165
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
162
|
-
var
|
|
163
|
-
|
|
166
|
+
var _this$props = this.props,
|
|
167
|
+
previewObj = _this$props.previewObj,
|
|
168
|
+
onSelectedAttachmentChange = _this$props.onSelectedAttachmentChange;
|
|
169
|
+
var _this$state = this.state,
|
|
170
|
+
selectedIndex = _this$state.selectedIndex,
|
|
171
|
+
data = _this$state.data;
|
|
164
172
|
var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
173
|
+
var attachmentPreviewUrlChanged = previewObj.previewData.some(function (value, index) {
|
|
174
|
+
var _prevState$data$index;
|
|
175
|
+
|
|
176
|
+
return (value === null || value === void 0 ? void 0 : value.viewUrl) !== ((_prevState$data$index = prevState.data[index]) === null || _prevState$data$index === void 0 ? void 0 : _prevState$data$index.viewUrl);
|
|
177
|
+
}); // Triggers an update if any previewed attachment is edited by the Attachment Annotator.
|
|
165
178
|
|
|
166
|
-
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
|
|
179
|
+
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
|
|
167
180
|
var objChanged = previewObj.previewData.some(function (value, index) {
|
|
168
|
-
return (0, _General.shallowDiff)(value, prevProps.previewObj[index]);
|
|
181
|
+
return (0, _General.shallowDiff)(value, prevProps.previewObj.previewData[index]);
|
|
169
182
|
});
|
|
170
183
|
|
|
171
184
|
if (objChanged || indexChanged) {
|
|
@@ -182,7 +195,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
182
195
|
}
|
|
183
196
|
}
|
|
184
197
|
|
|
185
|
-
if (prevState.selectedIndex != selectedIndex) {
|
|
198
|
+
if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
|
|
199
|
+
onSelectedAttachmentChange && onSelectedAttachmentChange({
|
|
200
|
+
data: data[selectedIndex] || _General.DUMMY_OBJECT,
|
|
201
|
+
selectedIndex: selectedIndex
|
|
202
|
+
});
|
|
186
203
|
this.handleMenuValidation();
|
|
187
204
|
}
|
|
188
205
|
}
|
|
@@ -191,16 +208,16 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
191
208
|
value: function handleMenuValidation() {
|
|
192
209
|
var _this2 = this;
|
|
193
210
|
|
|
194
|
-
var _this$
|
|
195
|
-
data = _this$
|
|
196
|
-
selectedIndex = _this$
|
|
211
|
+
var _this$state2 = this.state,
|
|
212
|
+
data = _this$state2.data,
|
|
213
|
+
selectedIndex = _this$state2.selectedIndex;
|
|
197
214
|
var allowedPreviewExtensionsData = this.props.allowedPreviewExtensionsData;
|
|
198
|
-
var selectedAttachment = data[selectedIndex] ||
|
|
215
|
+
var selectedAttachment = data[selectedIndex] || _General.DUMMY_OBJECT;
|
|
199
216
|
var selectedAttachmentViewUrl = selectedAttachment.viewUrl; // const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
200
217
|
|
|
201
218
|
var selectedAttachmentName = selectedAttachment.name;
|
|
202
219
|
var selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
203
|
-
(0,
|
|
220
|
+
(0, _utils2.checkFileSourcesValidation)({
|
|
204
221
|
fileName: selectedAttachmentName,
|
|
205
222
|
viewURL: selectedAttachmentViewUrl,
|
|
206
223
|
previewUrl: selectedAttachmentPreviewUrl,
|
|
@@ -322,9 +339,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
322
339
|
value: function changeSelectedIndex(index) {
|
|
323
340
|
var _this4 = this;
|
|
324
341
|
|
|
325
|
-
var _this$
|
|
326
|
-
data = _this$
|
|
327
|
-
selectedIndex = _this$
|
|
342
|
+
var _this$state3 = this.state,
|
|
343
|
+
data = _this$state3.data,
|
|
344
|
+
selectedIndex = _this$state3.selectedIndex;
|
|
328
345
|
var maintainZoom = this.props.maintainZoom;
|
|
329
346
|
maintainZoom ? this.zoomMaintain(index) : this.zoomOut(selectedIndex);
|
|
330
347
|
|
|
@@ -381,7 +398,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
381
398
|
} : fileUnknown;
|
|
382
399
|
var iconName = fileDetails.iconName,
|
|
383
400
|
iconSize = fileDetails.iconSize;
|
|
384
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
401
|
+
return /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
385
402
|
iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
|
|
386
403
|
name: iconName,
|
|
387
404
|
size: iconSize,
|
|
@@ -396,22 +413,86 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
396
413
|
className: _AttachmentViewerModule["default"].previewFrame
|
|
397
414
|
}, this.props.customProps.iframeProps));
|
|
398
415
|
}
|
|
416
|
+
}, {
|
|
417
|
+
key: "getRenderImageFrameCustomClass",
|
|
418
|
+
value: function getRenderImageFrameCustomClass() {
|
|
419
|
+
var _this$state4 = this.state,
|
|
420
|
+
selectedIndex = _this$state4.selectedIndex,
|
|
421
|
+
isZoomed = _this$state4.isZoomed,
|
|
422
|
+
canZoom = _this$state4.canZoom,
|
|
423
|
+
data = _this$state4.data;
|
|
424
|
+
var maintainZoom = this.props.maintainZoom;
|
|
425
|
+
var selectedData = data[selectedIndex] || _General.DUMMY_OBJECT;
|
|
426
|
+
var _selectedData$customC = selectedData.customClass,
|
|
427
|
+
customClass = _selectedData$customC === void 0 ? _General.DUMMY_OBJECT : _selectedData$customC;
|
|
428
|
+
var _customClass$customIm = customClass.customImageClass,
|
|
429
|
+
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
430
|
+
_customClass$customCh = customClass.customChildrenClass,
|
|
431
|
+
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
432
|
+
var retainZoom = canZoom && maintainZoom;
|
|
433
|
+
return {
|
|
434
|
+
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),
|
|
435
|
+
customChildrenClass: customChildrenClass
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
}, {
|
|
439
|
+
key: "renderImageFrame",
|
|
440
|
+
value: function renderImageFrame() {
|
|
441
|
+
var _this5 = this;
|
|
442
|
+
|
|
443
|
+
var _this$state5 = this.state,
|
|
444
|
+
selectedIndex = _this$state5.selectedIndex,
|
|
445
|
+
isZoomed = _this$state5.isZoomed,
|
|
446
|
+
isPreviewAttachmentValid = _this$state5.isPreviewAttachmentValid;
|
|
447
|
+
var renderCustomImagePreviewElement = this.props.renderCustomImagePreviewElement;
|
|
448
|
+
var data = this.state.data[selectedIndex] || _General.DUMMY_OBJECT;
|
|
449
|
+
var viewUrl = data.viewUrl,
|
|
450
|
+
name = data.name,
|
|
451
|
+
children = data.children,
|
|
452
|
+
_data$dataId = data.dataId,
|
|
453
|
+
dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
|
|
454
|
+
_data$customProps = data.customProps,
|
|
455
|
+
customProps = _data$customProps === void 0 ? _General.DUMMY_OBJECT : _data$customProps,
|
|
456
|
+
imageRef = data.imageRef;
|
|
457
|
+
var _customProps$imagePro = customProps.imageProps,
|
|
458
|
+
imageProps = _customProps$imagePro === void 0 ? _General.DUMMY_OBJECT : _customProps$imagePro;
|
|
459
|
+
var resolvedImageRef = imageRef;
|
|
460
|
+
var handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, selectedIndex) : undefined;
|
|
461
|
+
var handleZoomIn = isPreviewAttachmentValid && !isZoomed ? function (e) {
|
|
462
|
+
return _this5.zoomIn(e, selectedIndex, true);
|
|
463
|
+
} : undefined;
|
|
464
|
+
var handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
|
|
465
|
+
var imageFrameCustomClass = this.getRenderImageFrameCustomClass();
|
|
466
|
+
|
|
467
|
+
var img = /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
468
|
+
customClass: imageFrameCustomClass,
|
|
469
|
+
src: viewUrl,
|
|
470
|
+
onClick: handleImageClick,
|
|
471
|
+
alt: name,
|
|
472
|
+
dataId: dataId,
|
|
473
|
+
id: "img".concat(selectedIndex),
|
|
474
|
+
isCover: false,
|
|
475
|
+
imageRef: resolvedImageRef
|
|
476
|
+
}, imageProps), children);
|
|
477
|
+
|
|
478
|
+
return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
|
|
479
|
+
defaultView: img,
|
|
480
|
+
data: data,
|
|
481
|
+
index: selectedIndex
|
|
482
|
+
}) : img;
|
|
483
|
+
}
|
|
399
484
|
}, {
|
|
400
485
|
key: "imgPreviewView",
|
|
401
486
|
value: function imgPreviewView(downloadUrl) {
|
|
402
|
-
var
|
|
487
|
+
var _this6 = this;
|
|
403
488
|
|
|
404
|
-
var _this$
|
|
405
|
-
dataList = _this$
|
|
406
|
-
selectedIndex = _this$
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
maintainZoom = _this$props.maintainZoom,
|
|
412
|
-
dataId = _this$props.dataId,
|
|
413
|
-
i18nKeys = _this$props.i18nKeys,
|
|
414
|
-
renderUnSupportedElement = _this$props.renderUnSupportedElement;
|
|
489
|
+
var _this$state6 = this.state,
|
|
490
|
+
dataList = _this$state6.dataList,
|
|
491
|
+
selectedIndex = _this$state6.selectedIndex;
|
|
492
|
+
var _this$props2 = this.props,
|
|
493
|
+
dataId = _this$props2.dataId,
|
|
494
|
+
i18nKeys = _this$props2.i18nKeys,
|
|
495
|
+
renderUnSupportedElement = _this$props2.renderUnSupportedElement;
|
|
415
496
|
|
|
416
497
|
var getImgStyle = function getImgStyle(i) {
|
|
417
498
|
var position;
|
|
@@ -444,25 +525,16 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
444
525
|
var viewUrl = data.viewUrl,
|
|
445
526
|
name = data.name,
|
|
446
527
|
children = data.children,
|
|
447
|
-
_data$
|
|
448
|
-
dataId = _data$
|
|
449
|
-
_data$
|
|
450
|
-
|
|
451
|
-
_data$customProps = data.customProps,
|
|
452
|
-
customProps = _data$customProps === void 0 ? {} : _data$customProps,
|
|
528
|
+
_data$dataId2 = data.dataId,
|
|
529
|
+
dataId = _data$dataId2 === void 0 ? 'attachViewer' : _data$dataId2,
|
|
530
|
+
_data$customProps2 = data.customProps,
|
|
531
|
+
customProps = _data$customProps2 === void 0 ? {} : _data$customProps2,
|
|
453
532
|
previewurl = data.previewurl,
|
|
454
533
|
type = data.type;
|
|
455
534
|
var _customProps$audioPro = customProps.audioProps,
|
|
456
535
|
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
457
|
-
_customProps$imagePro = customProps.imageProps,
|
|
458
|
-
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
|
|
459
536
|
_customProps$videoPro = customProps.videoProps,
|
|
460
537
|
videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
|
|
461
|
-
var _customClass$customIm = customClass.customImageClass,
|
|
462
|
-
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
463
|
-
_customClass$customCh = customClass.customChildrenClass,
|
|
464
|
-
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
465
|
-
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
466
538
|
var extension = (0, _Attachment.getExtensionFromFileName)(name);
|
|
467
539
|
var _i18nKeys$previewUnsu = i18nKeys.previewUnsupportedText,
|
|
468
540
|
previewUnsupportedText = _i18nKeys$previewUnsu === void 0 ? "Preview not available for the selected file type." : _i18nKeys$previewUnsu,
|
|
@@ -478,7 +550,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
478
550
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
479
551
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
480
552
|
id: "imgPreviewRef".concat(i)
|
|
481
|
-
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null,
|
|
553
|
+
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this6.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
|
|
482
554
|
controls: true,
|
|
483
555
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
484
556
|
"data-id": "".concat(dataId, "_audioPreview"),
|
|
@@ -486,7 +558,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
486
558
|
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
487
559
|
src: previewurl || viewUrl,
|
|
488
560
|
type: "audio/".concat(extension)
|
|
489
|
-
})) :
|
|
561
|
+
})) : _this6.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
490
562
|
controls: true,
|
|
491
563
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
492
564
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
@@ -494,31 +566,19 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
494
566
|
}, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
495
567
|
src: viewUrl,
|
|
496
568
|
type: "video/".concat(extension)
|
|
497
|
-
})) :
|
|
498
|
-
customClass: {
|
|
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),
|
|
500
|
-
customChildrenClass: customChildrenClass
|
|
501
|
-
},
|
|
502
|
-
src: viewUrl,
|
|
503
|
-
onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
|
|
504
|
-
return _this5.zoomIn(e, i, true);
|
|
505
|
-
} : undefined,
|
|
506
|
-
alt: name,
|
|
507
|
-
dataId: dataId,
|
|
508
|
-
id: "img".concat(i),
|
|
509
|
-
isCover: false
|
|
510
|
-
}, imageProps), children) : type === "document" && previewurl != null ? _this5.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
569
|
+
})) : _this6.isImageFileType(name) || children ? _this6.renderImageFrame() : type === "document" && previewurl != null ? _this6.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
511
570
|
className: _AttachmentViewerModule["default"].previewNone
|
|
512
571
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
513
572
|
className: _AttachmentViewerModule["default"].fileTypeImg
|
|
514
|
-
},
|
|
573
|
+
}, _this6.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
515
574
|
$ui_size: "20",
|
|
516
575
|
$ui_weight: "semibold"
|
|
517
576
|
}, previewUnsupportedText), downloadUrl ? /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
518
577
|
href: downloadUrl,
|
|
578
|
+
download: true,
|
|
579
|
+
downloadName: name,
|
|
519
580
|
className: _AttachmentViewerModule["default"].downloadLink,
|
|
520
|
-
hasReload: true
|
|
521
|
-
download: true
|
|
581
|
+
hasReload: true
|
|
522
582
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
523
583
|
palette: "primaryFilled",
|
|
524
584
|
text: downloadText
|
|
@@ -528,22 +588,24 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
528
588
|
}, {
|
|
529
589
|
key: "render",
|
|
530
590
|
value: function render() {
|
|
531
|
-
var
|
|
532
|
-
|
|
533
|
-
var _this$
|
|
534
|
-
isPViewListOpen = _this$
|
|
535
|
-
selectedIndex = _this$
|
|
536
|
-
data = _this$
|
|
537
|
-
isZoomed = _this$
|
|
538
|
-
canZoom = _this$
|
|
539
|
-
canOpenInNewTab = _this$
|
|
540
|
-
var _this$
|
|
541
|
-
responsiveId = _this$
|
|
542
|
-
needDownload = _this$
|
|
543
|
-
i18nKeys = _this$
|
|
544
|
-
isActive = _this$
|
|
545
|
-
dataId = _this$
|
|
546
|
-
customProps = _this$
|
|
591
|
+
var _this7 = this;
|
|
592
|
+
|
|
593
|
+
var _this$state7 = this.state,
|
|
594
|
+
isPViewListOpen = _this$state7.isPViewListOpen,
|
|
595
|
+
selectedIndex = _this$state7.selectedIndex,
|
|
596
|
+
data = _this$state7.data,
|
|
597
|
+
isZoomed = _this$state7.isZoomed,
|
|
598
|
+
canZoom = _this$state7.canZoom,
|
|
599
|
+
canOpenInNewTab = _this$state7.canOpenInNewTab;
|
|
600
|
+
var _this$props3 = this.props,
|
|
601
|
+
responsiveId = _this$props3.responsiveId,
|
|
602
|
+
needDownload = _this$props3.needDownload,
|
|
603
|
+
i18nKeys = _this$props3.i18nKeys,
|
|
604
|
+
isActive = _this$props3.isActive,
|
|
605
|
+
dataId = _this$props3.dataId,
|
|
606
|
+
customProps = _this$props3.customProps,
|
|
607
|
+
hasCount = _this$props3.hasCount,
|
|
608
|
+
renderCustomIcons = _this$props3.renderCustomIcons;
|
|
547
609
|
var _customProps$avatarPr = customProps.avatarProps,
|
|
548
610
|
avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
|
|
549
611
|
var totalLen = data.length;
|
|
@@ -585,7 +647,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
585
647
|
"data-title": selectedAttachment.name,
|
|
586
648
|
dataId: "attachName",
|
|
587
649
|
id: ariaId
|
|
588
|
-
}, selectedAttachment.name), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
650
|
+
}, selectedAttachment.name), hasCount && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
589
651
|
flexible: true,
|
|
590
652
|
className: _AttachmentViewerModule["default"].count,
|
|
591
653
|
dataId: "attachCountContainer"
|
|
@@ -597,9 +659,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
597
659
|
align: uptoTablet ? 'bottom' : 'center',
|
|
598
660
|
wrap: "wrap",
|
|
599
661
|
isCover: false
|
|
600
|
-
},
|
|
662
|
+
}, (0, _utils.renderNode)(renderCustomIcons, {
|
|
663
|
+
selectedAttachment: selectedAttachment,
|
|
664
|
+
selectedIndex: selectedIndex,
|
|
665
|
+
totalLen: totalLen
|
|
666
|
+
}), canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
601
667
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
602
|
-
onClick:
|
|
668
|
+
onClick: _this7.zoomOut.bind(_this7, selectedIndex),
|
|
603
669
|
"data-id": "zoomOut",
|
|
604
670
|
"data-test-id": "zoomOut",
|
|
605
671
|
"data-title": i18nKeys.zoomOutText
|
|
@@ -614,7 +680,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
614
680
|
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
615
681
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
616
682
|
onClick: function onClick(e) {
|
|
617
|
-
return
|
|
683
|
+
return _this7.zoomIn(e, selectedIndex);
|
|
618
684
|
},
|
|
619
685
|
"data-id": "zoomIn",
|
|
620
686
|
"data-test-id": "zoomIn",
|
|
@@ -647,6 +713,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
647
713
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
|
|
648
714
|
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
649
715
|
href: downloadUrl,
|
|
716
|
+
downloadName: selectedAttachment.name,
|
|
650
717
|
target: "_parent",
|
|
651
718
|
hasReload: true,
|
|
652
719
|
download: true,
|
|
@@ -663,7 +730,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
663
730
|
}
|
|
664
731
|
}))) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
665
732
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
666
|
-
onClick:
|
|
733
|
+
onClick: _this7.closeAttachmentViewer,
|
|
667
734
|
"data-id": "closeAttach",
|
|
668
735
|
"data-test-id": "closeAttach",
|
|
669
736
|
"data-title": i18nKeys.closeText
|
|
@@ -684,13 +751,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
684
751
|
alignBox: "row"
|
|
685
752
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
686
753
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
687
|
-
onClick:
|
|
754
|
+
onClick: _this7.changeSelectedIndex.bind(_this7, selectedIndex - 1),
|
|
688
755
|
"data-title": i18nKeys.previousText,
|
|
689
756
|
"data-title-position": "left"
|
|
690
757
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
691
758
|
className: _AttachmentViewerModule["default"].btn,
|
|
692
759
|
"aria-label": i18nKeys.previousText
|
|
693
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
760
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
694
761
|
name: "ZD-arrowLeft3",
|
|
695
762
|
iconClass: _AttachmentViewerModule["default"].arrow,
|
|
696
763
|
dataId: "leftAttachNav",
|
|
@@ -700,18 +767,18 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
700
767
|
tabindex: "0",
|
|
701
768
|
"aria-describedby": ariaId,
|
|
702
769
|
isShrink: false,
|
|
703
|
-
eleRef:
|
|
770
|
+
eleRef: _this7.setImgBoxRef,
|
|
704
771
|
scroll: "both",
|
|
705
772
|
flexible: true
|
|
706
|
-
},
|
|
773
|
+
}, _this7.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
707
774
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
708
|
-
onClick:
|
|
775
|
+
onClick: _this7.changeSelectedIndex.bind(_this7, selectedIndex + 1),
|
|
709
776
|
"data-title": i18nKeys.nextText,
|
|
710
777
|
"data-title-position": "right"
|
|
711
778
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
712
779
|
className: _AttachmentViewerModule["default"].btn,
|
|
713
780
|
"aria-label": i18nKeys.nextText
|
|
714
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
781
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
715
782
|
name: "ZD-arrowRight3",
|
|
716
783
|
iconClass: _AttachmentViewerModule["default"].arrow,
|
|
717
784
|
dataId: "rightAttachNav",
|
|
@@ -745,7 +812,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
745
812
|
alignBox: "row",
|
|
746
813
|
scroll: "horizontal",
|
|
747
814
|
eleRef: function eleRef(el) {
|
|
748
|
-
return
|
|
815
|
+
return _this7.imgListCont = el;
|
|
749
816
|
},
|
|
750
817
|
className: _AttachmentViewerModule["default"].listContainer
|
|
751
818
|
}, data.map(function (item, index) {
|
|
@@ -759,7 +826,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
759
826
|
_item$customProps = item.customProps,
|
|
760
827
|
customProps = _item$customProps === void 0 ? {} : _item$customProps;
|
|
761
828
|
var thumbnail = item.thumbnail;
|
|
762
|
-
var isImageFileType =
|
|
829
|
+
var isImageFileType = _this7.isImageFileType(name) || thumbnail;
|
|
763
830
|
var _customClass$customIm2 = customClass.customImageClass,
|
|
764
831
|
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
765
832
|
_customClass$customCh2 = customClass.customChildrenClass,
|
|
@@ -767,9 +834,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
767
834
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
768
835
|
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
|
|
769
836
|
key: index,
|
|
770
|
-
onClick:
|
|
837
|
+
onClick: _this7.changeSelectedIndex.bind(_this7, index),
|
|
771
838
|
eleRef: function eleRef(el) {
|
|
772
|
-
return
|
|
839
|
+
return _this7["img_".concat(index)] = el;
|
|
773
840
|
},
|
|
774
841
|
dataId: "attachPreviewList",
|
|
775
842
|
"data-title": name
|
|
@@ -782,10 +849,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
782
849
|
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
783
850
|
},
|
|
784
851
|
dataId: dataId
|
|
785
|
-
}, customProps), children) :
|
|
852
|
+
}, customProps), children) : _this7.getPreviewIconData(name, '40'));
|
|
786
853
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
787
854
|
dataId: "attachToggle",
|
|
788
|
-
onClick:
|
|
855
|
+
onClick: _this7.togglePViewList,
|
|
789
856
|
iconName: "ZD-GN-hideTab",
|
|
790
857
|
iconSize: "14",
|
|
791
858
|
hoverType: "border",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.header {
|
|
2
|
-
height: var(--
|
|
2
|
+
height: var(--zd_size48) ;
|
|
3
3
|
position: relative;
|
|
4
4
|
z-index: 1;
|
|
5
|
-
padding-block:0 ;
|
|
5
|
+
padding-block: 0 ;
|
|
6
6
|
padding-inline: var(--zd_size15) ;
|
|
7
7
|
composes: alignVertical from '~@zohodesk/components/es/common/common.module.css';
|
|
8
8
|
background-color: var(--zdt_attachmentviewer_header_bg);
|
|
@@ -10,20 +10,13 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.title {
|
|
13
|
+
padding-inline-end: var(--zd_size15) ;
|
|
13
14
|
max-width: 50% ;
|
|
14
15
|
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
[dir=ltr] .title {
|
|
18
|
-
padding-right: var(--zd_size15) ;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
[dir=rtl] .title {
|
|
22
|
-
padding-left: var(--zd_size15) ;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
18
|
.count {
|
|
26
|
-
padding-block:0 ;
|
|
19
|
+
padding-block: 0 ;
|
|
27
20
|
padding-inline: var(--zd_size10) ;
|
|
28
21
|
position: absolute;
|
|
29
22
|
composes: xMiddle from '~@zohodesk/components/es/common/common.module.css';
|
|
@@ -80,7 +73,7 @@
|
|
|
80
73
|
|
|
81
74
|
.preview {
|
|
82
75
|
margin-block: var(--zd_size20) ;
|
|
83
|
-
margin-inline:0 ;
|
|
76
|
+
margin-inline: 0 ;
|
|
84
77
|
composes: posrel from '~@zohodesk/components/es/common/common.module.css';
|
|
85
78
|
text-align: center;
|
|
86
79
|
}
|
|
@@ -136,7 +129,7 @@
|
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
.listContainer {
|
|
139
|
-
padding-block:0 ;
|
|
132
|
+
padding-block: 0 ;
|
|
140
133
|
padding-inline: var(--zd_size18) ;
|
|
141
134
|
}
|
|
142
135
|
|
|
@@ -324,7 +317,7 @@
|
|
|
324
317
|
}
|
|
325
318
|
|
|
326
319
|
.authorName {
|
|
327
|
-
margin-block:0 ;
|
|
320
|
+
margin-block: 0 ;
|
|
328
321
|
margin-inline: var(--zd_size10) ;
|
|
329
322
|
font-size: var(--zd_font_size15) ;
|
|
330
323
|
color: var(--zdt_attachmentviewer_title_text);
|
|
@@ -364,4 +357,4 @@
|
|
|
364
357
|
color: var(--zdt_attachmentviewer_title_text);
|
|
365
358
|
padding: var(--zd_size2) ;
|
|
366
359
|
margin: auto ;
|
|
367
|
-
}
|
|
360
|
+
}
|