@zohodesk/dot 1.0.0-beta.220 → 1.0.0-beta.221

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 (111) hide show
  1. package/README.md +4 -0
  2. package/es/ActionButton/ActionButton.module.css +9 -25
  3. package/es/AlphabeticList/AlphabeticList.module.css +4 -7
  4. package/es/Attachment/Attachment.module.css +9 -20
  5. package/es/AttachmentViewer/AttachmentViewer.module.css +27 -82
  6. package/es/ChannelIcon/ChannelIcon.module.css +21 -30
  7. package/es/Drawer/Drawer.module.css +11 -59
  8. package/es/FlipCard/FlipCard.module.css +5 -14
  9. package/es/FormAction/FormAction.module.css +9 -34
  10. package/es/FreezeLayer/FreezeLayer.module.css +2 -6
  11. package/es/IconButton/IconButton.module.css +1 -1
  12. package/es/ImportantNotes/ImportantNotes.module.css +2 -7
  13. package/es/Loader/Loader.module.css +4 -25
  14. package/es/Message/Message.module.css +9 -42
  15. package/es/MessageBanner/MessageBanner.module.css +4 -12
  16. package/es/NewStar/NewStar.module.css +5 -42
  17. package/es/ToastMessage/ToastMessage.module.css +25 -96
  18. package/es/Upload/Upload.module.css +8 -27
  19. package/es/alert/AlertHeader/AlertHeader.module.css +3 -21
  20. package/es/alert/AlertLookup/AlertLookup.module.css +2 -6
  21. package/es/avatar/AvatarClose/AvatarClose.module.css +3 -9
  22. package/es/avatar/AvatarCollision/AvatarCollision.module.css +4 -18
  23. package/es/avatar/AvatarIcon/AvatarIcon.module.css +4 -3
  24. package/es/avatar/AvatarStatus/AvatarStatus.module.css +9 -59
  25. package/es/avatar/AvatarThread/AvatarThread.module.css +5 -55
  26. package/es/avatar/AvatarUser/AvatarUser.module.css +10 -81
  27. package/es/avatar/AvatarWithTeam/AvatarWithTeam.module.css +3 -10
  28. package/es/common/dot_animation.module.css +3 -16
  29. package/es/deprecated/SelectDropdown/SelectDropdown.module.css +3 -11
  30. package/es/dropdown/ToggleDropDown/ToggleDropDown.module.css +6 -19
  31. package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +4 -12
  32. package/es/emptystate/EditionPage/EditionPage.css +3 -9
  33. package/es/errorstate/EmptyStates.module.css +10 -13
  34. package/es/errorstate/Inconvenience/Inconvenience.module.css +0 -3
  35. package/es/errorstate/LinkText/LinkText.module.css +1 -1
  36. package/es/errorstate/PermissionPlay/PermissionPlay.module.css +2 -2
  37. package/es/errorstate/WillBack/WillBack.module.css +3 -1
  38. package/es/form/fields/Fields.module.css +14 -49
  39. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +7 -19
  40. package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.module.css +1 -4
  41. package/es/form/fields/TextEditor/TextEditor.js +4 -1
  42. package/es/form/fields/TextEditor/TextEditor.module.css +72 -149
  43. package/es/form/fields/TextEditorWrapper/TextEditorWrapper.module.css +2 -13
  44. package/es/form/fields/ValidationMessage/ValidationMessage.module.css +4 -9
  45. package/es/layout/SetupDetailLayout/SetupDetailLayout.module.css +16 -52
  46. package/es/layout/SubtabLayout/SubtabLayout.module.css +29 -55
  47. package/es/list/BluePrintStatus/BluePrintStatus.module.css +1 -4
  48. package/es/list/Comment/Comment.module.css +0 -5
  49. package/es/list/DotNew/DotNew.module.css +3 -3
  50. package/es/list/GridStencils/GridStencils.module.css +16 -70
  51. package/es/list/Icons/Icons.module.css +1 -1
  52. package/es/list/ListLayout/ListLayout.module.css +14 -22
  53. package/es/list/ListStencils/ListStencils.module.css +6 -11
  54. package/es/list/SecondaryText/SecondaryText.module.css +3 -13
  55. package/es/list/SentimentStatus/SentimentStatus.module.css +1 -4
  56. package/es/list/TagNew/TagNew.module.css +7 -14
  57. package/es/list/Thread/Thread.module.css +1 -13
  58. package/es/list/UserTime/UserTime.module.css +0 -6
  59. package/es/list/listCommon.module.css +1 -9
  60. package/es/list/status/StatusDropdown/StatusDropdown.module.css +6 -19
  61. package/es/list/status/StatusListItem/StatusListItem.module.css +15 -38
  62. package/es/lookup/Lookup/Lookup.module.css +2 -2
  63. package/es/lookup/Section/LookupSection.module.css +2 -2
  64. package/es/lookup/header/Close/LookupClose.module.css +4 -4
  65. package/es/lookup/header/Search/LookupSearch.module.css +12 -21
  66. package/es/lookup/header/TicketHeader/TicketHeader.module.css +2 -5
  67. package/es/lookup/header/ViewDropDown/ViewDropDown.module.css +3 -8
  68. package/es/lookup/header/lookupHeaderCommon.module.css +6 -16
  69. package/es/lookup/header/lookupHeaderCommonResponsive.module.css +3 -12
  70. package/es/setup/header/Button/HeaderButton.module.css +1 -3
  71. package/es/setup/header/Link/HeaderLink.module.css +1 -7
  72. package/es/setup/header/Search/Search.module.css +8 -19
  73. package/es/setup/header/Views/Views.module.css +5 -15
  74. package/es/setup/helptips/Link/HelpTipsLink.module.css +0 -1
  75. package/es/setup/helptips/ListGroup/ListGroup.module.css +1 -6
  76. package/es/setup/table/TableData/SetupTableData.module.css +3 -11
  77. package/es/setup/table/TableHead/SetupTableHead.module.css +0 -4
  78. package/es/setup/table/TableRow/SetupTableRow.module.css +2 -6
  79. package/es/version2/AlertClose/AlertClose.module.css +1 -1
  80. package/es/version2/GlobalNotification/GlobalNotification.module.css +9 -44
  81. package/es/version2/lookup/AlertHeader/AlertHeaderNew.module.css +2 -25
  82. package/es/version2/lookup/AlertLookup/AlertLookupNew.module.css +3 -7
  83. package/es/version2/lookup/alertLookupCommonNew.module.css +1 -8
  84. package/es/version2/notification/DesktopNotification/DesktopNotification.module.css +10 -26
  85. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +10 -47
  86. package/lib/ActionButton/ActionButton.module.css +1 -0
  87. package/lib/FreezeLayer/FreezeLayer.js +4 -31
  88. package/lib/form/fields/CheckBoxField/CheckBoxField.js +1 -1
  89. package/lib/form/fields/CurrencyField/CurrencyField.js +8 -9
  90. package/lib/form/fields/DateField/DateField.js +1 -1
  91. package/lib/form/fields/MultiSelectField/MultiSelectField.js +1 -1
  92. package/lib/form/fields/PhoneField/PhoneField.js +1 -1
  93. package/lib/form/fields/RadioField/RadioField.js +1 -1
  94. package/lib/form/fields/SelectField/SelectField.js +1 -1
  95. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +4 -7
  96. package/lib/form/fields/TextBoxField/TextBoxField.js +1 -1
  97. package/lib/form/fields/TextEditor/TextEditor.module.css +2 -13
  98. package/lib/form/fields/TextareaField/TextareaField.js +1 -1
  99. package/lib/list/status/StatusDropdown/StatusDropdown.js +37 -44
  100. package/lib/setup/header/Views/Views.js +2 -2
  101. package/lib/utils/General.js +24 -0
  102. package/package.json +1 -1
  103. package/lib/AttachmentViewer/Attachment.js +0 -28
  104. package/lib/AttachmentViewer/AttachmentImage.js +0 -129
  105. package/lib/AttachmentViewer/AttachmentViewer.js +0 -645
  106. package/lib/AttachmentViewer/AttachmentViewer.module.css +0 -346
  107. package/lib/AttachmentViewer/utils.js +0 -134
  108. package/lib/Provider/Config.js +0 -21
  109. package/lib/common/dot_animation.module.css +0 -27
  110. package/lib/common/dot_common.module.css +0 -4
  111. package/lib/deprecated/utils/General.js +0 -29
