@zohodesk/dot 1.0.0-temp-232 → 1.0.0-temp-230.4

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 (67) hide show
  1. package/README.md +14 -2
  2. package/es/ActionButton/__tests__/ActionButton.spec.js +5 -4
  3. package/es/AttachmentViewer/AttachmentImage.js +3 -1
  4. package/es/AttachmentViewer/AttachmentViewer.js +340 -265
  5. package/es/AttachmentViewer/AttachmentViewer.module.css +8 -15
  6. package/es/AttachmentViewer/__tests__/AttachmentViewer.spec.js +104 -100
  7. package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +778 -1
  8. package/es/AttachmentViewer/props/defaultProps.js +4 -2
  9. package/es/AttachmentViewer/props/propTypes.js +9 -2
  10. package/es/AttachmentViewer/utils.js +7 -6
  11. package/es/AudioPlayer/utils/utils.js +5 -2
  12. package/es/DotProvider/hooks/useDotProvider.js +15 -14
  13. package/es/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +16 -21
  14. package/es/DotProvider/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +4 -3
  15. package/es/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +5 -4
  16. package/es/DotProvider/utils/errorValidation.js +6 -5
  17. package/es/DotProvider/utils/getAssetsImportPromises.js +5 -4
  18. package/es/Drawer/Drawer.js +8 -6
  19. package/es/FreezeLayer/css/cssJSLogic.js +5 -4
  20. package/es/Hooks/Dragger/useDragger.js +6 -5
  21. package/es/Hooks/Dragger/utils/DraggerUtil.js +8 -7
  22. package/es/Hooks/useFreezeLayer.js +5 -4
  23. package/es/Link/Link.js +4 -3
  24. package/es/Link/props/propTypes.js +1 -0
  25. package/es/Onboarding/CarouselDots/CarouselDots.js +32 -29
  26. package/es/Onboarding/Onboarding.js +24 -23
  27. package/es/Onboarding/hooks/useOnboarding.js +5 -4
  28. package/es/Onboarding/hooks/useOnboardingSlider.js +6 -5
  29. package/es/deprecated/SelectDropdown/SelectDropdown.js +47 -43
  30. package/es/dropdown/ToggleDropDown/ToggleDropDown.js +225 -214
  31. package/es/errorstate/Inconvenience/Inconvenience.js +36 -32
  32. package/es/errorstate/NoRequestFound/NoRequestFound.js +36 -32
  33. package/es/errorstate/PermissionPlay/PermissionPlay.js +35 -31
  34. package/es/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +36 -32
  35. package/es/errorstate/UnableToProcess/UnableToProcess.js +36 -32
  36. package/es/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +36 -32
  37. package/es/errorstate/WillBack/WillBack.js +34 -30
  38. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +85 -81
  39. package/es/list/status/StatusDropdown/StatusDropdown.js +113 -109
  40. package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +4 -3
  41. package/es/lookup/header/Search/Search.js +5 -4
  42. package/es/lookup/header/Search/__tests__/Search.spec.js +4 -3
  43. package/es/lookup/header/ViewDropDown/ViewDropDown.js +75 -67
  44. package/es/utils/General.js +7 -2
  45. package/es/utils/editorUtils.js +5 -1
  46. package/es/version2/lookup/AlertHeader/AlertHeader.js +3 -5
  47. package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +0 -24
  48. package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +0 -34
  49. package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +5 -4
  50. package/es/version2/lookup/AlertHeader/props/propTypes.js +1 -2
  51. package/es/version2/notification/DesktopNotification/DesktopNotification.js +63 -59
  52. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +44 -40
  53. package/lib/AttachmentViewer/AttachmentImage.js +3 -1
  54. package/lib/AttachmentViewer/AttachmentViewer.js +164 -97
  55. package/lib/AttachmentViewer/AttachmentViewer.module.css +8 -15
  56. package/lib/AttachmentViewer/__tests__/AttachmentViewer.spec.js +100 -100
  57. package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +778 -1
  58. package/lib/AttachmentViewer/props/defaultProps.js +6 -2
  59. package/lib/AttachmentViewer/props/propTypes.js +9 -2
  60. package/lib/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +3 -9
  61. package/lib/Link/Link.js +4 -3
  62. package/lib/Link/props/propTypes.js +1 -0
  63. package/lib/version2/lookup/AlertHeader/AlertHeader.js +2 -5
  64. package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +0 -26
  65. package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +0 -34
  66. package/lib/version2/lookup/AlertHeader/props/propTypes.js +1 -2
  67. package/package.json +5 -5
@@ -4,7 +4,7 @@ import React, { Component } from 'react';
4
4
  import { AttachmentViewer_defaultProps } from "./props/defaultProps";
5
5
  import { AttachmentViewer_propTypes } from "./props/propTypes";
