@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
@@ -9,10 +9,16 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
+ var _hooks = require("@zohodesk/hooks");
13
+
14
+ var _Layout = require("@zohodesk/components/es/Layout");
15
+
12
16
  var _defaultProps = require("./props/defaultProps");
13
17
 
14
18
  var _propTypes = require("./props/propTypes");
15
19
 
20
+ var _utils = require("../../AttachmentViewer/utils");
21
+
16
22
  var _Image = _interopRequireDefault(require("../Image/Image"));
17
23
 
18
24
  var _AttachmentViewerModule = _interopRequireDefault(require("../../AttachmentViewer/AttachmentViewer.module.css"));
@@ -36,51 +42,73 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
36
42
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
43
 
38
44
  var AttachmentImage = function AttachmentImage(props) {
39
- var isImage = props.isImage,
40
- onLoad = props.onLoad,
45
+ var onLoad = props.onLoad,
46
+ onError = props.onError,
41
47
  src = props.src,
42
48
  onClick = props.onClick,
43
49
  alt = props.alt,
44
50
  dataId = props.dataId,
45
51
  id = props.id,
46
- className = props.className,
47
- isCover = props.isCover;
48
- var imageEle = (0, _react.useRef)();
52
+ customClass = props.customClass,
53
+ isCover = props.isCover,
54
+ children = props.children;
55
+ var _customClass$customIm = customClass.customImageClass,
56
+ customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
57
+ _customClass$customCh = customClass.customChildrenClass,
58
+ customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
49
59
 
50
60
  var _useState = (0, _react.useState)(true),
51
61
  _useState2 = _slicedToArray(_useState, 2),
52
62
  isLoading = _useState2[0],
53
63
  setLoading = _useState2[1];
54
64
 
55
- var imgLoad = function imgLoad() {
56
- setLoading(false);
57
- onLoad && onLoad();
58
- };
65
+ var _useState3 = (0, _react.useState)(false),
66
+ _useState4 = _slicedToArray(_useState3, 2),
67
+ isImageValid = _useState4[0],
68
+ setImageValidity = _useState4[1];
59
69
 
60
- (0, _react.useEffect)(function () {
61
- if (isImage) {
62
- var image = imageEle.current;
63
- image.addEventListener('load', imgLoad);
64
- } else {
70
+ function handleImageValidation() {
71
+ (0, _utils.checkImageValidity)(src).then(function (isValid) {
72
+ setImageValidity(isValid);
65
73
  setLoading(false);
66
- }
74
+ });
75
+ }
76
+
77
+ (0, _react.useEffect)(function () {
78
+ handleImageValidation();
67
79
  }, []);
80
+ (0, _hooks.useEffectCallOnlyAfterState)(function () {
81
+ setLoading(true);
82
+ handleImageValidation();
83
+ }, [src]);
84
+
85
+ function renderImage() {
86
+ return /*#__PURE__*/_react["default"].createElement(_Image["default"], {
87
+ htmlId: id,
88
+ dataId: isImageValid ? dataId : "".concat(dataId, "_alt"),
89
+ src: src,
90
+ onClick: onClick,
91
+ className: customImageClass,
92
+ alt: alt,
93
+ isCover: isCover,
94
+ onLoad: onLoad,
95
+ onError: onError
96
+ });
97
+ }
98
+
68
99
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isLoading ? /*#__PURE__*/_react["default"].createElement("div", {
69
100
  className: "".concat(_AttachmentViewerModule["default"].spinLoad),
70
101
  "data-id": "".concat(dataId, "_loader"),
71
102
  "data-test-id": "".concat(dataId, "_loader")
72
103
  }, /*#__PURE__*/_react["default"].createElement("div", {
73
104
  className: _AttachmentViewerModule["default"].loader
74
- })) : null, /*#__PURE__*/_react["default"].createElement(_Image["default"], {
105
+ })) : isImageValid ? renderImage() : children ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
106
+ align: "both",
75
107
  htmlId: id,
76
- eleRef: imageEle,
77
- dataId: dataId,
78
- src: src,
79
- onClick: onClick,
80
- className: "".concat(isLoading ? _AttachmentViewerModule["default"].hide : '', " ").concat(className),
81
- alt: alt,
82
- isCover: isCover
83
- }));
108
+ dataId: "".concat(dataId, "_custom"),
109
+ className: customChildrenClass
110
+ }, children) : renderImage() //alt ui
111
+ );
84
112
  };