@@ -153,7 +153,7 @@ var SelectField = /*#__PURE__*/function (_PureComponent) {
153
153
  var uniqueId = htmlId ? htmlId : this.getNextId();
154
154
  return /*#__PURE__*/_react["default"].createElement("div", {
155
155
  className: "".concat(_FieldsModule["default"].container, " ").concat(isDisabled ? _FieldsModule["default"].disabled : isReadOnly ? _FieldsModule["default"].readonly : ''),
156
- "data-title": isDisabled ? title : null
156
+ "data-title": isDisabled ? title : ''
157
157
  }, labelName && /*#__PURE__*/_react["default"].createElement("div", {
158
158
  className: _FieldsModule["default"].labelContainer
159
159
  }, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
@@ -177,8 +177,7 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
177
177
  needBorder = _this$props3.needBorder,
178
178
  borderColor = _this$props3.borderColor,
179
179
  getTextBoxChildren = _this$props3.getTextBoxChildren,
180
- htmlId = _this$props3.htmlId,
181
- boxSize = _this$props3.boxSize;
180
+ htmlId = _this$props3.htmlId;
182
181
  var showAll = this.state.showAll;
183
182
  var chipLimit = !isPopupReady ? showAll ? tagsList.length : chipNeedToShow : tagsList.length;
184
183
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -240,7 +239,7 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
240
239
  isArrow: false,
241
240
  getRef: getContainerRef,
242
241
  isBoxPaddingNeed: true,
243
- size: boxSize,
242
+ size: "default",
244
243
  boxPosition: boxPosition,
245
244
  isPadding: false,
246
245
  customClass: {
@@ -336,8 +335,7 @@ TagsMultiSelect.propTypes = {
336
335
  borderColor: _propTypes["default"].oneOf(['transparent', 'default', 'dark']),
337
336
  needBorder: _propTypes["default"].bool,
338
337
  getTextBoxChildren: _propTypes["default"].func,
339
- htmlId: _propTypes["default"].string,
340
- boxSize: _propTypes["default"].string
338
+ htmlId: _propTypes["default"].string
341
339
  };
342
340
  TagsMultiSelect.defaultProps = {
343
341
  className: '',
@@ -345,8 +343,7 @@ TagsMultiSelect.defaultProps = {
345
343
  chipNeedToShow: '5',
346
344
  borderColor: 'default',
347
345
  needBorder: true,
348
- dataId: '',
349
- boxSize: 'default'
346
+ dataId: ''
350
347
  };
351
348
 
352
349
  if (false) {
@@ -147,7 +147,7 @@ var TextBoxField = /*#__PURE__*/function (_PureComponent) {
147
147
  var uniqueId = htmlId ? htmlId : this.getNextId();
148
148
  return /*#__PURE__*/_react["default"].createElement("div", {
149
149
  className: "".concat(_FieldsModule["default"].container, " ").concat(isDisabled ? _FieldsModule["default"].disabled : isReadOnly ? _FieldsModule["default"].readonly : ''),
150
- "data-title": isDisabled ? title : null
150
+ "data-title": isDisabled ? title : ''
151
151
  }, labelName && /*#__PURE__*/_react["default"].createElement("div", {
152
152
  className: _FieldsModule["default"].labelContainer
153
153
  }, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
@@ -649,18 +649,7 @@
649
649
  right: 0;
650
650
  left: 0;
651
651
  }
652
- .readOnly :global .KB_Editor_menus {
653
- display: none !important;
654
- }
652
+ .readOnly :global .KB_Editor_menus,
655
653
  .editorHide :global .KB_Editor {
656
- position: absolute !important;
657
- top: 0;
658
- opacity: 0;
659
- visibility: hidden;
660
- }
661
- [dir=ltr] .editorHide :global .KB_Editor {
662
- left: 0;
663
- }
664
- [dir=rtl] .editorHide :global .KB_Editor {
665
- right: 0;
654
+ display: none !important;
666
655
  }
@@ -143,7 +143,7 @@ var TextareaField = /*#__PURE__*/function (_PureComponent) {
143
143
  var uniqueId = htmlId ? htmlId : this.getNextId();
144
144
  return /*#__PURE__*/_react["default"].createElement("div", {
145
145
  className: "".concat(_FieldsModule["default"].container, " ").concat(isDisabled ? _FieldsModule["default"].disabled : isReadOnly ? _FieldsModule["default"].readonly : ''),
146
- "data-title": isDisabled ? title : null
146
+ "data-title": isDisabled ? title : ''
147
147
  }, labelName && /*#__PURE__*/_react["default"].createElement("div", {
148
148
  className: _FieldsModule["default"].labelContainer
149
149
  }, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
@@ -182,7 +182,7 @@ var StatusDropdown = /*#__PURE__*/function (_React$Component) {
182
182
 
183
183
  if (prevProps.isPopupOpen != isPopupOpen) {
184
184
  setTimeout(function () {
185
- isPopupOpen && isSearch ? _this2.searchInput && _this2.searchInput.focus() : _this2.hiddenInput && _this2.hiddenInput.focus();
185
+ isPopupOpen ? isSearch ? _this2.searchInput && _this2.searchInput.focus() : _this2.hiddenInput && _this2.hiddenInput.focus() : _this2.hiddenInput && _this2.hiddenInput.focus();
186
186
  }, 10);
187
187
  }
188
188
 
@@ -211,61 +211,54 @@ var StatusDropdown = /*#__PURE__*/function (_React$Component) {
211
211
  togglePopup = _this$props4.togglePopup,
212
212
  onClick = _this$props4.onClick,
213
213
  boxPosition = _this$props4.boxPosition,
214
- isPopupReady = _this$props4.isPopupReady,
214
+ isPopupOpen = _this$props4.isPopupOpen,
215
215
  isNextOptions = _this$props4.isNextOptions,
216
216
  getNextOptions = _this$props4.getNextOptions,
217
- onTogglePopup = _this$props4.onTogglePopup,
218
- isPopupOpen = _this$props4.isPopupOpen;
217
+ onTogglePopup = _this$props4.onTogglePopup;
219
218
 
220
- if (isPopupReady && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
219
+ if (isPopupOpen && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
221
220
  e.preventDefault(); //prevent body scroll
222
221
  }
223
222
 
224
- if (isPopupReady) {
225
- switch (keyCode) {
226
- case 40:
227
- if (selectedIndex === totalIndex - 1) {
228
- this.setState({
229
- selectedIndex: 0
230
- });
231
- } else {
232
- if (selectedIndex === totalIndex - 3) {
233
- isNextOptions && getNextOptions && getNextOptions();
234
- }
235
-
236
- this.setState({
237
- selectedIndex: selectedIndex + 1
238
- });
223
+ switch (keyCode) {
224
+ case 40:
225
+ if (selectedIndex === totalIndex - 1) {
226
+ this.setState({
227
+ selectedIndex: 0
228
+ });
229
+ } else {
230
+ if (selectedIndex === totalIndex - 3) {
231
+ isNextOptions && getNextOptions && getNextOptions();
239
232
  }
240
233
 
241
- break;
242
-
243
- case 38:
244
- if (selectedIndex === 0) {
245
- this.setState({
246
- selectedIndex: totalIndex - 1
247
- });
248
- } else {
249
- this.setState({
250
- selectedIndex: selectedIndex - 1
251
- });
252
- }
234
+ this.setState({
235
+ selectedIndex: selectedIndex + 1
236
+ });
237
+ }
253
238
 
254
- break;
239
+ break;
240
+
241
+ case 38:
242
+ if (selectedIndex === 0) {
243
+ this.setState({
244
+ selectedIndex: totalIndex - 1
245
+ });
246
+ } else {
247
+ this.setState({
248
+ selectedIndex: selectedIndex - 1
249
+ });
250
+ }
255
251
 
256
- case 13:
257
- onClick && onClick(options[selectedIndex].name, e);
258
- onTogglePopup && onTogglePopup(isPopupOpen);
259
- togglePopup(e, boxPosition);
260
- break;
252
+ break;
261
253
 
262
- default:
263
- break;
264
- }
265
- } else {
266
- if (keyCode === 13 || keyCode === 40) {
254
+ case 13:
255
+ onClick && onClick(options[selectedIndex].name, e);
256
+ onTogglePopup && onTogglePopup(isPopupOpen);
267
257
  togglePopup(e, boxPosition);
268
- }
258
+ break;
259
+
260
+ default:
261
+ break;
269
262
  }
270
263
  }
271
264
  }, {
@@ -62,14 +62,14 @@ var Views = /*#__PURE__*/function (_React$Component) {
62
62
  className: _ViewsModule["default"].container
63
63
  }, /*#__PURE__*/_react["default"].createElement("span", {
64
64
  className: "".concat(_ViewsModule["default"].icon, " ").concat(_ViewsModule["default"].first, " ").concat(isList ? _ViewsModule["default"].active : ''),
65
- "data-title": !isList ? listTitle : null,
65
+ "data-title": !isList ? listTitle : '',
66
66
  onClick: onListClick
67
67
  }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
68
68
  name: "ZD-list22",
69
69
  size: "10"
70
70
  })), /*#__PURE__*/_react["default"].createElement("span", {
71
71
  className: "".concat(_ViewsModule["default"].icon, " ").concat(_ViewsModule["default"].last, " ").concat(isGrid ? _ViewsModule["default"].active : ''),
72
- "data-title": !isGrid ? gridTitle : null,
72
+ "data-title": !isGrid ? gridTitle : '',
73
73
  onClick: onGridClick
74
74
  }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
75
75
  name: "ZD-grid",
@@ -3,11 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.formatCurrency = formatCurrency;
6
7
  exports.formatPhoneUrl = formatPhoneUrl;
7
8
  exports.getFullName = getFullName;
8
9
  exports.shallowDiff = shallowDiff;
9
10
  exports.stopBubbling = stopBubbling;
10
11
 
12
+ 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); }
13
+
11
14
  function stopBubbling(event) {
12
15
  event.preventDefault();
13
16
  event.stopPropagation && event.stopPropagation();
@@ -55,4 +58,25 @@ function formatPhoneUrl(phone) {
55
58
  }
56
59
 
57
60
  return phone;
61
+ }
62
+
63
+ function formatCurrency(number, symbol) {
64
+ // format number 1000000 to 1,234,567
65
+ if (number && number != 0) {
66
+ var typeOfData = _typeof(number);
67
+
68
+ var isDecimal = typeOfData == 'string' ? number.indexOf('.') != -1 : !Number.isInteger(number);
69
+
70
+ if (isDecimal) {
71
+ var val = number.toString().split('.');
72
+ var arr1 = "".concat(val[0].replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ','));
73
+ var finalVal = "".concat(symbol).concat(arr1, ".").concat(val[1]);
74
+ return finalVal;
75
+ } else {
76
+ var value = "".concat(symbol).concat(number.toString().replace(/\D/g, '').replace(/\B(?=(\d{3})+(?!\d))/g, ','));
77
+ return value;
78
+ }
79
+ }
80
+
81
+ return number;
58
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-beta.220",
3
+ "version": "1.0.0-beta.221",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getExtensionFromFileName = getExtensionFromFileName;
7
- exports.isAudioFile = isAudioFile;
8
- exports.isBrowserSupportedFile = isBrowserSupportedFile;
9
- var UNASSIGNED = 'Unassigned';
10
- var BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
11
-
12
- function isAudioFile(fileName) {
13
- var extension = getExtensionFromFileName(fileName);
14
- return /mp3|wav|ogg/i.test(extension);
15
- }
16
-
17
- function getExtensionFromFileName(fileName) {
18
- if (fileName && fileName.indexOf(".") !== -1) {
19
- return fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length).toLowerCase();
20
- }
21
-
22
- return "";
23
- }
24
-
25
- function isBrowserSupportedFile(fileName) {
26
- var extension = getExtensionFromFileName(fileName);
27
- return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
28
- }
@@ -1,129 +0,0 @@
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 _Image = _interopRequireDefault(require("../Image/Image"));
15
-
16
- var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
- 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); }
21
-
22
- 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; }
23
-
24
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
-
26
- 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); } }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
-
30
- 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); }
31
-
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
-
34
- 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); }; }
35
-
36
- 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); }
37
-
38
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
-
40
- 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; } }
41
-
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
-
44
- var AttachmentImage = /*#__PURE__*/function (_Component) {
45
- _inherits(AttachmentImage, _Component);
46
-
47
- var _super = _createSuper(AttachmentImage);
48
-
49
- function AttachmentImage(props) {
50
- var _this;
51
-
52
- _classCallCheck(this, AttachmentImage);
53
-
54
- _this = _super.call(this, props);
55
- _this.imageEle = /*#__PURE__*/_react["default"].createRef();
56
- _this.state = {
57
- isLoading: true
58
- };
59
- _this.imgLoad = _this.imgLoad.bind(_assertThisInitialized(_this));
60
- return _this;
61
- }
62
-
63
- _createClass(AttachmentImage, [{
64
- key: "componentDidMount",
65
- value: function componentDidMount() {
66
- var isImage = this.props.isImage;
67
-
68
- if (isImage) {
69
- var image = this.imageEle.current;
70
- image.addEventListener('load', this.imgLoad);
71
- } else {
72
- this.setState({
73
- isLoading: false
74
- });
75
- }
76
- }
77
- }, {
78
- key: "imgLoad",
79
- value: function imgLoad() {
80
- this.setState({
81
- isLoading: false
82
- });
83
- var onLoad = this.props.onLoad;
84
- onLoad && onLoad();
85
- }
86
- }, {
87
- key: "render",
88
- value: function render() {
89
- var _this$props = this.props,
90
- src = _this$props.src,
91
- onClick = _this$props.onClick,
92
- alt = _this$props.alt,
93
- dataId = _this$props.dataId,
94
- id = _this$props.id,
95
- className = _this$props.className,
96
- isCover = _this$props.isCover;
97
- var isLoading = this.state.isLoading;
98
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isLoading ? /*#__PURE__*/_react["default"].createElement("div", {
99
- className: "".concat(_AttachmentViewerModule["default"].spinLoad)
100
- }, /*#__PURE__*/_react["default"].createElement("div", {
101
- className: _AttachmentViewerModule["default"].loader
102
- })) : null, /*#__PURE__*/_react["default"].createElement(_Image["default"], {
103
- htmlId: id,
104
- eleRef: this.imageEle,
105
- dataId: dataId,
106
- src: src,
107
- onClick: onClick,
108
- className: "".concat(isLoading ? _AttachmentViewerModule["default"].hide : '', " ").concat(className),
109
- alt: alt,
110
- isCover: isCover
111
- }));
112
- }
113
- }]);
114
-
115
- return AttachmentImage;
116
- }(_react.Component);
117
-
118
- exports["default"] = AttachmentImage;
119
- AttachmentImage.propTypes = {
120
- alt: _propTypes["default"].string,
121
- className: _propTypes["default"].string,
122
- dataId: _propTypes["default"].string,
123
- id: _propTypes["default"].string,
124
- isCover: _propTypes["default"].bool,
125
- isImage: _propTypes["default"].string,
126
- onClick: _propTypes["default"].func,
127
- onLoad: _propTypes["default"].func,
128
- src: _propTypes["default"].string
129
- };