6
6
  import { Container, Box } from '@zohodesk/components/es/Layout';
7
- import { Icon } from '@zohodesk/icons';
7
+ import Icon from '@zohodesk/icons/es/Icon';
8
8
  import Avatar from '@zohodesk/components/es/Avatar/Avatar';
9
9
  import { ResponsiveReceiver } from '@zohodesk/components/es/Responsive/CustomResponsive';
10
10
  import Typography from '@zohodesk/components/es/Typography/Typography';
@@ -14,6 +14,8 @@ import AttachmentImage from "./AttachmentImage";
14
14
  import Link from "../Link/Link";
15
15
  import IconButton from "../IconButton/IconButton";
16
16
  import FreezeLayer from "../FreezeLayer/FreezeLayer";
17
+ import { renderNode } from '@zohodesk/utils';
18
+ import { DUMMY_OBJECT } from "../utils/General";
17
19
  import { getExtensionFromFileName, getAttachmentIconDetails } from "./Attachment";
18
20
  import { shallowDiff } from "../utils/General";
19
21
  import { checkFileSourcesValidation, FILE_EXTENSIONS } from "./utils";
@@ -48,6 +50,8 @@ export default class AttachmentViewer extends Component {
48
50
  this.handleMenuValidation = this.handleMenuValidation.bind(this);
49
51
  this.getPreviewIconData = this.getPreviewIconData.bind(this);
50
52
  this.renderIframe = this.renderIframe.bind(this);
53
+ this.getRenderImageFrameCustomClass = this.getRenderImageFrameCustomClass.bind(this);
54
+ this.renderImageFrame = this.renderImageFrame.bind(this);
51
55
  }
52
56
 