85
113
 
86
114
  AttachmentImage.propTypes = _propTypes.AttachmentImage_propTypes;
@@ -33,6 +33,10 @@ var _FreezeLayer = _interopRequireDefault(require("../FreezeLayer/FreezeLayer"))
33
33
 
34
34
  var _Attachment = require("../../AttachmentViewer/Attachment");
35
35
 
36
+ var _utils = require("../../AttachmentViewer/utils");
37
+
38
+ var _audio_thumbnail = _interopRequireDefault(require("../../../images/audio_thumbnail.png"));
39
+
36
40
  var _General = require("../../utils/General");
37
41
 
38
42
  var _AttachmentViewerModule = _interopRequireDefault(require("../../AttachmentViewer/AttachmentViewer.module.css"));
@@ -43,6 +47,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
43
47
 
44
48
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
49
 
50
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
51
+
46
52
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
47
53
 
48
54
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -95,7 +101,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
95
101
  index: _this.props.previewObj.selectedIndex,
96
102
  data: _this.props.previewObj ? _this.props.previewObj.previewData : [],
97
103
  dataList: []
98
- })
104
+ }),
105
+ canOpenInNewTab: false,
106
+ canZoom: false,
107
+ isPreviewAttachmentValid: false
99
108
  };
100
109
  _this.togglePViewList = _this.togglePViewList.bind(_assertThisInitialized(_this));
101
110
  _this.changeSelectedIndex = _this.changeSelectedIndex.bind(_assertThisInitialized(_this));
@@ -107,13 +116,20 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
107
116
  _this.getNextId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
108
117
  _this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
109
118
  _this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
119
+ _this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
110
120
  return _this;
111
121
  }
112
122
 
113
123
  _createClass(AttachmentViewer, [{
124
+ key: "componentDidMount",
125
+ value: function componentDidMount() {
126
+ this.handleMenuValidation();
127
+ }
128
+ }, {
114
129
  key: "componentDidUpdate",
115
- value: function componentDidUpdate(prevProps) {
130
+ value: function componentDidUpdate(prevProps, prevState) {
116
131
  var previewObj = this.props.previewObj;
132
+ var selectedIndex = this.state.selectedIndex;
117
133
  var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
118
134
 
119
135
  if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
@@ -134,18 +150,48 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
134
150
  });
135
151
  }
136
152
  }
153
+
154
+ if (prevState.selectedIndex != selectedIndex) {
155
+ this.handleMenuValidation();
156
+ }
157
+ }
158
+ }, {
159
+ key: "handleMenuValidation",
160
+ value: function handleMenuValidation() {
161
+ var _this2 = this;
162
+
163
+ var _this$state = this.state,
164
+ data = _this$state.data,
165
+ selectedIndex = _this$state.selectedIndex;
166
+ var selectedAttachment = data[selectedIndex] || {};
167
+ var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
168
+ var selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
169
+ var selectedAttachmentName = selectedAttachment.name;
170
+ (0, _utils.checkFileSourcesValidation)({
171
+ fileName: selectedAttachmentName,
172
+ viewURL: selectedAttachmentViewUrl
173
+ }).then(function (fileSourceValidation) {
174
+ var isViewURLValid = fileSourceValidation.isViewURLValid,
175
+ canZoom = fileSourceValidation.canZoom;
176
+
177
+ _this2.setState({
178
+ isPreviewAttachmentValid: isViewURLValid,
179
+ canZoom: canZoom,
180
+ canOpenInNewTab: isViewURLValid
181
+ });
182
+ });
137
183
  }
138
184
  }, {
139
185
  key: "togglePViewList",
140
186
  value: function togglePViewList() {
141
- var _this2 = this;
187
+ var _this3 = this;
142
188
 
143
189
  this.setState(function (prevState) {
144
190
  return {
145
191
  isPViewListOpen: !prevState.isPViewListOpen
146
192
  };
147
193
  }, function () {
148
- _this2.focusSelectedImg(_this2.state.selectedIndex);
194
+ _this3.focusSelectedImg(_this3.state.selectedIndex);
149
195
  });
150
196
  }
151
197
  }, {
@@ -153,13 +199,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
153
199
  value: function zoomOut(ele) {
154
200
  this.setState({
155
201
  isZoomed: false
156
- });
157
- var img = document.getElementById("img".concat(ele));
158
-
159
- if (img) {
160
- img.classList.remove(_AttachmentViewerModule["default"].zoomedImg);
161
- img.classList.add(_AttachmentViewerModule["default"].normalImg);
162
- }
202
+ }); // const img = document.getElementById(`img${ele}`);
203
+ // if (img) {
204
+ // img.classList.remove(style.zoomedImg);
205
+ // img.classList.add(style.normalImg);
206
+ // }
163
207
  }
