@zohodesk/dot 1.0.0-beta.216 → 1.0.0-beta.219

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 (31) hide show
  1. package/README.md +8 -0
  2. package/assets/Appearance/dark/mode/dotDarkMode.module.css +10 -0
  3. package/assets/Appearance/dark/themes/blue/blueDarkDotTheme.module.css +6 -0
  4. package/assets/Appearance/dark/themes/green/greenDarkDotTheme.module.css +6 -0
  5. package/assets/Appearance/dark/themes/orange/orangeDarkDotTheme.module.css +6 -0
  6. package/assets/Appearance/dark/themes/red/redDarkDotTheme.module.css +6 -0
  7. package/assets/Appearance/dark/themes/yellow/yellowDarkDotTheme.module.css +6 -0
  8. package/assets/Appearance/default/mode/dotDefaultMode.module.css +10 -0
  9. package/assets/Appearance/default/themes/blue/blueDefaultDotTheme.module.css +6 -0
  10. package/assets/Appearance/default/themes/green/greenDefaultDotTheme.module.css +6 -0
  11. package/assets/Appearance/default/themes/orange/orangeDefaultDotTheme.module.css +6 -0
  12. package/assets/Appearance/default/themes/red/redDefaultDotTheme.module.css +6 -0
  13. package/assets/Appearance/default/themes/yellow/yellowDefaultDotTheme.module.css +6 -0
  14. package/es/AttachmentViewer/Attachment.js +17 -0
  15. package/es/AttachmentViewer/AttachmentImage.js +85 -0
  16. package/es/AttachmentViewer/AttachmentViewer.js +535 -0
  17. package/es/AttachmentViewer/AttachmentViewer.module.css +346 -0
  18. package/es/AttachmentViewer/utils.js +107 -0
  19. package/es/common/dot_animation.module.css +27 -0
  20. package/es/common/dot_common.module.css +4 -0
  21. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +7 -4
  22. package/images/audio_thumbnail.png +0 -0
  23. package/lib/AttachmentViewer/Attachment.js +28 -0
  24. package/lib/AttachmentViewer/AttachmentImage.js +129 -0
  25. package/lib/AttachmentViewer/AttachmentViewer.js +618 -0
  26. package/lib/AttachmentViewer/AttachmentViewer.module.css +346 -0
  27. package/lib/AttachmentViewer/utils.js +134 -0
  28. package/lib/common/dot_animation.module.css +27 -0
  29. package/lib/common/dot_common.module.css +4 -0
  30. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +7 -4
  31. package/package.json +15 -13
