@dcloudio/uni-h5 2.0.0 → 2.0.1-32920211122002
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/automator.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.umd.min.js +1 -1
- package/lib/apis.js +14 -4
- package/lib/h5/uni.automator.js +1 -1
- package/lib/modules.json +4 -1
- package/manifest.json +49 -0
- package/package.json +2 -3
- package/src/core/helpers/api.js +1 -1
- package/src/core/helpers/constants.js +1 -0
- package/src/core/helpers/i18n/en.json +4 -2
- package/src/core/helpers/i18n/es.json +4 -1
- package/src/core/helpers/i18n/fr.json +4 -1
- package/src/core/helpers/i18n/index.js +155 -4
- package/src/core/helpers/i18n/zh-Hans.json +4 -1
- package/src/core/helpers/i18n/zh-Hant.json +4 -1
- package/src/core/helpers/index.js +1 -1
- package/src/core/helpers/interceptor.js +19 -15
- package/src/core/helpers/promise.js +1 -1
- package/src/core/helpers/protocol/device/set-clipboard-data.js +11 -2
- package/src/core/helpers/protocol/network/request.js +14 -1
- package/src/core/helpers/protocol/network/upload-file.js +1 -1
- package/src/core/helpers/protocol/ui/popup.js +2 -2
- package/src/core/runtime/base.js +2 -0
- package/src/core/runtime/locale.js +37 -0
- package/src/core/runtime/web-view/index.js +4 -0
- package/src/core/runtime/wrapper/create-subpackage-app.js +7 -6
- package/src/core/runtime/wrapper/util.js +6 -1
- package/src/core/service/api/base/interceptor.js +1 -1
- package/src/core/service/api/context/canvas.js +3 -2
- package/src/core/service/api/context/create-map-context.js +8 -1
- package/src/core/service/api/ui/locale.js +50 -0
- package/src/core/service/plugins/app/create-app.js +8 -3
- package/src/core/service/plugins/app/index.js +2 -2
- package/src/core/service/plugins/index.js +8 -2
- package/src/core/view/bridge/subscribe/api/request-component-observer.js +16 -1
- package/src/core/view/components/canvas/index.vue +3 -1
- package/src/core/view/components/editor/formats/image.js +3 -1
- package/src/core/view/components/editor/formats/index.js +3 -1
- package/src/core/view/components/editor/formats/link.js +9 -0
- package/src/core/view/components/editor/index.vue +33 -3
- package/src/core/view/components/image/index.vue +4 -5
- package/src/core/view/components/input/index.vue +53 -25
- package/src/core/view/components/picker-view-column/index.vue +1 -0
- package/src/core/view/components/progress/index.vue +20 -13
- package/src/core/view/components/rich-text/index.vue +13 -1
- package/src/core/view/components/rich-text/nodes-parser.js +23 -4
- package/src/core/view/components/scroll-view/index.vue +253 -122
- package/src/core/view/components/slider/index.vue +1 -1
- package/src/core/view/components/swiper/index.vue +3 -0
- package/src/core/view/components/textarea/index.vue +7 -3
- package/src/core/view/index.css +4 -0
- package/src/core/view/mixins/field.js +27 -9
- package/src/core/view/mixins/interact.js +13 -11
- package/src/core/view/mixins/keyboard.js +42 -26
- package/src/core/view/mixins/touchtrack.js +2 -2
- package/src/core/view/plugins/index.js +1 -1
- package/src/platforms/app-plus/constants.js +1 -0
- package/src/platforms/app-plus/helpers/get-real-path.js +7 -4
- package/src/platforms/app-plus/helpers/uuid.js +1 -1
- package/src/platforms/app-plus/service/api/ad/ad-base.js +159 -0
- package/src/platforms/app-plus/service/api/ad/ad.js +4 -8
- package/src/platforms/app-plus/service/api/ad/full-screen-video-ad.js +5 -98
- package/src/platforms/app-plus/service/api/ad/interactive-ad.js +257 -0
- package/src/platforms/app-plus/service/api/ad/interstitial-ad.js +15 -0
- package/src/platforms/app-plus/service/api/ad/rewarded-video-ad.js +15 -2
- package/src/platforms/app-plus/service/api/device/system.js +3 -2
- package/src/platforms/app-plus/service/api/file/open-document.js +7 -15
- package/src/platforms/app-plus/service/api/index.js +2 -0
- package/src/platforms/app-plus/service/api/location/get-location.js +8 -7
- package/src/platforms/app-plus/service/api/media/choose-image.js +22 -51
- package/src/platforms/app-plus/service/api/media/choose-video.js +19 -36
- package/src/platforms/app-plus/service/api/media/compress-video.js +2 -2
- package/src/platforms/app-plus/service/api/media/get-video-info.js +5 -2
- package/src/platforms/app-plus/service/api/network/request.js +27 -1
- package/src/platforms/app-plus/service/api/network/upload-file.js +1 -1
- package/src/platforms/app-plus/service/api/plugin/oauth.js +140 -8
- package/src/platforms/app-plus/service/api/storage/storage.js +1 -1
- package/src/platforms/app-plus/service/api/ui/popup.js +21 -11
- package/src/platforms/app-plus/service/api/ui/tab-bar.js +3 -2
- package/src/platforms/app-plus/service/api/util.js +5 -1
- package/src/platforms/app-plus/service/framework/app.js +21 -5
- package/src/platforms/app-plus/service/framework/config.js +1 -0
- package/src/platforms/app-plus/service/framework/plugins/index.js +8 -2
- package/src/platforms/app-plus/service/framework/plugins/lifecycle.js +2 -2
- package/src/platforms/app-plus/service/framework/subscribe-handlers/index.js +1 -1
- package/src/platforms/app-plus/service/framework/tab-bar.js +12 -2
- package/src/platforms/app-plus/service/framework/webview/index.js +2 -2
- package/src/platforms/app-plus/service/framework/webview/parser/title-nview-parser.js +73 -30
- package/src/platforms/app-plus/service/framework/webview/parser/webview-style-parser.js +16 -16
- package/src/platforms/app-plus/service/index.js +10 -3
- package/src/platforms/app-plus/service/publish-handler.js +3 -0
- package/src/platforms/app-plus/view/bridge/subscribe/index.js +5 -3
- package/src/platforms/app-plus/view/components/ad/index.vue +53 -44
- package/src/platforms/app-plus/view/components/cover-view/index.vue +13 -7
- package/src/platforms/app-plus/view/components/map/index.vue +29 -27
- package/src/platforms/app-plus/view/components/video/index.vue +40 -24
- package/src/platforms/app-plus/view/framework/plugins/gesture.js +17 -0
- package/src/platforms/app-plus/view/framework/plugins/index.js +3 -1
- package/src/platforms/app-plus/view/index.css +4 -0
- package/src/platforms/app-plus/view/mixins/cover.js +10 -15
- package/src/platforms/app-plus/view/mixins/native.js +45 -3
- package/src/platforms/app-plus-nvue/service/api/context/operate-map-player.js +3 -0
- package/src/platforms/h5/components/app/observable.js +3 -2
- package/src/platforms/h5/components/app/popup/mixins/modal.js +3 -3
- package/src/platforms/h5/components/app/popup/modal.vue +38 -2
- package/src/platforms/h5/components/app/popup/toast.vue +9 -1
- package/src/platforms/h5/components/app/tabBar.vue +39 -17
- package/src/platforms/h5/components/page/index.vue +5 -3
- package/src/platforms/h5/components/page/pageHead.vue +94 -75
- package/src/platforms/h5/components/system-routes/choose-location/index.vue +127 -66
- package/src/platforms/h5/components/system-routes/open-location/index.vue +193 -38
- package/src/platforms/h5/helpers/location.js +26 -0
- package/src/platforms/h5/helpers/todo-api.js +2 -2
- package/src/platforms/h5/service/api/device/clipboard.js +41 -0
- package/src/platforms/h5/service/api/device/get-system-info.js +75 -0
- package/src/platforms/h5/service/api/location/get-location.js +47 -18
- package/src/platforms/h5/service/api/media/MIMEType.js +53 -0
- package/src/platforms/h5/service/api/media/choose-file.js +9 -1
- package/src/platforms/h5/service/api/media/choose-image.js +9 -2
- package/src/platforms/h5/service/api/media/choose-video.js +9 -1
- package/src/platforms/h5/service/api/media/create_input.js +12 -3
- package/src/platforms/h5/service/api/ui/popup.js +3 -5
- package/src/platforms/h5/service/api/ui/tab-bar.js +1 -1
- package/src/platforms/h5/service/index.js +5 -0
- package/src/platforms/h5/view/bridge/subscribe/index.js +3 -2
- package/src/platforms/h5/view/components/ad/index.vue +112 -69
- package/src/platforms/h5/view/components/map/index.vue +96 -349
- package/src/platforms/h5/view/components/map/map-marker.js +287 -0
- package/src/platforms/h5/view/components/map/maps/callout.js +117 -0
- package/src/platforms/h5/view/components/map/maps/index.js +55 -0
- package/src/platforms/h5/view/components/video/index.vue +1 -1
- package/src/platforms/h5/view/index.css +4 -0
- package/src/platforms/mp-alipay/runtime/api/protocols.js +30 -3
- package/src/platforms/mp-baidu/runtime/api/protocols.js +5 -0
- package/src/platforms/mp-baidu/runtime/wrapper/component-parser.js +20 -18
- package/src/platforms/mp-baidu/runtime/wrapper/util.js +2 -1
- package/src/platforms/mp-kuaishou/runtime/api/protocols.js +3 -1
- package/src/platforms/mp-kuaishou/runtime/wrapper/component-parser.js +21 -1
- package/src/platforms/mp-lark/runtime/api/index.js +0 -0
- package/src/platforms/mp-lark/runtime/api/protocols.js +68 -0
- package/src/platforms/mp-lark/runtime/api/providers.js +6 -0
- package/src/platforms/mp-lark/runtime/index.js +1 -0
- package/src/platforms/mp-lark/runtime/web-view.js +11 -0
- package/src/platforms/mp-lark/runtime/wrapper/app-parser.js +33 -0
- package/src/platforms/mp-lark/runtime/wrapper/component-parser.js +50 -0
- package/src/platforms/mp-lark/runtime/wrapper/page-parser.js +39 -0
- package/src/platforms/mp-lark/runtime/wrapper/util.js +64 -0
- package/src/platforms/mp-qq/runtime/api/protocols.js +3 -1
- package/src/platforms/mp-toutiao/runtime/api/protocols.js +2 -0
- package/src/platforms/mp-toutiao/runtime/wrapper/component-parser.js +35 -19
- package/src/platforms/mp-weixin/helpers/get-user-profile.js +6 -0
- package/src/platforms/mp-weixin/runtime/index.js +6 -7
- package/src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js +197 -126
- package/src/platforms/mp-weixin/runtime/wrapper/fix-set-data.js +37 -0
- package/src/shared/uni-id-mixin.js +77 -0
- package/src/shared/util.js +2 -0
package/lib/apis.js
CHANGED
|
@@ -2,7 +2,8 @@ const base = [
|
|
|
2
2
|
'base64ToArrayBuffer',
|
|
3
3
|
'arrayBufferToBase64',
|
|
4
4
|
'addInterceptor',
|
|
5
|
-
'removeInterceptor'
|
|
5
|
+
'removeInterceptor',
|
|
6
|
+
'interceptors'
|
|
6
7
|
]
|
|
7
8
|
|
|
8
9
|
const network = [
|
|
@@ -16,7 +17,8 @@ const network = [
|
|
|
16
17
|
'onSocketMessage',
|
|
17
18
|
'closeSocket',
|
|
18
19
|
'onSocketClose',
|
|
19
|
-
'getUpdateManager'
|
|
20
|
+
'getUpdateManager',
|
|
21
|
+
'configMTLS'
|
|
20
22
|
]
|
|
21
23
|
|
|
22
24
|
const route = [
|
|
@@ -181,7 +183,10 @@ const ui = [
|
|
|
181
183
|
'getRightWindowStyle',
|
|
182
184
|
'setTopWindowStyle',
|
|
183
185
|
'setLeftWindowStyle',
|
|
184
|
-
'setRightWindowStyle'
|
|
186
|
+
'setRightWindowStyle',
|
|
187
|
+
'getLocale',
|
|
188
|
+
'setLocale',
|
|
189
|
+
'onLocaleChange'
|
|
185
190
|
]
|
|
186
191
|
|
|
187
192
|
const event = [
|
|
@@ -214,8 +219,11 @@ const third = [
|
|
|
214
219
|
'login',
|
|
215
220
|
'checkSession',
|
|
216
221
|
'getUserInfo',
|
|
222
|
+
'getUserProfile',
|
|
217
223
|
'preLogin',
|
|
218
224
|
'closeAuthView',
|
|
225
|
+
'getCheckBoxState',
|
|
226
|
+
'getUniverifyManager',
|
|
219
227
|
'share',
|
|
220
228
|
'shareWithSystem',
|
|
221
229
|
'showShareMenu',
|
|
@@ -240,7 +248,9 @@ const third = [
|
|
|
240
248
|
|
|
241
249
|
const ad = [
|
|
242
250
|
'createRewardedVideoAd',
|
|
243
|
-
'createFullScreenVideoAd'
|
|
251
|
+
'createFullScreenVideoAd',
|
|
252
|
+
'createInterstitialAd',
|
|
253
|
+
'createInteractiveAd'
|
|
244
254
|
]
|
|
245
255
|
|
|
246
256
|
const apis = [
|
package/lib/h5/uni.automator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("debug")),o=e(require("
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("debug")),o=e(require("postcss-selector-parser"));const n=t("automator:devtool");function r(e){e.walk(e=>{if("tag"===e.type){const t=e.value;e.value="page"===t?"uni-page-body":"uni-"+t}})}const s=["Page.getElement","Page.getElements","Element.getElement","Element.getElements"];const i=["chromium","firefox","webkit"];let a=!1;try{a=!!require("playwright")}catch(e){}const c=new Map;function p(e="chromium"){const t=e&&i.includes(e)?e:i[0];let o=c.get(t);return o||(o=function(e){if("webkit"===e)return l("webkit");if("firefox"===e)return l("firefox");return a?l("chromium"):function(){const e=require("puppeteer");let t,o;return{type:"chromium",provider:"puppeteer",async open(r,s,i){t=await e.launch(s.options);const a=t.process();a?n("%s %o",a.spawnfile,s.options):n("%o",s.options),o=await t.newPage(),o.on("console",e=>{i.emit("App.logAdded",{type:e.type(),args:[e.text()]})}),o.on("pageerror",e=>{i.emit("App.exceptionThrown",e)}),await o.goto(s.url||r),await o.waitFor(1e3)},close:()=>t.close(),screenshot:(e=!1)=>o.screenshot({encoding:"base64",fullPage:e})}}()}(t),c.set(t,o)),o}function l(e){const t=require("playwright");let o,r;return{type:e,provider:"playwright",async open(s,i,a){o=await t[e].launch(i.options),"firefox"===e&&(i.contextOptions.isMobile=!1),n("browser.newContext "+JSON.stringify(i.contextOptions));const c=await o.newContext(i.contextOptions);r=await c.newPage(),r.on("console",e=>{a.emit("App.logAdded",{type:e.type(),args:[e.text()]})}),r.on("pageerror",e=>{a.emit("App.exceptionThrown",e)}),await r.goto(i.url||s),await r.waitForTimeout(1e3)},close:()=>o.close(),screenshot:(e=!1)=>r.screenshot({fullPage:e}).then(e=>e.toString("base64"))}}let u;const f={"Tool.close":{reflect:async()=>{await u.close()}},"App.exit":{reflect:async()=>{}},"App.enableLog":{reflect:()=>Promise.resolve()},"App.captureScreenshot":{reflect:async(e,t)=>{const o=await u.screenshot(!!t.fullPage);return n("App.captureScreenshot "+o.length),{data:o}}}};!function(e){s.forEach(t=>{e[t]=function(e){return{reflect:async(t,o)=>t(e,o,!1),params:e=>(e.selector&&(e.selector=o(r).processSync(e.selector)),e)}}(t)})}(f);const h={devtools:{name:"browser",paths:[],validate:async function(e){return e.options=e.options||{},e.executablePath&&!e.options.executablePath&&(e.options.executablePath=e.executablePath),e.contextOptions={viewport:Object.assign({width:375,height:667},e.options.defaultViewport||{}),hasTouch:!0,isMobile:!0,deviceScaleFactor:2},e.options.defaultViewport=Object.assign({width:375,height:667,deviceScaleFactor:2,hasTouch:!0,isMobile:!0},e.options.defaultViewport||{}),e.teardown||(e.teardown=!1===e.options.headless?"disconnect":"close"),e},create:async function(e,t,o){u=p(process.env.BROWSER),n("createDevtools "+(u.provider+" "+u.type+" "+JSON.stringify(t))),await u.open(e,t,o)}},shouldCompile:(e,t)=>!t.url,adapter:f};module.exports=h;
|
package/lib/modules.json
CHANGED
|
@@ -206,6 +206,7 @@
|
|
|
206
206
|
"uni.login": true,
|
|
207
207
|
"uni.checkSession": true,
|
|
208
208
|
"uni.getUserInfo": true,
|
|
209
|
+
"uni.getUserProfile": true,
|
|
209
210
|
"uni.share": true,
|
|
210
211
|
"uni.showShareMenu": true,
|
|
211
212
|
"uni.hideShareMenu": true,
|
|
@@ -223,6 +224,8 @@
|
|
|
223
224
|
"title": "广告",
|
|
224
225
|
"apiList": {
|
|
225
226
|
"uni.createRewardedVideoAd": true,
|
|
226
|
-
"uni.createFullScreenVideoAd": true
|
|
227
|
+
"uni.createFullScreenVideoAd": true,
|
|
228
|
+
"uni.'createInterstitialAd'": true,
|
|
229
|
+
"uni.'createInteractiveAd'": true
|
|
227
230
|
}
|
|
228
231
|
}]
|
package/manifest.json
CHANGED
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
]
|
|
36
36
|
]
|
|
37
37
|
],
|
|
38
|
+
"interceptors": [
|
|
39
|
+
"/core/service/api/base/interceptor.js",
|
|
40
|
+
[]
|
|
41
|
+
],
|
|
38
42
|
"request": [
|
|
39
43
|
"/platforms/h5/service/api/network/request.js",
|
|
40
44
|
[
|
|
@@ -235,6 +239,10 @@
|
|
|
235
239
|
[
|
|
236
240
|
"/core/helpers/protocol/location/get-location.js",
|
|
237
241
|
"getLocation"
|
|
242
|
+
],
|
|
243
|
+
[
|
|
244
|
+
"/platforms/h5/service/api/network/request.js",
|
|
245
|
+
"request"
|
|
238
246
|
]
|
|
239
247
|
]
|
|
240
248
|
],
|
|
@@ -257,6 +265,10 @@
|
|
|
257
265
|
"/core/view/components/scroll-view/index.vue",
|
|
258
266
|
"ScrollView"
|
|
259
267
|
],
|
|
268
|
+
[
|
|
269
|
+
"/platforms/h5/service/api/network/request.js",
|
|
270
|
+
"request"
|
|
271
|
+
],
|
|
260
272
|
[
|
|
261
273
|
"/platforms/h5/service/api/location/get-location.js",
|
|
262
274
|
"getLocation"
|
|
@@ -274,6 +286,18 @@
|
|
|
274
286
|
"/core/helpers/protocol/location/open-location.js",
|
|
275
287
|
"openLocation"
|
|
276
288
|
],
|
|
289
|
+
[
|
|
290
|
+
"/platforms/h5/view/components/map/index.vue",
|
|
291
|
+
"Map"
|
|
292
|
+
],
|
|
293
|
+
[
|
|
294
|
+
"/platforms/h5/service/api/network/request.js",
|
|
295
|
+
"request"
|
|
296
|
+
],
|
|
297
|
+
[
|
|
298
|
+
"/platforms/h5/service/api/location/get-location.js",
|
|
299
|
+
"getLocation"
|
|
300
|
+
],
|
|
277
301
|
[
|
|
278
302
|
"/platforms/h5/components/system-routes/open-location/index.vue",
|
|
279
303
|
"OpenLocation"
|
|
@@ -466,6 +490,19 @@
|
|
|
466
490
|
]
|
|
467
491
|
]
|
|
468
492
|
],
|
|
493
|
+
"setClipboardData": [
|
|
494
|
+
"/platforms/h5/service/api/device/clipboard.js",
|
|
495
|
+
[
|
|
496
|
+
[
|
|
497
|
+
"/core/helpers/protocol/device/set-clipboard-data.js",
|
|
498
|
+
"setClipboardData"
|
|
499
|
+
]
|
|
500
|
+
]
|
|
501
|
+
],
|
|
502
|
+
"getClipboardData": [
|
|
503
|
+
"/platforms/h5/service/api/device/clipboard.js",
|
|
504
|
+
[]
|
|
505
|
+
],
|
|
469
506
|
"vibrateLong": [
|
|
470
507
|
"/platforms/h5/service/api/device/vibrate.js",
|
|
471
508
|
[]
|
|
@@ -824,6 +861,18 @@
|
|
|
824
861
|
"/platforms/h5/service/api/ui/windows.js",
|
|
825
862
|
[]
|
|
826
863
|
],
|
|
864
|
+
"getLocale": [
|
|
865
|
+
"/core/service/api/ui/locale.js",
|
|
866
|
+
[]
|
|
867
|
+
],
|
|
868
|
+
"setLocale": [
|
|
869
|
+
"/core/service/api/ui/locale.js",
|
|
870
|
+
[]
|
|
871
|
+
],
|
|
872
|
+
"onLocaleChange": [
|
|
873
|
+
"/core/service/api/ui/locale.js",
|
|
874
|
+
[]
|
|
875
|
+
],
|
|
827
876
|
"$emit": [
|
|
828
877
|
"/platforms/h5/service/api/base/event-bus.js",
|
|
829
878
|
[
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-h5",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-32920211122002",
|
|
4
4
|
"description": "uni-app h5",
|
|
5
5
|
"main": "dist/index.umd.min.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"author": "fxy060608",
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@dcloudio/uni-i18n": "^0.0.3",
|
|
18
17
|
"base64-arraybuffer": "^0.2.0",
|
|
19
18
|
"intersection-observer": "^0.7.0",
|
|
20
19
|
"pako": "^1.0.11",
|
|
@@ -25,5 +24,5 @@
|
|
|
25
24
|
"title": "H5",
|
|
26
25
|
"main": "lib/h5/uni.config.js"
|
|
27
26
|
},
|
|
28
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "dc33ced4b2fff3063385d9eda8dd1f3539133a67"
|
|
29
28
|
}
|
package/src/core/helpers/api.js
CHANGED
|
@@ -204,7 +204,7 @@ function createApiCallback (apiName, params = {}, extras = {}) {
|
|
|
204
204
|
const errMsg = res.errMsg
|
|
205
205
|
|
|
206
206
|
if (errMsg.indexOf(apiName + ':ok') === 0) {
|
|
207
|
-
isFn(beforeSuccess) && beforeSuccess(res)
|
|
207
|
+
isFn(beforeSuccess) && beforeSuccess(res, params)
|
|
208
208
|
|
|
209
209
|
hasSuccess && success(res)
|
|
210
210
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"uni.chooseVideo.cancel": "Cancel",
|
|
13
13
|
"uni.chooseVideo.sourceType.album": "Album",
|
|
14
14
|
"uni.chooseVideo.sourceType.camera": "Camera",
|
|
15
|
-
"uni.
|
|
15
|
+
"uni.chooseFile.notUserActivation": "File chooser dialog can only be shown with a user activation",
|
|
16
16
|
"uni.previewImage.button.save": "Save Image",
|
|
17
17
|
"uni.previewImage.save.success": "Saved successfully",
|
|
18
18
|
"uni.previewImage.save.fail": "Save failed",
|
|
@@ -28,5 +28,7 @@
|
|
|
28
28
|
"uni.video.danmu": "Danmu",
|
|
29
29
|
"uni.video.volume": "Volume",
|
|
30
30
|
"uni.button.feedback.title": "feedback",
|
|
31
|
-
"uni.button.feedback.send": "send"
|
|
31
|
+
"uni.button.feedback.send": "send",
|
|
32
|
+
"uni.chooseLocation.search": "Find Place",
|
|
33
|
+
"uni.chooseLocation.cancel": "Cancel"
|
|
32
34
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"uni.chooseVideo.cancel": "Cancelar",
|
|
13
13
|
"uni.chooseVideo.sourceType.album": "Álbum",
|
|
14
14
|
"uni.chooseVideo.sourceType.camera": "Cámara",
|
|
15
|
+
"uni.chooseFile.notUserActivation": "El cuadro de diálogo del selector de archivos solo se puede mostrar con la activación del usuario",
|
|
15
16
|
"uni.previewImage.cancel": "Cancelar",
|
|
16
17
|
"uni.previewImage.button.save": "Guardar imagen",
|
|
17
18
|
"uni.previewImage.save.success": "Guardado exitosamente",
|
|
@@ -28,5 +29,7 @@
|
|
|
28
29
|
"uni.video.danmu": "Danmu",
|
|
29
30
|
"uni.video.volume": "Volumen",
|
|
30
31
|
"uni.button.feedback.title": "realimentación",
|
|
31
|
-
"uni.button.feedback.send": "enviar"
|
|
32
|
+
"uni.button.feedback.send": "enviar",
|
|
33
|
+
"uni.chooseLocation.search": "Encontrar",
|
|
34
|
+
"uni.chooseLocation.cancel": "Cancelar"
|
|
32
35
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"uni.chooseVideo.cancel": "Annuler",
|
|
13
13
|
"uni.chooseVideo.sourceType.album": "Album",
|
|
14
14
|
"uni.chooseVideo.sourceType.camera": "Caméra",
|
|
15
|
+
"uni.chooseFile.notUserActivation": "La boîte de dialogue du sélecteur de fichier ne peut être affichée qu'avec une activation par l'utilisateur",
|
|
15
16
|
"uni.previewImage.cancel": "Annuler",
|
|
16
17
|
"uni.previewImage.button.save": "Guardar imagen",
|
|
17
18
|
"uni.previewImage.save.success": "Enregistré avec succès",
|
|
@@ -28,5 +29,7 @@
|
|
|
28
29
|
"uni.video.danmu": "Danmu",
|
|
29
30
|
"uni.video.volume": "Le Volume",
|
|
30
31
|
"uni.button.feedback.title": "retour d'information",
|
|
31
|
-
"uni.button.feedback.send": "envoyer"
|
|
32
|
+
"uni.button.feedback.send": "envoyer",
|
|
33
|
+
"uni.chooseLocation.search": "Trouve",
|
|
34
|
+
"uni.chooseLocation.cancel": "Annuler"
|
|
32
35
|
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
initVueI18n
|
|
2
|
+
initVueI18n,
|
|
3
|
+
isI18nStr
|
|
3
4
|
} from '@dcloudio/uni-i18n'
|
|
5
|
+
import {
|
|
6
|
+
isStr
|
|
7
|
+
} from 'uni-shared'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
DC_LOCALE
|
|
11
|
+
} from '../constants'
|
|
4
12
|
|
|
5
13
|
import en from './en.json'
|
|
6
14
|
import es from './es.json'
|
|
@@ -16,10 +24,153 @@ const messages = {
|
|
|
16
24
|
'zh-Hant': zhHant
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
let locale
|
|
28
|
+
|
|
29
|
+
if (__PLATFORM__ === 'h5') {
|
|
30
|
+
locale = (window.localStorage && localStorage[DC_LOCALE]) || __uniConfig.locale || navigator.language
|
|
31
|
+
} else if (__PLATFORM__ === 'app-plus') {
|
|
32
|
+
if (typeof weex === 'object') {
|
|
33
|
+
locale = weex.requireModule('plus').getLanguage()
|
|
34
|
+
} else {
|
|
35
|
+
locale = ''
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
locale = __GLOBAL__.getSystemInfoSync().language
|
|
39
|
+
}
|
|
20
40
|
|
|
21
|
-
const i18n = initVueI18n(
|
|
41
|
+
export const i18n = initVueI18n(
|
|
42
|
+
locale,
|
|
43
|
+
__PLATFORM__ === 'app-plus' || __PLATFORM__ === 'h5' ? messages : {}
|
|
44
|
+
)
|
|
22
45
|
export const t = i18n.t
|
|
23
|
-
export const i18nMixin = i18n.mixin
|
|
46
|
+
export const i18nMixin = (i18n.mixin = {
|
|
47
|
+
beforeCreate () {
|
|
48
|
+
const unwatch = i18n.i18n.watchLocale(() => {
|
|
49
|
+
this.$forceUpdate()
|
|
50
|
+
})
|
|
51
|
+
this.$once('hook:beforeDestroy', function () {
|
|
52
|
+
unwatch()
|
|
53
|
+
})
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
$$t (key, values) {
|
|
57
|
+
return t(key, values)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})
|
|
24
61
|
export const setLocale = i18n.setLocale
|
|
25
62
|
export const getLocale = i18n.getLocale
|
|
63
|
+
|
|
64
|
+
export function initAppLocale (Vue, appVm, locale) {
|
|
65
|
+
const state = Vue.observable({
|
|
66
|
+
locale: locale || i18n.getLocale()
|
|
67
|
+
})
|
|
68
|
+
const localeWatchers = []
|
|
69
|
+
appVm.$watchLocale = fn => {
|
|
70
|
+
localeWatchers.push(fn)
|
|
71
|
+
}
|
|
72
|
+
Object.defineProperty(appVm, '$locale', {
|
|
73
|
+
get () {
|
|
74
|
+
return state.locale
|
|
75
|
+
},
|
|
76
|
+
set (v) {
|
|
77
|
+
state.locale = v
|
|
78
|
+
localeWatchers.forEach(watch => watch(v))
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const I18N_JSON_DELIMITERS = ['%', '%']
|
|
84
|
+
|
|
85
|
+
function getLocaleMessage () {
|
|
86
|
+
const locale = uni.getLocale()
|
|
87
|
+
const locales = __uniConfig.locales
|
|
88
|
+
return (
|
|
89
|
+
locales[locale] || locales[__uniConfig.fallbackLocale] || locales.en || {}
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function formatI18n (message) {
|
|
94
|
+
if (isI18nStr(message, I18N_JSON_DELIMITERS)) {
|
|
95
|
+
return i18n.f(message, getLocaleMessage(), I18N_JSON_DELIMITERS)
|
|
96
|
+
}
|
|
97
|
+
return message
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function resolveJsonObj (jsonObj, names) {
|
|
101
|
+
if (names.length === 1) {
|
|
102
|
+
if (jsonObj) {
|
|
103
|
+
const value = jsonObj[names[0]]
|
|
104
|
+
if (isStr(value) && isI18nStr(value, I18N_JSON_DELIMITERS)) {
|
|
105
|
+
return jsonObj
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
const name = names.shift()
|
|
111
|
+
return resolveJsonObj(jsonObj && jsonObj[name], names)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function defineI18nProperties (obj, names) {
|
|
115
|
+
return names.map(name => defineI18nProperty(obj, name))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function defineI18nProperty (obj, names) {
|
|
119
|
+
const jsonObj = resolveJsonObj(obj, names)
|
|
120
|
+
if (!jsonObj) {
|
|
121
|
+
return false
|
|
122
|
+
}
|
|
123
|
+
const prop = names[names.length - 1]
|
|
124
|
+
let value = jsonObj[prop]
|
|
125
|
+
Object.defineProperty(jsonObj, prop, {
|
|
126
|
+
get () {
|
|
127
|
+
return formatI18n(value)
|
|
128
|
+
},
|
|
129
|
+
set (v) {
|
|
130
|
+
value = v
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
return true
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function isEnableLocale () {
|
|
137
|
+
return __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function initNavigationBarI18n (navigationBar) {
|
|
141
|
+
if (isEnableLocale()) {
|
|
142
|
+
return defineI18nProperties(navigationBar, [
|
|
143
|
+
['titleText'],
|
|
144
|
+
['searchInput', 'placeholder']
|
|
145
|
+
])
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function initPullToRefreshI18n (pullToRefresh) {
|
|
150
|
+
if (isEnableLocale()) {
|
|
151
|
+
const CAPTION = 'caption'
|
|
152
|
+
return defineI18nProperties(pullToRefresh, [
|
|
153
|
+
['contentdown', CAPTION],
|
|
154
|
+
['contentover', CAPTION],
|
|
155
|
+
['contentrefresh', CAPTION]
|
|
156
|
+
])
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function initTabBarI18n (tabBar) {
|
|
161
|
+
if (isEnableLocale()) {
|
|
162
|
+
tabBar.list.forEach(item => {
|
|
163
|
+
defineI18nProperty(item, ['text'])
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
return tabBar
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function initI18n () {
|
|
170
|
+
const localeKeys = Object.keys(__uniConfig.locales || {})
|
|
171
|
+
if (localeKeys.length) {
|
|
172
|
+
localeKeys.forEach((locale) =>
|
|
173
|
+
i18n.add(locale, __uniConfig.locales[locale])
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"uni.chooseVideo.cancel": "取消",
|
|
13
13
|
"uni.chooseVideo.sourceType.album": "从相册选择",
|
|
14
14
|
"uni.chooseVideo.sourceType.camera": "拍摄",
|
|
15
|
+
"uni.chooseFile.notUserActivation": "文件选择器对话框只能在用户激活时显示",
|
|
15
16
|
"uni.previewImage.cancel": "取消",
|
|
16
17
|
"uni.previewImage.button.save": "保存图像",
|
|
17
18
|
"uni.previewImage.save.success": "保存图像到相册成功",
|
|
@@ -28,5 +29,7 @@
|
|
|
28
29
|
"uni.video.danmu": "弹幕",
|
|
29
30
|
"uni.video.volume": "音量",
|
|
30
31
|
"uni.button.feedback.title": "问题反馈",
|
|
31
|
-
"uni.button.feedback.send": "发送"
|
|
32
|
+
"uni.button.feedback.send": "发送",
|
|
33
|
+
"uni.chooseLocation.search": "搜索地点",
|
|
34
|
+
"uni.chooseLocation.cancel": "取消"
|
|
32
35
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"uni.chooseVideo.cancel": "取消",
|
|
13
13
|
"uni.chooseVideo.sourceType.album": "從相冊選擇",
|
|
14
14
|
"uni.chooseVideo.sourceType.camera": "拍攝",
|
|
15
|
+
"uni.chooseFile.notUserActivation": "文件選擇器對話框只能在用戶激活時顯示",
|
|
15
16
|
"uni.previewImage.cancel": "取消",
|
|
16
17
|
"uni.previewImage.button.save": "保存圖像",
|
|
17
18
|
"uni.previewImage.save.success": "保存圖像到相冊成功",
|
|
@@ -28,5 +29,7 @@
|
|
|
28
29
|
"uni.video.danmu": "彈幕",
|
|
29
30
|
"uni.video.volume": "音量",
|
|
30
31
|
"uni.button.feedback.title": "問題反饋",
|
|
31
|
-
"uni.button.feedback.send": "發送"
|
|
32
|
+
"uni.button.feedback.send": "發送",
|
|
33
|
+
"uni.chooseLocation.search": "搜索地點",
|
|
34
|
+
"uni.chooseLocation.cancel": "取消"
|
|
32
35
|
}
|
|
@@ -45,7 +45,7 @@ export function getTargetDataset (target) {
|
|
|
45
45
|
const $attrs = vm.$attrs
|
|
46
46
|
for (const key in $attrs) {
|
|
47
47
|
if (key.startsWith('data-')) {
|
|
48
|
-
const newKey = camelize(key.substr(5))
|
|
48
|
+
const newKey = camelize(key.substr(5).toLowerCase())
|
|
49
49
|
const value = $attrs[key]
|
|
50
50
|
dataset[newKey] = force ? value : dataset[newKey] || value
|
|
51
51
|
}
|
|
@@ -105,7 +105,7 @@ function queue (hooks, data) {
|
|
|
105
105
|
}
|
|
106
106
|
if (res === false) {
|
|
107
107
|
return {
|
|
108
|
-
then () {}
|
|
108
|
+
then () { }
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -153,15 +153,15 @@ function getApiInterceptorHooks (method) {
|
|
|
153
153
|
if (hook !== 'returnValue') {
|
|
154
154
|
interceptor[hook] = globalInterceptors[hook].slice()
|
|
155
155
|
}
|
|
156
|
-
})
|
|
157
|
-
const scopedInterceptor = scopedInterceptors[method]
|
|
158
|
-
if (scopedInterceptor) {
|
|
159
|
-
Object.keys(scopedInterceptor).forEach(hook => {
|
|
160
|
-
if (hook !== 'returnValue') {
|
|
161
|
-
interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook])
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
}
|
|
156
|
+
})
|
|
157
|
+
const scopedInterceptor = scopedInterceptors[method]
|
|
158
|
+
if (scopedInterceptor) {
|
|
159
|
+
Object.keys(scopedInterceptor).forEach(hook => {
|
|
160
|
+
if (hook !== 'returnValue') {
|
|
161
|
+
interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook])
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
165
|
return interceptor
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -185,10 +185,14 @@ export const promiseInterceptor = {
|
|
|
185
185
|
if (!isPromise(res)) {
|
|
186
186
|
return res
|
|
187
187
|
}
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
res.then(res => {
|
|
190
|
+
if (res[0]) {
|
|
191
|
+
reject(res[0])
|
|
192
|
+
} else {
|
|
193
|
+
resolve(res[1])
|
|
194
|
+
}
|
|
195
|
+
})
|
|
192
196
|
})
|
|
193
197
|
}
|
|
194
|
-
}
|
|
198
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from './interceptor'
|
|
9
9
|
|
|
10
10
|
const SYNC_API_RE =
|
|
11
|
-
/^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
|
|
11
|
+
/^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale/
|
|
12
12
|
|
|
13
13
|
const CONTEXT_API_RE = /^create|Manager$/
|
|
14
14
|
|
|
@@ -3,11 +3,20 @@ import {
|
|
|
3
3
|
} from 'uni-core/helpers/i18n'
|
|
4
4
|
|
|
5
5
|
export const setClipboardData = {
|
|
6
|
-
|
|
6
|
+
data: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true
|
|
9
|
+
},
|
|
10
|
+
showToast: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
beforeSuccess (res, params) {
|
|
15
|
+
if (!params.showToast) return
|
|
7
16
|
const title = t('uni.setClipboardData.success')
|
|
8
17
|
if (title) {
|
|
9
18
|
uni.showToast({
|
|
10
|
-
title
|
|
19
|
+
title,
|
|
11
20
|
icon: 'success',
|
|
12
21
|
mask: false,
|
|
13
22
|
style: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hasOwn,
|
|
3
|
-
isPlainObject
|
|
3
|
+
isPlainObject,
|
|
4
|
+
toRawType
|
|
4
5
|
} from 'uni-shared'
|
|
5
6
|
|
|
6
7
|
const method = {
|
|
@@ -108,3 +109,15 @@ export const request = {
|
|
|
108
109
|
type: Number
|
|
109
110
|
}
|
|
110
111
|
}
|
|
112
|
+
|
|
113
|
+
export const configMTLS = {
|
|
114
|
+
certificates: {
|
|
115
|
+
type: Array,
|
|
116
|
+
required: true,
|
|
117
|
+
validator (value) {
|
|
118
|
+
if (value.some(item => toRawType(item.host) !== 'String')) {
|
|
119
|
+
return '参数配置错误,请确认后重试'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -51,7 +51,7 @@ export const showToast = {
|
|
|
51
51
|
icon: {
|
|
52
52
|
default: 'success',
|
|
53
53
|
validator (icon, params) {
|
|
54
|
-
if (['success', 'loading', 'none'].indexOf(icon) === -1) {
|
|
54
|
+
if (['success', 'loading', 'error', 'none'].indexOf(icon) === -1) {
|
|
55
55
|
params.icon = 'success'
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -122,4 +122,4 @@ export const showActionSheet = {
|
|
|
122
122
|
popover: {
|
|
123
123
|
type: Object
|
|
124
124
|
}
|
|
125
|
-
}
|
|
125
|
+
}
|
package/src/core/runtime/base.js
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function getLocale () {
|
|
2
|
+
// 优先使用 $locale
|
|
3
|
+
const app = getApp({
|
|
4
|
+
allowDefault: true
|
|
5
|
+
})
|
|
6
|
+
if (app && app.$vm) {
|
|
7
|
+
return app.$vm.$locale
|
|
8
|
+
}
|
|
9
|
+
return __GLOBAL__.getSystemInfoSync().language || 'zh-Hans'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function setLocale (locale) {
|
|
13
|
+
const app = getApp()
|
|
14
|
+
if (!app) {
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
const oldLocale = app.$vm.$locale
|
|
18
|
+
if (oldLocale !== locale) {
|
|
19
|
+
app.$vm.$locale = locale
|
|
20
|
+
onLocaleChangeCallbacks.forEach((fn) => fn({
|
|
21
|
+
locale
|
|
22
|
+
}))
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const onLocaleChangeCallbacks = []
|
|
29
|
+
export function onLocaleChange (fn) {
|
|
30
|
+
if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
|
|
31
|
+
onLocaleChangeCallbacks.push(fn)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (typeof global !== 'undefined') {
|
|
36
|
+
global.getLocale = getLocale
|
|
37
|
+
}
|