164
208
  }, {
165
209
  key: "zoomIn",
@@ -191,12 +235,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
191
235
  top: 0,
192
236
  left: 0
193
237
  };
194
- }
238
+ } // if (img) {
239
+ // img.classList.remove(style.normalImg);
240
+ // img.classList.add(style.zoomedImg);
241
+ // }
195
242
 
196
- if (img) {
197
- img.classList.remove(_AttachmentViewerModule["default"].normalImg);
198
- img.classList.add(_AttachmentViewerModule["default"].zoomedImg);
199
- }
200
243
 
201
244
  if (moveToPosition) {
202
245
  imgContainer.scrollLeft = (event.pageX - imgContainerPosition.left - imgUnits.left) * imgRatio.width;
@@ -242,11 +285,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
242
285
  }, {
243
286
  key: "changeSelectedIndex",
244
287
  value: function changeSelectedIndex(index) {
245
- var _this3 = this;
288
+ var _this4 = this;
246
289
 
247
- var _this$state = this.state,
248
- data = _this$state.data,
249
- selectedIndex = _this$state.selectedIndex;
290
+ var _this$state2 = this.state,
291
+ data = _this$state2.data,
292
+ selectedIndex = _this$state2.selectedIndex;
250
293
  var maintainZoom = this.props.maintainZoom;
251
294
  maintainZoom ? this.zoomMaintain(index) : this.zoomOut(selectedIndex);
252
295
 
@@ -257,7 +300,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
257
300
  this.setState({
258
301
  selectedIndex: index
259
302
  }, function () {
260
- _this3.focusSelectedImg(index);
303
+ _this4.focusSelectedImg(index);
261
304
  });
262
305
  }
263
306
  }, {
@@ -292,12 +335,14 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
292
335
  }, {
293
336
  key: "imgPreviewView",
294
337
  value: function imgPreviewView() {
295
- var _this4 = this;
338
+ var _this5 = this;
296
339
 
297
- var _this$state2 = this.state,
298
- dataList = _this$state2.dataList,
299
- selectedIndex = _this$state2.selectedIndex,
300
- isZoomed = _this$state2.isZoomed;
340
+ var _this$state3 = this.state,
341
+ dataList = _this$state3.dataList,
342
+ selectedIndex = _this$state3.selectedIndex,
343
+ isZoomed = _this$state3.isZoomed,
344
+ canZoom = _this$state3.canZoom,
345
+ isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
301
346
  var _this$props = this.props,
302
347
  maintainZoom = _this$props.maintainZoom,
303
348
  dataId = _this$props.dataId;
@@ -330,7 +375,24 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
330
375
  return dataList.length && dataList.map(function () {
331
376
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
332
377
  var i = arguments.length > 1 ? arguments[1] : undefined;
333
- var selectedImgUrl = data.viewUrl;
378
+ var viewUrl = data.viewUrl,
379
+ name = data.name,
380
+ children = data.children,
381
+ _data$dataId = data.dataId,
382
+ dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
383
+ _data$customClass = data.customClass,
384
+ customClass = _data$customClass === void 0 ? {} : _data$customClass,
385
+ _data$customProps = data.customProps,
386
+ customProps = _data$customProps === void 0 ? {} : _data$customProps;
387
+ var _customProps$audioPro = customProps.audioProps,
388
+ audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
389
+ _customProps$imagePro = customProps.imageProps,
390
+ imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
391
+ var _customClass$customIm = customClass.customImageClass,
392
+ customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
393
+ _customClass$customCh = customClass.customChildrenClass,
394
+ customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
395
+ var retainZoom = canZoom && selectedIndex == i && maintainZoom;
334
396
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
335
397
  className: _AttachmentViewerModule["default"].imgBox,
336
398
  id: "imgBox".concat(i),
@@ -341,39 +403,43 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
341
403
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
342
404
  className: _AttachmentViewerModule["default"].imgRef,
343
405
  id: "imgPreviewRef".concat(i)
344
- }, (0, _Attachment.isAudioFile)(data.name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", {
406
+ }, (0, _Attachment.isAudioFile)(name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", _extends({
345
407
  autoPlay: true,
346
408
  controls: true,
347
409
  className: _AttachmentViewerModule["default"].zoomIn,
348
410
  "data-id": "".concat(dataId, "_videoPreview"),
349
411
  "data-test-id": "".concat(dataId, "_videoPreview")
350
- }, /*#__PURE__*/_react["default"].createElement("source", {
351
- src: data.viewUrl,
352
- type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(data.name))
353
- })) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
354
- className: "".concat(_AttachmentViewerModule["default"].img, " ").concat(selectedIndex == i && maintainZoom ? isZoomed ? _AttachmentViewerModule["default"].zoomedImg : _AttachmentViewerModule["default"].normalImg : ''),
355
- src: selectedImgUrl,
356
- onClick: isZoomed ? _this4.zoomOut.bind(_this4, i) : function (e) {
357
- _this4.zoomIn(e, i, true);
412
+ }, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
413
+ src: viewUrl,
414
+ type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(name))
415
+ })) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
416
+ customClass: {
417
+ customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "\n ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
418
+ customChildrenClass: customChildrenClass
358
419
  },
