@tarojs/taro-h5 3.3.17 → 3.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1081 -627
- package/dist/index.js +1077 -628
- package/dist/taroApis.js +1 -1
- package/package.json +6 -6
- package/src/api/base/system/index.ts +2 -2
- package/src/api/canvas/canvasGetImageData.ts +1 -3
- package/src/api/canvas/canvasPutImageData.ts +1 -3
- package/src/api/canvas/canvasToTempFilePath.ts +1 -3
- package/src/api/canvas/createCanvasContext.ts +1 -3
- package/src/api/canvas/index.ts +4 -4
- package/src/api/cloud/index.ts +1 -1
- package/src/api/device/accelerometer.ts +4 -6
- package/src/api/device/compass.ts +4 -11
- package/src/api/device/motion.ts +4 -11
- package/src/api/location/index.ts +1 -1
- package/src/api/media/audio/index.ts +12 -6
- package/src/api/media/image/chooseImage.ts +1 -3
- package/src/api/media/image/getImageInfo.ts +35 -0
- package/src/api/media/image/index.ts +3 -3
- package/src/api/media/image/previewImage.ts +101 -0
- package/src/api/network/download.ts +1 -3
- package/src/api/network/upload.ts +1 -3
- package/src/api/network/websocket/index.ts +12 -20
- package/src/api/network/websocket/socketTask.ts +1 -1
- package/src/api/storage/index.ts +58 -70
- package/src/api/ui/animation/index.ts +25 -21
- package/src/api/ui/interaction/index.ts +28 -24
- package/src/api/ui/pull-down-refresh.ts +2 -7
- package/src/api/ui/scroll/index.ts +8 -10
- package/src/api/utils/index.ts +17 -33
- package/src/api/wxml/nodesRef.ts +49 -0
- package/src/api/wxml/selectorQuery.ts +2 -48
- package/src/api/media/image/getImageInfo.js +0 -74
- package/src/api/media/image/previewImage.js +0 -98
package/dist/index.cjs.js
CHANGED
|
@@ -1172,11 +1172,15 @@ function prependBasename() {
|
|
|
1172
1172
|
return basename.replace(/\/$/, '') + '/' + url.replace(/^\//, '');
|
|
1173
1173
|
}
|
|
1174
1174
|
|
|
1175
|
-
var hasBasename = function hasBasename(
|
|
1175
|
+
var hasBasename = function hasBasename() {
|
|
1176
|
+
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1177
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1176
1178
|
return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path);
|
|
1177
1179
|
};
|
|
1178
1180
|
|
|
1179
|
-
var stripBasename = function stripBasename(
|
|
1181
|
+
var stripBasename = function stripBasename() {
|
|
1182
|
+
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1183
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1180
1184
|
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
|
1181
1185
|
};
|
|
1182
1186
|
|
|
@@ -1220,12 +1224,14 @@ var Stacks = /*#__PURE__*/function () {
|
|
|
1220
1224
|
}, {
|
|
1221
1225
|
key: "getLastIndex",
|
|
1222
1226
|
value: function getLastIndex(pathname) {
|
|
1227
|
+
var stateWith = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1228
|
+
|
|
1223
1229
|
var list = _toConsumableArray(this.stacks).reverse();
|
|
1224
1230
|
|
|
1225
1231
|
return list.findIndex(function (page, i) {
|
|
1226
1232
|
var _a;
|
|
1227
1233
|
|
|
1228
|
-
return i
|
|
1234
|
+
return i >= stateWith && ((_a = page.path) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) === pathname;
|
|
1229
1235
|
});
|
|
1230
1236
|
}
|
|
1231
1237
|
}, {
|
|
@@ -1241,7 +1247,8 @@ var Stacks = /*#__PURE__*/function () {
|
|
|
1241
1247
|
}, {
|
|
1242
1248
|
key: "getPrevIndex",
|
|
1243
1249
|
value: function getPrevIndex(pathname) {
|
|
1244
|
-
var
|
|
1250
|
+
var stateWith = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1251
|
+
var lastIndex = this.getLastIndex(pathname, stateWith);
|
|
1245
1252
|
|
|
1246
1253
|
if (lastIndex < 0) {
|
|
1247
1254
|
return -1;
|
|
@@ -1282,7 +1289,9 @@ var RoutesAlias = /*#__PURE__*/function () {
|
|
|
1282
1289
|
|
|
1283
1290
|
this.conf = [];
|
|
1284
1291
|
|
|
1285
|
-
this.getConfig = function (
|
|
1292
|
+
this.getConfig = function () {
|
|
1293
|
+
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1294
|
+
|
|
1286
1295
|
var customRoute = _this2.conf.filter(function (arr) {
|
|
1287
1296
|
return arr.includes(url);
|
|
1288
1297
|
});
|
|
@@ -1290,19 +1299,24 @@ var RoutesAlias = /*#__PURE__*/function () {
|
|
|
1290
1299
|
return customRoute[0];
|
|
1291
1300
|
};
|
|
1292
1301
|
|
|
1293
|
-
this.getOrigin = function (
|
|
1302
|
+
this.getOrigin = function () {
|
|
1303
|
+
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1304
|
+
|
|
1294
1305
|
var _a;
|
|
1295
1306
|
|
|
1296
1307
|
return ((_a = _this2.getConfig(url)) === null || _a === void 0 ? void 0 : _a[0]) || url;
|
|
1297
1308
|
};
|
|
1298
1309
|
|
|
1299
|
-
this.getAlias = function (
|
|
1310
|
+
this.getAlias = function () {
|
|
1311
|
+
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1312
|
+
|
|
1300
1313
|
var _a;
|
|
1301
1314
|
|
|
1302
1315
|
return ((_a = _this2.getConfig(url)) === null || _a === void 0 ? void 0 : _a[1]) || url;
|
|
1303
1316
|
};
|
|
1304
1317
|
|
|
1305
|
-
this.getAll = function (
|
|
1318
|
+
this.getAll = function () {
|
|
1319
|
+
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1306
1320
|
return _this2.conf.filter(function (arr) {
|
|
1307
1321
|
return arr.includes(url);
|
|
1308
1322
|
}).reduce(function (p, a) {
|
|
@@ -1347,33 +1361,6 @@ var RoutesAlias = /*#__PURE__*/function () {
|
|
|
1347
1361
|
|
|
1348
1362
|
var routesAlias = new RoutesAlias();
|
|
1349
1363
|
|
|
1350
|
-
var isTabBar = function isTabBar(config) {
|
|
1351
|
-
var _a, _b;
|
|
1352
|
-
|
|
1353
|
-
var _config$router = config.router,
|
|
1354
|
-
_config$router$custom = _config$router.customRoutes,
|
|
1355
|
-
customRoutes = _config$router$custom === void 0 ? {} : _config$router$custom,
|
|
1356
|
-
_config$router$basena = _config$router.basename,
|
|
1357
|
-
basename = _config$router$basena === void 0 ? '' : _config$router$basena,
|
|
1358
|
-
pathname = _config$router.pathname;
|
|
1359
|
-
var routePath = stripBasename(pathname, basename);
|
|
1360
|
-
var pagePath = ((_a = Object.entries(customRoutes).find(function (_ref) {
|
|
1361
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
1362
|
-
target = _ref2[1];
|
|
1363
|
-
|
|
1364
|
-
if (typeof target === 'string') {
|
|
1365
|
-
return target === routePath;
|
|
1366
|
-
} else if ((target === null || target === void 0 ? void 0 : target.length) > 0) {
|
|
1367
|
-
return target.includes(routePath);
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
return false;
|
|
1371
|
-
})) === null || _a === void 0 ? void 0 : _a[0]) || routePath;
|
|
1372
|
-
return !!pagePath && (((_b = config.tabBar) === null || _b === void 0 ? void 0 : _b.list) || []).some(function (t) {
|
|
1373
|
-
return t.pagePath === pagePath;
|
|
1374
|
-
});
|
|
1375
|
-
};
|
|
1376
|
-
|
|
1377
1364
|
function processNavigateUrl(option) {
|
|
1378
1365
|
var _a;
|
|
1379
1366
|
|
|
@@ -2141,119 +2128,7 @@ var UniversalRouter = function () {
|
|
|
2141
2128
|
return UniversalRouter;
|
|
2142
2129
|
}();
|
|
2143
2130
|
|
|
2144
|
-
UniversalRouter.pathToRegexp = pathToRegexp_1;
|
|
2145
|
-
|
|
2146
|
-
function initTabbar(config) {
|
|
2147
|
-
if (config.tabBar == null) {
|
|
2148
|
-
return;
|
|
2149
|
-
} // TODO: 找到 tabbar 的类型
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
var tabbar = document.createElement('taro-tabbar');
|
|
2153
|
-
var homePage = config.entryPagePath || (config.pages ? config.pages[0] : '');
|
|
2154
|
-
tabbar.conf = config.tabBar;
|
|
2155
|
-
tabbar.conf.homePage = exports.history.location.pathname === '/' ? homePage : exports.history.location.pathname;
|
|
2156
|
-
var routerConfig = config.router;
|
|
2157
|
-
tabbar.conf.mode = routerConfig && routerConfig.mode ? routerConfig.mode : 'hash';
|
|
2158
|
-
|
|
2159
|
-
if (routerConfig.customRoutes) {
|
|
2160
|
-
tabbar.conf.custom = true;
|
|
2161
|
-
tabbar.conf.customRoutes = routerConfig.customRoutes;
|
|
2162
|
-
} else {
|
|
2163
|
-
tabbar.conf.custom = false;
|
|
2164
|
-
tabbar.conf.customRoutes = {};
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
if (typeof routerConfig.basename !== 'undefined') {
|
|
2168
|
-
tabbar.conf.basename = routerConfig.basename;
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
var container = document.getElementById('container'); // eslint-disable-next-line no-unused-expressions
|
|
2172
|
-
|
|
2173
|
-
container === null || container === void 0 ? void 0 : container.appendChild(tabbar);
|
|
2174
|
-
taro$1.initTabBarApis(config);
|
|
2175
|
-
}
|
|
2176
|
-
|
|
2177
|
-
var routerConfig = Object.create(null);
|
|
2178
|
-
|
|
2179
|
-
function init(config) {
|
|
2180
|
-
var _a;
|
|
2181
|
-
|
|
2182
|
-
config.router.mode = config.router.mode || 'hash';
|
|
2183
|
-
setHistoryMode(config.router.mode, config.router.basename);
|
|
2184
|
-
Object.assign(routerConfig, config);
|
|
2185
|
-
(_a = document.getElementById('app')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2186
|
-
var container = document.createElement('div');
|
|
2187
|
-
container.classList.add('taro-tabbar__container');
|
|
2188
|
-
container.id = 'container';
|
|
2189
|
-
var panel = document.createElement('div');
|
|
2190
|
-
panel.classList.add('taro-tabbar__panel');
|
|
2191
|
-
var app = document.createElement('div');
|
|
2192
|
-
app.id = 'app';
|
|
2193
|
-
app.classList.add('taro_router');
|
|
2194
|
-
panel.appendChild(app);
|
|
2195
|
-
container.appendChild(panel);
|
|
2196
|
-
document.body.appendChild(container);
|
|
2197
|
-
initTabbar(config);
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
var pageScrollFn;
|
|
2201
|
-
var pageDOM = window;
|
|
2202
|
-
|
|
2203
|
-
function bindPageScroll(page, config) {
|
|
2204
|
-
pageDOM.removeEventListener('scroll', pageScrollFn);
|
|
2205
|
-
pageDOM = getScrollContainer();
|
|
2206
|
-
var distance = config.onReachBottomDistance || 50;
|
|
2207
|
-
var isReachBottom = false;
|
|
2208
|
-
|
|
2209
|
-
pageScrollFn = function pageScrollFn() {
|
|
2210
|
-
page.onPageScroll && page.onPageScroll({
|
|
2211
|
-
scrollTop: pageDOM instanceof Window ? window.scrollY : pageDOM.scrollTop
|
|
2212
|
-
});
|
|
2213
|
-
|
|
2214
|
-
if (isReachBottom && getOffset() > distance) {
|
|
2215
|
-
isReachBottom = false;
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
if (page.onReachBottom && !isReachBottom && getOffset() < distance) {
|
|
2219
|
-
isReachBottom = true;
|
|
2220
|
-
page.onReachBottom();
|
|
2221
|
-
}
|
|
2222
|
-
};
|
|
2223
|
-
|
|
2224
|
-
pageDOM.addEventListener('scroll', pageScrollFn, false);
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
window.addEventListener('DOMSubtreeModified', function (e) {
|
|
2228
|
-
var _a; // @ts-ignore
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
var className = (_a = e.target) === null || _a === void 0 ? void 0 : _a.className;
|
|
2232
|
-
|
|
2233
|
-
if (className && /taro-tabbar__/.test(className)) {
|
|
2234
|
-
pageDOM.removeEventListener('scroll', pageScrollFn);
|
|
2235
|
-
pageDOM = getScrollContainer();
|
|
2236
|
-
pageDOM.addEventListener('scroll', pageScrollFn, false);
|
|
2237
|
-
}
|
|
2238
|
-
}, false);
|
|
2239
|
-
|
|
2240
|
-
function getScrollContainer() {
|
|
2241
|
-
if (document.querySelector('.taro-tabbar__tabbar') === null) {
|
|
2242
|
-
// 没设置tabbar
|
|
2243
|
-
return window;
|
|
2244
|
-
} else {
|
|
2245
|
-
// 有设置tabbar
|
|
2246
|
-
return document.querySelector('.taro-tabbar__panel') || window;
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
function getOffset() {
|
|
2251
|
-
if (pageDOM instanceof Window) {
|
|
2252
|
-
return document.documentElement.scrollHeight - window.scrollY - window.innerHeight;
|
|
2253
|
-
} else {
|
|
2254
|
-
return pageDOM.scrollHeight - pageDOM.scrollTop - pageDOM.clientHeight;
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2131
|
+
UniversalRouter.pathToRegexp = pathToRegexp_1;
|
|
2257
2132
|
|
|
2258
2133
|
function createCommonjsModule$1(fn, module) {
|
|
2259
2134
|
return module = {
|
|
@@ -2823,137 +2698,468 @@ var queryString_4 = queryString.parseUrl;
|
|
|
2823
2698
|
var queryString_5 = queryString.stringifyUrl;
|
|
2824
2699
|
var queryString_6 = queryString.pick;
|
|
2825
2700
|
var queryString_7 = queryString.exclude;
|
|
2701
|
+
var pageScrollFn;
|
|
2702
|
+
var pageDOM = window;
|
|
2826
2703
|
|
|
2827
|
-
function
|
|
2828
|
-
|
|
2704
|
+
function bindPageScroll(page, config) {
|
|
2705
|
+
pageDOM.removeEventListener('scroll', pageScrollFn);
|
|
2706
|
+
pageDOM = getScrollContainer();
|
|
2707
|
+
var distance = config.onReachBottomDistance || 50;
|
|
2708
|
+
var isReachBottom = false;
|
|
2829
2709
|
|
|
2830
|
-
|
|
2831
|
-
|
|
2710
|
+
pageScrollFn = function pageScrollFn() {
|
|
2711
|
+
page.onPageScroll && page.onPageScroll({
|
|
2712
|
+
scrollTop: pageDOM instanceof Window ? window.scrollY : pageDOM.scrollTop
|
|
2713
|
+
});
|
|
2832
2714
|
|
|
2833
|
-
if (
|
|
2834
|
-
|
|
2715
|
+
if (isReachBottom && getOffset() > distance) {
|
|
2716
|
+
isReachBottom = false;
|
|
2835
2717
|
}
|
|
2836
|
-
} else {
|
|
2837
|
-
search = location.search;
|
|
2838
|
-
}
|
|
2839
2718
|
|
|
2840
|
-
|
|
2719
|
+
if (page.onReachBottom && !isReachBottom && getOffset() < distance) {
|
|
2720
|
+
isReachBottom = true;
|
|
2721
|
+
page.onReachBottom();
|
|
2722
|
+
}
|
|
2723
|
+
};
|
|
2724
|
+
|
|
2725
|
+
pageDOM.addEventListener('scroll', pageScrollFn, false);
|
|
2841
2726
|
}
|
|
2842
2727
|
|
|
2843
|
-
|
|
2844
|
-
var
|
|
2845
|
-
var
|
|
2846
|
-
var query = search ? queryString.parse(search) : {};
|
|
2728
|
+
window.addEventListener('DOMSubtreeModified', function (e) {
|
|
2729
|
+
var target = e.target;
|
|
2730
|
+
var className = target === null || target === void 0 ? void 0 : target.className;
|
|
2847
2731
|
|
|
2848
|
-
if (
|
|
2849
|
-
|
|
2732
|
+
if (className && /taro_page/.test(className)) {
|
|
2733
|
+
pageDOM.removeEventListener('scroll', pageScrollFn);
|
|
2734
|
+
pageDOM = getScrollContainer();
|
|
2735
|
+
pageDOM.addEventListener('scroll', pageScrollFn, false);
|
|
2850
2736
|
}
|
|
2737
|
+
}, false);
|
|
2851
2738
|
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
/* eslint-disable dot-notation */
|
|
2739
|
+
function getScrollContainer() {
|
|
2740
|
+
var _a;
|
|
2855
2741
|
|
|
2742
|
+
var id = (_a = runtime.Current.page) === null || _a === void 0 ? void 0 : _a.path;
|
|
2743
|
+
var el = id ? document.getElementById(id) : document.querySelector('.taro_page') || document.querySelector('.taro_router');
|
|
2744
|
+
return el || window;
|
|
2745
|
+
}
|
|
2856
2746
|
|
|
2857
|
-
function
|
|
2858
|
-
|
|
2747
|
+
function getOffset() {
|
|
2748
|
+
if (pageDOM instanceof Window) {
|
|
2749
|
+
return document.documentElement.scrollHeight - window.scrollY - window.innerHeight;
|
|
2750
|
+
} else {
|
|
2751
|
+
return pageDOM.scrollHeight - pageDOM.scrollTop - pageDOM.clientHeight;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* 插入页面动画需要的样式
|
|
2756
|
+
*/
|
|
2859
2757
|
|
|
2860
|
-
var _a, _b;
|
|
2861
2758
|
|
|
2862
|
-
|
|
2759
|
+
function loadAnimateStyle() {
|
|
2760
|
+
var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 300;
|
|
2761
|
+
var css = "\n.taro_router .taro_page {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n transform: translate3d(100%, 0, 0);\n transition: transform ".concat(ms, "ms;\n}\n\n.taro_router .taro_page.taro_tabbar_page {\n transform: none;\n}\n\n.taro_router .taro_page.taro_page_show {\n transform: translate3d(0, 0, 0);\n}");
|
|
2762
|
+
var style = document.createElement('style');
|
|
2763
|
+
style.innerHTML = css;
|
|
2764
|
+
document.getElementsByTagName('head')[0].appendChild(style);
|
|
2765
|
+
} // @ts-nocheck
|
|
2863
2766
|
|
|
2864
|
-
if (pageEl && !(pageEl === null || pageEl === void 0 ? void 0 : pageEl['__isReady'])) {
|
|
2865
|
-
var el = pageEl.firstElementChild;
|
|
2866
|
-
(_b = (_a = el === null || el === void 0 ? void 0 : el['componentOnReady']) === null || _a === void 0 ? void 0 : _a.call(el)) === null || _b === void 0 ? void 0 : _b.then(function () {
|
|
2867
|
-
runtime.requestAnimationFrame(function () {
|
|
2868
|
-
page.onReady();
|
|
2869
|
-
pageEl['__isReady'] = true;
|
|
2870
|
-
});
|
|
2871
|
-
});
|
|
2872
|
-
onLoad && (pageEl['__page'] = page);
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
2767
|
|
|
2876
|
-
function
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2768
|
+
function initTabbar(config) {
|
|
2769
|
+
if (config.tabBar == null) {
|
|
2770
|
+
return;
|
|
2771
|
+
} // TODO: custom-tab-bar
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
var tabbar = document.createElement('taro-tabbar');
|
|
2775
|
+
var homePage = config.entryPagePath || (config.pages ? config.pages[0] : '');
|
|
2776
|
+
tabbar.conf = config.tabBar;
|
|
2777
|
+
tabbar.conf.homePage = exports.history.location.pathname === '/' ? homePage : exports.history.location.pathname;
|
|
2778
|
+
var routerConfig = config.router;
|
|
2779
|
+
tabbar.conf.mode = routerConfig && routerConfig.mode ? routerConfig.mode : 'hash';
|
|
2881
2780
|
|
|
2882
|
-
if (
|
|
2883
|
-
|
|
2781
|
+
if (routerConfig.customRoutes) {
|
|
2782
|
+
tabbar.conf.custom = true;
|
|
2783
|
+
tabbar.conf.customRoutes = routerConfig.customRoutes;
|
|
2884
2784
|
} else {
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
});
|
|
2785
|
+
tabbar.conf.custom = false;
|
|
2786
|
+
tabbar.conf.customRoutes = {};
|
|
2888
2787
|
}
|
|
2889
2788
|
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2789
|
+
if (typeof routerConfig.basename !== 'undefined') {
|
|
2790
|
+
tabbar.conf.basename = routerConfig.basename;
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
var container = document.getElementById('container');
|
|
2794
|
+
container === null || container === void 0 ? void 0 : container.appendChild(tabbar);
|
|
2795
|
+
taro$1.initTabBarApis(config);
|
|
2893
2796
|
}
|
|
2894
2797
|
|
|
2895
|
-
function
|
|
2896
|
-
var
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
if (delta >= 1) unloadPage(stacks.last, delta);
|
|
2798
|
+
function setDisplay(el) {
|
|
2799
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2800
|
+
|
|
2801
|
+
if (el) {
|
|
2802
|
+
el.style.display = type;
|
|
2803
|
+
}
|
|
2902
2804
|
}
|
|
2903
2805
|
|
|
2904
|
-
function
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
if (!page) return;
|
|
2908
|
-
page.onShow();
|
|
2909
|
-
var pageEl = document.getElementById(page.path);
|
|
2806
|
+
var PageHandler = /*#__PURE__*/function () {
|
|
2807
|
+
function PageHandler(config) {
|
|
2808
|
+
_classCallCheck$1(this, PageHandler);
|
|
2910
2809
|
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2810
|
+
this.defaultAnimation = {
|
|
2811
|
+
duration: 300,
|
|
2812
|
+
delay: 50
|
|
2813
|
+
};
|
|
2814
|
+
this.config = config;
|
|
2815
|
+
this.mount();
|
|
2917
2816
|
}
|
|
2918
2817
|
|
|
2919
|
-
|
|
2920
|
-
|
|
2818
|
+
_createClass$1(PageHandler, [{
|
|
2819
|
+
key: "appId",
|
|
2820
|
+
get: function get() {
|
|
2821
|
+
return 'app';
|
|
2822
|
+
}
|
|
2823
|
+
}, {
|
|
2824
|
+
key: "router",
|
|
2825
|
+
get: function get() {
|
|
2826
|
+
return this.config.router;
|
|
2827
|
+
}
|
|
2828
|
+
}, {
|
|
2829
|
+
key: "routerMode",
|
|
2830
|
+
get: function get() {
|
|
2831
|
+
return this.router.mode || 'hash';
|
|
2832
|
+
}
|
|
2833
|
+
}, {
|
|
2834
|
+
key: "customRoutes",
|
|
2835
|
+
get: function get() {
|
|
2836
|
+
return this.router.customRoutes || {};
|
|
2837
|
+
}
|
|
2838
|
+
}, {
|
|
2839
|
+
key: "routes",
|
|
2840
|
+
get: function get() {
|
|
2841
|
+
return this.config.routes;
|
|
2842
|
+
}
|
|
2843
|
+
}, {
|
|
2844
|
+
key: "tabBarList",
|
|
2845
|
+
get: function get() {
|
|
2846
|
+
var _a;
|
|
2921
2847
|
|
|
2922
|
-
|
|
2923
|
-
|
|
2848
|
+
return ((_a = this.config.tabBar) === null || _a === void 0 ? void 0 : _a.list) || [];
|
|
2849
|
+
}
|
|
2850
|
+
}, {
|
|
2851
|
+
key: "PullDownRefresh",
|
|
2852
|
+
get: function get() {
|
|
2853
|
+
return this.config.PullDownRefresh;
|
|
2854
|
+
}
|
|
2855
|
+
}, {
|
|
2856
|
+
key: "animation",
|
|
2857
|
+
get: function get() {
|
|
2858
|
+
var _a, _b;
|
|
2924
2859
|
|
|
2925
|
-
|
|
2860
|
+
return (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.animation) !== null && _b !== void 0 ? _b : this.defaultAnimation;
|
|
2861
|
+
}
|
|
2862
|
+
}, {
|
|
2863
|
+
key: "animationDelay",
|
|
2864
|
+
get: function get() {
|
|
2865
|
+
var _a;
|
|
2926
2866
|
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
}
|
|
2867
|
+
return _typeof$1(this.animation) === 'object' ? this.animation.delay : this.animation ? (_a = this.defaultAnimation) === null || _a === void 0 ? void 0 : _a.delay : 0;
|
|
2868
|
+
}
|
|
2869
|
+
}, {
|
|
2870
|
+
key: "animationDuration",
|
|
2871
|
+
get: function get() {
|
|
2872
|
+
var _a;
|
|
2873
|
+
|
|
2874
|
+
return _typeof$1(this.animation) === 'object' ? this.animation.duration : this.animation ? (_a = this.defaultAnimation) === null || _a === void 0 ? void 0 : _a.duration : 0;
|
|
2875
|
+
}
|
|
2876
|
+
}, {
|
|
2877
|
+
key: "pathname",
|
|
2878
|
+
get: function get() {
|
|
2879
|
+
return this.router.pathname;
|
|
2880
|
+
},
|
|
2881
|
+
set: function set(p) {
|
|
2882
|
+
this.router.pathname = p;
|
|
2883
|
+
}
|
|
2884
|
+
}, {
|
|
2885
|
+
key: "basename",
|
|
2886
|
+
get: function get() {
|
|
2887
|
+
return this.router.basename || '';
|
|
2888
|
+
}
|
|
2889
|
+
}, {
|
|
2890
|
+
key: "pageConfig",
|
|
2891
|
+
get: function get() {
|
|
2892
|
+
var _this4 = this;
|
|
2893
|
+
|
|
2894
|
+
return this.routes.find(function (r) {
|
|
2895
|
+
var _a;
|
|
2896
|
+
|
|
2897
|
+
var routePath = stripBasename(_this4.pathname, _this4.basename);
|
|
2898
|
+
var pagePath = addLeadingSlash(r.path);
|
|
2899
|
+
return pagePath === routePath || ((_a = routesAlias.getConfig(pagePath)) === null || _a === void 0 ? void 0 : _a.includes(routePath));
|
|
2900
|
+
});
|
|
2901
|
+
}
|
|
2902
|
+
}, {
|
|
2903
|
+
key: "isTabBar",
|
|
2904
|
+
get: function get() {
|
|
2905
|
+
var _a;
|
|
2906
|
+
|
|
2907
|
+
var routePath = stripBasename(this.pathname, this.basename);
|
|
2908
|
+
var pagePath = ((_a = Object.entries(this.customRoutes).find(function (_ref) {
|
|
2909
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
2910
|
+
target = _ref2[1];
|
|
2911
|
+
|
|
2912
|
+
if (typeof target === 'string') {
|
|
2913
|
+
return target === routePath;
|
|
2914
|
+
} else if ((target === null || target === void 0 ? void 0 : target.length) > 0) {
|
|
2915
|
+
return target.includes(routePath);
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
return false;
|
|
2919
|
+
})) === null || _a === void 0 ? void 0 : _a[0]) || routePath;
|
|
2920
|
+
return !!pagePath && this.tabBarList.some(function (t) {
|
|
2921
|
+
return t.pagePath === pagePath;
|
|
2922
|
+
});
|
|
2923
|
+
}
|
|
2924
|
+
}, {
|
|
2925
|
+
key: "isSamePage",
|
|
2926
|
+
value: function isSamePage(page) {
|
|
2927
|
+
var routePath = stripBasename(this.pathname, this.basename);
|
|
2928
|
+
var pagePath = stripBasename(page === null || page === void 0 ? void 0 : page.path, this.basename);
|
|
2929
|
+
return pagePath.startsWith(routePath + '?');
|
|
2930
|
+
}
|
|
2931
|
+
}, {
|
|
2932
|
+
key: "search",
|
|
2933
|
+
get: function get() {
|
|
2934
|
+
var search = '?';
|
|
2935
|
+
|
|
2936
|
+
if (this.routerMode) {
|
|
2937
|
+
var idx = location.hash.indexOf('?');
|
|
2938
|
+
|
|
2939
|
+
if (idx > -1) {
|
|
2940
|
+
search = location.hash.slice(idx);
|
|
2941
|
+
}
|
|
2942
|
+
} else {
|
|
2943
|
+
search = location.search;
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
return search.substr(1);
|
|
2947
|
+
}
|
|
2948
|
+
}, {
|
|
2949
|
+
key: "getQuery",
|
|
2950
|
+
value: function getQuery() {
|
|
2951
|
+
var stamp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
2952
|
+
var search = this.search;
|
|
2953
|
+
var query = search ? queryString.parse(search) : {};
|
|
2954
|
+
|
|
2955
|
+
if (stamp) {
|
|
2956
|
+
query.stamp = stamp.toString();
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
return query;
|
|
2960
|
+
}
|
|
2961
|
+
}, {
|
|
2962
|
+
key: "mount",
|
|
2963
|
+
value: function mount() {
|
|
2964
|
+
var _a;
|
|
2965
|
+
|
|
2966
|
+
setHistoryMode(this.routerMode, this.router.basename);
|
|
2967
|
+
(_a = document.getElementById('app')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2968
|
+
this.animation && loadAnimateStyle(this.animationDuration);
|
|
2969
|
+
var app = document.createElement('div');
|
|
2970
|
+
app.id = this.appId;
|
|
2971
|
+
app.classList.add('taro_router');
|
|
2972
|
+
|
|
2973
|
+
if (this.tabBarList.length > 1) {
|
|
2974
|
+
var _container = document.createElement('div');
|
|
2975
|
+
|
|
2976
|
+
_container.classList.add('taro-tabbar__container');
|
|
2977
|
+
|
|
2978
|
+
_container.id = 'container';
|
|
2979
|
+
var panel = document.createElement('div');
|
|
2980
|
+
panel.classList.add('taro-tabbar__panel');
|
|
2981
|
+
panel.appendChild(app);
|
|
2982
|
+
|
|
2983
|
+
_container.appendChild(panel);
|
|
2984
|
+
|
|
2985
|
+
document.body.appendChild(_container);
|
|
2986
|
+
initTabbar(this.config);
|
|
2987
|
+
} else {
|
|
2988
|
+
document.body.appendChild(app);
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
}, {
|
|
2992
|
+
key: "onReady",
|
|
2993
|
+
value: function onReady(page) {
|
|
2994
|
+
var onLoad = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2995
|
+
|
|
2996
|
+
var _a, _b;
|
|
2997
|
+
|
|
2998
|
+
var pageEl = document.getElementById(page.path);
|
|
2999
|
+
|
|
3000
|
+
if (pageEl && !(pageEl === null || pageEl === void 0 ? void 0 : pageEl['__isReady'])) {
|
|
3001
|
+
var el = pageEl.firstElementChild;
|
|
3002
|
+
(_b = (_a = el === null || el === void 0 ? void 0 : el['componentOnReady']) === null || _a === void 0 ? void 0 : _a.call(el)) === null || _b === void 0 ? void 0 : _b.then(function () {
|
|
3003
|
+
runtime.requestAnimationFrame(function () {
|
|
3004
|
+
page.onReady();
|
|
3005
|
+
pageEl['__isReady'] = true;
|
|
3006
|
+
});
|
|
3007
|
+
});
|
|
3008
|
+
onLoad && (pageEl['__page'] = page);
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
}, {
|
|
3012
|
+
key: "load",
|
|
3013
|
+
value: function load(page) {
|
|
3014
|
+
var _this5 = this;
|
|
3015
|
+
|
|
3016
|
+
var pageConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3017
|
+
var stacksIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3018
|
+
if (!page) return;
|
|
3019
|
+
var pageEl = document.getElementById(page.path);
|
|
3020
|
+
|
|
3021
|
+
if (pageEl) {
|
|
3022
|
+
setDisplay(pageEl);
|
|
3023
|
+
this.isTabBar && pageEl.classList.add('taro_tabbar_page');
|
|
3024
|
+
this.addAnimation(pageEl, stacksIndex === 0);
|
|
3025
|
+
} else {
|
|
3026
|
+
page.onLoad(this.getQuery(stacksIndex), function () {
|
|
3027
|
+
pageEl = document.getElementById(page.path);
|
|
3028
|
+
_this5.isTabBar && (pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.add('taro_tabbar_page'));
|
|
3029
|
+
|
|
3030
|
+
_this5.addAnimation(pageEl, stacksIndex === 0);
|
|
3031
|
+
|
|
3032
|
+
_this5.onReady(page, true);
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
stacks.push(page);
|
|
3037
|
+
page.onShow();
|
|
3038
|
+
bindPageScroll(page, pageConfig);
|
|
3039
|
+
}
|
|
3040
|
+
}, {
|
|
3041
|
+
key: "unload",
|
|
3042
|
+
value: function unload(page) {
|
|
3043
|
+
var _this6 = this;
|
|
3044
|
+
|
|
3045
|
+
var delta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
3046
|
+
var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3047
|
+
|
|
3048
|
+
var _a;
|
|
3049
|
+
|
|
3050
|
+
if (!page) return;
|
|
3051
|
+
stacks.delta = --delta;
|
|
3052
|
+
stacks.pop();
|
|
3053
|
+
|
|
3054
|
+
if (this.animation && top) {
|
|
3055
|
+
if (this.unloadTimer) {
|
|
3056
|
+
clearTimeout(this.unloadTimer);
|
|
3057
|
+
(_a = this.lastUnloadPage) === null || _a === void 0 ? void 0 : _a.onUnload();
|
|
3058
|
+
this.unloadTimer = null;
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
this.lastUnloadPage = page;
|
|
3062
|
+
var pageEl = document.getElementById(page.path);
|
|
3063
|
+
pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.remove('taro_page_show');
|
|
3064
|
+
this.unloadTimer = setTimeout(function () {
|
|
3065
|
+
var _a;
|
|
3066
|
+
|
|
3067
|
+
_this6.unloadTimer = null;
|
|
3068
|
+
(_a = _this6.lastUnloadPage) === null || _a === void 0 ? void 0 : _a.onUnload();
|
|
3069
|
+
}, this.animationDuration);
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
if (delta >= 1) this.unload(stacks.last, delta);
|
|
3073
|
+
}
|
|
3074
|
+
}, {
|
|
3075
|
+
key: "show",
|
|
3076
|
+
value: function show(page) {
|
|
3077
|
+
var _this7 = this;
|
|
3078
|
+
|
|
3079
|
+
var pageConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3080
|
+
var stacksIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3081
|
+
if (!page) return;
|
|
3082
|
+
page.onShow();
|
|
3083
|
+
var pageEl = document.getElementById(page.path);
|
|
3084
|
+
|
|
3085
|
+
if (pageEl) {
|
|
3086
|
+
setDisplay(pageEl);
|
|
3087
|
+
this.addAnimation(pageEl, stacksIndex === 0);
|
|
3088
|
+
} else {
|
|
3089
|
+
page.onLoad(this.getQuery(stacksIndex), function () {
|
|
3090
|
+
pageEl = document.getElementById(page.path);
|
|
3091
|
+
|
|
3092
|
+
_this7.addAnimation(pageEl, stacksIndex === 0);
|
|
3093
|
+
|
|
3094
|
+
_this7.onReady(page, false);
|
|
3095
|
+
});
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
bindPageScroll(page, pageConfig);
|
|
3099
|
+
}
|
|
3100
|
+
}, {
|
|
3101
|
+
key: "hide",
|
|
3102
|
+
value: function hide(page) {
|
|
3103
|
+
var _this8 = this;
|
|
3104
|
+
|
|
3105
|
+
if (!page) return; // NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
|
|
3106
|
+
|
|
3107
|
+
var pageEl = document.getElementById(page.path);
|
|
3108
|
+
|
|
3109
|
+
if (pageEl) {
|
|
3110
|
+
if (this.hideTimer) {
|
|
3111
|
+
clearTimeout(this.hideTimer);
|
|
3112
|
+
this.hideTimer = null;
|
|
3113
|
+
setDisplay(this.lastHidePage, 'none');
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
this.lastHidePage = pageEl;
|
|
3117
|
+
this.hideTimer = setTimeout(function () {
|
|
3118
|
+
_this8.hideTimer = null;
|
|
3119
|
+
setDisplay(_this8.lastHidePage, 'none');
|
|
3120
|
+
}, this.animationDelay);
|
|
3121
|
+
page.onHide();
|
|
3122
|
+
} else {
|
|
3123
|
+
setTimeout(function () {
|
|
3124
|
+
return _this8.hide(page);
|
|
3125
|
+
}, 0);
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
}, {
|
|
3129
|
+
key: "addAnimation",
|
|
3130
|
+
value: function addAnimation(pageEl) {
|
|
3131
|
+
var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3132
|
+
if (!pageEl) return;
|
|
3133
|
+
|
|
3134
|
+
if (this.animation && !first) {
|
|
3135
|
+
setTimeout(function () {
|
|
3136
|
+
pageEl.classList.add('taro_page_show');
|
|
3137
|
+
}, this.animationDelay);
|
|
3138
|
+
} else {
|
|
3139
|
+
pageEl.classList.add('taro_page_show');
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
}]);
|
|
3143
|
+
|
|
3144
|
+
return PageHandler;
|
|
3145
|
+
}();
|
|
2936
3146
|
/* eslint-disable dot-notation */
|
|
2937
3147
|
|
|
2938
3148
|
|
|
2939
3149
|
function createRouter(app, config, framework) {
|
|
2940
3150
|
var _a;
|
|
2941
3151
|
|
|
2942
|
-
|
|
2943
|
-
var routes = [];
|
|
3152
|
+
var handler = new PageHandler(config);
|
|
2944
3153
|
var runtimeHooks = runtime.container.get(runtime.SERVICE_IDENTIFIER.Hooks);
|
|
2945
|
-
routesAlias.set(
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
routes.push({
|
|
2951
|
-
path: routesAlias.getAll(path),
|
|
3154
|
+
routesAlias.set(handler.router.customRoutes);
|
|
3155
|
+
var basename = handler.router.basename;
|
|
3156
|
+
var routes = handler.routes.map(function (route) {
|
|
3157
|
+
return {
|
|
3158
|
+
path: routesAlias.getAll(addLeadingSlash(route.path)),
|
|
2952
3159
|
action: route.load
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
|
|
2956
|
-
var basename = config.router.basename;
|
|
3160
|
+
};
|
|
3161
|
+
});
|
|
3162
|
+
var entryPagePath = config.entryPagePath || ((_a = routes[0].path) === null || _a === void 0 ? void 0 : _a[0]);
|
|
2957
3163
|
var router = new UniversalRouter(routes, {
|
|
2958
3164
|
baseUrl: basename || ''
|
|
2959
3165
|
});
|
|
@@ -2968,10 +3174,10 @@ function createRouter(app, config, framework) {
|
|
|
2968
3174
|
switch (_context.prev = _context.next) {
|
|
2969
3175
|
case 0:
|
|
2970
3176
|
location = _ref3.location, action = _ref3.action;
|
|
2971
|
-
|
|
3177
|
+
handler.pathname = location.pathname;
|
|
2972
3178
|
_context.prev = 2;
|
|
2973
3179
|
_context.next = 5;
|
|
2974
|
-
return router.resolve(
|
|
3180
|
+
return router.resolve(handler.router.forcePath || handler.pathname);
|
|
2975
3181
|
|
|
2976
3182
|
case 5:
|
|
2977
3183
|
element = _context.sent;
|
|
@@ -2988,7 +3194,7 @@ function createRouter(app, config, framework) {
|
|
|
2988
3194
|
}
|
|
2989
3195
|
|
|
2990
3196
|
(_a = app.onPageNotFound) === null || _a === void 0 ? void 0 : _a.call(app, {
|
|
2991
|
-
path:
|
|
3197
|
+
path: handler.pathname
|
|
2992
3198
|
});
|
|
2993
3199
|
_context.next = 15;
|
|
2994
3200
|
break;
|
|
@@ -3005,17 +3211,11 @@ function createRouter(app, config, framework) {
|
|
|
3005
3211
|
return _context.abrupt("return");
|
|
3006
3212
|
|
|
3007
3213
|
case 17:
|
|
3008
|
-
pageConfig =
|
|
3009
|
-
var _a;
|
|
3010
|
-
|
|
3011
|
-
var path = addLeadingSlash(r.path);
|
|
3012
|
-
var urlPath = stripBasename(location.pathname, routerConfig.router.basename);
|
|
3013
|
-
return path === urlPath || ((_a = routesAlias.getConfig(path)) === null || _a === void 0 ? void 0 : _a.includes(urlPath));
|
|
3014
|
-
});
|
|
3214
|
+
pageConfig = handler.pageConfig;
|
|
3015
3215
|
enablePullDownRefresh = false;
|
|
3016
3216
|
runtime.eventCenter.trigger('__taroRouterChange', {
|
|
3017
3217
|
toLocation: {
|
|
3018
|
-
path:
|
|
3218
|
+
path: handler.pathname
|
|
3019
3219
|
}
|
|
3020
3220
|
});
|
|
3021
3221
|
|
|
@@ -3025,7 +3225,7 @@ function createRouter(app, config, framework) {
|
|
|
3025
3225
|
}
|
|
3026
3226
|
|
|
3027
3227
|
currentPage = runtime.Current.page;
|
|
3028
|
-
pathname =
|
|
3228
|
+
pathname = handler.pathname;
|
|
3029
3229
|
shouldLoad = false;
|
|
3030
3230
|
|
|
3031
3231
|
if (!(action === 'POP')) {
|
|
@@ -3036,64 +3236,60 @@ function createRouter(app, config, framework) {
|
|
|
3036
3236
|
// NOTE: 浏览器事件退后多次时,该事件只会被触发一次
|
|
3037
3237
|
prevIndex = stacks.getPrevIndex(pathname);
|
|
3038
3238
|
delta = stacks.getDelta(pathname);
|
|
3039
|
-
|
|
3239
|
+
handler.unload(currentPage, delta, prevIndex > -1);
|
|
3040
3240
|
|
|
3041
3241
|
if (prevIndex > -1) {
|
|
3042
|
-
|
|
3242
|
+
handler.show(stacks.getItem(prevIndex), pageConfig, prevIndex);
|
|
3043
3243
|
} else {
|
|
3044
3244
|
shouldLoad = true;
|
|
3045
3245
|
}
|
|
3046
3246
|
|
|
3047
|
-
_context.next =
|
|
3247
|
+
_context.next = 42;
|
|
3048
3248
|
break;
|
|
3049
3249
|
|
|
3050
3250
|
case 31:
|
|
3051
|
-
if (!
|
|
3052
|
-
_context.next =
|
|
3251
|
+
if (!handler.isTabBar) {
|
|
3252
|
+
_context.next = 40;
|
|
3053
3253
|
break;
|
|
3054
3254
|
}
|
|
3055
3255
|
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
_context.next = 47;
|
|
3059
|
-
break;
|
|
3060
|
-
|
|
3061
|
-
case 36:
|
|
3062
|
-
if (!(action === 'REPLACE')) {
|
|
3063
|
-
_context.next = 47;
|
|
3256
|
+
if (!handler.isSamePage(currentPage)) {
|
|
3257
|
+
_context.next = 34;
|
|
3064
3258
|
break;
|
|
3065
3259
|
}
|
|
3066
3260
|
|
|
3067
|
-
|
|
3068
|
-
_context.next = 44;
|
|
3069
|
-
break;
|
|
3070
|
-
}
|
|
3261
|
+
return _context.abrupt("return");
|
|
3071
3262
|
|
|
3072
|
-
|
|
3073
|
-
_prevIndex = stacks.getPrevIndex(pathname);
|
|
3263
|
+
case 34:
|
|
3264
|
+
_prevIndex = stacks.getPrevIndex(pathname, 0);
|
|
3265
|
+
handler.hide(currentPage);
|
|
3074
3266
|
|
|
3075
3267
|
if (!(_prevIndex > -1)) {
|
|
3076
|
-
_context.next =
|
|
3268
|
+
_context.next = 38;
|
|
3077
3269
|
break;
|
|
3078
3270
|
}
|
|
3079
3271
|
|
|
3080
|
-
return _context.abrupt("return",
|
|
3272
|
+
return _context.abrupt("return", handler.show(stacks.getItem(_prevIndex), pageConfig, _prevIndex));
|
|
3081
3273
|
|
|
3082
|
-
case
|
|
3083
|
-
_context.next =
|
|
3274
|
+
case 38:
|
|
3275
|
+
_context.next = 41;
|
|
3084
3276
|
break;
|
|
3085
3277
|
|
|
3086
|
-
case
|
|
3087
|
-
|
|
3278
|
+
case 40:
|
|
3279
|
+
if (action === 'REPLACE') {
|
|
3280
|
+
_delta = stacks.getDelta(pathname); // NOTE: 页面路由记录并不会清空,只是移除掉缓存的 stack 以及页面
|
|
3088
3281
|
|
|
3089
|
-
|
|
3282
|
+
handler.unload(currentPage, _delta);
|
|
3283
|
+
} else if (action === 'PUSH') {
|
|
3284
|
+
handler.hide(currentPage);
|
|
3285
|
+
}
|
|
3090
3286
|
|
|
3091
|
-
case
|
|
3287
|
+
case 41:
|
|
3092
3288
|
shouldLoad = true;
|
|
3093
3289
|
|
|
3094
|
-
case
|
|
3290
|
+
case 42:
|
|
3095
3291
|
if (!(shouldLoad || stacks.length < 1)) {
|
|
3096
|
-
_context.next =
|
|
3292
|
+
_context.next = 50;
|
|
3097
3293
|
break;
|
|
3098
3294
|
}
|
|
3099
3295
|
|
|
@@ -3102,10 +3298,10 @@ function createRouter(app, config, framework) {
|
|
|
3102
3298
|
stacksIndex = stacks.length;
|
|
3103
3299
|
delete loadConfig['path'];
|
|
3104
3300
|
delete loadConfig['load'];
|
|
3105
|
-
page = runtime.createPageConfig(enablePullDownRefresh ? (_d = runtimeHooks.createPullDownComponent) === null || _d === void 0 ? void 0 : _d.call(runtimeHooks, el, location.pathname, framework,
|
|
3106
|
-
return _context.abrupt("return",
|
|
3301
|
+
page = runtime.createPageConfig(enablePullDownRefresh ? (_d = runtimeHooks.createPullDownComponent) === null || _d === void 0 ? void 0 : _d.call(runtimeHooks, el, location.pathname, framework, handler.PullDownRefresh) : el, pathname + runtime.stringify(handler.getQuery(stacksIndex)), {}, loadConfig);
|
|
3302
|
+
return _context.abrupt("return", handler.load(page, pageConfig, stacksIndex));
|
|
3107
3303
|
|
|
3108
|
-
case
|
|
3304
|
+
case 50:
|
|
3109
3305
|
case "end":
|
|
3110
3306
|
return _context.stop();
|
|
3111
3307
|
}
|
|
@@ -3119,14 +3315,14 @@ function createRouter(app, config, framework) {
|
|
|
3119
3315
|
}();
|
|
3120
3316
|
|
|
3121
3317
|
if (exports.history.location.pathname === '/') {
|
|
3122
|
-
exports.history.replace(prependBasename(
|
|
3318
|
+
exports.history.replace(prependBasename(entryPagePath + exports.history.location.search));
|
|
3123
3319
|
}
|
|
3124
3320
|
|
|
3125
3321
|
render({
|
|
3126
3322
|
location: exports.history.location,
|
|
3127
3323
|
action: r.Push
|
|
3128
3324
|
});
|
|
3129
|
-
app.onShow(
|
|
3325
|
+
app.onShow(handler.getQuery(stacks.length));
|
|
3130
3326
|
return exports.history.listen(render);
|
|
3131
3327
|
}
|
|
3132
3328
|
|
|
@@ -3257,7 +3453,7 @@ function processOpenApi(apiName, defaultOptions, formatResult = res => res, form
|
|
|
3257
3453
|
return p;
|
|
3258
3454
|
};
|
|
3259
3455
|
}
|
|
3260
|
-
const easeInOut = t => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
3456
|
+
const easeInOut = (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
3261
3457
|
const getTimingFunc = (easeFunc, frameCnt) => {
|
|
3262
3458
|
return x => {
|
|
3263
3459
|
if (frameCnt <= 1) {
|
|
@@ -4505,7 +4701,9 @@ const onNetworkStatusChange = (cb) => {
|
|
|
4505
4701
|
});
|
|
4506
4702
|
});
|
|
4507
4703
|
}
|
|
4508
|
-
};
|
|
4704
|
+
};
|
|
4705
|
+
const offNetworkStatusChange = temporarilyNotSupport('offNetworkStatusChange');
|
|
4706
|
+
const getLocalIPAddress = temporarilyNotSupport('getLocalIPAddress');
|
|
4509
4707
|
|
|
4510
4708
|
const updateWeChatApp = temporarilyNotSupport('updateWeChatApp');
|
|
4511
4709
|
const getUpdateManager = temporarilyNotSupport('getUpdateManager');
|
|
@@ -4936,6 +5134,19 @@ const onBackgroundFetchData = temporarilyNotSupport('onBackgroundFetchData');
|
|
|
4936
5134
|
const getBackgroundFetchToken = temporarilyNotSupport('getBackgroundFetchToken');
|
|
4937
5135
|
const getBackgroundFetchData = temporarilyNotSupport('getBackgroundFetchData');
|
|
4938
5136
|
|
|
5137
|
+
function getItem(key) {
|
|
5138
|
+
let item;
|
|
5139
|
+
try {
|
|
5140
|
+
item = JSON.parse(localStorage.getItem(key) || '');
|
|
5141
|
+
}
|
|
5142
|
+
catch (e) { }
|
|
5143
|
+
if (item && typeof item === 'object' && item.hasOwnProperty('data')) {
|
|
5144
|
+
return { result: true, data: item.data };
|
|
5145
|
+
}
|
|
5146
|
+
else {
|
|
5147
|
+
return { result: false };
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
4939
5150
|
const setStorageSync = (key, data = '') => {
|
|
4940
5151
|
if (typeof key !== 'string') {
|
|
4941
5152
|
console.error(getParameterError({
|
|
@@ -4976,15 +5187,27 @@ const setStorage = (options) => {
|
|
|
4976
5187
|
setStorageSync(key, data);
|
|
4977
5188
|
return handle.success();
|
|
4978
5189
|
};
|
|
4979
|
-
const
|
|
5190
|
+
const revokeBufferURL = temporarilyNotSupport('revokeBufferURL');
|
|
5191
|
+
const removeStorageSync = (key) => {
|
|
5192
|
+
if (typeof key !== 'string') {
|
|
5193
|
+
console.error(getParameterError({
|
|
5194
|
+
name: 'removeStorage',
|
|
5195
|
+
correct: 'String',
|
|
5196
|
+
wrong: key
|
|
5197
|
+
}));
|
|
5198
|
+
return;
|
|
5199
|
+
}
|
|
5200
|
+
localStorage.removeItem(key);
|
|
5201
|
+
};
|
|
5202
|
+
const removeStorage = (options) => {
|
|
4980
5203
|
const isObject = shouldBeObject(options);
|
|
4981
5204
|
if (!isObject.flag) {
|
|
4982
|
-
const res = { errMsg: `
|
|
5205
|
+
const res = { errMsg: `removeStorage:fail ${isObject.msg}` };
|
|
4983
5206
|
console.error(res.errMsg);
|
|
4984
5207
|
return Promise.reject(res);
|
|
4985
5208
|
}
|
|
4986
5209
|
const { key, success, fail, complete } = options;
|
|
4987
|
-
const handle = new MethodHandler({ name: '
|
|
5210
|
+
const handle = new MethodHandler({ name: 'removeStorage', success, fail, complete });
|
|
4988
5211
|
if (typeof key !== 'string') {
|
|
4989
5212
|
return handle.fail({
|
|
4990
5213
|
errMsg: getParameterError({
|
|
@@ -4994,15 +5217,8 @@ const getStorage = (options) => {
|
|
|
4994
5217
|
})
|
|
4995
5218
|
});
|
|
4996
5219
|
}
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
return handle.success({ data });
|
|
5000
|
-
}
|
|
5001
|
-
else {
|
|
5002
|
-
return handle.fail({
|
|
5003
|
-
errMsg: 'data not found'
|
|
5004
|
-
});
|
|
5005
|
-
}
|
|
5220
|
+
removeStorageSync(key);
|
|
5221
|
+
return handle.success();
|
|
5006
5222
|
};
|
|
5007
5223
|
const getStorageSync = (key) => {
|
|
5008
5224
|
if (typeof key !== 'string') {
|
|
@@ -5018,19 +5234,6 @@ const getStorageSync = (key) => {
|
|
|
5018
5234
|
return res.data;
|
|
5019
5235
|
return '';
|
|
5020
5236
|
};
|
|
5021
|
-
function getItem(key) {
|
|
5022
|
-
let item;
|
|
5023
|
-
try {
|
|
5024
|
-
item = JSON.parse(localStorage.getItem(key) || '');
|
|
5025
|
-
}
|
|
5026
|
-
catch (e) { }
|
|
5027
|
-
if (item && typeof item === 'object' && item.hasOwnProperty('data')) {
|
|
5028
|
-
return { result: true, data: item.data };
|
|
5029
|
-
}
|
|
5030
|
-
else {
|
|
5031
|
-
return { result: false };
|
|
5032
|
-
}
|
|
5033
|
-
}
|
|
5034
5237
|
const getStorageInfoSync = () => {
|
|
5035
5238
|
const res = {
|
|
5036
5239
|
keys: Object.keys(localStorage),
|
|
@@ -5043,26 +5246,15 @@ const getStorageInfo = ({ success, fail, complete } = {}) => {
|
|
|
5043
5246
|
const handle = new MethodHandler({ name: 'getStorageInfo', success, fail, complete });
|
|
5044
5247
|
return handle.success(getStorageInfoSync());
|
|
5045
5248
|
};
|
|
5046
|
-
const
|
|
5047
|
-
if (typeof key !== 'string') {
|
|
5048
|
-
console.error(getParameterError({
|
|
5049
|
-
name: 'removeStorage',
|
|
5050
|
-
correct: 'String',
|
|
5051
|
-
wrong: key
|
|
5052
|
-
}));
|
|
5053
|
-
return;
|
|
5054
|
-
}
|
|
5055
|
-
localStorage.removeItem(key);
|
|
5056
|
-
};
|
|
5057
|
-
const removeStorage = (options) => {
|
|
5249
|
+
const getStorage = (options) => {
|
|
5058
5250
|
const isObject = shouldBeObject(options);
|
|
5059
5251
|
if (!isObject.flag) {
|
|
5060
|
-
const res = { errMsg: `
|
|
5252
|
+
const res = { errMsg: `getStorage:fail ${isObject.msg}` };
|
|
5061
5253
|
console.error(res.errMsg);
|
|
5062
5254
|
return Promise.reject(res);
|
|
5063
5255
|
}
|
|
5064
5256
|
const { key, success, fail, complete } = options;
|
|
5065
|
-
const handle = new MethodHandler({ name: '
|
|
5257
|
+
const handle = new MethodHandler({ name: 'getStorage', success, fail, complete });
|
|
5066
5258
|
if (typeof key !== 'string') {
|
|
5067
5259
|
return handle.fail({
|
|
5068
5260
|
errMsg: getParameterError({
|
|
@@ -5072,18 +5264,25 @@ const removeStorage = (options) => {
|
|
|
5072
5264
|
})
|
|
5073
5265
|
});
|
|
5074
5266
|
}
|
|
5075
|
-
|
|
5076
|
-
|
|
5267
|
+
const { result, data } = getItem(key);
|
|
5268
|
+
if (result) {
|
|
5269
|
+
return handle.success({ data });
|
|
5270
|
+
}
|
|
5271
|
+
else {
|
|
5272
|
+
return handle.fail({
|
|
5273
|
+
errMsg: 'data not found'
|
|
5274
|
+
});
|
|
5275
|
+
}
|
|
5276
|
+
};
|
|
5277
|
+
const createBufferURL = temporarilyNotSupport('createBufferURL');
|
|
5278
|
+
const clearStorageSync = () => {
|
|
5279
|
+
localStorage.clear();
|
|
5077
5280
|
};
|
|
5078
5281
|
const clearStorage = ({ success, fail, complete } = {}) => {
|
|
5079
5282
|
const handle = new MethodHandler({ name: 'clearStorage', success, fail, complete });
|
|
5080
|
-
|
|
5283
|
+
clearStorageSync();
|
|
5081
5284
|
return handle.success();
|
|
5082
|
-
};
|
|
5083
|
-
const clearStorageSync = () => {
|
|
5084
|
-
clearStorage();
|
|
5085
|
-
};
|
|
5086
|
-
const revokeBufferURL = temporarilyNotSupport('revokeBufferURL');
|
|
5285
|
+
};
|
|
5087
5286
|
|
|
5088
5287
|
const CLIPBOARD_STORAGE_NAME = 'taro_clipboard';
|
|
5089
5288
|
document.addEventListener('copy', () => {
|
|
@@ -5522,23 +5721,28 @@ class InnerAudioContext {
|
|
|
5522
5721
|
this.stopStack = new CallbackManager();
|
|
5523
5722
|
Taro.eventCenter.on('__taroRouterChange', () => { this.stop(); });
|
|
5524
5723
|
}
|
|
5525
|
-
set autoplay(e) {
|
|
5724
|
+
set autoplay(e) { this.setProperty('autoplay', e); }
|
|
5526
5725
|
get autoplay() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.autoplay) || false; }
|
|
5527
5726
|
get buffered() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.buffered.length) || 0; }
|
|
5528
5727
|
get currentTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.currentTime) || 0; }
|
|
5529
5728
|
get duration() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.duration) || 0; }
|
|
5530
|
-
set loop(e) {
|
|
5729
|
+
set loop(e) { this.setProperty('loop', e); }
|
|
5531
5730
|
get loop() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.loop) || false; }
|
|
5532
5731
|
get paused() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused) || true; }
|
|
5533
|
-
set src(e) {
|
|
5732
|
+
set src(e) { this.setProperty('src', e); }
|
|
5534
5733
|
get src() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.src) || ''; }
|
|
5535
|
-
set volume(e) {
|
|
5734
|
+
set volume(e) { this.setProperty('volume', e); }
|
|
5536
5735
|
get volume() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
|
|
5537
|
-
set playbackRate(e) {
|
|
5736
|
+
set playbackRate(e) { this.setProperty('playbackRate', e); }
|
|
5538
5737
|
get playbackRate() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
|
|
5539
5738
|
get obeyMuteSwitch() { return true; }
|
|
5540
|
-
set startTime(e) {
|
|
5739
|
+
set startTime(e) { this.setProperty('startTime', e); }
|
|
5541
5740
|
get startTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
|
|
5741
|
+
setProperty(key, value) {
|
|
5742
|
+
if (this.Instance) {
|
|
5743
|
+
this.Instance[key] = value;
|
|
5744
|
+
}
|
|
5745
|
+
}
|
|
5542
5746
|
}
|
|
5543
5747
|
const stopVoice = temporarilyNotSupport('stopVoice');
|
|
5544
5748
|
const setInnerAudioOption = temporarilyNotSupport('setInnerAudioOption');
|
|
@@ -5579,186 +5783,107 @@ class EditorContext {
|
|
|
5579
5783
|
}
|
|
5580
5784
|
}
|
|
5581
5785
|
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
}
|
|
5659
|
-
}
|
|
5660
|
-
}, _callee, null, [[8, 14]]);
|
|
5661
|
-
}));
|
|
5662
|
-
return _previewImage.apply(this, arguments);
|
|
5663
|
-
}
|
|
5664
|
-
|
|
5665
|
-
function loadImage(url, fail) {
|
|
5666
|
-
return new Promise(function (resolve) {
|
|
5667
|
-
var item = document.createElement('taro-swiper-item-core');
|
|
5668
|
-
item.style.cssText = "\n display: flex;\n align-items: start;\n justify-content: center;\n overflow-y: scroll;\n ";
|
|
5669
|
-
var image = new Image();
|
|
5670
|
-
image.style.maxWidth = '100%';
|
|
5671
|
-
image.src = url;
|
|
5672
|
-
var div = document.createElement('div');
|
|
5673
|
-
div.style.cssText = "\n display: flex;\n align-items: center;\n justify-content: center;\n max-width: 100%;\n min-height: 100%;\n ";
|
|
5674
|
-
div.appendChild(image);
|
|
5675
|
-
item.appendChild(div); // Note: 等待图片加载完后返回,会导致轮播被卡住
|
|
5676
|
-
|
|
5677
|
-
resolve(item);
|
|
5678
|
-
|
|
5679
|
-
if (typeof fail === 'function') {
|
|
5680
|
-
image.addEventListener('error', function (err) {
|
|
5681
|
-
fail(err);
|
|
5682
|
-
});
|
|
5683
|
-
}
|
|
5684
|
-
});
|
|
5685
|
-
}
|
|
5686
|
-
|
|
5687
|
-
// const ORIENTATION_MAP = {
|
|
5688
|
-
// // up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
|
5689
|
-
// 1: 'up',
|
|
5690
|
-
// // up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
|
5691
|
-
// 2: 'up-mirrored',
|
|
5692
|
-
// // down 旋转180度,对应 Exif 中的 3
|
|
5693
|
-
// 3: 'down',
|
|
5694
|
-
// // down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
|
5695
|
-
// 4: 'down-mirrored',
|
|
5696
|
-
// // left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
|
5697
|
-
// 5: 'left-mirrored',
|
|
5698
|
-
// // right 顺时针旋转90度,对应 Exif 中的 6
|
|
5699
|
-
// 6: 'right',
|
|
5700
|
-
// // right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
|
5701
|
-
// 7: 'right-mirrored',
|
|
5702
|
-
// // left 逆时针旋转90度,对应 Exif 中的 8
|
|
5703
|
-
// 8: 'left'
|
|
5704
|
-
// }
|
|
5705
|
-
|
|
5706
|
-
/**
|
|
5707
|
-
* @typedef {'up'|'up-mirrored'|'down'|'down-mirrored'|'left-mirrored'|'right'|'right-mirrored'|'left'} Orientation
|
|
5708
|
-
* @typedef ImageInfo object.success 回调函数的参数
|
|
5709
|
-
* @property {number} width 图片原始宽度,单位px。不考虑旋转。
|
|
5710
|
-
* @property {number} height 图片原始高度,单位px。不考虑旋转。
|
|
5711
|
-
* @property {string} path 图片的本地路径
|
|
5712
|
-
* @property {Orientation} orientation 拍照时设备方向
|
|
5713
|
-
* @property {string} type 图片格式
|
|
5714
|
-
*/
|
|
5715
|
-
|
|
5716
|
-
/**
|
|
5717
|
-
* 获取图片信息。网络图片需先配置download域名才能生效。
|
|
5718
|
-
* @param {Object} object 参数
|
|
5719
|
-
* @param {string} object.src 图片的路径,可以是相对路径、临时文件路径、存储文件路径、网络图片路径
|
|
5720
|
-
* @param {(res: ImageInfo) => void} [object.success] 接口调用成功的回调函数
|
|
5721
|
-
* @param {function} [object.fail] 接口调用失败的回调函数
|
|
5722
|
-
* @param {function} [object.complete] 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
5723
|
-
*/
|
|
5724
|
-
var getImageInfo = function getImageInfo() {
|
|
5725
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
5726
|
-
src = _ref.src,
|
|
5727
|
-
success = _ref.success,
|
|
5728
|
-
fail = _ref.fail,
|
|
5729
|
-
complete = _ref.complete;
|
|
5730
|
-
|
|
5731
|
-
return new Promise(function (resolve, reject) {
|
|
5732
|
-
var onSuccess = function onSuccess(res) {
|
|
5733
|
-
success && success(res);
|
|
5734
|
-
complete && complete();
|
|
5735
|
-
resolve(res);
|
|
5736
|
-
};
|
|
5737
|
-
|
|
5738
|
-
var onError = function onError(res) {
|
|
5739
|
-
fail && fail(res);
|
|
5740
|
-
complete && complete();
|
|
5741
|
-
reject(res);
|
|
5742
|
-
};
|
|
5743
|
-
|
|
5744
|
-
var image = new Image();
|
|
5745
|
-
|
|
5746
|
-
image.onload = function () {
|
|
5747
|
-
onSuccess({
|
|
5748
|
-
errMsg: 'getImageInfo:ok',
|
|
5749
|
-
width: image.naturalWidth,
|
|
5750
|
-
height: image.naturalHeight
|
|
5751
|
-
});
|
|
5752
|
-
};
|
|
5753
|
-
|
|
5754
|
-
image.onerror = function (e) {
|
|
5755
|
-
onError({
|
|
5756
|
-
errMsg: "getImageInfo:fail ".concat(e.message)
|
|
5757
|
-
});
|
|
5758
|
-
};
|
|
5786
|
+
const previewImage = async (options) => {
|
|
5787
|
+
function loadImage(url, loadFail) {
|
|
5788
|
+
return new Promise((resolve) => {
|
|
5789
|
+
const item = document.createElement('taro-swiper-item-core');
|
|
5790
|
+
item.style.cssText = `
|
|
5791
|
+
display: flex;
|
|
5792
|
+
align-items: start;
|
|
5793
|
+
justify-content: center;
|
|
5794
|
+
overflow-y: scroll;
|
|
5795
|
+
`;
|
|
5796
|
+
const image = new Image();
|
|
5797
|
+
image.style.maxWidth = '100%';
|
|
5798
|
+
image.src = url;
|
|
5799
|
+
const div = document.createElement('div');
|
|
5800
|
+
div.style.cssText = `
|
|
5801
|
+
display: flex;
|
|
5802
|
+
align-items: center;
|
|
5803
|
+
justify-content: center;
|
|
5804
|
+
max-width: 100%;
|
|
5805
|
+
min-height: 100%;
|
|
5806
|
+
`;
|
|
5807
|
+
div.appendChild(image);
|
|
5808
|
+
item.appendChild(div);
|
|
5809
|
+
resolve(item);
|
|
5810
|
+
if (typeof loadFail === 'function') {
|
|
5811
|
+
image.addEventListener('error', (err) => {
|
|
5812
|
+
loadFail({ errMsg: err.message });
|
|
5813
|
+
});
|
|
5814
|
+
}
|
|
5815
|
+
});
|
|
5816
|
+
}
|
|
5817
|
+
const isObject = shouldBeObject(options);
|
|
5818
|
+
if (!isObject.flag) {
|
|
5819
|
+
const res = { errMsg: `previewImage:fail ${isObject.msg}` };
|
|
5820
|
+
console.error(res.errMsg);
|
|
5821
|
+
return Promise.reject(res);
|
|
5822
|
+
}
|
|
5823
|
+
const { urls = [], current = '', success, fail, complete } = options;
|
|
5824
|
+
const handle = new MethodHandler({ name: 'previewImage', success, fail, complete });
|
|
5825
|
+
const container = document.createElement('div');
|
|
5826
|
+
container.classList.add('preview-image');
|
|
5827
|
+
container.style.cssText = `
|
|
5828
|
+
position: fixed;
|
|
5829
|
+
top: 0;
|
|
5830
|
+
left: 0;
|
|
5831
|
+
z-index: 1050;
|
|
5832
|
+
width: 100%;
|
|
5833
|
+
height: 100%;
|
|
5834
|
+
overflow: hidden;
|
|
5835
|
+
outline: 0;
|
|
5836
|
+
background-color: #111;
|
|
5837
|
+
`;
|
|
5838
|
+
container.addEventListener('click', () => {
|
|
5839
|
+
container.remove();
|
|
5840
|
+
});
|
|
5841
|
+
const swiper = document.createElement('taro-swiper-core');
|
|
5842
|
+
swiper.full = true;
|
|
5843
|
+
let children = [];
|
|
5844
|
+
try {
|
|
5845
|
+
children = await Promise.all(urls.map(e => loadImage(e, fail)));
|
|
5846
|
+
}
|
|
5847
|
+
catch (error) {
|
|
5848
|
+
return handle.fail({
|
|
5849
|
+
errMsg: error
|
|
5850
|
+
});
|
|
5851
|
+
}
|
|
5852
|
+
for (let i = 0; i < children.length; i++) {
|
|
5853
|
+
const child = children[i];
|
|
5854
|
+
swiper.appendChild(child);
|
|
5855
|
+
}
|
|
5856
|
+
const currentIndex = urls.indexOf(current);
|
|
5857
|
+
swiper.current = currentIndex;
|
|
5858
|
+
container.appendChild(swiper);
|
|
5859
|
+
document.body.appendChild(container);
|
|
5860
|
+
return handle.success();
|
|
5861
|
+
};
|
|
5759
5862
|
|
|
5760
|
-
|
|
5761
|
-
|
|
5863
|
+
const getImageInfo = (options) => {
|
|
5864
|
+
const isObject = shouldBeObject(options);
|
|
5865
|
+
if (!isObject.flag) {
|
|
5866
|
+
const res = { errMsg: `getImageInfo:fail ${isObject.msg}` };
|
|
5867
|
+
console.error(res.errMsg);
|
|
5868
|
+
return Promise.reject(res);
|
|
5869
|
+
}
|
|
5870
|
+
const { src, success, fail, complete } = options;
|
|
5871
|
+
const handle = new MethodHandler({ name: 'getImageInfo', success, fail, complete });
|
|
5872
|
+
return new Promise((resolve, reject) => {
|
|
5873
|
+
const image = new Image();
|
|
5874
|
+
image.onload = () => {
|
|
5875
|
+
handle.success({
|
|
5876
|
+
width: image.naturalWidth,
|
|
5877
|
+
height: image.naturalHeight
|
|
5878
|
+
}, resolve);
|
|
5879
|
+
};
|
|
5880
|
+
image.onerror = (e) => {
|
|
5881
|
+
handle.fail({
|
|
5882
|
+
errMsg: e.message
|
|
5883
|
+
}, reject);
|
|
5884
|
+
};
|
|
5885
|
+
image.src = src;
|
|
5886
|
+
});
|
|
5762
5887
|
};
|
|
5763
5888
|
|
|
5764
5889
|
const chooseImage = function (options) {
|
|
@@ -5934,6 +6059,137 @@ const navigateToMiniProgram = temporarilyNotSupport('navigateToMiniProgram');
|
|
|
5934
6059
|
const navigateBackMiniProgram = temporarilyNotSupport('navigateBackMiniProgram');
|
|
5935
6060
|
const exitMiniProgram = temporarilyNotSupport('exitMiniProgram');
|
|
5936
6061
|
|
|
6062
|
+
const NETWORK_TIMEOUT = 60000;
|
|
6063
|
+
const XHR_STATS = {
|
|
6064
|
+
UNSENT: 0,
|
|
6065
|
+
OPENED: 1,
|
|
6066
|
+
HEADERS_RECEIVED: 2,
|
|
6067
|
+
LOADING: 3,
|
|
6068
|
+
DONE: 4
|
|
6069
|
+
};
|
|
6070
|
+
const setHeader = (xhr, header) => {
|
|
6071
|
+
let headerKey;
|
|
6072
|
+
for (headerKey in header) {
|
|
6073
|
+
xhr.setRequestHeader(headerKey, header[headerKey]);
|
|
6074
|
+
}
|
|
6075
|
+
};
|
|
6076
|
+
const convertObjectUrlToBlob = url => {
|
|
6077
|
+
return new Promise((resolve, reject) => {
|
|
6078
|
+
const xhr = new XMLHttpRequest();
|
|
6079
|
+
xhr.open('GET', url, true);
|
|
6080
|
+
xhr.responseType = 'blob';
|
|
6081
|
+
xhr.onload = function () {
|
|
6082
|
+
if (this.status === 200) {
|
|
6083
|
+
resolve(this.response);
|
|
6084
|
+
}
|
|
6085
|
+
else {
|
|
6086
|
+
reject({ status: this.status });
|
|
6087
|
+
}
|
|
6088
|
+
};
|
|
6089
|
+
xhr.send();
|
|
6090
|
+
});
|
|
6091
|
+
};
|
|
6092
|
+
|
|
6093
|
+
const createDownloadTask = ({ url, header, success, error }) => {
|
|
6094
|
+
let timeout;
|
|
6095
|
+
const apiName = 'downloadFile';
|
|
6096
|
+
const xhr = new XMLHttpRequest();
|
|
6097
|
+
const callbackManager = {
|
|
6098
|
+
headersReceived: new CallbackManager(),
|
|
6099
|
+
progressUpdate: new CallbackManager()
|
|
6100
|
+
};
|
|
6101
|
+
xhr.open('GET', url, true);
|
|
6102
|
+
xhr.responseType = 'blob';
|
|
6103
|
+
setHeader(xhr, header);
|
|
6104
|
+
xhr.onprogress = e => {
|
|
6105
|
+
const { loaded, total } = e;
|
|
6106
|
+
callbackManager.progressUpdate.trigger({
|
|
6107
|
+
progress: Math.round(loaded / total * 100),
|
|
6108
|
+
totalBytesWritten: loaded,
|
|
6109
|
+
totalBytesExpectedToWrite: total
|
|
6110
|
+
});
|
|
6111
|
+
};
|
|
6112
|
+
xhr.onreadystatechange = () => {
|
|
6113
|
+
if (xhr.readyState !== XHR_STATS.HEADERS_RECEIVED)
|
|
6114
|
+
return;
|
|
6115
|
+
callbackManager.headersReceived.trigger({
|
|
6116
|
+
header: xhr.getAllResponseHeaders()
|
|
6117
|
+
});
|
|
6118
|
+
};
|
|
6119
|
+
xhr.onload = () => {
|
|
6120
|
+
const response = xhr.response;
|
|
6121
|
+
const status = xhr.status;
|
|
6122
|
+
success({
|
|
6123
|
+
errMsg: `${apiName}:ok`,
|
|
6124
|
+
statusCode: status,
|
|
6125
|
+
tempFilePath: window.URL.createObjectURL(response)
|
|
6126
|
+
});
|
|
6127
|
+
};
|
|
6128
|
+
xhr.onabort = () => {
|
|
6129
|
+
clearTimeout(timeout);
|
|
6130
|
+
error({
|
|
6131
|
+
errMsg: `${apiName}:fail abort`
|
|
6132
|
+
});
|
|
6133
|
+
};
|
|
6134
|
+
xhr.onerror = (e) => {
|
|
6135
|
+
error({
|
|
6136
|
+
errMsg: `${apiName}:fail ${e.message}`
|
|
6137
|
+
});
|
|
6138
|
+
};
|
|
6139
|
+
const abort = () => {
|
|
6140
|
+
xhr.abort();
|
|
6141
|
+
};
|
|
6142
|
+
const send = () => {
|
|
6143
|
+
xhr.send();
|
|
6144
|
+
timeout = setTimeout(() => {
|
|
6145
|
+
xhr.onabort = null;
|
|
6146
|
+
xhr.onload = null;
|
|
6147
|
+
xhr.onprogress = null;
|
|
6148
|
+
xhr.onreadystatechange = null;
|
|
6149
|
+
xhr.onerror = null;
|
|
6150
|
+
abort();
|
|
6151
|
+
error({
|
|
6152
|
+
errMsg: `${apiName}:fail timeout`
|
|
6153
|
+
});
|
|
6154
|
+
}, NETWORK_TIMEOUT);
|
|
6155
|
+
};
|
|
6156
|
+
send();
|
|
6157
|
+
const onHeadersReceived = callbackManager.headersReceived.add;
|
|
6158
|
+
const offHeadersReceived = callbackManager.headersReceived.remove;
|
|
6159
|
+
const onProgressUpdate = callbackManager.progressUpdate.add;
|
|
6160
|
+
const offProgressUpdate = callbackManager.progressUpdate.remove;
|
|
6161
|
+
return {
|
|
6162
|
+
abort,
|
|
6163
|
+
onHeadersReceived,
|
|
6164
|
+
offHeadersReceived,
|
|
6165
|
+
onProgressUpdate,
|
|
6166
|
+
offProgressUpdate
|
|
6167
|
+
};
|
|
6168
|
+
};
|
|
6169
|
+
const downloadFile = ({ url, header, success, fail, complete }) => {
|
|
6170
|
+
let task;
|
|
6171
|
+
const result = new Promise((resolve, reject) => {
|
|
6172
|
+
task = createDownloadTask({
|
|
6173
|
+
url,
|
|
6174
|
+
header,
|
|
6175
|
+
success: res => {
|
|
6176
|
+
success && success(res);
|
|
6177
|
+
complete && complete(res);
|
|
6178
|
+
resolve(res);
|
|
6179
|
+
},
|
|
6180
|
+
error: res => {
|
|
6181
|
+
fail && fail(res);
|
|
6182
|
+
complete && complete(res);
|
|
6183
|
+
reject(res);
|
|
6184
|
+
}
|
|
6185
|
+
});
|
|
6186
|
+
result.headersReceive = task.onHeadersReceived;
|
|
6187
|
+
result.progress = task.onProgressUpdate;
|
|
6188
|
+
result.abort = task.abort;
|
|
6189
|
+
});
|
|
6190
|
+
return result;
|
|
6191
|
+
};
|
|
6192
|
+
|
|
5937
6193
|
const stopLocalServiceDiscovery = temporarilyNotSupport('stopLocalServiceDiscovery');
|
|
5938
6194
|
const startLocalServiceDiscovery = temporarilyNotSupport('startLocalServiceDiscovery');
|
|
5939
6195
|
const onLocalServiceResolveFail = temporarilyNotSupport('onLocalServiceResolveFail');
|
|
@@ -7204,6 +7460,133 @@ const createTCPSocket = temporarilyNotSupport('createTCPSocket');
|
|
|
7204
7460
|
|
|
7205
7461
|
const createUDPSocket = temporarilyNotSupport('createUDPSocket');
|
|
7206
7462
|
|
|
7463
|
+
const createUploadTask = ({ url, filePath, formData, name, header, timeout, fileName, success, error }) => {
|
|
7464
|
+
let timeoutInter;
|
|
7465
|
+
let formKey;
|
|
7466
|
+
const apiName = 'uploadFile';
|
|
7467
|
+
const xhr = new XMLHttpRequest();
|
|
7468
|
+
const form = new FormData();
|
|
7469
|
+
const callbackManager = {
|
|
7470
|
+
headersReceived: new CallbackManager(),
|
|
7471
|
+
progressUpdate: new CallbackManager()
|
|
7472
|
+
};
|
|
7473
|
+
xhr.open('POST', url);
|
|
7474
|
+
setHeader(xhr, header);
|
|
7475
|
+
for (formKey in formData) {
|
|
7476
|
+
form.append(formKey, formData[formKey]);
|
|
7477
|
+
}
|
|
7478
|
+
xhr.upload.onprogress = e => {
|
|
7479
|
+
const { loaded, total } = e;
|
|
7480
|
+
callbackManager.progressUpdate.trigger({
|
|
7481
|
+
progress: Math.round(loaded / total * 100),
|
|
7482
|
+
totalBytesSent: loaded,
|
|
7483
|
+
totalBytesExpectedToSent: total
|
|
7484
|
+
});
|
|
7485
|
+
};
|
|
7486
|
+
xhr.onreadystatechange = () => {
|
|
7487
|
+
if (xhr.readyState !== XHR_STATS.HEADERS_RECEIVED)
|
|
7488
|
+
return;
|
|
7489
|
+
callbackManager.headersReceived.trigger({
|
|
7490
|
+
header: xhr.getAllResponseHeaders()
|
|
7491
|
+
});
|
|
7492
|
+
};
|
|
7493
|
+
xhr.onload = () => {
|
|
7494
|
+
const status = xhr.status;
|
|
7495
|
+
clearTimeout(timeoutInter);
|
|
7496
|
+
success({
|
|
7497
|
+
errMsg: `${apiName}:ok`,
|
|
7498
|
+
statusCode: status,
|
|
7499
|
+
data: xhr.responseText || xhr.response
|
|
7500
|
+
});
|
|
7501
|
+
};
|
|
7502
|
+
xhr.onabort = () => {
|
|
7503
|
+
clearTimeout(timeoutInter);
|
|
7504
|
+
error({
|
|
7505
|
+
errMsg: `${apiName}:fail abort`
|
|
7506
|
+
});
|
|
7507
|
+
};
|
|
7508
|
+
xhr.onerror = (e) => {
|
|
7509
|
+
clearTimeout(timeoutInter);
|
|
7510
|
+
error({
|
|
7511
|
+
errMsg: `${apiName}:fail ${e.message}`
|
|
7512
|
+
});
|
|
7513
|
+
};
|
|
7514
|
+
const abort = () => {
|
|
7515
|
+
clearTimeout(timeoutInter);
|
|
7516
|
+
xhr.abort();
|
|
7517
|
+
};
|
|
7518
|
+
const send = () => {
|
|
7519
|
+
xhr.send(form);
|
|
7520
|
+
timeoutInter = setTimeout(() => {
|
|
7521
|
+
xhr.onabort = null;
|
|
7522
|
+
xhr.onload = null;
|
|
7523
|
+
xhr.upload.onprogress = null;
|
|
7524
|
+
xhr.onreadystatechange = null;
|
|
7525
|
+
xhr.onerror = null;
|
|
7526
|
+
abort();
|
|
7527
|
+
error({
|
|
7528
|
+
errMsg: `${apiName}:fail timeout`
|
|
7529
|
+
});
|
|
7530
|
+
}, timeout || NETWORK_TIMEOUT);
|
|
7531
|
+
};
|
|
7532
|
+
convertObjectUrlToBlob(filePath)
|
|
7533
|
+
.then((fileObj) => {
|
|
7534
|
+
if (!fileName) {
|
|
7535
|
+
fileName = typeof fileObj !== 'string' && fileObj.name;
|
|
7536
|
+
}
|
|
7537
|
+
form.append(name, fileObj, fileName || `file-${Date.now()}`);
|
|
7538
|
+
send();
|
|
7539
|
+
})
|
|
7540
|
+
.catch(e => {
|
|
7541
|
+
error({
|
|
7542
|
+
errMsg: `${apiName}:fail ${e.message}`
|
|
7543
|
+
});
|
|
7544
|
+
});
|
|
7545
|
+
const onHeadersReceived = callbackManager.headersReceived.add;
|
|
7546
|
+
const offHeadersReceived = callbackManager.headersReceived.remove;
|
|
7547
|
+
const onProgressUpdate = callbackManager.progressUpdate.add;
|
|
7548
|
+
const offProgressUpdate = callbackManager.progressUpdate.remove;
|
|
7549
|
+
const headersReceived = temporarilyNotSupport('UploadTask.headersReceived');
|
|
7550
|
+
const progress = temporarilyNotSupport('UploadTask.progress');
|
|
7551
|
+
return {
|
|
7552
|
+
abort,
|
|
7553
|
+
onHeadersReceived,
|
|
7554
|
+
offHeadersReceived,
|
|
7555
|
+
onProgressUpdate,
|
|
7556
|
+
offProgressUpdate,
|
|
7557
|
+
headersReceived,
|
|
7558
|
+
progress
|
|
7559
|
+
};
|
|
7560
|
+
};
|
|
7561
|
+
const uploadFile = ({ url, filePath, name, header, formData, timeout, fileName, success, fail, complete }) => {
|
|
7562
|
+
let task;
|
|
7563
|
+
const result = new Promise((resolve, reject) => {
|
|
7564
|
+
task = createUploadTask({
|
|
7565
|
+
url,
|
|
7566
|
+
header,
|
|
7567
|
+
name,
|
|
7568
|
+
filePath,
|
|
7569
|
+
formData,
|
|
7570
|
+
timeout,
|
|
7571
|
+
fileName,
|
|
7572
|
+
success: res => {
|
|
7573
|
+
success && success(res);
|
|
7574
|
+
complete && complete(res);
|
|
7575
|
+
resolve(res);
|
|
7576
|
+
},
|
|
7577
|
+
error: res => {
|
|
7578
|
+
fail && fail(res);
|
|
7579
|
+
complete && complete(res);
|
|
7580
|
+
reject(res);
|
|
7581
|
+
}
|
|
7582
|
+
});
|
|
7583
|
+
result.headersReceive = task.onHeadersReceived;
|
|
7584
|
+
result.progress = task.onProgressUpdate;
|
|
7585
|
+
result.abort = task.abort;
|
|
7586
|
+
});
|
|
7587
|
+
return result;
|
|
7588
|
+
};
|
|
7589
|
+
|
|
7207
7590
|
class SocketTask {
|
|
7208
7591
|
constructor(url, protocols) {
|
|
7209
7592
|
if (protocols && protocols.length) {
|
|
@@ -7319,9 +7702,10 @@ function connectSocket(options) {
|
|
|
7319
7702
|
socketTasks = socketTasks.filter(socketTask => socketTask !== this);
|
|
7320
7703
|
};
|
|
7321
7704
|
socketTasks.push(task);
|
|
7322
|
-
|
|
7705
|
+
handle.success({
|
|
7323
7706
|
socketTaskId: socketsCounter++
|
|
7324
|
-
}
|
|
7707
|
+
});
|
|
7708
|
+
return resolve(task);
|
|
7325
7709
|
});
|
|
7326
7710
|
}
|
|
7327
7711
|
function closeSocket() {
|
|
@@ -7434,15 +7818,15 @@ if ($detect.style['animation-name'] === 'standard') {
|
|
|
7434
7818
|
TRANSFORM = 'transform';
|
|
7435
7819
|
}
|
|
7436
7820
|
else if ($detect.style['-webkit-animation-name'] === 'webkit') {
|
|
7437
|
-
TRANSITION_END = '
|
|
7821
|
+
TRANSITION_END = 'webkitTransitionEnd';
|
|
7438
7822
|
TRANSFORM = '-webkit-transform';
|
|
7439
7823
|
}
|
|
7440
7824
|
else if ($detect.style['-moz-animation-name'] === 'moz') {
|
|
7441
|
-
TRANSITION_END = '
|
|
7825
|
+
TRANSITION_END = 'mozTransitionEnd';
|
|
7442
7826
|
TRANSFORM = '-moz-transform';
|
|
7443
7827
|
}
|
|
7444
7828
|
else if ($detect.style['-ms-animation-name'] === 'ms') {
|
|
7445
|
-
TRANSITION_END = '
|
|
7829
|
+
TRANSITION_END = 'msTransitionEnd';
|
|
7446
7830
|
TRANSFORM = '-ms-transform';
|
|
7447
7831
|
}
|
|
7448
7832
|
let animId = 0;
|
|
@@ -7490,8 +7874,8 @@ class Animation {
|
|
|
7490
7874
|
setDefault(duration, delay, timingFunction, transformOrigin) {
|
|
7491
7875
|
this.DEFAULT = { duration, delay, timingFunction, transformOrigin };
|
|
7492
7876
|
}
|
|
7493
|
-
matrix(a, b, c, d,
|
|
7494
|
-
this.transform.push(`matrix(${a}, ${b}, ${c}, ${d}, ${
|
|
7877
|
+
matrix(a, b, c, d, tx, ty) {
|
|
7878
|
+
this.transform.push(`matrix(${a}, ${b}, ${c}, ${d}, ${tx}, ${ty})`);
|
|
7495
7879
|
return this;
|
|
7496
7880
|
}
|
|
7497
7881
|
matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) {
|
|
@@ -7503,7 +7887,12 @@ class Animation {
|
|
|
7503
7887
|
return this;
|
|
7504
7888
|
}
|
|
7505
7889
|
rotate3d(x, y, z, angle) {
|
|
7506
|
-
|
|
7890
|
+
if (typeof y !== 'number') {
|
|
7891
|
+
this.transform.push(`rotate3d(${x})`);
|
|
7892
|
+
}
|
|
7893
|
+
else {
|
|
7894
|
+
this.transform.push(`rotate3d(${x}, ${y || 0}, ${z || 0}, ${angle || 0}deg)`);
|
|
7895
|
+
}
|
|
7507
7896
|
return this;
|
|
7508
7897
|
}
|
|
7509
7898
|
rotateX(angle) {
|
|
@@ -7644,9 +8033,9 @@ class Animation {
|
|
|
7644
8033
|
return this.createAnimationData();
|
|
7645
8034
|
}
|
|
7646
8035
|
}
|
|
7647
|
-
|
|
7648
|
-
return new Animation(
|
|
7649
|
-
}
|
|
8036
|
+
const createAnimation = (option) => {
|
|
8037
|
+
return new Animation(option);
|
|
8038
|
+
};
|
|
7650
8039
|
|
|
7651
8040
|
const setBackgroundTextStyle = temporarilyNotSupport('setBackgroundTextStyle');
|
|
7652
8041
|
const setBackgroundColor = temporarilyNotSupport('setBackgroundColor');
|
|
@@ -7712,27 +8101,26 @@ const stopPullDownRefresh = function ({ success, fail, complete } = {}) {
|
|
|
7712
8101
|
});
|
|
7713
8102
|
};
|
|
7714
8103
|
|
|
7715
|
-
let scrollFunc;
|
|
7716
8104
|
let timer;
|
|
7717
8105
|
const FRAME_DURATION = 17;
|
|
7718
8106
|
const pageScrollTo = ({ scrollTop, selector = '', duration = 300, success, fail, complete }) => {
|
|
8107
|
+
let scrollFunc;
|
|
7719
8108
|
const handle = new MethodHandler({ name: 'pageScrollTo', success, fail, complete });
|
|
7720
8109
|
return new Promise((resolve, reject) => {
|
|
8110
|
+
var _a;
|
|
7721
8111
|
try {
|
|
7722
8112
|
if (scrollTop === undefined && !selector) {
|
|
7723
8113
|
return handle.fail({
|
|
7724
8114
|
errMsg: 'scrollTop" 或 "selector" 需要其之一'
|
|
7725
8115
|
}, reject);
|
|
7726
8116
|
}
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
el = document.querySelector('.taro-tabbar__panel') || window;
|
|
7733
|
-
}
|
|
8117
|
+
const id = (_a = runtime.Current.page) === null || _a === void 0 ? void 0 : _a.path;
|
|
8118
|
+
const el = (id
|
|
8119
|
+
? document.getElementById(id)
|
|
8120
|
+
: document.querySelector('.taro_page') ||
|
|
8121
|
+
document.querySelector('.taro_router'));
|
|
7734
8122
|
if (!scrollFunc) {
|
|
7735
|
-
if (el
|
|
8123
|
+
if (!el) {
|
|
7736
8124
|
scrollFunc = pos => {
|
|
7737
8125
|
if (pos === undefined) {
|
|
7738
8126
|
return window.pageYOffset;
|
|
@@ -8130,7 +8518,11 @@ class Toast {
|
|
|
8130
8518
|
}
|
|
8131
8519
|
create(options = {}, _type = 'toast') {
|
|
8132
8520
|
const { maskStyle, toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle, textStyle } = this.style;
|
|
8133
|
-
const config =
|
|
8521
|
+
const config = {
|
|
8522
|
+
...this.options,
|
|
8523
|
+
...options,
|
|
8524
|
+
_type
|
|
8525
|
+
};
|
|
8134
8526
|
this.el = document.createElement('div');
|
|
8135
8527
|
this.el.className = 'taro__toast';
|
|
8136
8528
|
this.el.style.opacity = '0';
|
|
@@ -8140,17 +8532,26 @@ class Toast {
|
|
|
8140
8532
|
this.mask.style.display = config.mask ? 'block' : 'none';
|
|
8141
8533
|
this.icon = document.createElement('p');
|
|
8142
8534
|
if (config.image) {
|
|
8143
|
-
this.icon.setAttribute('style', inlineStyle(
|
|
8535
|
+
this.icon.setAttribute('style', inlineStyle({
|
|
8536
|
+
...imageStyle,
|
|
8537
|
+
'background-image': `url(${config.image})`
|
|
8538
|
+
}));
|
|
8144
8539
|
}
|
|
8145
8540
|
else {
|
|
8146
8541
|
const iconStyle = config.icon === 'loading' ? loadingStyle : config.icon === 'error' ? errrorStyle : successStyle;
|
|
8147
|
-
this.icon.setAttribute('style', inlineStyle(
|
|
8542
|
+
this.icon.setAttribute('style', inlineStyle({
|
|
8543
|
+
...iconStyle,
|
|
8544
|
+
...(config.icon === 'none' ? { display: 'none' } : {})
|
|
8545
|
+
}));
|
|
8148
8546
|
}
|
|
8149
8547
|
this.toast = document.createElement('div');
|
|
8150
|
-
this.toast.setAttribute('style', inlineStyle(
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8548
|
+
this.toast.setAttribute('style', inlineStyle({
|
|
8549
|
+
...toastStyle,
|
|
8550
|
+
...(config.icon === 'none' ? {
|
|
8551
|
+
'min-height': '0',
|
|
8552
|
+
padding: '10px 15px'
|
|
8553
|
+
} : {})
|
|
8554
|
+
}));
|
|
8154
8555
|
this.title = document.createElement('p');
|
|
8155
8556
|
this.title.setAttribute('style', inlineStyle(textStyle));
|
|
8156
8557
|
this.title.textContent = config.title;
|
|
@@ -8165,7 +8566,11 @@ class Toast {
|
|
|
8165
8566
|
return '';
|
|
8166
8567
|
}
|
|
8167
8568
|
show(options = {}, _type = 'toast') {
|
|
8168
|
-
const config =
|
|
8569
|
+
const config = {
|
|
8570
|
+
...this.options,
|
|
8571
|
+
...options,
|
|
8572
|
+
_type
|
|
8573
|
+
};
|
|
8169
8574
|
if (this.hideOpacityTimer)
|
|
8170
8575
|
clearTimeout(this.hideOpacityTimer);
|
|
8171
8576
|
if (this.hideDisplayTimer)
|
|
@@ -8174,18 +8579,27 @@ class Toast {
|
|
|
8174
8579
|
this.mask.style.display = config.mask ? 'block' : 'none';
|
|
8175
8580
|
const { toastStyle, successStyle, errrorStyle, loadingStyle, imageStyle } = this.style;
|
|
8176
8581
|
if (config.image) {
|
|
8177
|
-
this.icon.setAttribute('style', inlineStyle(
|
|
8582
|
+
this.icon.setAttribute('style', inlineStyle({
|
|
8583
|
+
...imageStyle,
|
|
8584
|
+
'background-image': `url(${config.image})`
|
|
8585
|
+
}));
|
|
8178
8586
|
}
|
|
8179
8587
|
else {
|
|
8180
8588
|
if (!config.image && config.icon) {
|
|
8181
8589
|
const iconStyle = config.icon === 'loading' ? loadingStyle : config.icon === 'error' ? errrorStyle : successStyle;
|
|
8182
|
-
this.icon.setAttribute('style', inlineStyle(
|
|
8590
|
+
this.icon.setAttribute('style', inlineStyle({
|
|
8591
|
+
...iconStyle,
|
|
8592
|
+
...(config.icon === 'none' ? { display: 'none' } : {})
|
|
8593
|
+
}));
|
|
8183
8594
|
}
|
|
8184
8595
|
}
|
|
8185
|
-
this.toast.setAttribute('style', inlineStyle(
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8596
|
+
this.toast.setAttribute('style', inlineStyle({
|
|
8597
|
+
...toastStyle,
|
|
8598
|
+
...(config.icon === 'none' ? {
|
|
8599
|
+
'min-height': '0',
|
|
8600
|
+
padding: '10px 15px'
|
|
8601
|
+
} : {})
|
|
8602
|
+
}));
|
|
8189
8603
|
this.el.style.display = 'block';
|
|
8190
8604
|
setTimeout(() => { this.el.style.opacity = '1'; }, 0);
|
|
8191
8605
|
this.type = config._type;
|
|
@@ -8269,7 +8683,10 @@ class Modal {
|
|
|
8269
8683
|
create(options = {}) {
|
|
8270
8684
|
return new Promise((resolve) => {
|
|
8271
8685
|
const { maskStyle, modalStyle, titleStyle, textStyle, footStyle, btnStyle } = this.style;
|
|
8272
|
-
const config =
|
|
8686
|
+
const config = {
|
|
8687
|
+
...this.options,
|
|
8688
|
+
...options
|
|
8689
|
+
};
|
|
8273
8690
|
this.el = document.createElement('div');
|
|
8274
8691
|
this.el.className = 'taro__modal';
|
|
8275
8692
|
this.el.style.opacity = '0';
|
|
@@ -8280,12 +8697,19 @@ class Modal {
|
|
|
8280
8697
|
const modal = document.createElement('div');
|
|
8281
8698
|
modal.className = 'taro-modal__content';
|
|
8282
8699
|
modal.setAttribute('style', inlineStyle(modalStyle));
|
|
8283
|
-
const titleCSS = config.title ? titleStyle :
|
|
8700
|
+
const titleCSS = config.title ? titleStyle : {
|
|
8701
|
+
...titleStyle,
|
|
8702
|
+
display: 'none'
|
|
8703
|
+
};
|
|
8284
8704
|
this.title = document.createElement('div');
|
|
8285
8705
|
this.title.className = 'taro-modal__title';
|
|
8286
8706
|
this.title.setAttribute('style', inlineStyle(titleCSS));
|
|
8287
8707
|
this.title.textContent = config.title;
|
|
8288
|
-
const textCSS = config.title ? textStyle :
|
|
8708
|
+
const textCSS = config.title ? textStyle : {
|
|
8709
|
+
...textStyle,
|
|
8710
|
+
padding: '40px 20px 26px',
|
|
8711
|
+
color: '#353535'
|
|
8712
|
+
};
|
|
8289
8713
|
this.text = document.createElement('div');
|
|
8290
8714
|
this.text.className = 'taro-modal__text';
|
|
8291
8715
|
this.text.setAttribute('style', inlineStyle(textCSS));
|
|
@@ -8293,7 +8717,11 @@ class Modal {
|
|
|
8293
8717
|
const foot = document.createElement('div');
|
|
8294
8718
|
foot.className = 'taro-modal__foot';
|
|
8295
8719
|
foot.setAttribute('style', inlineStyle(footStyle));
|
|
8296
|
-
const cancelCSS =
|
|
8720
|
+
const cancelCSS = {
|
|
8721
|
+
...btnStyle,
|
|
8722
|
+
color: config.cancelColor,
|
|
8723
|
+
display: config.showCancel ? 'block' : 'none'
|
|
8724
|
+
};
|
|
8297
8725
|
this.cancel = document.createElement('div');
|
|
8298
8726
|
this.cancel.className = 'taro-model__btn taro-model__cancel';
|
|
8299
8727
|
this.cancel.setAttribute('style', inlineStyle(cancelCSS));
|
|
@@ -8324,7 +8752,10 @@ class Modal {
|
|
|
8324
8752
|
}
|
|
8325
8753
|
show(options = {}) {
|
|
8326
8754
|
return new Promise((resolve) => {
|
|
8327
|
-
const config =
|
|
8755
|
+
const config = {
|
|
8756
|
+
...this.options,
|
|
8757
|
+
...options
|
|
8758
|
+
};
|
|
8328
8759
|
if (this.hideOpacityTimer)
|
|
8329
8760
|
clearTimeout(this.hideOpacityTimer);
|
|
8330
8761
|
if (this.hideDisplayTimer)
|
|
@@ -8337,7 +8768,11 @@ class Modal {
|
|
|
8337
8768
|
}
|
|
8338
8769
|
else {
|
|
8339
8770
|
this.title.style.display = 'none';
|
|
8340
|
-
const textCSS =
|
|
8771
|
+
const textCSS = {
|
|
8772
|
+
...textStyle,
|
|
8773
|
+
padding: '40px 20px 26px',
|
|
8774
|
+
color: '#353535'
|
|
8775
|
+
};
|
|
8341
8776
|
this.text.setAttribute('style', inlineStyle(textCSS));
|
|
8342
8777
|
}
|
|
8343
8778
|
this.text.textContent = config.content || '';
|
|
@@ -8426,7 +8861,10 @@ class ActionSheet {
|
|
|
8426
8861
|
create(options = {}) {
|
|
8427
8862
|
return new Promise((resolve) => {
|
|
8428
8863
|
const { maskStyle, actionSheetStyle, menuStyle, cellStyle, cancelStyle } = this.style;
|
|
8429
|
-
const config =
|
|
8864
|
+
const config = {
|
|
8865
|
+
...this.options,
|
|
8866
|
+
...options
|
|
8867
|
+
};
|
|
8430
8868
|
this.lastConfig = config;
|
|
8431
8869
|
this.el = document.createElement('div');
|
|
8432
8870
|
this.el.className = 'taro__actionSheet';
|
|
@@ -8437,7 +8875,10 @@ class ActionSheet {
|
|
|
8437
8875
|
this.actionSheet = document.createElement('div');
|
|
8438
8876
|
this.actionSheet.setAttribute('style', inlineStyle(actionSheetStyle));
|
|
8439
8877
|
this.menu = document.createElement('div');
|
|
8440
|
-
this.menu.setAttribute('style', inlineStyle(
|
|
8878
|
+
this.menu.setAttribute('style', inlineStyle({
|
|
8879
|
+
...menuStyle,
|
|
8880
|
+
color: config.itemColor
|
|
8881
|
+
}));
|
|
8441
8882
|
this.cells = config.itemList.map((item, index) => {
|
|
8442
8883
|
const cell = document.createElement('div');
|
|
8443
8884
|
cell.className = 'taro-actionsheet__cell';
|
|
@@ -8475,7 +8916,10 @@ class ActionSheet {
|
|
|
8475
8916
|
}
|
|
8476
8917
|
show(options = {}) {
|
|
8477
8918
|
return new Promise((resolve) => {
|
|
8478
|
-
const config =
|
|
8919
|
+
const config = {
|
|
8920
|
+
...this.options,
|
|
8921
|
+
...options
|
|
8922
|
+
};
|
|
8479
8923
|
this.lastConfig = config;
|
|
8480
8924
|
if (this.hideOpacityTimer)
|
|
8481
8925
|
clearTimeout(this.hideOpacityTimer);
|
|
@@ -8534,7 +8978,7 @@ class ActionSheet {
|
|
|
8534
8978
|
}
|
|
8535
8979
|
|
|
8536
8980
|
let status = 'default';
|
|
8537
|
-
function init
|
|
8981
|
+
function init(doc) {
|
|
8538
8982
|
if (status === 'ready')
|
|
8539
8983
|
return;
|
|
8540
8984
|
const taroStyle = doc.createElement('style');
|
|
@@ -8545,14 +8989,15 @@ function init$1(doc) {
|
|
|
8545
8989
|
const toast = new Toast();
|
|
8546
8990
|
const modal = new Modal();
|
|
8547
8991
|
const actionSheet = new ActionSheet();
|
|
8548
|
-
const showToast = (options = {
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8992
|
+
const showToast = (options = { title: '' }) => {
|
|
8993
|
+
init(document);
|
|
8994
|
+
options = Object.assign({
|
|
8995
|
+
title: '',
|
|
8996
|
+
icon: 'success',
|
|
8997
|
+
image: '',
|
|
8998
|
+
duration: 1500,
|
|
8999
|
+
mask: false
|
|
9000
|
+
}, options);
|
|
8556
9001
|
const { success, fail, complete } = options;
|
|
8557
9002
|
const handle = new MethodHandler({ name: 'showToast', success, fail, complete });
|
|
8558
9003
|
if (typeof options.title !== 'string') {
|
|
@@ -8592,11 +9037,12 @@ const hideToast = ({ success, fail, complete } = {}) => {
|
|
|
8592
9037
|
toast.hide(0, 'toast');
|
|
8593
9038
|
return handle.success();
|
|
8594
9039
|
};
|
|
8595
|
-
const showLoading = (options = {
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
9040
|
+
const showLoading = (options = { title: '' }) => {
|
|
9041
|
+
init(document);
|
|
9042
|
+
options = Object.assign({
|
|
9043
|
+
title: '',
|
|
9044
|
+
mask: false
|
|
9045
|
+
}, options);
|
|
8600
9046
|
const { success, fail, complete } = options;
|
|
8601
9047
|
const handle = new MethodHandler({ name: 'showLoading', success, fail, complete });
|
|
8602
9048
|
const config = {
|
|
@@ -8631,16 +9077,17 @@ const hideLoading = ({ success, fail, complete } = {}) => {
|
|
|
8631
9077
|
toast.hide(0, 'loading');
|
|
8632
9078
|
return handle.success();
|
|
8633
9079
|
};
|
|
8634
|
-
const showModal = async (options = {
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
9080
|
+
const showModal = async (options = {}) => {
|
|
9081
|
+
init(document);
|
|
9082
|
+
options = Object.assign({
|
|
9083
|
+
title: '',
|
|
9084
|
+
content: '',
|
|
9085
|
+
showCancel: true,
|
|
9086
|
+
cancelText: '取消',
|
|
9087
|
+
cancelColor: '#000000',
|
|
9088
|
+
confirmText: '确定',
|
|
9089
|
+
confirmColor: '#3CC51F'
|
|
9090
|
+
}, options);
|
|
8644
9091
|
const { success, fail, complete } = options;
|
|
8645
9092
|
const handle = new MethodHandler({ name: 'showModal', success, fail, complete });
|
|
8646
9093
|
if (typeof options.title !== 'string') {
|
|
@@ -8722,11 +9169,12 @@ function hideModal() {
|
|
|
8722
9169
|
return;
|
|
8723
9170
|
modal.hide();
|
|
8724
9171
|
}
|
|
8725
|
-
const showActionSheet = async (options = {
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
9172
|
+
const showActionSheet = async (options = { itemList: [] }) => {
|
|
9173
|
+
init(document);
|
|
9174
|
+
options = Object.assign({
|
|
9175
|
+
itemColor: '#000000',
|
|
9176
|
+
itemList: []
|
|
9177
|
+
}, options);
|
|
8730
9178
|
const { success, fail, complete } = options;
|
|
8731
9179
|
const handle = new MethodHandler({ name: 'showActionSheet', success, fail, complete });
|
|
8732
9180
|
if (!Array.isArray(options.itemList)) {
|
|
@@ -8788,6 +9236,41 @@ const disableAlertBeforeUnload = temporarilyNotSupport('disableAlertBeforeUnload
|
|
|
8788
9236
|
|
|
8789
9237
|
const createWorker = temporarilyNotSupport('createWorker');
|
|
8790
9238
|
|
|
9239
|
+
class NodesRef {
|
|
9240
|
+
constructor(selector, querySelectorQuery, single) {
|
|
9241
|
+
this.context = temporarilyNotSupport('NodesRef.context');
|
|
9242
|
+
this.node = temporarilyNotSupport('NodesRef.node');
|
|
9243
|
+
this._component = querySelectorQuery._component;
|
|
9244
|
+
this._selector = selector;
|
|
9245
|
+
this._selectorQuery = querySelectorQuery;
|
|
9246
|
+
this._single = single;
|
|
9247
|
+
}
|
|
9248
|
+
boundingClientRect(cb) {
|
|
9249
|
+
const { _selector, _component, _single, _selectorQuery } = this;
|
|
9250
|
+
_selectorQuery._push(_selector, _component, _single, { id: !0, dataset: !0, rect: !0, size: !0 }, cb);
|
|
9251
|
+
return _selectorQuery;
|
|
9252
|
+
}
|
|
9253
|
+
scrollOffset(cb) {
|
|
9254
|
+
const { _selector, _component, _single, _selectorQuery } = this;
|
|
9255
|
+
_selectorQuery._push(_selector, _component, _single, { id: !0, dataset: !0, scrollOffset: !0 }, cb);
|
|
9256
|
+
return _selectorQuery;
|
|
9257
|
+
}
|
|
9258
|
+
fields(fields, cb) {
|
|
9259
|
+
const { _selector, _component, _single, _selectorQuery } = this;
|
|
9260
|
+
const { id, dataset, rect, size, scrollOffset, properties = [], computedStyle = [] } = fields;
|
|
9261
|
+
_selectorQuery._push(_selector, _component, _single, {
|
|
9262
|
+
id,
|
|
9263
|
+
dataset,
|
|
9264
|
+
rect,
|
|
9265
|
+
size,
|
|
9266
|
+
scrollOffset,
|
|
9267
|
+
properties,
|
|
9268
|
+
computedStyle
|
|
9269
|
+
}, cb);
|
|
9270
|
+
return _selectorQuery;
|
|
9271
|
+
}
|
|
9272
|
+
}
|
|
9273
|
+
|
|
8791
9274
|
function filter(fields, dom, selector) {
|
|
8792
9275
|
if (!dom)
|
|
8793
9276
|
return null;
|
|
@@ -8925,40 +9408,6 @@ class SelectorQuery {
|
|
|
8925
9408
|
});
|
|
8926
9409
|
this._queueCb.push(callback);
|
|
8927
9410
|
}
|
|
8928
|
-
}
|
|
8929
|
-
class NodesRef {
|
|
8930
|
-
constructor(selector, querySelectorQuery, single) {
|
|
8931
|
-
this.context = temporarilyNotSupport('NodesRef.context');
|
|
8932
|
-
this.node = temporarilyNotSupport('NodesRef.node');
|
|
8933
|
-
this._component = querySelectorQuery._component;
|
|
8934
|
-
this._selector = selector;
|
|
8935
|
-
this._selectorQuery = querySelectorQuery;
|
|
8936
|
-
this._single = single;
|
|
8937
|
-
}
|
|
8938
|
-
boundingClientRect(cb) {
|
|
8939
|
-
const { _selector, _component, _single, _selectorQuery } = this;
|
|
8940
|
-
_selectorQuery._push(_selector, _component, _single, { id: !0, dataset: !0, rect: !0, size: !0 }, cb);
|
|
8941
|
-
return _selectorQuery;
|
|
8942
|
-
}
|
|
8943
|
-
scrollOffset(cb) {
|
|
8944
|
-
const { _selector, _component, _single, _selectorQuery } = this;
|
|
8945
|
-
_selectorQuery._push(_selector, _component, _single, { id: !0, dataset: !0, scrollOffset: !0 }, cb);
|
|
8946
|
-
return _selectorQuery;
|
|
8947
|
-
}
|
|
8948
|
-
fields(fields, cb) {
|
|
8949
|
-
const { _selector, _component, _single, _selectorQuery } = this;
|
|
8950
|
-
const { id, dataset, rect, size, scrollOffset, properties = [], computedStyle = [] } = fields;
|
|
8951
|
-
_selectorQuery._push(_selector, _component, _single, {
|
|
8952
|
-
id,
|
|
8953
|
-
dataset,
|
|
8954
|
-
rect,
|
|
8955
|
-
size,
|
|
8956
|
-
scrollOffset,
|
|
8957
|
-
properties,
|
|
8958
|
-
computedStyle
|
|
8959
|
-
}, cb);
|
|
8960
|
-
return _selectorQuery;
|
|
8961
|
-
}
|
|
8962
9411
|
}
|
|
8963
9412
|
|
|
8964
9413
|
const createSelectorQuery = () => {
|
|
@@ -9100,6 +9549,7 @@ exports.createAnimation = createAnimation;
|
|
|
9100
9549
|
exports.createAudioContext = createAudioContext;
|
|
9101
9550
|
exports.createBLEConnection = createBLEConnection;
|
|
9102
9551
|
exports.createBLEPeripheralServer = createBLEPeripheralServer;
|
|
9552
|
+
exports.createBufferURL = createBufferURL;
|
|
9103
9553
|
exports.createCameraContext = createCameraContext;
|
|
9104
9554
|
exports.createCanvasContext = createCanvasContext;
|
|
9105
9555
|
exports.createInnerAudioContext = createInnerAudioContext;
|
|
@@ -9125,6 +9575,7 @@ exports.createWorker = createWorker;
|
|
|
9125
9575
|
exports.default = taro;
|
|
9126
9576
|
exports.disableAlertBeforeUnload = disableAlertBeforeUnload;
|
|
9127
9577
|
exports.dishClassify = dishClassify;
|
|
9578
|
+
exports.downloadFile = downloadFile;
|
|
9128
9579
|
exports.drawCanvas = drawCanvas;
|
|
9129
9580
|
exports.enableAlertBeforeUnload = enableAlertBeforeUnload;
|
|
9130
9581
|
exports.eventCenter = eventCenter;
|
|
@@ -9166,6 +9617,7 @@ exports.getGroupEnterInfo = getGroupEnterInfo;
|
|
|
9166
9617
|
exports.getHCEState = getHCEState;
|
|
9167
9618
|
exports.getImageInfo = getImageInfo;
|
|
9168
9619
|
exports.getLaunchOptionsSync = getLaunchOptionsSync;
|
|
9620
|
+
exports.getLocalIPAddress = getLocalIPAddress;
|
|
9169
9621
|
exports.getLocation = getLocation;
|
|
9170
9622
|
exports.getLogManager = getLogManager;
|
|
9171
9623
|
exports.getMenuButtonBoundingClientRect = getMenuButtonBoundingClientRect;
|
|
@@ -9258,6 +9710,7 @@ exports.offLocalServiceResolveFail = offLocalServiceResolveFail;
|
|
|
9258
9710
|
exports.offLocationChange = offLocationChange;
|
|
9259
9711
|
exports.offLocationChangeError = offLocationChangeError;
|
|
9260
9712
|
exports.offMemoryWarning = offMemoryWarning;
|
|
9713
|
+
exports.offNetworkStatusChange = offNetworkStatusChange;
|
|
9261
9714
|
exports.offPageNotFound = offPageNotFound;
|
|
9262
9715
|
exports.offThemeChange = offThemeChange;
|
|
9263
9716
|
exports.offUnhandledRejection = offUnhandledRejection;
|
|
@@ -9440,6 +9893,7 @@ exports.textToAudio = textToAudio;
|
|
|
9440
9893
|
exports.updateShareMenu = updateShareMenu;
|
|
9441
9894
|
exports.updateVoIPChatMuteConfig = updateVoIPChatMuteConfig;
|
|
9442
9895
|
exports.updateWeChatApp = updateWeChatApp;
|
|
9896
|
+
exports.uploadFile = uploadFile;
|
|
9443
9897
|
exports.useAddToFavorites = useAddToFavorites;
|
|
9444
9898
|
exports.useDidHide = useDidHide;
|
|
9445
9899
|
exports.useDidShow = useDidShow;
|