fastman2 2.9.0 → 3.0.0-alpha.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.
- package/actionsheetman.js +96 -1
- package/alertman.js +79 -1
- package/annotationman.js +2912 -17
- package/baseman.js +115 -1
- package/blankpageman.js +171 -1
- package/cascadepickerman.js +322 -1
- package/confirmman.js +87 -1
- package/coreman.js +2182 -3
- package/cryptoman.js +8931 -2
- package/datetimepickerman.js +181 -1
- package/domman.js +2759 -1
- package/eventemitterman.js +112 -1
- package/fileuploadman.js +2970 -1
- package/formvalidateman.js +335 -1
- package/jsbridgeman.js +992 -1
- package/lazyloadman.js +133 -1
- package/loadingman.js +81 -1
- package/modalman.js +264 -1
- package/mutationobserverman.js +356 -1
- package/package.json +1 -1
- package/passguardman.js +1722 -1
- package/persistman.js +60 -1
- package/pickerman.js +680 -1
- package/popupman.js +61 -1
- package/postman.js +1649 -1
- package/preloadman.js +8760 -2
- package/resultpageman.js +153 -1
- package/routerman.js +1201 -1
- package/scrollman-infiniteRefresh.js +117 -1
- package/scrollman-pullDownRefresh.js +302 -1
- package/scrollman.js +2567 -2
- package/storeman.js +585 -1
- package/swiperman.js +4702 -1
- package/swiperoldman.js +3005 -1
- package/tabman.js +145 -1
- package/tipman.js +110 -1
- package/toastman.js +78 -1
- package/toolman.js +22 -1
- package/whenman.js +774 -1
- package/wsman.js +7624 -1
package/coreman.js
CHANGED
|
@@ -1,9 +1,2188 @@
|
|
|
1
|
-
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["fastman"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["fastman"] = factory();
|
|
10
|
+
})(this, function() {
|
|
11
|
+
return webpackJsonpfastman([4],{
|
|
12
|
+
|
|
13
|
+
/***/ 131:
|
|
14
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
15
|
+
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
exports.app = undefined;
|
|
23
|
+
|
|
24
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*
|
|
25
|
+
* @Author: shenzhiwei
|
|
26
|
+
* @Date: 2019-07-28 15:32:50
|
|
27
|
+
* @Company: orientsec.com.cn
|
|
28
|
+
* @Description: core核心库
|
|
29
|
+
*/
|
|
30
|
+
// 依赖于fastClick库
|
|
31
|
+
|
|
32
|
+
// import appCache from 'appcache-nanny'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _router = __webpack_require__(52);
|
|
36
|
+
|
|
37
|
+
var _fastclick = __webpack_require__(164);
|
|
38
|
+
|
|
39
|
+
var _fastclick2 = _interopRequireDefault(_fastclick);
|
|
40
|
+
|
|
41
|
+
var _actionService = __webpack_require__(55);
|
|
42
|
+
|
|
43
|
+
var _actionService2 = _interopRequireDefault(_actionService);
|
|
44
|
+
|
|
45
|
+
var _modelService = __webpack_require__(57);
|
|
46
|
+
|
|
47
|
+
var _modelService2 = _interopRequireDefault(_modelService);
|
|
48
|
+
|
|
49
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
50
|
+
|
|
51
|
+
var Version = __webpack_require__(58);
|
|
52
|
+
|
|
53
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
54
|
+
|
|
55
|
+
var app = function app(_app) {
|
|
56
|
+
var view = _app.view || function () {
|
|
57
|
+
return "";
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 转场时清空当前的v-node
|
|
62
|
+
* @param match 当前路由匹配
|
|
63
|
+
*/
|
|
64
|
+
function loadDocument(match) {
|
|
65
|
+
if ($.router) {
|
|
66
|
+
if (!$.router.vdoms[match]) {
|
|
67
|
+
if (node) {
|
|
68
|
+
node = undefined;
|
|
69
|
+
routerTrace.push(match);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
$.loadDocument = loadDocument;
|
|
75
|
+
|
|
76
|
+
var routerTrace = []; // 路由轨迹
|
|
77
|
+
var model;
|
|
78
|
+
var actions = {};
|
|
79
|
+
var effects = {}; // 新增
|
|
80
|
+
var readies = [];
|
|
81
|
+
var hooks = {
|
|
82
|
+
onError: [],
|
|
83
|
+
onAction: [],
|
|
84
|
+
onUpdate: [],
|
|
85
|
+
onRender: [],
|
|
86
|
+
onRendered: [],
|
|
87
|
+
onPageInit: [],
|
|
88
|
+
onPageWillAppear: [],
|
|
89
|
+
onPageDidAppear: [],
|
|
90
|
+
onPageWillDisappear: []
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var extraHooks = {
|
|
94
|
+
// onPageLoadStart: EVENTS['pageLoadStart'],
|
|
95
|
+
// onPageLoadCancel: EVENTS['pageLoadCancel'],
|
|
96
|
+
// onPageLoadError: EVENTS['pageLoadError'],
|
|
97
|
+
// onPageLoadComplete: EVENTS['pageLoadComplete'],
|
|
98
|
+
onPageWillAppear: _router.EVENTS['pageAnimationStart'],
|
|
99
|
+
onPageDidAppear: _router.EVENTS['pageAnimationEnd'],
|
|
100
|
+
// onBeforePageRemove: EVENTS['beforePageRemove'],
|
|
101
|
+
// onPageRemoved: EVENTS['pageRemoved'],
|
|
102
|
+
onPageWillDisappear: _router.EVENTS['beforePageSwitch'],
|
|
103
|
+
onPageInit: _router.EVENTS['pageInit']
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
var actionTypes = {
|
|
107
|
+
action: 0,
|
|
108
|
+
effect: 1,
|
|
109
|
+
mutation: 2
|
|
110
|
+
|
|
111
|
+
// var plugins = [app].concat((app.plugins || []).map(function (plugin) {
|
|
112
|
+
// return plugin(app)
|
|
113
|
+
// }))
|
|
114
|
+
|
|
115
|
+
};var node;
|
|
116
|
+
var elements = [];
|
|
117
|
+
var element;
|
|
118
|
+
var root;
|
|
119
|
+
var batch = [];
|
|
120
|
+
var plugins = _app.plugins || [];
|
|
121
|
+
|
|
122
|
+
for (var i = -1; i < plugins.length; i++) {
|
|
123
|
+
// var plugin = i < 0 ? app : plugins[i](app) // todo 这里修改了注意啊
|
|
124
|
+
// 将函数的ref进行了修改
|
|
125
|
+
var reinit = function reinit(proxyEffects) {
|
|
126
|
+
init(actions, proxyEffects, "", false, actionTypes.effect, true);
|
|
127
|
+
};
|
|
128
|
+
var plugin = i < 0 ? _app : plugins[i](_app, reinit);
|
|
129
|
+
var obj = plugin.model;
|
|
130
|
+
|
|
131
|
+
if (obj != null) {
|
|
132
|
+
model = merge(model, obj);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (obj = plugin.actions) {
|
|
136
|
+
// 保证陈旧的plugins可以正常使用
|
|
137
|
+
init(actions, obj, "", true, actionTypes.action, false);
|
|
138
|
+
}
|
|
139
|
+
if (obj = plugin.mutations) {
|
|
140
|
+
// 为mutation变种增加函数前缀$
|
|
141
|
+
var newObj = {};
|
|
142
|
+
Object.keys(obj).forEach(function (key) {
|
|
143
|
+
// 兼容<2.1.2版本
|
|
144
|
+
newObj['$' + key] = obj[key];
|
|
145
|
+
// 自>=2.1.2版本开始变种函数不在具有$前缀,而是由强类型来约束
|
|
146
|
+
newObj[key] = obj[key];
|
|
147
|
+
});
|
|
148
|
+
init(actions, newObj, "", true, actionTypes.mutation, false);
|
|
149
|
+
}
|
|
150
|
+
if (obj = plugin.effects) {
|
|
151
|
+
Object.keys(obj).forEach(function (key) {
|
|
152
|
+
effects[key] = obj[key];
|
|
153
|
+
});
|
|
154
|
+
init(actions, obj, "", false, actionTypes.effect, false);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (obj = plugin.readies) {
|
|
158
|
+
readies = readies.concat(obj);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var _hooks = plugin.hooks;
|
|
162
|
+
if (obj = _hooks) {
|
|
163
|
+
Object.keys(obj).forEach(function (key) {
|
|
164
|
+
if (hooks[key]) {
|
|
165
|
+
hooks[key].push(obj[key]);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 遍历注册extraHook
|
|
172
|
+
Object.keys(extraHooks).forEach(function (key) {
|
|
173
|
+
// 注册路由页面相关生命周期事件
|
|
174
|
+
if (extraHooks[key]) {
|
|
175
|
+
$(document).on(extraHooks[key], function (e, pageId, $page) {
|
|
176
|
+
// 在pageInit生命周期内使用data-api方式注册scroller组件
|
|
177
|
+
// if (key === 'onPageInit') {
|
|
178
|
+
// $('[data-toggle="scroller"]').scroller()
|
|
179
|
+
// }
|
|
180
|
+
|
|
181
|
+
// 生命周期函数中新增actions函数,用于某些场景下需要初始化操作
|
|
182
|
+
for (var i = 0; i < hooks[key].length; i++) {
|
|
183
|
+
hooks[key][i](e, pageId, $page, actions, model);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
function onError(error) {
|
|
190
|
+
for (var i = 0; i < hooks.onError.length; i++) {
|
|
191
|
+
hooks.onError[i](error);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (i <= 0) {
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function init(container, group, lastName, shouldUpdate, type, enforceInit) {
|
|
200
|
+
Object.keys(group).forEach(function (key) {
|
|
201
|
+
// 如果是强制重建,需要重新建立对象的引用,否则引用还会指向上一个
|
|
202
|
+
if (!container[key] || enforceInit) {
|
|
203
|
+
container[key] = {};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
var name = lastName ? lastName + "." + key : key;
|
|
207
|
+
// var name = key
|
|
208
|
+
var action = group[key];
|
|
209
|
+
var i;
|
|
210
|
+
|
|
211
|
+
if (typeof action === "function") {
|
|
212
|
+
container[key] = function (data) {
|
|
213
|
+
var actionType = type;
|
|
214
|
+
for (i = 0; i < hooks.onAction.length; i++) {
|
|
215
|
+
hooks.onAction[i](name, data);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
var result;
|
|
219
|
+
// 如果是effect或mutation,需要将effect过滤掉,effect的调用通过DI实现
|
|
220
|
+
if (actionType === actionTypes.effect || actionType === actionTypes.mutation) {
|
|
221
|
+
var filterActions = {};
|
|
222
|
+
for (var actionName in actions) {
|
|
223
|
+
if (!effects[actionName]) {
|
|
224
|
+
filterActions[actionName] = actions[actionName];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (actionType === actionTypes.effect) {
|
|
229
|
+
if (!_actionService2.default.AllMutationActions) {
|
|
230
|
+
_actionService2.default.AllMutationActions = filterActions;
|
|
231
|
+
}
|
|
232
|
+
// 在 effect 执行前添加 model 以便于 effect 中可以使用
|
|
233
|
+
_modelService2.default.CurrentModel = model;
|
|
234
|
+
result = action.apply(undefined, arguments);
|
|
235
|
+
} else {
|
|
236
|
+
result = action(model, data, filterActions, onError);
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
result = action(model, data, actions, onError);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (result === null || result === undefined || typeof result.then === "function" || !shouldUpdate) {
|
|
243
|
+
return result;
|
|
244
|
+
} else {
|
|
245
|
+
for (i = 0; i < hooks.onUpdate.length; i++) {
|
|
246
|
+
hooks.onUpdate[i](model, result, data);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
model = merge(model, result);
|
|
250
|
+
render(model, view, name);
|
|
251
|
+
// 在 mutation 更新model 的同时刷新ModelCenterService
|
|
252
|
+
_modelService2.default.CurrentModel = model;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
} else {
|
|
256
|
+
// 第四个参数必须true,进入该流程的都是插件,因此逻辑保持原来的流程
|
|
257
|
+
init(container[key], action, name, true);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// // 自动更新应用程序
|
|
263
|
+
// if (appCache.isSupported()){
|
|
264
|
+
// function pad2(n) { return n < 10 ? '0' + n : n }
|
|
265
|
+
|
|
266
|
+
// function generateTimeRequestNumber() {
|
|
267
|
+
// var date = new Date();
|
|
268
|
+
// return date.getFullYear().toString() + pad2(date.getMonth() + 1) + pad2(date.getDate()) + pad2(date.getHours()) + pad2(date.getMinutes()) + pad2(date.getSeconds());
|
|
269
|
+
// }
|
|
270
|
+
|
|
271
|
+
// console.warn('applicationCache supported')
|
|
272
|
+
// // 增加时间戳,否则该文件会一直存储在disk memory中影响缓存机制
|
|
273
|
+
// appCache.set('loaderPath', './appcache-loader.html?t=' + generateTimeRequestNumber())
|
|
274
|
+
|
|
275
|
+
// // 注册相关appcache事件
|
|
276
|
+
// appCache.on('progress', function (e) {
|
|
277
|
+
// console.warn('progress Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
278
|
+
// })
|
|
279
|
+
// appCache.on('cached', function (e) {
|
|
280
|
+
// console.warn('cached Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
281
|
+
// })
|
|
282
|
+
// appCache.on('update', function (e) {
|
|
283
|
+
// console.warn('update Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
284
|
+
// })
|
|
285
|
+
// // 代表appCache的manifest文件被修改过后的第一次刷新
|
|
286
|
+
// appCache.on('updateready', function (e) {
|
|
287
|
+
// console.warn('updateready Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
288
|
+
// })
|
|
289
|
+
// // 代表第一次加载manifest文件
|
|
290
|
+
// appCache.on('cached', function (e) {
|
|
291
|
+
// console.warn('cached Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
292
|
+
// })
|
|
293
|
+
// // 代表appCache没有更新(比DOMContentLoaded事件执行晚)
|
|
294
|
+
// appCache.on('noupdate', function (e) {
|
|
295
|
+
// console.warn('noupdate Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
296
|
+
// })
|
|
297
|
+
// // manifest文件发生404
|
|
298
|
+
// appCache.on('obsolete', function (e) {
|
|
299
|
+
// console.error('obsolete Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
300
|
+
// })
|
|
301
|
+
// // manifest文件发生404
|
|
302
|
+
// appCache.on('error', function (e) {
|
|
303
|
+
// console.error('error Event ' + (typeof e == 'object' ? JSON.stringify(e) : e))
|
|
304
|
+
// })
|
|
305
|
+
|
|
306
|
+
// // 启动定时刷新缓存机制
|
|
307
|
+
// appCache.start()
|
|
308
|
+
|
|
309
|
+
// // 启动applicationcache特性
|
|
310
|
+
// appCache.update()
|
|
311
|
+
// } else {
|
|
312
|
+
// console.error('applicationCache not supported')
|
|
313
|
+
// }
|
|
314
|
+
|
|
315
|
+
load(function () {
|
|
316
|
+
$('.page-loading').remove();
|
|
317
|
+
|
|
318
|
+
// 当前浏览器是否支持sessionStorage特性
|
|
319
|
+
if (!_router.Util.supportStorage()) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
//root = app.root || document.body.appendChild(document.createElement("div"))
|
|
324
|
+
root = _app.root || document.body;
|
|
325
|
+
|
|
326
|
+
render(model, view);
|
|
327
|
+
|
|
328
|
+
// 记录路由轨迹
|
|
329
|
+
if (model.router) routerTrace.push(model.router.match);
|
|
330
|
+
|
|
331
|
+
for (var i = 0; i < readies.length; i++) {
|
|
332
|
+
readies[i](model, actions, onError);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// 初始化路由
|
|
336
|
+
var routerManager = $.router = new _router.Router();
|
|
337
|
+
// 保存打开过页面的vdom,用于页面后退等场景使用
|
|
338
|
+
//var __hash = Util.getUrlFragment(window.location.href)
|
|
339
|
+
routerManager.vdoms[model.router.match] = node;
|
|
340
|
+
// 保存初始化页面的Hash对应ViewId
|
|
341
|
+
var _$visibleSection = routerManager._getCurrentSection();
|
|
342
|
+
$.router.hash2ViewId[model.router.match] = _$visibleSection.attr('id');
|
|
343
|
+
|
|
344
|
+
// data-api方式注册scroller组件(必须放在页面page-current添加后执行,否则不起效果)
|
|
345
|
+
$('[data-toggle="scroller"]').scroller({
|
|
346
|
+
type: 'native'
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// 注册初始化的钩子程序
|
|
350
|
+
_$visibleSection.isBack = false;
|
|
351
|
+
_$visibleSection.trigger(_router.EVENTS.pageAnimationEnd, [_$visibleSection.attr('id'), _$visibleSection]);
|
|
352
|
+
_$visibleSection.trigger(_router.EVENTS.pageInit, [_$visibleSection.attr('id'), _$visibleSection]);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// // 当popState时(即浏览器后退)触发更新上一个Node
|
|
356
|
+
// function setNode(_node) {
|
|
357
|
+
// if (_node)
|
|
358
|
+
// node = _node
|
|
359
|
+
// }
|
|
360
|
+
// $.setNode = setNode
|
|
361
|
+
|
|
362
|
+
function load(fn) {
|
|
363
|
+
if (document.readyState[0] !== "l") {
|
|
364
|
+
console.log('DOMContentLoaded Event:' + document.readyState);
|
|
365
|
+
fn();
|
|
366
|
+
} else {
|
|
367
|
+
console.log('DOMContentLoaded Event');
|
|
368
|
+
document.addEventListener("DOMContentLoaded", fn);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// ios11已解决300ms点击延时的bug,因此这里不引入fastclick,否则会偶发的发生点击事件失效的情况 .
|
|
372
|
+
if ($.device.ios && Version._compareVersion($.device.osVersion, '11.0.0') >= 0) {
|
|
373
|
+
console.log('[fastclick] removed');
|
|
374
|
+
} else {
|
|
375
|
+
// 注册快速点击,必须注册在load事件中,否则通过模板生成的virtual-dom将会失效
|
|
376
|
+
window.addEventListener('load', function () {
|
|
377
|
+
new _fastclick2.default(document.body);
|
|
378
|
+
});
|
|
379
|
+
console.log('[fastclick] added');
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function render(model, view, methodName) {
|
|
384
|
+
// 根据路由规则获取对应的view函数
|
|
385
|
+
for (i = 0; i < hooks.onRender.length; i++) {
|
|
386
|
+
view = hooks.onRender[i](model, view);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// 获取Page在路由列表中的索引位置
|
|
390
|
+
var indexPos = 0;
|
|
391
|
+
if (node) {
|
|
392
|
+
indexPos = routerTrace.indexOf(model.router.match);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// 打差异化补丁
|
|
396
|
+
var _patch = function _patch() {
|
|
397
|
+
// 如果是重复路由的前进和后退不触发patch(以后需考虑数据设计的区块化)
|
|
398
|
+
//patch(root, node, node = view(model, actions), indexPos)
|
|
399
|
+
element = elements[model.router.match];
|
|
400
|
+
element = patch(root, element, node, node = view(model, actions), indexPos);
|
|
401
|
+
// 更新当前page对应的document
|
|
402
|
+
elements[model.router.match] = element;
|
|
403
|
+
//console.log(`onPatch at pos:view${indexPos}`)
|
|
404
|
+
|
|
405
|
+
// 更新当前page的最新node对象(初始化时$.router还未被创建)
|
|
406
|
+
if ($.router) {
|
|
407
|
+
$.router.vdoms[model.router.match] = node;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
for (var i = 0; i < batch.length; i++) {
|
|
411
|
+
batch[i]();
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
batch = [];
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// 如果当前是路由指令则需要替换当前Node
|
|
418
|
+
var ROUTER_MATCH = 'router.match';
|
|
419
|
+
if (methodName && methodName.indexOf(ROUTER_MATCH) != -1) {
|
|
420
|
+
if ($.router) {
|
|
421
|
+
if ($.router.vdoms[model.router.match]) {
|
|
422
|
+
node = $.router.vdoms[model.router.match];
|
|
423
|
+
} else {
|
|
424
|
+
_patch();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// 非路由Action触发,一律打补丁
|
|
429
|
+
else {
|
|
430
|
+
_patch();
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// 如果是路由函数则进入(只是转场)
|
|
434
|
+
if (methodName && methodName.indexOf(ROUTER_MATCH) != -1) {
|
|
435
|
+
for (i = 0; i < hooks.onRendered.length; i++) {
|
|
436
|
+
view = hooks.onRendered[i](model, view, node);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function merge(a, b) {
|
|
442
|
+
var obj = {};
|
|
443
|
+
|
|
444
|
+
if ((typeof b === 'undefined' ? 'undefined' : _typeof(b)) !== "object" || Array.isArray(b)) {
|
|
445
|
+
return b;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
for (var key in a) {
|
|
449
|
+
obj[key] = a[key];
|
|
450
|
+
}
|
|
451
|
+
for (var key in b) {
|
|
452
|
+
obj[key] = b[key];
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return obj;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function defer(fn, data) {
|
|
459
|
+
setTimeout(function () {
|
|
460
|
+
fn(data);
|
|
461
|
+
}, 0);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function createElementFrom(node, isSVG) {
|
|
465
|
+
if (typeof node === "string") {
|
|
466
|
+
var element = document.createTextNode(node);
|
|
467
|
+
} else {
|
|
468
|
+
var element = (isSVG = isSVG || node.tag === "svg") ? document.createElementNS(SVG_NS, node.tag) : document.createElement(node.tag);
|
|
469
|
+
|
|
470
|
+
for (var name in node.data) {
|
|
471
|
+
if (name === "onCreate") {
|
|
472
|
+
defer(node.data[name], element);
|
|
473
|
+
} else {
|
|
474
|
+
setElementData(element, name, node.data[name]);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
for (var i = 0; i < node.children.length; i++) {
|
|
479
|
+
element.appendChild(createElementFrom(node.children[i], isSVG));
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return element;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function removeElementData(element, name, value) {
|
|
487
|
+
element[name] = value;
|
|
488
|
+
element.removeAttribute(name);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
function setElementData(element, name, value, oldValue) {
|
|
492
|
+
name = name.toLowerCase();
|
|
493
|
+
|
|
494
|
+
if (!value) {
|
|
495
|
+
removeElementData(element, name, value, oldValue);
|
|
496
|
+
} else if (name === "style") {
|
|
497
|
+
for (var i in oldValue) {
|
|
498
|
+
if (!(i in value)) {
|
|
499
|
+
element.style[i] = "";
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
for (var i in value) {
|
|
504
|
+
element.style[i] = value[i];
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
// TODO 使用element.setAttribute('onclick', ...)代替`addEventListener`
|
|
508
|
+
else if (name[0] === "o" && name[1] === "n") {
|
|
509
|
+
var event = name.substr(2);
|
|
510
|
+
element.removeEventListener(event, oldValue);
|
|
511
|
+
element.addEventListener(event, value);
|
|
512
|
+
} else {
|
|
513
|
+
element.setAttribute(name, value);
|
|
514
|
+
|
|
515
|
+
if (element.namespaceURI !== SVG_NS) {
|
|
516
|
+
if (element.type === "text") {
|
|
517
|
+
var oldSelStart = element.selectionStart;
|
|
518
|
+
var oldSelEnd = element.selectionEnd;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
element[name] = value;
|
|
522
|
+
|
|
523
|
+
if (oldSelStart >= 0) {
|
|
524
|
+
/**
|
|
525
|
+
* 兼容IE ie 在input 未挂载到页面上时 就调用setSelectionRange就会报错
|
|
526
|
+
* */
|
|
527
|
+
if ($.device.ie) {
|
|
528
|
+
// 确保 有选中的值 才执行 setSelectionRange 方法
|
|
529
|
+
if (oldSelStart != null && oldSelEnd != null && oldSelStart >= 0 && oldSelEnd >= 1) {
|
|
530
|
+
element.setSelectionRange(oldSelStart, oldSelEnd);
|
|
531
|
+
}
|
|
532
|
+
} else {
|
|
533
|
+
element.setSelectionRange(oldSelStart, oldSelEnd);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function updateElementData(element, data, oldData) {
|
|
541
|
+
for (var name in merge(oldData, data)) {
|
|
542
|
+
var value = data[name];
|
|
543
|
+
var oldValue = oldData[name];
|
|
544
|
+
var realValue = element[name];
|
|
545
|
+
|
|
546
|
+
if (name === "onUpdate") {
|
|
547
|
+
defer(value, element);
|
|
548
|
+
} else if (value !== oldValue || realValue !== value) {
|
|
549
|
+
setElementData(element, name, value, oldValue);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
function patch(parent, element, oldNode, node) {
|
|
555
|
+
if (oldNode === undefined) {
|
|
556
|
+
element = parent.appendChild(createElementFrom(node));
|
|
557
|
+
} else if (node === undefined) {
|
|
558
|
+
batch.push(parent.removeChild.bind(parent, element));
|
|
559
|
+
|
|
560
|
+
if (oldNode && oldNode.data && oldNode.data.onRemove) {
|
|
561
|
+
defer(oldNode.data.onRemove, element);
|
|
562
|
+
}
|
|
563
|
+
} else if (node.tag !== oldNode.tag || (typeof node === 'undefined' ? 'undefined' : _typeof(node)) !== (typeof oldNode === 'undefined' ? 'undefined' : _typeof(oldNode)) || typeof node === "string" && node !== oldNode) {
|
|
564
|
+
if (typeof node === "string") {
|
|
565
|
+
element.textContent = node;
|
|
566
|
+
} else {
|
|
567
|
+
var i = createElementFrom(node);
|
|
568
|
+
parent.replaceChild(i, element);
|
|
569
|
+
element = i;
|
|
570
|
+
}
|
|
571
|
+
} else if (node.tag) {
|
|
572
|
+
updateElementData(element, node.data, oldNode.data);
|
|
573
|
+
|
|
574
|
+
var len = node.children.length;
|
|
575
|
+
var oldLen = oldNode.children.length;
|
|
576
|
+
|
|
577
|
+
for (var i = 0; i < len || i < oldLen; i++) {
|
|
578
|
+
patch(element, element.childNodes[i], oldNode.children[i], node.children[i]);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return element;
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
exports.app = app;
|
|
587
|
+
|
|
588
|
+
/***/ }),
|
|
589
|
+
|
|
590
|
+
/***/ 132:
|
|
591
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
592
|
+
|
|
593
|
+
"use strict";
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
Object.defineProperty(exports, "__esModule", {
|
|
597
|
+
value: true
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*
|
|
601
|
+
* @Author: shenzhiwei
|
|
602
|
+
* @Date: 2019-07-07 17:39:07
|
|
603
|
+
* @LastEditors: shenzhiwei
|
|
604
|
+
* @LastEditTime: 2019-07-09 12:30:16
|
|
605
|
+
* @Description: ioc容器运行时修改函数
|
|
606
|
+
*/
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
var _pool = __webpack_require__(15);
|
|
610
|
+
|
|
611
|
+
var _pool2 = _interopRequireDefault(_pool);
|
|
612
|
+
|
|
613
|
+
var _importAction = __webpack_require__(56);
|
|
614
|
+
|
|
615
|
+
var _importAction2 = _interopRequireDefault(_importAction);
|
|
616
|
+
|
|
617
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
618
|
+
|
|
619
|
+
var Container = function Container(container) {
|
|
620
|
+
return function (app, reinit) {
|
|
621
|
+
return {
|
|
622
|
+
actions: {
|
|
623
|
+
container: {
|
|
624
|
+
modify: function modify(model, data, actions, error) {
|
|
625
|
+
// 首先container.register注册具体实现类
|
|
626
|
+
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') {
|
|
627
|
+
for (var key in data) {
|
|
628
|
+
container.register(key, {
|
|
629
|
+
useClass: data[key]
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// 之后进行实例的重建工作
|
|
634
|
+
var mutativeEffects = (0, _importAction2.default)(container)();
|
|
635
|
+
// 调用上层进行effect引用的重新初始化
|
|
636
|
+
reinit(mutativeEffects.effects);
|
|
637
|
+
|
|
638
|
+
// 刷新dom,防止dom缓存
|
|
639
|
+
actions.$updateModel(model);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
exports.default = Container;
|
|
649
|
+
|
|
650
|
+
/***/ }),
|
|
651
|
+
|
|
652
|
+
/***/ 133:
|
|
653
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
654
|
+
|
|
655
|
+
"use strict";
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
Object.defineProperty(exports, "__esModule", {
|
|
659
|
+
value: true
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
|
|
663
|
+
* 数据状态管理
|
|
664
|
+
* Created by dfzq on 2018/3/22.
|
|
665
|
+
*/
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
exports.default = function (options) {
|
|
669
|
+
return {
|
|
670
|
+
actions: {
|
|
671
|
+
model: {
|
|
672
|
+
/**
|
|
673
|
+
* 更新model数据状态
|
|
674
|
+
* @param state {Any} 修改model数据块的某部分数据
|
|
675
|
+
*/
|
|
676
|
+
setState: function setState(model, state) {
|
|
677
|
+
return state;
|
|
678
|
+
},
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* 更新model中的对象数据状态
|
|
682
|
+
* @param state {Object} 修改model对象数据块的某部分数据,只能是对象
|
|
683
|
+
*/
|
|
684
|
+
setObjectState: function setObjectState(model, state) {
|
|
685
|
+
if ((typeof state === 'undefined' ? 'undefined' : _typeof(state)) !== 'object') {
|
|
686
|
+
throw new Error('parameter of action.model.setObjectState must be object type.');
|
|
687
|
+
}
|
|
688
|
+
// 创建一个空对象
|
|
689
|
+
var obj = {};
|
|
690
|
+
// 遍历state属性,从model中寻找对应属性的值塞入obj中
|
|
691
|
+
for (var key in state) {
|
|
692
|
+
obj[key] = {};
|
|
693
|
+
for (var protertyKey in model[key]) {
|
|
694
|
+
var value = state[key][protertyKey];
|
|
695
|
+
if (value) {
|
|
696
|
+
obj[key][protertyKey] = value;
|
|
697
|
+
} else {
|
|
698
|
+
obj[key][protertyKey] = model[key][protertyKey];
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
// return $.extend(true, model, state) // 这种方式存在循环引用的严重bug
|
|
703
|
+
return obj;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
/***/ }),
|
|
711
|
+
|
|
712
|
+
/***/ 134:
|
|
713
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
714
|
+
|
|
715
|
+
"use strict";
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
Object.defineProperty(exports, "__esModule", {
|
|
719
|
+
value: true
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
exports.default = function (options) {
|
|
723
|
+
|
|
724
|
+
// prompt函数
|
|
725
|
+
var prompt = null;
|
|
726
|
+
|
|
727
|
+
return {
|
|
728
|
+
model: {
|
|
729
|
+
router: _match(options.view, _getUrlFragment(getLocationHref()))
|
|
730
|
+
},
|
|
731
|
+
actions: {
|
|
732
|
+
router: {
|
|
733
|
+
match: function match(_, data) {
|
|
734
|
+
return {
|
|
735
|
+
router: _match(options.view, _getUrlFragment(data))
|
|
736
|
+
};
|
|
737
|
+
},
|
|
738
|
+
go: function go(_, data, actions) {
|
|
739
|
+
// 2020-5-26:解决safari后退触发popstate导致页面白屏的缺陷(ie9 router改造后的遗留问题)
|
|
740
|
+
// 植入的点在jsbridge.go
|
|
741
|
+
localStorage.removeItem("tpl_" + location.pathname.replace("/", "_").replace(".", "_"));
|
|
742
|
+
// history.pushState({}, "", data)
|
|
743
|
+
actions.router.match(data.indexOf('#') == 0 ? data : '#' + data);
|
|
744
|
+
},
|
|
745
|
+
back: function back() {
|
|
746
|
+
history.back();
|
|
747
|
+
},
|
|
748
|
+
// 注入阻塞函数
|
|
749
|
+
block: function block(_, data) {
|
|
750
|
+
prompt = typeof data === 'function' ? data : null;
|
|
751
|
+
},
|
|
752
|
+
// 移除阻塞函数
|
|
753
|
+
destoryBlock: function destoryBlock() {
|
|
754
|
+
prompt = null;
|
|
755
|
+
},
|
|
756
|
+
/**
|
|
757
|
+
* 替代jsbridge.push的作用
|
|
758
|
+
* 该函数会自动触发router.block,
|
|
759
|
+
*/
|
|
760
|
+
needBlock: function needBlock(_, data, actions) {
|
|
761
|
+
var proxyMethod = data.createHrefProxyMethod;
|
|
762
|
+
if (typeof proxyMethod !== "function") {
|
|
763
|
+
throw new Error("the prop createHrefProxyMethod of router.blockGo API must function type");
|
|
764
|
+
}
|
|
765
|
+
history.pushState(null, "", proxyMethod(data.routerKey));
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
hooks: {
|
|
770
|
+
onRender: function onRender(model) {
|
|
771
|
+
$.loadDocument(model.router.match);
|
|
772
|
+
return options.view[model.router.match];
|
|
773
|
+
},
|
|
774
|
+
onRendered: function onRendered(model, view, node) {
|
|
775
|
+
// 路由转场
|
|
776
|
+
if ($.router) if (!$.router.popstateFlag) {
|
|
777
|
+
// 对真实hash进行路由
|
|
778
|
+
$.router.load(model.router);
|
|
779
|
+
} else {
|
|
780
|
+
$.router.popstateFlag = false;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
readies: [function (_, actions) {
|
|
785
|
+
if ($.device.hasNativeHistory) {
|
|
786
|
+
addEventListener("popstate", function (e) {
|
|
787
|
+
// 阻塞开始
|
|
788
|
+
if (prompt) {
|
|
789
|
+
prompt();
|
|
790
|
+
|
|
791
|
+
// 2017-12-20 解决上层不执行摧毁事件循环递归执行block的bug
|
|
792
|
+
prompt = null;
|
|
793
|
+
} else {
|
|
794
|
+
// 2020-5-26:解决safari后退触发popstate导致页面白屏的缺陷(ie9 router改造后的遗留问题)
|
|
795
|
+
var abortPopState = localStorage.getItem("tpl_" + location.pathname.replace("/", "_").replace(".", "_"));
|
|
796
|
+
if (abortPopState) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
// 是否当前路由是popState发起
|
|
800
|
+
$.router.popstateFlag = true;
|
|
801
|
+
// 获取当前state的history视图的路由对象
|
|
802
|
+
var router = _match(options.view, _getUrlFragment(getLocationHref()));
|
|
803
|
+
// 渲染当前state的history视图
|
|
804
|
+
actions.router.match(getLocationHref());
|
|
805
|
+
// router.match与pageId形成绑定关系,用于快速查找界面上的Page块
|
|
806
|
+
$.router._onPopState(e, router.match);
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
} else {
|
|
810
|
+
// 不兼容 history 的使用 statechange 事件 这个事件在 pushState 后退 前进都会触发
|
|
811
|
+
History.Adapter.bind(window, 'statechange', function () {
|
|
812
|
+
// Note: We are using statechange instead of popstate
|
|
813
|
+
// 不在 pushState,replaceState 后触发
|
|
814
|
+
if (window.__isPushState === true) {
|
|
815
|
+
window.__isPushState = false;
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
if (window.__isReplaceState === true) {
|
|
819
|
+
window.__isReplaceState = false;
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
if (prompt) {
|
|
824
|
+
prompt();
|
|
825
|
+
|
|
826
|
+
// 2017-12-20 解决上层不执行摧毁事件循环递归执行block的bug
|
|
827
|
+
prompt = null;
|
|
828
|
+
} else {
|
|
829
|
+
// 是否当前路由是popState发起
|
|
830
|
+
$.router.popstateFlag = true;
|
|
831
|
+
// 获取当前state的history视图的路由对象
|
|
832
|
+
var router = _match(options.view, _getUrlFragment(getLocationHref()));
|
|
833
|
+
// 渲染当前state的history视图
|
|
834
|
+
actions.router.match(getLocationHref());
|
|
835
|
+
// router.match与pageId形成绑定关系,用于快速查找界面上的Page块
|
|
836
|
+
var state = History.getState().data;
|
|
837
|
+
$.router._onPopState({ state: state }, router.match);
|
|
838
|
+
}
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
}]
|
|
842
|
+
};
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
function getLocationHref() {
|
|
846
|
+
return $.device.hasNativeHistory ? location.href : location.href.replace(/\?&_suid=.+$/, "");
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
function _match(routes, path) {
|
|
850
|
+
var match,
|
|
851
|
+
params = {};
|
|
852
|
+
|
|
853
|
+
// 解决部分外链在hash后添加get参数,导致路由出现错误的bug,例如QQ分享
|
|
854
|
+
if (path.indexOf('&') != -1) {
|
|
855
|
+
path = path.substr(0, path.indexOf('&'));
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
for (var route in routes) {
|
|
859
|
+
var keys = [];
|
|
860
|
+
|
|
861
|
+
if (route === "*") {
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
path.replace(new RegExp("^" + route.replace(/\//g, "\\/").replace(/:([A-Za-z0-9_]+)/g, function (_, key) {
|
|
866
|
+
keys.push(key);
|
|
867
|
+
return "([-A-Za-z0-9_]+)";
|
|
868
|
+
}) + "/?$", "g"), function () {
|
|
869
|
+
|
|
870
|
+
for (var i = 1; i < arguments.length - 2; i++) {
|
|
871
|
+
params[keys.shift()] = arguments[i];
|
|
872
|
+
}
|
|
873
|
+
match = route;
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
if (match) {
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
return {
|
|
882
|
+
match: match || "/",
|
|
883
|
+
params: params,
|
|
884
|
+
path: path
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
function _getUrlFragment(url) {
|
|
889
|
+
var hashIndex = url.indexOf('#');
|
|
890
|
+
return hashIndex === -1 ? '/' : url.slice(hashIndex + 1);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/***/ }),
|
|
894
|
+
|
|
895
|
+
/***/ 149:
|
|
896
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
897
|
+
|
|
898
|
+
"use strict";
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
Object.defineProperty(exports, "__esModule", {
|
|
902
|
+
value: true
|
|
903
|
+
});
|
|
904
|
+
/*
|
|
905
|
+
* @Author: shenzhiwei
|
|
906
|
+
* @Date: 2019-12-06 08:53:50
|
|
907
|
+
* @Company: orientsec.com.cn
|
|
908
|
+
* @Description: 登录失效时的兼容做法
|
|
909
|
+
*/
|
|
910
|
+
var LoginFailureCompatible = function LoginFailureCompatible() {
|
|
911
|
+
return {
|
|
912
|
+
readies: [function (model, actions, error) {
|
|
913
|
+
window.onLoginFailureCompatible = function () {
|
|
914
|
+
actions.jsbridge.back();
|
|
915
|
+
};
|
|
916
|
+
}]
|
|
917
|
+
};
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
exports.default = LoginFailureCompatible;
|
|
921
|
+
|
|
922
|
+
/***/ }),
|
|
923
|
+
|
|
924
|
+
/***/ 15:
|
|
925
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
926
|
+
|
|
927
|
+
"use strict";
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
Object.defineProperty(exports, "__esModule", {
|
|
931
|
+
value: true
|
|
932
|
+
});
|
|
933
|
+
exports.default = undefined;
|
|
934
|
+
|
|
935
|
+
var _class, _temp; /*
|
|
936
|
+
* @Author: shenzhiwei
|
|
937
|
+
* @Date: 2019-07-05 08:46:48
|
|
938
|
+
* @LastEditors: Please set LastEditors
|
|
939
|
+
* @LastEditTime: 2019-08-20 13:00:40
|
|
940
|
+
* @Description: 存储类构造类型和函数的对应关系
|
|
941
|
+
*/
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
var _map = __webpack_require__(22);
|
|
945
|
+
|
|
946
|
+
var _map2 = _interopRequireDefault(_map);
|
|
947
|
+
|
|
948
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
949
|
+
|
|
950
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
951
|
+
|
|
952
|
+
// 存储类构造类型和函数的对应关系
|
|
953
|
+
var ExposeActionPool = (_temp = _class = function ExposeActionPool() {
|
|
954
|
+
_classCallCheck(this, ExposeActionPool);
|
|
955
|
+
}, _class._pool = new _map2.default(), _temp);
|
|
956
|
+
exports.default = ExposeActionPool;
|
|
957
|
+
|
|
958
|
+
/***/ }),
|
|
959
|
+
|
|
960
|
+
/***/ 164:
|
|
961
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
962
|
+
|
|
963
|
+
var __WEBPACK_AMD_DEFINE_RESULT__;;(function () {
|
|
964
|
+
'use strict';
|
|
965
|
+
|
|
966
|
+
/**
|
|
2
967
|
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
|
|
3
968
|
*
|
|
4
969
|
* @codingstandard ftlabs-jsv2
|
|
5
970
|
* @copyright The Financial Times Limited [All Rights Reserved]
|
|
6
971
|
* @license MIT License (see LICENSE.txt)
|
|
7
972
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
973
|
+
|
|
974
|
+
/*jslint browser:true, node:true*/
|
|
975
|
+
/*global define, Event, Node*/
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Instantiate fast-clicking listeners on the specified layer.
|
|
980
|
+
*
|
|
981
|
+
* @constructor
|
|
982
|
+
* @param {Element} layer The layer to listen on
|
|
983
|
+
* @param {Object} [options={}] The options to override the defaults
|
|
984
|
+
*/
|
|
985
|
+
function FastClick(layer, options) {
|
|
986
|
+
var oldOnClick;
|
|
987
|
+
|
|
988
|
+
options = options || {};
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Whether a click is currently being tracked.
|
|
992
|
+
*
|
|
993
|
+
* @type boolean
|
|
994
|
+
*/
|
|
995
|
+
this.trackingClick = false;
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Timestamp for when click tracking started.
|
|
1000
|
+
*
|
|
1001
|
+
* @type number
|
|
1002
|
+
*/
|
|
1003
|
+
this.trackingClickStart = 0;
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* The element being tracked for a click.
|
|
1008
|
+
*
|
|
1009
|
+
* @type EventTarget
|
|
1010
|
+
*/
|
|
1011
|
+
this.targetElement = null;
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* X-coordinate of touch start event.
|
|
1016
|
+
*
|
|
1017
|
+
* @type number
|
|
1018
|
+
*/
|
|
1019
|
+
this.touchStartX = 0;
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Y-coordinate of touch start event.
|
|
1024
|
+
*
|
|
1025
|
+
* @type number
|
|
1026
|
+
*/
|
|
1027
|
+
this.touchStartY = 0;
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* ID of the last touch, retrieved from Touch.identifier.
|
|
1032
|
+
*
|
|
1033
|
+
* @type number
|
|
1034
|
+
*/
|
|
1035
|
+
this.lastTouchIdentifier = 0;
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Touchmove boundary, beyond which a click will be cancelled.
|
|
1040
|
+
*
|
|
1041
|
+
* @type number
|
|
1042
|
+
*/
|
|
1043
|
+
this.touchBoundary = options.touchBoundary || 10;
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* The FastClick layer.
|
|
1048
|
+
*
|
|
1049
|
+
* @type Element
|
|
1050
|
+
*/
|
|
1051
|
+
this.layer = layer;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* The minimum time between tap(touchstart and touchend) events
|
|
1055
|
+
*
|
|
1056
|
+
* @type number
|
|
1057
|
+
*/
|
|
1058
|
+
this.tapDelay = options.tapDelay || 200;
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* The maximum time for a tap
|
|
1062
|
+
*
|
|
1063
|
+
* @type number
|
|
1064
|
+
*/
|
|
1065
|
+
this.tapTimeout = options.tapTimeout || 700;
|
|
1066
|
+
|
|
1067
|
+
if (FastClick.notNeeded(layer)) {
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
// Some old versions of Android don't have Function.prototype.bind
|
|
1072
|
+
function bind(method, context) {
|
|
1073
|
+
return function() { return method.apply(context, arguments); };
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
|
|
1078
|
+
var context = this;
|
|
1079
|
+
for (var i = 0, l = methods.length; i < l; i++) {
|
|
1080
|
+
context[methods[i]] = bind(context[methods[i]], context);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// Set up event handlers as required
|
|
1084
|
+
if (deviceIsAndroid) {
|
|
1085
|
+
layer.addEventListener('mouseover', this.onMouse, true);
|
|
1086
|
+
layer.addEventListener('mousedown', this.onMouse, true);
|
|
1087
|
+
layer.addEventListener('mouseup', this.onMouse, true);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
layer.addEventListener('click', this.onClick, true);
|
|
1091
|
+
layer.addEventListener('touchstart', this.onTouchStart, false);
|
|
1092
|
+
layer.addEventListener('touchmove', this.onTouchMove, false);
|
|
1093
|
+
layer.addEventListener('touchend', this.onTouchEnd, false);
|
|
1094
|
+
layer.addEventListener('touchcancel', this.onTouchCancel, false);
|
|
1095
|
+
|
|
1096
|
+
// Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
|
1097
|
+
// which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
|
|
1098
|
+
// layer when they are cancelled.
|
|
1099
|
+
if (!Event.prototype.stopImmediatePropagation) {
|
|
1100
|
+
layer.removeEventListener = function(type, callback, capture) {
|
|
1101
|
+
var rmv = Node.prototype.removeEventListener;
|
|
1102
|
+
if (type === 'click') {
|
|
1103
|
+
rmv.call(layer, type, callback.hijacked || callback, capture);
|
|
1104
|
+
} else {
|
|
1105
|
+
rmv.call(layer, type, callback, capture);
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
layer.addEventListener = function(type, callback, capture) {
|
|
1110
|
+
var adv = Node.prototype.addEventListener;
|
|
1111
|
+
if (type === 'click') {
|
|
1112
|
+
adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
|
|
1113
|
+
if (!event.propagationStopped) {
|
|
1114
|
+
callback(event);
|
|
1115
|
+
}
|
|
1116
|
+
}), capture);
|
|
1117
|
+
} else {
|
|
1118
|
+
adv.call(layer, type, callback, capture);
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// If a handler is already declared in the element's onclick attribute, it will be fired before
|
|
1124
|
+
// FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
|
|
1125
|
+
// adding it as listener.
|
|
1126
|
+
if (typeof layer.onclick === 'function') {
|
|
1127
|
+
|
|
1128
|
+
// Android browser on at least 3.2 requires a new reference to the function in layer.onclick
|
|
1129
|
+
// - the old one won't work if passed to addEventListener directly.
|
|
1130
|
+
oldOnClick = layer.onclick;
|
|
1131
|
+
layer.addEventListener('click', function(event) {
|
|
1132
|
+
oldOnClick(event);
|
|
1133
|
+
}, false);
|
|
1134
|
+
layer.onclick = null;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
|
|
1140
|
+
*
|
|
1141
|
+
* @type boolean
|
|
1142
|
+
*/
|
|
1143
|
+
var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Android requires exceptions.
|
|
1147
|
+
*
|
|
1148
|
+
* @type boolean
|
|
1149
|
+
*/
|
|
1150
|
+
var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* iOS requires exceptions.
|
|
1155
|
+
*
|
|
1156
|
+
* @type boolean
|
|
1157
|
+
*/
|
|
1158
|
+
var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* iOS 4 requires an exception for select elements.
|
|
1163
|
+
*
|
|
1164
|
+
* @type boolean
|
|
1165
|
+
*/
|
|
1166
|
+
var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* iOS 6.0-7.* requires the target element to be manually derived
|
|
1171
|
+
*
|
|
1172
|
+
* @type boolean
|
|
1173
|
+
*/
|
|
1174
|
+
var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* BlackBerry requires exceptions.
|
|
1178
|
+
*
|
|
1179
|
+
* @type boolean
|
|
1180
|
+
*/
|
|
1181
|
+
var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* Determine whether a given element requires a native click.
|
|
1185
|
+
*
|
|
1186
|
+
* @param {EventTarget|Element} target Target DOM element
|
|
1187
|
+
* @returns {boolean} Returns true if the element needs a native click
|
|
1188
|
+
*/
|
|
1189
|
+
FastClick.prototype.needsClick = function(target) {
|
|
1190
|
+
switch (target.nodeName.toLowerCase()) {
|
|
1191
|
+
|
|
1192
|
+
// Don't send a synthetic click to disabled inputs (issue #62)
|
|
1193
|
+
case 'button':
|
|
1194
|
+
case 'select':
|
|
1195
|
+
case 'textarea':
|
|
1196
|
+
if (target.disabled) {
|
|
1197
|
+
return true;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
break;
|
|
1201
|
+
case 'input':
|
|
1202
|
+
|
|
1203
|
+
// File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
|
|
1204
|
+
if ((deviceIsIOS && target.type === 'file') || target.disabled) {
|
|
1205
|
+
return true;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
break;
|
|
1209
|
+
case 'label':
|
|
1210
|
+
case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
|
|
1211
|
+
case 'video':
|
|
1212
|
+
return true;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
return (/\bneedsclick\b/).test(target.className);
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* Determine whether a given element requires a call to focus to simulate click into element.
|
|
1221
|
+
*
|
|
1222
|
+
* @param {EventTarget|Element} target Target DOM element
|
|
1223
|
+
* @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
|
|
1224
|
+
*/
|
|
1225
|
+
FastClick.prototype.needsFocus = function(target) {
|
|
1226
|
+
switch (target.nodeName.toLowerCase()) {
|
|
1227
|
+
case 'textarea':
|
|
1228
|
+
return true;
|
|
1229
|
+
case 'select':
|
|
1230
|
+
return !deviceIsAndroid;
|
|
1231
|
+
case 'input':
|
|
1232
|
+
switch (target.type) {
|
|
1233
|
+
case 'button':
|
|
1234
|
+
case 'checkbox':
|
|
1235
|
+
case 'file':
|
|
1236
|
+
case 'image':
|
|
1237
|
+
case 'radio':
|
|
1238
|
+
case 'submit':
|
|
1239
|
+
return false;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
// No point in attempting to focus disabled inputs
|
|
1243
|
+
return !target.disabled && !target.readOnly;
|
|
1244
|
+
default:
|
|
1245
|
+
return (/\bneedsfocus\b/).test(target.className);
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Send a click event to the specified element.
|
|
1252
|
+
*
|
|
1253
|
+
* @param {EventTarget|Element} targetElement
|
|
1254
|
+
* @param {Event} event
|
|
1255
|
+
*/
|
|
1256
|
+
FastClick.prototype.sendClick = function(targetElement, event) {
|
|
1257
|
+
var clickEvent, touch;
|
|
1258
|
+
|
|
1259
|
+
// On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
|
|
1260
|
+
if (document.activeElement && document.activeElement !== targetElement) {
|
|
1261
|
+
document.activeElement.blur();
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
touch = event.changedTouches[0];
|
|
1265
|
+
|
|
1266
|
+
// Synthesise a click event, with an extra attribute so it can be tracked
|
|
1267
|
+
clickEvent = document.createEvent('MouseEvents');
|
|
1268
|
+
clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
|
|
1269
|
+
clickEvent.forwardedTouchEvent = true;
|
|
1270
|
+
targetElement.dispatchEvent(clickEvent);
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
FastClick.prototype.determineEventType = function(targetElement) {
|
|
1274
|
+
|
|
1275
|
+
//Issue #159: Android Chrome Select Box does not open with a synthetic click event
|
|
1276
|
+
if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
|
|
1277
|
+
return 'mousedown';
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
return 'click';
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* @param {EventTarget|Element} targetElement
|
|
1286
|
+
*/
|
|
1287
|
+
FastClick.prototype.focus = function(targetElement) {
|
|
1288
|
+
var length;
|
|
1289
|
+
|
|
1290
|
+
// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
|
|
1291
|
+
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
|
|
1292
|
+
length = targetElement.value.length;
|
|
1293
|
+
targetElement.setSelectionRange(length, length);
|
|
1294
|
+
} else {
|
|
1295
|
+
targetElement.focus();
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
|
|
1302
|
+
*
|
|
1303
|
+
* @param {EventTarget|Element} targetElement
|
|
1304
|
+
*/
|
|
1305
|
+
FastClick.prototype.updateScrollParent = function(targetElement) {
|
|
1306
|
+
var scrollParent, parentElement;
|
|
1307
|
+
|
|
1308
|
+
scrollParent = targetElement.fastClickScrollParent;
|
|
1309
|
+
|
|
1310
|
+
// Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
|
|
1311
|
+
// target element was moved to another parent.
|
|
1312
|
+
if (!scrollParent || !scrollParent.contains(targetElement)) {
|
|
1313
|
+
parentElement = targetElement;
|
|
1314
|
+
do {
|
|
1315
|
+
if (parentElement.scrollHeight > parentElement.offsetHeight) {
|
|
1316
|
+
scrollParent = parentElement;
|
|
1317
|
+
targetElement.fastClickScrollParent = parentElement;
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
parentElement = parentElement.parentElement;
|
|
1322
|
+
} while (parentElement);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// Always update the scroll top tracker if possible.
|
|
1326
|
+
if (scrollParent) {
|
|
1327
|
+
scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* @param {EventTarget} targetElement
|
|
1334
|
+
* @returns {Element|EventTarget}
|
|
1335
|
+
*/
|
|
1336
|
+
FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
|
|
1337
|
+
|
|
1338
|
+
// On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
|
|
1339
|
+
if (eventTarget.nodeType === Node.TEXT_NODE) {
|
|
1340
|
+
return eventTarget.parentNode;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
return eventTarget;
|
|
1344
|
+
};
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* On touch start, record the position and scroll offset.
|
|
1349
|
+
*
|
|
1350
|
+
* @param {Event} event
|
|
1351
|
+
* @returns {boolean}
|
|
1352
|
+
*/
|
|
1353
|
+
FastClick.prototype.onTouchStart = function(event) {
|
|
1354
|
+
var targetElement, touch, selection;
|
|
1355
|
+
|
|
1356
|
+
// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
|
|
1357
|
+
if (event.targetTouches.length > 1) {
|
|
1358
|
+
return true;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
targetElement = this.getTargetElementFromEventTarget(event.target);
|
|
1362
|
+
touch = event.targetTouches[0];
|
|
1363
|
+
|
|
1364
|
+
if (deviceIsIOS) {
|
|
1365
|
+
|
|
1366
|
+
// Only trusted events will deselect text on iOS (issue #49)
|
|
1367
|
+
selection = window.getSelection();
|
|
1368
|
+
if (selection.rangeCount && !selection.isCollapsed) {
|
|
1369
|
+
return true;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
if (!deviceIsIOS4) {
|
|
1373
|
+
|
|
1374
|
+
// Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
|
|
1375
|
+
// when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
|
|
1376
|
+
// with the same identifier as the touch event that previously triggered the click that triggered the alert.
|
|
1377
|
+
// Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
|
|
1378
|
+
// immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
|
|
1379
|
+
// Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
|
|
1380
|
+
// which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
|
|
1381
|
+
// random integers, it's safe to to continue if the identifier is 0 here.
|
|
1382
|
+
if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
|
|
1383
|
+
event.preventDefault();
|
|
1384
|
+
return false;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
this.lastTouchIdentifier = touch.identifier;
|
|
1388
|
+
|
|
1389
|
+
// If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
|
|
1390
|
+
// 1) the user does a fling scroll on the scrollable layer
|
|
1391
|
+
// 2) the user stops the fling scroll with another tap
|
|
1392
|
+
// then the event.target of the last 'touchend' event will be the element that was under the user's finger
|
|
1393
|
+
// when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
|
|
1394
|
+
// is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
|
|
1395
|
+
this.updateScrollParent(targetElement);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
this.trackingClick = true;
|
|
1400
|
+
this.trackingClickStart = event.timeStamp;
|
|
1401
|
+
this.targetElement = targetElement;
|
|
1402
|
+
|
|
1403
|
+
this.touchStartX = touch.pageX;
|
|
1404
|
+
this.touchStartY = touch.pageY;
|
|
1405
|
+
|
|
1406
|
+
// Prevent phantom clicks on fast double-tap (issue #36)
|
|
1407
|
+
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
|
1408
|
+
event.preventDefault();
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
return true;
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
|
|
1417
|
+
*
|
|
1418
|
+
* @param {Event} event
|
|
1419
|
+
* @returns {boolean}
|
|
1420
|
+
*/
|
|
1421
|
+
FastClick.prototype.touchHasMoved = function(event) {
|
|
1422
|
+
var touch = event.changedTouches[0], boundary = this.touchBoundary;
|
|
1423
|
+
|
|
1424
|
+
if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
|
|
1425
|
+
return true;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
return false;
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
/**
|
|
1433
|
+
* Update the last position.
|
|
1434
|
+
*
|
|
1435
|
+
* @param {Event} event
|
|
1436
|
+
* @returns {boolean}
|
|
1437
|
+
*/
|
|
1438
|
+
FastClick.prototype.onTouchMove = function(event) {
|
|
1439
|
+
if (!this.trackingClick) {
|
|
1440
|
+
return true;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
// If the touch has moved, cancel the click tracking
|
|
1444
|
+
if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
|
|
1445
|
+
this.trackingClick = false;
|
|
1446
|
+
this.targetElement = null;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
return true;
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Attempt to find the labelled control for the given label element.
|
|
1455
|
+
*
|
|
1456
|
+
* @param {EventTarget|HTMLLabelElement} labelElement
|
|
1457
|
+
* @returns {Element|null}
|
|
1458
|
+
*/
|
|
1459
|
+
FastClick.prototype.findControl = function(labelElement) {
|
|
1460
|
+
|
|
1461
|
+
// Fast path for newer browsers supporting the HTML5 control attribute
|
|
1462
|
+
if (labelElement.control !== undefined) {
|
|
1463
|
+
return labelElement.control;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
// All browsers under test that support touch events also support the HTML5 htmlFor attribute
|
|
1467
|
+
if (labelElement.htmlFor) {
|
|
1468
|
+
return document.getElementById(labelElement.htmlFor);
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
// If no for attribute exists, attempt to retrieve the first labellable descendant element
|
|
1472
|
+
// the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
|
|
1473
|
+
return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* On touch end, determine whether to send a click event at once.
|
|
1479
|
+
*
|
|
1480
|
+
* @param {Event} event
|
|
1481
|
+
* @returns {boolean}
|
|
1482
|
+
*/
|
|
1483
|
+
FastClick.prototype.onTouchEnd = function(event) {
|
|
1484
|
+
var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
|
|
1485
|
+
|
|
1486
|
+
if (!this.trackingClick) {
|
|
1487
|
+
return true;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
// Prevent phantom clicks on fast double-tap (issue #36)
|
|
1491
|
+
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
|
1492
|
+
this.cancelNextClick = true;
|
|
1493
|
+
return true;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
|
|
1497
|
+
return true;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
// Reset to prevent wrong click cancel on input (issue #156).
|
|
1501
|
+
this.cancelNextClick = false;
|
|
1502
|
+
|
|
1503
|
+
this.lastClickTime = event.timeStamp;
|
|
1504
|
+
|
|
1505
|
+
trackingClickStart = this.trackingClickStart;
|
|
1506
|
+
this.trackingClick = false;
|
|
1507
|
+
this.trackingClickStart = 0;
|
|
1508
|
+
|
|
1509
|
+
// On some iOS devices, the targetElement supplied with the event is invalid if the layer
|
|
1510
|
+
// is performing a transition or scroll, and has to be re-detected manually. Note that
|
|
1511
|
+
// for this to function correctly, it must be called *after* the event target is checked!
|
|
1512
|
+
// See issue #57; also filed as rdar://13048589 .
|
|
1513
|
+
if (deviceIsIOSWithBadTarget) {
|
|
1514
|
+
touch = event.changedTouches[0];
|
|
1515
|
+
|
|
1516
|
+
// In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
|
|
1517
|
+
targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
|
|
1518
|
+
targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
targetTagName = targetElement.tagName.toLowerCase();
|
|
1522
|
+
if (targetTagName === 'label') {
|
|
1523
|
+
forElement = this.findControl(targetElement);
|
|
1524
|
+
if (forElement) {
|
|
1525
|
+
this.focus(targetElement);
|
|
1526
|
+
if (deviceIsAndroid) {
|
|
1527
|
+
return false;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
targetElement = forElement;
|
|
1531
|
+
}
|
|
1532
|
+
} else if (this.needsFocus(targetElement)) {
|
|
1533
|
+
|
|
1534
|
+
// Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
|
|
1535
|
+
// Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
|
|
1536
|
+
if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
|
|
1537
|
+
this.targetElement = null;
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
this.focus(targetElement);
|
|
1542
|
+
this.sendClick(targetElement, event);
|
|
1543
|
+
|
|
1544
|
+
// Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
|
|
1545
|
+
// Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
|
|
1546
|
+
if (!deviceIsIOS || targetTagName !== 'select') {
|
|
1547
|
+
this.targetElement = null;
|
|
1548
|
+
event.preventDefault();
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
return false;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
if (deviceIsIOS && !deviceIsIOS4) {
|
|
1555
|
+
|
|
1556
|
+
// Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
|
|
1557
|
+
// and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
|
|
1558
|
+
scrollParent = targetElement.fastClickScrollParent;
|
|
1559
|
+
if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
|
|
1560
|
+
return true;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
// Prevent the actual click from going though - unless the target node is marked as requiring
|
|
1565
|
+
// real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
|
|
1566
|
+
if (!this.needsClick(targetElement)) {
|
|
1567
|
+
event.preventDefault();
|
|
1568
|
+
this.sendClick(targetElement, event);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
return false;
|
|
1572
|
+
};
|
|
1573
|
+
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* On touch cancel, stop tracking the click.
|
|
1577
|
+
*
|
|
1578
|
+
* @returns {void}
|
|
1579
|
+
*/
|
|
1580
|
+
FastClick.prototype.onTouchCancel = function() {
|
|
1581
|
+
this.trackingClick = false;
|
|
1582
|
+
this.targetElement = null;
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* Determine mouse events which should be permitted.
|
|
1588
|
+
*
|
|
1589
|
+
* @param {Event} event
|
|
1590
|
+
* @returns {boolean}
|
|
1591
|
+
*/
|
|
1592
|
+
FastClick.prototype.onMouse = function(event) {
|
|
1593
|
+
|
|
1594
|
+
// If a target element was never set (because a touch event was never fired) allow the event
|
|
1595
|
+
if (!this.targetElement) {
|
|
1596
|
+
return true;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
if (event.forwardedTouchEvent) {
|
|
1600
|
+
return true;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
// Programmatically generated events targeting a specific element should be permitted
|
|
1604
|
+
if (!event.cancelable) {
|
|
1605
|
+
return true;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
// Derive and check the target element to see whether the mouse event needs to be permitted;
|
|
1609
|
+
// unless explicitly enabled, prevent non-touch click events from triggering actions,
|
|
1610
|
+
// to prevent ghost/doubleclicks.
|
|
1611
|
+
if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
|
|
1612
|
+
|
|
1613
|
+
// Prevent any user-added listeners declared on FastClick element from being fired.
|
|
1614
|
+
if (event.stopImmediatePropagation) {
|
|
1615
|
+
event.stopImmediatePropagation();
|
|
1616
|
+
} else {
|
|
1617
|
+
|
|
1618
|
+
// Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
|
1619
|
+
event.propagationStopped = true;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
// Cancel the event
|
|
1623
|
+
event.stopPropagation();
|
|
1624
|
+
event.preventDefault();
|
|
1625
|
+
|
|
1626
|
+
return false;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
// If the mouse event is permitted, return true for the action to go through.
|
|
1630
|
+
return true;
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* On actual clicks, determine whether this is a touch-generated click, a click action occurring
|
|
1636
|
+
* naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
|
|
1637
|
+
* an actual click which should be permitted.
|
|
1638
|
+
*
|
|
1639
|
+
* @param {Event} event
|
|
1640
|
+
* @returns {boolean}
|
|
1641
|
+
*/
|
|
1642
|
+
FastClick.prototype.onClick = function(event) {
|
|
1643
|
+
var permitted;
|
|
1644
|
+
|
|
1645
|
+
// It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
|
|
1646
|
+
if (this.trackingClick) {
|
|
1647
|
+
this.targetElement = null;
|
|
1648
|
+
this.trackingClick = false;
|
|
1649
|
+
return true;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
// Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
|
|
1653
|
+
if (event.target.type === 'submit' && event.detail === 0) {
|
|
1654
|
+
return true;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
permitted = this.onMouse(event);
|
|
1658
|
+
|
|
1659
|
+
// Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
|
|
1660
|
+
if (!permitted) {
|
|
1661
|
+
this.targetElement = null;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
// If clicks are permitted, return true for the action to go through.
|
|
1665
|
+
return permitted;
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
/**
|
|
1670
|
+
* Remove all FastClick's event listeners.
|
|
1671
|
+
*
|
|
1672
|
+
* @returns {void}
|
|
1673
|
+
*/
|
|
1674
|
+
FastClick.prototype.destroy = function() {
|
|
1675
|
+
var layer = this.layer;
|
|
1676
|
+
|
|
1677
|
+
if (deviceIsAndroid) {
|
|
1678
|
+
layer.removeEventListener('mouseover', this.onMouse, true);
|
|
1679
|
+
layer.removeEventListener('mousedown', this.onMouse, true);
|
|
1680
|
+
layer.removeEventListener('mouseup', this.onMouse, true);
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
layer.removeEventListener('click', this.onClick, true);
|
|
1684
|
+
layer.removeEventListener('touchstart', this.onTouchStart, false);
|
|
1685
|
+
layer.removeEventListener('touchmove', this.onTouchMove, false);
|
|
1686
|
+
layer.removeEventListener('touchend', this.onTouchEnd, false);
|
|
1687
|
+
layer.removeEventListener('touchcancel', this.onTouchCancel, false);
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
/**
|
|
1692
|
+
* Check whether FastClick is needed.
|
|
1693
|
+
*
|
|
1694
|
+
* @param {Element} layer The layer to listen on
|
|
1695
|
+
*/
|
|
1696
|
+
FastClick.notNeeded = function(layer) {
|
|
1697
|
+
var metaViewport;
|
|
1698
|
+
var chromeVersion;
|
|
1699
|
+
var blackberryVersion;
|
|
1700
|
+
var firefoxVersion;
|
|
1701
|
+
|
|
1702
|
+
// Devices that don't support touch don't need FastClick
|
|
1703
|
+
if (typeof window.ontouchstart === 'undefined') {
|
|
1704
|
+
return true;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
// Chrome version - zero for other browsers
|
|
1708
|
+
chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
|
|
1709
|
+
|
|
1710
|
+
if (chromeVersion) {
|
|
1711
|
+
|
|
1712
|
+
if (deviceIsAndroid) {
|
|
1713
|
+
metaViewport = document.querySelector('meta[name=viewport]');
|
|
1714
|
+
|
|
1715
|
+
if (metaViewport) {
|
|
1716
|
+
// Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
|
|
1717
|
+
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
|
1718
|
+
return true;
|
|
1719
|
+
}
|
|
1720
|
+
// Chrome 32 and above with width=device-width or less don't need FastClick
|
|
1721
|
+
if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
|
|
1722
|
+
return true;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
// Chrome desktop doesn't need FastClick (issue #15)
|
|
1727
|
+
} else {
|
|
1728
|
+
return true;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
if (deviceIsBlackBerry10) {
|
|
1733
|
+
blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);
|
|
1734
|
+
|
|
1735
|
+
// BlackBerry 10.3+ does not require Fastclick library.
|
|
1736
|
+
// https://github.com/ftlabs/fastclick/issues/251
|
|
1737
|
+
if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
|
|
1738
|
+
metaViewport = document.querySelector('meta[name=viewport]');
|
|
1739
|
+
|
|
1740
|
+
if (metaViewport) {
|
|
1741
|
+
// user-scalable=no eliminates click delay.
|
|
1742
|
+
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
|
1743
|
+
return true;
|
|
1744
|
+
}
|
|
1745
|
+
// width=device-width (or less than device-width) eliminates click delay.
|
|
1746
|
+
if (document.documentElement.scrollWidth <= window.outerWidth) {
|
|
1747
|
+
return true;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
// IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)
|
|
1754
|
+
if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {
|
|
1755
|
+
return true;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
// Firefox version - zero for other browsers
|
|
1759
|
+
firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
|
|
1760
|
+
|
|
1761
|
+
if (firefoxVersion >= 27) {
|
|
1762
|
+
// Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896
|
|
1763
|
+
|
|
1764
|
+
metaViewport = document.querySelector('meta[name=viewport]');
|
|
1765
|
+
if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {
|
|
1766
|
+
return true;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
// IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version
|
|
1771
|
+
// http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx
|
|
1772
|
+
if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {
|
|
1773
|
+
return true;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
return false;
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* Factory method for creating a FastClick object
|
|
1782
|
+
*
|
|
1783
|
+
* @param {Element} layer The layer to listen on
|
|
1784
|
+
* @param {Object} [options={}] The options to override the defaults
|
|
1785
|
+
*/
|
|
1786
|
+
FastClick.attach = function(layer, options) {
|
|
1787
|
+
return new FastClick(layer, options);
|
|
1788
|
+
};
|
|
1789
|
+
|
|
1790
|
+
|
|
1791
|
+
if (true) {
|
|
1792
|
+
|
|
1793
|
+
// AMD. Register as an anonymous module.
|
|
1794
|
+
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
|
1795
|
+
return FastClick;
|
|
1796
|
+
}.call(exports, __webpack_require__, exports, module),
|
|
1797
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
1798
|
+
} else if (typeof module !== 'undefined' && module.exports) {
|
|
1799
|
+
module.exports = FastClick.attach;
|
|
1800
|
+
module.exports.FastClick = FastClick;
|
|
1801
|
+
} else {
|
|
1802
|
+
window.FastClick = FastClick;
|
|
1803
|
+
}
|
|
1804
|
+
}());
|
|
1805
|
+
|
|
1806
|
+
|
|
1807
|
+
/***/ }),
|
|
1808
|
+
|
|
1809
|
+
/***/ 22:
|
|
1810
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1811
|
+
|
|
1812
|
+
"use strict";
|
|
1813
|
+
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|
1814
|
+
/*! (c) Andrea Giammarchi - ISC */
|
|
1815
|
+
var self = this || /* istanbul ignore next */ {};
|
|
1816
|
+
try { self.Map = Map; }
|
|
1817
|
+
catch (Map) {
|
|
1818
|
+
(function (i, dPs) {'use strict';
|
|
1819
|
+
var proto = dPs(Map.prototype, {size: {
|
|
1820
|
+
configurable: true,
|
|
1821
|
+
get: function () {
|
|
1822
|
+
return this._k.length;
|
|
1823
|
+
}
|
|
1824
|
+
}});
|
|
1825
|
+
proto.clear = function () {
|
|
1826
|
+
var length = this._k.length;
|
|
1827
|
+
this._k.splice(0, length);
|
|
1828
|
+
this._v.splice(0, length);
|
|
1829
|
+
};
|
|
1830
|
+
proto.delete = function (key) {
|
|
1831
|
+
var had = has(this, key);
|
|
1832
|
+
if (had) {
|
|
1833
|
+
this._k.splice(i, 1);
|
|
1834
|
+
this._v.splice(i, 1);
|
|
1835
|
+
}
|
|
1836
|
+
return had;
|
|
1837
|
+
};
|
|
1838
|
+
proto.entries = function () {
|
|
1839
|
+
return this._k.map(pair, this._v);
|
|
1840
|
+
};
|
|
1841
|
+
proto.forEach = function (callback, context) {
|
|
1842
|
+
this._k.forEach(
|
|
1843
|
+
function (key, i) {
|
|
1844
|
+
callback.call(context, this._v[i], key, this);
|
|
1845
|
+
},
|
|
1846
|
+
this
|
|
1847
|
+
);
|
|
1848
|
+
};
|
|
1849
|
+
proto.get = function (key) {
|
|
1850
|
+
return has(this, key) ? this._v[i] : void 0;
|
|
1851
|
+
};
|
|
1852
|
+
proto.has = function (key) {
|
|
1853
|
+
return has(this, key);
|
|
1854
|
+
};
|
|
1855
|
+
proto.keys = function () {
|
|
1856
|
+
return this._k.slice(0);
|
|
1857
|
+
};
|
|
1858
|
+
proto.set = function (key, value) {
|
|
1859
|
+
this._v[has(this, key) ? i : (this._k.push(key) - 1)] = value;
|
|
1860
|
+
return this;
|
|
1861
|
+
};
|
|
1862
|
+
proto.values = function () {
|
|
1863
|
+
return this._v.slice(0);
|
|
1864
|
+
};
|
|
1865
|
+
self.Map = Map;
|
|
1866
|
+
return Map;
|
|
1867
|
+
function Map(iterable) {
|
|
1868
|
+
dPs(this, {_k: {value: []}, _v: {value: []}});
|
|
1869
|
+
if (iterable)
|
|
1870
|
+
iterable.forEach(add, this);
|
|
1871
|
+
}
|
|
1872
|
+
function add(pair) {
|
|
1873
|
+
this.set(pair[0], pair[1]);
|
|
1874
|
+
}
|
|
1875
|
+
function has(self, value) {
|
|
1876
|
+
i = self._k.indexOf(value);
|
|
1877
|
+
return -1 < i;
|
|
1878
|
+
}
|
|
1879
|
+
function pair(v, i) {
|
|
1880
|
+
return [v, this[i]];
|
|
1881
|
+
}
|
|
1882
|
+
}(0, Object.defineProperties));
|
|
1883
|
+
}
|
|
1884
|
+
/* harmony default export */ __webpack_exports__["default"] = (self.Map);
|
|
1885
|
+
|
|
1886
|
+
|
|
1887
|
+
/***/ }),
|
|
1888
|
+
|
|
1889
|
+
/***/ 227:
|
|
1890
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1891
|
+
|
|
1892
|
+
module.exports = __webpack_require__(92);
|
|
1893
|
+
|
|
1894
|
+
|
|
1895
|
+
/***/ }),
|
|
1896
|
+
|
|
1897
|
+
/***/ 33:
|
|
1898
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1899
|
+
|
|
1900
|
+
"use strict";
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1904
|
+
value: true
|
|
1905
|
+
});
|
|
1906
|
+
|
|
1907
|
+
exports.default = function (tag, data) {
|
|
1908
|
+
var canConcat, oldCanConcat;
|
|
1909
|
+
|
|
1910
|
+
children = [];
|
|
1911
|
+
i = arguments.length;
|
|
1912
|
+
|
|
1913
|
+
while (i-- > 2) {
|
|
1914
|
+
stack.push(arguments[i]);
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
while (stack.length) {
|
|
1918
|
+
if (Array.isArray(node = stack.pop())) {
|
|
1919
|
+
i = node.length;
|
|
1920
|
+
|
|
1921
|
+
while (i--) {
|
|
1922
|
+
stack.push(node[i]);
|
|
1923
|
+
}
|
|
1924
|
+
} else if (node != null && node !== true && node !== false) {
|
|
1925
|
+
// Ignore nulls and booleans; this is conditional rendering.
|
|
1926
|
+
|
|
1927
|
+
if (typeof node === "number") {
|
|
1928
|
+
node = node + "";
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
// Concatenate contiguous number/string nodes into one string.
|
|
1932
|
+
// The idea is to avoid creating unnecessary text nodes.
|
|
1933
|
+
|
|
1934
|
+
canConcat = typeof node === "string";
|
|
1935
|
+
|
|
1936
|
+
if (canConcat && oldCanConcat) {
|
|
1937
|
+
children[children.length - 1] += node;
|
|
1938
|
+
} else {
|
|
1939
|
+
children.push(node);
|
|
1940
|
+
oldCanConcat = canConcat;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
if (typeof tag === "function") {
|
|
1946
|
+
var _class = new tag(data, children);
|
|
1947
|
+
if (_class['render']) {
|
|
1948
|
+
return new tag(data, children).render();
|
|
1949
|
+
} else {
|
|
1950
|
+
// throw new Error("view class must define render function.")
|
|
1951
|
+
return tag(data, children);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
return {
|
|
1956
|
+
tag: tag,
|
|
1957
|
+
data: data || {},
|
|
1958
|
+
children: children
|
|
1959
|
+
};
|
|
1960
|
+
};
|
|
1961
|
+
|
|
1962
|
+
var i,
|
|
1963
|
+
node,
|
|
1964
|
+
children,
|
|
1965
|
+
stack = [];
|
|
1966
|
+
|
|
1967
|
+
/***/ }),
|
|
1968
|
+
|
|
1969
|
+
/***/ 55:
|
|
1970
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1971
|
+
|
|
1972
|
+
"use strict";
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1976
|
+
value: true
|
|
1977
|
+
});
|
|
1978
|
+
|
|
1979
|
+
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1980
|
+
|
|
1981
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
* 解耦effect调用mutation
|
|
1985
|
+
* ActionService内部缓存了所有可调用的mutation异变函数
|
|
1986
|
+
*/
|
|
1987
|
+
var ActionService = function () {
|
|
1988
|
+
function ActionService() {
|
|
1989
|
+
_classCallCheck(this, ActionService);
|
|
1990
|
+
|
|
1991
|
+
console.log('ActionService Created.');
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
_createClass(ActionService, [{
|
|
1995
|
+
key: 'select',
|
|
1996
|
+
value: function select() {
|
|
1997
|
+
return ActionService.AllMutationActions;
|
|
1998
|
+
}
|
|
1999
|
+
}]);
|
|
2000
|
+
|
|
2001
|
+
return ActionService;
|
|
2002
|
+
}();
|
|
2003
|
+
|
|
2004
|
+
exports.default = ActionService;
|
|
2005
|
+
|
|
2006
|
+
/***/ }),
|
|
2007
|
+
|
|
2008
|
+
/***/ 56:
|
|
2009
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2010
|
+
|
|
2011
|
+
"use strict";
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2015
|
+
value: true
|
|
2016
|
+
});
|
|
2017
|
+
|
|
2018
|
+
var _pool = __webpack_require__(15);
|
|
2019
|
+
|
|
2020
|
+
var _pool2 = _interopRequireDefault(_pool);
|
|
2021
|
+
|
|
2022
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2023
|
+
|
|
2024
|
+
var ImportAction = function ImportAction(container) {
|
|
2025
|
+
return function () {
|
|
2026
|
+
var effects = {};
|
|
2027
|
+
var $pool = _pool2.default._pool;
|
|
2028
|
+
if ($pool.size > 0) {
|
|
2029
|
+
$pool.forEach(function (value, key, map) {
|
|
2030
|
+
var ctor = key.constructor;
|
|
2031
|
+
if (ctor) {
|
|
2032
|
+
// 2.1.2开始支持
|
|
2033
|
+
if (!value) {
|
|
2034
|
+
var instance = container.resolve(key);
|
|
2035
|
+
for (var _key in instance) {
|
|
2036
|
+
if (typeof instance[_key] === 'function') {
|
|
2037
|
+
// effects[key] = instance[key];
|
|
2038
|
+
effects[_key] = instance[_key].bind(instance);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
} else {
|
|
2042
|
+
// 优化前的逻辑,一样兼容 < 2.1.2版本的声明方式
|
|
2043
|
+
var valueLength = value.length;
|
|
2044
|
+
if (valueLength > 0) {
|
|
2045
|
+
// 该模式下不提供注入具体的实现类,由上层在启动程序初始化时候进行注册
|
|
2046
|
+
var _instance = container.resolve(key.constructor); // 获取实例
|
|
2047
|
+
for (var i = 0, j = valueLength; i < j; i++) {
|
|
2048
|
+
effects[value[i]] = _instance[value[i]];
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
return {
|
|
2056
|
+
effects: effects
|
|
2057
|
+
};
|
|
2058
|
+
};
|
|
2059
|
+
}; /*
|
|
2060
|
+
* @Author: shenzhiwei
|
|
2061
|
+
* @Date: 2019-07-05 08:41:29
|
|
2062
|
+
* @LastEditors: Please set LastEditors
|
|
2063
|
+
* @LastEditTime: 2019-08-09 13:58:59
|
|
2064
|
+
* @Description: 将被注解exposeAction的effect/mutation注入到actions中
|
|
2065
|
+
*/
|
|
2066
|
+
exports.default = ImportAction;
|
|
2067
|
+
|
|
2068
|
+
/***/ }),
|
|
2069
|
+
|
|
2070
|
+
/***/ 57:
|
|
2071
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2072
|
+
|
|
2073
|
+
"use strict";
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2077
|
+
value: true
|
|
2078
|
+
});
|
|
2079
|
+
|
|
2080
|
+
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2081
|
+
|
|
2082
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2083
|
+
|
|
2084
|
+
/*
|
|
2085
|
+
* @Author: shenzhiwei
|
|
2086
|
+
* @Date: 2019-08-08 15:32:04
|
|
2087
|
+
* @Company: orientsec.com.cn
|
|
2088
|
+
* @Description: 解耦effect调用model
|
|
2089
|
+
*/
|
|
2090
|
+
var ModelCenterService = function () {
|
|
2091
|
+
function ModelCenterService() {
|
|
2092
|
+
_classCallCheck(this, ModelCenterService);
|
|
2093
|
+
|
|
2094
|
+
console.log('ModelService Created.');
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
_createClass(ModelCenterService, [{
|
|
2098
|
+
key: 'select',
|
|
2099
|
+
value: function select() {
|
|
2100
|
+
return ModelService.CurrentModel;
|
|
2101
|
+
}
|
|
2102
|
+
}]);
|
|
2103
|
+
|
|
2104
|
+
return ModelCenterService;
|
|
2105
|
+
}();
|
|
2106
|
+
|
|
2107
|
+
exports.default = ModelCenterService;
|
|
2108
|
+
|
|
2109
|
+
/***/ }),
|
|
2110
|
+
|
|
2111
|
+
/***/ 92:
|
|
2112
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2113
|
+
|
|
2114
|
+
"use strict";
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2118
|
+
value: true
|
|
2119
|
+
});
|
|
2120
|
+
exports.LoginFailureCompatible = exports.ModelCenterService = exports.Container = exports.ActionService = exports.ImportAction = exports.ModelState = exports.Router = exports.app = exports.h = undefined;
|
|
2121
|
+
|
|
2122
|
+
var _h = __webpack_require__(33);
|
|
2123
|
+
|
|
2124
|
+
var _h2 = _interopRequireDefault(_h);
|
|
2125
|
+
|
|
2126
|
+
var _appOptimize = __webpack_require__(131);
|
|
2127
|
+
|
|
2128
|
+
var _router = __webpack_require__(134);
|
|
2129
|
+
|
|
2130
|
+
var _router2 = _interopRequireDefault(_router);
|
|
2131
|
+
|
|
2132
|
+
var _modelState = __webpack_require__(133);
|
|
2133
|
+
|
|
2134
|
+
var _modelState2 = _interopRequireDefault(_modelState);
|
|
2135
|
+
|
|
2136
|
+
var _importAction = __webpack_require__(56);
|
|
2137
|
+
|
|
2138
|
+
var _importAction2 = _interopRequireDefault(_importAction);
|
|
2139
|
+
|
|
2140
|
+
var _actionService = __webpack_require__(55);
|
|
2141
|
+
|
|
2142
|
+
var _actionService2 = _interopRequireDefault(_actionService);
|
|
2143
|
+
|
|
2144
|
+
var _modelService = __webpack_require__(57);
|
|
2145
|
+
|
|
2146
|
+
var _modelService2 = _interopRequireDefault(_modelService);
|
|
2147
|
+
|
|
2148
|
+
var _container = __webpack_require__(132);
|
|
2149
|
+
|
|
2150
|
+
var _container2 = _interopRequireDefault(_container);
|
|
2151
|
+
|
|
2152
|
+
var _loginFailureCompatible = __webpack_require__(149);
|
|
2153
|
+
|
|
2154
|
+
var _loginFailureCompatible2 = _interopRequireDefault(_loginFailureCompatible);
|
|
2155
|
+
|
|
2156
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2157
|
+
|
|
2158
|
+
// 注:coreman.d.ts也要加入声明,否则编译不通过
|
|
2159
|
+
|
|
2160
|
+
// 解决多态性变化时候的运行时实例引用动态修改
|
|
2161
|
+
|
|
2162
|
+
// 解决effect中actions的引用问题,即通过actions调用可拿到其引用,但是通过实例调用就拿不到
|
|
2163
|
+
exports.h = _h2.default;
|
|
2164
|
+
exports.app = _appOptimize.app;
|
|
2165
|
+
exports.Router = _router2.default;
|
|
2166
|
+
exports.ModelState = _modelState2.default;
|
|
2167
|
+
exports.ImportAction = _importAction2.default;
|
|
2168
|
+
exports.ActionService = _actionService2.default;
|
|
2169
|
+
exports.Container = _container2.default;
|
|
2170
|
+
exports.ModelCenterService = _modelService2.default;
|
|
2171
|
+
exports.LoginFailureCompatible = _loginFailureCompatible2.default;
|
|
2172
|
+
// 解决桥接登录不兼容的问题
|
|
2173
|
+
|
|
2174
|
+
// 解决effect中model的引用问题
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
// 解决effect依赖注入的问题(fast plugin)
|
|
2178
|
+
/*
|
|
2179
|
+
* @Author: shenzhiwei
|
|
2180
|
+
* @Date: 2019-07-23 14:58:35
|
|
2181
|
+
* @Company: orientsec.com.cn
|
|
2182
|
+
* @Description: 优化过的入口文件
|
|
2183
|
+
*/
|
|
2184
|
+
|
|
2185
|
+
/***/ })
|
|
2186
|
+
|
|
2187
|
+
},[227]);
|
|
2188
|
+
});
|