359
- alt: "Preview",
360
- dataId: "attachViewer",
420
+ src: viewUrl,
421
+ onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
422
+ _this5.zoomIn(e, i, true);
423
+ } : undefined,
424
+ alt: name,
425
+ dataId: dataId,
361
426
  id: "img".concat(i),
362
- isImage: true,
363
427
  isCover: false
364
- })));
428
+ }, imageProps), children)));
365
429
  });
366
430
  }
367
431
  }, {
368
432
  key: "render",
369
433
  value: function render() {
370
- var _this5 = this;
371
-
372
- var _this$state3 = this.state,
373
- isPViewListOpen = _this$state3.isPViewListOpen,
374
- selectedIndex = _this$state3.selectedIndex,
375
- data = _this$state3.data,
376
- isZoomed = _this$state3.isZoomed;
434
+ var _this6 = this;
435
+
436
+ var _this$state4 = this.state,
437
+ isPViewListOpen = _this$state4.isPViewListOpen,
438
+ selectedIndex = _this$state4.selectedIndex,
439
+ data = _this$state4.data,
440
+ isZoomed = _this$state4.isZoomed,
441
+ canZoom = _this$state4.canZoom,
442
+ canOpenInNewTab = _this$state4.canOpenInNewTab;
377
443
  var _this$props2 = this.props,
378
444
  responsiveId = _this$props2.responsiveId,
379
445
  needDownload = _this$props2.needDownload,
@@ -431,9 +497,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
431
497
  align: uptoTablet ? 'bottom' : 'center',
432
498
  wrap: "wrap",
433
499
  isCover: false
434
- }, isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
500
+ }, canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
435
501
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
436
- onClick: _this5.zoomOut.bind(_this5, selectedIndex),
502
+ onClick: _this6.zoomOut.bind(_this6, selectedIndex),
437
503
  "data-id": "zoomOut",
438
504
  "data-test-id": "zoomOut",
439
505
  "data-title": i18nKeys.zoomOutText
