@zohodesk/dot 1.0.0-beta.225 → 1.0.0-beta.226

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 (135) hide show
  1. package/README.md +7 -0
  2. package/assets/Appearance/dark/mode/dotDarkMode.module.css +2 -0
  3. package/assets/Appearance/dark/themes/blue/blueDarkDotTheme.module.css +1 -1
  4. package/assets/Appearance/default/mode/dotDefaultMode.module.css +2 -0
  5. package/assets/Appearance/default/themes/blue/blueDefaultDotTheme.module.css +1 -1
  6. package/assets/Appearance/pureDark/mode/dotPureDarkMode.module.css +533 -0
  7. package/assets/Appearance/pureDark/themes/blue/bluePureDarkDotTheme.module.css +16 -0
  8. package/assets/Appearance/pureDark/themes/green/greenPureDarkDotTheme.module.css +16 -0
  9. package/assets/Appearance/pureDark/themes/orange/orangePureDarkDotTheme.module.css +16 -0
  10. package/assets/Appearance/pureDark/themes/red/redPureDarkDotTheme.module.css +16 -0
  11. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkDotTheme.module.css +16 -0
  12. package/es/ActionButton/ActionButton.module.css +25 -9
  13. package/es/AlphabeticList/AlphabeticList.module.css +7 -4
  14. package/es/Attachment/Attachment.module.css +20 -9
  15. package/es/AttachmentViewer/AttachmentImage.js +5 -1
  16. package/es/AttachmentViewer/AttachmentViewer.js +3 -2
  17. package/es/AttachmentViewer/AttachmentViewer.module.css +90 -27
  18. package/es/ChannelIcon/ChannelIcon.module.css +30 -21
  19. package/es/Drawer/Drawer.module.css +59 -11
  20. package/es/FlipCard/FlipCard.module.css +14 -5
  21. package/es/FormAction/FormAction.module.css +34 -9
  22. package/es/FreezeLayer/FreezeLayer.module.css +6 -2
  23. package/es/IconButton/IconButton.module.css +1 -1
  24. package/es/ImportantNotes/ImportantNotes.module.css +7 -2
  25. package/es/Loader/Loader.module.css +25 -4
  26. package/es/Message/Message.module.css +42 -9
  27. package/es/MessageBanner/MessageBanner.module.css +12 -4
  28. package/es/NewStar/NewStar.module.css +42 -5
  29. package/es/Provider.js +88 -35
  30. package/es/ToastMessage/ToastMessage.module.css +96 -25
  31. package/es/Upload/Upload.module.css +27 -8
  32. package/es/alert/AlertHeader/AlertHeader.module.css +21 -3
  33. package/es/alert/AlertLookup/AlertLookup.module.css +6 -2
  34. package/es/avatar/AvatarClose/AvatarClose.module.css +9 -3
  35. package/es/avatar/AvatarCollision/AvatarCollision.module.css +18 -4
  36. package/es/avatar/AvatarIcon/AvatarIcon.module.css +3 -4
  37. package/es/avatar/AvatarStatus/AvatarStatus.module.css +59 -9
  38. package/es/avatar/AvatarThread/AvatarThread.module.css +55 -5
  39. package/es/avatar/AvatarUser/AvatarUser.module.css +81 -10
  40. package/es/avatar/AvatarWithTeam/AvatarWithTeam.module.css +10 -3
  41. package/es/common/dot_animation.module.css +16 -3
  42. package/es/deprecated/SelectDropdown/SelectDropdown.module.css +11 -3
  43. package/es/dropdown/ToggleDropDown/ToggleDropDown.module.css +19 -6
  44. package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +12 -4
  45. package/es/emptystate/EditionPage/EditionPage.css +9 -3
  46. package/es/errorstate/EmptyStates.module.css +13 -10
  47. package/es/errorstate/Inconvenience/Inconvenience.module.css +3 -0
  48. package/es/errorstate/LinkText/LinkText.module.css +1 -1
  49. package/es/errorstate/PermissionPlay/PermissionPlay.module.css +2 -2
  50. package/es/errorstate/WillBack/WillBack.module.css +1 -3
  51. package/es/form/fields/Fields.module.css +49 -14
  52. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +19 -7
  53. package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.module.css +4 -1
  54. package/es/form/fields/TextEditor/TextEditor.module.css +149 -72
  55. package/es/form/fields/TextEditorWrapper/TextEditorWrapper.module.css +13 -2
  56. package/es/form/fields/ValidationMessage/ValidationMessage.module.css +9 -4
  57. package/es/layout/SetupDetailLayout/SetupDetailLayout.module.css +52 -16
  58. package/es/layout/SubtabLayout/SubtabLayout.module.css +55 -29
  59. package/es/list/BluePrintStatus/BluePrintStatus.module.css +4 -1
  60. package/es/list/Comment/Comment.module.css +5 -0
  61. package/es/list/DotNew/DotNew.module.css +3 -3
  62. package/es/list/GridStencils/GridStencils.module.css +71 -17
  63. package/es/list/Icons/Icons.module.css +1 -1
  64. package/es/list/ListLayout/ListLayout.module.css +22 -14
  65. package/es/list/ListStencils/ListStencils.module.css +11 -6
  66. package/es/list/SecondaryText/SecondaryText.module.css +14 -4
  67. package/es/list/SentimentStatus/SentimentStatus.module.css +4 -1
  68. package/es/list/TagNew/TagNew.module.css +14 -7
  69. package/es/list/Thread/Thread.module.css +13 -1
  70. package/es/list/UserTime/UserTime.module.css +6 -0
  71. package/es/list/listCommon.module.css +9 -1
  72. package/es/list/status/StatusDropdown/StatusDropdown.module.css +19 -6
  73. package/es/list/status/StatusListItem/StatusListItem.module.css +38 -15
  74. package/es/lookup/Lookup/Lookup.module.css +2 -2
  75. package/es/lookup/Section/LookupSection.module.css +2 -2
  76. package/es/lookup/header/Close/LookupClose.module.css +4 -4
  77. package/es/lookup/header/Search/LookupSearch.module.css +21 -12
  78. package/es/lookup/header/TicketHeader/TicketHeader.module.css +5 -2
  79. package/es/lookup/header/ViewDropDown/ViewDropDown.module.css +8 -3
  80. package/es/lookup/header/lookupHeaderCommon.module.css +15 -5
  81. package/es/lookup/header/lookupHeaderCommonResponsive.module.css +12 -3
  82. package/es/setup/header/Button/HeaderButton.module.css +3 -1
  83. package/es/setup/header/Link/HeaderLink.module.css +7 -1
  84. package/es/setup/header/Search/Search.module.css +19 -8
  85. package/es/setup/header/Views/Views.module.css +15 -5
  86. package/es/setup/helptips/Link/HelpTipsLink.module.css +1 -0
  87. package/es/setup/helptips/ListGroup/ListGroup.module.css +6 -1
  88. package/es/setup/table/TableData/SetupTableData.module.css +11 -3
  89. package/es/setup/table/TableHead/SetupTableHead.module.css +4 -0
  90. package/es/setup/table/TableRow/SetupTableRow.module.css +6 -2
  91. package/es/version2/AlertClose/AlertClose.module.css +1 -1
  92. package/es/version2/GlobalNotification/GlobalNotification.module.css +44 -9
  93. package/es/version2/lookup/AlertHeader/AlertHeaderNew.module.css +25 -2
  94. package/es/version2/lookup/AlertLookup/AlertLookupNew.module.css +7 -3
  95. package/es/version2/lookup/alertLookupCommonNew.module.css +8 -1
  96. package/es/version2/notification/DesktopNotification/DesktopNotification.module.css +26 -10
  97. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +47 -10
  98. package/lib/ActionButton/ActionButton.module.css +0 -1
  99. package/lib/AttachmentViewer/Attachment.js +28 -0
  100. package/lib/AttachmentViewer/AttachmentImage.js +133 -0
  101. package/lib/AttachmentViewer/AttachmentViewer.js +646 -0
  102. package/lib/AttachmentViewer/AttachmentViewer.module.css +354 -0
  103. package/lib/AttachmentViewer/utils.js +134 -0
  104. package/lib/FreezeLayer/FreezeLayer.js +29 -4
  105. package/lib/ImportantNotes/ImportantNotes.js +5 -3
  106. package/lib/Provider/Config.js +21 -0
  107. package/lib/Provider.js +112 -37
  108. package/lib/common/dot_animation.module.css +27 -0
  109. package/lib/common/dot_common.module.css +4 -0
  110. package/lib/deprecated/utils/General.js +29 -0
  111. package/lib/{utils → deprecated/utils}/KeyboardApi.js +0 -0
  112. package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +1 -1
  113. package/lib/form/fields/CheckBoxField/CheckBoxField.js +1 -1
  114. package/lib/form/fields/CurrencyField/CurrencyField.js +9 -8
  115. package/lib/form/fields/DateField/DateField.js +1 -1
  116. package/lib/form/fields/MultiSelectField/MultiSelectField.js +1 -1
  117. package/lib/form/fields/PhoneField/PhoneField.js +1 -1
  118. package/lib/form/fields/RadioField/RadioField.js +1 -1
  119. package/lib/form/fields/SelectField/SelectField.js +1 -1
  120. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +27 -13
  121. package/lib/form/fields/TextBoxField/TextBoxField.js +1 -1
  122. package/lib/form/fields/TextEditor/TextEditor.js +4 -1
  123. package/lib/form/fields/TextEditor/TextEditor.module.css +13 -2
  124. package/lib/form/fields/TextareaField/TextareaField.js +1 -1
  125. package/lib/list/DepartmentDropDown/DepartmentDropDown.js +1 -1
  126. package/lib/list/GridStencils/GridStencils.module.css +3 -1
  127. package/lib/list/SecondaryText/SecondaryText.module.css +1 -1
  128. package/lib/list/status/StatusDropdown/StatusDropdown.js +45 -38
  129. package/lib/lookup/header/ModuleHeader/ModuleHeader.js +8 -3
  130. package/lib/lookup/header/TicketHeader/TicketHeader.js +7 -4
  131. package/lib/lookup/header/lookupHeaderCommon.module.css +8 -2
  132. package/lib/setup/header/Views/Views.js +2 -2
  133. package/lib/utils/General.js +0 -24
  134. package/package.json +7 -7
  135. package/es/utils/KeyboardApi.js +0 -294
