tplus-components-touch 3.53.2 → 3.54.1

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 (176) hide show
  1. package/dist/components/collection/api.js +105 -0
  2. package/dist/components/collection/api.js.map +1 -0
  3. package/dist/components/collection/searchView/index.less +134 -0
  4. package/dist/components/password/style.less +95 -0
  5. package/dist/components/settlement/settlement.less +10 -0
  6. package/dist/components/ticon/iconfont/demo_index.html +72 -3
  7. package/dist/components/ticon/iconfont/iconfont.css +15 -3
  8. package/dist/components/ticon/iconfont/iconfont.json +21 -0
  9. package/dist/components/ticon/iconfont/iconfont.ttf +0 -0
  10. package/dist/components/ticon/iconfont/iconfont.woff +0 -0
  11. package/dist/components/ticon/iconfont/iconfont.woff2 +0 -0
  12. package/dist/index.js +22 -1
  13. package/dist/index.js.map +1 -1
  14. package/package.json +3 -3
  15. package/dist/components/cloudPrint/printTemplate/template.js +0 -52
  16. package/dist/components/cloudPrint/printTemplate/template.js.map +0 -1
  17. package/dist/components/commonForm/addressPicker/index.js +0 -241
  18. package/dist/components/commonForm/addressPicker/index.js.map +0 -1
  19. package/dist/components/commonForm/autoComplete/index.js +0 -260
  20. package/dist/components/commonForm/autoComplete/index.js.map +0 -1
  21. package/dist/components/commonForm/datePicker/index.js +0 -92
  22. package/dist/components/commonForm/datePicker/index.js.map +0 -1
  23. package/dist/components/commonForm/formControl/index.js +0 -144
  24. package/dist/components/commonForm/formControl/index.js.map +0 -1
  25. package/dist/components/commonForm/index.js +0 -231
  26. package/dist/components/commonForm/index.js.map +0 -1
  27. package/dist/components/commonForm/inputNumber/index.js +0 -272
  28. package/dist/components/commonForm/inputNumber/index.js.map +0 -1
  29. package/dist/components/commonForm/radio/index.js +0 -132
  30. package/dist/components/commonForm/radio/index.js.map +0 -1
  31. package/dist/components/deliverySearch/api.js +0 -355
  32. package/dist/components/deliverySearch/api.js.map +0 -1
  33. package/dist/components/deliverySearch/index.js +0 -1222
  34. package/dist/components/deliverySearch/index.js.map +0 -1
  35. package/dist/components/form/index.js +0 -310
  36. package/dist/components/form/index.js.map +0 -1
  37. package/dist/components/hardwareAPI/index.js +0 -215
  38. package/dist/components/hardwareAPI/index.js.map +0 -1
  39. package/dist/components/hotKey/config.js +0 -306
  40. package/dist/components/hotKey/config.js.map +0 -1
  41. package/dist/components/hotKey/hotKeyModal.js +0 -479
  42. package/dist/components/hotKey/hotKeyModal.js.map +0 -1
  43. package/dist/components/hotKey/index.js +0 -790
  44. package/dist/components/hotKey/index.js.map +0 -1
  45. package/dist/components/hotKey/localConfig.js +0 -1203
  46. package/dist/components/hotKey/localConfig.js.map +0 -1
  47. package/dist/components/hotKey/utils.js +0 -135
  48. package/dist/components/hotKey/utils.js.map +0 -1
  49. package/dist/components/input/index.js +0 -254
  50. package/dist/components/input/index.js.map +0 -1
  51. package/dist/components/input/scanInput.js +0 -98
  52. package/dist/components/input/scanInput.js.map +0 -1
  53. package/dist/components/input/tplusInput/index.js +0 -81
  54. package/dist/components/input/tplusInput/index.js.map +0 -1
  55. package/dist/components/input/tplusInput/inputContent.js +0 -128
  56. package/dist/components/input/tplusInput/inputContent.js.map +0 -1
  57. package/dist/components/input/tplusInput/inputs.js +0 -151
  58. package/dist/components/input/tplusInput/inputs.js.map +0 -1
  59. package/dist/components/input/utils/index.js +0 -26
  60. package/dist/components/input/utils/index.js.map +0 -1
  61. package/dist/components/inventorySearch/api.js +0 -214
  62. package/dist/components/inventorySearch/api.js.map +0 -1
  63. package/dist/components/inventorySearch/index.js +0 -303
  64. package/dist/components/inventorySearch/index.js.map +0 -1
  65. package/dist/components/inventorySearch/store.js +0 -363
  66. package/dist/components/inventorySearch/store.js.map +0 -1
  67. package/dist/components/inventorySearch/tab.js +0 -280
  68. package/dist/components/inventorySearch/tab.js.map +0 -1
  69. package/dist/components/keyboard/index.js +0 -259
  70. package/dist/components/keyboard/index.js.map +0 -1
  71. package/dist/components/keyboard/letterKeyboard.js +0 -227
  72. package/dist/components/keyboard/letterKeyboard.js.map +0 -1
  73. package/dist/components/keyboard/numKeyboard.js +0 -469
  74. package/dist/components/keyboard/numKeyboard.js.map +0 -1
  75. package/dist/components/keyboard/numKeyboardScan.js +0 -208
  76. package/dist/components/keyboard/numKeyboardScan.js.map +0 -1
  77. package/dist/components/keyboard/numberButton_input.js +0 -305
  78. package/dist/components/keyboard/numberButton_input.js.map +0 -1
  79. package/dist/components/keyboard/numkeyboardPassword.js +0 -477
  80. package/dist/components/keyboard/numkeyboardPassword.js.map +0 -1
  81. package/dist/components/keyboard/onlyKeyboard.js +0 -90
  82. package/dist/components/keyboard/onlyKeyboard.js.map +0 -1
  83. package/dist/components/keyboard/onlyLetterButton.js +0 -187
  84. package/dist/components/keyboard/onlyLetterButton.js.map +0 -1
  85. package/dist/components/keyboard/onlyLetterButton2.js +0 -235
  86. package/dist/components/keyboard/onlyLetterButton2.js.map +0 -1
  87. package/dist/components/keyboard/onlyNumberButton.js +0 -128
  88. package/dist/components/keyboard/onlyNumberButton.js.map +0 -1
  89. package/dist/components/keyboard/onlyNumberButton2.js +0 -115
  90. package/dist/components/keyboard/onlyNumberButton2.js.map +0 -1
  91. package/dist/components/keyboard/textKeyboard.js +0 -50
  92. package/dist/components/keyboard/textKeyboard.js.map +0 -1
  93. package/dist/components/layout/hamburger.js +0 -29
  94. package/dist/components/layout/hamburger.js.map +0 -1
  95. package/dist/components/layout/index.js +0 -31
  96. package/dist/components/layout/index.js.map +0 -1
  97. package/dist/components/layout/layout.js +0 -182
  98. package/dist/components/layout/layout.js.map +0 -1
  99. package/dist/components/layout/sider.js +0 -167
  100. package/dist/components/layout/sider.js.map +0 -1
  101. package/dist/components/loading/index.js +0 -198
  102. package/dist/components/loading/index.js.map +0 -1
  103. package/dist/components/loading/loadingContent.js +0 -188
  104. package/dist/components/loading/loadingContent.js.map +0 -1
  105. package/dist/components/loading/utils.js +0 -29
  106. package/dist/components/loading/utils.js.map +0 -1
  107. package/dist/components/message/index.js +0 -309
  108. package/dist/components/message/index.js.map +0 -1
  109. package/dist/components/modal/index.js +0 -93
  110. package/dist/components/modal/index.js.map +0 -1
  111. package/dist/components/modalVertical/index.js +0 -325
  112. package/dist/components/modalVertical/index.js.map +0 -1
  113. package/dist/components/modalWraper/index.js +0 -485
  114. package/dist/components/modalWraper/index.js.map +0 -1
  115. package/dist/components/modalWraper/utils.js +0 -48
  116. package/dist/components/modalWraper/utils.js.map +0 -1
  117. package/dist/components/notification/index.js +0 -118
  118. package/dist/components/notification/index.js.map +0 -1
  119. package/dist/components/overflowTip/index.js +0 -269
  120. package/dist/components/overflowTip/index.js.map +0 -1
  121. package/dist/components/page/index.js +0 -49
  122. package/dist/components/page/index.js.map +0 -1
  123. package/dist/components/presale/pickup.js +0 -479
  124. package/dist/components/presale/pickup.js.map +0 -1
  125. package/dist/components/product/detail.js +0 -148
  126. package/dist/components/product/detail.js.map +0 -1
  127. package/dist/components/product/getCard.js +0 -145
  128. package/dist/components/product/getCard.js.map +0 -1
  129. package/dist/components/progressState/EmptyAndErrorView.js +0 -142
  130. package/dist/components/progressState/EmptyAndErrorView.js.map +0 -1
  131. package/dist/components/progressState/ProgressState.js +0 -158
  132. package/dist/components/progressState/ProgressState.js.map +0 -1
  133. package/dist/components/progressState/index.js +0 -14
  134. package/dist/components/progressState/index.js.map +0 -1
  135. package/dist/components/scan/index.js +0 -219
  136. package/dist/components/scan/index.js.map +0 -1
  137. package/dist/components/select/index.js +0 -28
  138. package/dist/components/select/index.js.map +0 -1
  139. package/dist/components/settlement/asyncModal.js +0 -207
  140. package/dist/components/settlement/asyncModal.js.map +0 -1
  141. package/dist/components/settlement/index.js +0 -25
  142. package/dist/components/settlement/index.js.map +0 -1
  143. package/dist/components/settlement/moreCzkTable/index.js +0 -156
  144. package/dist/components/settlement/moreCzkTable/index.js.map +0 -1
  145. package/dist/components/settlement/prototypeTable/index.js +0 -353
  146. package/dist/components/settlement/prototypeTable/index.js.map +0 -1
  147. package/dist/components/settlement/prototypeTable/utils.js +0 -14
  148. package/dist/components/settlement/prototypeTable/utils.js.map +0 -1
  149. package/dist/components/settlement/settlement.js +0 -5557
  150. package/dist/components/settlement/settlement.js.map +0 -1
  151. package/dist/components/settlement/settlementApi.js +0 -512
  152. package/dist/components/settlement/settlementApi.js.map +0 -1
  153. package/dist/components/settlement/settlementStore.js +0 -2828
  154. package/dist/components/settlement/settlementStore.js.map +0 -1
  155. package/dist/components/settlement/utils.js +0 -249
  156. package/dist/components/settlement/utils.js.map +0 -1
  157. package/dist/components/socket/index.js +0 -221
  158. package/dist/components/socket/index.js.map +0 -1
  159. package/dist/components/spin/index.js +0 -95
  160. package/dist/components/spin/index.js.map +0 -1
  161. package/dist/components/test/index.js +0 -330
  162. package/dist/components/test/index.js.map +0 -1
  163. package/dist/components/ticon/iconfont/iconfont.js +0 -36
  164. package/dist/components/ticon/iconfont/iconfont.js.map +0 -1
  165. package/dist/components/ticon/index.js +0 -60
  166. package/dist/components/ticon/index.js.map +0 -1
  167. package/dist/components/touchScroll/index.js +0 -186
  168. package/dist/components/touchScroll/index.js.map +0 -1
  169. package/dist/components/touchTable/AuthProcess.js +0 -42
  170. package/dist/components/touchTable/AuthProcess.js.map +0 -1
  171. package/dist/components/touchTable/generateWater.js +0 -59
  172. package/dist/components/touchTable/generateWater.js.map +0 -1
  173. package/dist/components/touchTable/index.js +0 -1148
  174. package/dist/components/touchTable/index.js.map +0 -1
  175. package/dist/components/touchTable/utils.js +0 -27
  176. package/dist/components/touchTable/utils.js.map +0 -1