@@ -448,7 +514,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
448
514
  })) : /*#__PURE__*/_react["default"].createElement("div", {
449
515
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
450
516
  onClick: function onClick(e) {
451
- return _this5.zoomIn(e, selectedIndex);
517
+ return _this6.zoomIn(e, selectedIndex);
452
518
  },
453
519
  "data-id": "zoomIn",
454
520
  "data-test-id": "zoomIn",
@@ -461,7 +527,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
461
527
  a11y: {
462
528
  ariaLabel: i18nKeys.zoomInText
463
529
  }
464
- })), /*#__PURE__*/_react["default"].createElement("div", {
530
+ })) : null, canOpenInNewTab ? /*#__PURE__*/_react["default"].createElement("div", {
465
531
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
466
532
  }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
467
533
  href: selectedImgUrl,
@@ -477,7 +543,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
477
543
  a11y: {
478
544
  ariaLabel: i18nKeys.newTabText
479
545
  }
480
- }))), needDownload ? /*#__PURE__*/_react["default"].createElement("div", {
546
+ }))) : null, needDownload ? /*#__PURE__*/_react["default"].createElement("div", {
481
547
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
482
548
  }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
483
549
  href: downloadUrl,
@@ -497,7 +563,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
497
563
  }
498
564
  }))) : null, /*#__PURE__*/_react["default"].createElement("div", {
499
565
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
500
- onClick: _this5.closeAttachmentViewer,
566
+ onClick: _this6.closeAttachmentViewer,
501
567
  "data-id": "closeAttach",
502
568
  "data-test-id": "closeAttach",
503
569
  "data-title": i18nKeys.closeText
@@ -518,7 +584,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
518
584
  alignBox: "row"
519
585
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
520
586
  className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ''),
521
- onClick: _this5.changeSelectedIndex.bind(_this5, selectedIndex - 1),
587
+ onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex - 1),
522
588
  "data-title": i18nKeys.previousText,
523
589
  "data-title-position": "left"
524
590
  }, /*#__PURE__*/_react["default"].createElement("button", {
@@ -534,12 +600,12 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
534
600
  tabindex: "0",
535
601
  "aria-describedby": ariaId,
536
602
  isShrink: false,
537
- eleRef: _this5.setImgBoxRef,
603
+ eleRef: _this6.setImgBoxRef,
538
604
  scroll: "both",
539
605
  flexible: true
540
- }, _this5.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
606
+ }, _this6.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
541
607
  className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
542
- onClick: _this5.changeSelectedIndex.bind(_this5, selectedIndex + 1),
608
+ onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
543
609
  "data-title": i18nKeys.nextText,
544
610
  "data-title-position": "right"
545
611
  }, /*#__PURE__*/_react["default"].createElement("button", {
@@ -579,33 +645,48 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
579
645
  alignBox: "row",
580
646
  scroll: "horizontal",
581
647
  eleRef: function eleRef(el) {
582
- return _this5.imgListCont = el;
648
+ return _this6.imgListCont = el;
583
649
  },
584
650
  className: _AttachmentViewerModule["default"].listContainer
585
651
  }, data.map(function (item, index) {
586
652
  var name = item.name,
587
- viewUrl = item.viewUrl;
588
- var isAudio = (0, _Attachment.isAudioFile)(name);
653
+ viewUrl = item.viewUrl,
654
+ children = item.children,
655
+ _item$customClass = item.customClass,
656
+ customClass = _item$customClass === void 0 ? {} : _item$customClass,
657
+ _item$dataId = item.dataId,
658
+ dataId = _item$dataId === void 0 ? 'AttachmentImage' : _item$dataId,
659
+ _item$customProps = item.customProps,
660
+ customProps = _item$customProps === void 0 ? {} : _item$customProps;
661
+ var thumbnail = item.thumbnail;
662
+ var _customClass$customIm2 = customClass.customImageClass,
663
+ customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
664
+ _customClass$customCh2 = customClass.customChildrenClass,
665
+ customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
666
+ thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
667
+
589
668
  return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
590
- className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isAudio ? _AttachmentViewerModule["default"].isAudio : ''),
669
+ className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
591
670
  key: index,
592
- onClick: _this5.changeSelectedIndex.bind(_this5, index),
671
+ onClick: _this6.changeSelectedIndex.bind(_this6, index),
593
672
  eleRef: function eleRef(el) {
594
- return _this5["img_".concat(index)] = el;
673
+ return _this6["img_".concat(index)] = el;
595
674
  },
596
675
  dataId: "attachPreviewList",
597
676
  "data-title": name
598
- }, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
599
- src: viewUrl,
677
+ }, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
678
+ src: thumbnail || viewUrl,
600
679
  size: "small",