53
57
  isImageFileType(fileName) {
@@ -74,16 +78,19 @@ export default class AttachmentViewer extends Component {
74
78
 
75
79
  componentDidUpdate(prevProps, prevState) {
76
80
  let {
77
- previewObj
81
+ previewObj,
82
+ onSelectedAttachmentChange
78
83
  } = this.props;
79
84
  const {
80
- selectedIndex
85
+ selectedIndex,
86
+ data
81
87
  } = this.state;
82
88
  let indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
89
+ const attachmentPreviewUrlChanged = previewObj.previewData.some((value, index) => value?.viewUrl !== prevState.data[index]?.viewUrl); // Triggers an update if any previewed attachment is edited by the Attachment Annotator.
83
90
 
84
- if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
91
+ if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
85
92
  let objChanged = previewObj.previewData.some((value, index) => {
86
- return shallowDiff(value, prevProps.previewObj[index]);
93
+ return shallowDiff(value, prevProps.previewObj.previewData[index]);
87
94
  });
88
95
 
89
96
  if (objChanged || indexChanged) {
@@ -100,7 +107,11 @@ export default class AttachmentViewer extends Component {
100
107
  }
101
108
  }
102
109
 
103
- if (prevState.selectedIndex != selectedIndex) {
110
+ if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
111
+ onSelectedAttachmentChange && onSelectedAttachmentChange({
112
+ data: data[selectedIndex] || DUMMY_OBJECT,
113
+ selectedIndex
114
+ });
104
115
  this.handleMenuValidation();
105
116
  }
106
117
  }
@@ -113,7 +124,7 @@ export default class AttachmentViewer extends Component {
113
124
  const {
114
125
  allowedPreviewExtensionsData
115
126
  } = this.props;
116
- const selectedAttachment = data[selectedIndex] || {};
127
+ const selectedAttachment = data[selectedIndex] || DUMMY_OBJECT;
117
128
  const selectedAttachmentViewUrl = selectedAttachment.viewUrl; // const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
118
129
 
119
130
  const selectedAttachmentName = selectedAttachment.name;
@@ -154,7 +165,8 @@ export default class AttachmentViewer extends Component {
154
165
  // }
155
166
  }
156
167
 
157
- zoomIn(event, ele, moveToPosition = false) {
168
+ zoomIn(event, ele) {
169
+ let moveToPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
158
170
  this.setState({
159
171
  isZoomed: true
160
172
  });
@@ -200,11 +212,12 @@ export default class AttachmentViewer extends Component {
200
212
  isZoomed ? this.zoomIn({}, selectedIndex) : this.zoomOut(selectedIndex);
201
213
  }
202
214
 
203
- getUpdateDataList({
204
- index,
205
- data,
206
- dataList
207
- }) {
215
+ getUpdateDataList(_ref) {
216
+ let {
217
+ index,
218
+ data,
219
+ dataList
220
+ } = _ref;
208
221
  data = data || this.state.data;
209
222
  dataList = dataList || this.state.dataList;
210
223
  const finalDataList = [...dataList];
@@ -266,9 +279,10 @@ export default class AttachmentViewer extends Component {
266
279
  this.props.hideAttachmentViewer();
267
280
  }
268
281
 
269
- responsiveFunc({
270
- mediaQueryOR
271
- }) {
282
+ responsiveFunc(_ref2) {
283
+ let {
284
+ mediaQueryOR
285
+ } = _ref2;
272
286
  return {
273
287
  uptoTablet: mediaQueryOR([{
274
288
  maxWidth: 768
@@ -305,16 +319,82 @@ export default class AttachmentViewer extends Component {
305
319
  }, this.props.customProps.iframeProps));
306
320
  }
307
321
 
308
- imgPreviewView(downloadUrl) {
322
+ getRenderImageFrameCustomClass() {
309
323
  const {
310
- dataList,
311
324
  selectedIndex,
312
325
  isZoomed,
313
326
  canZoom,
327
+ data
328
+ } = this.state;
329
+ const {
330
+ maintainZoom
331
+ } = this.props;
332
+ const selectedData = data[selectedIndex] || DUMMY_OBJECT;
333
+ const {
334
+ customClass = DUMMY_OBJECT
335
+ } = selectedData;
336
+ const {
337
+ customImageClass = '',
338
+ customChildrenClass = ''
339
+ } = customClass;
340
+ const retainZoom = canZoom && maintainZoom;
341
+ return {
342
+ customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
343
+ customChildrenClass
344
+ };
345
+ }
346
+
347
+ renderImageFrame() {
348
+ const {
349
+ selectedIndex,
350
+ isZoomed,
314
351
  isPreviewAttachmentValid
315
352
  } = this.state;
316
353
  const {
317
- maintainZoom,
354
+ renderCustomImagePreviewElement
355
+ } = this.props;
356
+ const data = this.state.data[selectedIndex] || DUMMY_OBJECT;
357
+ const {
358
+ viewUrl,
359
+ name,
360
+ children,
361
+ dataId = 'attachViewer',
362
+ customProps = DUMMY_OBJECT,
363
+ imageRef
364
+ } = data;
365
+ const {
366
+ imageProps = DUMMY_OBJECT
367
+ } = customProps;
368
+ const resolvedImageRef = imageRef;
369
+ const handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, selectedIndex) : undefined;
370
+ const handleZoomIn = isPreviewAttachmentValid && !isZoomed ? e => this.zoomIn(e, selectedIndex, true) : undefined;
371
+ const handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
372
+ const imageFrameCustomClass = this.getRenderImageFrameCustomClass();
373
+ const img = /*#__PURE__*/React.createElement(AttachmentImage, _extends({
374
+ customClass: imageFrameCustomClass,
375
+ src: viewUrl,
376
+ onClick: handleImageClick,
377
+ alt: name,
378
+ dataId: dataId,
379
+ id: `img${selectedIndex}`,
380
+ isCover: false,
381
+ imageRef: resolvedImageRef
382
+ }, imageProps), children);
383
+ return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
384
+ defaultView: img,
385
+ data,
386
+ index: selectedIndex
387
+ }) : img;
388
+ }
389
+
390
+ imgPreviewView(downloadUrl) {
391
+ var _this = this;
392
+
393
+ const {
394
+ dataList,
395
+ selectedIndex
396
+ } = this.state;
397
+ const {
318
398
  dataId,
319
399
  i18nKeys,
320
400
  renderUnSupportedElement
@@ -345,27 +425,22 @@ export default class AttachmentViewer extends Component {
345
425
  };
346
426
  };
347
427
 
348
- return dataList.length && dataList.map((data = {}, i) => {
428
+ return dataList.length && dataList.map(function () {
429
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
430
+ let i = arguments.length > 1 ? arguments[1] : undefined;
349
431
  const {
350
432
  viewUrl,
351
433
  name,
352
434
  children,
353
435
  dataId = 'attachViewer',
354
- customClass = {},
355
436
  customProps = {},
356
437
  previewurl,
357
438
  type
358
439
  } = data;
359
440
  const {
360
441
  audioProps = {},
361
- imageProps = {},
362
442
  videoProps = {}
363
443
  } = customProps;
364
- const {
365
- customImageClass = '',
366
- customChildrenClass = ''
367
- } = customClass;
368
- const retainZoom = canZoom && selectedIndex == i && maintainZoom;
369
444
  const extension = getExtensionFromFileName(name);
370
445
  const {
371
446
  previewUnsupportedText = "Preview not available for the selected file type.",
@@ -381,7 +456,7 @@ export default class AttachmentViewer extends Component {
381
456
  }, /*#__PURE__*/React.createElement(Box, {
382
457
  className: style.imgRef,
383
458
  id: `imgPreviewRef${i}`
384
- }, selectedIndex == i && /*#__PURE__*/React.createElement(React.Fragment, null, this.isAudioFileType(name) ? /*#__PURE__*/React.createElement("audio", _extends({
459
+ }, selectedIndex == i && /*#__PURE__*/React.createElement(React.Fragment, null, _this.isAudioFileType(name) ? /*#__PURE__*/React.createElement("audio", _extends({
385
460
  controls: true,
386
461
  className: style.zoomIn,
387
462
  "data-id": `${dataId}_audioPreview`,
@@ -389,7 +464,7 @@ export default class AttachmentViewer extends Component {
389
464
  }, audioProps), /*#__PURE__*/React.createElement("source", {
390
465
  src: previewurl || viewUrl,
391
466
  type: `audio/${extension}`
392
- })) : this.isVideoFileType(name) ? /*#__PURE__*/React.createElement("video", _extends({
467
+ })) : _this.isVideoFileType(name) ? /*#__PURE__*/React.createElement("video", _extends({
393
468
  controls: true,
394
469
  className: style.zoomIn,
395
470
  "data-id": `${dataId}_videoPreview`,
@@ -397,29 +472,19 @@ export default class AttachmentViewer extends Component {
397
472
  }, videoProps), /*#__PURE__*/React.createElement("source", {
398
473
  src: viewUrl,
399
474
  type: `video/${extension}`
400
- })) : this.isImageFileType(name) || children ? /*#__PURE__*/React.createElement(AttachmentImage, _extends({
401
- customClass: {
402
- customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
403
- customChildrenClass
404
- },
405
- src: viewUrl,
406
- onClick: isPreviewAttachmentValid ? isZoomed ? this.zoomOut.bind(this, i) : e => this.zoomIn(e, i, true) : undefined,
407
- alt: name,
408
- dataId: dataId,
409
- id: `img${i}`,
410
- isCover: false
411
- }, imageProps), children) : type === "document" && previewurl != null ? this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
475
+ })) : _this.isImageFileType(name) || children ? _this.renderImageFrame() : type === "document" && previewurl != null ? _this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
412
476
  className: style.previewNone
413
477
  }, /*#__PURE__*/React.createElement("div", {
414
478
  className: style.fileTypeImg
415
- }, this.getPreviewIconData(name, '70')), /*#__PURE__*/React.createElement(Typography, {
479
+ }, _this.getPreviewIconData(name, '70')), /*#__PURE__*/React.createElement(Typography, {
416
480
  $ui_size: "20",
417
481
  $ui_weight: "semibold"
418
482
  }, previewUnsupportedText), downloadUrl ? /*#__PURE__*/React.createElement(Link, {
419
483
  href: downloadUrl,
484
+ download: true,
485
+ downloadName: name,
420
486
  className: style.downloadLink,
421
- hasReload: true,
422
- download: true
487
+ hasReload: true
423
488
  }, /*#__PURE__*/React.createElement(Button, {
424
489
  palette: "primaryFilled",
425
490
  text: downloadText
@@ -442,7 +507,9 @@ export default class AttachmentViewer extends Component {
442
507
  i18nKeys,
443
508
  isActive,
444
509
  dataId,
445
- customProps
510
+ customProps,
511
+ hasCount,
512
+ renderCustomIcons
446
513
  } = this.props;
447
514
  const {
448
515
  avatarProps = {}
@@ -470,228 +537,236 @@ export default class AttachmentViewer extends Component {
470
537
  }, /*#__PURE__*/React.createElement(ResponsiveReceiver, {
471
538
  responsiveId: responsiveId,
472
539
  query: this.responsiveFunc
473
- }, ({
474
- uptoTablet
475
- }) => /*#__PURE__*/React.createElement(Container, {
476
- scroll: "none",
477
- "data-scroll-palette": "dark"
478
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Container, {
479
- alignBox: "row",
480
- className: style.header,
481
- align: "between",
482
- tabindex: "0"
483
- }, /*#__PURE__*/React.createElement(Box, {
484
- shrink: true,
485
- className: style.title,
486
- "data-title": selectedAttachment.name,
487
- dataId: "attachName",
488
- id: ariaId
489
- }, selectedAttachment.name), /*#__PURE__*/React.createElement(Box, {
490
- flexible: true,
491
- className: style.count,
492
- dataId: "attachCountContainer"
493
- }, selectedIndex + 1, "/", totalLen), /*#__PURE__*/React.createElement(Box, {
494
- className: uptoTablet ? style.mbleMenuBar : style.menuBar
495
- }, /*#__PURE__*/React.createElement(Container, {
496
- isInline: true,
497
- alignBox: uptoTablet ? 'column-reverse' : 'row',
498
- align: uptoTablet ? 'bottom' : 'center',
499
- wrap: "wrap",
500
- isCover: false
501
- }, canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
502
- className: uptoTablet ? style.mobileMenu : style.menu,
503
- onClick: this.zoomOut.bind(this, selectedIndex),
504
- "data-id": "zoomOut",
505
- "data-test-id": "zoomOut",
506
- "data-title": i18nKeys.zoomOutText
507
- }, /*#__PURE__*/React.createElement(IconButton, {
508
- iconName: "ZD-GN-zoomOut",
509
- className: style.menuIcon,
510
- iconSize: "16",
511
- hoverType: "border",
512
- a11y: {
513
- ariaLabel: i18nKeys.zoomOutText
514
- }
515
- })) : /*#__PURE__*/React.createElement("div", {
516
- className: uptoTablet ? style.mobileMenu : style.menu,
517
- onClick: e => this.zoomIn(e, selectedIndex),
518
- "data-id": "zoomIn",
519
- "data-test-id": "zoomIn",
520
- "data-title": i18nKeys.zoomInText
521
- }, /*#__PURE__*/React.createElement(IconButton, {
522
- iconName: "ZD-GN-zoomIn",
523
- className: style.menuIcon,
524
- iconSize: "16",
525
- hoverType: "border",
526
- a11y: {
527
- ariaLabel: i18nKeys.zoomInText
528
- }
529
- })) : null, canOpenInNewTab ? /*#__PURE__*/React.createElement("div", {
530
- className: uptoTablet ? style.mobileMenu : style.menu
531
- }, /*#__PURE__*/React.createElement(Link, {
532
- href: selectedImgUrl,
533
- target: "_blank",
534
- dataId: "newTabAttach",
535
- title: i18nKeys.newTabText
536
- }, /*#__PURE__*/React.createElement(IconButton, {
537
- iconName: "ZD-GN-newLink",
538
- className: style.menuIcon,
539
- iconSize: "16",
540
- hoverType: "border",
541
- needButtonTag: false,
542
- a11y: {
543
- ariaLabel: i18nKeys.newTabText
544
- }
545
- }))) : null, needDownload ? /*#__PURE__*/React.createElement("div", {
546
- className: uptoTablet ? style.mobileMenu : style.menu
547
- }, /*#__PURE__*/React.createElement(Link, {
548
- href: downloadUrl,
549
- target: "_parent",
550
- hasReload: true,
551
- download: true,
552
- title: i18nKeys.downloadText,
553
- dataId: `${dataId}_downloadAttach`
554
- }, /*#__PURE__*/React.createElement(IconButton, {
555
- iconName: "ZD-GN-download",
556
- className: style.menuIcon,
557
- iconSize: "16",
558
- hoverType: "border",
559
- needButtonTag: false,
560
- a11y: {
561
- ariaLabel: i18nKeys.downloadText
562
- }
563
- }))) : null, /*#__PURE__*/React.createElement("div", {
564
- className: uptoTablet ? style.mobileMenu : style.menu,
565
- onClick: this.closeAttachmentViewer,
566
- "data-id": "closeAttach",
567
- "data-test-id": "closeAttach",
568
- "data-title": i18nKeys.closeText
569
- }, /*#__PURE__*/React.createElement(IconButton, {
570
- iconName: "ZD-cross",
571
- iconSize: "15",
572
- hoverType: "border",
573
- className: style.menuIcon,
574
- a11y: {
575
- ariaLabel: i18nKeys.closeText
576
- },
577
- title: i18nKeys.closeText
578
- })))))), /*#__PURE__*/React.createElement(Box, {
579
- flexible: true,
580
- role: "toolbar",
581
- tabindex: "0"
582
- }, /*#__PURE__*/React.createElement(Container, {
583
- alignBox: "row"
584
- }, /*#__PURE__*/React.createElement(Box, {
585
- className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${selectedIndex === 0 ? style.hidden : ''}`,
586
- onClick: this.changeSelectedIndex.bind(this, selectedIndex - 1),
587
- "data-title": i18nKeys.previousText,
588
- "data-title-position": "left"
589
- }, /*#__PURE__*/React.createElement("button", {
590
- className: style.btn,
591
- "aria-label": i18nKeys.previousText
592
- }, /*#__PURE__*/React.createElement(Icon, {
593
- name: "ZD-arrowLeft3",
594
- iconClass: style.arrow,
595
- dataId: "leftAttachNav",
596
- isBold: true
597
- }))), /*#__PURE__*/React.createElement(Box, {
598
- className: style.previewBox,
599
- tabindex: "0",
600
- "aria-describedby": ariaId,
601
- isShrink: false,
602
- eleRef: this.setImgBoxRef,
603
- scroll: "both",
604
- flexible: true
605
- }, this.imgPreviewView(downloadUrl)), /*#__PURE__*/React.createElement(Box, {
606
- className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${totalLen === selectedIndex + 1 ? style.hidden : ''}`,
607
- onClick: this.changeSelectedIndex.bind(this, selectedIndex + 1),
608
- "data-title": i18nKeys.nextText,
609
- "data-title-position": "right"
610
- }, /*#__PURE__*/React.createElement("button", {
611
- className: style.btn,
612
- "aria-label": i18nKeys.nextText
613
- }, /*#__PURE__*/React.createElement(Icon, {
614
- name: "ZD-arrowRight3",
615
- iconClass: style.arrow,
616
- dataId: "rightAttachNav",
617
- isBold: true
618
- }))))), /*#__PURE__*/React.createElement(Box, {
619
- className: `${style.footer} ${isPViewListOpen && totalLen !== 1 ? style.footerHeight : style.footerHide} `,
620
- dataId: `${dataId}_attachPreviewFooter`
621
- }, /*#__PURE__*/React.createElement(Container, {
622
- align: "vertical",
623
- alignBox: "row",
624
- className: style.footerHeight
625
- }, author && /*#__PURE__*/React.createElement(Box, {
626
- className: style.author,
627
- dataId: `${dataId}_authorName`
628
- }, /*#__PURE__*/React.createElement(Container, {
629
- alignBox: "row",
630
- align: "both"
631
- }, /*#__PURE__*/React.createElement(Avatar, _extends({
632
- name: authorName,
633
- size: "xmedium",
634
- src: authorHref,
635
- palette: "info"
636
- }, avatarProps)), /*#__PURE__*/React.createElement(Box, {
637
- flexible: true,
638
- className: style.authorName,
639
- "data-title": authorName
640
- }, authorName))), /*#__PURE__*/React.createElement(Box, {
641
- flexible: true
642
- }, /*#__PURE__*/React.createElement(Container, {
643
- align: "vertical",
644
- alignBox: "row",
645
- scroll: "horizontal",
646
- eleRef: el => this.imgListCont = el,
647
- className: style.listContainer
648
- }, data.map((item, index) => {
649
- const {
650
- name,
651
- viewUrl,
652
- children,
653
- customClass = {},
654
- dataId = 'AttachmentImage',
655
- customProps = {}
656
- } = item;
540
+ }, _ref3 => {
657
541
  let {
658
- thumbnail
659
- } = item;
660
- const isImageFileType = this.isImageFileType(name) || thumbnail;
661
- const {
662
- customImageClass = '',
663
- customChildrenClass = ''
664
- } = customClass;
665
- return /*#__PURE__*/React.createElement(Box, {
666
- className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''} ${isImageFileType ? '' : style.previewIconDiv}`,
667
- key: index,
668
- onClick: this.changeSelectedIndex.bind(this, index),
669
- eleRef: el => this[`img_${index}`] = el,
670
- dataId: "attachPreviewList",
671
- "data-title": name
672
- }, isImageFileType || children ? /*#__PURE__*/React.createElement(AttachmentImage, _extends({
673
- src: thumbnail || viewUrl,
674
- size: "small",
675
- alt: name,
676
- customClass: {
677
- customImageClass: `${style.image} ${style.altText} ${customImageClass}`,
678
- customChildrenClass: `${style.crsrPointer} ${customChildrenClass}`
542
+ uptoTablet
543
+ } = _ref3;
544
+ return /*#__PURE__*/React.createElement(Container, {
545
+ scroll: "none",
546
+ "data-scroll-palette": "dark"
547
+ }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Container, {
548
+ alignBox: "row",
549
+ className: style.header,
550
+ align: "between",
551
+ tabindex: "0"
552
+ }, /*#__PURE__*/React.createElement(Box, {
553
+ shrink: true,
554
+ className: style.title,
555
+ "data-title": selectedAttachment.name,
556
+ dataId: "attachName",
557
+ id: ariaId
558
+ }, selectedAttachment.name), hasCount && /*#__PURE__*/React.createElement(Box, {
559
+ flexible: true,
560
+ className: style.count,
561
+ dataId: "attachCountContainer"
562
+ }, selectedIndex + 1, "/", totalLen), /*#__PURE__*/React.createElement(Box, {
563
+ className: uptoTablet ? style.mbleMenuBar : style.menuBar
564
+ }, /*#__PURE__*/React.createElement(Container, {
565
+ isInline: true,
566
+ alignBox: uptoTablet ? 'column-reverse' : 'row',
567
+ align: uptoTablet ? 'bottom' : 'center',
568
+ wrap: "wrap",
569
+ isCover: false
570
+ }, renderNode(renderCustomIcons, {
571
+ selectedAttachment,
572
+ selectedIndex,
573
+ totalLen
574
+ }), canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
575
+ className: uptoTablet ? style.mobileMenu : style.menu,
576
+ onClick: this.zoomOut.bind(this, selectedIndex),
577
+ "data-id": "zoomOut",
578
+ "data-test-id": "zoomOut",
579
+ "data-title": i18nKeys.zoomOutText
580
+ }, /*#__PURE__*/React.createElement(IconButton, {
581
+ iconName: "ZD-GN-zoomOut",
582
+ className: style.menuIcon,
583
+ iconSize: "16",
584
+ hoverType: "border",
585
+ a11y: {
586
+ ariaLabel: i18nKeys.zoomOutText
587
+ }
588
+ })) : /*#__PURE__*/React.createElement("div", {
589
+ className: uptoTablet ? style.mobileMenu : style.menu,
590
+ onClick: e => this.zoomIn(e, selectedIndex),
591
+ "data-id": "zoomIn",
592
+ "data-test-id": "zoomIn",
593
+ "data-title": i18nKeys.zoomInText
594
+ }, /*#__PURE__*/React.createElement(IconButton, {
595
+ iconName: "ZD-GN-zoomIn",
596
+ className: style.menuIcon,
597
+ iconSize: "16",
598
+ hoverType: "border",
599
+ a11y: {
600
+ ariaLabel: i18nKeys.zoomInText
601
+ }
602
+ })) : null, canOpenInNewTab ? /*#__PURE__*/React.createElement("div", {
603
+ className: uptoTablet ? style.mobileMenu : style.menu
604
+ }, /*#__PURE__*/React.createElement(Link, {
605
+ href: selectedImgUrl,
606
+ target: "_blank",
607
+ dataId: "newTabAttach",
608
+ title: i18nKeys.newTabText
609
+ }, /*#__PURE__*/React.createElement(IconButton, {
610
+ iconName: "ZD-GN-newLink",
611
+ className: style.menuIcon,
612
+ iconSize: "16",
613
+ hoverType: "border",
614
+ needButtonTag: false,
615
+ a11y: {
616
+ ariaLabel: i18nKeys.newTabText
617
+ }
618
+ }))) : null, needDownload ? /*#__PURE__*/React.createElement("div", {
619
+ className: uptoTablet ? style.mobileMenu : style.menu
620
+ }, /*#__PURE__*/React.createElement(Link, {
621
+ href: downloadUrl,
622
+ downloadName: selectedAttachment.name,
623
+ target: "_parent",
624
+ hasReload: true,
625
+ download: true,
626
+ title: i18nKeys.downloadText,
627
+ dataId: `${dataId}_downloadAttach`
628
+ }, /*#__PURE__*/React.createElement(IconButton, {
629
+ iconName: "ZD-GN-download",
630
+ className: style.menuIcon,
631
+ iconSize: "16",
632
+ hoverType: "border",
633
+ needButtonTag: false,
634
+ a11y: {
635
+ ariaLabel: i18nKeys.downloadText
636
+ }
637
+ }))) : null, /*#__PURE__*/React.createElement("div", {
638
+ className: uptoTablet ? style.mobileMenu : style.menu,
639
+ onClick: this.closeAttachmentViewer,
640
+ "data-id": "closeAttach",
641
+ "data-test-id": "closeAttach",
642
+ "data-title": i18nKeys.closeText
643
+ }, /*#__PURE__*/React.createElement(IconButton, {
644
+ iconName: "ZD-cross",
645
+ iconSize: "15",
646
+ hoverType: "border",
647
+ className: style.menuIcon,
648
+ a11y: {
649
+ ariaLabel: i18nKeys.closeText
650
+ },
651
+ title: i18nKeys.closeText
652
+ })))))), /*#__PURE__*/React.createElement(Box, {
653
+ flexible: true,
654
+ role: "toolbar",
655
+ tabindex: "0"
656
+ }, /*#__PURE__*/React.createElement(Container, {
657
+ alignBox: "row"
658
+ }, /*#__PURE__*/React.createElement(Box, {
659
+ className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${selectedIndex === 0 ? style.hidden : ''}`,
660
+ onClick: this.changeSelectedIndex.bind(this, selectedIndex - 1),
661
+ "data-title": i18nKeys.previousText,
662
+ "data-title-position": "left"
663
+ }, /*#__PURE__*/React.createElement("button", {
664
+ className: style.btn,
665
+ "aria-label": i18nKeys.previousText
666
+ }, /*#__PURE__*/React.createElement(Icon, {
667
+ name: "ZD-arrowLeft3",
668
+ iconClass: style.arrow,
669
+ dataId: "leftAttachNav",
670
+ isBold: true
671
+ }))), /*#__PURE__*/React.createElement(Box, {
672
+ className: style.previewBox,
673
+ tabindex: "0",
674
+ "aria-describedby": ariaId,
675
+ isShrink: false,
676
+ eleRef: this.setImgBoxRef,
677
+ scroll: "both",
678
+ flexible: true
679
+ }, this.imgPreviewView(downloadUrl)), /*#__PURE__*/React.createElement(Box, {
680
+ className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${totalLen === selectedIndex + 1 ? style.hidden : ''}`,
681
+ onClick: this.changeSelectedIndex.bind(this, selectedIndex + 1),
682
+ "data-title": i18nKeys.nextText,
683
+ "data-title-position": "right"
684
+ }, /*#__PURE__*/React.createElement("button", {
685
+ className: style.btn,
686
+ "aria-label": i18nKeys.nextText
687
+ }, /*#__PURE__*/React.createElement(Icon, {
688
+ name: "ZD-arrowRight3",
689
+ iconClass: style.arrow,
690
+ dataId: "rightAttachNav",
691
+ isBold: true
692
+ }))))), /*#__PURE__*/React.createElement(Box, {
693
+ className: `${style.footer} ${isPViewListOpen && totalLen !== 1 ? style.footerHeight : style.footerHide} `,
694
+ dataId: `${dataId}_attachPreviewFooter`
695
+ }, /*#__PURE__*/React.createElement(Container, {
696
+ align: "vertical",
697
+ alignBox: "row",
698
+ className: style.footerHeight
699
+ }, author && /*#__PURE__*/React.createElement(Box, {
700
+ className: style.author,
701
+ dataId: `${dataId}_authorName`
702
+ }, /*#__PURE__*/React.createElement(Container, {
703
+ alignBox: "row",
704
+ align: "both"
705
+ }, /*#__PURE__*/React.createElement(Avatar, _extends({
706
+ name: authorName,
707
+ size: "xmedium",
708
+ src: authorHref,
709
+ palette: "info"
710
+ }, avatarProps)), /*#__PURE__*/React.createElement(Box, {
711
+ flexible: true,
712
+ className: style.authorName,
713
+ "data-title": authorName
714
+ }, authorName))), /*#__PURE__*/React.createElement(Box, {
715
+ flexible: true
716
+ }, /*#__PURE__*/React.createElement(Container, {
717
+ align: "vertical",
718
+ alignBox: "row",
719
+ scroll: "horizontal",
720
+ eleRef: el => this.imgListCont = el,
721
+ className: style.listContainer
722
+ }, data.map((item, index) => {
723
+ const {
724
+ name,
725
+ viewUrl,
726
+ children,
727
+ customClass = {},
728
+ dataId = 'AttachmentImage',
729
+ customProps = {}
730
+ } = item;
731
+ let {
732
+ thumbnail
733
+ } = item;
734
+ const isImageFileType = this.isImageFileType(name) || thumbnail;
735
+ const {
736
+ customImageClass = '',
737
+ customChildrenClass = ''
738
+ } = customClass;
739
+ return /*#__PURE__*/React.createElement(Box, {
740
+ className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''} ${isImageFileType ? '' : style.previewIconDiv}`,
741
+ key: index,
742
+ onClick: this.changeSelectedIndex.bind(this, index),
743
+ eleRef: el => this[`img_${index}`] = el,
744
+ dataId: "attachPreviewList",
745
+ "data-title": name
746
+ }, isImageFileType || children ? /*#__PURE__*/React.createElement(AttachmentImage, _extends({
747
+ src: thumbnail || viewUrl,
748
+ size: "small",
749
+ alt: name,
750
+ customClass: {
751
+ customImageClass: `${style.image} ${style.altText} ${customImageClass}`,
752
+ customChildrenClass: `${style.crsrPointer} ${customChildrenClass}`
753
+ },
754
+ dataId: dataId
755
+ }, customProps), children) : this.getPreviewIconData(name, '40'));
756
+ }))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
757
+ dataId: "attachToggle",
758
+ onClick: this.togglePViewList,
759
+ iconName: "ZD-GN-hideTab",
760
+ iconSize: "14",
761
+ hoverType: "border",
762
+ iconClass: `${style.thumpIcon} ${isPViewListOpen ? style.thumpIconActive : ''}`,
763
+ className: style.button,
764
+ a11y: {
765
+ ariaLabel: i18nKeys.hideText
679
766
  },
680
- dataId: dataId
681
- }, customProps), children) : this.getPreviewIconData(name, '40'));
682
- }))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
683
- dataId: "attachToggle",
684
- onClick: this.togglePViewList,
685
- iconName: "ZD-GN-hideTab",
686
- iconSize: "14",
687
- hoverType: "border",
688
- iconClass: `${style.thumpIcon} ${isPViewListOpen ? style.thumpIconActive : ''}`,
689
- className: style.button,
690
- a11y: {
691
- ariaLabel: i18nKeys.hideText
692
- },
693
- title: isPViewListOpen ? i18nKeys.hideText : i18nKeys.showText
694
- }))));
767
+ title: isPViewListOpen ? i18nKeys.hideText : i18nKeys.showText
768
+ }));
769
+ }));
695
770
  }
696
771
 
697
772
  }