1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
6 |
|
7 | var taro = require('@tarojs/taro');
|
8 | var fetch = _interopDefault(require('@system.fetch'));
|
9 | var quickRequest = _interopDefault(require('@system.request'));
|
10 | var storage = _interopDefault(require('@system.storage'));
|
11 | var router = _interopDefault(require('@system.router'));
|
12 | var prompt = _interopDefault(require('@system.prompt'));
|
13 | var barcode = _interopDefault(require('@system.barcode'));
|
14 | var vibrator = _interopDefault(require('@system.vibrator'));
|
15 | var clipboard = _interopDefault(require('@system.clipboard'));
|
16 | var sensor = _interopDefault(require('@system.sensor'));
|
17 | var geolocation = _interopDefault(require('@system.geolocation'));
|
18 | var share = _interopDefault(require('@system.share'));
|
19 | var notification = _interopDefault(require('@system.notification'));
|
20 | var device = _interopDefault(require('@system.device'));
|
21 | var webview = _interopDefault(require('@system.webview'));
|
22 | var audio = _interopDefault(require('@system.audio'));
|
23 | var record = _interopDefault(require('@system.record'));
|
24 | var contact = _interopDefault(require('@system.contact'));
|
25 | var sms = _interopDefault(require('@system.sms'));
|
26 |
|
27 | function _typeof(obj) {
|
28 | "@babel/helpers - typeof";
|
29 |
|
30 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
31 | _typeof = function (obj) {
|
32 | return typeof obj;
|
33 | };
|
34 | } else {
|
35 | _typeof = function (obj) {
|
36 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
37 | };
|
38 | }
|
39 |
|
40 | return _typeof(obj);
|
41 | }
|
42 |
|
43 | function _classCallCheck(instance, Constructor) {
|
44 | if (!(instance instanceof Constructor)) {
|
45 | throw new TypeError("Cannot call a class as a function");
|
46 | }
|
47 | }
|
48 |
|
49 | function _defineProperties(target, props) {
|
50 | for (var i = 0; i < props.length; i++) {
|
51 | var descriptor = props[i];
|
52 | descriptor.enumerable = descriptor.enumerable || false;
|
53 | descriptor.configurable = true;
|
54 | if ("value" in descriptor) descriptor.writable = true;
|
55 | Object.defineProperty(target, descriptor.key, descriptor);
|
56 | }
|
57 | }
|
58 |
|
59 | function _createClass(Constructor, protoProps, staticProps) {
|
60 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
61 | if (staticProps) _defineProperties(Constructor, staticProps);
|
62 | return Constructor;
|
63 | }
|
64 |
|
65 | function _defineProperty(obj, key, value) {
|
66 | if (key in obj) {
|
67 | Object.defineProperty(obj, key, {
|
68 | value: value,
|
69 | enumerable: true,
|
70 | configurable: true,
|
71 | writable: true
|
72 | });
|
73 | } else {
|
74 | obj[key] = value;
|
75 | }
|
76 |
|
77 | return obj;
|
78 | }
|
79 |
|
80 | function _inherits(subClass, superClass) {
|
81 | if (typeof superClass !== "function" && superClass !== null) {
|
82 | throw new TypeError("Super expression must either be null or a function");
|
83 | }
|
84 |
|
85 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
86 | constructor: {
|
87 | value: subClass,
|
88 | writable: true,
|
89 | configurable: true
|
90 | }
|
91 | });
|
92 | if (superClass) _setPrototypeOf(subClass, superClass);
|
93 | }
|
94 |
|
95 | function _getPrototypeOf(o) {
|
96 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
97 | return o.__proto__ || Object.getPrototypeOf(o);
|
98 | };
|
99 | return _getPrototypeOf(o);
|
100 | }
|
101 |
|
102 | function _setPrototypeOf(o, p) {
|
103 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
104 | o.__proto__ = p;
|
105 | return o;
|
106 | };
|
107 |
|
108 | return _setPrototypeOf(o, p);
|
109 | }
|
110 |
|
111 | function _isNativeReflectConstruct() {
|
112 | if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
113 | if (Reflect.construct.sham) return false;
|
114 | if (typeof Proxy === "function") return true;
|
115 |
|
116 | try {
|
117 | Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
118 | return true;
|
119 | } catch (e) {
|
120 | return false;
|
121 | }
|
122 | }
|
123 |
|
124 | function _assertThisInitialized(self) {
|
125 | if (self === void 0) {
|
126 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
127 | }
|
128 |
|
129 | return self;
|
130 | }
|
131 |
|
132 | function _possibleConstructorReturn(self, call) {
|
133 | if (call && (typeof call === "object" || typeof call === "function")) {
|
134 | return call;
|
135 | }
|
136 |
|
137 | return _assertThisInitialized(self);
|
138 | }
|
139 |
|
140 | function _createSuper(Derived) {
|
141 | var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
142 |
|
143 | return function _createSuperInternal() {
|
144 | var Super = _getPrototypeOf(Derived),
|
145 | result;
|
146 |
|
147 | if (hasNativeReflectConstruct) {
|
148 | var NewTarget = _getPrototypeOf(this).constructor;
|
149 |
|
150 | result = Reflect.construct(Super, arguments, NewTarget);
|
151 | } else {
|
152 | result = Super.apply(this, arguments);
|
153 | }
|
154 |
|
155 | return _possibleConstructorReturn(this, result);
|
156 | };
|
157 | }
|
158 |
|
159 | function _toConsumableArray(arr) {
|
160 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
161 | }
|
162 |
|
163 | function _arrayWithoutHoles(arr) {
|
164 | if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
165 | }
|
166 |
|
167 | function _iterableToArray(iter) {
|
168 | if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
169 | }
|
170 |
|
171 | function _unsupportedIterableToArray(o, minLen) {
|
172 | if (!o) return;
|
173 | if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
174 | var n = Object.prototype.toString.call(o).slice(8, -1);
|
175 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
176 | if (n === "Map" || n === "Set") return Array.from(o);
|
177 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
178 | }
|
179 |
|
180 | function _arrayLikeToArray(arr, len) {
|
181 | if (len == null || len > arr.length) len = arr.length;
|
182 |
|
183 | for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
184 |
|
185 | return arr2;
|
186 | }
|
187 |
|
188 | function _nonIterableSpread() {
|
189 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
190 | }
|
191 |
|
192 | function _createForOfIteratorHelper(o, allowArrayLike) {
|
193 | var it;
|
194 |
|
195 | if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
196 | if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
197 | if (it) o = it;
|
198 | var i = 0;
|
199 |
|
200 | var F = function () {};
|
201 |
|
202 | return {
|
203 | s: F,
|
204 | n: function () {
|
205 | if (i >= o.length) return {
|
206 | done: true
|
207 | };
|
208 | return {
|
209 | done: false,
|
210 | value: o[i++]
|
211 | };
|
212 | },
|
213 | e: function (e) {
|
214 | throw e;
|
215 | },
|
216 | f: F
|
217 | };
|
218 | }
|
219 |
|
220 | throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
221 | }
|
222 |
|
223 | var normalCompletion = true,
|
224 | didErr = false,
|
225 | err;
|
226 | return {
|
227 | s: function () {
|
228 | it = o[Symbol.iterator]();
|
229 | },
|
230 | n: function () {
|
231 | var step = it.next();
|
232 | normalCompletion = step.done;
|
233 | return step;
|
234 | },
|
235 | e: function (e) {
|
236 | didErr = true;
|
237 | err = e;
|
238 | },
|
239 | f: function () {
|
240 | try {
|
241 | if (!normalCompletion && it.return != null) it.return();
|
242 | } finally {
|
243 | if (didErr) throw err;
|
244 | }
|
245 | }
|
246 | };
|
247 | }
|
248 |
|
249 |
|
250 | var objectIs = Object.is || function (x, y) {
|
251 | if (x === y) {
|
252 | return x !== 0 || 1 / x === 1 / y;
|
253 | }
|
254 |
|
255 | return x !== x && y !== y;
|
256 | };
|
257 |
|
258 | function shallowEqual(obj1, obj2) {
|
259 | if (_typeof(obj1) !== 'object' && _typeof(obj2) !== 'object') {
|
260 | return obj1 === obj2;
|
261 | }
|
262 |
|
263 | if (obj1 === null && obj2 === null) {
|
264 | return true;
|
265 | }
|
266 |
|
267 | if (obj1 === null || obj2 === null) {
|
268 | return false;
|
269 | }
|
270 |
|
271 | if (objectIs(obj1, obj2)) {
|
272 | return true;
|
273 | }
|
274 |
|
275 | var obj1Keys = obj1 ? Object.keys(obj1) : [];
|
276 | var obj2Keys = obj2 ? Object.keys(obj2) : [];
|
277 |
|
278 | if (obj1Keys.length !== obj2Keys.length) {
|
279 | return false;
|
280 | }
|
281 |
|
282 | for (var i = 0; i < obj1Keys.length; i++) {
|
283 | var obj1KeyItem = obj1Keys[i];
|
284 |
|
285 | if (!obj2.hasOwnProperty(obj1KeyItem) || !objectIs(obj1[obj1KeyItem], obj2[obj1KeyItem])) {
|
286 | return false;
|
287 | }
|
288 | }
|
289 |
|
290 | return true;
|
291 | }
|
292 |
|
293 | var SimpleMap = function () {
|
294 | function SimpleMap() {
|
295 | _classCallCheck(this, SimpleMap);
|
296 |
|
297 | this.cache = [];
|
298 | this.size = 0;
|
299 | }
|
300 |
|
301 | _createClass(SimpleMap, [{
|
302 | key: "set",
|
303 | value: function set(k, v) {
|
304 | var len = this.cache.length;
|
305 |
|
306 | if (!len) {
|
307 | this.cache.push({
|
308 | k: k,
|
309 | v: v
|
310 | });
|
311 | this.size += 1;
|
312 | return;
|
313 | }
|
314 |
|
315 | for (var i = 0; i < len; i++) {
|
316 | var item = this.cache[i];
|
317 |
|
318 | if (item.k === k) {
|
319 | item.v = v;
|
320 | return;
|
321 | }
|
322 | }
|
323 |
|
324 | this.cache.push({
|
325 | k: k,
|
326 | v: v
|
327 | });
|
328 | this.size += 1;
|
329 | }
|
330 | }, {
|
331 | key: "get",
|
332 | value: function get(k) {
|
333 | var len = this.cache.length;
|
334 |
|
335 | if (!len) {
|
336 | return;
|
337 | }
|
338 |
|
339 | for (var i = 0; i < len; i++) {
|
340 | var item = this.cache[i];
|
341 |
|
342 | if (item.k === k) {
|
343 | return item.v;
|
344 | }
|
345 | }
|
346 | }
|
347 | }, {
|
348 | key: "has",
|
349 | value: function has(k) {
|
350 | var len = this.cache.length;
|
351 |
|
352 | if (!len) {
|
353 | return false;
|
354 | }
|
355 |
|
356 | for (var i = 0; i < len; i++) {
|
357 | var item = this.cache[i];
|
358 |
|
359 | if (item.k === k) {
|
360 | return true;
|
361 | }
|
362 | }
|
363 |
|
364 | return false;
|
365 | }
|
366 | }, {
|
367 | key: "delete",
|
368 | value: function _delete(k) {
|
369 | var len = this.cache.length;
|
370 |
|
371 | for (var i = 0; i < len; i++) {
|
372 | var item = this.cache[i];
|
373 |
|
374 | if (item.k === k) {
|
375 | this.cache.splice(i, 1);
|
376 | this.size -= 1;
|
377 | return true;
|
378 | }
|
379 | }
|
380 |
|
381 | return false;
|
382 | }
|
383 | }, {
|
384 | key: "clear",
|
385 | value: function clear() {
|
386 | var len = this.cache.length;
|
387 | this.size = 0;
|
388 |
|
389 | if (!len) {
|
390 | return;
|
391 | }
|
392 |
|
393 | while (len) {
|
394 | this.cache.pop();
|
395 | len--;
|
396 | }
|
397 | }
|
398 | }]);
|
399 |
|
400 | return SimpleMap;
|
401 | }();
|
402 |
|
403 | var nextTick = function nextTick(fn) {
|
404 | var _fn;
|
405 |
|
406 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
407 | args[_key - 1] = arguments[_key];
|
408 | }
|
409 |
|
410 | fn = typeof fn === 'function' ? (_fn = fn).bind.apply(_fn, [null].concat(args)) : fn;
|
411 | var timerFunc = setTimeout;
|
412 | timerFunc(fn);
|
413 | };
|
414 |
|
415 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
416 |
|
417 | function createCommonjsModule(fn, module) {
|
418 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
419 | }
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 | var b = "function" === typeof Symbol && Symbol["for"],
|
430 | c = b ? Symbol["for"]("react.element") : 60103,
|
431 | d = b ? Symbol["for"]("react.portal") : 60106,
|
432 | e = b ? Symbol["for"]("react.fragment") : 60107,
|
433 | f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
434 | g = b ? Symbol["for"]("react.profiler") : 60114,
|
435 | h = b ? Symbol["for"]("react.provider") : 60109,
|
436 | k = b ? Symbol["for"]("react.context") : 60110,
|
437 | l = b ? Symbol["for"]("react.async_mode") : 60111,
|
438 | m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
439 | n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
440 | p = b ? Symbol["for"]("react.suspense") : 60113,
|
441 | q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
442 | r = b ? Symbol["for"]("react.memo") : 60115,
|
443 | t = b ? Symbol["for"]("react.lazy") : 60116,
|
444 | v = b ? Symbol["for"]("react.block") : 60121,
|
445 | w = b ? Symbol["for"]("react.fundamental") : 60117,
|
446 | x = b ? Symbol["for"]("react.responder") : 60118,
|
447 | y = b ? Symbol["for"]("react.scope") : 60119;
|
448 |
|
449 | function z(a) {
|
450 | if ("object" === _typeof(a) && null !== a) {
|
451 | var u = a.$$typeof;
|
452 |
|
453 | switch (u) {
|
454 | case c:
|
455 | switch (a = a.type, a) {
|
456 | case l:
|
457 | case m:
|
458 | case e:
|
459 | case g:
|
460 | case f:
|
461 | case p:
|
462 | return a;
|
463 |
|
464 | default:
|
465 | switch (a = a && a.$$typeof, a) {
|
466 | case k:
|
467 | case n:
|
468 | case t:
|
469 | case r:
|
470 | case h:
|
471 | return a;
|
472 |
|
473 | default:
|
474 | return u;
|
475 | }
|
476 |
|
477 | }
|
478 |
|
479 | case d:
|
480 | return u;
|
481 | }
|
482 | }
|
483 | }
|
484 |
|
485 | function A(a) {
|
486 | return z(a) === m;
|
487 | }
|
488 |
|
489 | var AsyncMode = l;
|
490 | var ConcurrentMode = m;
|
491 | var ContextConsumer = k;
|
492 | var ContextProvider = h;
|
493 | var Element = c;
|
494 | var ForwardRef = n;
|
495 | var Fragment = e;
|
496 | var Lazy = t;
|
497 | var Memo = r;
|
498 | var Portal = d;
|
499 | var Profiler = g;
|
500 | var StrictMode = f;
|
501 | var Suspense = p;
|
502 |
|
503 | var isAsyncMode = function isAsyncMode(a) {
|
504 | return A(a) || z(a) === l;
|
505 | };
|
506 |
|
507 | var isConcurrentMode = A;
|
508 |
|
509 | var isContextConsumer = function isContextConsumer(a) {
|
510 | return z(a) === k;
|
511 | };
|
512 |
|
513 | var isContextProvider = function isContextProvider(a) {
|
514 | return z(a) === h;
|
515 | };
|
516 |
|
517 | var isElement = function isElement(a) {
|
518 | return "object" === _typeof(a) && null !== a && a.$$typeof === c;
|
519 | };
|
520 |
|
521 | var isForwardRef = function isForwardRef(a) {
|
522 | return z(a) === n;
|
523 | };
|
524 |
|
525 | var isFragment = function isFragment(a) {
|
526 | return z(a) === e;
|
527 | };
|
528 |
|
529 | var isLazy = function isLazy(a) {
|
530 | return z(a) === t;
|
531 | };
|
532 |
|
533 | var isMemo = function isMemo(a) {
|
534 | return z(a) === r;
|
535 | };
|
536 |
|
537 | var isPortal = function isPortal(a) {
|
538 | return z(a) === d;
|
539 | };
|
540 |
|
541 | var isProfiler = function isProfiler(a) {
|
542 | return z(a) === g;
|
543 | };
|
544 |
|
545 | var isStrictMode = function isStrictMode(a) {
|
546 | return z(a) === f;
|
547 | };
|
548 |
|
549 | var isSuspense = function isSuspense(a) {
|
550 | return z(a) === p;
|
551 | };
|
552 |
|
553 | var isValidElementType = function isValidElementType(a) {
|
554 | return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
555 | };
|
556 |
|
557 | var typeOf = z;
|
558 | var reactIs_production_min = {
|
559 | AsyncMode: AsyncMode,
|
560 | ConcurrentMode: ConcurrentMode,
|
561 | ContextConsumer: ContextConsumer,
|
562 | ContextProvider: ContextProvider,
|
563 | Element: Element,
|
564 | ForwardRef: ForwardRef,
|
565 | Fragment: Fragment,
|
566 | Lazy: Lazy,
|
567 | Memo: Memo,
|
568 | Portal: Portal,
|
569 | Profiler: Profiler,
|
570 | StrictMode: StrictMode,
|
571 | Suspense: Suspense,
|
572 | isAsyncMode: isAsyncMode,
|
573 | isConcurrentMode: isConcurrentMode,
|
574 | isContextConsumer: isContextConsumer,
|
575 | isContextProvider: isContextProvider,
|
576 | isElement: isElement,
|
577 | isForwardRef: isForwardRef,
|
578 | isFragment: isFragment,
|
579 | isLazy: isLazy,
|
580 | isMemo: isMemo,
|
581 | isPortal: isPortal,
|
582 | isProfiler: isProfiler,
|
583 | isStrictMode: isStrictMode,
|
584 | isSuspense: isSuspense,
|
585 | isValidElementType: isValidElementType,
|
586 | typeOf: typeOf
|
587 | };
|
588 |
|
589 | var reactIs_development = createCommonjsModule(function (module, exports) {
|
590 |
|
591 | if (process.env.NODE_ENV !== "production") {
|
592 | (function () {
|
593 |
|
594 |
|
595 | var hasSymbol = typeof Symbol === 'function' && Symbol["for"];
|
596 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7;
|
597 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol["for"]('react.portal') : 0xeaca;
|
598 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol["for"]('react.fragment') : 0xeacb;
|
599 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.strict_mode') : 0xeacc;
|
600 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol["for"]('react.profiler') : 0xead2;
|
601 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]('react.provider') : 0xeacd;
|
602 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]('react.context') : 0xeace;
|
603 |
|
604 |
|
605 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol["for"]('react.async_mode') : 0xeacf;
|
606 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.concurrent_mode') : 0xeacf;
|
607 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol["for"]('react.forward_ref') : 0xead0;
|
608 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol["for"]('react.suspense') : 0xead1;
|
609 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol["for"]('react.suspense_list') : 0xead8;
|
610 | var REACT_MEMO_TYPE = hasSymbol ? Symbol["for"]('react.memo') : 0xead3;
|
611 | var REACT_LAZY_TYPE = hasSymbol ? Symbol["for"]('react.lazy') : 0xead4;
|
612 | var REACT_BLOCK_TYPE = hasSymbol ? Symbol["for"]('react.block') : 0xead9;
|
613 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol["for"]('react.fundamental') : 0xead5;
|
614 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol["for"]('react.responder') : 0xead6;
|
615 | var REACT_SCOPE_TYPE = hasSymbol ? Symbol["for"]('react.scope') : 0xead7;
|
616 |
|
617 | function isValidElementType(type) {
|
618 | return typeof type === 'string' || typeof type === 'function' ||
|
619 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
620 | }
|
621 |
|
622 | function typeOf(object) {
|
623 | if (_typeof(object) === 'object' && object !== null) {
|
624 | var $$typeof = object.$$typeof;
|
625 |
|
626 | switch ($$typeof) {
|
627 | case REACT_ELEMENT_TYPE:
|
628 | var type = object.type;
|
629 |
|
630 | switch (type) {
|
631 | case REACT_ASYNC_MODE_TYPE:
|
632 | case REACT_CONCURRENT_MODE_TYPE:
|
633 | case REACT_FRAGMENT_TYPE:
|
634 | case REACT_PROFILER_TYPE:
|
635 | case REACT_STRICT_MODE_TYPE:
|
636 | case REACT_SUSPENSE_TYPE:
|
637 | return type;
|
638 |
|
639 | default:
|
640 | var $$typeofType = type && type.$$typeof;
|
641 |
|
642 | switch ($$typeofType) {
|
643 | case REACT_CONTEXT_TYPE:
|
644 | case REACT_FORWARD_REF_TYPE:
|
645 | case REACT_LAZY_TYPE:
|
646 | case REACT_MEMO_TYPE:
|
647 | case REACT_PROVIDER_TYPE:
|
648 | return $$typeofType;
|
649 |
|
650 | default:
|
651 | return $$typeof;
|
652 | }
|
653 |
|
654 | }
|
655 |
|
656 | case REACT_PORTAL_TYPE:
|
657 | return $$typeof;
|
658 | }
|
659 | }
|
660 |
|
661 | return undefined;
|
662 | }
|
663 |
|
664 |
|
665 | var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
666 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
667 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
668 | var ContextProvider = REACT_PROVIDER_TYPE;
|
669 | var Element = REACT_ELEMENT_TYPE;
|
670 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
671 | var Fragment = REACT_FRAGMENT_TYPE;
|
672 | var Lazy = REACT_LAZY_TYPE;
|
673 | var Memo = REACT_MEMO_TYPE;
|
674 | var Portal = REACT_PORTAL_TYPE;
|
675 | var Profiler = REACT_PROFILER_TYPE;
|
676 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
677 | var Suspense = REACT_SUSPENSE_TYPE;
|
678 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
679 |
|
680 | function isAsyncMode(object) {
|
681 | {
|
682 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
683 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
684 |
|
685 | console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
686 | }
|
687 | }
|
688 | return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
689 | }
|
690 |
|
691 | function isConcurrentMode(object) {
|
692 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
693 | }
|
694 |
|
695 | function isContextConsumer(object) {
|
696 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
697 | }
|
698 |
|
699 | function isContextProvider(object) {
|
700 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
701 | }
|
702 |
|
703 | function isElement(object) {
|
704 | return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
705 | }
|
706 |
|
707 | function isForwardRef(object) {
|
708 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
709 | }
|
710 |
|
711 | function isFragment(object) {
|
712 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
713 | }
|
714 |
|
715 | function isLazy(object) {
|
716 | return typeOf(object) === REACT_LAZY_TYPE;
|
717 | }
|
718 |
|
719 | function isMemo(object) {
|
720 | return typeOf(object) === REACT_MEMO_TYPE;
|
721 | }
|
722 |
|
723 | function isPortal(object) {
|
724 | return typeOf(object) === REACT_PORTAL_TYPE;
|
725 | }
|
726 |
|
727 | function isProfiler(object) {
|
728 | return typeOf(object) === REACT_PROFILER_TYPE;
|
729 | }
|
730 |
|
731 | function isStrictMode(object) {
|
732 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
733 | }
|
734 |
|
735 | function isSuspense(object) {
|
736 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
737 | }
|
738 |
|
739 | exports.AsyncMode = AsyncMode;
|
740 | exports.ConcurrentMode = ConcurrentMode;
|
741 | exports.ContextConsumer = ContextConsumer;
|
742 | exports.ContextProvider = ContextProvider;
|
743 | exports.Element = Element;
|
744 | exports.ForwardRef = ForwardRef;
|
745 | exports.Fragment = Fragment;
|
746 | exports.Lazy = Lazy;
|
747 | exports.Memo = Memo;
|
748 | exports.Portal = Portal;
|
749 | exports.Profiler = Profiler;
|
750 | exports.StrictMode = StrictMode;
|
751 | exports.Suspense = Suspense;
|
752 | exports.isAsyncMode = isAsyncMode;
|
753 | exports.isConcurrentMode = isConcurrentMode;
|
754 | exports.isContextConsumer = isContextConsumer;
|
755 | exports.isContextProvider = isContextProvider;
|
756 | exports.isElement = isElement;
|
757 | exports.isForwardRef = isForwardRef;
|
758 | exports.isFragment = isFragment;
|
759 | exports.isLazy = isLazy;
|
760 | exports.isMemo = isMemo;
|
761 | exports.isPortal = isPortal;
|
762 | exports.isProfiler = isProfiler;
|
763 | exports.isStrictMode = isStrictMode;
|
764 | exports.isSuspense = isSuspense;
|
765 | exports.isValidElementType = isValidElementType;
|
766 | exports.typeOf = typeOf;
|
767 | })();
|
768 | }
|
769 | });
|
770 | var reactIs_development_1 = reactIs_development.AsyncMode;
|
771 | var reactIs_development_2 = reactIs_development.ConcurrentMode;
|
772 | var reactIs_development_3 = reactIs_development.ContextConsumer;
|
773 | var reactIs_development_4 = reactIs_development.ContextProvider;
|
774 | var reactIs_development_5 = reactIs_development.Element;
|
775 | var reactIs_development_6 = reactIs_development.ForwardRef;
|
776 | var reactIs_development_7 = reactIs_development.Fragment;
|
777 | var reactIs_development_8 = reactIs_development.Lazy;
|
778 | var reactIs_development_9 = reactIs_development.Memo;
|
779 | var reactIs_development_10 = reactIs_development.Portal;
|
780 | var reactIs_development_11 = reactIs_development.Profiler;
|
781 | var reactIs_development_12 = reactIs_development.StrictMode;
|
782 | var reactIs_development_13 = reactIs_development.Suspense;
|
783 | var reactIs_development_14 = reactIs_development.isAsyncMode;
|
784 | var reactIs_development_15 = reactIs_development.isConcurrentMode;
|
785 | var reactIs_development_16 = reactIs_development.isContextConsumer;
|
786 | var reactIs_development_17 = reactIs_development.isContextProvider;
|
787 | var reactIs_development_18 = reactIs_development.isElement;
|
788 | var reactIs_development_19 = reactIs_development.isForwardRef;
|
789 | var reactIs_development_20 = reactIs_development.isFragment;
|
790 | var reactIs_development_21 = reactIs_development.isLazy;
|
791 | var reactIs_development_22 = reactIs_development.isMemo;
|
792 | var reactIs_development_23 = reactIs_development.isPortal;
|
793 | var reactIs_development_24 = reactIs_development.isProfiler;
|
794 | var reactIs_development_25 = reactIs_development.isStrictMode;
|
795 | var reactIs_development_26 = reactIs_development.isSuspense;
|
796 | var reactIs_development_27 = reactIs_development.isValidElementType;
|
797 | var reactIs_development_28 = reactIs_development.typeOf;
|
798 |
|
799 | var reactIs = createCommonjsModule(function (module) {
|
800 |
|
801 | if (process.env.NODE_ENV === 'production') {
|
802 | module.exports = reactIs_production_min;
|
803 | } else {
|
804 | module.exports = reactIs_development;
|
805 | }
|
806 | });
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
816 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
817 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
818 |
|
819 | function toObject(val) {
|
820 | if (val === null || val === undefined) {
|
821 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
822 | }
|
823 |
|
824 | return Object(val);
|
825 | }
|
826 |
|
827 | function shouldUseNative() {
|
828 | try {
|
829 | if (!Object.assign) {
|
830 | return false;
|
831 | }
|
832 |
|
833 |
|
834 |
|
835 | var test1 = new String('abc');
|
836 |
|
837 | test1[5] = 'de';
|
838 |
|
839 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
840 | return false;
|
841 | }
|
842 |
|
843 |
|
844 | var test2 = {};
|
845 |
|
846 | for (var i = 0; i < 10; i++) {
|
847 | test2['_' + String.fromCharCode(i)] = i;
|
848 | }
|
849 |
|
850 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
851 | return test2[n];
|
852 | });
|
853 |
|
854 | if (order2.join('') !== '0123456789') {
|
855 | return false;
|
856 | }
|
857 |
|
858 |
|
859 | var test3 = {};
|
860 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
861 | test3[letter] = letter;
|
862 | });
|
863 |
|
864 | if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
865 | return false;
|
866 | }
|
867 |
|
868 | return true;
|
869 | } catch (err) {
|
870 |
|
871 | return false;
|
872 | }
|
873 | }
|
874 |
|
875 | var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
876 | var from;
|
877 | var to = toObject(target);
|
878 | var symbols;
|
879 |
|
880 | for (var s = 1; s < arguments.length; s++) {
|
881 | from = Object(arguments[s]);
|
882 |
|
883 | for (var key in from) {
|
884 | if (hasOwnProperty.call(from, key)) {
|
885 | to[key] = from[key];
|
886 | }
|
887 | }
|
888 |
|
889 | if (getOwnPropertySymbols) {
|
890 | symbols = getOwnPropertySymbols(from);
|
891 |
|
892 | for (var i = 0; i < symbols.length; i++) {
|
893 | if (propIsEnumerable.call(from, symbols[i])) {
|
894 | to[symbols[i]] = from[symbols[i]];
|
895 | }
|
896 | }
|
897 | }
|
898 | }
|
899 |
|
900 | return to;
|
901 | };
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
911 | var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
912 |
|
913 | var printWarning = function printWarning() {};
|
914 |
|
915 | if (process.env.NODE_ENV !== 'production') {
|
916 | var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
917 | var loggedTypeFailures = {};
|
918 | var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
919 |
|
920 | printWarning = function printWarning(text) {
|
921 | var message = 'Warning: ' + text;
|
922 |
|
923 | if (typeof console !== 'undefined') {
|
924 | console.error(message);
|
925 | }
|
926 |
|
927 | try {
|
928 |
|
929 |
|
930 |
|
931 | throw new Error(message);
|
932 | } catch (x) {}
|
933 | };
|
934 | }
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
949 | if (process.env.NODE_ENV !== 'production') {
|
950 | for (var typeSpecName in typeSpecs) {
|
951 | if (has(typeSpecs, typeSpecName)) {
|
952 | var error;
|
953 |
|
954 |
|
955 |
|
956 | try {
|
957 |
|
958 |
|
959 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
960 | var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.');
|
961 | err.name = 'Invariant Violation';
|
962 | throw err;
|
963 | }
|
964 |
|
965 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
966 | } catch (ex) {
|
967 | error = ex;
|
968 | }
|
969 |
|
970 | if (error && !(error instanceof Error)) {
|
971 | printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + _typeof(error) + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
|
972 | }
|
973 |
|
974 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
975 |
|
976 |
|
977 | loggedTypeFailures[error.message] = true;
|
978 | var stack = getStack ? getStack() : '';
|
979 | printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
|
980 | }
|
981 | }
|
982 | }
|
983 | }
|
984 | }
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 | checkPropTypes.resetWarningCache = function () {
|
993 | if (process.env.NODE_ENV !== 'production') {
|
994 | loggedTypeFailures = {};
|
995 | }
|
996 | };
|
997 |
|
998 | var checkPropTypes_1 = checkPropTypes;
|
999 |
|
1000 | var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
1001 |
|
1002 | var printWarning$1 = function printWarning() {};
|
1003 |
|
1004 | if (process.env.NODE_ENV !== 'production') {
|
1005 | printWarning$1 = function printWarning(text) {
|
1006 | var message = 'Warning: ' + text;
|
1007 |
|
1008 | if (typeof console !== 'undefined') {
|
1009 | console.error(message);
|
1010 | }
|
1011 |
|
1012 | try {
|
1013 |
|
1014 |
|
1015 |
|
1016 | throw new Error(message);
|
1017 | } catch (x) {}
|
1018 | };
|
1019 | }
|
1020 |
|
1021 | function emptyFunctionThatReturnsNull() {
|
1022 | return null;
|
1023 | }
|
1024 |
|
1025 | var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, throwOnDirectAccess) {
|
1026 |
|
1027 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
1028 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
1029 |
|
1030 | |
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 | function getIteratorFn(maybeIterable) {
|
1046 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
1047 |
|
1048 | if (typeof iteratorFn === 'function') {
|
1049 | return iteratorFn;
|
1050 | }
|
1051 | }
|
1052 | |
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 | var ANONYMOUS = '<<anonymous>>';
|
1101 |
|
1102 |
|
1103 | var ReactPropTypes = {
|
1104 | array: createPrimitiveTypeChecker('array'),
|
1105 | bool: createPrimitiveTypeChecker('boolean'),
|
1106 | func: createPrimitiveTypeChecker('function'),
|
1107 | number: createPrimitiveTypeChecker('number'),
|
1108 | object: createPrimitiveTypeChecker('object'),
|
1109 | string: createPrimitiveTypeChecker('string'),
|
1110 | symbol: createPrimitiveTypeChecker('symbol'),
|
1111 | any: createAnyTypeChecker(),
|
1112 | arrayOf: createArrayOfTypeChecker,
|
1113 | element: createElementTypeChecker(),
|
1114 | elementType: createElementTypeTypeChecker(),
|
1115 | instanceOf: createInstanceTypeChecker,
|
1116 | node: createNodeChecker(),
|
1117 | objectOf: createObjectOfTypeChecker,
|
1118 | oneOf: createEnumTypeChecker,
|
1119 | oneOfType: createUnionTypeChecker,
|
1120 | shape: createShapeTypeChecker,
|
1121 | exact: createStrictShapeTypeChecker
|
1122 | };
|
1123 | |
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 | function is(x, y) {
|
1131 |
|
1132 | if (x === y) {
|
1133 |
|
1134 |
|
1135 | return x !== 0 || 1 / x === 1 / y;
|
1136 | } else {
|
1137 |
|
1138 | return x !== x && y !== y;
|
1139 | }
|
1140 | }
|
1141 |
|
1142 |
|
1143 | |
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 | function PropTypeError(message) {
|
1153 | this.message = message;
|
1154 | this.stack = '';
|
1155 | }
|
1156 |
|
1157 |
|
1158 | PropTypeError.prototype = Error.prototype;
|
1159 |
|
1160 | function createChainableTypeChecker(validate) {
|
1161 | if (process.env.NODE_ENV !== 'production') {
|
1162 | var manualPropTypeCallCache = {};
|
1163 | var manualPropTypeWarningCount = 0;
|
1164 | }
|
1165 |
|
1166 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
1167 | componentName = componentName || ANONYMOUS;
|
1168 | propFullName = propFullName || propName;
|
1169 |
|
1170 | if (secret !== ReactPropTypesSecret_1) {
|
1171 | if (throwOnDirectAccess) {
|
1172 |
|
1173 | var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
1174 | err.name = 'Invariant Violation';
|
1175 | throw err;
|
1176 | } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
1177 |
|
1178 | var cacheKey = componentName + ':' + propName;
|
1179 |
|
1180 | if (!manualPropTypeCallCache[cacheKey] &&
|
1181 | manualPropTypeWarningCount < 3) {
|
1182 | printWarning$1('You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.');
|
1183 | manualPropTypeCallCache[cacheKey] = true;
|
1184 | manualPropTypeWarningCount++;
|
1185 | }
|
1186 | }
|
1187 | }
|
1188 |
|
1189 | if (props[propName] == null) {
|
1190 | if (isRequired) {
|
1191 | if (props[propName] === null) {
|
1192 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
1193 | }
|
1194 |
|
1195 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
1196 | }
|
1197 |
|
1198 | return null;
|
1199 | } else {
|
1200 | return validate(props, propName, componentName, location, propFullName);
|
1201 | }
|
1202 | }
|
1203 |
|
1204 | var chainedCheckType = checkType.bind(null, false);
|
1205 | chainedCheckType.isRequired = checkType.bind(null, true);
|
1206 | return chainedCheckType;
|
1207 | }
|
1208 |
|
1209 | function createPrimitiveTypeChecker(expectedType) {
|
1210 | function validate(props, propName, componentName, location, propFullName, secret) {
|
1211 | var propValue = props[propName];
|
1212 | var propType = getPropType(propValue);
|
1213 |
|
1214 | if (propType !== expectedType) {
|
1215 |
|
1216 |
|
1217 |
|
1218 | var preciseType = getPreciseType(propValue);
|
1219 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
1220 | }
|
1221 |
|
1222 | return null;
|
1223 | }
|
1224 |
|
1225 | return createChainableTypeChecker(validate);
|
1226 | }
|
1227 |
|
1228 | function createAnyTypeChecker() {
|
1229 | return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
1230 | }
|
1231 |
|
1232 | function createArrayOfTypeChecker(typeChecker) {
|
1233 | function validate(props, propName, componentName, location, propFullName) {
|
1234 | if (typeof typeChecker !== 'function') {
|
1235 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
1236 | }
|
1237 |
|
1238 | var propValue = props[propName];
|
1239 |
|
1240 | if (!Array.isArray(propValue)) {
|
1241 | var propType = getPropType(propValue);
|
1242 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
1243 | }
|
1244 |
|
1245 | for (var i = 0; i < propValue.length; i++) {
|
1246 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
1247 |
|
1248 | if (error instanceof Error) {
|
1249 | return error;
|
1250 | }
|
1251 | }
|
1252 |
|
1253 | return null;
|
1254 | }
|
1255 |
|
1256 | return createChainableTypeChecker(validate);
|
1257 | }
|
1258 |
|
1259 | function createElementTypeChecker() {
|
1260 | function validate(props, propName, componentName, location, propFullName) {
|
1261 | var propValue = props[propName];
|
1262 |
|
1263 | if (!isValidElement(propValue)) {
|
1264 | var propType = getPropType(propValue);
|
1265 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
1266 | }
|
1267 |
|
1268 | return null;
|
1269 | }
|
1270 |
|
1271 | return createChainableTypeChecker(validate);
|
1272 | }
|
1273 |
|
1274 | function createElementTypeTypeChecker() {
|
1275 | function validate(props, propName, componentName, location, propFullName) {
|
1276 | var propValue = props[propName];
|
1277 |
|
1278 | if (!reactIs.isValidElementType(propValue)) {
|
1279 | var propType = getPropType(propValue);
|
1280 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
1281 | }
|
1282 |
|
1283 | return null;
|
1284 | }
|
1285 |
|
1286 | return createChainableTypeChecker(validate);
|
1287 | }
|
1288 |
|
1289 | function createInstanceTypeChecker(expectedClass) {
|
1290 | function validate(props, propName, componentName, location, propFullName) {
|
1291 | if (!(props[propName] instanceof expectedClass)) {
|
1292 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
1293 | var actualClassName = getClassName(props[propName]);
|
1294 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
1295 | }
|
1296 |
|
1297 | return null;
|
1298 | }
|
1299 |
|
1300 | return createChainableTypeChecker(validate);
|
1301 | }
|
1302 |
|
1303 | function createEnumTypeChecker(expectedValues) {
|
1304 | if (!Array.isArray(expectedValues)) {
|
1305 | if (process.env.NODE_ENV !== 'production') {
|
1306 | if (arguments.length > 1) {
|
1307 | printWarning$1('Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).');
|
1308 | } else {
|
1309 | printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
1310 | }
|
1311 | }
|
1312 |
|
1313 | return emptyFunctionThatReturnsNull;
|
1314 | }
|
1315 |
|
1316 | function validate(props, propName, componentName, location, propFullName) {
|
1317 | var propValue = props[propName];
|
1318 |
|
1319 | for (var i = 0; i < expectedValues.length; i++) {
|
1320 | if (is(propValue, expectedValues[i])) {
|
1321 | return null;
|
1322 | }
|
1323 | }
|
1324 |
|
1325 | var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
1326 | var type = getPreciseType(value);
|
1327 |
|
1328 | if (type === 'symbol') {
|
1329 | return String(value);
|
1330 | }
|
1331 |
|
1332 | return value;
|
1333 | });
|
1334 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
1335 | }
|
1336 |
|
1337 | return createChainableTypeChecker(validate);
|
1338 | }
|
1339 |
|
1340 | function createObjectOfTypeChecker(typeChecker) {
|
1341 | function validate(props, propName, componentName, location, propFullName) {
|
1342 | if (typeof typeChecker !== 'function') {
|
1343 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
1344 | }
|
1345 |
|
1346 | var propValue = props[propName];
|
1347 | var propType = getPropType(propValue);
|
1348 |
|
1349 | if (propType !== 'object') {
|
1350 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
1351 | }
|
1352 |
|
1353 | for (var key in propValue) {
|
1354 | if (has$1(propValue, key)) {
|
1355 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
1356 |
|
1357 | if (error instanceof Error) {
|
1358 | return error;
|
1359 | }
|
1360 | }
|
1361 | }
|
1362 |
|
1363 | return null;
|
1364 | }
|
1365 |
|
1366 | return createChainableTypeChecker(validate);
|
1367 | }
|
1368 |
|
1369 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
1370 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
1371 | process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
1372 | return emptyFunctionThatReturnsNull;
|
1373 | }
|
1374 |
|
1375 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
1376 | var checker = arrayOfTypeCheckers[i];
|
1377 |
|
1378 | if (typeof checker !== 'function') {
|
1379 | printWarning$1('Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.');
|
1380 | return emptyFunctionThatReturnsNull;
|
1381 | }
|
1382 | }
|
1383 |
|
1384 | function validate(props, propName, componentName, location, propFullName) {
|
1385 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
1386 | var checker = arrayOfTypeCheckers[i];
|
1387 |
|
1388 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
1389 | return null;
|
1390 | }
|
1391 | }
|
1392 |
|
1393 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
1394 | }
|
1395 |
|
1396 | return createChainableTypeChecker(validate);
|
1397 | }
|
1398 |
|
1399 | function createNodeChecker() {
|
1400 | function validate(props, propName, componentName, location, propFullName) {
|
1401 | if (!isNode(props[propName])) {
|
1402 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
1403 | }
|
1404 |
|
1405 | return null;
|
1406 | }
|
1407 |
|
1408 | return createChainableTypeChecker(validate);
|
1409 | }
|
1410 |
|
1411 | function createShapeTypeChecker(shapeTypes) {
|
1412 | function validate(props, propName, componentName, location, propFullName) {
|
1413 | var propValue = props[propName];
|
1414 | var propType = getPropType(propValue);
|
1415 |
|
1416 | if (propType !== 'object') {
|
1417 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
1418 | }
|
1419 |
|
1420 | for (var key in shapeTypes) {
|
1421 | var checker = shapeTypes[key];
|
1422 |
|
1423 | if (!checker) {
|
1424 | continue;
|
1425 | }
|
1426 |
|
1427 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
1428 |
|
1429 | if (error) {
|
1430 | return error;
|
1431 | }
|
1432 | }
|
1433 |
|
1434 | return null;
|
1435 | }
|
1436 |
|
1437 | return createChainableTypeChecker(validate);
|
1438 | }
|
1439 |
|
1440 | function createStrictShapeTypeChecker(shapeTypes) {
|
1441 | function validate(props, propName, componentName, location, propFullName) {
|
1442 | var propValue = props[propName];
|
1443 | var propType = getPropType(propValue);
|
1444 |
|
1445 | if (propType !== 'object') {
|
1446 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
1447 | }
|
1448 |
|
1449 |
|
1450 |
|
1451 | var allKeys = objectAssign({}, props[propName], shapeTypes);
|
1452 |
|
1453 | for (var key in allKeys) {
|
1454 | var checker = shapeTypes[key];
|
1455 |
|
1456 | if (!checker) {
|
1457 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
|
1458 | }
|
1459 |
|
1460 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
1461 |
|
1462 | if (error) {
|
1463 | return error;
|
1464 | }
|
1465 | }
|
1466 |
|
1467 | return null;
|
1468 | }
|
1469 |
|
1470 | return createChainableTypeChecker(validate);
|
1471 | }
|
1472 |
|
1473 | function isNode(propValue) {
|
1474 | switch (_typeof(propValue)) {
|
1475 | case 'number':
|
1476 | case 'string':
|
1477 | case 'undefined':
|
1478 | return true;
|
1479 |
|
1480 | case 'boolean':
|
1481 | return !propValue;
|
1482 |
|
1483 | case 'object':
|
1484 | if (Array.isArray(propValue)) {
|
1485 | return propValue.every(isNode);
|
1486 | }
|
1487 |
|
1488 | if (propValue === null || isValidElement(propValue)) {
|
1489 | return true;
|
1490 | }
|
1491 |
|
1492 | var iteratorFn = getIteratorFn(propValue);
|
1493 |
|
1494 | if (iteratorFn) {
|
1495 | var iterator = iteratorFn.call(propValue);
|
1496 | var step;
|
1497 |
|
1498 | if (iteratorFn !== propValue.entries) {
|
1499 | while (!(step = iterator.next()).done) {
|
1500 | if (!isNode(step.value)) {
|
1501 | return false;
|
1502 | }
|
1503 | }
|
1504 | } else {
|
1505 |
|
1506 | while (!(step = iterator.next()).done) {
|
1507 | var entry = step.value;
|
1508 |
|
1509 | if (entry) {
|
1510 | if (!isNode(entry[1])) {
|
1511 | return false;
|
1512 | }
|
1513 | }
|
1514 | }
|
1515 | }
|
1516 | } else {
|
1517 | return false;
|
1518 | }
|
1519 |
|
1520 | return true;
|
1521 |
|
1522 | default:
|
1523 | return false;
|
1524 | }
|
1525 | }
|
1526 |
|
1527 | function isSymbol(propType, propValue) {
|
1528 |
|
1529 | if (propType === 'symbol') {
|
1530 | return true;
|
1531 | }
|
1532 |
|
1533 |
|
1534 | if (!propValue) {
|
1535 | return false;
|
1536 | }
|
1537 |
|
1538 |
|
1539 | if (propValue['@@toStringTag'] === 'Symbol') {
|
1540 | return true;
|
1541 | }
|
1542 |
|
1543 |
|
1544 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
1545 | return true;
|
1546 | }
|
1547 |
|
1548 | return false;
|
1549 | }
|
1550 |
|
1551 |
|
1552 | function getPropType(propValue) {
|
1553 | var propType = _typeof(propValue);
|
1554 |
|
1555 | if (Array.isArray(propValue)) {
|
1556 | return 'array';
|
1557 | }
|
1558 |
|
1559 | if (propValue instanceof RegExp) {
|
1560 |
|
1561 |
|
1562 |
|
1563 | return 'object';
|
1564 | }
|
1565 |
|
1566 | if (isSymbol(propType, propValue)) {
|
1567 | return 'symbol';
|
1568 | }
|
1569 |
|
1570 | return propType;
|
1571 | }
|
1572 |
|
1573 |
|
1574 |
|
1575 | function getPreciseType(propValue) {
|
1576 | if (typeof propValue === 'undefined' || propValue === null) {
|
1577 | return '' + propValue;
|
1578 | }
|
1579 |
|
1580 | var propType = getPropType(propValue);
|
1581 |
|
1582 | if (propType === 'object') {
|
1583 | if (propValue instanceof Date) {
|
1584 | return 'date';
|
1585 | } else if (propValue instanceof RegExp) {
|
1586 | return 'regexp';
|
1587 | }
|
1588 | }
|
1589 |
|
1590 | return propType;
|
1591 | }
|
1592 |
|
1593 |
|
1594 |
|
1595 | function getPostfixForTypeWarning(value) {
|
1596 | var type = getPreciseType(value);
|
1597 |
|
1598 | switch (type) {
|
1599 | case 'array':
|
1600 | case 'object':
|
1601 | return 'an ' + type;
|
1602 |
|
1603 | case 'boolean':
|
1604 | case 'date':
|
1605 | case 'regexp':
|
1606 | return 'a ' + type;
|
1607 |
|
1608 | default:
|
1609 | return type;
|
1610 | }
|
1611 | }
|
1612 |
|
1613 |
|
1614 | function getClassName(propValue) {
|
1615 | if (!propValue.constructor || !propValue.constructor.name) {
|
1616 | return ANONYMOUS;
|
1617 | }
|
1618 |
|
1619 | return propValue.constructor.name;
|
1620 | }
|
1621 |
|
1622 | ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
1623 | ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
1624 | ReactPropTypes.PropTypes = ReactPropTypes;
|
1625 | return ReactPropTypes;
|
1626 | };
|
1627 |
|
1628 | function emptyFunction() {}
|
1629 |
|
1630 | function emptyFunctionWithReset() {}
|
1631 |
|
1632 | emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
1633 |
|
1634 | var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
1635 | function shim(props, propName, componentName, location, propFullName, secret) {
|
1636 | if (secret === ReactPropTypesSecret_1) {
|
1637 |
|
1638 | return;
|
1639 | }
|
1640 |
|
1641 | var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
1642 | err.name = 'Invariant Violation';
|
1643 | throw err;
|
1644 | }
|
1645 | shim.isRequired = shim;
|
1646 |
|
1647 | function getShim() {
|
1648 | return shim;
|
1649 | }
|
1650 |
|
1651 |
|
1652 | var ReactPropTypes = {
|
1653 | array: shim,
|
1654 | bool: shim,
|
1655 | func: shim,
|
1656 | number: shim,
|
1657 | object: shim,
|
1658 | string: shim,
|
1659 | symbol: shim,
|
1660 | any: shim,
|
1661 | arrayOf: getShim,
|
1662 | element: shim,
|
1663 | elementType: shim,
|
1664 | instanceOf: getShim,
|
1665 | node: shim,
|
1666 | objectOf: getShim,
|
1667 | oneOf: getShim,
|
1668 | oneOfType: getShim,
|
1669 | shape: getShim,
|
1670 | exact: getShim,
|
1671 | checkPropTypes: emptyFunctionWithReset,
|
1672 | resetWarningCache: emptyFunction
|
1673 | };
|
1674 | ReactPropTypes.PropTypes = ReactPropTypes;
|
1675 | return ReactPropTypes;
|
1676 | };
|
1677 |
|
1678 | var propTypes = createCommonjsModule(function (module) {
|
1679 | |
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 | if (process.env.NODE_ENV !== 'production') {
|
1686 | var ReactIs = reactIs;
|
1687 |
|
1688 |
|
1689 | var throwOnDirectAccess = true;
|
1690 | module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
1691 | } else {
|
1692 |
|
1693 |
|
1694 | module.exports = factoryWithThrowingShims();
|
1695 | }
|
1696 | });
|
1697 |
|
1698 |
|
1699 |
|
1700 | var freeGlobal = _typeof(commonjsGlobal) == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
1701 | var _freeGlobal = freeGlobal;
|
1702 |
|
1703 |
|
1704 |
|
1705 | var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
|
1706 |
|
1707 |
|
1708 | var root = _freeGlobal || freeSelf || Function('return this')();
|
1709 | var _root = root;
|
1710 |
|
1711 |
|
1712 |
|
1713 | var _Symbol2 = _root.Symbol;
|
1714 | var _Symbol = _Symbol2;
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 | function arrayMap(array, iteratee) {
|
1726 | var index = -1,
|
1727 | length = array == null ? 0 : array.length,
|
1728 | result = Array(length);
|
1729 |
|
1730 | while (++index < length) {
|
1731 | result[index] = iteratee(array[index], index, array);
|
1732 | }
|
1733 |
|
1734 | return result;
|
1735 | }
|
1736 |
|
1737 | var _arrayMap = arrayMap;
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 | var isArray = Array.isArray;
|
1763 | var isArray_1 = isArray;
|
1764 |
|
1765 |
|
1766 |
|
1767 | var objectProto = Object.prototype;
|
1768 |
|
1769 |
|
1770 | var hasOwnProperty$1 = objectProto.hasOwnProperty;
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 | var nativeObjectToString = objectProto.toString;
|
1778 |
|
1779 |
|
1780 | var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 | function getRawTag(value) {
|
1790 | var isOwn = hasOwnProperty$1.call(value, symToStringTag),
|
1791 | tag = value[symToStringTag];
|
1792 |
|
1793 | try {
|
1794 | value[symToStringTag] = undefined;
|
1795 | var unmasked = true;
|
1796 | } catch (e) {}
|
1797 |
|
1798 | var result = nativeObjectToString.call(value);
|
1799 |
|
1800 | if (unmasked) {
|
1801 | if (isOwn) {
|
1802 | value[symToStringTag] = tag;
|
1803 | } else {
|
1804 | delete value[symToStringTag];
|
1805 | }
|
1806 | }
|
1807 |
|
1808 | return result;
|
1809 | }
|
1810 |
|
1811 | var _getRawTag = getRawTag;
|
1812 |
|
1813 |
|
1814 | var objectProto$1 = Object.prototype;
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 | var nativeObjectToString$1 = objectProto$1.toString;
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 | function objectToString(value) {
|
1831 | return nativeObjectToString$1.call(value);
|
1832 | }
|
1833 |
|
1834 | var _objectToString = objectToString;
|
1835 |
|
1836 |
|
1837 |
|
1838 | var nullTag = '[object Null]',
|
1839 | undefinedTag = '[object Undefined]';
|
1840 |
|
1841 |
|
1842 | var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 | function baseGetTag(value) {
|
1852 | if (value == null) {
|
1853 | return value === undefined ? undefinedTag : nullTag;
|
1854 | }
|
1855 |
|
1856 | return symToStringTag$1 && symToStringTag$1 in Object(value) ? _getRawTag(value) : _objectToString(value);
|
1857 | }
|
1858 |
|
1859 | var _baseGetTag = baseGetTag;
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 | function isObjectLike(value) {
|
1886 | return value != null && _typeof(value) == 'object';
|
1887 | }
|
1888 |
|
1889 | var isObjectLike_1 = isObjectLike;
|
1890 |
|
1891 |
|
1892 |
|
1893 | var symbolTag = '[object Symbol]';
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 | function isSymbol(value) {
|
1913 | return _typeof(value) == 'symbol' || isObjectLike_1(value) && _baseGetTag(value) == symbolTag;
|
1914 | }
|
1915 |
|
1916 | var isSymbol_1 = isSymbol;
|
1917 |
|
1918 |
|
1919 |
|
1920 | var INFINITY = 1 / 0;
|
1921 |
|
1922 |
|
1923 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
1924 | symbolToString = symbolProto ? symbolProto.toString : undefined;
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 | function baseToString(value) {
|
1935 |
|
1936 | if (typeof value == 'string') {
|
1937 | return value;
|
1938 | }
|
1939 |
|
1940 | if (isArray_1(value)) {
|
1941 |
|
1942 | return _arrayMap(value, baseToString) + '';
|
1943 | }
|
1944 |
|
1945 | if (isSymbol_1(value)) {
|
1946 | return symbolToString ? symbolToString.call(value) : '';
|
1947 | }
|
1948 |
|
1949 | var result = value + '';
|
1950 | return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
1951 | }
|
1952 |
|
1953 | var _baseToString = baseToString;
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 | function toString(value) {
|
1978 | return value == null ? '' : _baseToString(value);
|
1979 | }
|
1980 |
|
1981 | var toString_1 = toString;
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 | function baseSlice(array, start, end) {
|
1993 | var index = -1,
|
1994 | length = array.length;
|
1995 |
|
1996 | if (start < 0) {
|
1997 | start = -start > length ? 0 : length + start;
|
1998 | }
|
1999 |
|
2000 | end = end > length ? length : end;
|
2001 |
|
2002 | if (end < 0) {
|
2003 | end += length;
|
2004 | }
|
2005 |
|
2006 | length = start > end ? 0 : end - start >>> 0;
|
2007 | start >>>= 0;
|
2008 | var result = Array(length);
|
2009 |
|
2010 | while (++index < length) {
|
2011 | result[index] = array[index + start];
|
2012 | }
|
2013 |
|
2014 | return result;
|
2015 | }
|
2016 |
|
2017 | var _baseSlice = baseSlice;
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 | function castSlice(array, start, end) {
|
2030 | var length = array.length;
|
2031 | end = end === undefined ? length : end;
|
2032 | return !start && end >= length ? array : _baseSlice(array, start, end);
|
2033 | }
|
2034 |
|
2035 | var _castSlice = castSlice;
|
2036 |
|
2037 |
|
2038 | var rsAstralRange = "\\ud800-\\udfff",
|
2039 | rsComboMarksRange = "\\u0300-\\u036f",
|
2040 | reComboHalfMarksRange = "\\ufe20-\\ufe2f",
|
2041 | rsComboSymbolsRange = "\\u20d0-\\u20ff",
|
2042 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
2043 | rsVarRange = "\\ufe0e\\ufe0f";
|
2044 |
|
2045 |
|
2046 | var rsZWJ = "\\u200d";
|
2047 |
|
2048 |
|
2049 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 | function hasUnicode(string) {
|
2059 | return reHasUnicode.test(string);
|
2060 | }
|
2061 |
|
2062 | var _hasUnicode = hasUnicode;
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 | function asciiToArray(string) {
|
2072 | return string.split('');
|
2073 | }
|
2074 |
|
2075 | var _asciiToArray = asciiToArray;
|
2076 |
|
2077 |
|
2078 | var rsAstralRange$1 = "\\ud800-\\udfff",
|
2079 | rsComboMarksRange$1 = "\\u0300-\\u036f",
|
2080 | reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f",
|
2081 | rsComboSymbolsRange$1 = "\\u20d0-\\u20ff",
|
2082 | rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
|
2083 | rsVarRange$1 = "\\ufe0e\\ufe0f";
|
2084 |
|
2085 |
|
2086 | var rsAstral = '[' + rsAstralRange$1 + ']',
|
2087 | rsCombo = '[' + rsComboRange$1 + ']',
|
2088 | rsFitz = "\\ud83c[\\udffb-\\udfff]",
|
2089 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
2090 | rsNonAstral = '[^' + rsAstralRange$1 + ']',
|
2091 | rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}",
|
2092 | rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]",
|
2093 | rsZWJ$1 = "\\u200d";
|
2094 |
|
2095 |
|
2096 | var reOptMod = rsModifier + '?',
|
2097 | rsOptVar = '[' + rsVarRange$1 + ']?',
|
2098 | rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
2099 | rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
2100 | rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
2101 |
|
2102 |
|
2103 | var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 | function unicodeToArray(string) {
|
2113 | return string.match(reUnicode) || [];
|
2114 | }
|
2115 |
|
2116 | var _unicodeToArray = unicodeToArray;
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 | function stringToArray(string) {
|
2127 | return _hasUnicode(string) ? _unicodeToArray(string) : _asciiToArray(string);
|
2128 | }
|
2129 |
|
2130 | var _stringToArray = stringToArray;
|
2131 |
|
2132 |
|
2133 |
|
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 | function createCaseFirst(methodName) {
|
2141 | return function (string) {
|
2142 | string = toString_1(string);
|
2143 | var strSymbols = _hasUnicode(string) ? _stringToArray(string) : undefined;
|
2144 | var chr = strSymbols ? strSymbols[0] : string.charAt(0);
|
2145 | var trailing = strSymbols ? _castSlice(strSymbols, 1).join('') : string.slice(1);
|
2146 | return chr[methodName]() + trailing;
|
2147 | };
|
2148 | }
|
2149 |
|
2150 | var _createCaseFirst = createCaseFirst;
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 | var upperFirst = _createCaseFirst('toUpperCase');
|
2171 | var upperFirst_1 = upperFirst;
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 | function capitalize(string) {
|
2190 | return upperFirst_1(toString_1(string).toLowerCase());
|
2191 | }
|
2192 |
|
2193 | var capitalize_1 = capitalize;
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 | function arrayReduce(array, iteratee, accumulator, initAccum) {
|
2208 | var index = -1,
|
2209 | length = array == null ? 0 : array.length;
|
2210 |
|
2211 | if (initAccum && length) {
|
2212 | accumulator = array[++index];
|
2213 | }
|
2214 |
|
2215 | while (++index < length) {
|
2216 | accumulator = iteratee(accumulator, array[index], index, array);
|
2217 | }
|
2218 |
|
2219 | return accumulator;
|
2220 | }
|
2221 |
|
2222 | var _arrayReduce = arrayReduce;
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 | function basePropertyOf(object) {
|
2232 | return function (key) {
|
2233 | return object == null ? undefined : object[key];
|
2234 | };
|
2235 | }
|
2236 |
|
2237 | var _basePropertyOf = basePropertyOf;
|
2238 |
|
2239 |
|
2240 |
|
2241 | var deburredLetters = {
|
2242 |
|
2243 | '\xc0': 'A',
|
2244 | '\xc1': 'A',
|
2245 | '\xc2': 'A',
|
2246 | '\xc3': 'A',
|
2247 | '\xc4': 'A',
|
2248 | '\xc5': 'A',
|
2249 | '\xe0': 'a',
|
2250 | '\xe1': 'a',
|
2251 | '\xe2': 'a',
|
2252 | '\xe3': 'a',
|
2253 | '\xe4': 'a',
|
2254 | '\xe5': 'a',
|
2255 | '\xc7': 'C',
|
2256 | '\xe7': 'c',
|
2257 | '\xd0': 'D',
|
2258 | '\xf0': 'd',
|
2259 | '\xc8': 'E',
|
2260 | '\xc9': 'E',
|
2261 | '\xca': 'E',
|
2262 | '\xcb': 'E',
|
2263 | '\xe8': 'e',
|
2264 | '\xe9': 'e',
|
2265 | '\xea': 'e',
|
2266 | '\xeb': 'e',
|
2267 | '\xcc': 'I',
|
2268 | '\xcd': 'I',
|
2269 | '\xce': 'I',
|
2270 | '\xcf': 'I',
|
2271 | '\xec': 'i',
|
2272 | '\xed': 'i',
|
2273 | '\xee': 'i',
|
2274 | '\xef': 'i',
|
2275 | '\xd1': 'N',
|
2276 | '\xf1': 'n',
|
2277 | '\xd2': 'O',
|
2278 | '\xd3': 'O',
|
2279 | '\xd4': 'O',
|
2280 | '\xd5': 'O',
|
2281 | '\xd6': 'O',
|
2282 | '\xd8': 'O',
|
2283 | '\xf2': 'o',
|
2284 | '\xf3': 'o',
|
2285 | '\xf4': 'o',
|
2286 | '\xf5': 'o',
|
2287 | '\xf6': 'o',
|
2288 | '\xf8': 'o',
|
2289 | '\xd9': 'U',
|
2290 | '\xda': 'U',
|
2291 | '\xdb': 'U',
|
2292 | '\xdc': 'U',
|
2293 | '\xf9': 'u',
|
2294 | '\xfa': 'u',
|
2295 | '\xfb': 'u',
|
2296 | '\xfc': 'u',
|
2297 | '\xdd': 'Y',
|
2298 | '\xfd': 'y',
|
2299 | '\xff': 'y',
|
2300 | '\xc6': 'Ae',
|
2301 | '\xe6': 'ae',
|
2302 | '\xde': 'Th',
|
2303 | '\xfe': 'th',
|
2304 | '\xdf': 'ss',
|
2305 |
|
2306 | "\u0100": 'A',
|
2307 | "\u0102": 'A',
|
2308 | "\u0104": 'A',
|
2309 | "\u0101": 'a',
|
2310 | "\u0103": 'a',
|
2311 | "\u0105": 'a',
|
2312 | "\u0106": 'C',
|
2313 | "\u0108": 'C',
|
2314 | "\u010A": 'C',
|
2315 | "\u010C": 'C',
|
2316 | "\u0107": 'c',
|
2317 | "\u0109": 'c',
|
2318 | "\u010B": 'c',
|
2319 | "\u010D": 'c',
|
2320 | "\u010E": 'D',
|
2321 | "\u0110": 'D',
|
2322 | "\u010F": 'd',
|
2323 | "\u0111": 'd',
|
2324 | "\u0112": 'E',
|
2325 | "\u0114": 'E',
|
2326 | "\u0116": 'E',
|
2327 | "\u0118": 'E',
|
2328 | "\u011A": 'E',
|
2329 | "\u0113": 'e',
|
2330 | "\u0115": 'e',
|
2331 | "\u0117": 'e',
|
2332 | "\u0119": 'e',
|
2333 | "\u011B": 'e',
|
2334 | "\u011C": 'G',
|
2335 | "\u011E": 'G',
|
2336 | "\u0120": 'G',
|
2337 | "\u0122": 'G',
|
2338 | "\u011D": 'g',
|
2339 | "\u011F": 'g',
|
2340 | "\u0121": 'g',
|
2341 | "\u0123": 'g',
|
2342 | "\u0124": 'H',
|
2343 | "\u0126": 'H',
|
2344 | "\u0125": 'h',
|
2345 | "\u0127": 'h',
|
2346 | "\u0128": 'I',
|
2347 | "\u012A": 'I',
|
2348 | "\u012C": 'I',
|
2349 | "\u012E": 'I',
|
2350 | "\u0130": 'I',
|
2351 | "\u0129": 'i',
|
2352 | "\u012B": 'i',
|
2353 | "\u012D": 'i',
|
2354 | "\u012F": 'i',
|
2355 | "\u0131": 'i',
|
2356 | "\u0134": 'J',
|
2357 | "\u0135": 'j',
|
2358 | "\u0136": 'K',
|
2359 | "\u0137": 'k',
|
2360 | "\u0138": 'k',
|
2361 | "\u0139": 'L',
|
2362 | "\u013B": 'L',
|
2363 | "\u013D": 'L',
|
2364 | "\u013F": 'L',
|
2365 | "\u0141": 'L',
|
2366 | "\u013A": 'l',
|
2367 | "\u013C": 'l',
|
2368 | "\u013E": 'l',
|
2369 | "\u0140": 'l',
|
2370 | "\u0142": 'l',
|
2371 | "\u0143": 'N',
|
2372 | "\u0145": 'N',
|
2373 | "\u0147": 'N',
|
2374 | "\u014A": 'N',
|
2375 | "\u0144": 'n',
|
2376 | "\u0146": 'n',
|
2377 | "\u0148": 'n',
|
2378 | "\u014B": 'n',
|
2379 | "\u014C": 'O',
|
2380 | "\u014E": 'O',
|
2381 | "\u0150": 'O',
|
2382 | "\u014D": 'o',
|
2383 | "\u014F": 'o',
|
2384 | "\u0151": 'o',
|
2385 | "\u0154": 'R',
|
2386 | "\u0156": 'R',
|
2387 | "\u0158": 'R',
|
2388 | "\u0155": 'r',
|
2389 | "\u0157": 'r',
|
2390 | "\u0159": 'r',
|
2391 | "\u015A": 'S',
|
2392 | "\u015C": 'S',
|
2393 | "\u015E": 'S',
|
2394 | "\u0160": 'S',
|
2395 | "\u015B": 's',
|
2396 | "\u015D": 's',
|
2397 | "\u015F": 's',
|
2398 | "\u0161": 's',
|
2399 | "\u0162": 'T',
|
2400 | "\u0164": 'T',
|
2401 | "\u0166": 'T',
|
2402 | "\u0163": 't',
|
2403 | "\u0165": 't',
|
2404 | "\u0167": 't',
|
2405 | "\u0168": 'U',
|
2406 | "\u016A": 'U',
|
2407 | "\u016C": 'U',
|
2408 | "\u016E": 'U',
|
2409 | "\u0170": 'U',
|
2410 | "\u0172": 'U',
|
2411 | "\u0169": 'u',
|
2412 | "\u016B": 'u',
|
2413 | "\u016D": 'u',
|
2414 | "\u016F": 'u',
|
2415 | "\u0171": 'u',
|
2416 | "\u0173": 'u',
|
2417 | "\u0174": 'W',
|
2418 | "\u0175": 'w',
|
2419 | "\u0176": 'Y',
|
2420 | "\u0177": 'y',
|
2421 | "\u0178": 'Y',
|
2422 | "\u0179": 'Z',
|
2423 | "\u017B": 'Z',
|
2424 | "\u017D": 'Z',
|
2425 | "\u017A": 'z',
|
2426 | "\u017C": 'z',
|
2427 | "\u017E": 'z',
|
2428 | "\u0132": 'IJ',
|
2429 | "\u0133": 'ij',
|
2430 | "\u0152": 'Oe',
|
2431 | "\u0153": 'oe',
|
2432 | "\u0149": "'n",
|
2433 | "\u017F": 's'
|
2434 | };
|
2435 |
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 | var deburrLetter = _basePropertyOf(deburredLetters);
|
2445 | var _deburrLetter = deburrLetter;
|
2446 |
|
2447 |
|
2448 |
|
2449 | var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
2450 |
|
2451 |
|
2452 | var rsComboMarksRange$2 = "\\u0300-\\u036f",
|
2453 | reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f",
|
2454 | rsComboSymbolsRange$2 = "\\u20d0-\\u20ff",
|
2455 | rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
|
2456 |
|
2457 |
|
2458 | var rsCombo$1 = '[' + rsComboRange$2 + ']';
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 | var reComboMark = RegExp(rsCombo$1, 'g');
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 | function deburr(string) {
|
2485 | string = toString_1(string);
|
2486 | return string && string.replace(reLatin, _deburrLetter).replace(reComboMark, '');
|
2487 | }
|
2488 |
|
2489 | var deburr_1 = deburr;
|
2490 |
|
2491 |
|
2492 | var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 | function asciiWords(string) {
|
2502 | return string.match(reAsciiWord) || [];
|
2503 | }
|
2504 |
|
2505 | var _asciiWords = asciiWords;
|
2506 |
|
2507 |
|
2508 | var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
2509 |
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 | function hasUnicodeWord(string) {
|
2518 | return reHasUnicodeWord.test(string);
|
2519 | }
|
2520 |
|
2521 | var _hasUnicodeWord = hasUnicodeWord;
|
2522 |
|
2523 |
|
2524 | var rsAstralRange$2 = "\\ud800-\\udfff",
|
2525 | rsComboMarksRange$3 = "\\u0300-\\u036f",
|
2526 | reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f",
|
2527 | rsComboSymbolsRange$3 = "\\u20d0-\\u20ff",
|
2528 | rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3,
|
2529 | rsDingbatRange = "\\u2700-\\u27bf",
|
2530 | rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
2531 | rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
2532 | rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
2533 | rsPunctuationRange = "\\u2000-\\u206f",
|
2534 | rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",
|
2535 | rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
2536 | rsVarRange$2 = "\\ufe0e\\ufe0f",
|
2537 | rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
2538 |
|
2539 |
|
2540 | var rsApos = "['\u2019]",
|
2541 | rsBreak = '[' + rsBreakRange + ']',
|
2542 | rsCombo$2 = '[' + rsComboRange$3 + ']',
|
2543 | rsDigits = '\\d+',
|
2544 | rsDingbat = '[' + rsDingbatRange + ']',
|
2545 | rsLower = '[' + rsLowerRange + ']',
|
2546 | rsMisc = '[^' + rsAstralRange$2 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
2547 | rsFitz$1 = "\\ud83c[\\udffb-\\udfff]",
|
2548 | rsModifier$1 = '(?:' + rsCombo$2 + '|' + rsFitz$1 + ')',
|
2549 | rsNonAstral$1 = '[^' + rsAstralRange$2 + ']',
|
2550 | rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}",
|
2551 | rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]",
|
2552 | rsUpper = '[' + rsUpperRange + ']',
|
2553 | rsZWJ$2 = "\\u200d";
|
2554 |
|
2555 |
|
2556 | var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
|
2557 | rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
|
2558 | rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
2559 | rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
2560 | reOptMod$1 = rsModifier$1 + '?',
|
2561 | rsOptVar$1 = '[' + rsVarRange$2 + ']?',
|
2562 | rsOptJoin$1 = '(?:' + rsZWJ$2 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
|
2563 | rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
|
2564 | rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
|
2565 | rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
|
2566 | rsEmoji = '(?:' + [rsDingbat, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsSeq$1;
|
2567 |
|
2568 |
|
2569 | var reUnicodeWord = RegExp([rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji].join('|'), 'g');
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 | function unicodeWords(string) {
|
2579 | return string.match(reUnicodeWord) || [];
|
2580 | }
|
2581 |
|
2582 | var _unicodeWords = unicodeWords;
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 | function words(string, pattern, guard) {
|
2605 | string = toString_1(string);
|
2606 | pattern = guard ? undefined : pattern;
|
2607 |
|
2608 | if (pattern === undefined) {
|
2609 | return _hasUnicodeWord(string) ? _unicodeWords(string) : _asciiWords(string);
|
2610 | }
|
2611 |
|
2612 | return string.match(pattern) || [];
|
2613 | }
|
2614 |
|
2615 | var words_1 = words;
|
2616 |
|
2617 |
|
2618 |
|
2619 | var rsApos$1 = "['\u2019]";
|
2620 |
|
2621 |
|
2622 | var reApos = RegExp(rsApos$1, 'g');
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 | function createCompounder(callback) {
|
2632 | return function (string) {
|
2633 | return _arrayReduce(words_1(deburr_1(string).replace(reApos, '')), callback, '');
|
2634 | };
|
2635 | }
|
2636 |
|
2637 | var _createCompounder = createCompounder;
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 |
|
2656 |
|
2657 |
|
2658 |
|
2659 |
|
2660 | var camelCase = _createCompounder(function (result, word, index) {
|
2661 | word = word.toLowerCase();
|
2662 | return result + (index ? capitalize_1(word) : word);
|
2663 | });
|
2664 | var camelCase_1 = camelCase;
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 | function overArg(func, transform) {
|
2675 | return function (arg) {
|
2676 | return func(transform(arg));
|
2677 | };
|
2678 | }
|
2679 |
|
2680 | var _overArg = overArg;
|
2681 |
|
2682 |
|
2683 |
|
2684 | var getPrototype = _overArg(Object.getPrototypeOf, Object);
|
2685 | var _getPrototype = getPrototype;
|
2686 |
|
2687 |
|
2688 |
|
2689 | var objectTag = '[object Object]';
|
2690 |
|
2691 |
|
2692 | var funcProto = Function.prototype,
|
2693 | objectProto$2 = Object.prototype;
|
2694 |
|
2695 |
|
2696 | var funcToString = funcProto.toString;
|
2697 |
|
2698 |
|
2699 | var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
2700 |
|
2701 |
|
2702 | var objectCtorString = funcToString.call(Object);
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 | function isPlainObject(value) {
|
2733 | if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
|
2734 | return false;
|
2735 | }
|
2736 |
|
2737 | var proto = _getPrototype(value);
|
2738 |
|
2739 | if (proto === null) {
|
2740 | return true;
|
2741 | }
|
2742 |
|
2743 | var Ctor = hasOwnProperty$2.call(proto, 'constructor') && proto.constructor;
|
2744 | return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
2745 | }
|
2746 |
|
2747 | var isPlainObject_1 = isPlainObject;
|
2748 |
|
2749 | function addLeadingSlash$1(str) {
|
2750 | return str[0] === '/' ? str : "/".concat(str);
|
2751 | }
|
2752 | function isEmptyObject(obj) {
|
2753 | if (!obj || !isPlainObject_1(obj)) {
|
2754 | return false;
|
2755 | }
|
2756 |
|
2757 | for (var n in obj) {
|
2758 | if (obj.hasOwnProperty(n)) {
|
2759 | return false;
|
2760 | }
|
2761 | }
|
2762 |
|
2763 | return true;
|
2764 | }
|
2765 | function isUndefined(o) {
|
2766 | return o === undefined;
|
2767 | }
|
2768 | function isFunction(arg) {
|
2769 | return typeof arg === 'function';
|
2770 | }
|
2771 | function isArray$1(arg) {
|
2772 | return Array.isArray(arg);
|
2773 | }
|
2774 | function shakeFnFromObject(obj) {
|
2775 | var newObj;
|
2776 |
|
2777 | if (isArray$1(obj)) {
|
2778 | newObj = [];
|
2779 | var len = obj.length;
|
2780 |
|
2781 | for (var i = 0; i < len; i++) {
|
2782 | newObj.push(shakeFnFromObject(obj[i]));
|
2783 | }
|
2784 | } else if (isPlainObject_1(obj)) {
|
2785 | newObj = {};
|
2786 |
|
2787 | for (var key in obj) {
|
2788 | if (isFunction(obj[key])) {
|
2789 | continue;
|
2790 | }
|
2791 |
|
2792 | var ret = shakeFnFromObject(obj[key]);
|
2793 | newObj[key] = ret;
|
2794 | }
|
2795 | } else {
|
2796 | return obj;
|
2797 | }
|
2798 |
|
2799 | return newObj;
|
2800 | }
|
2801 |
|
2802 | var _loadTime = new Date().getTime().toString();
|
2803 |
|
2804 | var _i = 1;
|
2805 | function getUniqueKey() {
|
2806 | return _loadTime + _i++;
|
2807 | }
|
2808 | var id$1 = 0;
|
2809 |
|
2810 | function genId() {
|
2811 | return String(id$1++);
|
2812 | }
|
2813 |
|
2814 | var compIdsMapper;
|
2815 |
|
2816 | try {
|
2817 | compIdsMapper = new Map();
|
2818 | } catch (error) {
|
2819 | compIdsMapper = new SimpleMap();
|
2820 | }
|
2821 |
|
2822 | function genCompid(key, isNeedCreate) {
|
2823 | if (!taro.Current || !taro.Current.current || !taro.Current.current.$scope) return [];
|
2824 | var prevId = compIdsMapper.get(key);
|
2825 |
|
2826 | if (isNeedCreate) {
|
2827 | var _id = genId();
|
2828 |
|
2829 | compIdsMapper.set(key, _id);
|
2830 | return [prevId, _id];
|
2831 | } else {
|
2832 | var _id2 = prevId || genId();
|
2833 |
|
2834 | !prevId && compIdsMapper.set(key, _id2);
|
2835 | return [null, _id2];
|
2836 | }
|
2837 | }
|
2838 | var prefix = 0;
|
2839 | function genCompPrefix() {
|
2840 | return String(prefix++);
|
2841 | }
|
2842 |
|
2843 | var appGlobal = global || {};
|
2844 | var globalRef = Object.getPrototypeOf(appGlobal) || appGlobal;
|
2845 |
|
2846 | globalRef.cacheData = globalRef.cacheData || {};
|
2847 | function cacheDataSet(key, val) {
|
2848 | globalRef.cacheData[key] = val;
|
2849 | }
|
2850 | function cacheDataGet(key, delelteAfterGet) {
|
2851 | var temp = globalRef.cacheData[key];
|
2852 | delelteAfterGet && delete globalRef.cacheData[key];
|
2853 | return temp;
|
2854 | }
|
2855 | function cacheDataHas(key) {
|
2856 | return key in globalRef.cacheData;
|
2857 | }
|
2858 |
|
2859 | var Manager = function () {
|
2860 | function Manager() {
|
2861 | _classCallCheck(this, Manager);
|
2862 |
|
2863 | _defineProperty(this, "map", {});
|
2864 |
|
2865 | _defineProperty(this, "observers", {});
|
2866 | }
|
2867 |
|
2868 | _createClass(Manager, [{
|
2869 | key: "set",
|
2870 | value: function set() {
|
2871 | var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
2872 | var compid = arguments.length > 1 ? arguments[1] : undefined;
|
2873 | var previd = arguments.length > 2 ? arguments[2] : undefined;
|
2874 | if (!compid) return;
|
2875 |
|
2876 | if (previd) {
|
2877 | this.observers[compid] = this.observers[previd];
|
2878 | this["delete"](previd);
|
2879 | }
|
2880 |
|
2881 | var observers = this.observers;
|
2882 |
|
2883 | if (!this.map[compid]) {
|
2884 | Object.defineProperty(this.map, compid, {
|
2885 | configurable: true,
|
2886 | get: function get() {
|
2887 | return this["__".concat(compid)];
|
2888 | },
|
2889 | set: function set(props) {
|
2890 | this["__".concat(compid)] = props;
|
2891 | var component = observers[compid] && observers[compid].component;
|
2892 | var ComponentClass = observers[compid] && observers[compid].ComponentClass;
|
2893 | if (!component || !ComponentClass || !component.__isReady) return;
|
2894 | var nextProps = filterProps(ComponentClass.defaultProps, props, component.props);
|
2895 | component.props = nextProps;
|
2896 | nextTick(function () {
|
2897 | component._unsafeCallUpdate = true;
|
2898 | updateComponent(component);
|
2899 | component._unsafeCallUpdate = false;
|
2900 | });
|
2901 | }
|
2902 | });
|
2903 | }
|
2904 |
|
2905 | this.map[compid] = props;
|
2906 | }
|
2907 | }, {
|
2908 | key: "delete",
|
2909 | value: function _delete(compid) {
|
2910 | delete this.map[compid];
|
2911 | delete this.map["__".concat(compid)];
|
2912 | delete this.observers[compid];
|
2913 | }
|
2914 | }]);
|
2915 |
|
2916 | return Manager;
|
2917 | }();
|
2918 |
|
2919 | var propsManager = new Manager();
|
2920 |
|
2921 | var anonymousFnNamePreffix = 'funPrivate';
|
2922 | var routerParamsPrivateKey = '__key_';
|
2923 | var preloadPrivateKey = 'quick$PriPreload';
|
2924 | var PRELOAD_DATA_KEY = 'preload';
|
2925 | var COMP_ID = 'compid';
|
2926 | var preloadInitedComponent = 'quick$PriPreloadComponent';
|
2927 | var pageExtraFns = ['onBackPress', 'onMenuPress', 'onRefresh'];
|
2928 |
|
2929 | function bindProperties(componentConf, ComponentClass, isPage) {
|
2930 | componentConf.properties = ComponentClass.properties || {};
|
2931 | var defaultProps = ComponentClass.defaultProps || {};
|
2932 |
|
2933 | for (var key in defaultProps) {
|
2934 | if (defaultProps.hasOwnProperty(key)) {
|
2935 | componentConf.properties[key] = {
|
2936 | type: null,
|
2937 | value: defaultProps[key]
|
2938 | };
|
2939 | }
|
2940 | }
|
2941 |
|
2942 | if (isPage) {
|
2943 | componentConf.properties[routerParamsPrivateKey] = {
|
2944 | type: null,
|
2945 | value: null
|
2946 | };
|
2947 | componentConf.properties[preloadPrivateKey] = {
|
2948 | type: null,
|
2949 | value: null
|
2950 | };
|
2951 | var defaultParams = ComponentClass.defaultParams || {};
|
2952 |
|
2953 | for (var _key in defaultParams) {
|
2954 | if (defaultParams.hasOwnProperty(_key)) {
|
2955 | componentConf.properties[_key] = {
|
2956 | type: null,
|
2957 | value: null
|
2958 | };
|
2959 | }
|
2960 | }
|
2961 | }
|
2962 |
|
2963 | componentConf.props = [];
|
2964 | Object.keys(componentConf.properties).forEach(function (item) {
|
2965 | componentConf.props.push(item.toLocaleLowerCase());
|
2966 | });
|
2967 | componentConf.props.push(COMP_ID);
|
2968 |
|
2969 | componentConf.onCompidChange = function () {
|
2970 | initComponent.apply(this, [ComponentClass, isPage]);
|
2971 | };
|
2972 | }
|
2973 |
|
2974 | function filterProps() {
|
2975 | var defaultProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
2976 | var propsFromPropsManager = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2977 | var curAllProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
2978 | var extraProps = arguments.length > 3 ? arguments[3] : undefined;
|
2979 | var newProps = Object.assign({}, curAllProps, propsFromPropsManager);
|
2980 |
|
2981 | if (!isEmptyObject(defaultProps)) {
|
2982 | for (var propName in defaultProps) {
|
2983 | if (newProps[propName] === undefined) {
|
2984 | newProps[propName] = defaultProps[propName];
|
2985 | }
|
2986 | }
|
2987 | }
|
2988 |
|
2989 | if (extraProps) {
|
2990 | newProps = Object.assign({}, newProps, extraProps);
|
2991 | }
|
2992 |
|
2993 | Object.keys(newProps).forEach(function (propName) {
|
2994 | var camelizePropName = camelCase_1(propName);
|
2995 |
|
2996 | if (camelizePropName !== propName) {
|
2997 | Object.defineProperty(newProps, camelizePropName, {
|
2998 | get: function get() {
|
2999 | return newProps[propName];
|
3000 | }
|
3001 | });
|
3002 | }
|
3003 | });
|
3004 | return newProps;
|
3005 | }
|
3006 |
|
3007 | function processEvent(eventHandlerName, obj) {
|
3008 | if (obj[eventHandlerName]) return;
|
3009 |
|
3010 | obj[eventHandlerName] = function (event) {
|
3011 | if (event) {
|
3012 | var _currentTarget = event.currentTarget;
|
3013 | var target = event.target;
|
3014 | Object.defineProperties(event, {
|
3015 | target: {
|
3016 | configurable: true,
|
3017 | get: function get() {
|
3018 | return Object.assign(target || {}, event.detail);
|
3019 | }
|
3020 | },
|
3021 | currentTarget: {
|
3022 | configurable: true,
|
3023 | get: function get() {
|
3024 | return Object.assign(_currentTarget || target || {}, event.detail);
|
3025 | },
|
3026 | set: function set(target) {
|
3027 | _currentTarget = target;
|
3028 | }
|
3029 | }
|
3030 | });
|
3031 |
|
3032 | if (!event.stopPropagation) {
|
3033 | Object.defineProperty(event, 'stopPropagation', {
|
3034 | value: function value() {}
|
3035 | });
|
3036 | }
|
3037 |
|
3038 | if (!event.preventDefault) {
|
3039 | Object.defineProperty(event, 'preventDefault', {
|
3040 | value: function value() {}
|
3041 | });
|
3042 | }
|
3043 | }
|
3044 |
|
3045 | var scope = this.$component;
|
3046 | var callScope = scope;
|
3047 | var isAnonymousFn = eventHandlerName.indexOf(anonymousFnNamePreffix) > -1;
|
3048 | var realArgs = [];
|
3049 | var detailArgs = [];
|
3050 | var datasetArgs = [];
|
3051 | var isScopeBinded = false;
|
3052 |
|
3053 | var dataset = {};
|
3054 | var currentTarget = event.currentTarget;
|
3055 | var vm = currentTarget._vm || (currentTarget._target ? currentTarget._target._vm : null);
|
3056 | var attr = vm ? vm._externalBinding.template.attr : currentTarget._attr || currentTarget.attr;
|
3057 |
|
3058 | if (attr) {
|
3059 | Object.keys(attr).forEach(function (key) {
|
3060 | if (/^data/.test(key)) {
|
3061 | var item = attr[key];
|
3062 | dataset[key.replace(/^data/, '')] = typeof item === 'function' ? item() : item;
|
3063 | }
|
3064 | });
|
3065 | }
|
3066 |
|
3067 | var bindArgs = {};
|
3068 | var eventType = "on".concat(event.type).toLocaleLowerCase();
|
3069 | if (event.detail && event.detail.__detail) Object.assign(dataset, event.detail.__detail);
|
3070 | Object.keys(dataset).forEach(function (key) {
|
3071 | var keyLower = key.toLocaleLowerCase();
|
3072 |
|
3073 | if (/^e/.test(keyLower)) {
|
3074 |
|
3075 | keyLower = keyLower.replace(/^e/, '');
|
3076 |
|
3077 | if (keyLower.indexOf(eventType) >= 0) {
|
3078 | var argName = keyLower.replace(eventType, '');
|
3079 |
|
3080 | if (/^(a[a-z]|so)$/.test(argName)) {
|
3081 | bindArgs[argName] = dataset[key];
|
3082 | }
|
3083 | }
|
3084 | }
|
3085 | });
|
3086 |
|
3087 | if (event.detail && event.detail.__arguments && event.detail.__arguments.length > 0) {
|
3088 | detailArgs = event.detail.__arguments;
|
3089 | }
|
3090 |
|
3091 |
|
3092 | if (!isAnonymousFn) {
|
3093 | if ('so' in bindArgs) {
|
3094 | if (bindArgs['so'] !== 'this') {
|
3095 | callScope = bindArgs['so'];
|
3096 | }
|
3097 |
|
3098 | isScopeBinded = true;
|
3099 | delete bindArgs['so'];
|
3100 | }
|
3101 |
|
3102 | if (detailArgs.length > 0) {
|
3103 | !isScopeBinded && detailArgs[0] && (callScope = detailArgs[0]);
|
3104 | detailArgs.shift();
|
3105 | }
|
3106 |
|
3107 | if (!isEmptyObject(bindArgs)) {
|
3108 | datasetArgs = Object.keys(bindArgs).sort().map(function (key) {
|
3109 | return bindArgs[key];
|
3110 | });
|
3111 | }
|
3112 |
|
3113 | realArgs = [].concat(_toConsumableArray(datasetArgs), _toConsumableArray(detailArgs), [event]);
|
3114 | } else {
|
3115 |
|
3116 | var _scope = null;
|
3117 |
|
3118 | if ('so' in bindArgs) {
|
3119 | if (bindArgs['so'] !== 'this') {
|
3120 | _scope = bindArgs['so'];
|
3121 | }
|
3122 |
|
3123 | isScopeBinded = true;
|
3124 | delete bindArgs['so'];
|
3125 | }
|
3126 |
|
3127 | if (detailArgs.length > 0) {
|
3128 | !isScopeBinded && detailArgs[0] && (callScope = detailArgs[0]);
|
3129 | detailArgs.shift();
|
3130 | }
|
3131 |
|
3132 | if (!isEmptyObject(bindArgs)) {
|
3133 | datasetArgs = Object.keys(bindArgs).sort().map(function (key) {
|
3134 | return bindArgs[key];
|
3135 | });
|
3136 | }
|
3137 |
|
3138 | realArgs = [_scope].concat(_toConsumableArray(datasetArgs), _toConsumableArray(detailArgs), [event]);
|
3139 | }
|
3140 |
|
3141 | return scope[eventHandlerName].apply(callScope, realArgs);
|
3142 | };
|
3143 | }
|
3144 |
|
3145 | function bindEvents(componentConf, events) {
|
3146 | events.forEach(function (name) {
|
3147 | processEvent(name, componentConf);
|
3148 | });
|
3149 | }
|
3150 |
|
3151 | function bindStaticFns(componentConf, ComponentClass) {
|
3152 | for (var key in ComponentClass) {
|
3153 | typeof ComponentClass[key] === 'function' && (componentConf[key] = ComponentClass[key]);
|
3154 | }
|
3155 |
|
3156 |
|
3157 | Object.getOwnPropertyNames(ComponentClass).forEach(function (key) {
|
3158 | var excludes = ['arguments', 'caller', 'length', 'name', 'prototype'];
|
3159 |
|
3160 | if (excludes.indexOf(key) < 0) {
|
3161 | typeof ComponentClass[key] === 'function' && (componentConf[key] = ComponentClass[key]);
|
3162 | }
|
3163 | });
|
3164 | }
|
3165 |
|
3166 | function getPageUrlParams(url) {
|
3167 | var taroRouterParamsCache = globalRef.taroRouterParamsCache;
|
3168 | var params = {};
|
3169 |
|
3170 | if (taroRouterParamsCache && url) {
|
3171 | url = addLeadingSlash$1(url);
|
3172 | params = taroRouterParamsCache[url] || {};
|
3173 | delete taroRouterParamsCache[url];
|
3174 | }
|
3175 |
|
3176 | return params;
|
3177 | }
|
3178 |
|
3179 | var hasPageInited = false;
|
3180 |
|
3181 | function initComponent(ComponentClass, isPage) {
|
3182 | if (!this.$component || this.$component.__isReady) return;
|
3183 | this.$component.__isReady = true;
|
3184 |
|
3185 | if (isPage && !hasPageInited) {
|
3186 | hasPageInited = true;
|
3187 | }
|
3188 |
|
3189 | if (hasPageInited && !isPage) {
|
3190 | var compid = this.compid;
|
3191 |
|
3192 | if (compid) {
|
3193 | propsManager.observers[compid] = {
|
3194 | component: this.$component,
|
3195 | ComponentClass: ComponentClass
|
3196 | };
|
3197 | }
|
3198 |
|
3199 | var nextProps = filterProps(ComponentClass.defaultProps, propsManager.map[compid], this.$component.props);
|
3200 | this.$component.props = nextProps;
|
3201 | }
|
3202 |
|
3203 | if (hasPageInited || isPage) {
|
3204 | mountComponent(this.$component);
|
3205 | }
|
3206 | }
|
3207 |
|
3208 | function componentTrigger(component, key, args) {
|
3209 | args = args || [];
|
3210 |
|
3211 | if (key === 'componentDidMount') {
|
3212 | if (component['$$hasLoopRef']) {
|
3213 | taro.Current.current = component;
|
3214 | taro.Current.index = 0;
|
3215 | component._disableEffect = true;
|
3216 |
|
3217 | component._createData(component.state, component.props, true);
|
3218 |
|
3219 | component._disableEffect = false;
|
3220 | taro.Current.current = null;
|
3221 | }
|
3222 | }
|
3223 |
|
3224 | if (key === 'componentWillUnmount') {
|
3225 | var compid = component.$scope.compid;
|
3226 | if (compid) propsManager["delete"](compid);
|
3227 | }
|
3228 |
|
3229 | component[key] && typeof component[key] === 'function' && component[key].apply(component, _toConsumableArray(args));
|
3230 |
|
3231 | if (key === 'componentWillMount') {
|
3232 | component._dirty = false;
|
3233 | component._disable = false;
|
3234 | component.state = component.getState();
|
3235 | }
|
3236 |
|
3237 | if (key === 'componentWillUnmount') {
|
3238 | component._dirty = true;
|
3239 | component._disable = true;
|
3240 | component.$router = {
|
3241 | params: {},
|
3242 | path: ''
|
3243 | };
|
3244 | component._pendingStates = [];
|
3245 | component._pendingCallbacks = [];
|
3246 | }
|
3247 | }
|
3248 | function createComponent(ComponentClass, isPage) {
|
3249 | var initData = {
|
3250 | priTaroCompReady: false
|
3251 | };
|
3252 | var componentProps = filterProps(ComponentClass.defaultProps);
|
3253 | var componentInstance = new ComponentClass(componentProps);
|
3254 | componentInstance._constructor && componentInstance._constructor(componentProps);
|
3255 |
|
3256 | try {
|
3257 | taro.Current.current = componentInstance;
|
3258 | taro.Current.index = 0;
|
3259 | componentInstance.state = componentInstance._createData() || componentInstance.state;
|
3260 | } catch (err) {
|
3261 | if (isPage) {
|
3262 | console.warn("[Taro warn] \u8BF7\u7ED9\u9875\u9762\u63D0\u4F9B\u521D\u59CB `state` \u4EE5\u63D0\u9AD8\u521D\u6B21\u6E32\u67D3\u6027\u80FD\uFF01");
|
3263 | } else {
|
3264 | console.warn("[Taro warn] \u8BF7\u7ED9\u7EC4\u4EF6\u63D0\u4F9B\u4E00\u4E2A `defaultProps` \u4EE5\u63D0\u9AD8\u521D\u6B21\u6E32\u67D3\u6027\u80FD\uFF01");
|
3265 | }
|
3266 |
|
3267 | console.warn(err);
|
3268 | }
|
3269 |
|
3270 | initData = Object.assign({}, initData, componentInstance.props, componentInstance.state);
|
3271 | var componentConf = {
|
3272 | data: initData,
|
3273 | onInit: function onInit() {
|
3274 | isPage && (hasPageInited = false);
|
3275 |
|
3276 | if (isPage && cacheDataHas(preloadInitedComponent)) {
|
3277 | this.$component = cacheDataGet(preloadInitedComponent, true);
|
3278 | } else {
|
3279 | this.$component = new ComponentClass({}, isPage);
|
3280 | }
|
3281 |
|
3282 | this.$component._init(this);
|
3283 |
|
3284 | this.$component.render = this.$component._createData;
|
3285 | this.$component.__propTypes = ComponentClass.propTypes;
|
3286 |
|
3287 | if (isPage) {
|
3288 | this.$component.$componentType = 'PAGE';
|
3289 |
|
3290 | if (cacheDataHas(PRELOAD_DATA_KEY)) {
|
3291 | var data = cacheDataGet(PRELOAD_DATA_KEY, true);
|
3292 | this.$component.$router.preload = data;
|
3293 | }
|
3294 |
|
3295 | var options = getPageUrlParams(isPage);
|
3296 | Object.assign(this.$component.$router.params, options);
|
3297 | this.$app.pageInstaceMap = this.$app.pageInstaceMap || {};
|
3298 | this.$app.pageInstaceMap[isPage] = this.$component;
|
3299 |
|
3300 | if (cacheDataHas(options[preloadPrivateKey])) {
|
3301 | this.$component.$preloadData = cacheDataGet(options[preloadPrivateKey], true);
|
3302 | } else {
|
3303 | this.$component.$preloadData = {};
|
3304 | }
|
3305 |
|
3306 |
|
3307 | initComponent.apply(this, [ComponentClass, isPage]);
|
3308 | }
|
3309 |
|
3310 |
|
3311 | this.$watch(COMP_ID, 'onCompidChange');
|
3312 | },
|
3313 | onReady: function onReady() {
|
3314 | if (!isPage) {
|
3315 | initComponent.apply(this, [ComponentClass, isPage]);
|
3316 | }
|
3317 |
|
3318 | var component = this.$component;
|
3319 |
|
3320 | if (!component.__mounted) {
|
3321 | component.__mounted = true;
|
3322 | componentTrigger(component, 'componentDidMount');
|
3323 | }
|
3324 | },
|
3325 | onDestroy: function onDestroy() {
|
3326 | componentTrigger(this.$component, 'componentWillUnmount');
|
3327 | var component = this.$component;
|
3328 | component.hooks.forEach(function (hook) {
|
3329 | if (isFunction(hook.cleanup)) {
|
3330 | hook.cleanup();
|
3331 | }
|
3332 | });
|
3333 | var events = component.$$renderPropsEvents;
|
3334 |
|
3335 | if (isArray$1(events)) {
|
3336 | events.forEach(function (e) {
|
3337 | return taro.eventCenter.off(e);
|
3338 | });
|
3339 | }
|
3340 | }
|
3341 | };
|
3342 |
|
3343 | if (isPage) {
|
3344 | componentConf['onShow'] = function () {
|
3345 | componentTrigger(this.$component, 'componentDidShow');
|
3346 | };
|
3347 |
|
3348 | componentConf['onHide'] = function () {
|
3349 | componentTrigger(this.$component, 'componentDidHide');
|
3350 | };
|
3351 |
|
3352 | pageExtraFns.forEach(function (fn) {
|
3353 | if (componentInstance[fn] && typeof componentInstance[fn] === 'function') {
|
3354 | componentConf[fn] = function () {
|
3355 | var component = this.$component;
|
3356 |
|
3357 | if (component[fn] && typeof component[fn] === 'function') {
|
3358 | return component[fn].apply(component, arguments);
|
3359 | }
|
3360 | };
|
3361 | }
|
3362 | });
|
3363 | globalRef.componentPath = isPage;
|
3364 | addLeadingSlash$1(isPage) && cacheDataSet(addLeadingSlash$1(isPage), ComponentClass);
|
3365 | }
|
3366 |
|
3367 | bindStaticFns(componentConf, ComponentClass);
|
3368 | bindProperties(componentConf, ComponentClass, isPage);
|
3369 | ComponentClass['privateTaroEvent'] && bindEvents(componentConf, ComponentClass['privateTaroEvent']);
|
3370 | return componentConf;
|
3371 | }
|
3372 |
|
3373 | var isDEV = typeof process === 'undefined' || !process.env || process.env.NODE_ENV !== 'production';
|
3374 |
|
3375 | function hasNewLifecycle(component) {
|
3376 | var getDerivedStateFromProps = component.constructor.getDerivedStateFromProps,
|
3377 | getSnapshotBeforeUpdate = component.getSnapshotBeforeUpdate;
|
3378 | return isFunction(getDerivedStateFromProps) || isFunction(getSnapshotBeforeUpdate);
|
3379 | }
|
3380 |
|
3381 | function callGetDerivedStateFromProps(component, props, state) {
|
3382 | var getDerivedStateFromProps = component.constructor.getDerivedStateFromProps;
|
3383 | var newState;
|
3384 |
|
3385 | if (isFunction(getDerivedStateFromProps)) {
|
3386 | var partialState = getDerivedStateFromProps(props, state);
|
3387 |
|
3388 | if (!isUndefined(partialState)) {
|
3389 | newState = Object.assign({}, state, partialState);
|
3390 | } else {
|
3391 | console.warn('getDerivedStateFromProps 没有返回任何内容,这个生命周期必须返回 null 或一个新对象。');
|
3392 | }
|
3393 | }
|
3394 |
|
3395 | return newState;
|
3396 | }
|
3397 |
|
3398 | function callGetSnapshotBeforeUpdate(component, props, state) {
|
3399 | var getSnapshotBeforeUpdate = component.getSnapshotBeforeUpdate;
|
3400 | var snapshot;
|
3401 |
|
3402 | if (isFunction(getSnapshotBeforeUpdate)) {
|
3403 | snapshot = getSnapshotBeforeUpdate.call(component, props, state);
|
3404 | }
|
3405 |
|
3406 | return snapshot;
|
3407 | }
|
3408 |
|
3409 | function mountComponent(component) {
|
3410 | var props = component.props;
|
3411 |
|
3412 | if (!component.__componentWillMountTriggered) {
|
3413 | component._constructor && component._constructor(props);
|
3414 | }
|
3415 |
|
3416 | var newState = callGetDerivedStateFromProps(component, props, component.state);
|
3417 |
|
3418 | if (!isUndefined(newState)) {
|
3419 | component.state = newState;
|
3420 | }
|
3421 |
|
3422 | component._dirty = false;
|
3423 | component._disable = false;
|
3424 | component._isForceUpdate = false;
|
3425 |
|
3426 | if (!component.__componentWillMountTriggered) {
|
3427 | component.__componentWillMountTriggered = true;
|
3428 |
|
3429 | if (!hasNewLifecycle(component)) {
|
3430 | componentTrigger(component, 'componentWillMount');
|
3431 | }
|
3432 | }
|
3433 |
|
3434 | doUpdate(component, props, component.state);
|
3435 | component.prevProps = component.props;
|
3436 | component.prevState = component.state;
|
3437 | }
|
3438 | function updateComponent(component) {
|
3439 | var props = component.props,
|
3440 | __propTypes = component.__propTypes;
|
3441 |
|
3442 | if (isDEV && __propTypes) {
|
3443 | var componentName = component.constructor.name;
|
3444 |
|
3445 | if (isUndefined(componentName)) {
|
3446 | var names = component.constructor.toString().match(/^function\s*([^\s(]+)/);
|
3447 | componentName = isArray$1(names) ? names[0] : 'Component';
|
3448 | }
|
3449 |
|
3450 | propTypes.checkPropTypes(__propTypes, props, 'prop', componentName);
|
3451 | }
|
3452 |
|
3453 | var prevProps = component.prevProps || props;
|
3454 | component.props = prevProps;
|
3455 |
|
3456 | if (component.__mounted && component._unsafeCallUpdate === true && !hasNewLifecycle(component) && component.componentWillReceiveProps) {
|
3457 | component._disable = true;
|
3458 | component.componentWillReceiveProps(props);
|
3459 | component._disable = false;
|
3460 | }
|
3461 |
|
3462 |
|
3463 | var state = component.getState();
|
3464 | var prevState = component.prevState || state;
|
3465 | var stateFromProps = callGetDerivedStateFromProps(component, props, state);
|
3466 |
|
3467 | if (!isUndefined(stateFromProps)) {
|
3468 | state = stateFromProps;
|
3469 | }
|
3470 |
|
3471 | var skip = false;
|
3472 |
|
3473 | if (component.__mounted) {
|
3474 | if (isFunction(component.shouldComponentUpdate) && !component._isForceUpdate && component.shouldComponentUpdate(props, state) === false) {
|
3475 | skip = true;
|
3476 | } else if (!hasNewLifecycle(component) && isFunction(component.componentWillUpdate)) {
|
3477 | component.componentWillUpdate(props, state);
|
3478 | }
|
3479 | }
|
3480 |
|
3481 | component.props = props;
|
3482 | component.state = state;
|
3483 | component._dirty = false;
|
3484 | component._isForceUpdate = false;
|
3485 |
|
3486 | if (!skip) {
|
3487 | doUpdate(component, prevProps, prevState);
|
3488 | }
|
3489 |
|
3490 | component.prevProps = component.props;
|
3491 | component.prevState = component.state;
|
3492 | }
|
3493 |
|
3494 | function injectContextType(component) {
|
3495 | var ctxType = component.constructor.contextType;
|
3496 |
|
3497 | if (ctxType) {
|
3498 | var context = ctxType.context;
|
3499 | var emitter = context.emitter;
|
3500 |
|
3501 | if (emitter === null) {
|
3502 | component.context = context._defaultValue;
|
3503 | return;
|
3504 | }
|
3505 |
|
3506 | if (!component._hasContext) {
|
3507 | component._hasContext = true;
|
3508 | emitter.on(function (_) {
|
3509 | return enqueueRender(component);
|
3510 | });
|
3511 | }
|
3512 |
|
3513 | component.context = emitter.value;
|
3514 | }
|
3515 | }
|
3516 |
|
3517 | function doUpdate(component, prevProps, prevState) {
|
3518 | var state = component.state,
|
3519 | _component$props = component.props,
|
3520 | props = _component$props === void 0 ? {} : _component$props;
|
3521 | var data = state || {};
|
3522 |
|
3523 | if (component._createData) {
|
3524 |
|
3525 | if (component.__isReady) {
|
3526 | injectContextType(component);
|
3527 | taro.Current.current = component;
|
3528 | taro.Current.index = 0;
|
3529 | taro.invokeEffects(component, true);
|
3530 | }
|
3531 |
|
3532 | data = component._createData(state, props) || data;
|
3533 |
|
3534 | if (component.__isReady) {
|
3535 | taro.Current.current = null;
|
3536 | }
|
3537 | }
|
3538 |
|
3539 | data = Object.assign({}, props, data);
|
3540 |
|
3541 | if (component.$usedState && component.$usedState.length) {
|
3542 | var _data = {};
|
3543 | component.$usedState.forEach(function (key) {
|
3544 | var val = taro.internal_safe_get(data, key);
|
3545 |
|
3546 | if (typeof val === 'undefined') {
|
3547 | return;
|
3548 | }
|
3549 |
|
3550 | if (_typeof(val) === 'object') {
|
3551 | if (isEmptyObject(val)) return taro.internal_safe_set(_data, key, val);
|
3552 | val = shakeFnFromObject(val);
|
3553 |
|
3554 | if (!isEmptyObject(val)) taro.internal_safe_set(_data, key, val);
|
3555 | } else {
|
3556 | taro.internal_safe_set(_data, key, val);
|
3557 | }
|
3558 | });
|
3559 | data = _data;
|
3560 | }
|
3561 |
|
3562 | data['priTaroCompReady'] = true;
|
3563 | var __mounted = component.__mounted;
|
3564 | var snapshot;
|
3565 |
|
3566 | if (__mounted) {
|
3567 | snapshot = callGetSnapshotBeforeUpdate(component, prevProps, prevState);
|
3568 | }
|
3569 |
|
3570 |
|
3571 | var cbs = [];
|
3572 |
|
3573 | if (component._pendingCallbacks && component._pendingCallbacks.length) {
|
3574 | cbs = component._pendingCallbacks;
|
3575 | component._pendingCallbacks = [];
|
3576 | }
|
3577 |
|
3578 | Object.keys(data).map(function (item) {
|
3579 | if (!(item in component.$scope)) {
|
3580 | component.$scope.$set(item, data[item]);
|
3581 | } else {
|
3582 | component.$scope[item] = data[item];
|
3583 | }
|
3584 | });
|
3585 |
|
3586 | if (__mounted) {
|
3587 | taro.invokeEffects(component);
|
3588 |
|
3589 | if (component['$$hasLoopRef']) {
|
3590 | taro.Current.current = component;
|
3591 | taro.Current.index = 0;
|
3592 | component._disableEffect = true;
|
3593 |
|
3594 | component._createData(component.state, component.props, true);
|
3595 |
|
3596 | component._disableEffect = false;
|
3597 | taro.Current.current = null;
|
3598 | }
|
3599 |
|
3600 | if (isFunction(component.componentDidUpdate)) {
|
3601 | component.componentDidUpdate(prevProps, prevState, snapshot);
|
3602 | }
|
3603 | }
|
3604 |
|
3605 | if (cbs.length) {
|
3606 | var i = cbs.length;
|
3607 |
|
3608 | while (--i >= 0) {
|
3609 | isFunction(cbs[i]) && cbs[i].call(component);
|
3610 | }
|
3611 | }
|
3612 | }
|
3613 |
|
3614 | var items = [];
|
3615 | function enqueueRender(component) {
|
3616 | var isForceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
3617 |
|
3618 | component._isForceUpdate = isForceUpdate;
|
3619 |
|
3620 | if (!component._dirty && (component._dirty = true) && items.push(component) === 1) {
|
3621 | nextTick(function () {
|
3622 | rerender();
|
3623 | });
|
3624 | }
|
3625 | }
|
3626 | function rerender() {
|
3627 | var p;
|
3628 | var list = items;
|
3629 | items = [];
|
3630 |
|
3631 | while (p = list.pop()) {
|
3632 | if (p._dirty) {
|
3633 | updateComponent(p, true);
|
3634 | }
|
3635 | }
|
3636 | }
|
3637 |
|
3638 | var PRELOAD_DATA_KEY$1 = 'preload';
|
3639 |
|
3640 | var BaseComponent = function () {
|
3641 |
|
3642 |
|
3643 |
|
3644 | function BaseComponent() {
|
3645 | var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
3646 | var isPage = arguments.length > 1 ? arguments[1] : undefined;
|
3647 |
|
3648 | _classCallCheck(this, BaseComponent);
|
3649 |
|
3650 | _defineProperty(this, "__computed", {});
|
3651 |
|
3652 | _defineProperty(this, "__props", {});
|
3653 |
|
3654 | _defineProperty(this, "__isReady", false);
|
3655 |
|
3656 | _defineProperty(this, "__mounted", false);
|
3657 |
|
3658 | _defineProperty(this, "nextProps", {});
|
3659 |
|
3660 | _defineProperty(this, "context", {});
|
3661 |
|
3662 | _defineProperty(this, "_dirty", true);
|
3663 |
|
3664 | _defineProperty(this, "_disable", true);
|
3665 |
|
3666 | _defineProperty(this, "_isForceUpdate", false);
|
3667 |
|
3668 | _defineProperty(this, "_pendingStates", []);
|
3669 |
|
3670 | _defineProperty(this, "_pendingCallbacks", []);
|
3671 |
|
3672 | _defineProperty(this, "$componentType", '');
|
3673 |
|
3674 | _defineProperty(this, "$router", {
|
3675 | params: {},
|
3676 | path: ''
|
3677 | });
|
3678 |
|
3679 | _defineProperty(this, "_afterScheduleEffect", false);
|
3680 |
|
3681 | _defineProperty(this, "_disableEffect", false);
|
3682 |
|
3683 | _defineProperty(this, "hooks", []);
|
3684 |
|
3685 | _defineProperty(this, "effects", []);
|
3686 |
|
3687 | _defineProperty(this, "layoutEffects", []);
|
3688 |
|
3689 | this.state = {};
|
3690 | this.props = props || {};
|
3691 | this.$componentType = isPage ? 'PAGE' : 'COMPONENT';
|
3692 | this.$prefix = genCompPrefix();
|
3693 | this.isTaroComponent = this.$componentType && this.$router && this._pendingStates;
|
3694 | }
|
3695 |
|
3696 | _createClass(BaseComponent, [{
|
3697 | key: "_constructor",
|
3698 | value: function _constructor(props) {
|
3699 | this.props = props || {};
|
3700 | }
|
3701 | }, {
|
3702 | key: "_init",
|
3703 | value: function _init(scope) {
|
3704 | this.$scope = scope;
|
3705 | }
|
3706 | }, {
|
3707 | key: "setState",
|
3708 | value: function setState(state, callback) {
|
3709 | if (state) {
|
3710 | (this._pendingStates = this._pendingStates || []).push(state);
|
3711 | }
|
3712 |
|
3713 | if (isFunction(callback)) {
|
3714 | (this._pendingCallbacks = this._pendingCallbacks || []).push(callback);
|
3715 | }
|
3716 |
|
3717 | if (!this._disable) {
|
3718 | enqueueRender(this, taro.internal_force_update === callback);
|
3719 | }
|
3720 | }
|
3721 | }, {
|
3722 | key: "getState",
|
3723 | value: function getState() {
|
3724 | var _this = this;
|
3725 |
|
3726 | var _pendingStates = this._pendingStates,
|
3727 | state = this.state,
|
3728 | props = this.props;
|
3729 | var stateClone = Object.assign({}, state);
|
3730 | delete stateClone.__data;
|
3731 |
|
3732 | if (!_pendingStates.length) {
|
3733 | return stateClone;
|
3734 | }
|
3735 |
|
3736 | var queue = _pendingStates.concat();
|
3737 |
|
3738 | this._pendingStates.length = 0;
|
3739 | queue.forEach(function (nextState) {
|
3740 | if (typeof nextState === 'function') {
|
3741 | nextState = nextState.call(_this, stateClone, props);
|
3742 | }
|
3743 |
|
3744 | Object.assign(stateClone, nextState);
|
3745 | });
|
3746 | return stateClone;
|
3747 | }
|
3748 | }, {
|
3749 | key: "forceUpdate",
|
3750 | value: function forceUpdate(callback) {
|
3751 | if (typeof callback === 'function') {
|
3752 | (this._pendingCallbacks = this._pendingCallbacks || []).push(callback);
|
3753 | }
|
3754 |
|
3755 | this._isForceUpdate = true;
|
3756 | updateComponent(this);
|
3757 | }
|
3758 | }, {
|
3759 | key: "$preload",
|
3760 | value: function $preload(key, value) {
|
3761 | var preloadData = cacheDataGet(PRELOAD_DATA_KEY$1) || {};
|
3762 |
|
3763 | if (_typeof(key) === 'object') {
|
3764 | for (var k in key) {
|
3765 | preloadData[k] = key[k];
|
3766 | }
|
3767 | } else {
|
3768 | preloadData[key] = value;
|
3769 | }
|
3770 |
|
3771 | cacheDataSet(PRELOAD_DATA_KEY$1, preloadData);
|
3772 | }
|
3773 |
|
3774 | }, {
|
3775 | key: "__triggerPropsFn",
|
3776 | value: function __triggerPropsFn(key, args) {
|
3777 | var keyChain = key.split('.');
|
3778 | var reduxFnPrefix = '__event_';
|
3779 | var reduxFnName = reduxFnPrefix + keyChain.shift();
|
3780 |
|
3781 | if (reduxFnName in this) {
|
3782 | var scope = args.shift();
|
3783 | var fn;
|
3784 |
|
3785 | if (keyChain.length > 0) {
|
3786 | fn = taro.internal_safe_get(this[reduxFnName], keyChain.join('.'));
|
3787 | } else {
|
3788 | fn = this[reduxFnName];
|
3789 | }
|
3790 |
|
3791 | fn.apply(scope, args);
|
3792 | } else {
|
3793 |
|
3794 | var keyLower = key.toLocaleLowerCase();
|
3795 | var payload = {
|
3796 | __isCustomEvt: true,
|
3797 | __arguments: args
|
3798 | };
|
3799 | var detail = {};
|
3800 | var externalBinding = this.$scope._externalBinding;
|
3801 | var attr = this.$scope._attr || this.$scope.attr || externalBinding && externalBinding.template.attr;
|
3802 |
|
3803 | if (attr) {
|
3804 | Object.keys(attr).forEach(function (item) {
|
3805 | if (/^data/.test(item)) {
|
3806 | detail[item.replace(/_/g, '').replace(/^data/, '')] = typeof attr[item] === 'function' ? attr[item]() : attr[item];
|
3807 | }
|
3808 | });
|
3809 | }
|
3810 |
|
3811 | if (Object.keys(detail).length) {
|
3812 | payload.__detail = detail;
|
3813 | }
|
3814 |
|
3815 | this.$scope.$emit(keyLower.replace(/^on/, ''), payload);
|
3816 | }
|
3817 | }
|
3818 | }]);
|
3819 |
|
3820 | return BaseComponent;
|
3821 | }();
|
3822 |
|
3823 | var PureComponent = function (_Component) {
|
3824 | _inherits(PureComponent, _Component);
|
3825 |
|
3826 | var _super = _createSuper(PureComponent);
|
3827 |
|
3828 | function PureComponent() {
|
3829 | var _this;
|
3830 |
|
3831 | _classCallCheck(this, PureComponent);
|
3832 |
|
3833 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
3834 | args[_key] = arguments[_key];
|
3835 | }
|
3836 |
|
3837 | _this = _super.call.apply(_super, [this].concat(args));
|
3838 |
|
3839 | _defineProperty(_assertThisInitialized(_this), "isPureComponent", true);
|
3840 |
|
3841 | return _this;
|
3842 | }
|
3843 |
|
3844 | _createClass(PureComponent, [{
|
3845 | key: "shouldComponentUpdate",
|
3846 | value: function shouldComponentUpdate(nextProps, nextState) {
|
3847 | return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
|
3848 | }
|
3849 | }]);
|
3850 |
|
3851 | return PureComponent;
|
3852 | }(BaseComponent);
|
3853 |
|
3854 | function createApp(AppClass) {
|
3855 | var app = new AppClass();
|
3856 | var appConf = {
|
3857 | onCreate: function onCreate(options) {
|
3858 | globalRef.$app = this;
|
3859 | app.$app = this;
|
3860 | app.$app.$router = app.$router = {
|
3861 | params: options
|
3862 | };
|
3863 |
|
3864 | if (app.componentWillMount) {
|
3865 | app.componentWillMount();
|
3866 | }
|
3867 |
|
3868 | if (app.componentDidMount) {
|
3869 | app.componentDidMount();
|
3870 | }
|
3871 | },
|
3872 | onDestroy: function onDestroy() {
|
3873 | if (app.componentWillUnmount) {
|
3874 | app.componentWillUnmount();
|
3875 | }
|
3876 | }
|
3877 | };
|
3878 | return Object.assign(appConf, app);
|
3879 | }
|
3880 |
|
3881 | function request() {
|
3882 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
3883 | return new Promise(function (resolve, reject) {
|
3884 | if (typeof options === 'string') {
|
3885 | options = {
|
3886 | url: options
|
3887 | };
|
3888 | }
|
3889 |
|
3890 | var _options = options,
|
3891 | _options$url = _options.url,
|
3892 | url = _options$url === void 0 ? '' : _options$url,
|
3893 | method = _options.method,
|
3894 | _options$dataType = _options.dataType,
|
3895 | dataType = _options$dataType === void 0 ? 'json' : _options$dataType,
|
3896 | _success = _options.success,
|
3897 | _fail = _options.fail,
|
3898 | complete = _options.complete;
|
3899 | var _options2 = options,
|
3900 | header = _options2.header,
|
3901 | _options2$data = _options2.data,
|
3902 | data = _options2$data === void 0 ? '' : _options2$data;
|
3903 |
|
3904 | if (_typeof(header) !== 'object') header = {};
|
3905 |
|
3906 | if (!header['content-type'] && !header['Content-Type']) {
|
3907 | header['Content-Type'] = 'application/json';
|
3908 | }
|
3909 |
|
3910 |
|
3911 | var methodUpper = typeof method === 'string' ? method.toUpperCase() : 'GET';
|
3912 |
|
3913 | if (methodUpper === 'POST' && _typeof(data) === 'object') {
|
3914 | var contentType = header && (header['Content-Type'] || header['content-type']);
|
3915 |
|
3916 | if (contentType === 'application/json') {
|
3917 | data = JSON.stringify(data);
|
3918 | }
|
3919 | }
|
3920 |
|
3921 |
|
3922 | var obj = {
|
3923 | url: url,
|
3924 | data: data,
|
3925 | header: header,
|
3926 | method: methodUpper,
|
3927 | success: function success(res) {
|
3928 | var data = res.data;
|
3929 | if (dataType === 'json') data = JSON.parse(res.data);
|
3930 | var reponse = {
|
3931 | data: data,
|
3932 | statusCode: res.code,
|
3933 | header: res.headers
|
3934 | };
|
3935 | typeof _success === 'function' && _success(reponse);
|
3936 | typeof complete === 'function' && complete(reponse);
|
3937 | resolve(reponse);
|
3938 | },
|
3939 | fail: function fail(err, code) {
|
3940 | var reason = {
|
3941 | err: err,
|
3942 | code: code
|
3943 | };
|
3944 | typeof _fail === 'function' && _fail(reason);
|
3945 | typeof complete === 'function' && complete(reason);
|
3946 | reject(reason);
|
3947 | }
|
3948 | };
|
3949 | fetch.fetch(obj);
|
3950 | });
|
3951 | }
|
3952 | function uploadFile() {
|
3953 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
3954 | return new Promise(function (resolve, reject) {
|
3955 | var _options$url2 = options.url,
|
3956 | url = _options$url2 === void 0 ? '' : _options$url2,
|
3957 | filePath = options.filePath,
|
3958 | _options$name = options.name,
|
3959 | name = _options$name === void 0 ? 'file' : _options$name,
|
3960 | _options$formData = options.formData,
|
3961 | formData = _options$formData === void 0 ? {} : _options$formData,
|
3962 | _success2 = options.success,
|
3963 | _fail2 = options.fail,
|
3964 | complete = options.complete;
|
3965 | var header = options.header,
|
3966 | _options$method = options.method,
|
3967 | method = _options$method === void 0 ? 'POST' : _options$method,
|
3968 | _options$files = options.files,
|
3969 | files = _options$files === void 0 ? [] : _options$files,
|
3970 | _options$data = options.data,
|
3971 | data = _options$data === void 0 ? [] : _options$data;
|
3972 | if (_typeof(header) !== 'object') header = {};
|
3973 |
|
3974 | if (files.length === 0) {
|
3975 | files.push({
|
3976 | name: name,
|
3977 | uri: filePath
|
3978 | });
|
3979 | }
|
3980 |
|
3981 | if (data.length === 0) {
|
3982 | data.push(formData);
|
3983 | }
|
3984 |
|
3985 | var methodUpper = typeof method === 'string' ? method.toUpperCase() : 'POST';
|
3986 | var obj = {
|
3987 | url: url,
|
3988 | header: header,
|
3989 | method: methodUpper,
|
3990 | files: files,
|
3991 | data: data,
|
3992 | success: function success(res) {
|
3993 | var data = res.data;
|
3994 | if (dataType === 'json') data = JSON.parse(res.data);
|
3995 | var reponse = {
|
3996 | data: data,
|
3997 | statusCode: res.code,
|
3998 | header: res.headers
|
3999 | };
|
4000 | typeof _success2 === 'function' && _success2(reponse);
|
4001 | typeof complete === 'function' && complete(reponse);
|
4002 | resolve(reponse);
|
4003 | },
|
4004 | fail: function fail(err, code) {
|
4005 | var reason = {
|
4006 | err: err,
|
4007 | code: code
|
4008 | };
|
4009 | typeof _fail2 === 'function' && _fail2(reason);
|
4010 | typeof complete === 'function' && complete(reason);
|
4011 | reject(reason);
|
4012 | }
|
4013 | };
|
4014 | quickRequest.upload(obj);
|
4015 | });
|
4016 | }
|
4017 | function downloadFile() {
|
4018 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4019 | return new Promise(function (resolve, reject) {
|
4020 | var _options$url3 = options.url,
|
4021 | url = _options$url3 === void 0 ? '' : _options$url3,
|
4022 | _options$description = options.description,
|
4023 | description = _options$description === void 0 ? '' : _options$description,
|
4024 | filename = options.filename,
|
4025 | _success3 = options.success,
|
4026 | _fail3 = options.fail,
|
4027 | complete = options.complete;
|
4028 | var header = options.header;
|
4029 | if (_typeof(header) !== 'object') header = {};
|
4030 | var obj = {
|
4031 | url: url,
|
4032 | header: header,
|
4033 | description: description,
|
4034 | data: data,
|
4035 | success: function success(res) {
|
4036 | var data = res.data;
|
4037 | if (dataType === 'json') data = JSON.parse(res.data);
|
4038 | var reponse = {
|
4039 | data: data,
|
4040 | statusCode: res.code,
|
4041 | header: res.headers
|
4042 | };
|
4043 | typeof _success3 === 'function' && _success3(reponse);
|
4044 | typeof complete === 'function' && complete(reponse);
|
4045 | resolve(reponse);
|
4046 | },
|
4047 | fail: function fail(err, code) {
|
4048 | var reason = {
|
4049 | err: err,
|
4050 | code: code
|
4051 | };
|
4052 | typeof _fail3 === 'function' && _fail3(reason);
|
4053 | typeof complete === 'function' && complete(reason);
|
4054 | reject(reason);
|
4055 | }
|
4056 | };
|
4057 | if (filename) obj.filename = filename;
|
4058 | quickRequest.download(obj);
|
4059 | });
|
4060 | }
|
4061 |
|
4062 | function generateUnSupportApi(errText, fnNames) {
|
4063 | var res = {};
|
4064 | fnNames.forEach(function (fnName) {
|
4065 | res[fnName] = function () {
|
4066 | throw new Error(errText);
|
4067 | };
|
4068 | });
|
4069 | return res;
|
4070 | }
|
4071 | function makeSyncPromise(fnName, process) {
|
4072 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
4073 | var success = options.success,
|
4074 | fail = options.fail,
|
4075 | complete = options.complete;
|
4076 | var res = {
|
4077 | errMsg: "".concat(fnName, ":ok")
|
4078 | };
|
4079 | return new Promise(function (resolve, reject) {
|
4080 | try {
|
4081 | process && process();
|
4082 | success && success(res);
|
4083 | complete && complete(res);
|
4084 | resolve(res);
|
4085 | } catch (data) {
|
4086 | res.errMsg = "".concat(fnName, ":error");
|
4087 | res.data = data;
|
4088 | fail && fail(res);
|
4089 | complete && complete(res);
|
4090 | reject(res);
|
4091 | }
|
4092 | });
|
4093 | }
|
4094 | function temporarilyNotSupport(apiName) {
|
4095 | return function () {
|
4096 | var errMsg = "\u6682\u65F6\u4E0D\u652F\u6301 API ".concat(apiName);
|
4097 | console.error(errMsg);
|
4098 | return Promise.reject(new Error(errMsg));
|
4099 | };
|
4100 | }
|
4101 |
|
4102 | function setStorage() {
|
4103 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4104 | var key = opts.key,
|
4105 | data = opts.data,
|
4106 | _success = opts.success,
|
4107 | _fail = opts.fail,
|
4108 | complete = opts.complete;
|
4109 | var res = {
|
4110 | errMsg: 'setStorage:ok'
|
4111 | };
|
4112 | return new Promise(function (resolve, reject) {
|
4113 | storage.set({
|
4114 | key: key,
|
4115 | value: JSON.stringify(data),
|
4116 | success: function success() {
|
4117 | _success && _success(res);
|
4118 | complete && complete(res);
|
4119 | resolve(res);
|
4120 | },
|
4121 | fail: function fail(message, code) {
|
4122 | res.errMsg = message;
|
4123 | res.code = code;
|
4124 | _fail && _fail(res);
|
4125 | complete && complete(res);
|
4126 | reject(res);
|
4127 | }
|
4128 | });
|
4129 | });
|
4130 | }
|
4131 | function getStorage() {
|
4132 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4133 | var key = opts.key,
|
4134 | _success2 = opts.success,
|
4135 | _fail2 = opts.fail,
|
4136 | complete = opts.complete;
|
4137 | var res = {
|
4138 | errMsg: 'getStorage:ok'
|
4139 | };
|
4140 | return new Promise(function (resolve, reject) {
|
4141 | storage.get({
|
4142 | key: key,
|
4143 | success: function success(data) {
|
4144 | res.data = data ? JSON.parse(data) : data;
|
4145 | _success2 && _success2(res);
|
4146 | complete && complete(res);
|
4147 | resolve(res);
|
4148 | },
|
4149 | fail: function fail(message, code) {
|
4150 | res.errMsg = message;
|
4151 | res.code = code;
|
4152 | _fail2 && _fail2(res);
|
4153 | complete && complete(res);
|
4154 | reject(res);
|
4155 | }
|
4156 | });
|
4157 | });
|
4158 | }
|
4159 | function getStorageInfo() {
|
4160 | console.log('快应用暂不支持getStorageInfo api');
|
4161 | }
|
4162 | function removeStorage() {
|
4163 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4164 | var key = opts.key,
|
4165 | _success3 = opts.success,
|
4166 | _fail3 = opts.fail,
|
4167 | complete = opts.complete;
|
4168 | var res = {
|
4169 | errMsg: 'removeStorage:ok'
|
4170 | };
|
4171 | return new Promise(function (resolve, reject) {
|
4172 | storage["delete"]({
|
4173 | key: key,
|
4174 | success: function success() {
|
4175 | _success3 && _success3(res);
|
4176 | complete && complete(res);
|
4177 | resolve(res);
|
4178 | },
|
4179 | fail: function fail(message, code) {
|
4180 | res.errMsg = message;
|
4181 | res.code = code;
|
4182 | _fail3 && _fail3(res);
|
4183 | complete && complete(res);
|
4184 | reject(res);
|
4185 | }
|
4186 | });
|
4187 | });
|
4188 | }
|
4189 | function clearStorage() {
|
4190 | return storage.clear();
|
4191 | }
|
4192 | var unSupportApis = ['setStorageSync', 'getStorageSync', 'getStorageInfoSync', 'removeStorageSync', 'clearStorageSync'];
|
4193 | unSupportApis = generateUnSupportApi('快应用暂不支持storage的同步存取', unSupportApis);
|
4194 | var qStorage = {
|
4195 | setStorage: setStorage,
|
4196 | getStorage: getStorage,
|
4197 | getStorageInfo: getStorageInfo,
|
4198 | removeStorage: removeStorage,
|
4199 | clearStorage: clearStorage
|
4200 | };
|
4201 | Object.assign(qStorage, unSupportApis);
|
4202 |
|
4203 | var preloadPrivateKey$1 = 'quick$PriPreload';
|
4204 | var preloadInitedComponent$1 = 'quick$PriPreloadComponent';
|
4205 | function navigateTo() {
|
4206 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4207 | return qappNavigate(options);
|
4208 | }
|
4209 | function redirectTo() {
|
4210 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4211 | return qappNavigate(options, 'replace');
|
4212 | }
|
4213 | function navigateBack() {
|
4214 | router.back();
|
4215 | }
|
4216 | function switchTab() {
|
4217 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4218 | router.clear();
|
4219 | return qappNavigate(options, 'replace');
|
4220 | }
|
4221 | function getCurrentPages$1() {
|
4222 | return router.getLength();
|
4223 | }
|
4224 | function reLaunch() {
|
4225 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4226 | router.clear();
|
4227 | return qappNavigate(options, 'replace');
|
4228 | }
|
4229 |
|
4230 | function qappNavigate() {
|
4231 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4232 | var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'push';
|
4233 | var _options$url = options.url,
|
4234 | url = _options$url === void 0 ? '' : _options$url,
|
4235 | success = options.success,
|
4236 | fail = options.fail,
|
4237 | complete = options.complete;
|
4238 | var res = {
|
4239 | errMsg: 'ok'
|
4240 | };
|
4241 | return new Promise(function (resolve, reject) {
|
4242 | var params = {};
|
4243 |
|
4244 | if (!url) {
|
4245 | res.errMsg = 'url不能为空';
|
4246 | fail && fail(res);
|
4247 | reject(res);
|
4248 | return;
|
4249 | }
|
4250 |
|
4251 | params = getUrlParams(url);
|
4252 | var markIndex = url.indexOf('?');
|
4253 | var componentPath = globalRef.componentPath || '';
|
4254 | var parseUrl = url.substr(0, markIndex >= 0 ? markIndex : url.length);
|
4255 | var RelativeReg = /\.\.\//g;
|
4256 |
|
4257 | if (componentPath && RelativeReg.test(parseUrl)) {
|
4258 |
|
4259 | var componentRootDir = componentPath.substr(0, componentPath.lastIndexOf('/'));
|
4260 | var pathArr = parseUrl.split('/');
|
4261 |
|
4262 | var _iterator = _createForOfIteratorHelper(pathArr),
|
4263 | _step;
|
4264 |
|
4265 | try {
|
4266 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
4267 | var path = _step.value;
|
4268 |
|
4269 | if (path === '..') {
|
4270 | componentRootDir = componentRootDir.substr(0, componentRootDir.lastIndexOf('/'));
|
4271 | }
|
4272 | }
|
4273 | } catch (err) {
|
4274 | _iterator.e(err);
|
4275 | } finally {
|
4276 | _iterator.f();
|
4277 | }
|
4278 |
|
4279 | parseUrl = componentRootDir + '/' + parseUrl.replace(RelativeReg, '');
|
4280 | }
|
4281 |
|
4282 | parseUrl = addLeadingSlash$1(parseUrl);
|
4283 | globalRef.taroRouterParamsCache = globalRef.taroRouterParamsCache || {};
|
4284 | globalRef.taroRouterParamsCache[parseUrl] = params;
|
4285 |
|
4286 | if (method === 'push' || method === 'replace') {
|
4287 | var Component = cacheDataGet(parseUrl);
|
4288 |
|
4289 | if (Component) {
|
4290 | var component = new Component();
|
4291 |
|
4292 | if (component.componentWillPreload) {
|
4293 | var cacheKey = getUniqueKey();
|
4294 | cacheDataSet(cacheKey, component.componentWillPreload(Object.assign({}, params)));
|
4295 | cacheDataSet(preloadInitedComponent$1, component);
|
4296 | params[preloadPrivateKey$1] = cacheKey;
|
4297 | }
|
4298 | }
|
4299 | }
|
4300 |
|
4301 | try {
|
4302 | router[method]({
|
4303 | uri: parseUrl.substr(0, parseUrl.lastIndexOf('/')),
|
4304 | params: params
|
4305 | });
|
4306 | success && success(res);
|
4307 | complete && complete(res);
|
4308 | resolve(res);
|
4309 | } catch (data) {
|
4310 | res.errMsg = 'error';
|
4311 | res.data = data;
|
4312 | fail && fail(res);
|
4313 | reject(res);
|
4314 | }
|
4315 | });
|
4316 | }
|
4317 |
|
4318 | function getUrlParams() {
|
4319 | var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
4320 | var params = {};
|
4321 | url = url.replace(/#.*$/, '');
|
4322 | var queryArray = url.split(/[?&]/).slice(1);
|
4323 | queryArray.forEach(function (item) {
|
4324 | var match = item.match(/([^=]+)=([^=]+)/);
|
4325 |
|
4326 | if (match != null) {
|
4327 | params[match[1]] = decodeURIComponent(match[2]);
|
4328 | }
|
4329 | });
|
4330 | return params;
|
4331 | }
|
4332 |
|
4333 | function showToast() {
|
4334 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4335 | var _options$title = options.title,
|
4336 | title = _options$title === void 0 ? '' : _options$title,
|
4337 | _options$duration = options.duration,
|
4338 | duration = _options$duration === void 0 ? 1500 : _options$duration,
|
4339 | success = options.success,
|
4340 | complete = options.complete,
|
4341 | fail = options.fail;
|
4342 | var res = {
|
4343 | errMsg: 'showToast:ok'
|
4344 | };
|
4345 | return new Promise(function (resolve, reject) {
|
4346 | try {
|
4347 | prompt.showToast({
|
4348 | message: title,
|
4349 | duration: duration
|
4350 | });
|
4351 | success && success(res);
|
4352 | complete && complete(res);
|
4353 | resolve(res);
|
4354 | } catch (data) {
|
4355 | res.errMsg = 'showToast: error';
|
4356 | res.data = data;
|
4357 | fail && fail(res);
|
4358 | reject(res);
|
4359 | }
|
4360 | });
|
4361 | }
|
4362 | function showModal() {
|
4363 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4364 | var _options$title2 = options.title,
|
4365 | title = _options$title2 === void 0 ? '' : _options$title2,
|
4366 | _options$content = options.content,
|
4367 | content = _options$content === void 0 ? '' : _options$content,
|
4368 | _options$showCancel = options.showCancel,
|
4369 | showCancel = _options$showCancel === void 0 ? true : _options$showCancel,
|
4370 | _options$cancelText = options.cancelText,
|
4371 | cancelText = _options$cancelText === void 0 ? '取消' : _options$cancelText,
|
4372 | _options$cancelColor = options.cancelColor,
|
4373 | cancelColor = _options$cancelColor === void 0 ? '#000000' : _options$cancelColor,
|
4374 | _options$confirmText = options.confirmText,
|
4375 | confirmText = _options$confirmText === void 0 ? '确定' : _options$confirmText,
|
4376 | _options$confirmColor = options.confirmColor,
|
4377 | confirmColor = _options$confirmColor === void 0 ? '#3CC51F' : _options$confirmColor,
|
4378 | _success = options.success,
|
4379 | _fail = options.fail,
|
4380 | complete = options.complete;
|
4381 | var res = {
|
4382 | errMsg: 'showModel:ok',
|
4383 | confirm: false,
|
4384 | cancel: false
|
4385 | };
|
4386 | var btnList = [{
|
4387 | text: confirmText,
|
4388 | color: confirmColor
|
4389 | }];
|
4390 | showCancel && btnList.push({
|
4391 | text: cancelText,
|
4392 | color: cancelColor
|
4393 | });
|
4394 | return new Promise(function (resolve, reject) {
|
4395 | prompt.showDialog({
|
4396 | title: title,
|
4397 | message: content,
|
4398 | buttons: btnList,
|
4399 | success: function success(data) {
|
4400 | if (showCancel) {
|
4401 | res.confirm = data.index === 0;
|
4402 | res.cancel = data.index === 1;
|
4403 | } else {
|
4404 | res.confirm = true;
|
4405 | }
|
4406 |
|
4407 | _success && _success(res);
|
4408 | complete && complete(res);
|
4409 | resolve(res);
|
4410 | },
|
4411 | cancel: function cancel() {
|
4412 | _success && _success(res);
|
4413 | complete && complete(res);
|
4414 | res.cancel = true;
|
4415 | resolve(res);
|
4416 | },
|
4417 | fail: function fail(data, code) {
|
4418 | res.errMsg = data;
|
4419 | res.code = code;
|
4420 | _fail && _fail(res);
|
4421 | reject(res);
|
4422 | console.log("handling fail, code = ".concat(code), data);
|
4423 | }
|
4424 | });
|
4425 | });
|
4426 | }
|
4427 | function showActionSheet() {
|
4428 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4429 | var itemList = options.itemList,
|
4430 | _options$itemColor = options.itemColor,
|
4431 | itemColor = _options$itemColor === void 0 ? '#000000' : _options$itemColor,
|
4432 | _success2 = options.success,
|
4433 | _fail2 = options.fail,
|
4434 | complete = options.complete;
|
4435 | var res = {
|
4436 | errMsg: 'showActionSheet:ok'
|
4437 | };
|
4438 | return new Promise(function (resolve, reject) {
|
4439 | if (!itemList) {
|
4440 | console.warn('itemList必传');
|
4441 | res.errMsg = 'itemList必传';
|
4442 | reject(res);
|
4443 | return;
|
4444 | }
|
4445 |
|
4446 | prompt.showContextMenu({
|
4447 | itemList: itemList,
|
4448 | itemColor: itemColor,
|
4449 | success: function success(data) {
|
4450 | res.tapIndex = data.index;
|
4451 | _success2 && _success2(res);
|
4452 | complete && complete(res);
|
4453 | resolve(res);
|
4454 | },
|
4455 | cancel: function cancel() {
|
4456 | res.errMsg = 'cancelActionSheet: success';
|
4457 | _success2 && _success2(res);
|
4458 | complete && complete(res);
|
4459 | res.tapIndex = -1;
|
4460 | resolve(res);
|
4461 | },
|
4462 | fail: function fail(data, code) {
|
4463 | res.errMsg = data;
|
4464 | res.code = code;
|
4465 | complete && complete(res);
|
4466 | _fail2 && _fail2(res);
|
4467 | reject(res);
|
4468 | console.log("handling fail, code = ".concat(code), data);
|
4469 | }
|
4470 | });
|
4471 | });
|
4472 | }
|
4473 |
|
4474 | function setNavigationBar(params, fnName) {
|
4475 | var success = params.success,
|
4476 | complete = params.complete,
|
4477 | fail = params.fail;
|
4478 | var res = {
|
4479 | errMsg: "".concat(fnName, ": ok")
|
4480 | };
|
4481 | return new Promise(function (resolve, reject) {
|
4482 | try {
|
4483 | globalRef.eventCenter.trigger('TaroEvent:setNavigationBar', params);
|
4484 | success && success(res);
|
4485 | complete && complete(res);
|
4486 | resolve(res);
|
4487 | } catch (data) {
|
4488 | res.errMsg = "".concat(fnName, ": error");
|
4489 | res.data = data;
|
4490 | fail && fail(res);
|
4491 | reject(res);
|
4492 | }
|
4493 | });
|
4494 | }
|
4495 |
|
4496 | function setNavigationBarTitle(params) {
|
4497 | setNavigationBar(params, 'setNavigationBarTitle');
|
4498 | }
|
4499 | function setNavigationBarColor(params) {
|
4500 | setNavigationBar(params, 'setNavigationBarColor');
|
4501 | }
|
4502 | function startPullDownRefresh() {
|
4503 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4504 | var success = options.success,
|
4505 | complete = options.complete,
|
4506 | fail = options.fail;
|
4507 | var res = {
|
4508 | errMsg: "startPullDownRefresh: ok"
|
4509 | };
|
4510 | return new Promise(function (resolve, reject) {
|
4511 | try {
|
4512 | globalRef.eventCenter.trigger('TaroPage:startPullDownRefresh');
|
4513 | success && success(res);
|
4514 | complete && complete(res);
|
4515 | resolve(res);
|
4516 | } catch (data) {
|
4517 | res.errMsg = 'startPullDownRefresh: error';
|
4518 | res.data = data;
|
4519 | fail && fail(res);
|
4520 | reject(res);
|
4521 | }
|
4522 | });
|
4523 | }
|
4524 | function stopPullDownRefresh() {
|
4525 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4526 | var success = options.success,
|
4527 | complete = options.complete,
|
4528 | fail = options.fail;
|
4529 | var res = {
|
4530 | errMsg: "stopPullDownRefresh: ok"
|
4531 | };
|
4532 | return new Promise(function (resolve, reject) {
|
4533 | try {
|
4534 | globalRef.eventCenter.trigger('TaroPage:stopPullDownRefresh');
|
4535 | success && success(res);
|
4536 | complete && complete(res);
|
4537 | resolve(res);
|
4538 | } catch (data) {
|
4539 | res.errMsg = 'stopPullDownRefresh: error';
|
4540 | res.data = data;
|
4541 | fail && fail(res);
|
4542 | reject(res);
|
4543 | }
|
4544 | });
|
4545 | }
|
4546 |
|
4547 | function scanCode() {
|
4548 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4549 | var _success = options.success,
|
4550 | _fail = options.fail,
|
4551 | _complete = options.complete;
|
4552 | var res = {
|
4553 | errMsg: 'scanCode:ok'
|
4554 | };
|
4555 | return new Promise(function (resolve, reject) {
|
4556 | barcode.scan({
|
4557 | success: function success(data) {
|
4558 | res.result = data.result;
|
4559 | _success && _success(res);
|
4560 | _complete && _complete(res);
|
4561 | resolve(res);
|
4562 | },
|
4563 | cancel: function cancel() {
|
4564 | res.errMsg = 'cancelScanCode: success';
|
4565 | _success && _success(res);
|
4566 | _complete && _complete(res);
|
4567 | res.result = '';
|
4568 | resolve(res);
|
4569 | },
|
4570 | fail: function fail(data, code) {
|
4571 | res.errMsg = data;
|
4572 | res.code = code;
|
4573 | _complete && _complete(res);
|
4574 | _fail && _fail(res);
|
4575 | reject(res);
|
4576 | console.log("scanCode fail, code = ".concat(code), data);
|
4577 | },
|
4578 | complete: function complete() {
|
4579 | _complete && _complete(res);
|
4580 | }
|
4581 | });
|
4582 | });
|
4583 | }
|
4584 | function vibrateShort() {
|
4585 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4586 | return makeSyncPromise('vibrateShort', function () {
|
4587 | vibrator.vibrate({
|
4588 | mode: 'short'
|
4589 | });
|
4590 | }, options);
|
4591 | }
|
4592 | function vibrateLong() {
|
4593 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4594 | return makeSyncPromise('vibrateLong', function () {
|
4595 | vibrator.vibrate({
|
4596 | mode: 'long'
|
4597 | });
|
4598 | }, options);
|
4599 | }
|
4600 | function setClipboardData() {
|
4601 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4602 | var data = options.data,
|
4603 | _success2 = options.success,
|
4604 | _fail2 = options.fail,
|
4605 | _complete2 = options.complete;
|
4606 | var res = {
|
4607 | errMsg: 'setClipboardData:ok'
|
4608 | };
|
4609 | return new Promise(function (resolve, reject) {
|
4610 | clipboard.set({
|
4611 | text: data,
|
4612 | success: function success(data) {
|
4613 | res.result = data.result;
|
4614 | _success2 && _success2(res);
|
4615 | resolve(res);
|
4616 | },
|
4617 | fail: function fail(data, code) {
|
4618 | res.errMsg = data;
|
4619 | res.code = code;
|
4620 | _fail2 && _fail2(res);
|
4621 | reject(res);
|
4622 | },
|
4623 | complete: function complete() {
|
4624 | _complete2 && _complete2(res);
|
4625 | }
|
4626 | });
|
4627 | });
|
4628 | }
|
4629 | function getClipboardData() {
|
4630 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4631 | var _success3 = options.success,
|
4632 | _fail3 = options.fail,
|
4633 | _complete3 = options.complete;
|
4634 | var res = {
|
4635 | errMsg: 'getClipboardData:ok'
|
4636 | };
|
4637 | return new Promise(function (resolve, reject) {
|
4638 | clipboard.get({
|
4639 | success: function success(data) {
|
4640 | res.data = data.text;
|
4641 | _success3 && _success3(res);
|
4642 | resolve(res);
|
4643 | },
|
4644 | fail: function fail(data, code) {
|
4645 | res.errMsg = data;
|
4646 | res.code = code;
|
4647 | _fail3 && _fail3(res);
|
4648 | reject(res);
|
4649 | },
|
4650 | complete: function complete() {
|
4651 | _complete3 && _complete3(res);
|
4652 | }
|
4653 | });
|
4654 | });
|
4655 | }
|
4656 | function startAccelerometer() {
|
4657 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4658 | return makeSyncPromise('startAccelerometer', null, options);
|
4659 | }
|
4660 | function stopAccelerometer() {
|
4661 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4662 | return makeSyncPromise('stopAccelerometer', function () {
|
4663 | sensor.unsubscribeAccelerometer();
|
4664 | }, options);
|
4665 | }
|
4666 | function onAccelerometerChange(callback) {
|
4667 | if (callback) {
|
4668 | sensor.subscribeAccelerometer({
|
4669 | callback: callback
|
4670 | });
|
4671 | }
|
4672 | }
|
4673 | function startCompass() {
|
4674 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4675 | return makeSyncPromise('startCompass', null, options);
|
4676 | }
|
4677 | function stopCompass() {
|
4678 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4679 | return makeSyncPromise('stopCompass', function () {
|
4680 | sensor.unsubscribeCompass();
|
4681 | }, options);
|
4682 | }
|
4683 | function onCompassChange(callback) {
|
4684 | if (callback) {
|
4685 | sensor.subscribeCompass({
|
4686 | callback: callback
|
4687 | });
|
4688 | }
|
4689 | }
|
4690 | function getLocation() {
|
4691 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4692 | var _success4 = options.success,
|
4693 | _fail4 = options.fail,
|
4694 | _complete4 = options.complete;
|
4695 | var res = {
|
4696 | errMsg: 'getLocation:ok'
|
4697 | };
|
4698 | return new Promise(function (resolve, reject) {
|
4699 | geolocation.getLocation({
|
4700 | success: function success(data) {
|
4701 | res.latitude = data.latitude;
|
4702 | res.longitude = data.longitude;
|
4703 | res.accuracy = data.accuracy;
|
4704 | _success4 && _success4(res);
|
4705 | resolve(res);
|
4706 | },
|
4707 | fail: function fail(data, code) {
|
4708 | res.errMsg = data;
|
4709 | res.code = code;
|
4710 | _fail4 && _fail4(res);
|
4711 | reject(res);
|
4712 | },
|
4713 | complete: function complete() {
|
4714 | _complete4 && _complete4(res);
|
4715 | }
|
4716 | });
|
4717 | });
|
4718 | }
|
4719 |
|
4720 | function showShareMenu() {
|
4721 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4722 | var type = opts.type,
|
4723 | data = opts.data,
|
4724 | _success = opts.success,
|
4725 | _fail = opts.fail,
|
4726 | complete = opts.complete;
|
4727 | var res = {
|
4728 | errMsg: 'showShareMenu:ok'
|
4729 | };
|
4730 | return new Promise(function (resolve, reject) {
|
4731 | share.share({
|
4732 | type: type,
|
4733 | data: data,
|
4734 | success: function success() {
|
4735 | _success && _success(res);
|
4736 | complete && complete(res);
|
4737 | resolve(res);
|
4738 | },
|
4739 | fail: function fail(message, code) {
|
4740 | res.errMsg = message;
|
4741 | res.code = code;
|
4742 | _fail && _fail(res);
|
4743 | complete && complete(res);
|
4744 | reject(res);
|
4745 | }
|
4746 | });
|
4747 | });
|
4748 | }
|
4749 |
|
4750 | function showNotification() {
|
4751 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4752 | var contentTitle = opts.contentTitle,
|
4753 | contentText = opts.contentText,
|
4754 | clickAction = opts.clickAction;
|
4755 |
|
4756 | if (clickAction) {
|
4757 | var uri = clickAction.uri;
|
4758 | clickAction.uri = uri.substr(0, url.lastIndexOf('/'));
|
4759 | }
|
4760 |
|
4761 | notification.show({
|
4762 | contentTitle: contentTitle || undefined,
|
4763 | contentText: contentText || undefined,
|
4764 | clickAction: contentText || undefined
|
4765 | });
|
4766 | }
|
4767 |
|
4768 | function getSystemInfo() {
|
4769 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4770 | var _success = options.success,
|
4771 | _fail = options.fail,
|
4772 | _complete = options.complete;
|
4773 | var res = {
|
4774 | errMsg: 'getSystemInfo:ok'
|
4775 | };
|
4776 | return new Promise(function (resolve, reject) {
|
4777 | device.getInfo({
|
4778 | success: function success(data) {
|
4779 | res.result = data;
|
4780 | _success && _success(res);
|
4781 | resolve(res);
|
4782 | },
|
4783 | fail: function fail(data, code) {
|
4784 | res.errMsg = data;
|
4785 | res.code = code;
|
4786 | _fail && _fail(res);
|
4787 | reject(res);
|
4788 | },
|
4789 | complete: function complete() {
|
4790 | _complete && _complete(res);
|
4791 | }
|
4792 | });
|
4793 | });
|
4794 | }
|
4795 | function getSystemId() {
|
4796 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4797 | var _success2 = options.success,
|
4798 | _fail2 = options.fail,
|
4799 | _complete2 = options.complete,
|
4800 | type = options.type;
|
4801 | var res = {
|
4802 | errMsg: 'getSystemId:ok'
|
4803 | };
|
4804 | return new Promise(function (resolve, reject) {
|
4805 | device.getId({
|
4806 | type: type,
|
4807 | success: function success(data) {
|
4808 | res.result = data;
|
4809 | _success2 && _success2(res);
|
4810 | resolve(res);
|
4811 | },
|
4812 | fail: function fail(data, code) {
|
4813 | res.errMsg = data;
|
4814 | res.code = code;
|
4815 | _fail2 && _fail2(res);
|
4816 | reject(res);
|
4817 | },
|
4818 | complete: function complete() {
|
4819 | _complete2 && _complete2(res);
|
4820 | }
|
4821 | });
|
4822 | });
|
4823 | }
|
4824 | function getSystemDeviceId() {
|
4825 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4826 | var _success3 = options.success,
|
4827 | _fail3 = options.fail,
|
4828 | complete = options.complete;
|
4829 | var res = {
|
4830 | errMsg: 'getSystemDeviceId:ok'
|
4831 | };
|
4832 | return new Promise(function (resolve, reject) {
|
4833 | device.getDeviceId({
|
4834 | success: function success(data) {
|
4835 | res.result = data;
|
4836 | _success3 && _success3(res);
|
4837 | resolve(res);
|
4838 | },
|
4839 | fail: function fail(data, code) {
|
4840 | res.errMsg = data;
|
4841 | res.code = code;
|
4842 | _fail3 && _fail3(res);
|
4843 | complete && complete(res);
|
4844 | reject(res);
|
4845 | }
|
4846 | });
|
4847 | });
|
4848 | }
|
4849 | function getSystemUserId() {
|
4850 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4851 | var _success4 = options.success,
|
4852 | _fail4 = options.fail,
|
4853 | complete = options.complete;
|
4854 | var res = {
|
4855 | errMsg: 'getSystemUserId:ok'
|
4856 | };
|
4857 | return new Promise(function (resolve, reject) {
|
4858 | device.getDeviceId({
|
4859 | success: function success(data) {
|
4860 | res.result = data;
|
4861 | _success4 && _success4(res);
|
4862 | resolve(res);
|
4863 | },
|
4864 | fail: function fail(data, code) {
|
4865 | res.errMsg = data;
|
4866 | res.code = code;
|
4867 | _fail4 && _fail4(res);
|
4868 | complete && complete(res);
|
4869 | reject(res);
|
4870 | }
|
4871 | });
|
4872 | });
|
4873 | }
|
4874 | function getSystemAdvertisingId() {
|
4875 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4876 | var _success5 = options.success,
|
4877 | _fail5 = options.fail,
|
4878 | complete = options.complete;
|
4879 | var res = {
|
4880 | errMsg: 'getSystemAdvertisingId:ok'
|
4881 | };
|
4882 | return new Promise(function (resolve, reject) {
|
4883 | device.getAdvertisingId({
|
4884 | success: function success(data) {
|
4885 | res.result = data;
|
4886 | _success5 && _success5(res);
|
4887 | resolve(res);
|
4888 | },
|
4889 | fail: function fail(data, code) {
|
4890 | res.errMsg = data;
|
4891 | res.code = code;
|
4892 | _fail5 && _fail5(res);
|
4893 | complete && complete(res);
|
4894 | reject(res);
|
4895 | }
|
4896 | });
|
4897 | });
|
4898 | }
|
4899 | function getSystemSerial() {
|
4900 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4901 | var _success6 = options.success,
|
4902 | _fail6 = options.fail,
|
4903 | complete = options.complete;
|
4904 | var res = {
|
4905 | errMsg: 'getSystemSerial:ok'
|
4906 | };
|
4907 | return new Promise(function (resolve, reject) {
|
4908 | device.getSerial({
|
4909 | success: function success(data) {
|
4910 | res.result = data;
|
4911 | _success6 && _success6(res);
|
4912 | resolve(res);
|
4913 | },
|
4914 | fail: function fail(data, code) {
|
4915 | res.errMsg = data;
|
4916 | res.code = code;
|
4917 | _fail6 && _fail6(res);
|
4918 | complete && complete(res);
|
4919 | reject(res);
|
4920 | }
|
4921 | });
|
4922 | });
|
4923 | }
|
4924 | function getSystemTotalStorage() {
|
4925 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4926 | var _success7 = options.success,
|
4927 | _fail7 = options.fail,
|
4928 | complete = options.complete;
|
4929 | var res = {
|
4930 | errMsg: 'getSystemTotalStorage:ok'
|
4931 | };
|
4932 | return new Promise(function (resolve, reject) {
|
4933 | device.getTotalStorage({
|
4934 | success: function success(data) {
|
4935 | res.result = data;
|
4936 | _success7 && _success7(res);
|
4937 | resolve(res);
|
4938 | },
|
4939 | fail: function fail(data, code) {
|
4940 | res.errMsg = data;
|
4941 | res.code = code;
|
4942 | _fail7 && _fail7(res);
|
4943 | complete && complete(res);
|
4944 | reject(res);
|
4945 | }
|
4946 | });
|
4947 | });
|
4948 | }
|
4949 | function getSystemAvailableStorage() {
|
4950 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4951 | var _success8 = options.success,
|
4952 | _fail8 = options.fail,
|
4953 | complete = options.complete;
|
4954 | var res = {
|
4955 | errMsg: 'getSystemAvailableStorage:ok'
|
4956 | };
|
4957 | return new Promise(function (resolve, reject) {
|
4958 | device.getAvailableStorage({
|
4959 | success: function success(data) {
|
4960 | res.result = data;
|
4961 | _success8 && _success8(res);
|
4962 | resolve(res);
|
4963 | },
|
4964 | fail: function fail(data, code) {
|
4965 | res.errMsg = data;
|
4966 | res.code = code;
|
4967 | _fail8 && _fail8(res);
|
4968 | complete && complete(res);
|
4969 | reject(res);
|
4970 | }
|
4971 | });
|
4972 | });
|
4973 | }
|
4974 | function getSystemCpuInfo() {
|
4975 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4976 | var _success9 = options.success,
|
4977 | _fail9 = options.fail,
|
4978 | complete = options.complete;
|
4979 | var res = {
|
4980 | errMsg: 'getSystemCpuInfo:ok'
|
4981 | };
|
4982 | return new Promise(function (resolve, reject) {
|
4983 | device.getCpuInfo({
|
4984 | success: function success(data) {
|
4985 | res.result = data;
|
4986 | _success9 && _success9(res);
|
4987 | resolve(res);
|
4988 | },
|
4989 | fail: function fail(data, code) {
|
4990 | res.errMsg = data;
|
4991 | res.code = code;
|
4992 | _fail9 && _fail9(res);
|
4993 | complete && complete(res);
|
4994 | reject(res);
|
4995 | }
|
4996 | });
|
4997 | });
|
4998 | }
|
4999 | function getSystemPlatform() {
|
5000 | return device.platform;
|
5001 | }
|
5002 | var unSupportApis$1 = ['getSystemInfoSync'];
|
5003 | unSupportApis$1 = generateUnSupportApi('快应用暂不支持SystemInfo的同步接口', unSupportApis$1);
|
5004 | var qSystem = {
|
5005 | getSystemInfo: getSystemInfo,
|
5006 | getSystemId: getSystemId,
|
5007 | getSystemDeviceId: getSystemDeviceId,
|
5008 | getSystemUserId: getSystemUserId,
|
5009 | getSystemAdvertisingId: getSystemAdvertisingId,
|
5010 | getSystemSerial: getSystemSerial,
|
5011 | getSystemTotalStorage: getSystemTotalStorage,
|
5012 | getSystemAvailableStorage: getSystemAvailableStorage,
|
5013 | getSystemCpuInfo: getSystemCpuInfo,
|
5014 | getSystemPlatform: getSystemPlatform
|
5015 | };
|
5016 | Object.assign(qSystem, unSupportApis$1);
|
5017 |
|
5018 | function webviewLoadUrl() {
|
5019 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5020 | return webview.loadUrl(opts);
|
5021 | }
|
5022 |
|
5023 | function createInnerAudioContext() {
|
5024 | return audio;
|
5025 | }
|
5026 | function getPlayState() {
|
5027 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5028 | var _success = opts.success,
|
5029 | _fail = opts.fail,
|
5030 | complete = opts.complete;
|
5031 | var res = {
|
5032 | errMsg: 'getPlayState:ok'
|
5033 | };
|
5034 | return new Promise(function (resolve, reject) {
|
5035 | device.getCpuInfo({
|
5036 | success: function success(data) {
|
5037 | res.result = data;
|
5038 | _success && _success(data);
|
5039 | resolve(res);
|
5040 | },
|
5041 | fail: function fail(data, code) {
|
5042 | res.errMsg = data;
|
5043 | res.code = code;
|
5044 | _fail && _fail(res);
|
5045 | complete && complete(res);
|
5046 | reject(res);
|
5047 | }
|
5048 | });
|
5049 | });
|
5050 | }
|
5051 | function startRecord() {
|
5052 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5053 | var duration = opts.duration,
|
5054 | sampleRate = opts.sampleRate,
|
5055 | numberOfChannels = opts.numberOfChannels,
|
5056 | encodeBitRate = opts.encodeBitRate,
|
5057 | format = opts.format,
|
5058 | _success2 = opts.success,
|
5059 | _fail2 = opts.fail,
|
5060 | complete = opts.complete;
|
5061 | var res = {
|
5062 | errMsg: 'startRecord:ok'
|
5063 | };
|
5064 | return new Promise(function (resolve, reject) {
|
5065 | record.start({
|
5066 | duration: duration,
|
5067 | sampleRate: sampleRate,
|
5068 | numberOfChannels: numberOfChannels,
|
5069 | encodeBitRate: encodeBitRate,
|
5070 | format: format,
|
5071 | success: function success(data) {
|
5072 | res.result = data;
|
5073 | _success2 && _success2(data);
|
5074 | resolve(res);
|
5075 | },
|
5076 | fail: function fail(data, code) {
|
5077 | res.errMsg = data;
|
5078 | res.code = code;
|
5079 | _fail2 && _fail2(res);
|
5080 | complete && complete(res);
|
5081 | reject(res);
|
5082 | }
|
5083 | });
|
5084 | });
|
5085 | }
|
5086 | function stopRecord() {
|
5087 | return record.stop();
|
5088 | }
|
5089 |
|
5090 | function getContactPick() {
|
5091 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5092 | var _success = opts.success,
|
5093 | _fail = opts.fail,
|
5094 | complete = opts.complete;
|
5095 | var res = {
|
5096 | errMsg: 'getContactPick:ok'
|
5097 | };
|
5098 | return new Promise(function (resolve, reject) {
|
5099 | contact.pick({
|
5100 | success: function success(data) {
|
5101 | res.result = data;
|
5102 | _success && _success(data);
|
5103 | resolve(res);
|
5104 | },
|
5105 | fail: function fail(data, code) {
|
5106 | res.errMsg = data;
|
5107 | res.code = code;
|
5108 | _fail && _fail(res);
|
5109 | complete && complete(res);
|
5110 | reject(res);
|
5111 | }
|
5112 | });
|
5113 | });
|
5114 | }
|
5115 | function getContactList() {
|
5116 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5117 | var _success2 = opts.success,
|
5118 | _fail2 = opts.fail,
|
5119 | complete = opts.complete;
|
5120 | var res = {
|
5121 | errMsg: 'getContactList:ok'
|
5122 | };
|
5123 | return new Promise(function (resolve, reject) {
|
5124 | contact.list({
|
5125 | success: function success(data) {
|
5126 | res.result = data;
|
5127 | _success2 && _success2(data);
|
5128 | resolve(res);
|
5129 | },
|
5130 | fail: function fail(data, code) {
|
5131 | res.errMsg = data;
|
5132 | res.code = code;
|
5133 | _fail2 && _fail2(res);
|
5134 | complete && complete(res);
|
5135 | reject(res);
|
5136 | }
|
5137 | });
|
5138 | });
|
5139 | }
|
5140 | function sendSms() {
|
5141 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5142 | var address = opts.address,
|
5143 | content = opts.content,
|
5144 | _success3 = opts.success,
|
5145 | _fail3 = opts.fail,
|
5146 | complete = opts.complete;
|
5147 | var res = {
|
5148 | errMsg: 'sendSms:ok'
|
5149 | };
|
5150 | return new Promise(function (resolve, reject) {
|
5151 | sms.send({
|
5152 | address: address,
|
5153 | content: content,
|
5154 | success: function success(data) {
|
5155 | res.result = data;
|
5156 | _success3 && _success3(data);
|
5157 | resolve(res);
|
5158 | },
|
5159 | fail: function fail(data, code) {
|
5160 | res.errMsg = data;
|
5161 | res.code = code;
|
5162 | _fail3 && _fail3(res);
|
5163 | complete && complete(res);
|
5164 | reject(res);
|
5165 | }
|
5166 | });
|
5167 | });
|
5168 | }
|
5169 | function readSmsSafely() {
|
5170 | var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5171 | var timeout = opts.timeout,
|
5172 | _success4 = opts.success,
|
5173 | _fail4 = opts.fail,
|
5174 | complete = opts.complete;
|
5175 | var res = {
|
5176 | errMsg: 'sendSms:ok'
|
5177 | };
|
5178 | return new Promise(function (resolve, reject) {
|
5179 | sms.readSafely({
|
5180 | timeout: timeout,
|
5181 | success: function success(data) {
|
5182 | res.result = data;
|
5183 | _success4 && _success4(data);
|
5184 | resolve(res);
|
5185 | },
|
5186 | fail: function fail(data, code) {
|
5187 | res.errMsg = data;
|
5188 | res.code = code;
|
5189 | _fail4 && _fail4(res);
|
5190 | complete && complete(res);
|
5191 | reject(res);
|
5192 | }
|
5193 | });
|
5194 | });
|
5195 | }
|
5196 |
|
5197 | var onSocketOpen = temporarilyNotSupport('onSocketOpen');
|
5198 | var onSocketError = temporarilyNotSupport('onSocketError');
|
5199 | var onSocketMessage = temporarilyNotSupport('onSocketMessage');
|
5200 | var onSocketClose = temporarilyNotSupport('onSocketClose');
|
5201 | var onBackgroundAudioPlay = temporarilyNotSupport('onBackgroundAudioPlay');
|
5202 | var onBackgroundAudioPause = temporarilyNotSupport('onBackgroundAudioPause');
|
5203 | var onBackgroundAudioStop = temporarilyNotSupport('onBackgroundAudioStop');
|
5204 | var onNetworkStatusChange = temporarilyNotSupport('onNetworkStatusChange');
|
5205 |
|
5206 |
|
5207 | var onDeviceMotionChange = temporarilyNotSupport('onDeviceMotionChange');
|
5208 | var onBluetoothAdapterStateChange = temporarilyNotSupport('onBluetoothAdapterStateChange');
|
5209 | var onBluetoothDeviceFound = temporarilyNotSupport('onBluetoothDeviceFound');
|
5210 | var onBLEConnectionStateChange = temporarilyNotSupport('onBLEConnectionStateChange');
|
5211 | var onBLECharacteristicValueChange = temporarilyNotSupport('onBLECharacteristicValueChange');
|
5212 | var onBeaconUpdate = temporarilyNotSupport('onBeaconUpdate');
|
5213 | var onBeaconServiceChange = temporarilyNotSupport('onBeaconServiceChange');
|
5214 | var onUserCaptureScreen = temporarilyNotSupport('onUserCaptureScreen');
|
5215 | var onHCEMessage = temporarilyNotSupport('onHCEMessage');
|
5216 | var onGetWifiList = temporarilyNotSupport('onGetWifiList');
|
5217 | var onWifiConnected = temporarilyNotSupport('onWifiConnected');
|
5218 | var setStorageSync = temporarilyNotSupport('setStorageSync');
|
5219 | var getStorageSync = temporarilyNotSupport('getStorageSync');
|
5220 | var getStorageInfoSync = temporarilyNotSupport('getStorageInfoSync');
|
5221 | var removeStorageSync = temporarilyNotSupport('removeStorageSync');
|
5222 | var clearStorageSync = temporarilyNotSupport('clearStorageSync');
|
5223 | var getSystemInfoSync = temporarilyNotSupport('getSystemInfoSync');
|
5224 | var getExtConfigSync = temporarilyNotSupport('getExtConfigSync');
|
5225 | var getLogManager = temporarilyNotSupport('getLogManager');
|
5226 | var onMemoryWarning = temporarilyNotSupport('onMemoryWarning');
|
5227 | var reportAnalytics = temporarilyNotSupport('reportAnalytics');
|
5228 | var navigateToSmartGameProgram = temporarilyNotSupport('navigateToSmartGameProgram');
|
5229 |
|
5230 | var getFileSystemManager = temporarilyNotSupport('getFileSystemManager');
|
5231 |
|
5232 |
|
5233 |
|
5234 | var getRecorderManager = temporarilyNotSupport('getRecorderManager');
|
5235 | var pauseVoice = temporarilyNotSupport('pauseVoice');
|
5236 | var stopVoice = temporarilyNotSupport('stopVoice');
|
5237 | var pauseBackgroundAudio = temporarilyNotSupport('pauseBackgroundAudio');
|
5238 | var stopBackgroundAudio = temporarilyNotSupport('stopBackgroundAudio');
|
5239 | var getBackgroundAudioManager = temporarilyNotSupport('getBackgroundAudioManager');
|
5240 | var createAudioContext = temporarilyNotSupport('createAudioContext');
|
5241 |
|
5242 | var createVideoContext = temporarilyNotSupport('createVideoContext');
|
5243 | var createCameraContext = temporarilyNotSupport('createCameraContext');
|
5244 | var createLivePlayerContext = temporarilyNotSupport('createLivePlayerContext');
|
5245 | var createLivePusherContext = temporarilyNotSupport('createLivePusherContext');
|
5246 |
|
5247 | var createMapContext = temporarilyNotSupport('createMapContext');
|
5248 |
|
5249 | var canIUse = temporarilyNotSupport('canIUse');
|
5250 |
|
5251 |
|
5252 |
|
5253 |
|
5254 | var startDeviceMotionListening = temporarilyNotSupport('startDeviceMotionListening');
|
5255 | var stopDeviceMotionListening = temporarilyNotSupport('stopDeviceMotionListening');
|
5256 |
|
5257 | var hideToast = temporarilyNotSupport('hideToast');
|
5258 | var hideLoading = temporarilyNotSupport('hideLoading');
|
5259 | var showNavigationBarLoading = temporarilyNotSupport('showNavigationBarLoading');
|
5260 | var hideNavigationBarLoading = temporarilyNotSupport('hideNavigationBarLoading');
|
5261 | var createAnimation = temporarilyNotSupport('createAnimation');
|
5262 | var pageScrollTo = temporarilyNotSupport('pageScrollTo');
|
5263 | var createSelectorQuery = temporarilyNotSupport('createSelectorQuery');
|
5264 | var createCanvasContext = temporarilyNotSupport('createCanvasContext');
|
5265 | var createContext = temporarilyNotSupport('createContext');
|
5266 | var drawCanvas = temporarilyNotSupport('drawCanvas');
|
5267 | var hideKeyboard = temporarilyNotSupport('hideKeyboard');
|
5268 |
|
5269 | var createIntersectionObserver = temporarilyNotSupport('createIntersectionObserver');
|
5270 |
|
5271 | var nextTick$1 = temporarilyNotSupport('nextTick');
|
5272 |
|
5273 | var getMenuButtonBoundingClientRect = temporarilyNotSupport('getMenuButtonBoundingClientRect');
|
5274 |
|
5275 | var onWindowResize = temporarilyNotSupport('onWindowResize');
|
5276 | var offWindowResize = temporarilyNotSupport('offWindowResize');
|
5277 |
|
5278 | var arrayBufferToBase64 = temporarilyNotSupport('arrayBufferToBase64');
|
5279 | var base64ToArrayBuffer = temporarilyNotSupport('base64ToArrayBuffer');
|
5280 | var getAccountInfoSync = temporarilyNotSupport('getAccountInfoSync');
|
5281 | var getUpdateManager = temporarilyNotSupport('getUpdateManager');
|
5282 | var createWorker = temporarilyNotSupport('createWorker');
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 | var connectSocket = temporarilyNotSupport('connectSocket');
|
5288 | var sendSocketMessage = temporarilyNotSupport('sendSocketMessage');
|
5289 | var closeSocket = temporarilyNotSupport('closeSocket');
|
5290 |
|
5291 | var chooseImage = temporarilyNotSupport('chooseImage');
|
5292 | var previewImage = temporarilyNotSupport('previewImage');
|
5293 | var getImageInfo = temporarilyNotSupport('getImageInfo');
|
5294 | var saveImageToPhotosAlbum = temporarilyNotSupport('saveImageToPhotosAlbum');
|
5295 |
|
5296 | var playVoice = temporarilyNotSupport('playVoice');
|
5297 | var setInnerAudioOption = temporarilyNotSupport('setInnerAudioOption');
|
5298 | var getAvailableAudioSources = temporarilyNotSupport('getAvailableAudioSources');
|
5299 | var getBackgroundAudioPlayerState = temporarilyNotSupport('getBackgroundAudioPlayerState');
|
5300 | var playBackgroundAudio = temporarilyNotSupport('playBackgroundAudio');
|
5301 | var seekBackgroundAudio = temporarilyNotSupport('seekBackgroundAudio');
|
5302 | var chooseVideo = temporarilyNotSupport('chooseVideo');
|
5303 | var saveVideoToPhotosAlbum = temporarilyNotSupport('saveVideoToPhotosAlbum');
|
5304 | var loadFontFace = temporarilyNotSupport('loadFontFace');
|
5305 |
|
5306 | var saveFile = temporarilyNotSupport('saveFile');
|
5307 | var getFileInfo = temporarilyNotSupport('getFileInfo');
|
5308 | var getSavedFileList = temporarilyNotSupport('getSavedFileList');
|
5309 | var getSavedFileInfo = temporarilyNotSupport('getSavedFileInfo');
|
5310 | var removeSavedFile = temporarilyNotSupport('removeSavedFile');
|
5311 | var openDocument = temporarilyNotSupport('openDocument');
|
5312 |
|
5313 |
|
5314 |
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 | var chooseLocation = temporarilyNotSupport('chooseLocation');
|
5327 | var openLocation = temporarilyNotSupport('openLocation');
|
5328 |
|
5329 |
|
5330 | var getNetworkType = temporarilyNotSupport('getNetworkType');
|
5331 | var makePhoneCall = temporarilyNotSupport('makePhoneCall');
|
5332 |
|
5333 |
|
5334 |
|
5335 | var openBluetoothAdapter = temporarilyNotSupport('openBluetoothAdapter');
|
5336 | var closeBluetoothAdapter = temporarilyNotSupport('closeBluetoothAdapter');
|
5337 | var getBluetoothAdapterState = temporarilyNotSupport('getBluetoothAdapterState');
|
5338 | var startBluetoothDevicesDiscovery = temporarilyNotSupport('startBluetoothDevicesDiscovery');
|
5339 | var stopBluetoothDevicesDiscovery = temporarilyNotSupport('stopBluetoothDevicesDiscovery');
|
5340 | var getBluetoothDevices = temporarilyNotSupport('getBluetoothDevices');
|
5341 | var getConnectedBluetoothDevices = temporarilyNotSupport('getConnectedBluetoothDevices');
|
5342 | var createBLEConnection = temporarilyNotSupport('createBLEConnection');
|
5343 | var closeBLEConnection = temporarilyNotSupport('closeBLEConnection');
|
5344 | var getBLEDeviceServices = temporarilyNotSupport('getBLEDeviceServices');
|
5345 | var getBLEDeviceCharacteristics = temporarilyNotSupport('getBLEDeviceCharacteristics');
|
5346 | var readBLECharacteristicValue = temporarilyNotSupport('readBLECharacteristicValue');
|
5347 | var writeBLECharacteristicValue = temporarilyNotSupport('writeBLECharacteristicValue');
|
5348 | var notifyBLECharacteristicValueChange = temporarilyNotSupport('notifyBLECharacteristicValueChange');
|
5349 | var startBeaconDiscovery = temporarilyNotSupport('startBeaconDiscovery');
|
5350 | var stopBeaconDiscovery = temporarilyNotSupport('stopBeaconDiscovery');
|
5351 | var getBeacons = temporarilyNotSupport('getBeacons');
|
5352 | var setScreenBrightness = temporarilyNotSupport('setScreenBrightness');
|
5353 | var getScreenBrightness = temporarilyNotSupport('getScreenBrightness');
|
5354 | var setKeepScreenOn = temporarilyNotSupport('setKeepScreenOn');
|
5355 |
|
5356 |
|
5357 | var addPhoneContact = temporarilyNotSupport('addPhoneContact');
|
5358 | var getHCEState = temporarilyNotSupport('getHCEState');
|
5359 | var startHCE = temporarilyNotSupport('startHCE');
|
5360 | var stopHCE = temporarilyNotSupport('stopHCE');
|
5361 | var sendHCEMessage = temporarilyNotSupport('sendHCEMessage');
|
5362 | var startWifi = temporarilyNotSupport('startWifi');
|
5363 | var stopWifi = temporarilyNotSupport('stopWifi');
|
5364 | var connectWifi = temporarilyNotSupport('connectWifi');
|
5365 | var getWifiList = temporarilyNotSupport('getWifiList');
|
5366 | var setWifiList = temporarilyNotSupport('setWifiList');
|
5367 | var getConnectedWifi = temporarilyNotSupport('getConnectedWifi');
|
5368 |
|
5369 |
|
5370 | var showLoading = temporarilyNotSupport('showLoading');
|
5371 |
|
5372 |
|
5373 |
|
5374 |
|
5375 | var setTabBarBadge = temporarilyNotSupport('setTabBarBadge');
|
5376 | var removeTabBarBadge = temporarilyNotSupport('removeTabBarBadge');
|
5377 | var showTabBarRedDot = temporarilyNotSupport('showTabBarRedDot');
|
5378 | var hideTabBarRedDot = temporarilyNotSupport('hideTabBarRedDot');
|
5379 | var setTabBarStyle = temporarilyNotSupport('setTabBarStyle');
|
5380 | var setTabBarItem = temporarilyNotSupport('setTabBarItem');
|
5381 | var showTabBar = temporarilyNotSupport('showTabBar');
|
5382 | var hideTabBar = temporarilyNotSupport('hideTabBar');
|
5383 | var setTopBarText = temporarilyNotSupport('setTopBarText');
|
5384 |
|
5385 | var canvasToTempFilePath = temporarilyNotSupport('canvasToTempFilePath');
|
5386 | var canvasGetImageData = temporarilyNotSupport('canvasGetImageData');
|
5387 | var canvasPutImageData = temporarilyNotSupport('canvasPutImageData');
|
5388 | var setBackgroundColor = temporarilyNotSupport('setBackgroundColor');
|
5389 | var setBackgroundTextStyle = temporarilyNotSupport('setBackgroundTextStyle');
|
5390 |
|
5391 | var getExtConfig = temporarilyNotSupport('getExtConfig');
|
5392 |
|
5393 | var login = temporarilyNotSupport('login');
|
5394 | var checkSession = temporarilyNotSupport('checkSession');
|
5395 | var authorize = temporarilyNotSupport('authorize');
|
5396 | var getUserInfo = temporarilyNotSupport('getUserInfo');
|
5397 | var checkIsSupportFacialRecognition = temporarilyNotSupport('checkIsSupportFacialRecognition');
|
5398 | var startFacialRecognitionVerify = temporarilyNotSupport('startFacialRecognitionVerify');
|
5399 | var startFacialRecognitionVerifyAndUploadVideo = temporarilyNotSupport('startFacialRecognitionVerifyAndUploadVideo');
|
5400 | var faceVerifyForPay = temporarilyNotSupport('faceVerifyForPay');
|
5401 | var requestPayment = temporarilyNotSupport('requestPayment');
|
5402 |
|
5403 | var hideShareMenu = temporarilyNotSupport('hideShareMenu');
|
5404 | var updateShareMenu = temporarilyNotSupport('updateShareMenu');
|
5405 | var getShareInfo = temporarilyNotSupport('getShareInfo');
|
5406 | var chooseAddress = temporarilyNotSupport('chooseAddress');
|
5407 | var addCard = temporarilyNotSupport('addCard');
|
5408 | var openCard = temporarilyNotSupport('openCard');
|
5409 | var openSetting = temporarilyNotSupport('openSetting');
|
5410 | var getSetting = temporarilyNotSupport('getSetting');
|
5411 | var getWeRunData = temporarilyNotSupport('getWeRunData');
|
5412 | var navigateToMiniProgram = temporarilyNotSupport('navigateToMiniProgram');
|
5413 | var navigateBackMiniProgram = temporarilyNotSupport('navigateBackMiniProgram');
|
5414 | var chooseInvoice = temporarilyNotSupport('chooseInvoice');
|
5415 | var chooseInvoiceTitle = temporarilyNotSupport('chooseInvoiceTitle');
|
5416 | var checkIsSupportSoterAuthentication = temporarilyNotSupport('checkIsSupportSoterAuthentication');
|
5417 | var startSoterAuthentication = temporarilyNotSupport('startSoterAuthentication');
|
5418 | var checkIsSoterEnrolledInDevice = temporarilyNotSupport('checkIsSoterEnrolledInDevice');
|
5419 | var setEnableDebug = temporarilyNotSupport('setEnableDebug');
|
5420 |
|
5421 |
|
5422 | var ocrIdCard = temporarilyNotSupport('ocrIdCard');
|
5423 | var ocrBankCard = temporarilyNotSupport('ocrBankCard');
|
5424 | var ocrDrivingLicense = temporarilyNotSupport('ocrDrivingLicense');
|
5425 | var ocrVehicleLicense = temporarilyNotSupport('ocrVehicleLicense');
|
5426 | var textReview = temporarilyNotSupport('textReview');
|
5427 | var textToAudio = temporarilyNotSupport('textToAudio');
|
5428 | var imageAudit = temporarilyNotSupport('imageAudit');
|
5429 | var advancedGeneralIdentify = temporarilyNotSupport('advancedGeneralIdentify');
|
5430 | var objectDetectIdentify = temporarilyNotSupport('objectDetectIdentify');
|
5431 | var carClassify = temporarilyNotSupport('carClassify');
|
5432 | var dishClassify = temporarilyNotSupport('dishClassify');
|
5433 | var logoClassify = temporarilyNotSupport('logoClassify');
|
5434 | var animalClassify = temporarilyNotSupport('animalClassify');
|
5435 | var plantClassify = temporarilyNotSupport('plantClassify');
|
5436 |
|
5437 | var getSwanId = temporarilyNotSupport('getSwanId');
|
5438 |
|
5439 | var requestPolymerPayment = temporarilyNotSupport('requestPolymerPayment');
|
5440 |
|
5441 | var navigateToSmartProgram = temporarilyNotSupport('navigateToSmartProgram');
|
5442 | var navigateBackSmartProgram = temporarilyNotSupport('navigateBackSmartProgram');
|
5443 | var preloadSubPackage = temporarilyNotSupport('preloadSubPackage');
|
5444 |
|
5445 |
|
5446 |
|
5447 | var supportApi = Object.freeze({
|
5448 | request: request,
|
5449 | uploadFile: uploadFile,
|
5450 | downloadFile: downloadFile,
|
5451 | setStorage: setStorage,
|
5452 | getStorage: getStorage,
|
5453 | getStorageInfo: getStorageInfo,
|
5454 | removeStorage: removeStorage,
|
5455 | clearStorage: clearStorage,
|
5456 | navigateTo: navigateTo,
|
5457 | redirectTo: redirectTo,
|
5458 | navigateBack: navigateBack,
|
5459 | switchTab: switchTab,
|
5460 | getCurrentPages: getCurrentPages$1,
|
5461 | reLaunch: reLaunch,
|
5462 | showToast: showToast,
|
5463 | showModal: showModal,
|
5464 | showActionSheet: showActionSheet,
|
5465 | setNavigationBarTitle: setNavigationBarTitle,
|
5466 | setNavigationBarColor: setNavigationBarColor,
|
5467 | startPullDownRefresh: startPullDownRefresh,
|
5468 | stopPullDownRefresh: stopPullDownRefresh,
|
5469 | scanCode: scanCode,
|
5470 | vibrateShort: vibrateShort,
|
5471 | vibrateLong: vibrateLong,
|
5472 | setClipboardData: setClipboardData,
|
5473 | getClipboardData: getClipboardData,
|
5474 | startAccelerometer: startAccelerometer,
|
5475 | stopAccelerometer: stopAccelerometer,
|
5476 | onAccelerometerChange: onAccelerometerChange,
|
5477 | startCompass: startCompass,
|
5478 | stopCompass: stopCompass,
|
5479 | onCompassChange: onCompassChange,
|
5480 | getLocation: getLocation,
|
5481 | showShareMenu: showShareMenu,
|
5482 | showNotification: showNotification,
|
5483 | getSystemInfo: getSystemInfo,
|
5484 | getSystemId: getSystemId,
|
5485 | getSystemDeviceId: getSystemDeviceId,
|
5486 | getSystemUserId: getSystemUserId,
|
5487 | getSystemAdvertisingId: getSystemAdvertisingId,
|
5488 | getSystemSerial: getSystemSerial,
|
5489 | getSystemTotalStorage: getSystemTotalStorage,
|
5490 | getSystemAvailableStorage: getSystemAvailableStorage,
|
5491 | getSystemCpuInfo: getSystemCpuInfo,
|
5492 | getSystemPlatform: getSystemPlatform,
|
5493 | webviewLoadUrl: webviewLoadUrl,
|
5494 | createInnerAudioContext: createInnerAudioContext,
|
5495 | getPlayState: getPlayState,
|
5496 | startRecord: startRecord,
|
5497 | stopRecord: stopRecord,
|
5498 | getContactPick: getContactPick,
|
5499 | getContactList: getContactList,
|
5500 | sendSms: sendSms,
|
5501 | readSmsSafely: readSmsSafely,
|
5502 | onSocketOpen: onSocketOpen,
|
5503 | onSocketError: onSocketError,
|
5504 | onSocketMessage: onSocketMessage,
|
5505 | onSocketClose: onSocketClose,
|
5506 | onBackgroundAudioPlay: onBackgroundAudioPlay,
|
5507 | onBackgroundAudioPause: onBackgroundAudioPause,
|
5508 | onBackgroundAudioStop: onBackgroundAudioStop,
|
5509 | onNetworkStatusChange: onNetworkStatusChange,
|
5510 | onDeviceMotionChange: onDeviceMotionChange,
|
5511 | onBluetoothAdapterStateChange: onBluetoothAdapterStateChange,
|
5512 | onBluetoothDeviceFound: onBluetoothDeviceFound,
|
5513 | onBLEConnectionStateChange: onBLEConnectionStateChange,
|
5514 | onBLECharacteristicValueChange: onBLECharacteristicValueChange,
|
5515 | onBeaconUpdate: onBeaconUpdate,
|
5516 | onBeaconServiceChange: onBeaconServiceChange,
|
5517 | onUserCaptureScreen: onUserCaptureScreen,
|
5518 | onHCEMessage: onHCEMessage,
|
5519 | onGetWifiList: onGetWifiList,
|
5520 | onWifiConnected: onWifiConnected,
|
5521 | setStorageSync: setStorageSync,
|
5522 | getStorageSync: getStorageSync,
|
5523 | getStorageInfoSync: getStorageInfoSync,
|
5524 | removeStorageSync: removeStorageSync,
|
5525 | clearStorageSync: clearStorageSync,
|
5526 | getSystemInfoSync: getSystemInfoSync,
|
5527 | getExtConfigSync: getExtConfigSync,
|
5528 | getLogManager: getLogManager,
|
5529 | onMemoryWarning: onMemoryWarning,
|
5530 | reportAnalytics: reportAnalytics,
|
5531 | navigateToSmartGameProgram: navigateToSmartGameProgram,
|
5532 | getFileSystemManager: getFileSystemManager,
|
5533 | getRecorderManager: getRecorderManager,
|
5534 | pauseVoice: pauseVoice,
|
5535 | stopVoice: stopVoice,
|
5536 | pauseBackgroundAudio: pauseBackgroundAudio,
|
5537 | stopBackgroundAudio: stopBackgroundAudio,
|
5538 | getBackgroundAudioManager: getBackgroundAudioManager,
|
5539 | createAudioContext: createAudioContext,
|
5540 | createVideoContext: createVideoContext,
|
5541 | createCameraContext: createCameraContext,
|
5542 | createLivePlayerContext: createLivePlayerContext,
|
5543 | createLivePusherContext: createLivePusherContext,
|
5544 | createMapContext: createMapContext,
|
5545 | canIUse: canIUse,
|
5546 | startDeviceMotionListening: startDeviceMotionListening,
|
5547 | stopDeviceMotionListening: stopDeviceMotionListening,
|
5548 | hideToast: hideToast,
|
5549 | hideLoading: hideLoading,
|
5550 | showNavigationBarLoading: showNavigationBarLoading,
|
5551 | hideNavigationBarLoading: hideNavigationBarLoading,
|
5552 | createAnimation: createAnimation,
|
5553 | pageScrollTo: pageScrollTo,
|
5554 | createSelectorQuery: createSelectorQuery,
|
5555 | createCanvasContext: createCanvasContext,
|
5556 | createContext: createContext,
|
5557 | drawCanvas: drawCanvas,
|
5558 | hideKeyboard: hideKeyboard,
|
5559 | createIntersectionObserver: createIntersectionObserver,
|
5560 | nextTick: nextTick$1,
|
5561 | getMenuButtonBoundingClientRect: getMenuButtonBoundingClientRect,
|
5562 | onWindowResize: onWindowResize,
|
5563 | offWindowResize: offWindowResize,
|
5564 | arrayBufferToBase64: arrayBufferToBase64,
|
5565 | base64ToArrayBuffer: base64ToArrayBuffer,
|
5566 | getAccountInfoSync: getAccountInfoSync,
|
5567 | getUpdateManager: getUpdateManager,
|
5568 | createWorker: createWorker,
|
5569 | connectSocket: connectSocket,
|
5570 | sendSocketMessage: sendSocketMessage,
|
5571 | closeSocket: closeSocket,
|
5572 | chooseImage: chooseImage,
|
5573 | previewImage: previewImage,
|
5574 | getImageInfo: getImageInfo,
|
5575 | saveImageToPhotosAlbum: saveImageToPhotosAlbum,
|
5576 | playVoice: playVoice,
|
5577 | setInnerAudioOption: setInnerAudioOption,
|
5578 | getAvailableAudioSources: getAvailableAudioSources,
|
5579 | getBackgroundAudioPlayerState: getBackgroundAudioPlayerState,
|
5580 | playBackgroundAudio: playBackgroundAudio,
|
5581 | seekBackgroundAudio: seekBackgroundAudio,
|
5582 | chooseVideo: chooseVideo,
|
5583 | saveVideoToPhotosAlbum: saveVideoToPhotosAlbum,
|
5584 | loadFontFace: loadFontFace,
|
5585 | saveFile: saveFile,
|
5586 | getFileInfo: getFileInfo,
|
5587 | getSavedFileList: getSavedFileList,
|
5588 | getSavedFileInfo: getSavedFileInfo,
|
5589 | removeSavedFile: removeSavedFile,
|
5590 | openDocument: openDocument,
|
5591 | chooseLocation: chooseLocation,
|
5592 | openLocation: openLocation,
|
5593 | getNetworkType: getNetworkType,
|
5594 | makePhoneCall: makePhoneCall,
|
5595 | openBluetoothAdapter: openBluetoothAdapter,
|
5596 | closeBluetoothAdapter: closeBluetoothAdapter,
|
5597 | getBluetoothAdapterState: getBluetoothAdapterState,
|
5598 | startBluetoothDevicesDiscovery: startBluetoothDevicesDiscovery,
|
5599 | stopBluetoothDevicesDiscovery: stopBluetoothDevicesDiscovery,
|
5600 | getBluetoothDevices: getBluetoothDevices,
|
5601 | getConnectedBluetoothDevices: getConnectedBluetoothDevices,
|
5602 | createBLEConnection: createBLEConnection,
|
5603 | closeBLEConnection: closeBLEConnection,
|
5604 | getBLEDeviceServices: getBLEDeviceServices,
|
5605 | getBLEDeviceCharacteristics: getBLEDeviceCharacteristics,
|
5606 | readBLECharacteristicValue: readBLECharacteristicValue,
|
5607 | writeBLECharacteristicValue: writeBLECharacteristicValue,
|
5608 | notifyBLECharacteristicValueChange: notifyBLECharacteristicValueChange,
|
5609 | startBeaconDiscovery: startBeaconDiscovery,
|
5610 | stopBeaconDiscovery: stopBeaconDiscovery,
|
5611 | getBeacons: getBeacons,
|
5612 | setScreenBrightness: setScreenBrightness,
|
5613 | getScreenBrightness: getScreenBrightness,
|
5614 | setKeepScreenOn: setKeepScreenOn,
|
5615 | addPhoneContact: addPhoneContact,
|
5616 | getHCEState: getHCEState,
|
5617 | startHCE: startHCE,
|
5618 | stopHCE: stopHCE,
|
5619 | sendHCEMessage: sendHCEMessage,
|
5620 | startWifi: startWifi,
|
5621 | stopWifi: stopWifi,
|
5622 | connectWifi: connectWifi,
|
5623 | getWifiList: getWifiList,
|
5624 | setWifiList: setWifiList,
|
5625 | getConnectedWifi: getConnectedWifi,
|
5626 | showLoading: showLoading,
|
5627 | setTabBarBadge: setTabBarBadge,
|
5628 | removeTabBarBadge: removeTabBarBadge,
|
5629 | showTabBarRedDot: showTabBarRedDot,
|
5630 | hideTabBarRedDot: hideTabBarRedDot,
|
5631 | setTabBarStyle: setTabBarStyle,
|
5632 | setTabBarItem: setTabBarItem,
|
5633 | showTabBar: showTabBar,
|
5634 | hideTabBar: hideTabBar,
|
5635 | setTopBarText: setTopBarText,
|
5636 | canvasToTempFilePath: canvasToTempFilePath,
|
5637 | canvasGetImageData: canvasGetImageData,
|
5638 | canvasPutImageData: canvasPutImageData,
|
5639 | setBackgroundColor: setBackgroundColor,
|
5640 | setBackgroundTextStyle: setBackgroundTextStyle,
|
5641 | getExtConfig: getExtConfig,
|
5642 | login: login,
|
5643 | checkSession: checkSession,
|
5644 | authorize: authorize,
|
5645 | getUserInfo: getUserInfo,
|
5646 | checkIsSupportFacialRecognition: checkIsSupportFacialRecognition,
|
5647 | startFacialRecognitionVerify: startFacialRecognitionVerify,
|
5648 | startFacialRecognitionVerifyAndUploadVideo: startFacialRecognitionVerifyAndUploadVideo,
|
5649 | faceVerifyForPay: faceVerifyForPay,
|
5650 | requestPayment: requestPayment,
|
5651 | hideShareMenu: hideShareMenu,
|
5652 | updateShareMenu: updateShareMenu,
|
5653 | getShareInfo: getShareInfo,
|
5654 | chooseAddress: chooseAddress,
|
5655 | addCard: addCard,
|
5656 | openCard: openCard,
|
5657 | openSetting: openSetting,
|
5658 | getSetting: getSetting,
|
5659 | getWeRunData: getWeRunData,
|
5660 | navigateToMiniProgram: navigateToMiniProgram,
|
5661 | navigateBackMiniProgram: navigateBackMiniProgram,
|
5662 | chooseInvoice: chooseInvoice,
|
5663 | chooseInvoiceTitle: chooseInvoiceTitle,
|
5664 | checkIsSupportSoterAuthentication: checkIsSupportSoterAuthentication,
|
5665 | startSoterAuthentication: startSoterAuthentication,
|
5666 | checkIsSoterEnrolledInDevice: checkIsSoterEnrolledInDevice,
|
5667 | setEnableDebug: setEnableDebug,
|
5668 | ocrIdCard: ocrIdCard,
|
5669 | ocrBankCard: ocrBankCard,
|
5670 | ocrDrivingLicense: ocrDrivingLicense,
|
5671 | ocrVehicleLicense: ocrVehicleLicense,
|
5672 | textReview: textReview,
|
5673 | textToAudio: textToAudio,
|
5674 | imageAudit: imageAudit,
|
5675 | advancedGeneralIdentify: advancedGeneralIdentify,
|
5676 | objectDetectIdentify: objectDetectIdentify,
|
5677 | carClassify: carClassify,
|
5678 | dishClassify: dishClassify,
|
5679 | logoClassify: logoClassify,
|
5680 | animalClassify: animalClassify,
|
5681 | plantClassify: plantClassify,
|
5682 | getSwanId: getSwanId,
|
5683 | requestPolymerPayment: requestPolymerPayment,
|
5684 | navigateToSmartProgram: navigateToSmartProgram,
|
5685 | navigateBackSmartProgram: navigateBackSmartProgram,
|
5686 | preloadSubPackage: preloadSubPackage
|
5687 | });
|
5688 |
|
5689 | function processApis(taro$$1) {
|
5690 | var weApis = Object.assign({}, taro.onAndSyncApis, taro.noPromiseApis, taro.otherApis);
|
5691 | Object.keys(weApis).forEach(function (key) {
|
5692 | taro$$1[key] = function () {
|
5693 | console.log("\u6682\u65F6\u4E0D\u652F\u6301 ".concat(key));
|
5694 | };
|
5695 | });
|
5696 | }
|
5697 |
|
5698 | function canIUseWebp() {
|
5699 | return true;
|
5700 | }
|
5701 |
|
5702 | function pxTransform(size) {
|
5703 | return size + 'px';
|
5704 | }
|
5705 |
|
5706 | function getApp() {
|
5707 | return globalRef.$app || {};
|
5708 | }
|
5709 |
|
5710 | function initNativeApi(taro$$1) {
|
5711 | processApis(taro$$1);
|
5712 | taro$$1.canIUseWebp = canIUseWebp;
|
5713 | taro$$1.initPxTransform = taro.initPxTransform.bind(taro$$1);
|
5714 | taro$$1.pxTransform = pxTransform.bind(taro$$1);
|
5715 | taro$$1.getApp = getApp;
|
5716 | Object.assign(taro$$1, supportApi);
|
5717 | }
|
5718 |
|
5719 |
|
5720 | var Taro = {
|
5721 | Component: BaseComponent,
|
5722 | PureComponent: PureComponent,
|
5723 | createApp: createApp,
|
5724 | initNativeApi: initNativeApi,
|
5725 | Events: taro.Events,
|
5726 | eventCenter: taro.eventCenter,
|
5727 | getEnv: taro.getEnv,
|
5728 | render: taro.render,
|
5729 | ENV_TYPE: taro.ENV_TYPE,
|
5730 | internal_safe_get: taro.internal_safe_get,
|
5731 | internal_safe_set: taro.internal_safe_set,
|
5732 | internal_inline_style: taro.internal_inline_style,
|
5733 | createComponent: createComponent,
|
5734 | internal_get_original: taro.internal_get_original,
|
5735 | interceptors: taro.interceptors,
|
5736 | propsManager: propsManager,
|
5737 | genCompid: genCompid,
|
5738 | useEffect: taro.useEffect,
|
5739 | useLayoutEffect: taro.useLayoutEffect,
|
5740 | useReducer: taro.useReducer,
|
5741 | useState: taro.useState,
|
5742 | useDidShow: taro.useDidShow,
|
5743 | useDidHide: taro.useDidHide,
|
5744 | usePullDownRefresh: taro.usePullDownRefresh,
|
5745 | useReachBottom: taro.useReachBottom,
|
5746 | usePageScroll: taro.usePageScroll,
|
5747 | useRouter: taro.useRouter,
|
5748 | useScope: taro.useScope,
|
5749 | useRef: taro.useRef,
|
5750 | useCallback: taro.useCallback,
|
5751 | useMemo: taro.useMemo,
|
5752 | useImperativeHandle: taro.useImperativeHandle,
|
5753 | useContext: taro.useContext,
|
5754 | createContext: taro.createContext,
|
5755 | memo: taro.memo,
|
5756 | shallowEqual: shallowEqual
|
5757 | };
|
5758 | initNativeApi(Taro);
|
5759 |
|
5760 | exports.Taro = Taro;
|
5761 | exports.default = Taro;
|
5762 |
|