uview-plus 3.8.18 → 3.8.37
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/changelog.md +122 -0
- package/components/u-button/u-button.vue +60 -16
- package/components/u-calendar/calendar.js +4 -3
- package/components/u-calendar/header.vue +74 -32
- package/components/u-calendar/month.vue +9 -0
- package/components/u-calendar/props.js +5 -0
- package/components/u-calendar/u-calendar.vue +46 -0
- package/components/u-cropper/u-cropper.vue +409 -387
- package/components/u-input/u-input.vue +3 -1
- package/components/u-parse/node/node.vue +50 -20
- package/components/u-parse/u-parse.vue +38 -8
- package/components/u-poster/u-poster.vue +12 -10
- package/components/u-qrcode/qrcode.js +35 -29
- package/components/u-qrcode/u-qrcode.vue +17 -12
- package/components/u-toast/u-toast.vue +5 -1
- package/components/u-tooltip/u-tooltip.vue +1 -0
- package/index.scss +1 -0
- package/libs/config/config.js +2 -0
- package/libs/css/theme-legacy-bridge.scss +6 -0
- package/libs/css/theme-vars-core.scss +4 -0
- package/libs/i18n/locales/de.json +1 -0
- package/libs/i18n/locales/en.json +1 -0
- package/libs/i18n/locales/es.json +1 -0
- package/libs/i18n/locales/fr.json +1 -0
- package/libs/i18n/locales/ja.json +1 -0
- package/libs/i18n/locales/ko.json +1 -0
- package/libs/i18n/locales/ru.json +1 -0
- package/libs/i18n/locales/th.json +1 -0
- package/libs/i18n/locales/zh-Hans.json +1 -0
- package/libs/i18n/locales/zh-Hant.json +1 -0
- package/libs/root/index.js +5 -29
- package/libs/root/root.js +6 -2
- package/libs/theme/runtime.js +52 -3
- package/libs/theme/theme.js +13 -16
- package/package.json +1 -1
- package/theme.scss +0 -5
- package/types/comps/calendar.d.ts +5 -0
- package/types/comps/qrcode.d.ts +6 -0
- package/types/index.d.ts +6 -0
package/libs/theme/runtime.js
CHANGED
|
@@ -133,6 +133,37 @@ function getRuntimeU(upU) {
|
|
|
133
133
|
return null
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
function normalizeRuntimeRoute(route) {
|
|
137
|
+
if (typeof route !== 'string') return ''
|
|
138
|
+
return route.replace(/^\//, '').split('?')[0]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function getCurrentRuntimeRoute() {
|
|
142
|
+
try {
|
|
143
|
+
if (typeof getCurrentPages !== 'function') return ''
|
|
144
|
+
const pages = getCurrentPages()
|
|
145
|
+
if (!Array.isArray(pages) || pages.length === 0) return ''
|
|
146
|
+
const page = pages[pages.length - 1] || {}
|
|
147
|
+
return normalizeRuntimeRoute(page.route || page.path || '')
|
|
148
|
+
} catch (e) {}
|
|
149
|
+
return ''
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function getRuntimeTabBarRoutes() {
|
|
153
|
+
const routes = []
|
|
154
|
+
try {
|
|
155
|
+
const runtimeConfig = typeof __uniConfig !== 'undefined' ? __uniConfig : null
|
|
156
|
+
const tabBarList = runtimeConfig?.tabBar?.list
|
|
157
|
+
if (Array.isArray(tabBarList)) {
|
|
158
|
+
tabBarList.forEach((item) => {
|
|
159
|
+
const route = normalizeRuntimeRoute(item?.pagePath || '')
|
|
160
|
+
if (route) routes.push(route)
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {}
|
|
164
|
+
return routes
|
|
165
|
+
}
|
|
166
|
+
|
|
136
167
|
function hasActiveRuntimePage() {
|
|
137
168
|
try {
|
|
138
169
|
if (typeof getCurrentPages === 'function') {
|
|
@@ -154,6 +185,25 @@ function trySetNavigationBarColor(options) {
|
|
|
154
185
|
} catch (e) {}
|
|
155
186
|
}
|
|
156
187
|
|
|
188
|
+
export function isTabBarPage() {
|
|
189
|
+
const route = getCurrentRuntimeRoute()
|
|
190
|
+
if (!route) return false
|
|
191
|
+
const tabBarRoutes = getRuntimeTabBarRoutes()
|
|
192
|
+
if (!tabBarRoutes.length) return false
|
|
193
|
+
return tabBarRoutes.includes(route)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function trySetTabBarStyle(options) {
|
|
197
|
+
if (typeof uni === 'undefined' || typeof uni.setTabBarStyle !== 'function') return
|
|
198
|
+
if (!isTabBarPage()) return
|
|
199
|
+
try {
|
|
200
|
+
const result = uni.setTabBarStyle(options)
|
|
201
|
+
if (result && typeof result.catch === 'function') {
|
|
202
|
+
result.catch(() => {})
|
|
203
|
+
}
|
|
204
|
+
} catch (e) {}
|
|
205
|
+
}
|
|
206
|
+
|
|
157
207
|
function normalizeThemeMode(theme = 'light') {
|
|
158
208
|
return theme === 'dark' ? 'dark' : 'light'
|
|
159
209
|
}
|
|
@@ -349,6 +399,7 @@ export function getThemeTabBarStyle(upU) {
|
|
|
349
399
|
export function applyNativeThemeUI(upU) {
|
|
350
400
|
if (typeof uni === 'undefined') return
|
|
351
401
|
const runtimeU = getRuntimeU(upU)
|
|
402
|
+
if (runtimeU?.config?.nativeThemeSync !== true) return
|
|
352
403
|
const isDark = getThemeIsDark(runtimeU)
|
|
353
404
|
const fallbackBg = isDark ? '#1f1f1f' : (runtimeU?.color?.bgColor || '#f3f4f6')
|
|
354
405
|
const pageBg = getThemeVar(
|
|
@@ -376,9 +427,7 @@ export function applyNativeThemeUI(upU) {
|
|
|
376
427
|
backgroundColorBottom: pageBg
|
|
377
428
|
})
|
|
378
429
|
}
|
|
379
|
-
|
|
380
|
-
uni.setTabBarStyle(getThemeTabBarStyle(runtimeU))
|
|
381
|
-
}
|
|
430
|
+
trySetTabBarStyle(getThemeTabBarStyle(runtimeU))
|
|
382
431
|
}
|
|
383
432
|
|
|
384
433
|
export function applyNativeThemeUIDeferred(upU, delay = 30) {
|
package/libs/theme/theme.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import config from '../config/config.js'
|
|
2
2
|
import color from '../config/color.js'
|
|
3
3
|
import index from '../function/index.js'
|
|
4
|
+
import { trySetTabBarStyle } from './runtime.js'
|
|
4
5
|
|
|
5
6
|
const DEFAULT_LIGHT_THEME_COLORS = Object.freeze({
|
|
6
7
|
primary: '#3c9cff',
|
|
@@ -512,11 +513,6 @@ function syncThemeToH5(mode) {
|
|
|
512
513
|
// #ifdef H5
|
|
513
514
|
if (typeof document !== 'undefined' && document.documentElement) {
|
|
514
515
|
document.documentElement.setAttribute('data-up-theme', mode)
|
|
515
|
-
const bg = color.bgColor || (mode === 'dark' ? '#1f1f1f' : '#f3f4f6')
|
|
516
|
-
document.documentElement.style.backgroundColor = bg
|
|
517
|
-
if (document.body) document.body.style.backgroundColor = bg
|
|
518
|
-
const appRoot = document.getElementById('app')
|
|
519
|
-
if (appRoot) appRoot.style.backgroundColor = bg
|
|
520
516
|
}
|
|
521
517
|
// #endif
|
|
522
518
|
}
|
|
@@ -542,11 +538,14 @@ function trySetNavigationBarColor(options) {
|
|
|
542
538
|
} catch (e) {}
|
|
543
539
|
}
|
|
544
540
|
|
|
545
|
-
function applyNativeThemeUI(mode, themeColors) {
|
|
541
|
+
function applyNativeThemeUI(mode, themeColors, themeVars = {}) {
|
|
546
542
|
if (typeof uni === 'undefined') return
|
|
543
|
+
if (config.nativeThemeSync !== true) return
|
|
547
544
|
const isDark = normalizeThemeMode(mode) === 'dark'
|
|
548
545
|
const pageBg = themeColors?.bgColor || (isDark ? '#1f1f1f' : '#f3f4f6')
|
|
549
|
-
const navBg =
|
|
546
|
+
const navBg = themeVars?.['--up-navbar-bg-color']
|
|
547
|
+
|| themeVars?.['--u-navbar-bg-color']
|
|
548
|
+
|| config.color?.['up-navbar-bg-color']
|
|
550
549
|
|| config.color?.['u-navbar-bg-color']
|
|
551
550
|
|| (isDark ? '#1c1c1e' : '#ffffff')
|
|
552
551
|
trySetNavigationBarColor({
|
|
@@ -564,14 +563,12 @@ function applyNativeThemeUI(mode, themeColors) {
|
|
|
564
563
|
backgroundColorBottom: pageBg
|
|
565
564
|
})
|
|
566
565
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
})
|
|
574
|
-
}
|
|
566
|
+
trySetTabBarStyle({
|
|
567
|
+
color: isDark ? '#8e8e93' : '#909399',
|
|
568
|
+
selectedColor: isDark ? '#f2f2f7' : '#303133',
|
|
569
|
+
backgroundColor: isDark ? '#111111' : '#ffffff',
|
|
570
|
+
borderStyle: isDark ? 'white' : 'black'
|
|
571
|
+
})
|
|
575
572
|
}
|
|
576
573
|
|
|
577
574
|
function applyTheme(mode = 'light') {
|
|
@@ -615,7 +612,7 @@ function applyTheme(mode = 'light') {
|
|
|
615
612
|
themeState.vars = { ...themeVars }
|
|
616
613
|
themeState.version = Number(themeState.version || 0) + 1
|
|
617
614
|
syncThemeToH5(themeMode)
|
|
618
|
-
applyNativeThemeUI(themeMode, themeColors)
|
|
615
|
+
applyNativeThemeUI(themeMode, themeColors, themeVars)
|
|
619
616
|
|
|
620
617
|
if (typeof uni !== 'undefined' && uni.$u && uni.$u.theme) {
|
|
621
618
|
uni.$u.theme.mode = themeState.mode
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "uview-plus",
|
|
3
3
|
"name": "uview-plus",
|
|
4
4
|
"displayName": "零云®uview-plus3.0重磅发布,全面的Vue3鸿蒙跨端移动组件库,组件丰富维护更新稳定。",
|
|
5
|
-
"version": "3.8.
|
|
5
|
+
"version": "3.8.37",
|
|
6
6
|
"description": "零云®uview-plus已兼容vue3支持多语言,120+全面的组件和便捷的工具会让您信手拈来。近期新增拖动排序、条码、图片裁剪、下拉刷新、虚拟列表、签名、Markdown等。",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"uview",
|
package/theme.scss
CHANGED
|
@@ -111,11 +111,6 @@ $up-legacy-light-theme-map: (
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
@include up-export-legacy-light-vars(':root');
|
|
115
|
-
@include up-export-legacy-light-vars('page');
|
|
116
|
-
@include up-export-legacy-light-vars('body');
|
|
117
|
-
@include up-export-legacy-light-vars("[data-up-theme='light']");
|
|
118
|
-
|
|
119
114
|
// scss混入,为了少写几行#ifndef
|
|
120
115
|
@mixin flex($direction: row) {
|
|
121
116
|
/* #ifndef APP-NVUE */
|
package/types/comps/qrcode.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ declare module 'uview-plus' {
|
|
|
23
23
|
* @default 'px'
|
|
24
24
|
*/
|
|
25
25
|
unit: 'px' | 'rpx';
|
|
26
|
+
/**
|
|
27
|
+
* 是否由运行时主题同步原生导航栏、页面背景、tabBar等全局UI。
|
|
28
|
+
* 默认关闭,避免升级后覆盖项目已有 pages.json/theme.json 全局样式。
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
nativeThemeSync: boolean;
|
|
26
32
|
/**
|
|
27
33
|
* 只加载一次字体图标
|
|
28
34
|
* @default false
|