@tarojs/with-weapp 3.5.0-canary.1 → 3.5.0

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/dist/index.js CHANGED
@@ -13,8 +13,8 @@ var _inherits = require('@babel/runtime/helpers/inherits');
13
13
  var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
14
14
  var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
15
15
  var _typeof = require('@babel/runtime/helpers/typeof');
16
- var taro = require('@tarojs/taro');
17
16
  var runtime = require('@tarojs/runtime');
17
+ var taro = require('@tarojs/taro');
18
18
 
19
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
20
 
@@ -30,166 +30,110 @@ var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_po
30
30
  var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
31
31
  var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
32
32
 
33
- var _lifecycleMap;
34
-
35
- var TaroLifeCycles;
36
-
37
- (function (TaroLifeCycles) {
38
- TaroLifeCycles["WillMount"] = "componentWillMount";
39
- TaroLifeCycles["DidMount"] = "componentDidMount";
40
- TaroLifeCycles["DidShow"] = "componentDidShow";
41
- TaroLifeCycles["DidHide"] = "componentDidHide";
42
- TaroLifeCycles["WillUnmount"] = "componentWillUnmount";
43
- })(TaroLifeCycles || (TaroLifeCycles = {}));
44
-
45
- var lifecycleMap = (_lifecycleMap = {}, _defineProperty__default['default'](_lifecycleMap, TaroLifeCycles.WillMount, ['created']), _defineProperty__default['default'](_lifecycleMap, TaroLifeCycles.DidMount, ['attached']), _defineProperty__default['default'](_lifecycleMap, TaroLifeCycles.DidShow, ['onShow']), _defineProperty__default['default'](_lifecycleMap, TaroLifeCycles.DidHide, ['onHide']), _defineProperty__default['default'](_lifecycleMap, TaroLifeCycles.WillUnmount, ['detached', 'onUnload']), _lifecycleMap);
46
- var lifecycles = new Set(['ready']);
47
-
48
- for (var key in lifecycleMap) {
49
- var lifecycle = lifecycleMap[key];
50
- lifecycle.forEach(function (l) {
51
- return lifecycles.add(l);
52
- });
53
- }
54
-
55
- var uniquePageLifecycle = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onShareTimeline', 'onAddToFavorites', 'onPageScroll', 'onResize', 'onTabItemTap'];
56
- var appOptions = ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound', 'onUnhandledRejection', 'onThemeChange'];
33
+ var json = JSON;
34
+ var clone = function clone(obj) {
35
+ return json.parse(stringify(obj));
36
+ };
57
37
 
