@zohodesk/dot 1.0.0-temp-229.2 → 1.0.0-temp-230.1
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 +7 -5
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +0 -3
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +0 -3
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +0 -3
- package/es/AttachmentViewer/AttachmentViewer.js +115 -23
- package/es/AttachmentViewer/AttachmentViewer.module.css +1 -1
- package/es/AttachmentViewer/props/defaultProps.js +2 -1
- package/es/AttachmentViewer/props/propTypes.js +3 -1
- package/es/Link/Link.js +4 -3
- package/es/Link/props/propTypes.js +1 -0
- package/es/common/dot_boxShadow.module.css +0 -2
- package/es/form/fields/SelectField/SelectField.js +2 -4
- package/es/form/fields/SelectField/props/defaultProps.js +0 -1
- package/es/form/fields/SelectField/props/propTypes.js +0 -1
- package/es/list/status/StatusDropdown/StatusDropdown.js +79 -121
- package/es/list/status/StatusDropdown/StatusDropdown.module.css +7 -54
- package/es/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/es/list/status/StatusDropdown/props/propTypes.js +1 -2
- package/lib/AttachmentViewer/AttachmentViewer.js +177 -80
- package/lib/AttachmentViewer/AttachmentViewer.module.css +1 -1
- package/lib/AttachmentViewer/props/defaultProps.js +2 -1
- package/lib/AttachmentViewer/props/propTypes.js +3 -1
- package/lib/Link/Link.js +4 -3
- package/lib/Link/props/propTypes.js +1 -0
- package/lib/common/dot_boxShadow.module.css +0 -2
- package/lib/form/fields/SelectField/SelectField.js +2 -4
- package/lib/form/fields/SelectField/props/defaultProps.js +0 -1
- package/lib/form/fields/SelectField/props/propTypes.js +0 -1
- package/lib/list/status/StatusDropdown/StatusDropdown.js +81 -133
- package/lib/list/status/StatusDropdown/StatusDropdown.module.css +7 -54
- package/lib/list/status/StatusDropdown/props/defaultProps.js +1 -2
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/package.json +4 -4
|
@@ -1,130 +1,83 @@
|
|
|
1
1
|
.container {
|
|
2
2
|
max-width: 100% ;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
.dropBoxListContainer {
|
|
6
|
-
border-radius: 7px;
|
|
7
|
-
padding: var(--zd_size10) ;
|
|
8
|
-
border: 1px solid var(--zdt_statusdropdown_wrapper_container_border);
|
|
9
|
-
background: var(--zdt_statusdropdown_wrapper_container_bg);
|
|
10
|
-
box-shadow: var(--zd_bs_statusdropdown_wrapper_container);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.dropdownOptions {
|
|
14
|
-
padding-inline: var(--zd_size1) ;
|
|
15
|
-
padding-block: var(--zd_size1) ;
|
|
16
|
-
background-color: var(--zdt_statusdropdown_wrapper_dropdown_bg);
|
|
17
|
-
border: 1px solid var(--zdt_statusdropdown_wrapper_container_border);
|
|
18
|
-
border-radius: 7px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
4
|
.posRel {
|
|
22
5
|
position: relative;
|
|
23
6
|
}
|
|
24
|
-
|
|
25
7
|
.maxHgt {
|
|
26
8
|
max-height: var(--zd_size265) ;
|
|
27
9
|
padding-block: var(--zd_size10) ;
|
|
28
|
-
padding-inline:
|
|
10
|
+
padding-inline:0 ;
|
|
29
11
|
}
|
|
30
|
-
|
|
31
|
-
.responsivemaxHgt {
|
|
12
|
+
.responsivemaxHgt{
|
|
32
13
|
padding-block: var(--zd_size10) 0 ;
|
|
33
|
-
padding-inline:
|
|
14
|
+
padding-inline:0 ;
|
|
34
15
|
}
|
|
35
|
-
|
|
36
16
|
.title {
|
|
37
17
|
padding-block-start: var(--zd_size6) ;
|
|
38
18
|
}
|
|
39
|
-
|
|
40
19
|
.default_arrow,
|
|
41
20
|
.overlay_arrow {
|
|
42
21
|
padding-inline: var(--zd_size5) 0 ;
|
|
43
|
-
padding-block:
|
|
22
|
+
padding-block:0 ;
|
|
44
23
|
}
|
|
45
|
-
|
|
46
24
|
.overlay_arrow {
|
|
47
25
|
position: absolute;
|
|
48
26
|
top: 50% ;
|
|
49
27
|
transform: translateY(-50%) perspective(1px);
|
|
50
28
|
}
|
|
51
|
-
|
|
52
29
|
[dir=ltr] .overlay_arrow {
|
|
53
30
|
left: 100% ;
|
|
54
31
|
}
|
|
55
|
-
|
|
56
32
|
[dir=rtl] .overlay_arrow {
|
|
57
33
|
right: 100% ;
|
|
58
34
|
}
|
|
59
|
-
|
|
60
35
|
.hoverIcon .arrow {
|
|
61
36
|
opacity: 0;
|
|
62
37
|
visibility: hidden;
|
|
63
38
|
}
|
|
64
|
-
|
|
65
39
|
.hoverIcon:hover .arrow {
|
|
66
40
|
opacity: 1;
|
|
67
41
|
visibility: visible;
|
|
68
42
|
}
|
|
69
|
-
|
|
70
43
|
.value {
|
|
71
44
|
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
72
45
|
}
|
|
73
|
-
|
|
74
46
|
.search {
|
|
75
47
|
padding-block: var(--zd_size6) 0 ;
|
|
76
|
-
padding-inline:
|
|
48
|
+
padding-inline:var(--zd_size20) ;
|
|
77
49
|
}
|
|
78
|
-
|
|
79
50
|
.svgWrapper {
|
|
80
51
|
padding-block-end: var(--zd_size25) ;
|
|
81
52
|
}
|
|
82
|
-
|
|
83
53
|
.readOnly {
|
|
84
54
|
cursor: no-drop;
|
|
85
55
|
}
|
|
86
|
-
|
|
87
56
|
.cursorDefault {
|
|
88
57
|
cursor: default;
|
|
89
58
|
}
|
|
90
|
-
|
|
91
59
|
.cursor {
|
|
92
60
|
cursor: pointer;
|
|
93
61
|
}
|
|
94
|
-
|
|
95
62
|
[dir=ltr] .dropBoxContainer {
|
|
96
63
|
text-align: left;
|
|
97
64
|
}
|
|
98
|
-
|
|
99
65
|
[dir=rtl] .dropBoxContainer {
|
|
100
66
|
text-align: right;
|
|
101
67
|
}
|
|
102
|
-
|
|
103
68
|
.iconBox {
|
|
104
69
|
margin-inline-end: var(--zd_size4) ;
|
|
105
70
|
}
|
|
106
|
-
|
|
107
|
-
.iconBox>i {
|
|
71
|
+
.iconBox > i {
|
|
108
72
|
display: block;
|
|
109
73
|
}
|
|
110
|
-
|
|
111
74
|
.loader {
|
|
112
75
|
width: var(--zd_size40) ;
|
|
113
76
|
margin: 0 auto ;
|
|
114
77
|
}
|
|
115
|
-
|
|
116
78
|
.seperatedLine {
|
|
117
79
|
height: var(--zd_size1) ;
|
|
118
80
|
margin-block: var(--zd_size9) var(--zd_size10) ;
|
|
119
|
-
margin-inline:
|
|
81
|
+
margin-inline:0 ;
|
|
120
82
|
border-bottom: 1px solid var(--zdt_statusdropdown_line_border);
|
|
121
83
|
}
|
|
122
|
-
|
|
123
|
-
.customDropBoxHeaderContainer {
|
|
124
|
-
margin-block-end: var(--zd_size6) ;
|
|
125
|
-
margin-inline: var(--zd_size1) ;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.dropBoxWithCustomHeader {
|
|
129
|
-
border-radius: 7px;
|
|
130
|
-
}
|
|
@@ -120,9 +120,37 @@ 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));
|
|
123
|
+
_this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this)); // this.updateItem = this.updateItem.bind(this);
|
|
124
|
+
|
|
124
125
|
return _this;
|
|
125
|
-
}
|
|
126
|
+
} // updateItem(idOrIndex, changes) {
|
|
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
|
+
|
|
126
154
|
|
|
127
155
|
_createClass(AttachmentViewer, [{
|
|
128
156
|
key: "isImageFileType",
|
|
@@ -159,11 +187,14 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
159
187
|
}, {
|
|
160
188
|
key: "componentDidUpdate",
|
|
161
189
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
190
|
+
var _previewObj$previewDa, _prevState$data$;
|
|
191
|
+
|
|
162
192
|
var previewObj = this.props.previewObj;
|
|
163
193
|
var selectedIndex = this.state.selectedIndex;
|
|
164
194
|
var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
195
|
+
var attachmentPreviewUrlChanged = ((_previewObj$previewDa = previewObj.previewData[0]) === null || _previewObj$previewDa === void 0 ? void 0 : _previewObj$previewDa.viewUrl) !== ((_prevState$data$ = prevState.data[0]) === null || _prevState$data$ === void 0 ? void 0 : _prevState$data$.viewUrl); // Triggers an update if the previewed attachment is edited by the Attachment Annotator.
|
|
165
196
|
|
|
166
|
-
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
|
|
197
|
+
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
|
|
167
198
|
var objChanged = previewObj.previewData.some(function (value, index) {
|
|
168
199
|
return (0, _General.shallowDiff)(value, prevProps.previewObj[index]);
|
|
169
200
|
});
|
|
@@ -182,7 +213,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
182
213
|
}
|
|
183
214
|
}
|
|
184
215
|
|
|
185
|
-
if (prevState.selectedIndex != selectedIndex) {
|
|
216
|
+
if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
|
|
186
217
|
this.handleMenuValidation();
|
|
187
218
|
}
|
|
188
219
|
}
|
|
@@ -397,21 +428,92 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
397
428
|
}, this.props.customProps.iframeProps));
|
|
398
429
|
}
|
|
399
430
|
}, {
|
|
400
|
-
key: "
|
|
401
|
-
value: function
|
|
431
|
+
key: "getRenderImageFrameCustomClass",
|
|
432
|
+
value: function getRenderImageFrameCustomClass(_ref3) {
|
|
433
|
+
var canZoom = _ref3.canZoom,
|
|
434
|
+
retainZoom = _ref3.retainZoom,
|
|
435
|
+
isZoomed = _ref3.isZoomed,
|
|
436
|
+
customImageClass = _ref3.customImageClass,
|
|
437
|
+
customChildrenClass = _ref3.customChildrenClass;
|
|
438
|
+
return {
|
|
439
|
+
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),
|
|
440
|
+
customChildrenClass: customChildrenClass
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}, {
|
|
444
|
+
key: "renderImageFrame",
|
|
445
|
+
value: function renderImageFrame(data, i) {
|
|
402
446
|
var _this5 = this;
|
|
403
447
|
|
|
404
448
|
var _this$state3 = this.state,
|
|
405
|
-
dataList = _this$state3.dataList,
|
|
406
449
|
selectedIndex = _this$state3.selectedIndex,
|
|
407
450
|
isZoomed = _this$state3.isZoomed,
|
|
408
451
|
canZoom = _this$state3.canZoom,
|
|
409
452
|
isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
|
|
410
453
|
var _this$props = this.props,
|
|
411
454
|
maintainZoom = _this$props.maintainZoom,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
455
|
+
renderCustomImagePreviewElement = _this$props.renderCustomImagePreviewElement;
|
|
456
|
+
var viewUrl = data.viewUrl,
|
|
457
|
+
name = data.name,
|
|
458
|
+
children = data.children,
|
|
459
|
+
_data$dataId = data.dataId,
|
|
460
|
+
dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
|
|
461
|
+
_data$customClass = data.customClass,
|
|
462
|
+
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
463
|
+
_data$customProps = data.customProps,
|
|
464
|
+
customProps = _data$customProps === void 0 ? {} : _data$customProps;
|
|
465
|
+
var _customProps$imagePro = customProps.imageProps,
|
|
466
|
+
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
|
|
467
|
+
var _customClass$customIm = customClass.customImageClass,
|
|
468
|
+
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
469
|
+
_customClass$customCh = customClass.customChildrenClass,
|
|
470
|
+
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
471
|
+
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
472
|
+
var handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, i) : undefined;
|
|
473
|
+
var handleZoomIn = isPreviewAttachmentValid && !isZoomed ? function (e) {
|
|
474
|
+
return _this5.zoomIn(e, i, true);
|
|
475
|
+
} : undefined;
|
|
476
|
+
var handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
|
|
477
|
+
var imageFrameCustomClass = this.getRenderImageFrameCustomClass({
|
|
478
|
+
canZoom: canZoom,
|
|
479
|
+
retainZoom: retainZoom,
|
|
480
|
+
isZoomed: isZoomed,
|
|
481
|
+
customImageClass: customImageClass,
|
|
482
|
+
customChildrenClass: customChildrenClass
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
var img = /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
486
|
+
customClass: imageFrameCustomClass,
|
|
487
|
+
src: viewUrl,
|
|
488
|
+
onClick: handleImageClick,
|
|
489
|
+
alt: name,
|
|
490
|
+
dataId: dataId,
|
|
491
|
+
id: "img".concat(i),
|
|
492
|
+
isCover: false
|
|
493
|
+
}, imageProps), children);
|
|
494
|
+
|
|
495
|
+
return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
|
|
496
|
+
defaultView: img,
|
|
497
|
+
data: data,
|
|
498
|
+
index: i
|
|
499
|
+
}) : img;
|
|
500
|
+
}
|
|
501
|
+
}, {
|
|
502
|
+
key: "imgPreviewView",
|
|
503
|
+
value: function imgPreviewView(downloadUrl) {
|
|
504
|
+
var _this6 = this;
|
|
505
|
+
|
|
506
|
+
var _this$state4 = this.state,
|
|
507
|
+
dataList = _this$state4.dataList,
|
|
508
|
+
selectedIndex = _this$state4.selectedIndex,
|
|
509
|
+
isZoomed = _this$state4.isZoomed,
|
|
510
|
+
canZoom = _this$state4.canZoom,
|
|
511
|
+
isPreviewAttachmentValid = _this$state4.isPreviewAttachmentValid;
|
|
512
|
+
var _this$props2 = this.props,
|
|
513
|
+
maintainZoom = _this$props2.maintainZoom,
|
|
514
|
+
dataId = _this$props2.dataId,
|
|
515
|
+
i18nKeys = _this$props2.i18nKeys,
|
|
516
|
+
renderUnSupportedElement = _this$props2.renderUnSupportedElement;
|
|
415
517
|
|
|
416
518
|
var getImgStyle = function getImgStyle(i) {
|
|
417
519
|
var position;
|
|
@@ -444,24 +546,24 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
444
546
|
var viewUrl = data.viewUrl,
|
|
445
547
|
name = data.name,
|
|
446
548
|
children = data.children,
|
|
447
|
-
_data$
|
|
448
|
-
dataId = _data$
|
|
449
|
-
_data$
|
|
450
|
-
customClass = _data$
|
|
451
|
-
_data$
|
|
452
|
-
customProps = _data$
|
|
549
|
+
_data$dataId2 = data.dataId,
|
|
550
|
+
dataId = _data$dataId2 === void 0 ? 'attachViewer' : _data$dataId2,
|
|
551
|
+
_data$customClass2 = data.customClass,
|
|
552
|
+
customClass = _data$customClass2 === void 0 ? {} : _data$customClass2,
|
|
553
|
+
_data$customProps2 = data.customProps,
|
|
554
|
+
customProps = _data$customProps2 === void 0 ? {} : _data$customProps2,
|
|
453
555
|
previewurl = data.previewurl,
|
|
454
556
|
type = data.type;
|
|
455
557
|
var _customProps$audioPro = customProps.audioProps,
|
|
456
558
|
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
457
|
-
_customProps$
|
|
458
|
-
imageProps = _customProps$
|
|
559
|
+
_customProps$imagePro2 = customProps.imageProps,
|
|
560
|
+
imageProps = _customProps$imagePro2 === void 0 ? {} : _customProps$imagePro2,
|
|
459
561
|
_customProps$videoPro = customProps.videoProps,
|
|
460
562
|
videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
|
|
461
|
-
var _customClass$
|
|
462
|
-
customImageClass = _customClass$
|
|
463
|
-
_customClass$
|
|
464
|
-
customChildrenClass = _customClass$
|
|
563
|
+
var _customClass$customIm2 = customClass.customImageClass,
|
|
564
|
+
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
565
|
+
_customClass$customCh2 = customClass.customChildrenClass,
|
|
566
|
+
customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
|
|
465
567
|
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
466
568
|
var extension = (0, _Attachment.getExtensionFromFileName)(name);
|
|
467
569
|
var _i18nKeys$previewUnsu = i18nKeys.previewUnsupportedText,
|
|
@@ -478,7 +580,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
478
580
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
479
581
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
480
582
|
id: "imgPreviewRef".concat(i)
|
|
481
|
-
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null,
|
|
583
|
+
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this6.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
|
|
482
584
|
controls: true,
|
|
483
585
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
484
586
|
"data-id": "".concat(dataId, "_audioPreview"),
|
|
@@ -486,7 +588,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
486
588
|
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
487
589
|
src: previewurl || viewUrl,
|
|
488
590
|
type: "audio/".concat(extension)
|
|
489
|
-
})) :
|
|
591
|
+
})) : _this6.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
490
592
|
controls: true,
|
|
491
593
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
492
594
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
@@ -494,31 +596,19 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
494
596
|
}, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
495
597
|
src: viewUrl,
|
|
496
598
|
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", {
|
|
599
|
+
})) : _this6.isImageFileType(name) || children ? _this6.renderImageFrame(data, i) : type === "document" && previewurl != null ? _this6.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
511
600
|
className: _AttachmentViewerModule["default"].previewNone
|
|
512
601
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
513
602
|
className: _AttachmentViewerModule["default"].fileTypeImg
|
|
514
|
-
},
|
|
603
|
+
}, _this6.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
515
604
|
$ui_size: "20",
|
|
516
605
|
$ui_weight: "semibold"
|
|
517
606
|
}, previewUnsupportedText), downloadUrl ? /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
518
607
|
href: downloadUrl,
|
|
608
|
+
download: true,
|
|
609
|
+
downloadName: name,
|
|
519
610
|
className: _AttachmentViewerModule["default"].downloadLink,
|
|
520
|
-
hasReload: true
|
|
521
|
-
download: true
|
|
611
|
+
hasReload: true
|
|
522
612
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
523
613
|
palette: "primaryFilled",
|
|
524
614
|
text: downloadText
|
|
@@ -528,22 +618,24 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
528
618
|
}, {
|
|
529
619
|
key: "render",
|
|
530
620
|
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$
|
|
621
|
+
var _this7 = this;
|
|
622
|
+
|
|
623
|
+
var _this$state5 = this.state,
|
|
624
|
+
isPViewListOpen = _this$state5.isPViewListOpen,
|
|
625
|
+
selectedIndex = _this$state5.selectedIndex,
|
|
626
|
+
data = _this$state5.data,
|
|
627
|
+
isZoomed = _this$state5.isZoomed,
|
|
628
|
+
canZoom = _this$state5.canZoom,
|
|
629
|
+
canOpenInNewTab = _this$state5.canOpenInNewTab;
|
|
630
|
+
var _this$props3 = this.props,
|
|
631
|
+
responsiveId = _this$props3.responsiveId,
|
|
632
|
+
needDownload = _this$props3.needDownload,
|
|
633
|
+
i18nKeys = _this$props3.i18nKeys,
|
|
634
|
+
isActive = _this$props3.isActive,
|
|
635
|
+
dataId = _this$props3.dataId,
|
|
636
|
+
customProps = _this$props3.customProps,
|
|
637
|
+
showCount = _this$props3.showCount,
|
|
638
|
+
renderCustomIcons = _this$props3.renderCustomIcons;
|
|
547
639
|
var _customProps$avatarPr = customProps.avatarProps,
|
|
548
640
|
avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
|
|
549
641
|
var totalLen = data.length;
|
|
@@ -553,8 +645,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
553
645
|
var authorHref;
|
|
554
646
|
var authorName;
|
|
555
647
|
|
|
556
|
-
var
|
|
557
|
-
author =
|
|
648
|
+
var _ref4 = data[selectedIndex] ? data[selectedIndex] : {},
|
|
649
|
+
author = _ref4.author;
|
|
558
650
|
|
|
559
651
|
if (author) {
|
|
560
652
|
authorHref = author.href;
|
|
@@ -569,8 +661,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
569
661
|
}, /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
570
662
|
responsiveId: responsiveId,
|
|
571
663
|
query: this.responsiveFunc
|
|
572
|
-
}, function (
|
|
573
|
-
var uptoTablet =
|
|
664
|
+
}, function (_ref5) {
|
|
665
|
+
var uptoTablet = _ref5.uptoTablet;
|
|
574
666
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
575
667
|
scroll: "none",
|
|
576
668
|
"data-scroll-palette": "dark"
|
|
@@ -585,7 +677,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
585
677
|
"data-title": selectedAttachment.name,
|
|
586
678
|
dataId: "attachName",
|
|
587
679
|
id: ariaId
|
|
588
|
-
}, selectedAttachment.name), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
680
|
+
}, selectedAttachment.name), showCount && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
589
681
|
flexible: true,
|
|
590
682
|
className: _AttachmentViewerModule["default"].count,
|
|
591
683
|
dataId: "attachCountContainer"
|
|
@@ -597,9 +689,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
597
689
|
align: uptoTablet ? 'bottom' : 'center',
|
|
598
690
|
wrap: "wrap",
|
|
599
691
|
isCover: false
|
|
600
|
-
},
|
|
692
|
+
}, typeof renderCustomIcons === 'function' && renderCustomIcons({
|
|
693
|
+
selectedAttachment: selectedAttachment,
|
|
694
|
+
selectedIndex: selectedIndex,
|
|
695
|
+
totalLen: totalLen
|
|
696
|
+
}), canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
601
697
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
602
|
-
onClick:
|
|
698
|
+
onClick: _this7.zoomOut.bind(_this7, selectedIndex),
|
|
603
699
|
"data-id": "zoomOut",
|
|
604
700
|
"data-test-id": "zoomOut",
|
|
605
701
|
"data-title": i18nKeys.zoomOutText
|
|
@@ -614,7 +710,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
614
710
|
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
615
711
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
616
712
|
onClick: function onClick(e) {
|
|
617
|
-
return
|
|
713
|
+
return _this7.zoomIn(e, selectedIndex);
|
|
618
714
|
},
|
|
619
715
|
"data-id": "zoomIn",
|
|
620
716
|
"data-test-id": "zoomIn",
|
|
@@ -647,6 +743,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
647
743
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
|
|
648
744
|
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
649
745
|
href: downloadUrl,
|
|
746
|
+
downloadName: selectedAttachment.name,
|
|
650
747
|
target: "_parent",
|
|
651
748
|
hasReload: true,
|
|
652
749
|
download: true,
|
|
@@ -663,7 +760,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
663
760
|
}
|
|
664
761
|
}))) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
665
762
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
666
|
-
onClick:
|
|
763
|
+
onClick: _this7.closeAttachmentViewer,
|
|
667
764
|
"data-id": "closeAttach",
|
|
668
765
|
"data-test-id": "closeAttach",
|
|
669
766
|
"data-title": i18nKeys.closeText
|
|
@@ -684,7 +781,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
684
781
|
alignBox: "row"
|
|
685
782
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
686
783
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
687
|
-
onClick:
|
|
784
|
+
onClick: _this7.changeSelectedIndex.bind(_this7, selectedIndex - 1),
|
|
688
785
|
"data-title": i18nKeys.previousText,
|
|
689
786
|
"data-title-position": "left"
|
|
690
787
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
@@ -700,12 +797,12 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
700
797
|
tabindex: "0",
|
|
701
798
|
"aria-describedby": ariaId,
|
|
702
799
|
isShrink: false,
|
|
703
|
-
eleRef:
|
|
800
|
+
eleRef: _this7.setImgBoxRef,
|
|
704
801
|
scroll: "both",
|
|
705
802
|
flexible: true
|
|
706
|
-
},
|
|
803
|
+
}, _this7.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
707
804
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
708
|
-
onClick:
|
|
805
|
+
onClick: _this7.changeSelectedIndex.bind(_this7, selectedIndex + 1),
|
|
709
806
|
"data-title": i18nKeys.nextText,
|
|
710
807
|
"data-title-position": "right"
|
|
711
808
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
@@ -745,7 +842,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
745
842
|
alignBox: "row",
|
|
746
843
|
scroll: "horizontal",
|
|
747
844
|
eleRef: function eleRef(el) {
|
|
748
|
-
return
|
|
845
|
+
return _this7.imgListCont = el;
|
|
749
846
|
},
|
|
750
847
|
className: _AttachmentViewerModule["default"].listContainer
|
|
751
848
|
}, data.map(function (item, index) {
|
|
@@ -759,17 +856,17 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
759
856
|
_item$customProps = item.customProps,
|
|
760
857
|
customProps = _item$customProps === void 0 ? {} : _item$customProps;
|
|
761
858
|
var thumbnail = item.thumbnail;
|
|
762
|
-
var isImageFileType =
|
|
763
|
-
var _customClass$
|
|
764
|
-
customImageClass = _customClass$
|
|
765
|
-
_customClass$
|
|
766
|
-
customChildrenClass = _customClass$
|
|
859
|
+
var isImageFileType = _this7.isImageFileType(name) || thumbnail;
|
|
860
|
+
var _customClass$customIm3 = customClass.customImageClass,
|
|
861
|
+
customImageClass = _customClass$customIm3 === void 0 ? '' : _customClass$customIm3,
|
|
862
|
+
_customClass$customCh3 = customClass.customChildrenClass,
|
|
863
|
+
customChildrenClass = _customClass$customCh3 === void 0 ? '' : _customClass$customCh3;
|
|
767
864
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
768
865
|
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
|
|
769
866
|
key: index,
|
|
770
|
-
onClick:
|
|
867
|
+
onClick: _this7.changeSelectedIndex.bind(_this7, index),
|
|
771
868
|
eleRef: function eleRef(el) {
|
|
772
|
-
return
|
|
869
|
+
return _this7["img_".concat(index)] = el;
|
|
773
870
|
},
|
|
774
871
|
dataId: "attachPreviewList",
|
|
775
872
|
"data-title": name
|
|
@@ -782,10 +879,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
782
879
|
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
783
880
|
},
|
|
784
881
|
dataId: dataId
|
|
785
|
-
}, customProps), children) :
|
|
882
|
+
}, customProps), children) : _this7.getPreviewIconData(name, '40'));
|
|
786
883
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
787
884
|
dataId: "attachToggle",
|
|
788
|
-
onClick:
|
|
885
|
+
onClick: _this7.togglePViewList,
|
|
789
886
|
iconName: "ZD-GN-hideTab",
|
|
790
887
|
iconSize: "14",
|
|
791
888
|
hoverType: "border",
|
|
@@ -56,6 +56,8 @@ var AttachmentViewer_propTypes = {
|
|
|
56
56
|
renderUnSupportedElement: _propTypes["default"].func,
|
|
57
57
|
customProps: _propTypes["default"].shape({
|
|
58
58
|
avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
|
|
59
|
-
})
|
|
59
|
+
}),
|
|
60
|
+
showCount: _propTypes["default"].bool,
|
|
61
|
+
renderCustomIcons: _propTypes["default"].func
|
|
60
62
|
};
|
|
61
63
|
exports.AttachmentViewer_propTypes = AttachmentViewer_propTypes;
|
package/lib/Link/Link.js
CHANGED
|
@@ -110,7 +110,8 @@ 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
|
|
113
|
+
ariaLabel = _this$props2.ariaLabel,
|
|
114
|
+
downloadName = _this$props2.downloadName;
|
|
114
115
|
var _this$context$options = this.context.options,
|
|
115
116
|
isLink = _this$context$options.isLink,
|
|
116
117
|
constructURL = _this$context$options.constructURL;
|
|
@@ -118,10 +119,10 @@ var Link = /*#__PURE__*/function (_React$Component) {
|
|
|
118
119
|
var option = {};
|
|
119
120
|
|
|
120
121
|
if (download) {
|
|
121
|
-
option.download = true;
|
|
122
|
+
option.download = downloadName || true;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
var ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
|
|
125
|
+
var ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'downloadName', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
|
|
125
126
|
var others = Object.keys(this.props).filter(function (key) {
|
|
126
127
|
return ignoreKeys.indexOf(key) == -1;
|
|
127
128
|
}).reduce(function (res, key) {
|
|
@@ -23,6 +23,7 @@ var propTypes = {
|
|
|
23
23
|
customProps: _propTypes["default"].object,
|
|
24
24
|
onClick: _propTypes["default"].func,
|
|
25
25
|
download: _propTypes["default"].bool,
|
|
26
|
+
downloadName: _propTypes["default"].string,
|
|
26
27
|
ariaLabel: _propTypes["default"].string,
|
|
27
28
|
key: _propTypes["default"].string
|
|
28
29
|
};
|