@@ -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() : _this2.hiddenInput && _this2.hiddenInput.focus();
185
+ isPopupOpen && isSearch ? _this2.searchInput && _this2.searchInput.focus() : _this2.hiddenInput && _this2.hiddenInput.focus();
186
186
  }, 10);
187
187
  }
188
188
 
@@ -211,54 +211,61 @@ 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
- isPopupOpen = _this$props4.isPopupOpen,
214
+ isPopupReady = _this$props4.isPopupReady,
215
215
  isNextOptions = _this$props4.isNextOptions,
216
216
  getNextOptions = _this$props4.getNextOptions,
217
- onTogglePopup = _this$props4.onTogglePopup;
217
+ onTogglePopup = _this$props4.onTogglePopup,
218
+ isPopupOpen = _this$props4.isPopupOpen;
218
219
 
219
- if (isPopupOpen && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
220
+ if (isPopupReady && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
220
221
  e.preventDefault(); //prevent body scroll
221
222
  }
222
223
 
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();
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
+ });
232
239
  }
233
240
 
234
- this.setState({
235
- selectedIndex: selectedIndex + 1
236
- });
237
- }
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
+ }
238
253
 
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
- }
254
+ break;
251
255
 
252
- break;
256
+ case 13:
257
+ onClick && onClick(options[selectedIndex].name, e);
258
+ onTogglePopup && onTogglePopup(isPopupOpen);
259
+ togglePopup(e, boxPosition);
260
+ break;
253
261
 