@@ -1,790 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
8
-
9
- var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
10
-
11
- var _from = require('babel-runtime/core-js/array/from');
12
-
13
- var _from2 = _interopRequireDefault(_from);
14
-
15
- var _getIterator2 = require('babel-runtime/core-js/get-iterator');
16
-
17
- var _getIterator3 = _interopRequireDefault(_getIterator2);
18
-
19
- var _promise = require('babel-runtime/core-js/promise');
20
-
21
- var _promise2 = _interopRequireDefault(_promise);
22
-
23
- var _extends2 = require('babel-runtime/helpers/extends');
24
-
25
- var _extends3 = _interopRequireDefault(_extends2);
26
-
27
- var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
28
-
29
- var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
30
-
31
- var _keys = require('babel-runtime/core-js/object/keys');
32
-
33
- var _keys2 = _interopRequireDefault(_keys);
34
-
35
- var _keymaster = require('keymaster');
36
-
37
- var _keymaster2 = _interopRequireDefault(_keymaster);
38
-
39
- var _utils = require('./utils');
40
-
41
- var _config = require('./config');
42
-
43
- var _hotKeyModal = require('./hotKeyModal');
44
-
45
- var _mutantsUtil = require('mutants-util');
46
-
47
- require('./style.less');
48
-
49
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
-
51
- /**
52
- * Created by hzy on 2019/11/27.
53
- */
54
- /**
55
- * @hotKey(option) 调用hotKey方法初始化状态
56
- * @option 可传入选项 {handler: 全局的句柄默认为$}
57
- * @observerCallback dom变化后的回调
58
- * @log 是否显示log
59
- * @hotKeyConfig 快捷键配置项
60
- * @operationControl 快捷键权限控制
61
- * @clickBefore 点击事件前的回调方法
62
- *
63
- * 初始化后的方法
64
- * action 传入第一个参数 按键字符串,触发config中的动作,返回一个promise,执行then方法可以从参数中拿到当前的上下文对象
65
- * action 第二个参数为回调函数,回调函数的参数会返回当前的动作触发的元素属性以及当前为第几步
66
- *
67
- * observer 监听dom变化,第一个参数为监听的dom目标,第二个参数为配置 具体查看 new MutationObserver observer
68
- * find 查找dom,可链式调用
69
- * next 查找下一个兄弟节点,参数中可传入数量跳过几个相邻的
70
- * prev 查找上一个兄弟节点,参数中可传入数量跳过几个相邻的
71
- * click 触发点击事件
72
- * register 注册一个全局的快捷键,第一个方法参数为快捷键名,第二个方法参数为目标容器class名,第三个方法参数为触发事件dom class名
73
- * unRegister 注销一个全局的快捷键
74
- *
75
- *
76
- * config & control 说明 见 ./config.js 文件
77
- *
78
- */
79
- var keyboard = _keymaster2.default.noConflict();
80
-
81
- var hotKeyFactory = {
82
- constructor: function constructor() {
83
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
84
- _ref$keys = _ref.keys,
85
- keys = _ref$keys === undefined ? [] : _ref$keys,
86
- _ref$handler = _ref.handler,
87
- handler = _ref$handler === undefined ? '$' : _ref$handler,
88
- observerCallback = _ref.observerCallback,
89
- pressed = _ref.pressed,
90
- _ref$log = _ref.log,
91
- log = _ref$log === undefined ? false : _ref$log,
92
- _ref$hotKeyConfig = _ref.hotKeyConfig,
93
- hotKeyConfig = _ref$hotKeyConfig === undefined ? _config.hotKeyConfig : _ref$hotKeyConfig,
94
- _ref$operationControl = _ref.operationControl,
95
- operationControl = _ref$operationControl === undefined ? _config.operationControl : _ref$operationControl,
96
- filter = _ref.filter,
97
- clickBefore = _ref.clickBefore;
98
-
99
- // keys = ['esc', 'enter', 'ctrl+f1', ...Object.keys(hotKeyInjectOrEject)];
100
- var observe = observerCallback && new MutationObserver(observerCallback);
101
- hotKeyFactory.showLog = log;
102
- // 如果快捷键配置不存在使用默认
103
- var defineHotKeyConfig = this.getDefineHotKeyConfigByStore();
104
-
105
- // hotKeyFactory.hotKeyConfig = Object.keys(defineHotKeyConfig).length?defineHotKeyConfig:hotKeyConfig;
106
- hotKeyFactory.hotKeyConfig = (0, _keys2.default)(defineHotKeyConfig).length ? defineHotKeyConfig : hotKeyConfig;
107
- keys = keys.length == 0 ? ['esc', 'enter', 'ctrl+f1'].concat((0, _toConsumableArray3.default)((0, _keys2.default)(hotKeyFactory.hotKeyConfig))) : keys;
108
-
109
- // 删除原来挂载的按键监听
110
- if (window[handler]) {
111
- keyboard.deleteScope(keyboard.getScope());
112
- }
113
- keyboard(keys.join(), pressed);
114
- keyboard.filter = filter;
115
-
116
- var defineOperationControl = this.getDefineOperationControlByStore(hotKeyFactory.hotKeyConfig);
117
- hotKeyFactory.operationControl = defineOperationControl || operationControl;
118
-
119
- // 排序复合结算
120
- if (hotKeyFactory.operationControl[5] && hotKeyFactory.operationControl[5].control && hotKeyFactory.operationControl[5].dynamicSelector) {
121
- var dynamicSelector = hotKeyFactory.operationControl[5].dynamicSelector;
122
- hotKeyFactory.operationControl[5].control = hotKeyFactory.newhotKeyArraySort(hotKeyFactory.operationControl[5].control, function (a, b) {
123
- return dynamicSelector[a] && dynamicSelector[b] ? dynamicSelector[a][0].replace('.settlement .paymode:', '') - dynamicSelector[b][0].replace('.settlement .paymode:', '') : -1;
124
- });
125
- }
126
-
127
- hotKeyFactory.clickBeforeProp = clickBefore;
128
- var controller = {
129
- keys: keys,
130
- hotKeyConfig: hotKeyFactory.hotKeyConfig,
131
- operationControl: hotKeyFactory.operationControl,
132
- action: this.actuator,
133
- find: this.find,
134
- next: this.next,
135
- find_element: this.find_element,
136
- getFocusId: this.getFocusId.bind(this),
137
- register: this.register,
138
- unRegister: this.unRegister,
139
- setFocus: this.setFocus,
140
- clearFocus: this.clearFocus,
141
- observerTrigger: observerCallback,
142
- bind: this.bind,
143
- unbind: this.unbind,
144
- on: this.on,
145
- off: this.off,
146
- observer: function observer(dom) {
147
- var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { attributes: true, childList: true, subtree: true };
148
-
149
- var containerDom = dom || document.body;
150
- observe.observe(containerDom, config);
151
- }
152
- };
153
- // if (!window[handler]) {
154
- window[handler] = controller;
155
- // }
156
- return controller;
157
- },
158
- asyncQueryHotKeyDom: function asyncQueryHotKeyDom(operator, currentNode) {
159
- var pollQueryDom = function pollQueryDom() {
160
- if (Array.isArray(operator)) {
161
- for (var index = 0; index < operator.length; index++) {
162
- var element = operator[index];
163
- var target = (0, _utils.queryHotKey)(element, currentNode);
164
- if (target) return target;
165
- }
166
- } else {
167
- var _target = (0, _utils.queryHotKey)(operator, currentNode);
168
- if (_target) return _target;
169
- }
170
- var result = (0, _utils.queryCount)();
171
- if (result === 'done') return;
172
-
173
- return pollQueryDom();
174
- };
175
-
176
- return pollQueryDom();
177
- },
178
-
179
-
180
- // 获取自定义快捷键
181
- getDefineHotKeyConfigByStore: function getDefineHotKeyConfigByStore() {
182
- // 正式环境使用缓存对象
183
- var setting_setData = _mutantsUtil.localStore.get("setting_setData");
184
- setting_setData = setting_setData == 'undefined' || !setting_setData ? [] : setting_setData;
185
- if (setting_setData == null) {
186
- setting_setData = JSON.parse(localStorage.getItem("setting_setData"));
187
- }
188
-
189
- // 本地调试使用
190
- // const setting_setData = window.web_hotKeyConfig
191
- var defineHotKeyConfig = {};
192
- var defineHotKeyConfigList = [];
193
- var conflictHotKeyConfigList = [];
194
- if (setting_setData && setting_setData.length != 0) {
195
- setting_setData.forEach(function (settingItem) {
196
- // 快捷键固定ParamType
197
- var _enumController$getEn = _mutantsUtil.enumController.getEnumOj(),
198
- RE_POSParamType = _enumController$getEn.RE_POSParamType;
199
-
200
- var SHORTCUT_KEY = RE_POSParamType.SHORTCUT_KEY;
201
-
202
- if (settingItem.ParamType && (settingItem.ParamType.Id === SHORTCUT_KEY || settingItem.ParamType === SHORTCUT_KEY)) {
203
- var _ref2 = settingItem || {},
204
- DefaultValue = _ref2.DefaultValue,
205
- ExtField = _ref2.ExtField,
206
- Title = _ref2.Title,
207
- ID = _ref2.ID,
208
- Value = _ref2.Value,
209
- Name = _ref2.Name,
210
- TabIndex = _ref2.TabIndex;
211
-
212
- var ExtFieldParse = { dynamic: false, classification: "", enableEdit: false, operation: [], operationType: 1, isdisplay: false };
213
- try {
214
- ExtFieldParse = JSON.parse(ExtField);
215
- } catch (error) {}
216
- var _ExtFieldParse = ExtFieldParse,
217
- dynamic = _ExtFieldParse.dynamic,
218
- classification = _ExtFieldParse.classification,
219
- enableEdit = _ExtFieldParse.enableEdit,
220
- operation = _ExtFieldParse.operation,
221
- operationType = _ExtFieldParse.operationType,
222
- isdisplay = _ExtFieldParse.isdisplay;
223
-
224
-
225
- var configItem = { Name: Name, describe: Title, dynamic: dynamic, keyValue: Value, operation: operation, enableEdit: enableEdit, classification: classification, id: ID, DefaultValue: DefaultValue, operationType: operationType, TabIndex: TabIndex, isdisplay: isdisplay };
226
-
227
- if (Value !== '') {
228
- // 快捷键未被设置为空
229
- if (defineHotKeyConfig[Value]) {
230
- // 存在使用相同快捷键
231
- var operationControl = defineHotKeyConfig[Value].operationControl;
232
-
233
- if (operationControl) {
234
- // 之前已经存入过两个快捷键 这是第三个
235
- if (!operationControl[operationType]) {
236
- defineHotKeyConfig[Value].operationControl[operationType] = configItem;
237
- } else {
238
- // 表示有冲突快捷键
239
- conflictHotKeyConfigList.push((0, _extends3.default)({}, configItem, { keyValue: "" }));
240
- return null;
241
- }
242
- } else {
243
- var itemOperationType = defineHotKeyConfig[Value].operationType;
244
-
245
- if (operationType == itemOperationType) {
246
- // 存在冲突快捷键 因为 dynamic 并未改变为动态键所致
247
- conflictHotKeyConfigList.push((0, _extends3.default)({}, configItem, { keyValue: "" }));
248
- return null;
249
- } else {
250
- // 存储第二个快捷键
251
- var _operationControl = (0, _extends3.default)({}, defineHotKeyConfig[Value], { dynamic: true });
252
- defineHotKeyConfig[Value] = {
253
- operationControl: {}
254
- };
255
- // 搬移一层对象信息到第二次 变为动态键
256
- defineHotKeyConfig[Value].dynamic = true;
257
- defineHotKeyConfig[Value].operationControl[itemOperationType] = _operationControl;
258
- // 增加第二个动态键
259
- defineHotKeyConfig[Value].operationControl[operationType] = (0, _extends3.default)({}, configItem, { dynamic: true });
260
- }
261
- }
262
- } else {
263
- // 单个动态键
264
- if (dynamic) {
265
- defineHotKeyConfig[Value] = {
266
- dynamic: true,
267
- operationControl: {}
268
- };
269
- defineHotKeyConfig[Value].operationControl[operationType] = (0, _extends3.default)({}, configItem, { dynamic: true });
270
- } else {
271
- defineHotKeyConfig[Value] = (0, _extends3.default)({}, configItem, { dynamic: false });
272
- }
273
- }
274
- } else {
275
- // 快捷键设置为空
276
- }
277
-
278
- defineHotKeyConfigList.push(configItem);
279
- }
280
- });
281
- } else {
282
- defineHotKeyConfig = _config.hotKeyConfig;
283
- }
284
- window.defineHotKeyConfigList = [].concat(defineHotKeyConfigList, conflictHotKeyConfigList);
285
- return defineHotKeyConfig;
286
- },
287
-
288
-
289
- // 获取自定义权限
290
- getDefineOperationControlByStore: function getDefineOperationControlByStore(defineHotKey) {
291
- // 获取自定义快捷键配置JSON KEY值集合
292
- var defineHotKeyList = (0, _keys2.default)(defineHotKey);
293
-
294
- var defineOperationControl = {};
295
-
296
- // 遍历自定义快捷键的key值
297
- defineHotKeyList.forEach(function (defineKey) {
298
- var _ref3 = defineHotKey[defineKey] || {},
299
- dynamic = _ref3.dynamic,
300
- operationControl = _ref3.operationControl;
301
- // 是否是动态键
302
-
303
-
304
- if (dynamic) {
305
- if (operationControl) {
306
- // 动态键
307
- var operationKeys = (0, _keys2.default)(operationControl);
308
- operationKeys.forEach(function (opKey) {
309
- var _ref4 = operationControl[opKey] || {},
310
- operation = _ref4.operation;
311
- // 构建权限页面结构
312
-
313
-
314
- if (!defineOperationControl[opKey]) {
315
- defineOperationControl[opKey] = {
316
- control: [],
317
- dynamicSelector: {}
318
- };
319
- }
320
-
321
- // 添加键值
322
- defineOperationControl[opKey].control.push(defineKey);
323
- // 如果是上下键 dynamicSelector值有所不同
324
- if (defineKey === 'down' || defineKey === 'up') {
325
- defineOperationControl[opKey].dynamicSelector['up&down'] = operation;
326
- return;
327
- }
328
- defineOperationControl[opKey].dynamicSelector[defineKey] = operation;
329
- });
330
- } else {
331
- var _ref5 = defineHotKey[defineKey] || {},
332
- operationType = _ref5.operationType,
333
- operation = _ref5.operation;
334
-
335
- if (!defineOperationControl[operationType]) {
336
- defineOperationControl[operationType] = {
337
- control: [],
338
- dynamicSelector: {}
339
- };
340
- }
341
- // 添加键值
342
- defineOperationControl[operationType].control.push(defineKey);
343
- defineOperationControl[operationType].dynamicSelector[defineKey] = operation;
344
- // const {}
345
- }
346
- }
347
- });
348
- return defineOperationControl;
349
- },
350
- newhotKeyArraySort: function newhotKeyArraySort(array, fn) {
351
- var t = void 0;
352
- fn = fn || function (x, y) {
353
- return x - y;
354
- };
355
- for (var i = 0; i < array.length; i++) {
356
- for (var j = i; j < array.length; j++) {
357
- if (fn(array[i], array[j]) > 0) {
358
- t = array[i];
359
- array[i] = array[j];
360
- array[j] = t;
361
- }
362
- }
363
- }
364
- return array;
365
- },
366
- dynamicAction: function dynamicAction(keyName, target) {
367
- var _ref6 = this.hotKeyConfig[keyName] || {},
368
- dynamic = _ref6.dynamic;
369
-
370
- if (!dynamic) return;
371
-
372
- var _ref7 = this.operationControl[this.focusId] || {},
373
- _ref7$dynamicSelector = _ref7.dynamicSelector,
374
- dynamicSelector = _ref7$dynamicSelector === undefined ? {} : _ref7$dynamicSelector;
375
-
376
- var _ref8 = this.operationControl[this.focusId] || {},
377
- _ref8$directionSelect = _ref8.directionSelector,
378
- directionSelector = _ref8$directionSelect === undefined ? {} : _ref8$directionSelect;
379
-
380
- var targetKey = 'up&down';
381
-
382
- if (keyName !== 'up' && keyName !== 'down') {
383
- targetKey = (0, _keys2.default)(dynamicSelector).find(function (key) {
384
- return key === keyName;
385
- });
386
- }
387
-
388
- var domSelector = dynamicSelector[targetKey];
389
- var actionNode = hotKeyFactory.queryNode(target).find(domSelector);
390
-
391
- if ('updown'.includes(keyName) && actionNode.currentNode) {
392
- var fnName = { down: 'next', up: 'prev' };
393
- actionNode = actionNode[fnName[keyName]]();
394
- }
395
-
396
- if (this.focusId == 7 && 'leftright'.includes(keyName) && actionNode.currentNode) {
397
- var _fnName = { right: 'next', left: 'prev' };
398
- actionNode = actionNode[_fnName[keyName]]();
399
- }
400
-
401
- actionNode.currentNode && actionNode.click();
402
-
403
- if (!actionNode.currentNode) {
404
- hotKeyFactory.log(true, { waring: 'the [' + keyName + '] hot-key of dynamic trigger Dom not found' });
405
- return true;
406
- }
407
-
408
- return actionNode.currentNode;
409
- },
410
- triggerRegister: function triggerRegister(keyName) {
411
- if (!hotKeyFactory.registerKey) return;
412
-
413
- var trigger = this.registerKey.find(function (item) {
414
- return item.key === keyName;
415
- });
416
- if (!trigger) return;
417
-
418
- var container = trigger.container,
419
- className = trigger.className;
420
-
421
- var containerDom = this.asyncQueryHotKeyDom(container);
422
- var targetDom = void 0;
423
- var classNameList = Array.isArray(className) ? className : [className];
424
- classNameList.some(function (name) {
425
- var queryDom = hotKeyFactory.queryNode(containerDom).find(name);
426
- targetDom = queryDom;
427
- return !!queryDom.currentNode;
428
- });
429
-
430
- targetDom.currentNode && targetDom.click();
431
- hotKeyFactory.log(!targetDom.currentNode, { waring: 'register hot-key trigger Dom not found' });
432
-
433
- hotKeyFactory.unlock();
434
- },
435
- register: function register(keyName) {
436
- return function (containerName) {
437
- return function (className) {
438
- var registerKey = {
439
- key: keyName,
440
- container: containerName,
441
- className: className
442
- };
443
-
444
- if (!hotKeyFactory.registerKey) {
445
- hotKeyFactory.registerKey = [registerKey];
446
- } else {
447
- var addKey = [].concat((0, _toConsumableArray3.default)(hotKeyFactory.registerKey.filter(function (item) {
448
- return item.key !== keyName;
449
- })), [registerKey]);
450
- hotKeyFactory.registerKey = addKey;
451
- }
452
- };
453
- };
454
- },
455
- unRegister: function unRegister(keyName) {
456
- if (hotKeyFactory.registerKey) {
457
- var keys = hotKeyFactory.registerKey.filter(function (item) {
458
- return item.key !== keyName;
459
- });
460
- hotKeyFactory.registerKey = keys;
461
- }
462
- },
463
- queryNode: function queryNode(target) {
464
- var find = this.find,
465
- next = this.next,
466
- prev = this.prev,
467
- setFocus = this.setFocus,
468
- clearFocus = this.clearFocus;
469
-
470
-
471
- return {
472
- currentNode: target,
473
- find: find,
474
- next: next,
475
- prev: prev,
476
- setFocus: setFocus,
477
- clearFocus: clearFocus,
478
- click: function click() {
479
- hotKeyFactory.clickBefore();
480
- this.currentNode.click();
481
- }
482
- };
483
- },
484
- rejectDoAction: function rejectDoAction(keyName) {
485
- var id = hotKeyFactory.getFocusId();
486
- if (!id) return true;
487
-
488
- var _ref9 = this.operationControl[id] || {},
489
- control = _ref9.control,
490
- directionSelector = _ref9.directionSelector;
491
-
492
- // if (control === 'ALL') return;
493
-
494
-
495
- if (id == '1') return; //动态生成id=='1' 代替ALL
496
- if (!control || !control.includes(keyName)) return true;
497
- },
498
- action: function action(keyName, className) {
499
- var _this = this;
500
-
501
- return new _promise2.default(function (resolve, reject) {
502
- var target = _this.asyncQueryHotKeyDom(className);
503
-
504
- var dynamicActionTarget = hotKeyFactory.dynamicAction(keyName, target);
505
- if (dynamicActionTarget) return resolve(dynamicActionTarget);
506
-
507
- if (target) {
508
- var hotKeyProto = hotKeyFactory.queryNode(target);
509
-
510
- hotKeyProto.click();
511
- hotKeyFactory.unlock();
512
-
513
- resolve(hotKeyProto);
514
- } else {
515
- hotKeyFactory.log(true, { waring: 'not found hot ket target of [' + className + ']' });
516
- hotKeyFactory.unlock();
517
- }
518
- });
519
- },
520
- actionCompose: function actionCompose(operation, keyName, callback) {
521
- var _this2 = this;
522
-
523
- var actionPromise = null;
524
- var prveValue = null;
525
- var listener = hotKeyFactory.listener;
526
-
527
-
528
- operation.forEach(function (value, index) {
529
- if (!actionPromise) {
530
- prveValue = value;
531
- actionPromise = hotKeyFactory.action(keyName, value);
532
- if (index === operation.length - 1) {
533
- actionPromise.then(function (res) {
534
- listener(callback, res, index);
535
- hotKeyFactory.unlock();
536
- return _this2;
537
- });
538
- }
539
- } else {
540
- actionPromise.then(function (res) {
541
- listener(callback, res, index - 1);
542
- prveValue = value;
543
- return hotKeyFactory.action(keyName, value);
544
- });
545
-
546
- if (index === operation.length - 1) {
547
- actionPromise.then(function (res) {
548
- listener(callback, res, index);
549
- hotKeyFactory.unlock();
550
- return _this2;
551
- });
552
- }
553
- }
554
- });
555
-
556
- return actionPromise;
557
- },
558
- actuator: function actuator(keyName, callback) {
559
- hotKeyFactory.log(true, { keyName: keyName });
560
-
561
- if (hotKeyFactory.isShouldQuickKeyClicked()) return null;
562
- // if (hotKeyFactory.lock) return;
563
- hotKeyFactory.lock = true;
564
-
565
- if (hotKeyFactory.triggerRegister(keyName)) return;
566
- if (hotKeyFactory.rejectDoAction(keyName)) return;
567
-
568
- var _ref10 = this.hotKeyConfig[keyName] || {},
569
- _ref10$operation = _ref10.operation,
570
- operation = _ref10$operation === undefined ? ['.hot-key-focus-container'] : _ref10$operation;
571
-
572
- var operations = Array.isArray(operation[0]) ? operation : [operation]; // 存在一个按键操作多个节点
573
-
574
- operations.forEach(function (operationItem) {
575
- return hotKeyFactory.actionCompose(operationItem, keyName, callback);
576
- });
577
- },
578
- find: function find(selector, isNew) {
579
- var currentNode = void 0;
580
- if (!this.currentNode || isNew) {
581
- currentNode = hotKeyFactory.asyncQueryHotKeyDom(selector);
582
- } else {
583
- currentNode = hotKeyFactory.asyncQueryHotKeyDom(selector, this.currentNode);
584
- }
585
-
586
- return hotKeyFactory.queryNode(currentNode);
587
- },
588
- next: function next() {
589
- var filterNum = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
590
-
591
- for (var i = 0; i < filterNum; i++) {
592
- if (!this.currentNode) {
593
- hotKeyFactory.log(true, { waring: 'There is a warning in the next,trigger Dom is not found ' });
594
- break;
595
- }
596
- this.currentNode = this.currentNode.nextSibling;
597
- }
598
-
599
- return this;
600
- },
601
- prev: function prev() {
602
- var filterNum = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
603
-
604
- for (var i = 0; i < filterNum; i++) {
605
- if (!this.currentNode) {
606
- hotKeyFactory.log(true, { waring: 'There is a warning in the prev,trigger Dom is not found ' });
607
- break;
608
- }
609
- this.currentNode = this.currentNode.previousSibling;
610
- }
611
-
612
- return this;
613
- },
614
- find_element: function find_element(selector) {
615
- var returnValue = [];
616
- var arr = selector.split(' ');
617
- if (arr && arr.length > 0) {
618
- arr.map(function (item) {
619
- var el = document.querySelectorAll('.hot-key-focus-container ' + item);
620
- returnValue = [].concat((0, _toConsumableArray3.default)(returnValue), (0, _toConsumableArray3.default)(el));
621
- });
622
- returnValue = returnValue && [].concat((0, _toConsumableArray3.default)(returnValue)).filter(function (v) {
623
- return v.style.display != 'none';
624
- });
625
- }
626
- return returnValue;
627
- },
628
- setFocus: function setFocus(target) {
629
- var container = target || this.currentNode;
630
- container && container.classList.add('hot-key-focus-container');
631
- //hotKeyFactory.log(!container, { waring: 'the set focus container Dom is not found' });
632
- },
633
- clearFocus: function clearFocus() {
634
- var focusContainer = document.querySelectorAll('.hot-key-focus-container');
635
-
636
- var _iteratorNormalCompletion = true;
637
- var _didIteratorError = false;
638
- var _iteratorError = undefined;
639
-
640
- try {
641
- for (var _iterator = (0, _getIterator3.default)(focusContainer), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
642
- var dom = _step.value;
643
-
644
- dom.classList.remove('hot-key-focus-container');
645
- }
646
- } catch (err) {
647
- _didIteratorError = true;
648
- _iteratorError = err;
649
- } finally {
650
- try {
651
- if (!_iteratorNormalCompletion && _iterator.return) {
652
- _iterator.return();
653
- }
654
- } finally {
655
- if (_didIteratorError) {
656
- throw _iteratorError;
657
- }
658
- }
659
- }
660
-
661
- hotKeyFactory.log(true, { log: 'the focus container is clear' });
662
- },
663
- clickBefore: function clickBefore() {
664
- var clickBeforeProp = hotKeyFactory.clickBeforeProp;
665
-
666
- clickBeforeProp && clickBeforeProp();
667
- },
668
- unlock: function unlock() {
669
- hotKeyFactory.lock = false;
670
- },
671
- getFocusId: function getFocusId() {
672
- var focusContainer = document.querySelector('.hot-key-focus-container');
673
- if (!focusContainer) return hotKeyFactory.log(true, { waring: 'the focus container is not found' });
674
-
675
- var classList = void 0;
676
- var currentClassList = (0, _from2.default)(focusContainer.classList) || [];
677
- if (currentClassList.includes('hot-key-id')) {
678
- classList = currentClassList;
679
- } else {
680
- var hotKeyIdNode = focusContainer.querySelector('.hot-key-id');
681
- hotKeyFactory.log(!hotKeyIdNode, { waring: 'not have any bind hot-key id node' });
682
-
683
- if (!hotKeyIdNode) return;
684
-
685
- classList = (0, _from2.default)(hotKeyIdNode.classList) || [];
686
- }
687
-
688
- var _split = (classList.find(function (className) {
689
- return className.includes('hot-key-id=');
690
- }) || '').split('='),
691
- _split2 = (0, _slicedToArray3.default)(_split, 2),
692
- id = _split2[1];
693
-
694
- this.focusId = id;
695
-
696
- return id;
697
- },
698
- bind: function bind() {
699
- var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
700
- var callBack = arguments[1];
701
-
702
- keyboard(keys.join(), callBack);
703
- },
704
- unbind: function unbind() {
705
- var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
706
-
707
- keys.forEach(function (key) {
708
- return keyboard.unbind(key);
709
- });
710
- },
711
-
712
- handles: [],
713
- on: function on(callback) {
714
- var handles = hotKeyFactory.handles || [];
715
- var isHaveEvent = handles.some(function (handle) {
716
- return handle === callback;
717
- });
718
-
719
- if (!isHaveEvent) {
720
- handles.push(callback);
721
- }
722
- },
723
- off: function off(callback) {
724
- var handles = hotKeyFactory.handles || [];
725
- var handleIndex = handles.findIndex(function (handle) {
726
- return handle === callback;
727
- });
728
-
729
- if (~handleIndex) {
730
- handles.splice(handleIndex, 1);
731
- }
732
- },
733
- listener: function listener(callback) {
734
- var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
735
- var index = arguments[2];
736
-
737
- var node = result.nodeType === 1 ? result : result.currentNode;
738
- hotKeyFactory.handles.forEach(function (handle) {
739
- return handle(node, index);
740
- });
741
-
742
- callback && callback(node, index);
743
- },
744
- log: function log(isShowLog) {
745
- var _ref11 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
746
- keyName = _ref11.keyName,
747
- waring = _ref11.waring;
748
-
749
- if (!this.showLog || !isShowLog) return;
750
-
751
- if (keyName) console.log('[hot-key]: ' + keyName);
752
- if (waring) console.log('[hot-key-waring]: ' + waring);
753
- },
754
- isShouldQuickKeyClicked: function isShouldQuickKeyClicked() {
755
- var loadingImgs = document.querySelector("img.loading-img-symbol");
756
- if (loadingImgs) return true;
757
- }
758
- };
759
-
760
- function hotKey(option) {
761
- return hotKeyFactory.constructor.call(hotKeyFactory, option);
762
- }
763
-
764
- hotKey.hotKeyPart = function (partName) {
765
- var otherClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
766
-
767
- return otherClassName + ' hot-key-part-' + partName;
768
- };
769
-
770
- hotKey.hotKeyBindClass = function (id) {
771
- var otherClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
772
-
773
- return otherClassName + ' hot-key-id hot-key-id=' + id;
774
- };
775
-
776
- hotKey.hotKeyNotFilter = function () {
777
- var otherClassName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
778
-
779
- return otherClassName + ' hot-key-not-filter';
780
- };
781
-
782
- hotKey.hotKeyConfig = _config.hotKeyConfig;
783
- hotKey.operationControl = _config.operationControl;
784
- hotKey.showHotKeyModal = _hotKeyModal.showHotKeyModal;
785
- hotKey.classificationList = _config.classificationList;
786
- hotKey.keyReplaceStringList = _config.keyReplaceStringList;
787
- hotKey.operationTypeName = _config.operationTypeName;
788
-
789
- exports.default = hotKey;
790
- //# sourceMappingURL=index.js.map