@zohodesk/dot 1.0.0-temp-198.3.3 → 1.0.0-temp-199
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli/propValidation_report.html +1 -1
- package/README.md +39 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -0
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -0
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -0
- package/es/ActionButton/ActionButton.module.css +192 -192
- package/es/AlphabeticList/AlphabeticList.module.css +57 -57
- package/es/AttachmentViewer/AttachmentImage.js +68 -32
- package/es/AttachmentViewer/AttachmentViewer.js +120 -41
- package/es/AttachmentViewer/AttachmentViewer.module.css +364 -352
- package/es/AttachmentViewer/__tests__/AttachmentImage.spec.js +63 -13
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
- package/es/AttachmentViewer/props/defaultProps.js +5 -1
- package/es/AttachmentViewer/props/propTypes.js +7 -3
- package/es/AttachmentViewer/utils.js +49 -0
- package/es/ChannelIcon/ChannelIcon.module.css +225 -225
- package/es/FormAction/FormAction.module.css +100 -100
- package/es/IconButton/IconButton.module.css +22 -22
- package/es/Image/Image.js +6 -2
- package/es/Image/props/propTypes.js +3 -1
- package/es/TagWithIcon/TagWithIcon.module.css +66 -66
- package/es/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
- package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
- package/es/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/es/form/fields/TextEditor/TextEditor.js +64 -64
- package/es/form/fields/TextEditor/TextEditor.module.css +73 -61
- package/es/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
- package/es/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/es/form/fields/TextEditor/props/propTypes.js +10 -3
- package/es/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
- package/es/layout/SubtabLayout/SubtabLayout.module.css +164 -164
- package/es/list/Comment/Comment.module.css +29 -29
- package/es/list/Dot/Dot.module.css +15 -15
- package/es/list/ListLayout/ListLayout.module.css +79 -79
- package/es/list/Subject/Subject.module.css +34 -34
- package/es/list/Thread/Thread.module.css +42 -42
- package/es/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +16 -0
- package/es/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
- package/es/list/status/StatusDropdown/props/propTypes.js +2 -0
- package/es/lookup/header/Search/LookupSearch.module.css +26 -26
- package/es/lookup/header/Search/Search.js +55 -38
- package/es/lookup/header/Search/props/defaultProps.js +2 -1
- package/es/lookup/header/Search/props/propTypes.js +5 -1
- package/es/utils/editorUtils.js +6 -6
- package/es/v1/AttachmentViewer/AttachmentImage.js +44 -23
- package/es/v1/AttachmentViewer/AttachmentViewer.js +120 -41
- package/es/v1/AttachmentViewer/props/propTypes.js +7 -3
- package/es/v1/Image/Image.js +6 -2
- package/es/v1/Image/props/propTypes.js +3 -1
- package/es/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/es/v1/form/fields/TextEditor/TextEditor.js +63 -64
- package/es/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/es/v1/form/fields/TextEditor/props/propTypes.js +10 -3
- package/es/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/es/v1/list/status/StatusDropdown/props/propTypes.js +2 -0
- package/es/v1/utils/editorUtils.js +6 -6
- package/es/version2/GlobalNotification/GlobalNotification.module.css +177 -177
- package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
- package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
- package/lib/ActionButton/ActionButton.module.css +192 -192
- package/lib/AlphabeticList/AlphabeticList.module.css +57 -57
- package/lib/AttachmentViewer/AttachmentImage.js +74 -36
- package/lib/AttachmentViewer/AttachmentViewer.js +151 -70
- package/lib/AttachmentViewer/AttachmentViewer.module.css +364 -352
- package/lib/AttachmentViewer/__tests__/AttachmentImage.spec.js +64 -13
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
- package/lib/AttachmentViewer/props/defaultProps.js +5 -1
- package/lib/AttachmentViewer/props/propTypes.js +7 -3
- package/lib/AttachmentViewer/utils.js +60 -1
- package/lib/ChannelIcon/ChannelIcon.module.css +225 -225
- package/lib/FormAction/FormAction.module.css +100 -100
- package/lib/IconButton/IconButton.module.css +22 -22
- package/lib/Image/Image.js +6 -2
- package/lib/Image/props/propTypes.js +3 -1
- package/lib/TagWithIcon/TagWithIcon.module.css +66 -66
- package/lib/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
- package/lib/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
- package/lib/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/lib/form/fields/TextEditor/TextEditor.js +74 -74
- package/lib/form/fields/TextEditor/TextEditor.module.css +73 -61
- package/lib/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
- package/lib/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/lib/form/fields/TextEditor/props/propTypes.js +10 -3
- package/lib/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
- package/lib/layout/SubtabLayout/SubtabLayout.module.css +164 -164
- package/lib/list/Comment/Comment.module.css +29 -29
- package/lib/list/Dot/Dot.module.css +15 -15
- package/lib/list/ListLayout/ListLayout.module.css +79 -79
- package/lib/list/Subject/Subject.module.css +34 -34
- package/lib/list/Thread/Thread.module.css +42 -42
- package/lib/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/lib/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +14 -0
- package/lib/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/lookup/header/Search/LookupSearch.module.css +26 -26
- package/lib/lookup/header/Search/Search.js +73 -64
- package/lib/lookup/header/Search/props/defaultProps.js +2 -1
- package/lib/lookup/header/Search/props/propTypes.js +9 -3
- package/lib/utils/editorUtils.js +6 -5
- package/lib/v1/AttachmentViewer/AttachmentImage.js +52 -24
- package/lib/v1/AttachmentViewer/AttachmentViewer.js +151 -70
- package/lib/v1/AttachmentViewer/props/propTypes.js +7 -3
- package/lib/v1/Image/Image.js +6 -2
- package/lib/v1/Image/props/propTypes.js +3 -1
- package/lib/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/lib/v1/form/fields/TextEditor/TextEditor.js +73 -74
- package/lib/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/lib/v1/form/fields/TextEditor/props/propTypes.js +10 -3
- package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/lib/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/v1/utils/editorUtils.js +6 -5
- package/lib/version2/GlobalNotification/GlobalNotification.module.css +177 -177
- package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
- package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
- package/package.json +6 -6
- package/result.json +1 -1
- package/unittest/index.html +6 -2
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
/** * Libraries ** */
|
|
4
4
|
import React, { Component } from 'react';
|
|
5
|
+
import { Container } from '@zohodesk/components/es/Layout';
|
|
5
6
|
import { AttachmentImage_defaultProps } from "./props/defaultProps";
|
|
6
7
|
import { AttachmentImage_propTypes } from "./props/propTypes";
|
|
8
|
+
import { checkImageValidity } from "./utils";
|
|
7
9
|
import Image from "../Image/Image";
|
|
8
10
|
/** * CSS ** */
|
|
9
11
|
|
|
@@ -11,67 +13,101 @@ import style from "./AttachmentViewer.module.css";
|
|
|
11
13
|
export default class AttachmentImage extends Component {
|
|
12
14
|
constructor(props) {
|
|
13
15
|
super(props);
|
|
14
|
-
this.imageEle = /*#__PURE__*/React.createRef();
|
|
15
16
|
this.state = {
|
|
16
|
-
isLoading: true
|
|
17
|
+
isLoading: true,
|
|
18
|
+
isImageValid: false
|
|
17
19
|
};
|
|
18
|
-
this.
|
|
20
|
+
this.handleImageValidation = this.handleImageValidation.bind(this);
|
|
21
|
+
this.renderImage = this.renderImage.bind(this);
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
handleImageValidation() {
|
|
22
25
|
const {
|
|
23
|
-
|
|
26
|
+
src
|
|
24
27
|
} = this.props;
|
|
25
|
-
|
|
26
|
-
if (isImage) {
|
|
27
|
-
const image = this.imageEle.current;
|
|
28
|
-
image.addEventListener('load', this.imgLoad);
|
|
29
|
-
} else {
|
|
28
|
+
checkImageValidity(src).then(isValid => {
|
|
30
29
|
this.setState({
|
|
31
|
-
isLoading: false
|
|
30
|
+
isLoading: false,
|
|
31
|
+
isImageValid: isValid
|
|
32
32
|
});
|
|
33
|
-
}
|
|
33
|
+
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
renderImage() {
|
|
37
|
+
const {
|
|
38
|
+
src,
|
|
39
|
+
onClick,
|
|
40
|
+
alt,
|
|
41
|
+
id,
|
|
42
|
+
dataId,
|
|
43
|
+
isCover,
|
|
44
|
+
customClass,
|
|
45
|
+
onLoad,
|
|
46
|
+
onError
|
|
47
|
+
} = this.props;
|
|
48
|
+
const {
|
|
49
|
+
isImageValid
|
|
50
|
+
} = this.state;
|
|
51
|
+
const {
|
|
52
|
+
customImageClass = ''
|
|
53
|
+
} = customClass;
|
|
54
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
55
|
+
htmlId: id,
|
|
56
|
+
dataId: isImageValid ? dataId : `${dataId}_alt`,
|
|
57
|
+
src: src,
|
|
58
|
+
onClick: onClick,
|
|
59
|
+
className: customImageClass,
|
|
60
|
+
alt: alt,
|
|
61
|
+
isCover: isCover,
|
|
62
|
+
onLoad: onLoad,
|
|
63
|
+
onError: onError
|
|
39
64
|
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
componentDidMount() {
|
|
68
|
+
this.handleImageValidation();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
componentDidUpdate(prevProps) {
|
|
40
72
|
const {
|
|
41
|
-
|
|
73
|
+
src
|
|
42
74
|
} = this.props;
|
|
43
|
-
|
|
75
|
+
|
|
76
|
+
if (prevProps.src !== src) {
|
|
77
|
+
this.setState({
|
|
78
|
+
isLoading: true
|
|
79
|
+
});
|
|
80
|
+
this.handleImageValidation();
|
|
81
|
+
}
|
|
44
82
|
}
|
|
45
83
|
|
|
46
84
|
render() {
|
|
47
85
|
const {
|
|
48
|
-
src,
|
|
49
|
-
onClick,
|
|
50
|
-
alt,
|
|
51
86
|
dataId,
|
|
52
87
|
id,
|
|
53
|
-
|
|
54
|
-
|
|
88
|
+
customClass,
|
|
89
|
+
children
|
|
55
90
|
} = this.props;
|
|
56
91
|
const {
|
|
57
|
-
isLoading
|
|
92
|
+
isLoading,
|
|
93
|
+
isImageValid
|
|
58
94
|
} = this.state;
|
|
95
|
+
const {
|
|
96
|
+
customChildrenClass = ''
|
|
97
|
+
} = customClass;
|
|
59
98
|
return /*#__PURE__*/React.createElement(React.Fragment, null, isLoading ? /*#__PURE__*/React.createElement("div", {
|
|
60
99
|
className: `${style.spinLoad}`,
|
|
61
100
|
"data-id": `${dataId}_loader`,
|
|
62
101
|
"data-test-id": `${dataId}_loader`
|
|
63
102
|
}, /*#__PURE__*/React.createElement("div", {
|
|
64
103
|
className: style.loader
|
|
65
|
-
})) :
|
|
104
|
+
})) : isImageValid ? this.renderImage() : children ? /*#__PURE__*/React.createElement(Container, {
|
|
105
|
+
align: "both",
|
|
66
106
|
htmlId: id,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
className: `${isLoading ? style.hide : ''} ${className}`,
|
|
72
|
-
alt: alt,
|
|
73
|
-
isCover: isCover
|
|
74
|
-
}));
|
|
107
|
+
dataId: `${dataId}_custom`,
|
|
108
|
+
className: customChildrenClass
|
|
109
|
+
}, children) : this.renderImage() //alt ui
|
|
110
|
+
);
|
|
75
111
|
}
|
|
76
112
|
|
|
77
113
|
}
|
|
@@ -13,6 +13,8 @@ import FreezeLayer from "../FreezeLayer/FreezeLayer";
|
|
|
13
13
|
import { isAudioFile, getExtensionFromFileName } from "./Attachment";
|
|
14
14
|
import { shallowDiff } from "../utils/General";
|
|
15
15
|
import style from "./AttachmentViewer.module.css";
|
|
16
|
+
import { checkFileSourcesValidation } from "./utils";
|
|
17
|
+
import audioThumbNail from "../../images/audio_thumbnail.png";
|
|
16
18
|
export default class AttachmentViewer extends Component {
|
|
17
19
|
constructor(props) {
|
|
18
20
|
super(props);
|
|
@@ -25,7 +27,10 @@ export default class AttachmentViewer extends Component {
|
|
|
25
27
|
index: this.props.previewObj.selectedIndex,
|
|
26
28
|
data: this.props.previewObj ? this.props.previewObj.previewData : [],
|
|
27
29
|
dataList: []
|
|
28
|
-
})
|
|
30
|
+
}),
|
|
31
|
+
canOpenInNewTab: false,
|
|
32
|
+
canZoom: false,
|
|
33
|
+
isPreviewAttachmentValid: false
|
|
29
34
|
};
|
|
30
35
|
this.togglePViewList = this.togglePViewList.bind(this);
|
|
31
36
|
this.changeSelectedIndex = this.changeSelectedIndex.bind(this);
|
|
@@ -37,12 +42,20 @@ export default class AttachmentViewer extends Component {
|
|
|
37
42
|
this.getNextId = getUniqueId(this);
|
|
38
43
|
this.getUpdateDataList = this.getUpdateDataList.bind(this);
|
|
39
44
|
this.zoomMaintain = this.zoomMaintain.bind(this);
|
|
45
|
+
this.handleMenuValidation = this.handleMenuValidation.bind(this);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
componentDidMount() {
|
|
49
|
+
this.handleMenuValidation();
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
componentDidUpdate(prevProps) {
|
|
52
|
+
componentDidUpdate(prevProps, prevState) {
|
|
43
53
|
let {
|
|
44
54
|
previewObj
|
|
45
55
|
} = this.props;
|
|
56
|
+
const {
|
|
57
|
+
selectedIndex
|
|
58
|
+
} = this.state;
|
|
46
59
|
let indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
47
60
|
|
|
48
61
|
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
|
|
@@ -63,6 +76,35 @@ export default class AttachmentViewer extends Component {
|
|
|
63
76
|
});
|
|
64
77
|
}
|
|
65
78
|
}
|
|
79
|
+
|
|
80
|
+
if (prevState.selectedIndex != selectedIndex) {
|
|
81
|
+
this.handleMenuValidation();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
handleMenuValidation() {
|
|
86
|
+
const {
|
|
87
|
+
data,
|
|
88
|
+
selectedIndex
|
|
89
|
+
} = this.state;
|
|
90
|
+
const selectedAttachment = data[selectedIndex] || {};
|
|
91
|
+
const selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
92
|
+
const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
93
|
+
const selectedAttachmentName = selectedAttachment.name;
|
|
94
|
+
checkFileSourcesValidation({
|
|
95
|
+
fileName: selectedAttachmentName,
|
|
96
|
+
viewURL: selectedAttachmentViewUrl
|
|
97
|
+
}).then(fileSourceValidation => {
|
|
98
|
+
const {
|
|
99
|
+
isViewURLValid,
|
|
100
|
+
canZoom
|
|
101
|
+
} = fileSourceValidation;
|
|
102
|
+
this.setState({
|
|
103
|
+
isPreviewAttachmentValid: isViewURLValid,
|
|
104
|
+
canZoom,
|
|
105
|
+
canOpenInNewTab: isViewURLValid
|
|
106
|
+
});
|
|
107
|
+
});
|
|
66
108
|
}
|
|
67
109
|
|
|
68
110
|
togglePViewList() {
|
|
@@ -76,13 +118,11 @@ export default class AttachmentViewer extends Component {
|
|
|
76
118
|
zoomOut(ele) {
|
|
77
119
|
this.setState({
|
|
78
120
|
isZoomed: false
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
img.classList.add(style.normalImg);
|
|
85
|
-
}
|
|
121
|
+
}); // const img = document.getElementById(`img${ele}`);
|
|
122
|
+
// if (img) {
|
|
123
|
+
// img.classList.remove(style.zoomedImg);
|
|
124
|
+
// img.classList.add(style.normalImg);
|
|
125
|
+
// }
|
|
86
126
|
}
|
|
87
127
|
|
|
88
128
|
zoomIn(event, ele) {
|
|
@@ -113,12 +153,11 @@ export default class AttachmentViewer extends Component {
|
|
|
113
153
|
top: 0,
|
|
114
154
|
left: 0
|
|
115
155
|
};
|
|
116
|
-
}
|
|
156
|
+
} // if (img) {
|
|
157
|
+
// img.classList.remove(style.normalImg);
|
|
158
|
+
// img.classList.add(style.zoomedImg);
|
|
159
|
+
// }
|
|
117
160
|
|
|
118
|
-
if (img) {
|
|
119
|
-
img.classList.remove(style.normalImg);
|
|
120
|
-
img.classList.add(style.zoomedImg);
|
|
121
|
-
}
|
|
122
161
|
|
|
123
162
|
if (moveToPosition) {
|
|
124
163
|
imgContainer.scrollLeft = (event.pageX - imgContainerPosition.left - imgUnits.left) * imgRatio.width;
|
|
@@ -217,7 +256,9 @@ export default class AttachmentViewer extends Component {
|
|
|
217
256
|
const {
|
|
218
257
|
dataList,
|
|
219
258
|
selectedIndex,
|
|
220
|
-
isZoomed
|
|
259
|
+
isZoomed,
|
|
260
|
+
canZoom,
|
|
261
|
+
isPreviewAttachmentValid
|
|
221
262
|
} = this.state;
|
|
222
263
|
const {
|
|
223
264
|
maintainZoom,
|
|
@@ -252,7 +293,23 @@ export default class AttachmentViewer extends Component {
|
|
|
252
293
|
return dataList.length && dataList.map(function () {
|
|
253
294
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
254
295
|
let i = arguments.length > 1 ? arguments[1] : undefined;
|
|
255
|
-
const
|
|
296
|
+
const {
|
|
297
|
+
viewUrl,
|
|
298
|
+
name,
|
|
299
|
+
children,
|
|
300
|
+
dataId = 'attachViewer',
|
|
301
|
+
customClass = {},
|
|
302
|
+
customProps = {}
|
|
303
|
+
} = data;
|
|
304
|
+
const {
|
|
305
|
+
audioProps = {},
|
|
306
|
+
imageProps = {}
|
|
307
|
+
} = customProps;
|
|
308
|
+
const {
|
|
309
|
+
customImageClass = '',
|
|
310
|
+
customChildrenClass = ''
|
|
311
|
+
} = customClass;
|
|
312
|
+
const retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
256
313
|
return /*#__PURE__*/React.createElement(Container, {
|
|
257
314
|
className: style.imgBox,
|
|
258
315
|
id: `imgBox${i}`,
|
|
@@ -263,27 +320,32 @@ export default class AttachmentViewer extends Component {
|
|
|
263
320
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
264
321
|
className: style.imgRef,
|
|
265
322
|
id: `imgPreviewRef${i}`
|
|
266
|
-
}, isAudioFile(
|
|
323
|
+
}, isAudioFile(name) ? selectedIndex == i ? /*#__PURE__*/React.createElement("video", {
|
|
267
324
|
autoPlay: true,
|
|
268
325
|
controls: true,
|
|
269
326
|
className: style.zoomIn,
|
|
270
327
|
"data-id": `${dataId}_videoPreview`,
|
|
271
|
-
"data-test-id": `${dataId}_videoPreview
|
|
328
|
+
"data-test-id": `${dataId}_videoPreview`,
|
|
329
|
+
...audioProps
|
|
272
330
|
}, /*#__PURE__*/React.createElement("source", {
|
|
273
|
-
src:
|
|
274
|
-
type: `audio/${getExtensionFromFileName(
|
|
331
|
+
src: viewUrl,
|
|
332
|
+
type: `audio/${getExtensionFromFileName(name)}`
|
|
275
333
|
})) : null : /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
334
|
+
customClass: {
|
|
335
|
+
customImageClass: `${style.img} ${style.altText}
|
|
336
|
+
${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
337
|
+
customChildrenClass
|
|
280
338
|
},
|
|
281
|
-
|
|
282
|
-
|
|
339
|
+
src: viewUrl,
|
|
340
|
+
onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e => {
|
|
341
|
+
_this.zoomIn(e, i, true);
|
|
342
|
+
} : undefined,
|
|
343
|
+
alt: name,
|
|
344
|
+
dataId: dataId,
|
|
283
345
|
id: `img${i}`,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
})));
|
|
346
|
+
isCover: false,
|
|
347
|
+
...imageProps
|
|
348
|
+
}, children)));
|
|
287
349
|
});
|
|
288
350
|
}
|
|
289
351
|
|
|
@@ -292,7 +354,9 @@ export default class AttachmentViewer extends Component {
|
|
|
292
354
|
isPViewListOpen,
|
|
293
355
|
selectedIndex,
|
|
294
356
|
data,
|
|
295
|
-
isZoomed
|
|
357
|
+
isZoomed,
|
|
358
|
+
canZoom,
|
|
359
|
+
canOpenInNewTab
|
|
296
360
|
} = this.state;
|
|
297
361
|
const {
|
|
298
362
|
responsiveId,
|
|
@@ -354,7 +418,7 @@ export default class AttachmentViewer extends Component {
|
|
|
354
418
|
align: uptoTablet ? 'bottom' : 'center',
|
|
355
419
|
wrap: "wrap",
|
|
356
420
|
isCover: false
|
|
357
|
-
}, isZoomed ? /*#__PURE__*/React.createElement("div", {
|
|
421
|
+
}, canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
|
|
358
422
|
className: uptoTablet ? style.mobileMenu : style.menu,
|
|
359
423
|
onClick: this.zoomOut.bind(this, selectedIndex),
|
|
360
424
|
"data-id": "zoomOut",
|
|
@@ -382,7 +446,7 @@ export default class AttachmentViewer extends Component {
|
|
|
382
446
|
a11y: {
|
|
383
447
|
ariaLabel: i18nKeys.zoomInText
|
|
384
448
|
}
|
|
385
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
449
|
+
})) : null, canOpenInNewTab ? /*#__PURE__*/React.createElement("div", {
|
|
386
450
|
className: uptoTablet ? style.mobileMenu : style.menu
|
|
387
451
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
388
452
|
href: selectedImgUrl,
|
|
@@ -398,7 +462,7 @@ export default class AttachmentViewer extends Component {
|
|
|
398
462
|
a11y: {
|
|
399
463
|
ariaLabel: i18nKeys.newTabText
|
|
400
464
|
}
|
|
401
|
-
}))), needDownload ? /*#__PURE__*/React.createElement("div", {
|
|
465
|
+
}))) : null, needDownload ? /*#__PURE__*/React.createElement("div", {
|
|
402
466
|
className: uptoTablet ? style.mobileMenu : style.menu
|
|
403
467
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
404
468
|
href: downloadUrl,
|
|
@@ -504,24 +568,39 @@ export default class AttachmentViewer extends Component {
|
|
|
504
568
|
}, data.map((item, index) => {
|
|
505
569
|
const {
|
|
506
570
|
name,
|
|
507
|
-
viewUrl
|
|
571
|
+
viewUrl,
|
|
572
|
+
children,
|
|
573
|
+
customClass = {},
|
|
574
|
+
dataId = 'AttachmentImage',
|
|
575
|
+
customProps = {}
|
|
508
576
|
} = item;
|
|
509
|
-
|
|
577
|
+
let {
|
|
578
|
+
thumbnail
|
|
579
|
+
} = item;
|
|
580
|
+
const {
|
|
581
|
+
customImageClass = '',
|
|
582
|
+
customChildrenClass = ''
|
|
583
|
+
} = customClass;
|
|
584
|
+
thumbnail = isAudioFile(name) ? thumbnail || audioThumbNail : thumbnail; //fallback thumbnail for audio
|
|
585
|
+
|
|
510
586
|
return /*#__PURE__*/React.createElement(Box, {
|
|
511
|
-
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}
|
|
587
|
+
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}`,
|
|
512
588
|
key: index,
|
|
513
589
|
onClick: this.changeSelectedIndex.bind(this, index),
|
|
514
590
|
eleRef: el => this[`img_${index}`] = el,
|
|
515
591
|
dataId: "attachPreviewList",
|
|
516
592
|
"data-title": name
|
|
517
593
|
}, /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
518
|
-
src: viewUrl,
|
|
594
|
+
src: thumbnail || viewUrl,
|
|
519
595
|
size: "small",
|
|
520
596
|
alt: name,
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
597
|
+
customClass: {
|
|
598
|
+
customImageClass: `${style.image} ${style.altText} ${customImageClass}`,
|
|
599
|
+
customChildrenClass: `${style.crsrPointer} ${customChildrenClass}`
|
|
600
|
+
},
|
|
601
|
+
dataId: dataId,
|
|
602
|
+
...customProps
|
|
603
|
+
}, children));
|
|
525
604
|
}))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
|
|
526
605
|
dataId: "attachToggle",
|
|
527
606
|
onClick: this.togglePViewList,
|