@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.
Files changed (120) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +39 -0
  3. package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -0
  4. package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -0
  5. package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -0
  6. package/es/ActionButton/ActionButton.module.css +192 -192
  7. package/es/AlphabeticList/AlphabeticList.module.css +57 -57
  8. package/es/AttachmentViewer/AttachmentImage.js +68 -32
  9. package/es/AttachmentViewer/AttachmentViewer.js +120 -41
  10. package/es/AttachmentViewer/AttachmentViewer.module.css +364 -352
  11. package/es/AttachmentViewer/__tests__/AttachmentImage.spec.js +63 -13
  12. package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
  13. package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
  14. package/es/AttachmentViewer/props/defaultProps.js +5 -1
  15. package/es/AttachmentViewer/props/propTypes.js +7 -3
  16. package/es/AttachmentViewer/utils.js +49 -0
  17. package/es/ChannelIcon/ChannelIcon.module.css +225 -225
  18. package/es/FormAction/FormAction.module.css +100 -100
  19. package/es/IconButton/IconButton.module.css +22 -22
  20. package/es/Image/Image.js +6 -2
  21. package/es/Image/props/propTypes.js +3 -1
  22. package/es/TagWithIcon/TagWithIcon.module.css +66 -66
  23. package/es/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
  24. package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
  25. package/es/form/fields/CurrencyField/CurrencyField.js +2 -1
  26. package/es/form/fields/TextEditor/TextEditor.js +64 -64
  27. package/es/form/fields/TextEditor/TextEditor.module.css +73 -61
  28. package/es/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
  29. package/es/form/fields/TextEditor/props/defaultProps.js +4 -1
  30. package/es/form/fields/TextEditor/props/propTypes.js +10 -3
  31. package/es/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
  32. package/es/layout/SubtabLayout/SubtabLayout.module.css +164 -164
  33. package/es/list/Comment/Comment.module.css +29 -29
  34. package/es/list/Dot/Dot.module.css +15 -15
  35. package/es/list/ListLayout/ListLayout.module.css +79 -79
  36. package/es/list/Subject/Subject.module.css +34 -34
  37. package/es/list/Thread/Thread.module.css +42 -42
  38. package/es/list/status/StatusDropdown/StatusDropdown.js +8 -2
  39. package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +16 -0
  40. package/es/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
  41. package/es/list/status/StatusDropdown/props/propTypes.js +2 -0
  42. package/es/lookup/header/Search/LookupSearch.module.css +26 -26
  43. package/es/lookup/header/Search/Search.js +55 -38
  44. package/es/lookup/header/Search/props/defaultProps.js +2 -1
  45. package/es/lookup/header/Search/props/propTypes.js +5 -1
  46. package/es/utils/editorUtils.js +6 -6
  47. package/es/v1/AttachmentViewer/AttachmentImage.js +44 -23
  48. package/es/v1/AttachmentViewer/AttachmentViewer.js +120 -41
  49. package/es/v1/AttachmentViewer/props/propTypes.js +7 -3
  50. package/es/v1/Image/Image.js +6 -2
  51. package/es/v1/Image/props/propTypes.js +3 -1
  52. package/es/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
  53. package/es/v1/form/fields/TextEditor/TextEditor.js +63 -64
  54. package/es/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
  55. package/es/v1/form/fields/TextEditor/props/propTypes.js +10 -3
  56. package/es/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
  57. package/es/v1/list/status/StatusDropdown/props/propTypes.js +2 -0
  58. package/es/v1/utils/editorUtils.js +6 -6
  59. package/es/version2/GlobalNotification/GlobalNotification.module.css +177 -177
  60. package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
  61. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
  62. package/lib/ActionButton/ActionButton.module.css +192 -192
  63. package/lib/AlphabeticList/AlphabeticList.module.css +57 -57
  64. package/lib/AttachmentViewer/AttachmentImage.js +74 -36
  65. package/lib/AttachmentViewer/AttachmentViewer.js +151 -70
  66. package/lib/AttachmentViewer/AttachmentViewer.module.css +364 -352
  67. package/lib/AttachmentViewer/__tests__/AttachmentImage.spec.js +64 -13
  68. package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
  69. package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
  70. package/lib/AttachmentViewer/props/defaultProps.js +5 -1
  71. package/lib/AttachmentViewer/props/propTypes.js +7 -3
  72. package/lib/AttachmentViewer/utils.js +60 -1
  73. package/lib/ChannelIcon/ChannelIcon.module.css +225 -225
  74. package/lib/FormAction/FormAction.module.css +100 -100
  75. package/lib/IconButton/IconButton.module.css +22 -22
  76. package/lib/Image/Image.js +6 -2
  77. package/lib/Image/props/propTypes.js +3 -1
  78. package/lib/TagWithIcon/TagWithIcon.module.css +66 -66
  79. package/lib/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
  80. package/lib/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
  81. package/lib/form/fields/CurrencyField/CurrencyField.js +2 -1
  82. package/lib/form/fields/TextEditor/TextEditor.js +74 -74
  83. package/lib/form/fields/TextEditor/TextEditor.module.css +73 -61
  84. package/lib/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
  85. package/lib/form/fields/TextEditor/props/defaultProps.js +4 -1
  86. package/lib/form/fields/TextEditor/props/propTypes.js +10 -3
  87. package/lib/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
  88. package/lib/layout/SubtabLayout/SubtabLayout.module.css +164 -164
  89. package/lib/list/Comment/Comment.module.css +29 -29
  90. package/lib/list/Dot/Dot.module.css +15 -15
  91. package/lib/list/ListLayout/ListLayout.module.css +79 -79
  92. package/lib/list/Subject/Subject.module.css +34 -34
  93. package/lib/list/Thread/Thread.module.css +42 -42
  94. package/lib/list/status/StatusDropdown/StatusDropdown.js +8 -2
  95. package/lib/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +14 -0
  96. package/lib/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
  97. package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
  98. package/lib/lookup/header/Search/LookupSearch.module.css +26 -26
  99. package/lib/lookup/header/Search/Search.js +73 -64
  100. package/lib/lookup/header/Search/props/defaultProps.js +2 -1
  101. package/lib/lookup/header/Search/props/propTypes.js +9 -3
  102. package/lib/utils/editorUtils.js +6 -5
  103. package/lib/v1/AttachmentViewer/AttachmentImage.js +52 -24
  104. package/lib/v1/AttachmentViewer/AttachmentViewer.js +151 -70
  105. package/lib/v1/AttachmentViewer/props/propTypes.js +7 -3
  106. package/lib/v1/Image/Image.js +6 -2
  107. package/lib/v1/Image/props/propTypes.js +3 -1
  108. package/lib/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
  109. package/lib/v1/form/fields/TextEditor/TextEditor.js +73 -74
  110. package/lib/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
  111. package/lib/v1/form/fields/TextEditor/props/propTypes.js +10 -3
  112. package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
  113. package/lib/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
  114. package/lib/v1/utils/editorUtils.js +6 -5
  115. package/lib/version2/GlobalNotification/GlobalNotification.module.css +177 -177
  116. package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
  117. package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
  118. package/package.json +6 -6
  119. package/result.json +1 -1
  120. 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.imgLoad = this.imgLoad.bind(this);
