@zohodesk/dot 1.0.0-temp-230.3 → 1.0.0-temp-232
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 +2 -11
- package/es/ActionButton/__tests__/ActionButton.spec.js +4 -5
- package/es/AttachmentViewer/AttachmentImage.js +1 -3
- package/es/AttachmentViewer/AttachmentViewer.js +254 -359
- package/es/AttachmentViewer/AttachmentViewer.module.css +15 -8
- package/es/AttachmentViewer/props/defaultProps.js +2 -4
- package/es/AttachmentViewer/props/propTypes.js +2 -8
- package/es/AttachmentViewer/utils.js +6 -7
- package/es/AudioPlayer/utils/utils.js +2 -5
- package/es/DotProvider/hooks/useDotProvider.js +14 -15
- package/es/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +21 -16
- package/es/DotProvider/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +3 -4
- package/es/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +4 -5
- package/es/DotProvider/utils/errorValidation.js +5 -6
- package/es/DotProvider/utils/getAssetsImportPromises.js +4 -5
- package/es/Drawer/Drawer.js +6 -8
- package/es/FreezeLayer/css/cssJSLogic.js +4 -5
- package/es/Hooks/Dragger/useDragger.js +5 -6
- package/es/Hooks/Dragger/utils/DraggerUtil.js +7 -8
- package/es/Hooks/useFreezeLayer.js +4 -5
- package/es/Link/Link.js +3 -4
- package/es/Link/props/propTypes.js +0 -1
- package/es/Onboarding/CarouselDots/CarouselDots.js +29 -32
- package/es/Onboarding/Onboarding.js +23 -24
- package/es/Onboarding/hooks/useOnboarding.js +4 -5
- package/es/Onboarding/hooks/useOnboardingSlider.js +5 -6
- package/es/deprecated/SelectDropdown/SelectDropdown.js +43 -47
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +214 -225
- package/es/errorstate/Inconvenience/Inconvenience.js +32 -36
- package/es/errorstate/NoRequestFound/NoRequestFound.js +32 -36
- package/es/errorstate/PermissionPlay/PermissionPlay.js +31 -35
- package/es/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +32 -36
- package/es/errorstate/UnableToProcess/UnableToProcess.js +32 -36
- package/es/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +32 -36
- package/es/errorstate/WillBack/WillBack.js +30 -34
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +81 -85
- package/es/list/status/StatusDropdown/StatusDropdown.js +109 -113
- package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +3 -4
- package/es/lookup/header/Search/Search.js +4 -5
- package/es/lookup/header/Search/__tests__/Search.spec.js +3 -4
- package/es/lookup/header/ViewDropDown/ViewDropDown.js +67 -75
- package/es/utils/General.js +2 -7
- package/es/utils/editorUtils.js +1 -5
- package/es/version2/lookup/AlertHeader/AlertHeader.js +5 -3
- package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +24 -0
- package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +34 -0
- package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +4 -5
- package/es/version2/lookup/AlertHeader/props/propTypes.js +2 -1
- package/es/version2/notification/DesktopNotification/DesktopNotification.js +59 -63
- package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +40 -44
- package/lib/AttachmentViewer/AttachmentImage.js +1 -3
- package/lib/AttachmentViewer/AttachmentViewer.js +85 -187
- package/lib/AttachmentViewer/AttachmentViewer.module.css +15 -8
- package/lib/AttachmentViewer/props/defaultProps.js +2 -6
- package/lib/AttachmentViewer/props/propTypes.js +2 -8
- package/lib/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +9 -3
- package/lib/Link/Link.js +3 -4
- package/lib/Link/props/propTypes.js +0 -1
- package/lib/version2/lookup/AlertHeader/AlertHeader.js +5 -2
- package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +26 -0
- package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +34 -0
- package/lib/version2/lookup/AlertHeader/props/propTypes.js +2 -1
- package/package.json +7 -7
|
@@ -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 _icons = require("@zohodesk/icons");
|
|
19
19
|
|
|
20
20
|
var _Avatar = _interopRequireDefault(require("@zohodesk/components/es/Avatar/Avatar"));
|
|
21
21
|
|
|
@@ -120,37 +120,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
120
120
|
_this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
|
|
121
121
|
_this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
|
|
122
122
|
_this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
|
|
123
|
-
_this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
|
|
124
|
-
|
|
123
|
+
_this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
|
|
125
124
|
return _this;
|
|
126
|
-
}
|
|
127
|
-
// if (!changes || typeof changes !== 'object') {
|
|
128
|
-
// return false;
|
|
129
|
-
// }
|
|
130
|
-
// const { data } = this.state;
|
|
131
|
-
// const targetIdx = typeof idOrIndex === 'number'
|
|
132
|
-
// ? idOrIndex
|
|
133
|
-
// : data.findIndex((item) => item && item.id === idOrIndex);
|
|
134
|
-
// if (targetIdx < 0 || targetIdx >= data.length) {
|
|
135
|
-
// return false;
|
|
136
|
-
// }
|
|
137
|
-
// this.setState((prevState) => {
|
|
138
|
-
// const nextData = prevState.data.slice();
|
|
139
|
-
// nextData[targetIdx] = { ...nextData[targetIdx], ...changes };
|
|
140
|
-
// let nextDataList = prevState.dataList;
|
|
141
|
-
// if (targetIdx < prevState.dataList.length) {
|
|
142
|
-
// nextDataList = prevState.dataList.slice();
|
|
143
|
-
// nextDataList[targetIdx] = { ...nextDataList[targetIdx], ...changes };
|
|
144
|
-
// }
|
|
145
|
-
// return { data: nextData, dataList: nextDataList };
|
|
146
|
-
// }, () => {
|
|
147
|
-
// if (this.state.selectedIndex === targetIdx) {
|
|
148
|
-
// this.handleMenuValidation();
|
|
149
|
-
// }
|
|
150
|
-
// });
|
|
151
|
-
// return true;
|
|
152
|
-
// }
|
|
153
|
-
|
|
125
|
+
}
|
|
154
126
|
|
|
155
127
|
_createClass(AttachmentViewer, [{
|
|
156
128
|
key: "isImageFileType",
|
|
@@ -190,15 +162,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
190
162
|
var previewObj = this.props.previewObj;
|
|
191
163
|
var selectedIndex = this.state.selectedIndex;
|
|
192
164
|
var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
193
|
-
var attachmentPreviewUrlChanged = previewObj.previewData.some(function (value, index) {
|
|
194
|
-
var _prevState$data$index;
|
|
195
|
-
|
|
196
|
-
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);
|
|
197
|
-
}); // Triggers an update if any previewed attachment is edited by the Attachment Annotator.
|
|
198
165
|
|
|
199
|
-
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged
|
|
166
|
+
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
|
|
200
167
|
var objChanged = previewObj.previewData.some(function (value, index) {
|
|
201
|
-
return (0, _General.shallowDiff)(value, prevProps.previewObj
|
|
168
|
+
return (0, _General.shallowDiff)(value, prevProps.previewObj[index]);
|
|
202
169
|
});
|
|
203
170
|
|
|
204
171
|
if (objChanged || indexChanged) {
|
|
@@ -215,7 +182,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
215
182
|
}
|
|
216
183
|
}
|
|
217
184
|
|
|
218
|
-
if (prevState.selectedIndex != selectedIndex
|
|
185
|
+
if (prevState.selectedIndex != selectedIndex) {
|
|
219
186
|
this.handleMenuValidation();
|
|
220
187
|
}
|
|
221
188
|
}
|
|
@@ -414,7 +381,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
414
381
|
} : fileUnknown;
|
|
415
382
|
var iconName = fileDetails.iconName,
|
|
416
383
|
iconSize = fileDetails.iconSize;
|
|
417
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
384
|
+
return /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
418
385
|
iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
|
|
419
386
|
name: iconName,
|
|
420
387
|
size: iconSize,
|
|
@@ -430,95 +397,21 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
430
397
|
}, this.props.customProps.iframeProps));
|
|
431
398
|
}
|
|
432
399
|
}, {
|
|
433
|
-
key: "
|
|
434
|
-
value: function
|
|
435
|
-
var canZoom = _ref3.canZoom,
|
|
436
|
-
retainZoom = _ref3.retainZoom,
|
|
437
|
-
isZoomed = _ref3.isZoomed,
|
|
438
|
-
customImageClass = _ref3.customImageClass,
|
|
439
|
-
customChildrenClass = _ref3.customChildrenClass;
|
|
440
|
-
return {
|
|
441
|
-
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),
|
|
442
|
-
customChildrenClass: customChildrenClass
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
}, {
|
|
446
|
-
key: "renderImageFrame",
|
|
447
|
-
value: function renderImageFrame(data, i) {
|
|
400
|
+
key: "imgPreviewView",
|
|
401
|
+
value: function imgPreviewView(downloadUrl) {
|
|
448
402
|
var _this5 = this;
|
|
449
403
|
|
|
450
404
|
var _this$state3 = this.state,
|
|
405
|
+
dataList = _this$state3.dataList,
|
|
451
406
|
selectedIndex = _this$state3.selectedIndex,
|
|
452
407
|
isZoomed = _this$state3.isZoomed,
|
|
453
408
|
canZoom = _this$state3.canZoom,
|
|
454
409
|
isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
|
|
455
410
|
var _this$props = this.props,
|
|
456
411
|
maintainZoom = _this$props.maintainZoom,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
children = data.children,
|
|
461
|
-
_data$dataId = data.dataId,
|
|
462
|
-
dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
|
|
463
|
-
_data$customClass = data.customClass,
|
|
464
|
-
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
465
|
-
_data$customProps = data.customProps,
|
|
466
|
-
customProps = _data$customProps === void 0 ? {} : _data$customProps,
|
|
467
|
-
imageRef = data.imageRef;
|
|
468
|
-
var _customProps$imagePro = customProps.imageProps,
|
|
469
|
-
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
|
|
470
|
-
var _customClass$customIm = customClass.customImageClass,
|
|
471
|
-
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
472
|
-
_customClass$customCh = customClass.customChildrenClass,
|
|
473
|
-
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
474
|
-
var resolvedImageRef = imageRef;
|
|
475
|
-
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
476
|
-
var handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, i) : undefined;
|
|
477
|
-
var handleZoomIn = isPreviewAttachmentValid && !isZoomed ? function (e) {
|
|
478
|
-
return _this5.zoomIn(e, i, true);
|
|
479
|
-
} : undefined;
|
|
480
|
-
var handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
|
|
481
|
-
var imageFrameCustomClass = this.getRenderImageFrameCustomClass({
|
|
482
|
-
canZoom: canZoom,
|
|
483
|
-
retainZoom: retainZoom,
|
|
484
|
-
isZoomed: isZoomed,
|
|
485
|
-
customImageClass: customImageClass,
|
|
486
|
-
customChildrenClass: customChildrenClass
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
var img = /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({}, imageProps, {
|
|
490
|
-
customClass: imageFrameCustomClass,
|
|
491
|
-
src: viewUrl,
|
|
492
|
-
onClick: handleImageClick,
|
|
493
|
-
alt: name,
|
|
494
|
-
dataId: dataId,
|
|
495
|
-
id: "img".concat(i),
|
|
496
|
-
isCover: false,
|
|
497
|
-
imageRef: resolvedImageRef
|
|
498
|
-
}), children);
|
|
499
|
-
|
|
500
|
-
return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
|
|
501
|
-
defaultView: img,
|
|
502
|
-
data: data,
|
|
503
|
-
index: i
|
|
504
|
-
}) : img;
|
|
505
|
-
}
|
|
506
|
-
}, {
|
|
507
|
-
key: "imgPreviewView",
|
|
508
|
-
value: function imgPreviewView(downloadUrl) {
|
|
509
|
-
var _this6 = this;
|
|
510
|
-
|
|
511
|
-
var _this$state4 = this.state,
|
|
512
|
-
dataList = _this$state4.dataList,
|
|
513
|
-
selectedIndex = _this$state4.selectedIndex,
|
|
514
|
-
isZoomed = _this$state4.isZoomed,
|
|
515
|
-
canZoom = _this$state4.canZoom,
|
|
516
|
-
isPreviewAttachmentValid = _this$state4.isPreviewAttachmentValid;
|
|
517
|
-
var _this$props2 = this.props,
|
|
518
|
-
maintainZoom = _this$props2.maintainZoom,
|
|
519
|
-
dataId = _this$props2.dataId,
|
|
520
|
-
i18nKeys = _this$props2.i18nKeys,
|
|
521
|
-
renderUnSupportedElement = _this$props2.renderUnSupportedElement;
|
|
412
|
+
dataId = _this$props.dataId,
|
|
413
|
+
i18nKeys = _this$props.i18nKeys,
|
|
414
|
+
renderUnSupportedElement = _this$props.renderUnSupportedElement;
|
|
522
415
|
|
|
523
416
|
var getImgStyle = function getImgStyle(i) {
|
|
524
417
|
var position;
|
|
@@ -551,24 +444,24 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
551
444
|
var viewUrl = data.viewUrl,
|
|
552
445
|
name = data.name,
|
|
553
446
|
children = data.children,
|
|
554
|
-
_data$
|
|
555
|
-
dataId = _data$
|
|
556
|
-
_data$
|
|
557
|
-
customClass = _data$
|
|
558
|
-
_data$
|
|
559
|
-
customProps = _data$
|
|
447
|
+
_data$dataId = data.dataId,
|
|
448
|
+
dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
|
|
449
|
+
_data$customClass = data.customClass,
|
|
450
|
+
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
451
|
+
_data$customProps = data.customProps,
|
|
452
|
+
customProps = _data$customProps === void 0 ? {} : _data$customProps,
|
|
560
453
|
previewurl = data.previewurl,
|
|
561
454
|
type = data.type;
|
|
562
455
|
var _customProps$audioPro = customProps.audioProps,
|
|
563
456
|
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
564
|
-
_customProps$
|
|
565
|
-
imageProps = _customProps$
|
|
457
|
+
_customProps$imagePro = customProps.imageProps,
|
|
458
|
+
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
|
|
566
459
|
_customProps$videoPro = customProps.videoProps,
|
|
567
460
|
videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
|
|
568
|
-
var _customClass$
|
|
569
|
-
customImageClass = _customClass$
|
|
570
|
-
_customClass$
|
|
571
|
-
customChildrenClass = _customClass$
|
|
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;
|
|
572
465
|
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
573
466
|
var extension = (0, _Attachment.getExtensionFromFileName)(name);
|
|
574
467
|
var _i18nKeys$previewUnsu = i18nKeys.previewUnsupportedText,
|
|
@@ -585,7 +478,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
585
478
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
586
479
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
587
480
|
id: "imgPreviewRef".concat(i)
|
|
588
|
-
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null,
|
|
481
|
+
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this5.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
|
|
589
482
|
controls: true,
|
|
590
483
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
591
484
|
"data-id": "".concat(dataId, "_audioPreview"),
|
|
@@ -593,7 +486,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
593
486
|
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
594
487
|
src: previewurl || viewUrl,
|
|
595
488
|
type: "audio/".concat(extension)
|
|
596
|
-
})) :
|
|
489
|
+
})) : _this5.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
597
490
|
controls: true,
|
|
598
491
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
599
492
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
@@ -601,19 +494,31 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
601
494
|
}, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
602
495
|
src: viewUrl,
|
|
603
496
|
type: "video/".concat(extension)
|
|
604
|
-
})) :
|
|
497
|
+
})) : _this5.isImageFileType(name) || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
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", {
|
|
605
511
|
className: _AttachmentViewerModule["default"].previewNone
|
|
606
512
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
607
513
|
className: _AttachmentViewerModule["default"].fileTypeImg
|
|
608
|
-
},
|
|
514
|
+
}, _this5.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
609
515
|
$ui_size: "20",
|
|
610
516
|
$ui_weight: "semibold"
|
|
611
517
|
}, previewUnsupportedText), downloadUrl ? /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
612
518
|
href: downloadUrl,
|
|
613
|
-
download: true,
|
|
614
|
-
downloadName: name,
|
|
615
519
|
className: _AttachmentViewerModule["default"].downloadLink,
|
|
616
|
-
hasReload: true
|
|
520
|
+
hasReload: true,
|
|
521
|
+
download: true
|
|
617
522
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
618
523
|
palette: "primaryFilled",
|
|
619
524
|
text: downloadText
|
|
@@ -623,24 +528,22 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
623
528
|
}, {
|
|
624
529
|
key: "render",
|
|
625
530
|
value: function render() {
|
|
626
|
-
var
|
|
627
|
-
|
|
628
|
-
var _this$
|
|
629
|
-
isPViewListOpen = _this$
|
|
630
|
-
selectedIndex = _this$
|
|
631
|
-
data = _this$
|
|
632
|
-
isZoomed = _this$
|
|
633
|
-
canZoom = _this$
|
|
634
|
-
canOpenInNewTab = _this$
|
|
635
|
-
var _this$
|
|
636
|
-
responsiveId = _this$
|
|
637
|
-
needDownload = _this$
|
|
638
|
-
i18nKeys = _this$
|
|
639
|
-
isActive = _this$
|
|
640
|
-
dataId = _this$
|
|
641
|
-
customProps = _this$
|
|
642
|
-
showCount = _this$props3.showCount,
|
|
643
|
-
renderCustomIcons = _this$props3.renderCustomIcons;
|
|
531
|
+
var _this6 = this;
|
|
532
|
+
|
|
533
|
+
var _this$state4 = this.state,
|
|
534
|
+
isPViewListOpen = _this$state4.isPViewListOpen,
|
|
535
|
+
selectedIndex = _this$state4.selectedIndex,
|
|
536
|
+
data = _this$state4.data,
|
|
537
|
+
isZoomed = _this$state4.isZoomed,
|
|
538
|
+
canZoom = _this$state4.canZoom,
|
|
539
|
+
canOpenInNewTab = _this$state4.canOpenInNewTab;
|
|
540
|
+
var _this$props2 = this.props,
|
|
541
|
+
responsiveId = _this$props2.responsiveId,
|
|
542
|
+
needDownload = _this$props2.needDownload,
|
|
543
|
+
i18nKeys = _this$props2.i18nKeys,
|
|
544
|
+
isActive = _this$props2.isActive,
|
|
545
|
+
dataId = _this$props2.dataId,
|
|
546
|
+
customProps = _this$props2.customProps;
|
|
644
547
|
var _customProps$avatarPr = customProps.avatarProps,
|
|
645
548
|
avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
|
|
646
549
|
var totalLen = data.length;
|
|
@@ -650,8 +553,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
650
553
|
var authorHref;
|
|
651
554
|
var authorName;
|
|
652
555
|
|
|
653
|
-
var
|
|
654
|
-
author =
|
|
556
|
+
var _ref3 = data[selectedIndex] ? data[selectedIndex] : {},
|
|
557
|
+
author = _ref3.author;
|
|
655
558
|
|
|
656
559
|
if (author) {
|
|
657
560
|
authorHref = author.href;
|
|
@@ -666,8 +569,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
666
569
|
}, /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
667
570
|
responsiveId: responsiveId,
|
|
668
571
|
query: this.responsiveFunc
|
|
669
|
-
}, function (
|
|
670
|
-
var uptoTablet =
|
|
572
|
+
}, function (_ref4) {
|
|
573
|
+
var uptoTablet = _ref4.uptoTablet;
|
|
671
574
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
672
575
|
scroll: "none",
|
|
673
576
|
"data-scroll-palette": "dark"
|
|
@@ -682,7 +585,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
682
585
|
"data-title": selectedAttachment.name,
|
|
683
586
|
dataId: "attachName",
|
|
684
587
|
id: ariaId
|
|
685
|
-
}, selectedAttachment.name),
|
|
588
|
+
}, selectedAttachment.name), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
686
589
|
flexible: true,
|
|
687
590
|
className: _AttachmentViewerModule["default"].count,
|
|
688
591
|
dataId: "attachCountContainer"
|
|
@@ -694,13 +597,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
694
597
|
align: uptoTablet ? 'bottom' : 'center',
|
|
695
598
|
wrap: "wrap",
|
|
696
599
|
isCover: false
|
|
697
|
-
},
|
|
698
|
-
selectedAttachment: selectedAttachment,
|
|
699
|
-
selectedIndex: selectedIndex,
|
|
700
|
-
totalLen: totalLen
|
|
701
|
-
}), canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
600
|
+
}, canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
702
601
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
703
|
-
onClick:
|
|
602
|
+
onClick: _this6.zoomOut.bind(_this6, selectedIndex),
|
|
704
603
|
"data-id": "zoomOut",
|
|
705
604
|
"data-test-id": "zoomOut",
|
|
706
605
|
"data-title": i18nKeys.zoomOutText
|
|
@@ -715,7 +614,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
715
614
|
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
716
615
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
717
616
|
onClick: function onClick(e) {
|
|
718
|
-
return
|
|
617
|
+
return _this6.zoomIn(e, selectedIndex);
|
|
719
618
|
},
|
|
720
619
|
"data-id": "zoomIn",
|
|
721
620
|
"data-test-id": "zoomIn",
|
|
@@ -748,7 +647,6 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
748
647
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
|
|
749
648
|
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
750
649
|
href: downloadUrl,
|
|
751
|
-
downloadName: selectedAttachment.name,
|
|
752
650
|
target: "_parent",
|
|
753
651
|
hasReload: true,
|
|
754
652
|
download: true,
|
|
@@ -765,7 +663,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
765
663
|
}
|
|
766
664
|
}))) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
767
665
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
768
|
-
onClick:
|
|
666
|
+
onClick: _this6.closeAttachmentViewer,
|
|
769
667
|
"data-id": "closeAttach",
|
|
770
668
|
"data-test-id": "closeAttach",
|
|
771
669
|
"data-title": i18nKeys.closeText
|
|
@@ -786,13 +684,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
786
684
|
alignBox: "row"
|
|
787
685
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
788
686
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
789
|
-
onClick:
|
|
687
|
+
onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex - 1),
|
|
790
688
|
"data-title": i18nKeys.previousText,
|
|
791
689
|
"data-title-position": "left"
|
|
792
690
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
793
691
|
className: _AttachmentViewerModule["default"].btn,
|
|
794
692
|
"aria-label": i18nKeys.previousText
|
|
795
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
693
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
796
694
|
name: "ZD-arrowLeft3",
|
|
797
695
|
iconClass: _AttachmentViewerModule["default"].arrow,
|
|
798
696
|
dataId: "leftAttachNav",
|
|
@@ -802,18 +700,18 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
802
700
|
tabindex: "0",
|
|
803
701
|
"aria-describedby": ariaId,
|
|
804
702
|
isShrink: false,
|
|
805
|
-
eleRef:
|
|
703
|
+
eleRef: _this6.setImgBoxRef,
|
|
806
704
|
scroll: "both",
|
|
807
705
|
flexible: true
|
|
808
|
-
},
|
|
706
|
+
}, _this6.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
809
707
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
810
|
-
onClick:
|
|
708
|
+
onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
|
|
811
709
|
"data-title": i18nKeys.nextText,
|
|
812
710
|
"data-title-position": "right"
|
|
813
711
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
814
712
|
className: _AttachmentViewerModule["default"].btn,
|
|
815
713
|
"aria-label": i18nKeys.nextText
|
|
816
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
714
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
817
715
|
name: "ZD-arrowRight3",
|
|
818
716
|
iconClass: _AttachmentViewerModule["default"].arrow,
|
|
819
717
|
dataId: "rightAttachNav",
|
|
@@ -847,7 +745,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
847
745
|
alignBox: "row",
|
|
848
746
|
scroll: "horizontal",
|
|
849
747
|
eleRef: function eleRef(el) {
|
|
850
|
-
return
|
|
748
|
+
return _this6.imgListCont = el;
|
|
851
749
|
},
|
|
852
750
|
className: _AttachmentViewerModule["default"].listContainer
|
|
853
751
|
}, data.map(function (item, index) {
|
|
@@ -861,17 +759,17 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
861
759
|
_item$customProps = item.customProps,
|
|
862
760
|
customProps = _item$customProps === void 0 ? {} : _item$customProps;
|
|
863
761
|
var thumbnail = item.thumbnail;
|
|
864
|
-
var isImageFileType =
|
|
865
|
-
var _customClass$
|
|
866
|
-
customImageClass = _customClass$
|
|
867
|
-
_customClass$
|
|
868
|
-
customChildrenClass = _customClass$
|
|
762
|
+
var isImageFileType = _this6.isImageFileType(name) || thumbnail;
|
|
763
|
+
var _customClass$customIm2 = customClass.customImageClass,
|
|
764
|
+
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
765
|
+
_customClass$customCh2 = customClass.customChildrenClass,
|
|
766
|
+
customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
|
|
869
767
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
870
768
|
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
|
|
871
769
|
key: index,
|
|
872
|
-
onClick:
|
|
770
|
+
onClick: _this6.changeSelectedIndex.bind(_this6, index),
|
|
873
771
|
eleRef: function eleRef(el) {
|
|
874
|
-
return
|
|
772
|
+
return _this6["img_".concat(index)] = el;
|
|
875
773
|
},
|
|
876
774
|
dataId: "attachPreviewList",
|
|
877
775
|
"data-title": name
|
|
@@ -884,10 +782,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
884
782
|
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
885
783
|
},
|
|
886
784
|
dataId: dataId
|
|
887
|
-
}, customProps), children) :
|
|
785
|
+
}, customProps), children) : _this6.getPreviewIconData(name, '40'));
|
|
888
786
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
889
787
|
dataId: "attachToggle",
|
|
890
|
-
onClick:
|
|
788
|
+
onClick: _this6.togglePViewList,
|
|
891
789
|
iconName: "ZD-GN-hideTab",
|
|
892
790
|
iconSize: "14",
|
|
893
791
|
hoverType: "border",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.header {
|
|
2
|
-
height: var(--
|
|
2
|
+
height: var(--zd_size40) ;
|
|
3
3
|
position: relative;
|
|
4
4
|
z-index: 1;
|
|
5
|
-
padding-block:
|
|
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,13 +10,20 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.title {
|
|
13
|
-
padding-inline-end: var(--zd_size15) ;
|
|
14
13
|
max-width: 50% ;
|
|
15
14
|
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
16
15
|
}
|
|
17
16
|
|
|
17
|
+
[dir=ltr] .title {
|
|
18
|
+
padding-right: var(--zd_size15) ;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[dir=rtl] .title {
|
|
22
|
+
padding-left: var(--zd_size15) ;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
.count {
|
|
19
|
-
padding-block:
|
|
26
|
+
padding-block:0 ;
|
|
20
27
|
padding-inline: var(--zd_size10) ;
|
|
21
28
|
position: absolute;
|
|
22
29
|
composes: xMiddle from '~@zohodesk/components/es/common/common.module.css';
|
|
@@ -73,7 +80,7 @@
|
|
|
73
80
|
|
|
74
81
|
.preview {
|
|
75
82
|
margin-block: var(--zd_size20) ;
|
|
76
|
-
margin-inline:
|
|
83
|
+
margin-inline:0 ;
|
|
77
84
|
composes: posrel from '~@zohodesk/components/es/common/common.module.css';
|
|
78
85
|
text-align: center;
|
|
79
86
|
}
|
|
@@ -129,7 +136,7 @@
|
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
.listContainer {
|
|
132
|
-
padding-block:
|
|
139
|
+
padding-block:0 ;
|
|
133
140
|
padding-inline: var(--zd_size18) ;
|
|
134
141
|
}
|
|
135
142
|
|
|
@@ -317,7 +324,7 @@
|
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
.authorName {
|
|
320
|
-
margin-block:
|
|
327
|
+
margin-block:0 ;
|
|
321
328
|
margin-inline: var(--zd_size10) ;
|
|
322
329
|
font-size: var(--zd_font_size15) ;
|
|
323
330
|
color: var(--zdt_attachmentviewer_title_text);
|
|
@@ -357,4 +364,4 @@
|
|
|
357
364
|
color: var(--zdt_attachmentviewer_title_text);
|
|
358
365
|
padding: var(--zd_size2) ;
|
|
359
366
|
margin: auto ;
|
|
360
|
-
}
|
|
367
|
+
}
|
|
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AttachmentViewer_defaultProps = exports.AttachmentImage_defaultProps = void 0;
|
|
7
|
-
|
|
8
|
-
var _General = require("../../utils/General");
|
|
9
|
-
|
|
10
7
|
var AttachmentImage_defaultProps = {
|
|
11
8
|
dataId: 'AttachmentImage',
|
|
12
9
|
customClass: {
|
|
@@ -21,8 +18,7 @@ var AttachmentViewer_defaultProps = {
|
|
|
21
18
|
maintainZoom: false,
|
|
22
19
|
isActive: false,
|
|
23
20
|
dataId: 'AttachmentViewer',
|
|
24
|
-
i18nKeys:
|
|
25
|
-
customProps:
|
|
26
|
-
showCount: true
|
|
21
|
+
i18nKeys: {},
|
|
22
|
+
customProps: {}
|
|
27
23
|
};
|
|
28
24
|
exports.AttachmentViewer_defaultProps = AttachmentViewer_defaultProps;
|
|
@@ -13,9 +13,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
13
13
|
|
|
14
14
|
var AttachmentImage_propTypes = {
|
|
15
15
|
alt: _propTypes["default"].string,
|
|
16
|
-
imageRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
|
|
17
|
-
current: _propTypes["default"].any
|
|
18
|
-
})]),
|
|
19
16
|
customClass: _propTypes["default"].shape({
|
|
20
17
|
customImageClass: _propTypes["default"].string,
|
|
21
18
|
customChildrenClass: _propTypes["default"].string
|
|
@@ -44,7 +41,7 @@ var AttachmentViewer_propTypes = {
|
|
|
44
41
|
showText: _propTypes["default"].string,
|
|
45
42
|
previewUnsupportedText: _propTypes["default"].string
|
|
46
43
|
}),
|
|
47
|
-
needDownload: _propTypes["default"].
|
|
44
|
+
needDownload: _propTypes["default"].string,
|
|
48
45
|
previewObj: _propTypes["default"].object,
|
|
49
46
|
responsiveId: _propTypes["default"].string,
|
|
50
47
|
maintainZoom: _propTypes["default"].bool,
|
|
@@ -57,11 +54,8 @@ var AttachmentViewer_propTypes = {
|
|
|
57
54
|
document: _propTypes["default"].arrayOf(_propTypes["default"].string)
|
|
58
55
|
}),
|
|
59
56
|
renderUnSupportedElement: _propTypes["default"].func,
|
|
60
|
-
renderCustomImagePreviewElement: _propTypes["default"].func,
|
|
61
57
|
customProps: _propTypes["default"].shape({
|
|
62
58
|
avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
|
|
63
|
-
})
|
|
64
|
-
showCount: _propTypes["default"].bool,
|
|
65
|
-
renderCustomIcons: _propTypes["default"].func
|
|
59
|
+
})
|
|
66
60
|
};
|
|
67
61
|
exports.AttachmentViewer_propTypes = AttachmentViewer_propTypes;
|
|
@@ -106,7 +106,10 @@ function useDownloadAssetsAndSetAttr(_ref) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
function setZoomSizeAttribute() {
|
|
109
|
-
|
|
109
|
+
var zoomLower = String(baseZoomUnit).toLowerCase();
|
|
110
|
+
var varLower = String(zoomUnitVariable).toLowerCase();
|
|
111
|
+
|
|
112
|
+
if (!needZoom || zoomLower === 'none' || zoomLower === 'unset' || varLower === 'none' || varLower === 'unset') {
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
115
|
|
|
@@ -122,7 +125,10 @@ function useDownloadAssetsAndSetAttr(_ref) {
|
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
function setFontSizeAttribute() {
|
|
125
|
-
|
|
128
|
+
var fontLower = String(baseFontUnit).toLowerCase();
|
|
129
|
+
var varLower = String(fontUnitVariable).toLowerCase();
|
|
130
|
+
|
|
131
|
+
if (!needFont || fontLower === 'none' || fontLower === 'unset' || varLower === 'none' || varLower === 'unset') {
|
|
126
132
|
return;
|
|
127
133
|
}
|
|
128
134
|
|
|
@@ -142,7 +148,7 @@ function useDownloadAssetsAndSetAttr(_ref) {
|
|
|
142
148
|
}, [themeAppearanceAttr, themeColorAttr, themeAppearance, themeColor, getProviderElement, needTheme]);
|
|
143
149
|
(0, _react.useLayoutEffect)(function () {
|
|
144
150
|
setZoomSizeAttribute();
|
|
145
|
-
}, [zoomUnitVariable, modifiedZoomUnitWithSuffix, zoomSizePromise, getProviderElement, needZoom]);
|
|
151
|
+
}, [zoomUnitVariable, modifiedZoomUnitWithSuffix, zoomSizePromise, getProviderElement, needZoom, baseZoomUnit]);
|
|
146
152
|
(0, _react.useLayoutEffect)(function () {
|
|
147
153
|
setFontSizeAttribute();
|
|
148
154
|
}, [fontUnitVariable, baseFontUnit, fontSizePromise, getProviderElement, needFont]);
|
package/lib/Link/Link.js
CHANGED
|
@@ -110,8 +110,7 @@ var Link = /*#__PURE__*/function (_React$Component) {
|
|
|
110
110
|
rel = _this$props2.rel,
|
|
111
111
|
dataId = _this$props2.dataId,
|
|
112
112
|
customProps = _this$props2.customProps,
|
|
113
|
-
ariaLabel = _this$props2.ariaLabel
|
|
114
|
-
downloadName = _this$props2.downloadName;
|
|
113
|
+
ariaLabel = _this$props2.ariaLabel;
|
|
115
114
|
var _this$context$options = this.context.options,
|
|
116
115
|
isLink = _this$context$options.isLink,
|
|
117
116
|
constructURL = _this$context$options.constructURL;
|
|
@@ -119,10 +118,10 @@ var Link = /*#__PURE__*/function (_React$Component) {
|
|
|
119
118
|
var option = {};
|
|
120
119
|
|
|
121
120
|
if (download) {
|
|
122
|
-
option.download =
|
|
121
|
+
option.download = true;
|
|
123
122
|
}
|
|
124
123
|
|
|
125
|
-
var ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', '
|
|
124
|
+
var ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
|
|
126
125
|
var others = Object.keys(this.props).filter(function (key) {
|
|
127
126
|
return ignoreKeys.indexOf(key) == -1;
|
|
128
127
|
}).reduce(function (res, key) {
|