601
680
  alt: name,
602
- className: _AttachmentViewerModule["default"].image,
603
- isImage: !isAudio,
604
- dataId: "AttachmentImage"
605
- }));
681
+ customClass: {
682
+ customImageClass: "".concat(_AttachmentViewerModule["default"].image, " ").concat(_AttachmentViewerModule["default"].altText, " ").concat(customImageClass),
683
+ customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
684
+ },
685
+ dataId: dataId
686
+ }, customProps), children));
606
687
  }))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
607
688
  dataId: "attachToggle",
608
- onClick: _this5.togglePViewList,
689
+ onClick: _this6.togglePViewList,
609
690
  iconName: "ZD-GN-hideTab",
610
691
  iconSize: "14",
611
692
  hoverType: "border",
@@ -11,14 +11,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
11
11
 
12
12
  var AttachmentImage_propTypes = {
13
13
  alt: _propTypes["default"].string,
14
- className: _propTypes["default"].string,
14
+ customClass: _propTypes["default"].shape({
15
+ customImageClass: _propTypes["default"].string,
16
+ customChildrenClass: _propTypes["default"].string
17
+ }),
15
18
  dataId: _propTypes["default"].string,
16
19
  id: _propTypes["default"].string,
17
20
  isCover: _propTypes["default"].bool,
18
- isImage: _propTypes["default"].bool,
19
21
  onClick: _propTypes["default"].func,
20
22
  onLoad: _propTypes["default"].func,
21
- src: _propTypes["default"].string
23
+ onError: _propTypes["default"].func,
24
+ src: _propTypes["default"].string,
25
+ children: _propTypes["default"].node
22
26
  };
23
27
  exports.AttachmentImage_propTypes = AttachmentImage_propTypes;
24
28
  var AttachmentViewer_propTypes = {
@@ -25,7 +25,9 @@ function Image(props) {
25
25
  dataId = props.dataId,
26
26
  htmlId = props.htmlId,
27
27
  eleRef = props.eleRef,
28
- original = props.original;
28
+ original = props.original,
29
+ onLoad = props.onLoad,
30
+ onError = props.onError;
29
31
  return /*#__PURE__*/_react["default"].createElement("img", {
30
32
  src: src,
31
33
  alt: alt,
@@ -36,7 +38,9 @@ function Image(props) {
36
38
  onClick: onClick,
37
39
  id: htmlId,
38
40
  ref: eleRef,
39
- "data-original": original
41
+ "data-original": original,
42
+ onLoad: onLoad,
43
+ onError: onError
40
44
  });
41
45
  }
42
46
 
@@ -19,6 +19,8 @@ var propTypes = {
19
19
  onClick: _propTypes["default"].func,
20
20
  original: _propTypes["default"].string,
21
21
  src: _propTypes["default"].string.isRequired,
22
- title: _propTypes["default"].string
22
+ title: _propTypes["default"].string,
23
+ onLoad: _propTypes["default"].func,
24
+ onError: _propTypes["default"].func
23
25
  };
24
26
  exports.propTypes = propTypes;
@@ -109,6 +109,7 @@ function CurrencyField(props) {
109
109
  }
110
110
 
111
111
  var uniqueId = htmlId ? htmlId : getNextId();
112
+ var isFocusable = !needReadOnlyStyle || !isReadOnly && needReadOnlyStyle;
112
113
 
113
114
  function handleChange(value) {
114
115
  onChange && onChange(id, value);
@@ -160,7 +161,7 @@ function CurrencyField(props) {
160
161
  onChange: handleChange,
161
162
  dataId: dataId,
162
163
  onBlur: handleonBlur,
163
- onFocus: handleonFocus,
164
+ onFocus: isFocusable && handleonFocus,
164
165
  onKeyDown: onKeyDown,
165
166
  placeHolder: placeHolder,
166
167
  borderColor: borderColor,