20
+ this.handleImageValidation = this.handleImageValidation.bind(this);
21
+ this.renderImage = this.renderImage.bind(this);
19
22
  }
20
23
 
21
- componentDidMount() {
24
+ handleImageValidation() {
22
25
  const {
23
- isImage
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
- imgLoad() {
37
- this.setState({
38
- isLoading: false
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
- onLoad
73
+ src
42
74
  } = this.props;
43
- onLoad && onLoad();
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
- className,
54
- isCover
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
- })) : null, /*#__PURE__*/React.createElement(Image, {
104
+ })) : isImageValid ? this.renderImage() : children ? /*#__PURE__*/React.createElement(Container, {
105
+ align: "both",
66
106
  htmlId: id,
67
- eleRef: this.imageEle,
68
- dataId: dataId,
69
- src: src,
70
- onClick: onClick,
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
- const img = document.getElementById(`img${ele}`);
81
-
82
- if (img) {
83
- img.classList.remove(style.zoomedImg);
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 selectedImgUrl = data.viewUrl;
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(data.name) ? selectedIndex == i ? /*#__PURE__*/React.createElement("video", {
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: data.viewUrl,
274
- type: `audio/${getExtensionFromFileName(data.name)}`
331
+ src: viewUrl,
332
+ type: `audio/${getExtensionFromFileName(name)}`
275
333
  })) : null : /*#__PURE__*/React.createElement(AttachmentImage, {
276
- className: `${style.img} ${selectedIndex == i && maintainZoom ? isZoomed ? style.zoomedImg : style.normalImg : ''}`,
277
- src: selectedImgUrl,
278
- onClick: isZoomed ? _this.zoomOut.bind(_this, i) : e => {
279
- _this.zoomIn(e, i, true);
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
- alt: "Preview",
282
- dataId: "attachViewer",
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
- isImage: true,
285
- isCover: false
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
- const isAudio = isAudioFile(name);
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 : ''} ${isAudio ? style.isAudio : ''}`,
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
- className: style.image,
522
- isImage: !isAudio,
523
- dataId: "AttachmentImage"
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,