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