58
- /**
59
- * Simple bind, faster than native
60
- */
61
- function bind(fn
62
- /*: Function */
63
- , ctx
64
- /*: Object */
65
- ) {
66
- if (!fn) return false;
38
+ var isArray = Array.isArray || function (x) {
39
+ return {}.toString.call(x) === '[object Array]';
40
+ };
67
41
 
68
- function boundFn(a) {
69
- var l
70
- /*: number */
71
- = arguments.length;
72
- return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
73
- } // record original fn length
42
+ var objectKeys = Object.keys || function (obj) {
43
+ var has = Object.prototype.hasOwnProperty || function () {
44
+ return true;
45
+ };
74
46
 
47
+ var keys = [];
75
48
 
76
- boundFn._length = fn.length;
77
- return boundFn;
78
- }
79
- function isEqual(obj1, obj2) {
80
- return JSON.stringify(obj1) === JSON.stringify(obj2);
81
- }
82
- function safeGet(obj, propsArg, defaultValue) {
83
- if (!obj) {
84
- return defaultValue;
49
+ for (var key in obj) {
50
+ if (has.call(obj, key)) keys.push(key);
85
51
  }
86
52
 
87
- var props, prop;
88
-
89
- if (Array.isArray(propsArg)) {
90
- props = propsArg.slice(0);
91
- }
53
+ return keys;
54
+ };
92
55
 
93
- if (typeof propsArg === 'string') {
94
- props = propsArg.replace(/\[(.+?)\]/g, '.$1');
95
- props = props.split('.');
96
- }
56
+ function stringify(obj, opts) {
57
+ if (!opts) opts = {};
58
+ if (typeof opts === 'function') opts = {
59
+ cmp: opts
60
+ };
61
+ var space = opts.space || '';
62
+ if (typeof space === 'number') space = Array(space + 1).join(' ');
63
+ var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
97
64
 
98
- if (_typeof__default['default'](propsArg) === 'symbol') {
99
- props = [propsArg];
100
- }
65
+ var replacer = opts.replacer || function (key, value) {
66
+ return value;
67
+ };
101
68
 
102
- if (!Array.isArray(props)) {
103
- throw new Error('props arg must be an array, a string or a symbol');
104
- }
69
+ var cmp = opts.cmp && function (f) {
70
+ return function (node) {
71
+ return function (a, b) {
72
+ var aobj = {
73
+ key: a,
74
+ value: node[a]
75
+ };
76
+ var bobj = {
77
+ key: b,
78
+ value: node[b]
79
+ };
80
+ return f(aobj, bobj);
81
+ };
82
+ };
83
+ }(opts.cmp);
105
84
 
106
- while (props.length) {
107
- prop = props.shift();
85
+ var seen = [];
86
+ return function stringify(parent, key, node, level) {
87
+ var indent = space ? '\n' + new Array(level + 1).join(space) : '';
88
+ var colonSeparator = space ? ': ' : ':';
108
89
 
109
- if (!obj) {
110
- return defaultValue;
90
+ if (node && node.toJSON && typeof node.toJSON === 'function') {
91
+ node = node.toJSON();
111
92
  }
112
93
 
113
- obj = obj[prop];
94
+ node = replacer.call(parent, key, node);
114
95
 
115
- if (obj === undefined) {
116
- return defaultValue;
96
+ if (node === undefined) {
97
+ return;
117
98
  }
118
- }
119
-
120
- return obj;
121
- }
122
- function safeSet(obj, props, value) {
123
- if (typeof props === 'string') {
124
- props = props.replace(/\[(.+?)\]/g, '.$1');
125
- props = props.split('.');
126
- }
127
99
 
128
- if (_typeof__default['default'](props) === 'symbol') {
129
- props = [props];
130
- }
131
-
132
- var lastProp = props.pop();
133
-
134
- if (!lastProp) {
135
- return false;
136
- }
137
-
138
- var thisProp;
139
-
140
- while (thisProp = props.shift()) {
141
- if (typeof obj[thisProp] === 'undefined') {
142
- obj[thisProp] = {};
143
- } // 直接按路径修改 this.state 可能会导致 nextProps 也被修改
144
- // 因此按路径寻找时,每一层都复制一遍
145
-
146
-
147
- if (Array.isArray(obj[thisProp])) {
148
- obj[thisProp] = _toConsumableArray__default['default'](obj[thisProp]);
149
- } else if (_typeof__default['default'](obj[thisProp]) === 'object') {
150
- obj[thisProp] = Object.assign({}, obj[thisProp]);
100
+ if (_typeof__default["default"](node) !== 'object' || node === null) {
101
+ return json.stringify(node);
151
102
  }
152
103
 
153
- obj = obj[thisProp];
104
+ if (isArray(node)) {
105
+ var out = [];
154
106
 
155
- if (!obj || _typeof__default['default'](obj) !== 'object') {
156
- return false;
157
- }
158
- }
107
+ for (var i = 0; i < node.length; i++) {
108
+ var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
109
+ out.push(indent + space + item);
110
+ }
159
111
 
160
- obj[lastProp] = value;
161
- return true;
162
- }
163
- function report(msg) {
164
- console.warn('[Taro Convert Warning] ' + msg);
165
- }
166
- var unsupport = new Map([['onError', '不支持 App 的 onError 生命周期方法。'], ['onPageNotFound', '不支持 App 的 onPageNotFound 生命周期方法。'], ['onUnhandledRejection', '不支持 App 的 onUnhandledRejection 生命周期方法。'], ['onThemeChange', '不支持 App 的 onThemeChange 生命周期方法。'], ['moved', '不支持自定义组件的 moved 生命周期。'], ['externalClasses', '不支持自定义组件的 externalClasses 功能。'], ['relations', '不支持自定义组件的 relations 功能。'], ['options', '不支持自定义组件的 options 功能。'], ['definitionFilter', '不支持自定义组件的 definitionFilter 功能。'], ['selectComponent', 'selectComponent 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectAllComponents', 'selectAllComponents 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectOwnerComponent', 'selectOwnerComponent 方法产生不到目标效果,请使用 React 语法重构。'], ['groupSetData', 'groupSetData 方法产生不到目标效果,请使用 React 语法重构。']]);
167
- function flattenBehaviors(behavior, behaviorMap) {
168
- if (typeof behavior === 'string') {
169
- return report("\u4E0D\u652F\u6301\u4F7F\u7528\u5185\u7F6E Behavior: [".concat(behavior, "]"));
170
- }
112
+ return '[' + out.join(',') + indent + ']';
113
+ } else {
114
+ if (seen.indexOf(node) !== -1) {
115
+ if (cycles) return json.stringify('__cycle__');
116
+ throw new TypeError('Converting circular structure to JSON');
117
+ } else seen.push(node);
171
118
 
172
- var subBehaviors = behavior.behaviors;
119
+ var keys = objectKeys(node).sort(cmp && cmp(node));
120
+ var _out = [];
173
121
 
174
- if (subBehaviors === null || subBehaviors === void 0 ? void 0 : subBehaviors.length) {
175
- subBehaviors.forEach(function (subBehavior) {
176
- return flattenBehaviors(subBehavior, behaviorMap);
177
- });
178
- }
122
+ for (var _i = 0; _i < keys.length; _i++) {
123
+ var _key = keys[_i];
124
+ var value = stringify(node, _key, node[_key], level + 1);
125
+ if (!value) continue;
126
+ var keyValue = json.stringify(_key) + colonSeparator + value;
179
127
 
180
- Object.keys(behavior).forEach(function (key) {
181
- // 不支持的属性
182
- if (unsupport.has(key)) {
183
- var advise = unsupport.get(key);
184
- return report(advise);
185
- }
128
+ _out.push(indent + space + keyValue);
129
+ }
186
130
 
187
- if (behaviorMap.has(key)) {
188
- var list = behaviorMap.get(key);
189
- var value = behavior[key];
190
- list.push(value);
131
+ seen.splice(seen.indexOf(node), 1);
132
+ return '{' + _out.join(',') + indent + '}';
191
133
  }
192
- });
134
+ }({
135
+ '': obj
136
+ }, '', obj, 0);
193
137
  }
194
138
 
195
139
  /*eslint-disable*/
@@ -304,110 +248,166 @@ function type(obj) {
304
248
  return Object.prototype.toString.call(obj);
305
249
  }
306
250
 
307
- var json = JSON;
308
- var clone = function clone(obj) {
309
- return json.parse(stringify(obj));
310
- };
251
+ var _lifecycleMap;
311
252
 
312
- var isArray = Array.isArray || function (x) {
313
- return {}.toString.call(x) === '[object Array]';
314
- };
253
+ var TaroLifeCycles;
315
254
 
316
- var objectKeys = Object.keys || function (obj) {
317
- var has = Object.prototype.hasOwnProperty || function () {
318
- return true;
319
- };
255
+ (function (TaroLifeCycles) {
256
+ TaroLifeCycles["WillMount"] = "componentWillMount";
257
+ TaroLifeCycles["DidMount"] = "componentDidMount";
258
+ TaroLifeCycles["DidShow"] = "componentDidShow";
259
+ TaroLifeCycles["DidHide"] = "componentDidHide";
260
+ TaroLifeCycles["WillUnmount"] = "componentWillUnmount";
261
+ })(TaroLifeCycles || (TaroLifeCycles = {}));
320
262
 
321
- var keys = [];
263
+ var lifecycleMap = (_lifecycleMap = {}, _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.WillMount, ['created']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.DidMount, ['attached']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.DidShow, ['onShow']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.DidHide, ['onHide']), _defineProperty__default["default"](_lifecycleMap, TaroLifeCycles.WillUnmount, ['detached', 'onUnload']), _lifecycleMap);
264
+ var lifecycles = new Set(['ready']);
322
265
 
323
- for (var key in obj) {
324
- if (has.call(obj, key)) keys.push(key);
266
+ for (var key in lifecycleMap) {
267
+ var lifecycle = lifecycleMap[key];
268
+ lifecycle.forEach(function (l) {
269
+ return lifecycles.add(l);
270
+ });
271
+ }
272
+
273
+ var uniquePageLifecycle = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onShareTimeline', 'onAddToFavorites', 'onPageScroll', 'onResize', 'onTabItemTap'];
274
+ var appOptions = ['onLaunch', 'onShow', 'onHide', 'onError', 'onPageNotFound', 'onUnhandledRejection', 'onThemeChange'];
275
+
276
+ /**
277
+ * Simple bind, faster than native
278
+ */
279
+ function bind(fn
280
+ /*: Function */
281
+ , ctx
282
+ /*: Object */
283
+ ) {
284
+ if (!fn) return false;
285
+
286
+ function boundFn(a) {
287
+ var l
288
+ /*: number */
289
+ = arguments.length;
290
+ return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
291
+ } // record original fn length
292
+
293
+
294
+ boundFn._length = fn.length;
295
+ return boundFn;
296
+ }
297
+ function isEqual(obj1, obj2) {
298
+ return JSON.stringify(obj1) === JSON.stringify(obj2);
299
+ }
300
+ function safeGet(obj, propsArg, defaultValue) {
301
+ if (!obj) {
302
+ return defaultValue;
325
303
  }
326
304
 
327
- return keys;
328
- };
305
+ var props, prop;
329
306
 
330
- function stringify(obj, opts) {
331
- if (!opts) opts = {};
332
- if (typeof opts === 'function') opts = {
333
- cmp: opts
334
- };
335
- var space = opts.space || '';
336
- if (typeof space === 'number') space = Array(space + 1).join(' ');
337
- var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
307
+ if (Array.isArray(propsArg)) {
308
+ props = propsArg.slice(0);
309
+ }
338
310
 
339
- var replacer = opts.replacer || function (key, value) {
340
- return value;
341
- };
311
+ if (typeof propsArg === 'string') {
312
+ props = propsArg.replace(/\[(.+?)\]/g, '.$1');
313
+ props = props.split('.');
314
+ }
342
315
 
343
- var cmp = opts.cmp && function (f) {
344
- return function (node) {
345
- return function (a, b) {
346
- var aobj = {
347
- key: a,
348
- value: node[a]
349
- };
350
- var bobj = {
351
- key: b,
352
- value: node[b]
353
- };
354
- return f(aobj, bobj);
355
- };
356
- };
357
- }(opts.cmp);
316
+ if (_typeof__default["default"](propsArg) === 'symbol') {
317
+ props = [propsArg];
318
+ }
358
319
 
359
- var seen = [];
360
- return function stringify(parent, key, node, level) {
361
- var indent = space ? '\n' + new Array(level + 1).join(space) : '';
362
- var colonSeparator = space ? ': ' : ':';
320
+ if (!Array.isArray(props)) {
321
+ throw new Error('props arg must be an array, a string or a symbol');
322
+ }
363
323
 
364
- if (node && node.toJSON && typeof node.toJSON === 'function') {
365
- node = node.toJSON();
324
+ while (props.length) {
325
+ prop = props.shift();
326
+
327
+ if (!obj) {
328
+ return defaultValue;
366
329
  }
367
330
 
368
- node = replacer.call(parent, key, node);
331
+ obj = obj[prop];
369
332
 
370
- if (node === undefined) {
371
- return;
333
+ if (obj === undefined) {
334
+ return defaultValue;
372
335
  }
336
+ }
373
337
 
374
- if (_typeof__default['default'](node) !== 'object' || node === null) {
375
- return json.stringify(node);
338
+ return obj;
339
+ }
340
+ function safeSet(obj, props, value) {
341
+ if (typeof props === 'string') {
342
+ props = props.replace(/\[(.+?)\]/g, '.$1');
343
+ props = props.split('.');
344
+ }
345
+
346
+ if (_typeof__default["default"](props) === 'symbol') {
347
+ props = [props];
348
+ }
349
+
350
+ var lastProp = props.pop();
351
+
352
+ if (!lastProp) {
353
+ return false;
354
+ }
355
+
356
+ var thisProp;
357
+
358
+ while (thisProp = props.shift()) {
359
+ if (typeof obj[thisProp] === 'undefined') {
360
+ obj[thisProp] = {};
361
+ } // 直接按路径修改 this.state 可能会导致 nextProps 也被修改
362
+ // 因此按路径寻找时,每一层都复制一遍
363
+
364
+
365
+ if (Array.isArray(obj[thisProp])) {
366
+ obj[thisProp] = _toConsumableArray__default["default"](obj[thisProp]);
367
+ } else if (_typeof__default["default"](obj[thisProp]) === 'object') {
368
+ obj[thisProp] = Object.assign({}, obj[thisProp]);
376
369
  }
377
370
 
378
- if (isArray(node)) {
379
- var out = [];
371
+ obj = obj[thisProp];
380
372
 
381
- for (var i = 0; i < node.length; i++) {
382
- var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
383
- out.push(indent + space + item);
384
- }
373
+ if (!obj || _typeof__default["default"](obj) !== 'object') {
374
+ return false;
375
+ }
376
+ }
385
377
 
386
- return '[' + out.join(',') + indent + ']';
387
- } else {
388
- if (seen.indexOf(node) !== -1) {
389
- if (cycles) return json.stringify('__cycle__');
390
- throw new TypeError('Converting circular structure to JSON');
391
- } else seen.push(node);
378
+ obj[lastProp] = value;
379
+ return true;
380
+ }
381
+ function report(msg) {
382
+ console.warn('[Taro Convert Warning] ' + msg);
383
+ }
384
+ var nonsupport = new Map([['onError', '不支持 App 的 onError 生命周期方法。'], ['onPageNotFound', '不支持 App 的 onPageNotFound 生命周期方法。'], ['onUnhandledRejection', '不支持 App 的 onUnhandledRejection 生命周期方法。'], ['onThemeChange', '不支持 App 的 onThemeChange 生命周期方法。'], ['moved', '不支持自定义组件的 moved 生命周期。'], ['externalClasses', '不支持自定义组件的 externalClasses 功能。'], ['relations', '不支持自定义组件的 relations 功能。'], ['options', '不支持自定义组件的 options 功能。'], ['definitionFilter', '不支持自定义组件的 definitionFilter 功能。'], ['selectComponent', 'selectComponent 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectAllComponents', 'selectAllComponents 方法产生不到目标效果,请使用 React 的 ref 进行重构。'], ['selectOwnerComponent', 'selectOwnerComponent 方法产生不到目标效果,请使用 React 语法重构。'], ['groupSetData', 'groupSetData 方法产生不到目标效果,请使用 React 语法重构。']]);
385
+ function flattenBehaviors(behavior, behaviorMap) {
386
+ if (typeof behavior === 'string') {
387
+ return report("\u4E0D\u652F\u6301\u4F7F\u7528\u5185\u7F6E Behavior: [".concat(behavior, "]"));
388
+ }
392
389
 
393
- var keys = objectKeys(node).sort(cmp && cmp(node));
394
- var _out = [];
390
+ var subBehaviors = behavior.behaviors;
395
391
 
396
- for (var _i = 0; _i < keys.length; _i++) {
397
- var _key = keys[_i];
398
- var value = stringify(node, _key, node[_key], level + 1);
399
- if (!value) continue;
400
- var keyValue = json.stringify(_key) + colonSeparator + value;
392
+ if (subBehaviors === null || subBehaviors === void 0 ? void 0 : subBehaviors.length) {
393
+ subBehaviors.forEach(function (subBehavior) {
394
+ return flattenBehaviors(subBehavior, behaviorMap);
395
+ });
396
+ }
401
397
 
402
- _out.push(indent + space + keyValue);
403
- }
398
+ Object.keys(behavior).forEach(function (key) {
399
+ // 不支持的属性
400
+ if (nonsupport.has(key)) {
401
+ var advise = nonsupport.get(key);
402
+ return report(advise);
403
+ }
404
404
 
405
- seen.splice(seen.indexOf(node), 1);
406
- return '{' + _out.join(',') + indent + '}';
405
+ if (behaviorMap.has(key)) {
406
+ var list = behaviorMap.get(key);
407
+ var value = behavior[key];
408
+ list.push(value);
407
409
  }
408
- }({
409
- '': obj
410
- }, '', obj, 0);
410
+ });
411
411
  }
412
412
 
413
413
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -416,7 +416,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
416
416
 
417
417
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
418
418
 
419
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
419
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
420
420
 
421
421
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
422
422
 
@@ -441,7 +441,7 @@ function isFunction(o) {
441
441
  function withWeapp(weappConf) {
442
442
  var isApp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
443
443
 
444
- if (_typeof__default['default'](weappConf) === 'object' && Object.keys(weappConf).length === 0) {
444
+ if (_typeof__default["default"](weappConf) === 'object' && Object.keys(weappConf).length === 0) {
445
445
  report('withWeapp 请传入“App/页面/组件“的配置对象。如果原生写法使用了基类,请将基类组合后的配置对象传入,详情请参考文档。');
446
446
  }
447
447
 
@@ -470,7 +470,7 @@ function withWeapp(weappConf) {
470
470
  }
471
471
 
472
472
  if (!weappConf.properties.hasOwnProperty(propName)) {
473
- if (propValue && _typeof__default['default'](propValue) === 'object' && propValue.value) {
473
+ if (propValue && _typeof__default["default"](propValue) === 'object' && propValue.value) {
474
474
  propValue.value = clone(propValue.value);
475
475
  }
476
476
 
@@ -481,14 +481,14 @@ function withWeapp(weappConf) {
481
481
  }
482
482
 
483
483
  var BaseComponent = /*#__PURE__*/function (_ConnectComponent) {
484
- _inherits__default['default'](BaseComponent, _ConnectComponent);
484
+ _inherits__default["default"](BaseComponent, _ConnectComponent);
485
485
 
486
486
  var _super = _createSuper(BaseComponent);
487
487
 
488
488
  function BaseComponent(props) {
489
489
  var _this;
490
490
 
491
- _classCallCheck__default['default'](this, BaseComponent);
491
+ _classCallCheck__default["default"](this, BaseComponent);
492
492
 
493
493
  _this = _super.call(this, props);
494
494
  _this._observeProps = []; // mixins 可以多次调用生命周期
@@ -498,7 +498,7 @@ function withWeapp(weappConf) {
498
498
  _this.didHides = [];
499
499
  _this.didShows = [];
500
500
  _this.willUnmounts = [];
501
- _this.eventDistoryList = [];
501
+ _this.eventDestroyList = [];
502
502
  _this.current = runtime.getCurrentInstance();
503
503
  _this.taroGlobalData = Object.create(null);
504
504
 
@@ -507,7 +507,7 @@ function withWeapp(weappConf) {
507
507
  args[_key - 1] = arguments[_key];
508
508
  }
509
509
 
510
- if (isFunction(func)) func.apply(_assertThisInitialized__default['default'](_this), args);
510
+ if (isFunction(func)) func.apply(_assertThisInitialized__default["default"](_this), args);
511
511
  };
512
512
 
513
513
  _this.setData = function (obj, callback) {
@@ -525,7 +525,7 @@ function withWeapp(weappConf) {
525
525
  _this.triggerObservers(_this.state, oldState);
526
526
 
527
527
  if (callback) {
528
- callback.call(_assertThisInitialized__default['default'](_this));
528
+ callback.call(_assertThisInitialized__default["default"](_this));
529
529
  }
530
530
  });
531
531
  };
@@ -546,7 +546,7 @@ function withWeapp(weappConf) {
546
546
  var func = props["on".concat(eventName[0].toUpperCase()).concat(eventName.slice(1))];
547
547
 
548
548
  if (isFunction(func)) {
549
- func.call(_assertThisInitialized__default['default'](_this), {
549
+ func.call(_assertThisInitialized__default["default"](_this), {
550
550
  type: eventName,
551
551
  detail: detail,
552
552
  target: {
@@ -575,12 +575,12 @@ function withWeapp(weappConf) {
575
575
 
576
576
  _this.init(weappConf);
577
577
 
578
- defineGetter(_assertThisInitialized__default['default'](_this), 'data', 'state');
579
- defineGetter(_assertThisInitialized__default['default'](_this), 'properties', 'props');
578
+ defineGetter(_assertThisInitialized__default["default"](_this), 'data', 'state');
579
+ defineGetter(_assertThisInitialized__default["default"](_this), 'properties', 'props');
580
580
  return _this;
581
581
  }
582
582
 
583
- _createClass__default['default'](BaseComponent, [{
583
+ _createClass__default["default"](BaseComponent, [{
584
584
  key: "initProps",
585
585
  value: function initProps(props) {
586
586
  for (var propKey in props) {
@@ -612,7 +612,7 @@ function withWeapp(weappConf) {
612
612
 
613
613
  try {
614
614
  var _loop = function _loop() {
615
- var _step$value = _slicedToArray__default['default'](_step.value, 2),
615
+ var _step$value = _slicedToArray__default["default"](_step.value, 2),
616
616
  key = _step$value[0],
617
617
  list = _step$value[1];
618
618
 
@@ -640,8 +640,8 @@ function withWeapp(weappConf) {
640
640
 
641
641
  for (var confKey in options) {
642
642
  // 不支持的属性
643
- if (unsupport.has(confKey)) {
644
- var advise = unsupport.get(confKey);
643
+ if (nonsupport.has(confKey)) {
644
+ var advise = nonsupport.get(confKey);
645
645
  report(advise);
646
646
  }
647
647
 
@@ -755,20 +755,20 @@ function withWeapp(weappConf) {
755
755
 
756
756
  try {
757
757
  var _loop2 = function _loop2() {
758
- var _step2$value = _slicedToArray__default['default'](_step2.value, 2),
758
+ var _step2$value = _slicedToArray__default["default"](_step2.value, 2),
759
759
  key = _step2$value[0],
760
760
  list = _step2$value[1];
761
761
 
762
762
  switch (key) {
763
763
  case 'data':
764
- [].concat(_toConsumableArray__default['default'](list), [_this2.state]).forEach(function (dataObject, index) {
764
+ [].concat(_toConsumableArray__default["default"](list), [_this2.state]).forEach(function (dataObject, index) {
765
765
  Object.keys(dataObject).forEach(function (dataKey) {
766
766
  var value = dataObject[dataKey];
767
767
  var preValue = behaviorData[dataKey];
768
768
 
769
- var valueType = _typeof__default['default'](value);
769
+ var valueType = _typeof__default["default"](value);
770
770
 
771
- var preValueType = _typeof__default['default'](preValue);
771
+ var preValueType = _typeof__default["default"](preValue);
772
772
 
773
773
  if (valueType === 'object') {
774
774
  if (!value) {
@@ -819,8 +819,8 @@ function withWeapp(weappConf) {
819
819
  key: "initLifeCycles",
820
820
  value: function initLifeCycles(lifecycleName, lifecycle) {
821
821
  // 不支持的生命周期
822
- if (unsupport.has(lifecycleName)) {
823
- var advise = unsupport.get(lifecycleName);
822
+ if (nonsupport.has(lifecycleName)) {
823
+ var advise = nonsupport.get(lifecycleName);
824
824
  return report(advise);
825
825
  }
826
826
 
@@ -887,7 +887,7 @@ function withWeapp(weappConf) {
887
887
  cb = cb.bind(this);
888
888
  (router === null || router === void 0 ? void 0 : router[lifecycleName]) && taro.eventCenter.on(router[lifecycleName], cb); // unMount 时需要取消事件监听
889
889
 
890
- this.eventDistoryList.push(function () {
890
+ this.eventDestroyList.push(function () {
891
891
  return taro.eventCenter.off(router[lifecycleName], cb);
892
892
  });
893
893
  }
@@ -1015,7 +1015,7 @@ function withWeapp(weappConf) {
1015
1015
  }, {
1016
1016
  key: "componentWillMount",
1017
1017
  value: function componentWillMount() {
1018
- this.safeExecute(_get__default['default'](_getPrototypeOf__default['default'](BaseComponent.prototype), "componentWillMount", this));
1018
+ this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentWillMount", this));
1019
1019
  this.executeLifeCycles(this.willMounts, this.current.router || {});
1020
1020
  this.triggerObservers(this.data, BaseComponent.defaultProps);
1021
1021
  this.triggerPropertiesObservers(BaseComponent.defaultProps, this.props);
@@ -1023,28 +1023,28 @@ function withWeapp(weappConf) {
1023
1023
  }, {
1024
1024
  key: "componentDidMount",
1025
1025
  value: function componentDidMount() {
1026
- this.safeExecute(_get__default['default'](_getPrototypeOf__default['default'](BaseComponent.prototype), "componentDidMount", this));
1026
+ this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentDidMount", this));
1027
1027
  this.executeLifeCycles(this.didMounts);
1028
1028
  }
1029
1029
  }, {
1030
1030
  key: "componentWillUnmount",
1031
1031
  value: function componentWillUnmount() {
1032
- this.eventDistoryList.forEach(function (fn) {
1032
+ this.eventDestroyList.forEach(function (fn) {
1033
1033
  return fn();
1034
1034
  });
1035
- this.safeExecute(_get__default['default'](_getPrototypeOf__default['default'](BaseComponent.prototype), "componentWillUnmount", this));
1035
+ this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentWillUnmount", this));
1036
1036
  this.executeLifeCycles(this.willUnmounts);
1037
1037
  }
1038
1038
  }, {
1039
1039
  key: "componentDidHide",
1040
1040
  value: function componentDidHide() {
1041
- this.safeExecute(_get__default['default'](_getPrototypeOf__default['default'](BaseComponent.prototype), "componentDidHide", this));
1041
+ this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentDidHide", this));
1042
1042
  this.executeLifeCycles(this.didHides);
1043
1043
  }
1044
1044
  }, {
1045
1045
  key: "componentDidShow",
1046
1046
  value: function componentDidShow() {
1047
- this.safeExecute(_get__default['default'](_getPrototypeOf__default['default'](BaseComponent.prototype), "componentDidShow", this), this.current.router || {});
1047
+ this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentDidShow", this), this.current.router || {});
1048
1048
  this.executeLifeCycles(this.didShows, this.current.router || {});
1049
1049
  }
1050
1050
  }, {
@@ -1052,7 +1052,7 @@ function withWeapp(weappConf) {
1052
1052
  value: function componentWillReceiveProps(nextProps) {
1053
1053
  this.triggerObservers(nextProps, this.props);
1054
1054
  this.triggerPropertiesObservers(this.props, nextProps);
1055
- this.safeExecute(_get__default['default'](_getPrototypeOf__default['default'](BaseComponent.prototype), "componentWillReceiveProps", this));
1055
+ this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentWillReceiveProps", this));
1056
1056
  } // ================ 小程序 App, Page, Component 实例属性与方法 ================
1057
1057
 
1058
1058
  }, {
@@ -1088,22 +1088,22 @@ function withWeapp(weappConf) {
1088
1088
  }, {
1089
1089
  key: "selectComponent",
1090
1090
  value: function selectComponent() {
1091
- report(unsupport.get('selectComponent'));
1091
+ report(nonsupport.get('selectComponent'));
1092
1092
  }
1093
1093
  }, {
1094
1094
  key: "selectAllComponents",
1095
1095
  value: function selectAllComponents() {
1096
- report(unsupport.get('selectAllComponents'));
1096
+ report(nonsupport.get('selectAllComponents'));
1097
1097
  }
1098
1098
  }, {
1099
1099
  key: "selectOwnerComponent",
1100
1100
  value: function selectOwnerComponent() {
1101
- report(unsupport.get('selectOwnerComponent'));
1101
+ report(nonsupport.get('selectOwnerComponent'));
1102
1102
  }
1103
1103
  }, {
1104
1104
  key: "groupSetData",
1105
1105
  value: function groupSetData() {
1106
- report(unsupport.get('groupSetData'));
1106
+ report(nonsupport.get('groupSetData'));
1107
1107
  }
1108
1108
  }]);
1109
1109
 
@@ -1119,7 +1119,7 @@ function withWeapp(weappConf) {
1119
1119
  if (propValue != null && !isFunction(propValue)) {
1120
1120
  if (propValue.value !== undefined) {
1121
1121
  // 如果是 null 也赋值到 defaultProps
1122
- BaseComponent.defaultProps = Object.assign(_defineProperty__default['default']({}, propKey, propValue.value), BaseComponent.defaultProps);
1122
+ BaseComponent.defaultProps = Object.assign(_defineProperty__default["default"]({}, propKey, propValue.value), BaseComponent.defaultProps);
1123
1123
  }
1124
1124
  }
1125
1125
  }
@@ -1137,5 +1137,5 @@ function withWeapp(weappConf) {
1137
1137
  };
1138
1138
  }
1139
1139
 
1140
- exports['default'] = withWeapp;
1140
+ exports["default"] = withWeapp;
1141
1141
  //# sourceMappingURL=index.js.map