@tarojs/with-weapp 3.5.0-beta.2 → 3.5.0-beta.3
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.esm.js +226 -226
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +226 -226
- package/dist/index.js.map +1 -1
- package/dist/with-weapp.js +229 -229
- package/dist/with-weapp.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +20 -22
- package/src/utils.ts +3 -3
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
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
if (Array.isArray(propsArg)) {
|
|
90
|
-
props = propsArg.slice(0);
|
|
91
|
-
}
|
|
53
|
+
return keys;
|
|
54
|
+
};
|
|
92
55
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
65
|
+
var replacer = opts.replacer || function (key, value) {
|
|
66
|
+
return value;
|
|
67
|
+
};
|
|
101
68
|
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
107
|
-
|
|
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 (
|
|
110
|
-
|
|
90
|
+
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
91
|
+
node = node.toJSON();
|
|
111
92
|
}
|
|
112
93
|
|
|
113
|
-
|
|
94
|
+
node = replacer.call(parent, key, node);
|
|
114
95
|
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
96
|
+
if (node === undefined) {
|
|
97
|
+
return;
|
|
117
98
|
}
|
|
118
|
-
}
|
|
119
99
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
function safeSet(obj, props, value) {
|
|
123
|
-
if (typeof props === 'string') {
|
|
124
|
-
props = props.replace(/\[(.+?)\]/g, '.$1');
|
|
125
|
-
props = props.split('.');
|
|
126
|
-
}
|
|
127
|
-
|
|
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
|
-
|
|
104
|
+
if (isArray(node)) {
|
|
105
|
+
var out = [];
|
|
154
106
|
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
119
|
+
var keys = objectKeys(node).sort(cmp && cmp(node));
|
|
120
|
+
var _out = [];
|
|
173
121
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
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
|
-
|
|
188
|
-
|
|
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
|
|
308
|
-
var clone = function clone(obj) {
|
|
309
|
-
return json.parse(stringify(obj));
|
|
310
|
-
};
|
|
251
|
+
var _lifecycleMap;
|
|
311
252
|
|
|
312
|
-
var
|
|
313
|
-
return {}.toString.call(x) === '[object Array]';
|
|
314
|
-
};
|
|
253
|
+
var TaroLifeCycles;
|
|
315
254
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
-
|
|
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
|
-
|
|
324
|
-
|
|
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
|
-
|
|
328
|
-
};
|
|
305
|
+
var props, prop;
|
|
329
306
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
-
|
|
340
|
-
|
|
341
|
-
|
|
311
|
+
if (typeof propsArg === 'string') {
|
|
312
|
+
props = propsArg.replace(/\[(.+?)\]/g, '.$1');
|
|
313
|
+
props = props.split('.');
|
|
314
|
+
}
|
|
342
315
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
-
|
|
365
|
-
|
|
324
|
+
while (props.length) {
|
|
325
|
+
prop = props.shift();
|
|
326
|
+
|
|
327
|
+
if (!obj) {
|
|
328
|
+
return defaultValue;
|
|
366
329
|
}
|
|
367
330
|
|
|
368
|
-
|
|
331
|
+
obj = obj[prop];
|
|
369
332
|
|
|
370
|
-
if (
|
|
371
|
-
return;
|
|
333
|
+
if (obj === undefined) {
|
|
334
|
+
return defaultValue;
|
|
372
335
|
}
|
|
336
|
+
}
|
|
373
337
|
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
|
|
379
|
-
var out = [];
|
|
371
|
+
obj = obj[thisProp];
|
|
380
372
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
373
|
+
if (!obj || _typeof__default["default"](obj) !== 'object') {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
385
377
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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
|
-
|
|
394
|
-
var _out = [];
|
|
390
|
+
var subBehaviors = behavior.behaviors;
|
|
395
391
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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
|
-
|
|
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
|
-
|
|
406
|
-
|
|
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; } } }; }
|
|
@@ -498,7 +498,7 @@ function withWeapp(weappConf) {
|
|
|
498
498
|
_this.didHides = [];
|
|
499
499
|
_this.didShows = [];
|
|
500
500
|
_this.willUnmounts = [];
|
|
501
|
-
_this.
|
|
501
|
+
_this.eventDestroyList = [];
|
|
502
502
|
_this.current = runtime.getCurrentInstance();
|
|
503
503
|
_this.taroGlobalData = Object.create(null);
|
|
504
504
|
|
|
@@ -640,8 +640,8 @@ function withWeapp(weappConf) {
|
|
|
640
640
|
|
|
641
641
|
for (var confKey in options) {
|
|
642
642
|
// 不支持的属性
|
|
643
|
-
if (
|
|
644
|
-
var advise =
|
|
643
|
+
if (nonsupport.has(confKey)) {
|
|
644
|
+
var advise = nonsupport.get(confKey);
|
|
645
645
|
report(advise);
|
|
646
646
|
}
|
|
647
647
|
|
|
@@ -819,8 +819,8 @@ function withWeapp(weappConf) {
|
|
|
819
819
|
key: "initLifeCycles",
|
|
820
820
|
value: function initLifeCycles(lifecycleName, lifecycle) {
|
|
821
821
|
// 不支持的生命周期
|
|
822
|
-
if (
|
|
823
|
-
var advise =
|
|
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.
|
|
890
|
+
this.eventDestroyList.push(function () {
|
|
891
891
|
return taro.eventCenter.off(router[lifecycleName], cb);
|
|
892
892
|
});
|
|
893
893
|
}
|
|
@@ -1029,7 +1029,7 @@ function withWeapp(weappConf) {
|
|
|
1029
1029
|
}, {
|
|
1030
1030
|
key: "componentWillUnmount",
|
|
1031
1031
|
value: function componentWillUnmount() {
|
|
1032
|
-
this.
|
|
1032
|
+
this.eventDestroyList.forEach(function (fn) {
|
|
1033
1033
|
return fn();
|
|
1034
1034
|
});
|
|
1035
1035
|
this.safeExecute(_get__default["default"](_getPrototypeOf__default["default"](BaseComponent.prototype), "componentWillUnmount", this));
|
|
@@ -1088,22 +1088,22 @@ function withWeapp(weappConf) {
|
|
|
1088
1088
|
}, {
|
|
1089
1089
|
key: "selectComponent",
|
|
1090
1090
|
value: function selectComponent() {
|
|
1091
|
-
report(
|
|
1091
|
+
report(nonsupport.get('selectComponent'));
|
|
1092
1092
|
}
|
|
1093
1093
|
}, {
|
|
1094
1094
|
key: "selectAllComponents",
|
|
1095
1095
|
value: function selectAllComponents() {
|
|
1096
|
-
report(
|
|
1096
|
+
report(nonsupport.get('selectAllComponents'));
|
|
1097
1097
|
}
|
|
1098
1098
|
}, {
|
|
1099
1099
|
key: "selectOwnerComponent",
|
|
1100
1100
|
value: function selectOwnerComponent() {
|
|
1101
|
-
report(
|
|
1101
|
+
report(nonsupport.get('selectOwnerComponent'));
|
|
1102
1102
|
}
|
|
1103
1103
|
}, {
|
|
1104
1104
|
key: "groupSetData",
|
|
1105
1105
|
value: function groupSetData() {
|
|
1106
|
-
report(
|
|
1106
|
+
report(nonsupport.get('groupSetData'));
|
|
1107
1107
|
}
|
|
1108
1108
|
}]);
|
|
1109
1109
|
|