254
- case 13:
255
- onClick && onClick(options[selectedIndex].name, e);
256
- onTogglePopup && onTogglePopup(isPopupOpen);
262
+ default:
263
+ break;
264
+ }
265
+ } else {
266
+ if (keyCode === 13 || keyCode === 40) {
257
267
  togglePopup(e, boxPosition);
258
- break;
259
-
260
- default:
261
- break;
268
+ }
262
269
  }
263
270
  }
264
271
  }, {
@@ -475,7 +482,7 @@ var StatusDropdown = /*#__PURE__*/function (_React$Component) {
475
482
  }));
476
483
  })) : isDataLoaded ? /*#__PURE__*/_react["default"].createElement(_CommonEmptyState["default"], {
477
484
  className: _StatusDropdownModule["default"].svgWrapper,
478
- title: searchErrorText || 'oops !',
485
+ title: searchErrorText || 'No results',
479
486
  description: searchEmptyHint,
480
487
  size: "small",
481
488
  getEmptyState: this.emptySearchSVG
@@ -80,11 +80,12 @@ var ModuleHeader = /*#__PURE__*/function (_PureComponent) {
80
80
  miniDescription = _this$props.miniDescription,
81
81
  dataId = _this$props.dataId,
82
82
  closeTitle = _this$props.closeTitle,
83
- onSearchKeyDown = _this$props.onSearchKeyDown;
83
+ onSearchKeyDown = _this$props.onSearchKeyDown,
84
+ palette = _this$props.palette;
84
85
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
85
86
  align: "vertical",
86
87
  alignBox: "row",
87
- className: "".concat(_lookupHeaderCommonModule["default"].container),
88
+ className: "".concat(_lookupHeaderCommonModule["default"].container, " ").concat(_lookupHeaderCommonModule["default"]["".concat(palette)]),
88
89
  isCover: false,
89
90
  wrap: "wrap",
90
91
  dataId: dataId
@@ -134,7 +135,11 @@ ModuleHeader.propTypes = {
134
135
  title: _propTypes["default"].string,
135
136
  dataId: _propTypes["default"].string,
136
137
  closeTitle: _propTypes["default"].string,
137
- onSearchKeyDown: _propTypes["default"].func
138
+ onSearchKeyDown: _propTypes["default"].func,
139
+ palette: _propTypes["default"].oneOf(['default', 'white'])
140
+ };
141
+ ModuleHeader.defaultProps = {
142
+ palette: 'default'
138
143
  };
139
144
 
140
145
  if (false) {
@@ -82,13 +82,14 @@ var TicketHeader = /*#__PURE__*/function (_Component) {
82
82
  needOnTypeSearch = _this$props.needOnTypeSearch,
83
83
  getSearchBoxRef = _this$props.getSearchBoxRef,
84
84
  needViewsList = _this$props.needViewsList,
85
- i18nKeys = _this$props.i18nKeys;
85
+ i18nKeys = _this$props.i18nKeys,
86
+ palette = _this$props.palette;
86
87
  var _i18nKeys$menuEmptyMe = i18nKeys.menuEmptyMessage,
87
88
  menuEmptyMessage = _i18nKeys$menuEmptyMe === void 0 ? 'No matches found' : _i18nKeys$menuEmptyMe;
88
89
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
89
90
  align: "vertical",
90
91
  alignBox: "row",
91
- className: "".concat(_lookupHeaderCommonModule["default"].container, " ").concat(_lookupHeaderCommonResponsiveModule["default"].container, " ").concat(_TicketHeaderModule["default"].container),
92
+ className: "".concat(_lookupHeaderCommonModule["default"].container, " ").concat(_lookupHeaderCommonModule["default"]["".concat(palette)], " ").concat(_lookupHeaderCommonResponsiveModule["default"].container, " ").concat(_TicketHeaderModule["default"].container),
92
93
  isCover: false,
93
94
  wrap: "wrap"
94
95
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -156,10 +157,12 @@ TicketHeader.propTypes = {
156
157
  title: _propTypes["default"].string,
157
158
  i18nKeys: _propTypes["default"].shape({
158
159
  menuEmptyMessage: _propTypes["default"].string
159
- })
160
+ }),
161
+ palette: _propTypes["default"].oneOf(['default', 'white'])
160
162
  };
161
163
  TicketHeader.defaultProps = {
162
- i18nKeys: {}
164
+ i18nKeys: {},
165
+ palette: 'default'
163
166
  };
164
167
 
165
168
  if (false) {
@@ -1,13 +1,19 @@
1
1
  .container {
2
2
  min-height: var(--zd_size51);
3
3
  position: relative;
4
- background-color: var(--zdt_lookupheader_default_bg);
5
- border-bottom: solid 1px var(--zdt_lookupheader_default_border);
6
4
  }[dir=ltr] .container {
7
5
  padding: 0 var(--zd_size52) 0 var(--zd_size10);
8
6
  }[dir=rtl] .container {
9
7
  padding: 0 var(--zd_size10) 0 var(--zd_size52);
10
8
  }
9
+ .default {
10
+ background-color: var(--zdt_lookupheader_default_bg);
11
+ border-bottom: solid 1px var(--zdt_lookupheader_default_border);
12
+ }
13
+ .white {
14
+ background-color: var(--zdt_lookupheader_white_bg);
15
+ border-bottom: solid 1px var(--zdt_lookupheader_white_border);
16
+ }
11
17
  .searchContainer, .title {
12
18
  margin: 0 var(--zd_size20);
13
19
  }
@@ -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 : '',
65
+ "data-title": !isList ? listTitle : null,
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 : '',
72
+ "data-title": !isGrid ? gridTitle : null,
73
73
  onClick: onGridClick
74
74
  }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
75
75
  name: "ZD-grid",
@@ -3,14 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.formatCurrency = formatCurrency;
7
6
  exports.formatPhoneUrl = formatPhoneUrl;
8
7
  exports.getFullName = getFullName;
9
8
  exports.shallowDiff = shallowDiff;
10
9
  exports.stopBubbling = stopBubbling;
11
10
 
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
-
14
11
  function stopBubbling(event) {
15
12
  event.preventDefault();
16
13
  event.stopPropagation && event.stopPropagation();
@@ -58,25 +55,4 @@ function formatPhoneUrl(phone) {
58
55
  }
59
56
 
60
57
  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;
82
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-beta.225",
3
+ "version": "1.0.0-beta.226",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",
@@ -35,9 +35,9 @@
35
35
  "velocity-react": "1.4.3",
36
36
  "@zohodesk/variables": "1.0.0-beta.29",
37
37
  "@zohodesk/i18n": "1.0.0-beta.7",
38
- "@zohodesk/components": "1.0.0-alpha-237",
39
- "@zohodesk/icons": "1.0.0-beta.101",
40
- "@zohodesk/svg": "1.0.0-beta.43",
38
+ "@zohodesk/components": "1.0.0-alpha-238",
39
+ "@zohodesk/icons": "1.0.0-beta.105",
40
+ "@zohodesk/svg": "1.0.0-beta.47",
41
41
  "@zohodesk/virtualizer": "1.0.3",
42
42
  "react-sortable-hoc": "^0.8.3"
43
43
  },
@@ -45,9 +45,9 @@
45
45
  "velocity-react": "1.4.3",
46
46
  "@zohodesk/variables": "1.0.0-beta.29",
47
47
  "@zohodesk/i18n": "1.0.0-beta.7",
48
- "@zohodesk/components": "1.0.0-alpha-237",
49
- "@zohodesk/icons": "1.0.0-beta.101",
50
- "@zohodesk/svg": "1.0.0-beta.43"
48
+ "@zohodesk/components": "1.0.0-alpha-238",
49
+ "@zohodesk/icons": "1.0.0-beta.105",
50
+ "@zohodesk/svg": "1.0.0-beta.47"
51
51
  },
52
52
  "react-cli": {
53
53
  "preprocessor": {
@@ -1,294 +0,0 @@
1
- //$Id$
2
- let isShortCutEnabled;
3
- let showShortcut = {};
4
- let shortcutdatas = {};
5
- let additionalKey = {};
6
- let _SpecialKeyMaps = {
7
- 8: 'backspace',
8
- 9: 'tab',
9
- 13: 'enter',
10
- 16: 'shift',
11
- 17: 'ctrl',
12
- 18: 'alt',
13
- //20: 'capslock',
14
- 27: 'esc',
15
- 32: 'space',
16
- //33: 'pageup',
17
- //34: 'pagedown',
18
- //35: 'end',
19
- //36: 'home',
20
- 37: 'left',
21
- 38: 'up',
22
- 39: 'right',
23
- 40: 'down',
24
- 46: 'del',
25
- 91: 'meta',
26
- 93: 'meta',
27
- 224: 'meta',
28
- 43: 'plus',
29
- // +
30
- 61: 'plus',
31
- // = , in firefox
32
- 63: 'ques',
33
- // ?
34
- 187: 'plus',
35
- // =
36
- 191: 'slash' // /
37
-
38
- };
39
- export function Shortcut(target) {
40
- _addEvent(target, 'keypress', keycallback);
41
-
42
- _addEvent(target, 'keydown', keycallback);
43
-
44
- _addEvent(target, 'keyup', keycallback);
45
- }
46
-
47
- Shortcut.setState = function (isEnabled) {
48
- isShortCutEnabled = isEnabled;
49
- };
50
-
51
- Shortcut.addAll = function (keysObj, props) {
52
- showShortcut = props.showShortcut;
53
- isShortCutEnabled && keysObj.map((keyOptions, index) => {
54
- Shortcut.add(keyOptions.keyCombo, keyOptions.keyCallback(props), keyOptions.keyAction, keyOptions.displayLabel || []);
55
- return;
56
- });
57
- };
58
- /**
59
- * @param keycombo = 'z' or 'z+e' or 'shift+a' etc..
60
- * @param callback = any function
61
- * @param action = keypress or keydown or keyup
62
- */
63
-
64
-
65
- Shortcut.bulkAdd = function (shortcutArray) {
66
- showShortcut && shortcutArray.map(shortcutObj => {
67
- Shortcut.add(shortcutObj.keyCombo, shortcutObj.keyCallback, shortcutObj.keyAction, shortcutObj.displayLabel || []);
68
- });
69
- };
70
-
71
- Shortcut.add = function (keycombo, cpFunc, action, displayLabel) {
72
- if (!keycombo || !isShortCutEnabled) {
73
- return;
74
- }
75
-
76
- let tempjson = {};
77
-
78
- if (cpFunc === undefined) {
79
- cpFunc = function (keycode, keyOptions, e) {
80
- _defaultCallBack(keycode, keyOptions);
81
- };
82
- } else {
83
- let oldfunc = cpFunc;
84
-
85
- cpFunc = function (keycode, keyOptions, ev) {
86
- oldfunc(keycode, ev);
87
- };
88
- }
89
-
90
- tempjson.key = keycombo.toLowerCase();
91
- tempjson.displayLabel = displayLabel;
92
- tempjson.keyOptions = cpFunc;
93
- tempjson.action = action || 'keypress';
94
- shortcutdatas[keycombo.toLowerCase()] = tempjson;
95
- };
96
- /*Shortcut.prototype.remove = function(){
97
-
98
- };*/
99
-
100
-
101
- Shortcut.removeAll = function () {
102
- shortcutdatas = {};
103
- };
104
-
105
- Shortcut.show = function () {
106
- return Object.assign({}, shortcutdatas);
107
- };
108
-
109
- Shortcut.remove = function (keyCombo) {
110
- keyCombo = Array.isArray(keyCombo) ? keyCombo : [keyCombo];
111
- keyCombo.map(key => {
112
- delete shortcutdatas[key];
113
- });
114
- };
115
-
116
- Shortcut.init = function (doc) {
117
- let documentshortcut = Shortcut(doc);
118
-
119
- for (let method in documentshortcut) {
120
- if (method.charAt(0) !== '_') {
121
- Shortcut[method] = function (method) {
122
- return function () {
123
- return documentshortcut[method](...arguments);
124
- };
125
- }(method);
126
- }
127
- }
128
- };
129
-
130
- function _addEvent(object, type, callback) {
131
- if (object.addEventListener) {
132
- object.addEventListener(type, callback, false);
133
- return;
134
- }
135
-
136
- object.attachEvent(`on${type}`, callback);
137
- }
138
-
139
- export function keycallback(e) {
140
- if (!isShortCutEnabled) {
141
- return;
142
- }
143
-
144
- let keyaction = e.type;
145
-
146
- let keycode = _convertToKeyCharacter(e);
147
-
148
- if (e.metaKey) {
149
- return;
150
- }
151
-
152
- _bindNeedData(e, keyaction);
153
-
154
- if ('esc' !== keycode) {
155
- if (_shortRestrictionPlaces(e)) {
156
- //return if type any text in input tag or texta area
157
- return;
158
- }
159
- }
160
-
161
- keycode = _eventModifiers(e) + keycode;
162
- let keycodedata = shortcutdatas[keycode];
163
-
164
- if (keycodedata) {
165
- e.preventDefault();
166
- }
167
-
168
- if (keycodedata && keyaction === keycodedata.action && keycodedata.keyOptions) {
169
- keycodedata.keyOptions && keycodedata.keyOptions(keycode, keycodedata.keyOptions, e);
170
- showShortcut({
171
- type: 'SHORTCUT_SHOW',
172
- displayLabel: keycodedata.displayLabel
173
- });
174
- }
175
- }
176
-
177
- function _eventModifiers(e) {
178
- if (e.shiftKey === true && e.metaKey === true) {
179
- return 'command+shift+';
180
- }
181
-
182
- if (e.shiftKey === true && e.ctrlKey === true) {
183
- return 'ctrl+shift+';
184
- }
185
-
186
- if (e.altKey === true && e.ctrlKey === true) {
187
- return 'alt+ctrl+';
188
- }
189
-
190
- if (e.ctrlKey === true) {
191
- return 'ctrl+';
192
- }
193
-
194
- if (e.metaKey === true) {
195
- return 'command+';
196
- }
197
-
198
- if (e.shiftKey === true) {
199
- return 'shift+';
200
- }
201
-
202
- if (additionalKey.zpress === true) {
203
- return 'z+';
204
- } else if (additionalKey.apress === true) {
205
- return 'a+';
206
- } else if (additionalKey.cpress === true) {
207
- return 'c+';
208
- } else if (additionalKey.dpress === true) {
209
- return 'd+';
210
- } else if (additionalKey.fpress === true) {
211
- return 'f+';
212
- } else if (additionalKey.kpress === true) {
213
- return 'k+';
214
- } else if (additionalKey.ppress === true) {
215
- return 'p+';
216
- } else if (additionalKey.rpress === true) {
217
- return 'r+';
218
- } else if (additionalKey.tpress === true) {
219
- return 't+';
220
- } else if (additionalKey.epress === true) {
221
- return 'e+';
222
- } else if (additionalKey.lpress === true) {
223
- return 'l+';
224
- }
225
-
226
- return '';
227
- }
228
-
229
- function _bindNeedData(e, keyaction) {
230
- let keyName = String.fromCharCode(e.keyCode).toLowerCase();
231
-
232
- if (['z', 'a', 'c', 'd', 'f', 'k', 'p', 'r', 't', 'l', 'e'].indexOf(keyName) !== -1) {
233
- let extraName = `${keyName}press`;
234
-
235
- if (keyaction === 'keydown') {
236
- additionalKey = !additionalKey[extraName] ? Object.assign({}, additionalKey, {
237
- [extraName]: true
238
- }) : additionalKey;
239
- additionalKey[extraName] = true;
240
- } else if (keyaction === 'keyup') {
241
- additionalKey = !additionalKey[extraName] ? Object.assign({}, additionalKey, {
242
- [extraName]: false
243
- }) : additionalKey;
244
- additionalKey[extraName] = false;
245
- }
246
- }
247
- }
248
-
249
- function _convertToKeyCharacter(e) {
250
- let keyCode = e.keyCode || e.charCode;
251
- let keyName = String.fromCharCode(keyCode).toLowerCase();
252
- keyName = _SpecialKeyMaps.hasOwnProperty(keyCode) ? _SpecialKeyMaps[keyCode] : keyName;
253
- return keyName;
254
- }
255
-
256
- function _defaultCallBack(keycombo, keyOptions) {
257
- /*var keyElement = jQuery("[data-shortcut-key='" + keycombo + "']");
258
- if (keyOptions.callbackflow !== undefined) {
259
- keycombo = keyOptions.callbackflow.split(',');
260
- var click = function(i, combo) {
261
- setTimeout(function() {
262
- jQuery("[data-shortcut-key='" + combo + "']").trigger('click');
263
- }, i * 200);
264
- };
265
- for (var i = 0; i < keycombo.length; i++) {
266
- var clickFunc = click.bind(this, i);
267
- clickFunc(keycombo[i]);
268
- highLightKeys(keycombo[i]);
269
- }
270
- return;
271
- }
272
- if (keyElement.length === 1) {
273
- keyElement.trigger('click');
274
- highLightKeys(keycombo);
275
- return;
276
- }*/
277
- }
278
-
279
- function _shortRestrictionPlaces(e) {
280
- let _target = e.target;
281
- let {
282
- tagName
283
- } = _target;
284
- let keyCode = e.keyCode || e.charCode;
285
- let isContentEditable = _target.contentEditable === 'true';
286
-
287
- if (['TEXTAREA', 'INPUT', 'SELECT'].indexOf(tagName) !== -1 || //!SupportUI.CurrentUser.getKBStatus() ||
288
- //restrict_keyUI() ||
289
- keyCode >= 112 && keyCode <= 123 || isContentEditable) {
290
- return true;
291
- }
292
-
293
- return false;
294
- }