@@ -0,0 +1,618 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _Layout = require("@zohodesk/components/lib/Layout");
15
+
16
+ var _Icon = _interopRequireDefault(require("@zohodesk/icons/lib/Icon"));
17
+
18
+ var _Avatar = _interopRequireDefault(require("@zohodesk/components/lib/Avatar/Avatar"));
19
+
20
+ var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
21
+
22
+ var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
23
+
24
+ var _AttachmentImage = _interopRequireDefault(require("./AttachmentImage"));
25
+
26
+ var _Link = _interopRequireDefault(require("../Link/Link"));
27
+
28
+ var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
29
+
30
+ var _FreezeLayer = _interopRequireDefault(require("../FreezeLayer/FreezeLayer"));
31
+
32
+ var _Attachment = require("./Attachment");
33
+
34
+ var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
35
+
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
37
+
38
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
+
40
+ 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; }
41
+
42
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
43
+
44
+ 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."); }
45
+
46
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
47
+
48
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
49
+
50
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
51
+
52
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
53
+
54
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55
+
56
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
57
+
58
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
59
+
60
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
61
+
62
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
63
+
64
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
65
+
66
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
67
+
68
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
69
+
70
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
71
+
72
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
73
+
74
+ var AttachmentViewer = /*#__PURE__*/function (_Component) {
75
+ _inherits(AttachmentViewer, _Component);
76
+
77
+ var _super = _createSuper(AttachmentViewer);
78
+
79
+ function AttachmentViewer(props) {
80
+ var _this;
81
+
82
+ _classCallCheck(this, AttachmentViewer);
83
+
84
+ _this = _super.call(this, props);
85
+ _this.state = {
86
+ isPViewListOpen: !!(_this.props.previewObj && _this.props.previewObj.previewData),
87
+ selectedIndex: _this.props.previewObj.selectedIndex,
88
+ isZoomed: false,
89
+ data: _this.props.previewObj ? _this.props.previewObj.previewData : [],
90
+ dataList: _this.getUpdateDataList({
91
+ index: _this.props.previewObj.selectedIndex,
92
+ data: _this.props.previewObj ? _this.props.previewObj.previewData : [],
93
+ dataList: []
94
+ })
95
+ };
96
+ _this.togglePViewList = _this.togglePViewList.bind(_assertThisInitialized(_this));
97
+ _this.changeSelectedIndex = _this.changeSelectedIndex.bind(_assertThisInitialized(_this));
98
+ _this.closeAttachmentViewer = _this.closeAttachmentViewer.bind(_assertThisInitialized(_this));
99
+ _this.responsiveFunc = _this.responsiveFunc.bind(_assertThisInitialized(_this));
100
+ _this.zoomIn = _this.zoomIn.bind(_assertThisInitialized(_this));
101
+ _this.zoomOut = _this.zoomOut.bind(_assertThisInitialized(_this));
102
+ _this.imgPreviewView = _this.imgPreviewView.bind(_assertThisInitialized(_this));
103
+ _this.getNextId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
104
+ _this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
105
+ _this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
106
+ return _this;
107
+ }
108
+
109
+ _createClass(AttachmentViewer, [{
110
+ key: "togglePViewList",
111
+ value: function togglePViewList() {
112
+ var _this2 = this;
113
+
114
+ this.setState(function (prevState) {
115
+ return {
116
+ isPViewListOpen: !prevState.isPViewListOpen
117
+ };
118
+ }, function () {
119
+ _this2.focusSelectedImg(_this2.state.selectedIndex);
120
+ });
121
+ }
122
+ }, {
123
+ key: "zoomOut",
124
+ value: function zoomOut(ele) {
125
+ this.setState({
126
+ isZoomed: false
127
+ });
128
+ var img = document.getElementById("img".concat(ele));
129
+
130
+ if (img) {
131
+ img.classList.remove(_AttachmentViewerModule["default"].zoomedImg);
132
+ img.classList.add(_AttachmentViewerModule["default"].normalImg);
133
+ }
134
+ }
135
+ }, {
136
+ key: "zoomIn",
137
+ value: function zoomIn(event, ele) {
138
+ var moveToPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
139
+ this.setState({
140
+ isZoomed: true
141
+ });
142
+ var img = document.getElementById("img".concat(ele));
143
+ var ratio = 95;
144
+ var imgContainer, imgUnits, imgSize, imgRatio, imgContainerUnits, imgContainerPosition;
145
+
146
+ if (moveToPosition) {
147
+ imgContainer = document.getElementById("imgBox".concat(ele));
148
+ imgUnits = img.getBoundingClientRect();
149
+ imgSize = {
150
+ height: img.naturalHeight,
151
+ width: img.naturalWidth
152
+ };
153
+ imgRatio = {
154
+ height: Math.floor(imgSize.height / imgUnits.height / 100 * ratio),
155
+ width: Math.floor(imgSize.width / imgUnits.width / 100 * ratio)
156
+ };
157
+ imgContainerUnits = imgContainer.getBoundingClientRect();
158
+ imgContainerPosition = imgContainer ? {
159
+ top: imgContainerUnits.top,
160
+ left: imgContainerUnits.left
161
+ } : {
162
+ top: 0,
163
+ left: 0
164
+ };
165
+ }
166
+
167
+ if (img) {
168
+ img.classList.remove(_AttachmentViewerModule["default"].normalImg);
169
+ img.classList.add(_AttachmentViewerModule["default"].zoomedImg);
170
+ }
171
+
172
+ if (moveToPosition) {
173
+ imgContainer.scrollLeft = (event.pageX - imgContainerPosition.left - imgUnits.left) * imgRatio.width;
174
+ imgContainer.scrollTop = (event.pageY - imgContainerPosition.top - imgUnits.top) * imgRatio.height;
175
+ }
176
+ }
177
+ }, {
178
+ key: "zoomMaintain",
179
+ value: function zoomMaintain(selectedIndex) {
180
+ var isZoomed = this.state.isZoomed;
181
+ isZoomed ? this.zoomIn({}, selectedIndex) : this.zoomOut(selectedIndex);
182
+ }
183
+ }, {
184
+ key: "getUpdateDataList",
185
+ value: function getUpdateDataList(_ref) {
186
+ var index = _ref.index,
187
+ data = _ref.data,
188
+ dataList = _ref.dataList;
189
+ data = data || this.state.data;
190
+ dataList = dataList || this.state.dataList;
191
+
192
+ var finalDataList = _toConsumableArray(dataList);
193
+
194
+ if (index >= finalDataList.length) {
195
+ for (var i = dataList.length; i <= index; i++) {
196
+ finalDataList.push(data.slice(i)[0]);
197
+ }
198
+ } else if (index + 1 === finalDataList.length && index + 1 < data.length) {
199
+ finalDataList.push(data.slice(index + 1)[0]);
200
+ }
201
+
202
+ return finalDataList;
203
+ }
204
+ }, {
205
+ key: "updateDataList",
206
+ value: function updateDataList(index) {
207
+ this.setState({
208
+ dataList: this.getUpdateDataList({
209
+ index: index
210
+ })
211
+ });
212
+ }
213
+ }, {
214
+ key: "changeSelectedIndex",
215
+ value: function changeSelectedIndex(index) {
216
+ var _this3 = this;
217
+
218
+ var _this$state = this.state,
219
+ data = _this$state.data,
220
+ selectedIndex = _this$state.selectedIndex;
221
+ var maintainZoom = this.props.maintainZoom;
222
+ maintainZoom ? this.zoomMaintain(index) : this.zoomOut(selectedIndex);
223
+
224
+ if (index <= data.length - 1) {
225
+ this.updateDataList(index);
226
+ }
227
+
228
+ this.setState({
229
+ selectedIndex: index
230
+ }, function () {
231
+ _this3.focusSelectedImg(index);
232
+ });
233
+ }
234
+ }, {
235
+ key: "focusSelectedImg",
236
+ value: function focusSelectedImg(index) {
237
+ var ele = this["img_".concat(index)];
238
+
239
+ if (ele) {
240
+ var cont = this.imgListCont;
241
+ cont.scrollLeft = ele.offsetLeft;
242
+ }
243
+ }
244
+ }, {
245
+ key: "closeAttachmentViewer",
246
+ value: function closeAttachmentViewer() {
247
+ this.setState({
248
+ isPViewListOpen: false,
249
+ isZoomed: false
250
+ });
251
+ this.props.hideAttachmentViewer();
252
+ }
253
+ }, {
254
+ key: "responsiveFunc",
255
+ value: function responsiveFunc(_ref2) {
256
+ var mediaQueryOR = _ref2.mediaQueryOR;
257
+ return {
258
+ uptoTablet: mediaQueryOR([{
259
+ maxWidth: 768
260
+ }])
261
+ };
262
+ }
263
+ }, {
264
+ key: "imgPreviewView",
265
+ value: function imgPreviewView() {
266
+ var _this4 = this;
267
+
268
+ var _this$state2 = this.state,
269
+ dataList = _this$state2.dataList,
270
+ selectedIndex = _this$state2.selectedIndex,
271
+ isZoomed = _this$state2.isZoomed;
272
+ var maintainZoom = this.props.maintainZoom;
273
+
274
+ var getImgStyle = function getImgStyle(i) {
275
+ var position;
276
+
277
+ if (selectedIndex < i) {
278
+ position = (i - selectedIndex) * 100;
279
+ return {
280
+ transform: "translateX(".concat(parseInt(position), "%)"),
281
+ opacity: "0"
282
+ };
283
+ }
284
+
285
+ if (i === selectedIndex) {
286
+ return {
287
+ transform: "translateX(0%)",
288
+ opacity: "1"
289
+ };
290
+ }
291
+
292
+ position = (selectedIndex - i) * 100 * -1;
293
+ return {
294
+ transform: "translateX(".concat(parseInt(position), "%)"),
295
+ opacity: "0"
296
+ };
297
+ };
298
+
299
+ return dataList.length && dataList.map(function () {
300
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
301
+ var i = arguments.length > 1 ? arguments[1] : undefined;
302
+ var selectedImgUrl = data.viewUrl;
303
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
304
+ className: _AttachmentViewerModule["default"].imgBox,
305
+ id: "imgBox".concat(i),
306
+ key: i,
307
+ alignBox: "row",
308
+ align: "both",
309
+ style: getImgStyle(i)
310
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
311
+ className: _AttachmentViewerModule["default"].imgRef,
312
+ id: "imgPreviewRef".concat(i)
313
+ }, (0, _Attachment.isAudioFile)(data.name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", {
314
+ autoPlay: true,
315
+ controls: true,
316
+ className: _AttachmentViewerModule["default"].zoomIn
317
+ }, /*#__PURE__*/_react["default"].createElement("source", {
318
+ src: data.viewUrl,
319
+ type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(data.name))
320
+ })) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
321
+ className: "".concat(_AttachmentViewerModule["default"].img, " ").concat(selectedIndex == i && maintainZoom ? isZoomed ? _AttachmentViewerModule["default"].zoomedImg : _AttachmentViewerModule["default"].normalImg : ""),
322
+ src: selectedImgUrl,
323
+ onClick: isZoomed ? _this4.zoomOut.bind(_this4, i) : function (e) {
324
+ _this4.zoomIn(e, i, true);
325
+ },
326
+ alt: "Preview",
327
+ dataId: "attachViewed",
328
+ id: "img".concat(i),
329
+ isImage: true,
330
+ isCover: false
331
+ })));
332
+ });
333
+ }
334
+ }, {
335
+ key: "render",
336
+ value: function render() {
337
+ var _this5 = this;
338
+
339
+ var _this$state3 = this.state,
340
+ isPViewListOpen = _this$state3.isPViewListOpen,
341
+ selectedIndex = _this$state3.selectedIndex,
342
+ data = _this$state3.data,
343
+ isZoomed = _this$state3.isZoomed;
344
+ var _this$props = this.props,
345
+ responsiveId = _this$props.responsiveId,
346
+ needDownload = _this$props.needDownload,
347
+ i18nKeys = _this$props.i18nKeys,
348
+ isActive = _this$props.isActive;
349
+ var totalLen = data.length;
350
+ var selectedAttachment = data[selectedIndex] || {};
351
+ var selectedImgUrl = selectedAttachment.viewUrl;
352
+ var downloadUrl = selectedAttachment.downloadUrl;
353
+ var authorHref;
354
+ var authorName;
355
+
356
+ var _ref3 = data[selectedIndex] ? data[selectedIndex] : {},
357
+ author = _ref3.author;
358
+
359
+ if (author) {
360
+ authorHref = author.href;
361
+ authorName = author.name;
362
+ }
363
+
364
+ var ariaId = this.getNextId();
365
+ return /*#__PURE__*/_react["default"].createElement(_FreezeLayer["default"], {
366
+ isActive: isActive && totalLen >= 1,
367
+ palette: "dark",
368
+ animationName: "expand"
369
+ }, /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
370
+ responsiveId: responsiveId,
371
+ query: this.responsiveFunc
372
+ }, function (_ref4) {
373
+ var uptoTablet = _ref4.uptoTablet;
374
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
375
+ scroll: "none",
376
+ "data-scroll-palette": "dark"
377
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
378
+ alignBox: "row",
379
+ className: _AttachmentViewerModule["default"].header,
380
+ align: "between",
381
+ tabindex: "0"
382
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
383
+ shrink: true,
384
+ className: _AttachmentViewerModule["default"].title,
385
+ "data-title": selectedAttachment.name,
386
+ dataId: "attachName",
387
+ id: ariaId
388
+ }, selectedAttachment.name), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
389
+ flexible: true,
390
+ className: _AttachmentViewerModule["default"].count,
391
+ dataId: "attachCountContainer"
392
+ }, selectedIndex + 1, "/", totalLen), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
393
+ className: uptoTablet ? _AttachmentViewerModule["default"].mbleMenuBar : _AttachmentViewerModule["default"].menuBar
394
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
395
+ isInline: true,
396
+ alignBox: uptoTablet ? "column-reverse" : "row",
397
+ align: uptoTablet ? "bottom" : "center",
398
+ wrap: "wrap",
399
+ isCover: false
400
+ }, isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
401
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
402
+ onClick: _this5.zoomOut.bind(_this5, selectedIndex),
403
+ "data-id": "zoomOut",
404
+ "data-title": i18nKeys.zoomOutText
405
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
406
+ iconName: "ZD-GN-zoomOut",
407
+ className: _AttachmentViewerModule["default"].menuIcon,
408
+ iconSize: "16",
409
+ hoverType: "border",
410
+ a11y: {
411
+ ariaLabel: i18nKeys.zoomOutText
412
+ }
413
+ })) : /*#__PURE__*/_react["default"].createElement("div", {
414
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
415
+ onClick: function onClick(e) {
416
+ return _this5.zoomIn(e, selectedIndex);
417
+ },
418
+ "data-id": "zoomIn",
419
+ "data-title": i18nKeys.zoomInText
420
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
421
+ iconName: "ZD-GN-zoomIn",
422
+ className: _AttachmentViewerModule["default"].menuIcon,
423
+ iconSize: "16",
424
+ hoverType: "border",
425
+ a11y: {
426
+ ariaLabel: i18nKeys.zoomInText
427
+ }
428
+ })), /*#__PURE__*/_react["default"].createElement("div", {
429
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
430
+ }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
431
+ href: selectedImgUrl,
432
+ target: "_blank",
433
+ dataId: "newTabAttach",
434
+ title: i18nKeys.newTabText
435
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
436
+ iconName: "ZD-GN-newLink",
437
+ className: _AttachmentViewerModule["default"].menuIcon,
438
+ iconSize: "16",
439
+ hoverType: "border",
440
+ needButtonTag: false,
441
+ a11y: {
442
+ ariaLabel: i18nKeys.newTabText
443
+ }
444
+ }))), needDownload ? /*#__PURE__*/_react["default"].createElement("div", {
445
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
446
+ }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
447
+ href: downloadUrl,
448
+ target: "_parent",
449
+ hasReload: true,
450
+ download: true,
451
+ title: i18nKeys.downloadText
452
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
453
+ iconName: "ZD-GN-download",
454
+ className: _AttachmentViewerModule["default"].menuIcon,
455
+ iconSize: "16",
456
+ hoverType: "border",
457
+ needButtonTag: false,
458
+ a11y: {
459
+ ariaLabel: i18nKeys.downloadText
460
+ }
461
+ }))) : null, /*#__PURE__*/_react["default"].createElement("div", {
462
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
463
+ onClick: _this5.closeAttachmentViewer,
464
+ "data-id": "closeAttach",
465
+ "data-title": i18nKeys.closeText
466
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
467
+ iconName: "ZD-cross",
468
+ iconSize: "15",
469
+ hoverType: "border",
470
+ className: _AttachmentViewerModule["default"].menuIcon,
471
+ a11y: {
472
+ ariaLabel: i18nKeys.closeText
473
+ },
474
+ title: i18nKeys.closeText
475
+ })))))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
476
+ flexible: true,
477
+ role: "toolbar",
478
+ tabindex: "0"
479
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
480
+ alignBox: "row"
481
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
482
+ className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ""),
483
+ onClick: _this5.changeSelectedIndex.bind(_this5, selectedIndex - 1),
484
+ "data-title": i18nKeys.previousText,
485
+ "data-title-position": "left"
486
+ }, /*#__PURE__*/_react["default"].createElement("button", {
487
+ className: _AttachmentViewerModule["default"].btn,
488
+ "aria-label": i18nKeys.previousText
489
+ }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
490
+ name: "ZD-arrowLeft3",
491
+ iconClass: _AttachmentViewerModule["default"].arrow,
492
+ dataId: "leftAttachNav",
493
+ isBold: true
494
+ }))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
495
+ className: _AttachmentViewerModule["default"].previewBox,
496
+ role: "option",
497
+ tabindex: "0",
498
+ "aria-describedby": ariaId,
499
+ isShrink: false,
500
+ eleRef: _this5.setImgBoxRef,
501
+ scroll: "both",
502
+ flexible: true
503
+ }, _this5.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
504
+ className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ""),
505
+ onClick: _this5.changeSelectedIndex.bind(_this5, selectedIndex + 1),
506
+ "data-title": i18nKeys.nextText,
507
+ "data-title-position": "right"
508
+ }, /*#__PURE__*/_react["default"].createElement("button", {
509
+ className: _AttachmentViewerModule["default"].btn,
510
+ "aria-label": i18nKeys.nextText
511
+ }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
512
+ name: "ZD-arrowRight3",
513
+ iconClass: _AttachmentViewerModule["default"].arrow,
514
+ dataId: "rightAttachNav",
515
+ isBold: true
516
+ }))))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
517
+ className: "".concat(_AttachmentViewerModule["default"].footer, " ").concat(isPViewListOpen && totalLen !== 1 ? _AttachmentViewerModule["default"].footerHeight : _AttachmentViewerModule["default"].footerHide, " ")
518
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
519
+ align: "vertical",
520
+ alignBox: "row",
521
+ className: _AttachmentViewerModule["default"].footerHeight
522
+ }, author && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
523
+ className: _AttachmentViewerModule["default"].author
524
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
525
+ alignBox: "row",
526
+ align: "both"
527
+ }, /*#__PURE__*/_react["default"].createElement(_Avatar["default"], {
528
+ name: authorName,
529
+ size: "xmedium",
530
+ src: authorHref,
531
+ palette: "info"
532
+ }), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
533
+ flexible: true,
534
+ className: _AttachmentViewerModule["default"].authorName,
535
+ "data-title": authorName
536
+ }, authorName))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
537
+ flexible: true
538
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
539
+ align: "vertical",
540
+ alignBox: "row",
541
+ scroll: "horizontal",
542
+ eleRef: function eleRef(el) {
543
+ return _this5.imgListCont = el;
544
+ },
545
+ className: _AttachmentViewerModule["default"].listContainer
546
+ }, data.map(function (item, index) {
547
+ var name = item.name,
548
+ viewUrl = item.viewUrl;
549
+ var isAudio = (0, _Attachment.isAudioFile)(name);
550
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
551
+ className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : "", " ").concat(isAudio ? _AttachmentViewerModule["default"].isAudio : ""),
552
+ key: index,
553
+ onClick: _this5.changeSelectedIndex.bind(_this5, index),
554
+ eleRef: function eleRef(el) {
555
+ return _this5["img_".concat(index)] = el;
556
+ },
557
+ dataId: "attachPreviewList",
558
+ "data-title": name
559
+ }, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
560
+ src: viewUrl,
561
+ size: "small",
562
+ alt: name,
563
+ className: _AttachmentViewerModule["default"].image,
564
+ isImage: !isAudio
565
+ }));
566
+ }))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
567
+ dataId: "attachToggle",
568
+ onClick: _this5.togglePViewList,
569
+ iconName: "ZD-GN-hideTab",
570
+ iconSize: "14",
571
+ hoverType: "border",
572
+ iconClass: "".concat(_AttachmentViewerModule["default"].thumpIcon, " ").concat(isPViewListOpen ? _AttachmentViewerModule["default"].thumpIconActive : ""),
573
+ className: _AttachmentViewerModule["default"].button,
574
+ a11y: {
575
+ ariaLabel: i18nKeys.hideText
576
+ },
577
+ title: isPViewListOpen ? i18nKeys.hideText : i18nKeys.showText
578
+ }));
579
+ }));
580
+ }
581
+ }]);
582
+
583
+ return AttachmentViewer;
584
+ }(_react.Component);
585
+
586
+ exports["default"] = AttachmentViewer;
587
+ AttachmentViewer.propTypes = {
588
+ hideAttachmentViewer: _propTypes["default"].func,
589
+ i18nKeys: _propTypes["default"].shape({
590
+ nextText: _propTypes["default"].string,
591
+ previousText: _propTypes["default"].string,
592
+ zoomOutText: _propTypes["default"].string,
593
+ zoomInText: _propTypes["default"].string,
594
+ newTabText: _propTypes["default"].string,
595
+ downloadText: _propTypes["default"].string,
596
+ closeText: _propTypes["default"].string,
597
+ hideText: _propTypes["default"].string,
598
+ showText: _propTypes["default"].string
599
+ }),
600
+ needDownload: _propTypes["default"].string,
601
+ previewObj: _propTypes["default"].object,
602
+ responsiveId: _propTypes["default"].string,
603
+ maintainZoom: _propTypes["default"].bool,
604
+ isActive: _propTypes["default"].bool
605
+ };
606
+ AttachmentViewer.defaultProps = {
607
+ responsiveId: "Helmet",
608
+ needDownload: true,
609
+ i18nKeys: {},
610
+ maintainZoom: false,
611
+ isActive: false
612
+ };
613
+
614
+ if (false) {
615
+ AttachmentViewer.docs = {
616
+ componentGroup: "Molecule"
617
+ };
618
+ }