@tarojs/taro-h5 3.4.5 → 3.5.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/base/system.js +28 -24
- package/dist/api/canvas/CanvasContext.js +27 -16
- package/dist/api/device/accelerometer.js +9 -17
- package/dist/api/device/battery.js +12 -3
- package/dist/api/device/clipboard.js +13 -4
- package/dist/api/device/compass.js +32 -18
- package/dist/api/device/motion.js +8 -17
- package/dist/api/device/network.js +12 -3
- package/dist/api/device/scan.js +8 -4
- package/dist/api/location/chooseLocation.js +13 -8
- package/dist/api/location/getLocation.js +64 -0
- package/dist/api/location/index.js +6 -3
- package/dist/api/media/image/previewImage.js +12 -3
- package/dist/api/taro.js +2 -3
- package/dist/api/ui/fonts.js +12 -3
- package/dist/api/ui/interaction/actionSheet.js +3 -12
- package/dist/api/ui/interaction/index.js +17 -8
- package/dist/api/ui/interaction/modal.js +6 -27
- package/dist/api/ui/interaction/toast.js +14 -40
- package/dist/api/utils/animation.js +14 -0
- package/dist/api/utils/index.js +33 -46
- package/dist/api/utils/lodash.js +29 -0
- package/dist/api/utils/valid.js +7 -0
- package/dist/dist/api/device/scan.d.ts +3 -1
- package/dist/dist/api/location/getLocation.d.ts +2 -0
- package/dist/dist/api/location/index.d.ts +5 -3
- package/dist/dist/api/taro.d.ts +2 -2
- package/dist/dist/api/utils/animation.d.ts +6 -0
- package/dist/dist/api/utils/index.d.ts +11 -10
- package/dist/dist/api/utils/lodash.d.ts +2 -0
- package/dist/dist/api/utils/valid.d.ts +2 -0
- package/dist/index.cjs.js +529 -260
- package/dist/index.cjs.js.map +1 -1
- package/package.json +11 -12
- package/src/api/device/accelerometer.ts +8 -17
- package/src/api/device/compass.ts +34 -18
- package/src/api/device/motion.ts +9 -17
- package/src/api/device/scan.ts +8 -4
- package/src/api/location/getLocation.ts +80 -0
- package/src/api/location/index.ts +6 -3
- package/src/api/taro.ts +2 -7
- package/src/api/ui/scroll/index.ts +1 -1
- package/src/api/utils/animation.ts +15 -0
- package/src/api/utils/index.ts +40 -46
- package/src/api/utils/lodash.ts +30 -0
- package/src/api/utils/valid.ts +8 -0
package/dist/index.cjs.js
CHANGED
|
@@ -17,6 +17,59 @@ var Taro__default = /*#__PURE__*/_interopDefaultLegacy(Taro);
|
|
|
17
17
|
var MobileDetect__default = /*#__PURE__*/_interopDefaultLegacy(MobileDetect);
|
|
18
18
|
var jsonpRetry__default = /*#__PURE__*/_interopDefaultLegacy(jsonpRetry);
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* ease-in-out的函数
|
|
22
|
+
* @param t 0-1的数字
|
|
23
|
+
*/
|
|
24
|
+
const easeInOut = (t) => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1);
|
|
25
|
+
const getTimingFunc = (easeFunc, frameCnt) => {
|
|
26
|
+
return x => {
|
|
27
|
+
if (frameCnt <= 1) {
|
|
28
|
+
return easeFunc(1);
|
|
29
|
+
}
|
|
30
|
+
const t = x / (frameCnt - 1);
|
|
31
|
+
return easeFunc(t);
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function throttle(fn, threshold = 250, scope) {
|
|
36
|
+
let lastTime = 0;
|
|
37
|
+
let deferTimer;
|
|
38
|
+
return function (...args) {
|
|
39
|
+
const context = scope || this;
|
|
40
|
+
const now = Date.now();
|
|
41
|
+
if (now - lastTime > threshold) {
|
|
42
|
+
fn.apply(this, args);
|
|
43
|
+
lastTime = now;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
clearTimeout(deferTimer);
|
|
47
|
+
deferTimer = setTimeout(() => {
|
|
48
|
+
lastTime = now;
|
|
49
|
+
fn.apply(context, args);
|
|
50
|
+
}, threshold);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function debounce(fn, ms = 250, scope) {
|
|
55
|
+
let timer;
|
|
56
|
+
return function (...args) {
|
|
57
|
+
const context = scope || this;
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
timer = setTimeout(function () {
|
|
60
|
+
fn.apply(context, args);
|
|
61
|
+
}, ms);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function isFunction(obj) {
|
|
66
|
+
return typeof obj === 'function';
|
|
67
|
+
}
|
|
68
|
+
const VALID_COLOR_REG = /^#[0-9a-fA-F]{6}$/;
|
|
69
|
+
const isValidColor = (color) => {
|
|
70
|
+
return VALID_COLOR_REG.test(color);
|
|
71
|
+
};
|
|
72
|
+
|
|
20
73
|
/* eslint-disable prefer-promise-reject-errors */
|
|
21
74
|
function shouldBeObject(target) {
|
|
22
75
|
if (target && typeof target === 'object')
|
|
@@ -108,7 +161,7 @@ function temporarilyNotSupport(apiName) {
|
|
|
108
161
|
}
|
|
109
162
|
function weixinCorpSupport(apiName) {
|
|
110
163
|
return () => {
|
|
111
|
-
const errMsg = `h5
|
|
164
|
+
const errMsg = `h5端当前仅在微信公众号JS-SDK环境下支持此 API ${apiName}`;
|
|
112
165
|
if (process.env.NODE_ENV !== 'production') {
|
|
113
166
|
console.error(errMsg);
|
|
114
167
|
return Promise.reject({
|
|
@@ -140,54 +193,38 @@ function permanentlyNotSupport(apiName) {
|
|
|
140
193
|
}
|
|
141
194
|
};
|
|
142
195
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
else if (k === 'fail') {
|
|
167
|
-
reject(res);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
196
|
+
function processOpenApi({ name, defaultOptions, standardMethod, formatOptions = options => options, formatResult = res => res }) {
|
|
197
|
+
const notSupported = weixinCorpSupport(name);
|
|
198
|
+
return (options = {}) => {
|
|
199
|
+
var _a;
|
|
200
|
+
// @ts-ignore
|
|
201
|
+
const targetApi = (_a = window === null || window === void 0 ? void 0 : window.wx) === null || _a === void 0 ? void 0 : _a[name];
|
|
202
|
+
const opts = formatOptions(Object.assign({}, defaultOptions, options));
|
|
203
|
+
if (typeof targetApi === 'function') {
|
|
204
|
+
return new Promise((resolve, reject) => {
|
|
205
|
+
['fail', 'success', 'complete'].forEach(k => {
|
|
206
|
+
opts[k] = preRef => {
|
|
207
|
+
const res = formatResult(preRef);
|
|
208
|
+
options[k] && options[k](res);
|
|
209
|
+
if (k === 'success') {
|
|
210
|
+
resolve(res);
|
|
211
|
+
}
|
|
212
|
+
else if (k === 'fail') {
|
|
213
|
+
reject(res);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
return targetApi(opts);
|
|
217
|
+
});
|
|
170
218
|
});
|
|
171
|
-
// @ts-ignore
|
|
172
|
-
wx[apiName](formatParams(obj));
|
|
173
|
-
});
|
|
174
|
-
return p;
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* ease-in-out的函数
|
|
179
|
-
* @param t 0-1的数字
|
|
180
|
-
*/
|
|
181
|
-
const easeInOut = (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
182
|
-
const getTimingFunc = (easeFunc, frameCnt) => {
|
|
183
|
-
return x => {
|
|
184
|
-
if (frameCnt <= 1) {
|
|
185
|
-
return easeFunc(1);
|
|
186
219
|
}
|
|
187
|
-
|
|
188
|
-
|
|
220
|
+
else if (typeof standardMethod === 'function') {
|
|
221
|
+
return standardMethod(opts);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
return notSupported();
|
|
225
|
+
}
|
|
189
226
|
};
|
|
190
|
-
}
|
|
227
|
+
}
|
|
191
228
|
|
|
192
229
|
// 广告
|
|
193
230
|
const createRewardedVideoAd = temporarilyNotSupport('createRewardedVideoAd');
|
|
@@ -203,6 +240,246 @@ const isVKSupport = temporarilyNotSupport('isVKSupport');
|
|
|
203
240
|
// 视觉算法
|
|
204
241
|
const createVKSession = temporarilyNotSupport('createVKSession');
|
|
205
242
|
|
|
243
|
+
/*! *****************************************************************************
|
|
244
|
+
Copyright (c) Microsoft Corporation.
|
|
245
|
+
|
|
246
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
247
|
+
purpose with or without fee is hereby granted.
|
|
248
|
+
|
|
249
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
250
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
251
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
252
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
253
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
254
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
255
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
256
|
+
***************************************************************************** */
|
|
257
|
+
/* global Reflect, Promise */
|
|
258
|
+
|
|
259
|
+
var extendStatics = function(d, b) {
|
|
260
|
+
extendStatics = Object.setPrototypeOf ||
|
|
261
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
262
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
263
|
+
return extendStatics(d, b);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
function __extends(d, b) {
|
|
267
|
+
if (typeof b !== "function" && b !== null)
|
|
268
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
269
|
+
extendStatics(d, b);
|
|
270
|
+
function __() { this.constructor = d; }
|
|
271
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
var __assign = function() {
|
|
275
|
+
__assign = Object.assign || function __assign(t) {
|
|
276
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
277
|
+
s = arguments[i];
|
|
278
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
279
|
+
}
|
|
280
|
+
return t;
|
|
281
|
+
};
|
|
282
|
+
return __assign.apply(this, arguments);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
function __rest(s, e) {
|
|
286
|
+
var t = {};
|
|
287
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
288
|
+
t[p] = s[p];
|
|
289
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
290
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
291
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
292
|
+
t[p[i]] = s[p[i]];
|
|
293
|
+
}
|
|
294
|
+
return t;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function __decorate(decorators, target, key, desc) {
|
|
298
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
299
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
300
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
301
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function __param(paramIndex, decorator) {
|
|
305
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function __metadata(metadataKey, metadataValue) {
|
|
309
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
313
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
314
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
315
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
316
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
317
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
318
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function __generator(thisArg, body) {
|
|
323
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
324
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
325
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
326
|
+
function step(op) {
|
|
327
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
328
|
+
while (_) try {
|
|
329
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
330
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
331
|
+
switch (op[0]) {
|
|
332
|
+
case 0: case 1: t = op; break;
|
|
333
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
334
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
335
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
336
|
+
default:
|
|
337
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
338
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
339
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
340
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
341
|
+
if (t[2]) _.ops.pop();
|
|
342
|
+
_.trys.pop(); continue;
|
|
343
|
+
}
|
|
344
|
+
op = body.call(thisArg, _);
|
|
345
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
346
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
351
|
+
if (k2 === undefined) k2 = k;
|
|
352
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
353
|
+
}) : (function(o, m, k, k2) {
|
|
354
|
+
if (k2 === undefined) k2 = k;
|
|
355
|
+
o[k2] = m[k];
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
function __exportStar(m, o) {
|
|
359
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function __values(o) {
|
|
363
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
364
|
+
if (m) return m.call(o);
|
|
365
|
+
if (o && typeof o.length === "number") return {
|
|
366
|
+
next: function () {
|
|
367
|
+
if (o && i >= o.length) o = void 0;
|
|
368
|
+
return { value: o && o[i++], done: !o };
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function __read(o, n) {
|
|
375
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
376
|
+
if (!m) return o;
|
|
377
|
+
var i = m.call(o), r, ar = [], e;
|
|
378
|
+
try {
|
|
379
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
380
|
+
}
|
|
381
|
+
catch (error) { e = { error: error }; }
|
|
382
|
+
finally {
|
|
383
|
+
try {
|
|
384
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
385
|
+
}
|
|
386
|
+
finally { if (e) throw e.error; }
|
|
387
|
+
}
|
|
388
|
+
return ar;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** @deprecated */
|
|
392
|
+
function __spread() {
|
|
393
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
394
|
+
ar = ar.concat(__read(arguments[i]));
|
|
395
|
+
return ar;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** @deprecated */
|
|
399
|
+
function __spreadArrays() {
|
|
400
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
401
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
402
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
403
|
+
r[k] = a[j];
|
|
404
|
+
return r;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function __spreadArray(to, from, pack) {
|
|
408
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
409
|
+
if (ar || !(i in from)) {
|
|
410
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
411
|
+
ar[i] = from[i];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function __await(v) {
|
|
418
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
422
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
423
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
424
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
425
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
426
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
427
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
428
|
+
function fulfill(value) { resume("next", value); }
|
|
429
|
+
function reject(value) { resume("throw", value); }
|
|
430
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function __asyncDelegator(o) {
|
|
434
|
+
var i, p;
|
|
435
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
436
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function __asyncValues(o) {
|
|
440
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
441
|
+
var m = o[Symbol.asyncIterator], i;
|
|
442
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
443
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
444
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function __makeTemplateObject(cooked, raw) {
|
|
448
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
449
|
+
return cooked;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
453
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
454
|
+
}) : function(o, v) {
|
|
455
|
+
o["default"] = v;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
function __importStar(mod) {
|
|
459
|
+
if (mod && mod.__esModule) return mod;
|
|
460
|
+
var result = {};
|
|
461
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
462
|
+
__setModuleDefault(result, mod);
|
|
463
|
+
return result;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function __importDefault(mod) {
|
|
467
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
471
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
472
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
473
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
477
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
478
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
479
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
480
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
481
|
+
}
|
|
482
|
+
|
|
206
483
|
class MethodHandler {
|
|
207
484
|
constructor({ name, success, fail, complete }) {
|
|
208
485
|
this.methodName = name;
|
|
@@ -408,44 +685,39 @@ const getSystemInfoSync = () => {
|
|
|
408
685
|
const appBaseInfo = getAppBaseInfo();
|
|
409
686
|
const appAuthorizeSetting = getAppAuthorizeSetting();
|
|
410
687
|
delete deviceInfo.abi;
|
|
411
|
-
const info = {
|
|
412
|
-
...windowInfo,
|
|
413
|
-
...systemSetting,
|
|
414
|
-
...deviceInfo,
|
|
415
|
-
...appBaseInfo,
|
|
688
|
+
const info = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, windowInfo), systemSetting), deviceInfo), appBaseInfo), {
|
|
416
689
|
/** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
|
|
417
|
-
fontSizeSetting: NaN,
|
|
690
|
+
fontSizeSetting: NaN,
|
|
418
691
|
/** 允许微信使用相册的开关(仅 iOS 有效) */
|
|
419
|
-
albumAuthorized: appAuthorizeSetting.albumAuthorized === 'authorized',
|
|
692
|
+
albumAuthorized: appAuthorizeSetting.albumAuthorized === 'authorized',
|
|
420
693
|
/** 允许微信使用摄像头的开关 */
|
|
421
|
-
cameraAuthorized: appAuthorizeSetting.cameraAuthorized === 'authorized',
|
|
694
|
+
cameraAuthorized: appAuthorizeSetting.cameraAuthorized === 'authorized',
|
|
422
695
|
/** 允许微信使用定位的开关 */
|
|
423
|
-
locationAuthorized: appAuthorizeSetting.locationAuthorized === 'authorized',
|
|
696
|
+
locationAuthorized: appAuthorizeSetting.locationAuthorized === 'authorized',
|
|
424
697
|
/** 允许微信使用麦克风的开关 */
|
|
425
|
-
microphoneAuthorized: appAuthorizeSetting.microphoneAuthorized === 'authorized',
|
|
698
|
+
microphoneAuthorized: appAuthorizeSetting.microphoneAuthorized === 'authorized',
|
|
426
699
|
/** 允许微信通知的开关 */
|
|
427
|
-
notificationAuthorized: appAuthorizeSetting.notificationAuthorized === 'authorized',
|
|
700
|
+
notificationAuthorized: appAuthorizeSetting.notificationAuthorized === 'authorized',
|
|
428
701
|
/** 允许微信通知带有提醒的开关(仅 iOS 有效) */
|
|
429
|
-
notificationAlertAuthorized: appAuthorizeSetting.notificationAlertAuthorized === 'authorized',
|
|
702
|
+
notificationAlertAuthorized: appAuthorizeSetting.notificationAlertAuthorized === 'authorized',
|
|
430
703
|
/** 允许微信通知带有标记的开关(仅 iOS 有效) */
|
|
431
|
-
notificationBadgeAuthorized: appAuthorizeSetting.notificationBadgeAuthorized === 'authorized',
|
|
704
|
+
notificationBadgeAuthorized: appAuthorizeSetting.notificationBadgeAuthorized === 'authorized',
|
|
432
705
|
/** 允许微信通知带有声音的开关(仅 iOS 有效) */
|
|
433
|
-
notificationSoundAuthorized: appAuthorizeSetting.notificationSoundAuthorized === 'authorized',
|
|
706
|
+
notificationSoundAuthorized: appAuthorizeSetting.notificationSoundAuthorized === 'authorized',
|
|
434
707
|
/** 允许微信使用日历的开关 */
|
|
435
|
-
phoneCalendarAuthorized: appAuthorizeSetting.phoneCalendarAuthorized === 'authorized',
|
|
708
|
+
phoneCalendarAuthorized: appAuthorizeSetting.phoneCalendarAuthorized === 'authorized',
|
|
436
709
|
/** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
|
|
437
|
-
locationReducedAccuracy: appAuthorizeSetting.locationReducedAccuracy,
|
|
710
|
+
locationReducedAccuracy: appAuthorizeSetting.locationReducedAccuracy,
|
|
438
711
|
/** 小程序当前运行环境 */
|
|
439
|
-
environment: ''
|
|
440
|
-
};
|
|
712
|
+
environment: '' });
|
|
441
713
|
return info;
|
|
442
714
|
};
|
|
443
715
|
/** 获取系统信息 */
|
|
444
|
-
const getSystemInfoAsync =
|
|
716
|
+
const getSystemInfoAsync = (options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
445
717
|
const { success, fail, complete } = options;
|
|
446
718
|
const handle = new MethodHandler({ name: 'getSystemInfoAsync', success, fail, complete });
|
|
447
719
|
try {
|
|
448
|
-
const info =
|
|
720
|
+
const info = yield getSystemInfoSync();
|
|
449
721
|
return handle.success(info);
|
|
450
722
|
}
|
|
451
723
|
catch (error) {
|
|
@@ -453,13 +725,13 @@ const getSystemInfoAsync = async (options = {}) => {
|
|
|
453
725
|
errMsg: error
|
|
454
726
|
});
|
|
455
727
|
}
|
|
456
|
-
};
|
|
728
|
+
});
|
|
457
729
|
/** 获取系统信息 */
|
|
458
|
-
const getSystemInfo =
|
|
730
|
+
const getSystemInfo = (options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
459
731
|
const { success, fail, complete } = options;
|
|
460
732
|
const handle = new MethodHandler({ name: 'getSystemInfo', success, fail, complete });
|
|
461
733
|
try {
|
|
462
|
-
const info =
|
|
734
|
+
const info = yield getSystemInfoSync();
|
|
463
735
|
return handle.success(info);
|
|
464
736
|
}
|
|
465
737
|
catch (error) {
|
|
@@ -467,7 +739,7 @@ const getSystemInfo = async (options = {}) => {
|
|
|
467
739
|
errMsg: error
|
|
468
740
|
});
|
|
469
741
|
}
|
|
470
|
-
};
|
|
742
|
+
});
|
|
471
743
|
|
|
472
744
|
// 更新
|
|
473
745
|
const updateWeChatApp = temporarilyNotSupport('updateWeChatApp');
|
|
@@ -598,24 +870,26 @@ class CanvasContext {
|
|
|
598
870
|
* 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
|
|
599
871
|
* @todo 每次 draw 都会读取 width 和 height
|
|
600
872
|
*/
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
873
|
+
draw(reserve, callback) {
|
|
874
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
875
|
+
try {
|
|
876
|
+
if (!reserve) {
|
|
877
|
+
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
878
|
+
}
|
|
879
|
+
// 部分 action 是异步的
|
|
880
|
+
for (const { func, args } of this.actions) {
|
|
881
|
+
yield func.apply(this.ctx, args);
|
|
882
|
+
}
|
|
883
|
+
this.emptyActions();
|
|
884
|
+
callback && callback();
|
|
605
885
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
886
|
+
catch (e) {
|
|
887
|
+
/* eslint-disable no-throw-literal */
|
|
888
|
+
throw {
|
|
889
|
+
errMsg: e.message
|
|
890
|
+
};
|
|
609
891
|
}
|
|
610
|
-
|
|
611
|
-
callback && callback();
|
|
612
|
-
}
|
|
613
|
-
catch (e) {
|
|
614
|
-
/* eslint-disable no-throw-literal */
|
|
615
|
-
throw {
|
|
616
|
-
errMsg: e.message
|
|
617
|
-
};
|
|
618
|
-
}
|
|
892
|
+
});
|
|
619
893
|
}
|
|
620
894
|
drawImage(imageResource, ...extra) {
|
|
621
895
|
this.enqueueActions(() => {
|
|
@@ -849,22 +1123,6 @@ const INTERVAL_MAP$1 = {
|
|
|
849
1123
|
frequency: 5
|
|
850
1124
|
}
|
|
851
1125
|
};
|
|
852
|
-
const getDevicemotionListener = interval => {
|
|
853
|
-
let lock;
|
|
854
|
-
let timer;
|
|
855
|
-
return evt => {
|
|
856
|
-
if (lock)
|
|
857
|
-
return;
|
|
858
|
-
lock = true;
|
|
859
|
-
timer && clearTimeout(timer);
|
|
860
|
-
callbackManager$3.trigger({
|
|
861
|
-
x: evt.acceleration.x || 0,
|
|
862
|
-
y: evt.acceleration.y || 0,
|
|
863
|
-
z: evt.acceleration.z || 0
|
|
864
|
-
});
|
|
865
|
-
timer = setTimeout(() => { lock = false; }, interval);
|
|
866
|
-
};
|
|
867
|
-
};
|
|
868
1126
|
/**
|
|
869
1127
|
* 开始监听加速度数据。
|
|
870
1128
|
*/
|
|
@@ -876,7 +1134,14 @@ const startAccelerometer = ({ interval = 'normal', success, fail, complete } = {
|
|
|
876
1134
|
if (devicemotionListener) {
|
|
877
1135
|
stopAccelerometer();
|
|
878
1136
|
}
|
|
879
|
-
devicemotionListener =
|
|
1137
|
+
devicemotionListener = throttle((evt) => {
|
|
1138
|
+
var _a, _b, _c;
|
|
1139
|
+
callbackManager$3.trigger({
|
|
1140
|
+
x: ((_a = evt.acceleration) === null || _a === void 0 ? void 0 : _a.x) || 0,
|
|
1141
|
+
y: ((_b = evt.acceleration) === null || _b === void 0 ? void 0 : _b.y) || 0,
|
|
1142
|
+
z: ((_c = evt.acceleration) === null || _c === void 0 ? void 0 : _c.z) || 0
|
|
1143
|
+
});
|
|
1144
|
+
}, intervalObj.interval);
|
|
880
1145
|
window.addEventListener('devicemotion', devicemotionListener, true);
|
|
881
1146
|
}
|
|
882
1147
|
else {
|
|
@@ -906,12 +1171,12 @@ const checkIsOpenAccessibility = temporarilyNotSupport('checkIsOpenAccessibility
|
|
|
906
1171
|
|
|
907
1172
|
// 电量
|
|
908
1173
|
const getBatteryInfoSync = temporarilyNotSupport('getBatteryInfoSync');
|
|
909
|
-
const getBatteryInfo =
|
|
1174
|
+
const getBatteryInfo = ({ success, fail, complete } = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
910
1175
|
var _a;
|
|
911
1176
|
const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete });
|
|
912
1177
|
try {
|
|
913
1178
|
// @ts-ignore
|
|
914
|
-
const battery =
|
|
1179
|
+
const battery = yield ((_a = navigator.getBattery) === null || _a === void 0 ? void 0 : _a.call(navigator));
|
|
915
1180
|
return handle.success({
|
|
916
1181
|
isCharging: battery.charging,
|
|
917
1182
|
level: Number(battery.level || 0) * 100
|
|
@@ -922,7 +1187,7 @@ const getBatteryInfo = async ({ success, fail, complete } = {}) => {
|
|
|
922
1187
|
errMsg: (error === null || error === void 0 ? void 0 : error.message) || error
|
|
923
1188
|
});
|
|
924
1189
|
}
|
|
925
|
-
};
|
|
1190
|
+
});
|
|
926
1191
|
|
|
927
1192
|
// 蓝牙-通用
|
|
928
1193
|
const stopBluetoothDevicesDiscovery = temporarilyNotSupport('stopBluetoothDevicesDiscovery');
|
|
@@ -1146,7 +1411,7 @@ document.addEventListener('copy', () => {
|
|
|
1146
1411
|
/**
|
|
1147
1412
|
* 设置系统剪贴板的内容
|
|
1148
1413
|
*/
|
|
1149
|
-
const setClipboardData =
|
|
1414
|
+
const setClipboardData = ({ data, success, fail, complete }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1150
1415
|
const handle = new MethodHandler({ name: 'setClipboardData', success, fail, complete });
|
|
1151
1416
|
try {
|
|
1152
1417
|
setStorageSync(CLIPBOARD_STORAGE_NAME, data);
|
|
@@ -1176,11 +1441,11 @@ const setClipboardData = async ({ data, success, fail, complete }) => {
|
|
|
1176
1441
|
catch (e) {
|
|
1177
1442
|
return handle.fail({ errMsg: e.message });
|
|
1178
1443
|
}
|
|
1179
|
-
};
|
|
1444
|
+
});
|
|
1180
1445
|
/**
|
|
1181
1446
|
* 获取系统剪贴板的内容
|
|
1182
1447
|
*/
|
|
1183
|
-
const getClipboardData =
|
|
1448
|
+
const getClipboardData = ({ success, fail, complete } = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1184
1449
|
const handle = new MethodHandler({ name: 'getClipboardData', success, fail, complete });
|
|
1185
1450
|
try {
|
|
1186
1451
|
const data = getStorageSync(CLIPBOARD_STORAGE_NAME);
|
|
@@ -1189,49 +1454,61 @@ const getClipboardData = async ({ success, fail, complete } = {}) => {
|
|
|
1189
1454
|
catch (e) {
|
|
1190
1455
|
return handle.fail({ errMsg: e.message });
|
|
1191
1456
|
}
|
|
1192
|
-
};
|
|
1457
|
+
});
|
|
1193
1458
|
|
|
1194
1459
|
const callbackManager$2 = new CallbackManager();
|
|
1195
1460
|
let compassListener;
|
|
1461
|
+
/**
|
|
1462
|
+
* Note: 按系统类型获取对应绝对 orientation 事件名,因为安卓系统中直接监听 deviceorientation 事件得到的不是绝对 orientation
|
|
1463
|
+
*/
|
|
1464
|
+
const deviceorientationEventName = ['absolutedeviceorientation', 'deviceorientationabsolute', 'deviceorientation'].find(item => {
|
|
1465
|
+
if ('on' + item in window) {
|
|
1466
|
+
return item;
|
|
1467
|
+
}
|
|
1468
|
+
}) || '';
|
|
1196
1469
|
/**
|
|
1197
1470
|
* 停止监听罗盘数据
|
|
1198
1471
|
*/
|
|
1199
1472
|
const stopCompass = ({ success, fail, complete } = {}) => {
|
|
1200
1473
|
const handle = new MethodHandler({ name: 'stopCompass', success, fail, complete });
|
|
1201
1474
|
try {
|
|
1202
|
-
window.removeEventListener(
|
|
1475
|
+
window.removeEventListener(deviceorientationEventName, compassListener, true);
|
|
1203
1476
|
return handle.success();
|
|
1204
1477
|
}
|
|
1205
1478
|
catch (e) {
|
|
1206
1479
|
return handle.fail({ errMsg: e.message });
|
|
1207
1480
|
}
|
|
1208
1481
|
};
|
|
1209
|
-
|
|
1210
|
-
let lock;
|
|
1211
|
-
let timer;
|
|
1212
|
-
return evt => {
|
|
1213
|
-
if (lock)
|
|
1214
|
-
return;
|
|
1215
|
-
lock = true;
|
|
1216
|
-
timer && clearTimeout(timer);
|
|
1217
|
-
callbackManager$2.trigger({
|
|
1218
|
-
direction: 360 - evt.alpha
|
|
1219
|
-
});
|
|
1220
|
-
timer = setTimeout(() => { lock = false; }, interval);
|
|
1221
|
-
};
|
|
1222
|
-
};
|
|
1482
|
+
let CompassChangeTrigger = false;
|
|
1223
1483
|
/**
|
|
1224
1484
|
* 开始监听罗盘数据
|
|
1225
1485
|
*/
|
|
1226
1486
|
const startCompass = ({ success, fail, complete } = {}) => {
|
|
1227
1487
|
const handle = new MethodHandler({ name: 'startCompass', success, fail, complete });
|
|
1228
1488
|
try {
|
|
1229
|
-
if (
|
|
1489
|
+
if (deviceorientationEventName !== '') {
|
|
1230
1490
|
if (compassListener) {
|
|
1231
1491
|
stopCompass();
|
|
1232
1492
|
}
|
|
1233
|
-
compassListener =
|
|
1234
|
-
|
|
1493
|
+
compassListener = throttle((evt) => {
|
|
1494
|
+
const isAndroid = getDeviceInfo().system === 'AndroidOS';
|
|
1495
|
+
if (isAndroid && !evt.absolute && !CompassChangeTrigger) {
|
|
1496
|
+
CompassChangeTrigger = true;
|
|
1497
|
+
console.warn('Warning: In \'onCompassChange\', your browser is not supported to get the orientation relative to the earth, the orientation data will be related to the initial orientation of the device .');
|
|
1498
|
+
}
|
|
1499
|
+
const alpha = evt.alpha || 0;
|
|
1500
|
+
/**
|
|
1501
|
+
* 由于平台差异,accuracy 在 iOS/Android 的值不同。
|
|
1502
|
+
* - iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
|
|
1503
|
+
* - Android:accuracy 是一个 string 类型的枚举值。
|
|
1504
|
+
*/
|
|
1505
|
+
const accuracy = isAndroid ? evt.absolute ? 'high' : 'medium' : alpha;
|
|
1506
|
+
callbackManager$2.trigger({
|
|
1507
|
+
direction: 360 - alpha,
|
|
1508
|
+
accuracy: accuracy
|
|
1509
|
+
});
|
|
1510
|
+
}, 5000);
|
|
1511
|
+
window.addEventListener(deviceorientationEventName, compassListener, true);
|
|
1235
1512
|
}
|
|
1236
1513
|
else {
|
|
1237
1514
|
throw new Error('compass is not supported');
|
|
@@ -1316,22 +1593,6 @@ const stopDeviceMotionListening = ({ success, fail, complete } = {}) => {
|
|
|
1316
1593
|
return handle.fail({ errMsg: e.message });
|
|
1317
1594
|
}
|
|
1318
1595
|
};
|
|
1319
|
-
const getDeviceOrientationListener = interval => {
|
|
1320
|
-
let lock;
|
|
1321
|
-
let timer;
|
|
1322
|
-
return evt => {
|
|
1323
|
-
if (lock)
|
|
1324
|
-
return;
|
|
1325
|
-
lock = true;
|
|
1326
|
-
timer && clearTimeout(timer);
|
|
1327
|
-
callbackManager$1.trigger({
|
|
1328
|
-
alpha: evt.alpha,
|
|
1329
|
-
beta: evt.beta,
|
|
1330
|
-
gamma: evt.gamma
|
|
1331
|
-
});
|
|
1332
|
-
timer = setTimeout(() => { lock = false; }, interval);
|
|
1333
|
-
};
|
|
1334
|
-
};
|
|
1335
1596
|
/**
|
|
1336
1597
|
* 开始监听设备方向的变化。
|
|
1337
1598
|
*/
|
|
@@ -1343,7 +1604,13 @@ const startDeviceMotionListening = ({ interval = 'normal', success, fail, comple
|
|
|
1343
1604
|
if (deviceMotionListener) {
|
|
1344
1605
|
stopDeviceMotionListening();
|
|
1345
1606
|
}
|
|
1346
|
-
deviceMotionListener =
|
|
1607
|
+
deviceMotionListener = throttle((evt) => {
|
|
1608
|
+
callbackManager$1.trigger({
|
|
1609
|
+
alpha: evt.alpha,
|
|
1610
|
+
beta: evt.beta,
|
|
1611
|
+
gamma: evt.gamma
|
|
1612
|
+
});
|
|
1613
|
+
}, intervalObj.interval);
|
|
1347
1614
|
window.addEventListener('deviceorientation', deviceMotionListener, true);
|
|
1348
1615
|
}
|
|
1349
1616
|
else {
|
|
@@ -1414,12 +1681,12 @@ const getNetworkType = (options = {}) => {
|
|
|
1414
1681
|
return handle.success({ networkType });
|
|
1415
1682
|
};
|
|
1416
1683
|
const networkStatusManager = new CallbackManager();
|
|
1417
|
-
const networkStatusListener =
|
|
1418
|
-
const { networkType } =
|
|
1684
|
+
const networkStatusListener = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1685
|
+
const { networkType } = yield getNetworkType();
|
|
1419
1686
|
const isConnected = networkType !== 'none';
|
|
1420
1687
|
const obj = { isConnected, networkType };
|
|
1421
1688
|
networkStatusManager.trigger(obj);
|
|
1422
|
-
};
|
|
1689
|
+
});
|
|
1423
1690
|
/**
|
|
1424
1691
|
* 在最近的八次网络请求中, 出现下列三个现象之一则判定弱网。
|
|
1425
1692
|
* - 出现三次以上连接超时
|
|
@@ -1478,10 +1745,14 @@ const makePhoneCall = (options) => {
|
|
|
1478
1745
|
};
|
|
1479
1746
|
|
|
1480
1747
|
// 扫码
|
|
1481
|
-
const scanCode = processOpenApi(
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1748
|
+
const scanCode = processOpenApi({
|
|
1749
|
+
name: 'scanQRCode',
|
|
1750
|
+
defaultOptions: { needResult: 1 },
|
|
1751
|
+
formatResult: res => ({
|
|
1752
|
+
errMsg: res.errMsg === 'scanQRCode:ok' ? 'scanCode:ok' : res.errMsg,
|
|
1753
|
+
result: res.resultStr
|
|
1754
|
+
})
|
|
1755
|
+
});
|
|
1485
1756
|
|
|
1486
1757
|
// 屏幕
|
|
1487
1758
|
const setVisualEffectOnCapture = temporarilyNotSupport('setVisualEffectOnCapture');
|
|
@@ -1559,6 +1830,69 @@ const getApp = function () {
|
|
|
1559
1830
|
// 自定义组件
|
|
1560
1831
|
const getCurrentInstance = Taro__default["default"].getCurrentInstance;
|
|
1561
1832
|
|
|
1833
|
+
const getLocationByW3CApi = (options) => {
|
|
1834
|
+
var _a;
|
|
1835
|
+
// 断言 options 必须是 Object
|
|
1836
|
+
const isObject = shouldBeObject(options);
|
|
1837
|
+
if (!isObject.flag) {
|
|
1838
|
+
const res = { errMsg: `getLocation:fail ${isObject.msg}` };
|
|
1839
|
+
console.error(res.errMsg);
|
|
1840
|
+
return Promise.reject(res);
|
|
1841
|
+
}
|
|
1842
|
+
// 解构回调函数
|
|
1843
|
+
const { success, fail, complete } = options;
|
|
1844
|
+
const handle = new MethodHandler({ name: 'getLocation', success, fail, complete });
|
|
1845
|
+
// const defaultMaximumAge = 5 * 1000
|
|
1846
|
+
const positionOptions = {
|
|
1847
|
+
enableHighAccuracy: options.isHighAccuracy || (options.altitude != null),
|
|
1848
|
+
// maximumAge: defaultMaximumAge, // 允许取多久以内的缓存位置
|
|
1849
|
+
timeout: options.highAccuracyExpireTime // 高精度定位超时时间
|
|
1850
|
+
};
|
|
1851
|
+
// Web端API实现暂时仅支持GPS坐标系
|
|
1852
|
+
if (((_a = options.type) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== 'WGS84') {
|
|
1853
|
+
return handle.fail({
|
|
1854
|
+
errMsg: 'This coordinate system type is not temporarily supported'
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
// 判断当前浏览器是否支持位置API
|
|
1858
|
+
const geolocationSupported = navigator.geolocation;
|
|
1859
|
+
if (!geolocationSupported) {
|
|
1860
|
+
return handle.fail({
|
|
1861
|
+
errMsg: 'The current browser does not support this feature'
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
// 开始获取位置
|
|
1865
|
+
return new Promise((resolve, reject) => {
|
|
1866
|
+
navigator.geolocation.getCurrentPosition((position) => {
|
|
1867
|
+
const result = {
|
|
1868
|
+
/** 位置的精确度 */
|
|
1869
|
+
accuracy: position.coords.accuracy,
|
|
1870
|
+
/** 高度,单位 m */
|
|
1871
|
+
altitude: position.coords.altitude,
|
|
1872
|
+
/** 水平精度,单位 m */
|
|
1873
|
+
horizontalAccuracy: position.coords.accuracy,
|
|
1874
|
+
/** 纬度,范围为 -90~90,负数表示南纬 */
|
|
1875
|
+
latitude: position.coords.latitude,
|
|
1876
|
+
/** 经度,范围为 -180~180,负数表示西经 */
|
|
1877
|
+
longitude: position.coords.longitude,
|
|
1878
|
+
/** 速度,单位 m/s */
|
|
1879
|
+
speed: position.coords.speed,
|
|
1880
|
+
/** 垂直精度,单位 m(Android 无法获取,返回 0) */
|
|
1881
|
+
verticalAccuracy: position.coords.altitudeAccuracy || 0,
|
|
1882
|
+
/** 调用结果,自动补充 */
|
|
1883
|
+
errMsg: ''
|
|
1884
|
+
};
|
|
1885
|
+
handle.success(result, resolve);
|
|
1886
|
+
}, (error) => {
|
|
1887
|
+
handle.fail({ errMsg: error.message }, reject);
|
|
1888
|
+
}, positionOptions);
|
|
1889
|
+
});
|
|
1890
|
+
};
|
|
1891
|
+
const getLocation = processOpenApi({
|
|
1892
|
+
name: 'getLocation',
|
|
1893
|
+
standardMethod: getLocationByW3CApi
|
|
1894
|
+
});
|
|
1895
|
+
|
|
1562
1896
|
function styleInject(css, ref) {
|
|
1563
1897
|
if ( ref === void 0 ) ref = {};
|
|
1564
1898
|
var insertAt = ref.insertAt;
|
|
@@ -1592,14 +1926,8 @@ styleInject(css_248z,{"insertAt":"top"});
|
|
|
1592
1926
|
|
|
1593
1927
|
function createLocationChooser(handler, key = LOCATION_APIKEY, mapOpt = {}) {
|
|
1594
1928
|
var _a, _b, _c;
|
|
1595
|
-
const { latitude, longitude,
|
|
1596
|
-
const query = {
|
|
1597
|
-
key,
|
|
1598
|
-
type: 1,
|
|
1599
|
-
coord: ((_a = mapOpt.coord) !== null && _a !== void 0 ? _a : [latitude, longitude].every(e => Number(e) >= 0)) ? `${latitude},${longitude}` : undefined,
|
|
1600
|
-
referer: 'myapp',
|
|
1601
|
-
...opts
|
|
1602
|
-
};
|
|
1929
|
+
const { latitude, longitude } = mapOpt, opts = __rest(mapOpt, ["latitude", "longitude"]);
|
|
1930
|
+
const query = Object.assign({ key, type: 1, coord: ((_a = mapOpt.coord) !== null && _a !== void 0 ? _a : [latitude, longitude].every(e => Number(e) >= 0)) ? `${latitude},${longitude}` : undefined, referer: 'myapp' }, opts);
|
|
1603
1931
|
const html = `
|
|
1604
1932
|
<div class='taro_choose_location'>
|
|
1605
1933
|
<div class='taro_choose_location_bar'>
|
|
@@ -1694,12 +2022,14 @@ const chooseLocation = ({ success, fail, complete, mapOpts } = {}) => {
|
|
|
1694
2022
|
const stopLocationUpdate = temporarilyNotSupport('stopLocationUpdate');
|
|
1695
2023
|
const startLocationUpdateBackground = temporarilyNotSupport('startLocationUpdateBackground');
|
|
1696
2024
|
const startLocationUpdate = temporarilyNotSupport('startLocationUpdate');
|
|
1697
|
-
const openLocation = processOpenApi(
|
|
2025
|
+
const openLocation = processOpenApi({
|
|
2026
|
+
name: 'openLocation',
|
|
2027
|
+
defaultOptions: { scale: 18 }
|
|
2028
|
+
});
|
|
1698
2029
|
const onLocationChangeError = temporarilyNotSupport('onLocationChangeError');
|
|
1699
2030
|
const onLocationChange = temporarilyNotSupport('onLocationChange');
|
|
1700
2031
|
const offLocationChangeError = temporarilyNotSupport('offLocationChangeError');
|
|
1701
2032
|
const offLocationChange = temporarilyNotSupport('offLocationChange');
|
|
1702
|
-
const getLocation = processOpenApi('getLocation');
|
|
1703
2033
|
const choosePoi = temporarilyNotSupport('choosePoi');
|
|
1704
2034
|
|
|
1705
2035
|
class InnerAudioContext {
|
|
@@ -1906,7 +2236,7 @@ const createCameraContext = temporarilyNotSupport('createCameraContext');
|
|
|
1906
2236
|
/**
|
|
1907
2237
|
* 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
1908
2238
|
*/
|
|
1909
|
-
const previewImage =
|
|
2239
|
+
const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1910
2240
|
function loadImage(url, loadFail) {
|
|
1911
2241
|
return new Promise((resolve) => {
|
|
1912
2242
|
const item = document.createElement('taro-swiper-item-core');
|
|
@@ -1947,7 +2277,7 @@ const previewImage = async (options) => {
|
|
|
1947
2277
|
swiper.full = true;
|
|
1948
2278
|
let children = [];
|
|
1949
2279
|
try {
|
|
1950
|
-
children =
|
|
2280
|
+
children = yield Promise.all(urls.map(e => loadImage(e, fail)));
|
|
1951
2281
|
}
|
|
1952
2282
|
catch (error) {
|
|
1953
2283
|
return handle.fail({
|
|
@@ -1964,7 +2294,7 @@ const previewImage = async (options) => {
|
|
|
1964
2294
|
container.appendChild(swiper);
|
|
1965
2295
|
document.body.appendChild(container);
|
|
1966
2296
|
return handle.success();
|
|
1967
|
-
};
|
|
2297
|
+
});
|
|
1968
2298
|
|
|
1969
2299
|
/**
|
|
1970
2300
|
* 获取图片信息。网络图片需先配置download域名才能生效。
|
|
@@ -3216,7 +3546,7 @@ const setBackgroundColor = temporarilyNotSupport('setBackgroundColor');
|
|
|
3216
3546
|
const nextTick = Taro__default["default"].nextTick;
|
|
3217
3547
|
|
|
3218
3548
|
// 字体
|
|
3219
|
-
const loadFontFace =
|
|
3549
|
+
const loadFontFace = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3220
3550
|
options = Object.assign({ global: false }, options);
|
|
3221
3551
|
const { success, fail, complete, family, source, desc = {} } = options;
|
|
3222
3552
|
const handle = new MethodHandler({ name: 'loadFontFace', success, fail, complete });
|
|
@@ -3226,7 +3556,7 @@ const loadFontFace = async (options) => {
|
|
|
3226
3556
|
// @ts-ignore
|
|
3227
3557
|
const fontFace = new FontFace(family, source, desc);
|
|
3228
3558
|
try {
|
|
3229
|
-
|
|
3559
|
+
yield fontFace.load();
|
|
3230
3560
|
fonts.add(fontFace);
|
|
3231
3561
|
return handle.success({});
|
|
3232
3562
|
}
|
|
@@ -3264,7 +3594,7 @@ const loadFontFace = async (options) => {
|
|
|
3264
3594
|
document.head.appendChild(style);
|
|
3265
3595
|
return handle.success();
|
|
3266
3596
|
}
|
|
3267
|
-
};
|
|
3597
|
+
});
|
|
3268
3598
|
|
|
3269
3599
|
// 菜单
|
|
3270
3600
|
const getMenuButtonBoundingClientRect = temporarilyNotSupport('getMenuButtonBoundingClientRect');
|
|
@@ -3808,11 +4138,7 @@ class Toast {
|
|
|
3808
4138
|
// style
|
|
3809
4139
|
const { maskStyle, toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle, textStyle } = this.style;
|
|
3810
4140
|
// configuration
|
|
3811
|
-
const config = {
|
|
3812
|
-
...this.options,
|
|
3813
|
-
...options,
|
|
3814
|
-
_type
|
|
3815
|
-
};
|
|
4141
|
+
const config = Object.assign(Object.assign(Object.assign({}, this.options), options), { _type });
|
|
3816
4142
|
// wrapper
|
|
3817
4143
|
this.el = document.createElement('div');
|
|
3818
4144
|
this.el.className = 'taro__toast';
|
|
@@ -3825,27 +4151,18 @@ class Toast {
|
|
|
3825
4151
|
// icon
|
|
3826
4152
|
this.icon = document.createElement('p');
|
|
3827
4153
|
if (config.image) {
|
|
3828
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
3829
|
-
...imageStyle,
|
|
3830
|
-
'background-image': `url(${config.image})`
|
|
3831
|
-
}));
|
|
4154
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, imageStyle), { 'background-image': `url(${config.image})` })));
|
|
3832
4155
|
}
|
|
3833
4156
|
else {
|
|
3834
4157
|
const iconStyle = config.icon === 'loading' ? loadingStyle : config.icon === 'error' ? errrorStyle : successStyle;
|
|
3835
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
3836
|
-
...iconStyle,
|
|
3837
|
-
...(config.icon === 'none' ? { display: 'none' } : {})
|
|
3838
|
-
}));
|
|
4158
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, iconStyle), (config.icon === 'none' ? { display: 'none' } : {}))));
|
|
3839
4159
|
}
|
|
3840
4160
|
// toast
|
|
3841
4161
|
this.toast = document.createElement('div');
|
|
3842
|
-
this.toast.setAttribute('style', inlineStyle({
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
padding: '10px 15px'
|
|
3847
|
-
} : {})
|
|
3848
|
-
}));
|
|
4162
|
+
this.toast.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, toastStyle), (config.icon === 'none' ? {
|
|
4163
|
+
'min-height': '0',
|
|
4164
|
+
padding: '10px 15px'
|
|
4165
|
+
} : {}))));
|
|
3849
4166
|
// title
|
|
3850
4167
|
this.title = document.createElement('p');
|
|
3851
4168
|
this.title.setAttribute('style', inlineStyle(textStyle));
|
|
@@ -3864,11 +4181,7 @@ class Toast {
|
|
|
3864
4181
|
return '';
|
|
3865
4182
|
}
|
|
3866
4183
|
show(options = {}, _type = 'toast') {
|
|
3867
|
-
const config = {
|
|
3868
|
-
...this.options,
|
|
3869
|
-
...options,
|
|
3870
|
-
_type
|
|
3871
|
-
};
|
|
4184
|
+
const config = Object.assign(Object.assign(Object.assign({}, this.options), options), { _type });
|
|
3872
4185
|
if (this.hideOpacityTimer)
|
|
3873
4186
|
clearTimeout(this.hideOpacityTimer);
|
|
3874
4187
|
if (this.hideDisplayTimer)
|
|
@@ -3880,28 +4193,19 @@ class Toast {
|
|
|
3880
4193
|
// image
|
|
3881
4194
|
const { toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle } = this.style;
|
|
3882
4195
|
if (config.image) {
|
|
3883
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
3884
|
-
...imageStyle,
|
|
3885
|
-
'background-image': `url(${config.image})`
|
|
3886
|
-
}));
|
|
4196
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, imageStyle), { 'background-image': `url(${config.image})` })));
|
|
3887
4197
|
}
|
|
3888
4198
|
else {
|
|
3889
4199
|
if (!config.image && config.icon) {
|
|
3890
4200
|
const iconStyle = config.icon === 'loading' ? loadingStyle : config.icon === 'error' ? errrorStyle : successStyle;
|
|
3891
|
-
this.icon.setAttribute('style', inlineStyle({
|
|
3892
|
-
...iconStyle,
|
|
3893
|
-
...(config.icon === 'none' ? { display: 'none' } : {})
|
|
3894
|
-
}));
|
|
4201
|
+
this.icon.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, iconStyle), (config.icon === 'none' ? { display: 'none' } : {}))));
|
|
3895
4202
|
}
|
|
3896
4203
|
}
|
|
3897
4204
|
// toast
|
|
3898
|
-
this.toast.setAttribute('style', inlineStyle({
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
padding: '10px 15px'
|
|
3903
|
-
} : {})
|
|
3904
|
-
}));
|
|
4205
|
+
this.toast.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, toastStyle), (config.icon === 'none' ? {
|
|
4206
|
+
'min-height': '0',
|
|
4207
|
+
padding: '10px 15px'
|
|
4208
|
+
} : {}))));
|
|
3905
4209
|
// show
|
|
3906
4210
|
this.el.style.display = 'block';
|
|
3907
4211
|
setTimeout(() => { this.el.style.opacity = '1'; }, 0);
|
|
@@ -3989,10 +4293,7 @@ class Modal {
|
|
|
3989
4293
|
// style
|
|
3990
4294
|
const { maskStyle, modalStyle, titleStyle, textStyle, footStyle, btnStyle } = this.style;
|
|
3991
4295
|
// configuration
|
|
3992
|
-
const config = {
|
|
3993
|
-
...this.options,
|
|
3994
|
-
...options
|
|
3995
|
-
};
|
|
4296
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
3996
4297
|
// wrapper
|
|
3997
4298
|
this.el = document.createElement('div');
|
|
3998
4299
|
this.el.className = 'taro__modal';
|
|
@@ -4007,20 +4308,13 @@ class Modal {
|
|
|
4007
4308
|
modal.className = 'taro-modal__content';
|
|
4008
4309
|
modal.setAttribute('style', inlineStyle(modalStyle));
|
|
4009
4310
|
// title
|
|
4010
|
-
const titleCSS = config.title ? titleStyle : {
|
|
4011
|
-
...titleStyle,
|
|
4012
|
-
display: 'none'
|
|
4013
|
-
};
|
|
4311
|
+
const titleCSS = config.title ? titleStyle : Object.assign(Object.assign({}, titleStyle), { display: 'none' });
|
|
4014
4312
|
this.title = document.createElement('div');
|
|
4015
4313
|
this.title.className = 'taro-modal__title';
|
|
4016
4314
|
this.title.setAttribute('style', inlineStyle(titleCSS));
|
|
4017
4315
|
this.title.textContent = config.title;
|
|
4018
4316
|
// text
|
|
4019
|
-
const textCSS = config.title ? textStyle : {
|
|
4020
|
-
...textStyle,
|
|
4021
|
-
padding: '40px 20px 26px',
|
|
4022
|
-
color: '#353535'
|
|
4023
|
-
};
|
|
4317
|
+
const textCSS = config.title ? textStyle : Object.assign(Object.assign({}, textStyle), { padding: '40px 20px 26px', color: '#353535' });
|
|
4024
4318
|
this.text = document.createElement('div');
|
|
4025
4319
|
this.text.className = 'taro-modal__text';
|
|
4026
4320
|
this.text.setAttribute('style', inlineStyle(textCSS));
|
|
@@ -4030,11 +4324,7 @@ class Modal {
|
|
|
4030
4324
|
foot.className = 'taro-modal__foot';
|
|
4031
4325
|
foot.setAttribute('style', inlineStyle(footStyle));
|
|
4032
4326
|
// cancel button
|
|
4033
|
-
const cancelCSS = {
|
|
4034
|
-
...btnStyle,
|
|
4035
|
-
color: config.cancelColor,
|
|
4036
|
-
display: config.showCancel ? 'block' : 'none'
|
|
4037
|
-
};
|
|
4327
|
+
const cancelCSS = Object.assign(Object.assign({}, btnStyle), { color: config.cancelColor, display: config.showCancel ? 'block' : 'none' });
|
|
4038
4328
|
this.cancel = document.createElement('div');
|
|
4039
4329
|
this.cancel.className = 'taro-model__btn taro-model__cancel';
|
|
4040
4330
|
this.cancel.setAttribute('style', inlineStyle(cancelCSS));
|
|
@@ -4068,10 +4358,7 @@ class Modal {
|
|
|
4068
4358
|
}
|
|
4069
4359
|
show(options = {}) {
|
|
4070
4360
|
return new Promise((resolve) => {
|
|
4071
|
-
const config = {
|
|
4072
|
-
...this.options,
|
|
4073
|
-
...options
|
|
4074
|
-
};
|
|
4361
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
4075
4362
|
if (this.hideOpacityTimer)
|
|
4076
4363
|
clearTimeout(this.hideOpacityTimer);
|
|
4077
4364
|
if (this.hideDisplayTimer)
|
|
@@ -4087,11 +4374,7 @@ class Modal {
|
|
|
4087
4374
|
else {
|
|
4088
4375
|
// block => none
|
|
4089
4376
|
this.title.style.display = 'none';
|
|
4090
|
-
const textCSS = {
|
|
4091
|
-
...textStyle,
|
|
4092
|
-
padding: '40px 20px 26px',
|
|
4093
|
-
color: '#353535'
|
|
4094
|
-
};
|
|
4377
|
+
const textCSS = Object.assign(Object.assign({}, textStyle), { padding: '40px 20px 26px', color: '#353535' });
|
|
4095
4378
|
this.text.setAttribute('style', inlineStyle(textCSS));
|
|
4096
4379
|
}
|
|
4097
4380
|
this.text.textContent = config.content || '';
|
|
@@ -4189,10 +4472,7 @@ class ActionSheet {
|
|
|
4189
4472
|
// style
|
|
4190
4473
|
const { maskStyle, actionSheetStyle, menuStyle, cellStyle, cancelStyle } = this.style;
|
|
4191
4474
|
// configuration
|
|
4192
|
-
const config = {
|
|
4193
|
-
...this.options,
|
|
4194
|
-
...options
|
|
4195
|
-
};
|
|
4475
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
4196
4476
|
this.lastConfig = config;
|
|
4197
4477
|
// wrapper
|
|
4198
4478
|
this.el = document.createElement('div');
|
|
@@ -4207,10 +4487,7 @@ class ActionSheet {
|
|
|
4207
4487
|
this.actionSheet.setAttribute('style', inlineStyle(actionSheetStyle));
|
|
4208
4488
|
// menu
|
|
4209
4489
|
this.menu = document.createElement('div');
|
|
4210
|
-
this.menu.setAttribute('style', inlineStyle({
|
|
4211
|
-
...menuStyle,
|
|
4212
|
-
color: config.itemColor
|
|
4213
|
-
}));
|
|
4490
|
+
this.menu.setAttribute('style', inlineStyle(Object.assign(Object.assign({}, menuStyle), { color: config.itemColor })));
|
|
4214
4491
|
// cells
|
|
4215
4492
|
this.cells = config.itemList.map((item, index) => {
|
|
4216
4493
|
const cell = document.createElement('div');
|
|
@@ -4253,10 +4530,7 @@ class ActionSheet {
|
|
|
4253
4530
|
}
|
|
4254
4531
|
show(options = {}) {
|
|
4255
4532
|
return new Promise((resolve) => {
|
|
4256
|
-
const config = {
|
|
4257
|
-
...this.options,
|
|
4258
|
-
...options
|
|
4259
|
-
};
|
|
4533
|
+
const config = Object.assign(Object.assign({}, this.options), options);
|
|
4260
4534
|
this.lastConfig = config;
|
|
4261
4535
|
if (this.hideOpacityTimer)
|
|
4262
4536
|
clearTimeout(this.hideOpacityTimer);
|
|
@@ -4421,7 +4695,7 @@ const hideLoading = ({ success, fail, complete } = {}) => {
|
|
|
4421
4695
|
toast.hide(0, 'loading');
|
|
4422
4696
|
return handle.success();
|
|
4423
4697
|
};
|
|
4424
|
-
const showModal =
|
|
4698
|
+
const showModal = (options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4425
4699
|
init(document);
|
|
4426
4700
|
options = Object.assign({
|
|
4427
4701
|
title: '',
|
|
@@ -4501,21 +4775,21 @@ const showModal = async (options = {}) => {
|
|
|
4501
4775
|
options.showCancel = !!options.showCancel;
|
|
4502
4776
|
let result = '';
|
|
4503
4777
|
if (!modal.el) {
|
|
4504
|
-
result =
|
|
4778
|
+
result = yield modal.create(options);
|
|
4505
4779
|
}
|
|
4506
4780
|
else {
|
|
4507
|
-
result =
|
|
4781
|
+
result = yield modal.show(options);
|
|
4508
4782
|
}
|
|
4509
4783
|
const res = { cancel: !1, confirm: !1 };
|
|
4510
4784
|
res[result] = !0;
|
|
4511
4785
|
return handle.success(res);
|
|
4512
|
-
};
|
|
4786
|
+
});
|
|
4513
4787
|
function hideModal() {
|
|
4514
4788
|
if (!modal.el)
|
|
4515
4789
|
return;
|
|
4516
4790
|
modal.hide();
|
|
4517
4791
|
}
|
|
4518
|
-
const showActionSheet =
|
|
4792
|
+
const showActionSheet = (options = { itemList: [] }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4519
4793
|
init(document);
|
|
4520
4794
|
options = Object.assign({
|
|
4521
4795
|
itemColor: '#000000',
|
|
@@ -4561,10 +4835,10 @@ const showActionSheet = async (options = { itemList: [] }) => {
|
|
|
4561
4835
|
}
|
|
4562
4836
|
let result = '';
|
|
4563
4837
|
if (!actionSheet.el) {
|
|
4564
|
-
result =
|
|
4838
|
+
result = yield actionSheet.create(options);
|
|
4565
4839
|
}
|
|
4566
4840
|
else {
|
|
4567
|
-
result =
|
|
4841
|
+
result = yield actionSheet.show(options);
|
|
4568
4842
|
}
|
|
4569
4843
|
if (typeof result === 'string') {
|
|
4570
4844
|
return handle.fail(({ errMsg: result }));
|
|
@@ -4572,7 +4846,7 @@ const showActionSheet = async (options = { itemList: [] }) => {
|
|
|
4572
4846
|
else {
|
|
4573
4847
|
return handle.success(({ tapIndex: result }));
|
|
4574
4848
|
}
|
|
4575
|
-
};
|
|
4849
|
+
});
|
|
4576
4850
|
Taro__default["default"].eventCenter.on('__taroRouterChange', () => {
|
|
4577
4851
|
hideToast();
|
|
4578
4852
|
hideLoading();
|
|
@@ -4876,7 +5150,6 @@ const taro = {
|
|
|
4876
5150
|
Events,
|
|
4877
5151
|
preload,
|
|
4878
5152
|
history: router.history,
|
|
4879
|
-
createRouter: router.createRouter,
|
|
4880
5153
|
navigateBack: router.navigateBack,
|
|
4881
5154
|
navigateTo: router.navigateTo,
|
|
4882
5155
|
reLaunch: router.reLaunch,
|
|
@@ -4902,10 +5175,6 @@ taro.initPxTransform = initPxTransform;
|
|
|
4902
5175
|
// @ts-ignore
|
|
4903
5176
|
taro.canIUseWebp = canIUseWebp;
|
|
4904
5177
|
|
|
4905
|
-
Object.defineProperty(exports, 'createRouter', {
|
|
4906
|
-
enumerable: true,
|
|
4907
|
-
get: function () { return router.createRouter; }
|
|
4908
|
-
});
|
|
4909
5178
|
Object.defineProperty(exports, 'getCurrentPages', {
|
|
4910
5179
|
enumerable: true,
|
|
4911
5180
|
get: function () { return router.getCurrentPages; }
|