uview-pro 0.4.3 → 0.4.5
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 +41 -6
- package/components/u-card/u-card.vue +1 -0
- package/components/u-form-item/u-form-item.vue +1 -1
- package/components/u-input/u-input.vue +13 -1
- package/components/u-line-progress/u-line-progress.vue +7 -2
- package/components/u-switch/types.ts +3 -3
- package/components/u-switch/u-switch.vue +16 -10
- package/components/u-tag/u-tag.vue +5 -3
- package/libs/css/style.theme.scss +2 -0
- package/package.json +1 -1
- package/types/global.d.ts +2 -0
package/changelog.md
CHANGED
|
@@ -1,18 +1,53 @@
|
|
|
1
|
-
## 0.4.
|
|
1
|
+
## 0.4.5(2025-12-10)
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### ✨ Features | 新功能
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
- **
|
|
5
|
+
- **u-input:** 为选择类型输入框添加覆盖层以增强交互 ([9b7bac2](https://github.com/anyup/uView-Pro/commit/9b7bac221195d010c31b15915d2927d095bd257f))
|
|
6
|
+
- **u-form:** 增强 u-form 深层校验、动态校验表单 ([97d0ccb](https://github.com/anyup/uView-Pro/commit/97d0ccbe03391f63bed81dcfd1af1432f4f7c77d))
|
|
7
7
|
|
|
8
8
|
### 🐛 Bug Fixes | Bug 修复
|
|
9
9
|
|
|
10
|
-
- **
|
|
10
|
+
- **u-input:** 修复清空图标点击事件冒泡问题 ([8a214ff](https://github.com/anyup/uView-Pro/commit/8a214ffe8e5588395cdc456e600bc8dd0f03a603))
|
|
11
|
+
- **style:** 修复除H5环境外主题样式作用域问题 ([c02ba3c](https://github.com/anyup/uView-Pro/commit/c02ba3c1454e709b1fa9de817d77b0f2128b5fc0))
|
|
12
|
+
- **u-switch:** 修复开关组件激活颜色默认值的响应式问题 ([3d78647](https://github.com/anyup/uView-Pro/commit/3d78647d75c3201cced2643395ff5dd935d0e7ec))
|
|
13
|
+
- **form:** 修复 form 校验报错问题 ([8d6d60d](https://github.com/anyup/uView-Pro/commit/8d6d60d4af4e5653f7b87afc3f208d0e26809505))
|
|
11
14
|
|
|
12
15
|
### 👥 Contributors
|
|
13
16
|
|
|
14
|
-
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
17
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/yoshinosk"><img src="https://github.com/yoshinosk.png?size=40" width="40" height="40" alt="yoshinosk" title="yoshinosk"/></a>
|
|
15
18
|
|
|
19
|
+
## 0.4.4(2025-12-08)
|
|
20
|
+
|
|
21
|
+
### ✨ Features | 新功能
|
|
22
|
+
|
|
23
|
+
- **u-card:** u-card 组件的默认插槽同 body 插槽 ([ffa13ed](https://github.com/anyup/uView-Pro/commit/ffa13edcf17ff1559e8bdf2260f6b146680f9d07))
|
|
24
|
+
- **u-tag:** 优化自定义样式 custom-style 应用,支持 text 插槽内容 ([5bdb733](https://github.com/anyup/uView-Pro/commit/5bdb73346252850d74165cda0bb00766e5f6f59f))
|
|
25
|
+
- **u-line-progress:** 优化u-line-progress进度条百分比显示方式 ([1c1d979](https://github.com/anyup/uView-Pro/commit/1c1d97958f3c7e5a28943b46ea25d38b50449364))
|
|
26
|
+
- **switch:** 增强开关组件支持自定义值类型 ([2bcb136](https://github.com/anyup/uView-Pro/commit/2bcb1368aa1f3c7fe83799e909b89fc4349b30c3))
|
|
27
|
+
|
|
28
|
+
### 📝 Documentation | 文档
|
|
29
|
+
|
|
30
|
+
- 优化 Markdown 文档样式和格式 ([c80ff6d](https://github.com/anyup/uView-Pro/commit/c80ff6df269eb92a88001373aa96344ff4cafb79))
|
|
31
|
+
|
|
32
|
+
### 👥 Contributors
|
|
33
|
+
|
|
34
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/liujiayii"><img src="https://github.com/liujiayii.png?size=40" width="40" height="40" alt="liujiayii" title="liujiayii"/></a>
|
|
35
|
+
|
|
36
|
+
## 0.4.3(2025-12-03)
|
|
37
|
+
|
|
38
|
+
### 📝 Documentation | 文档
|
|
39
|
+
|
|
40
|
+
- 更新项目描述和移除冗余信息 ([3d5c105](https://github.com/anyup/uView-Pro/commit/3d5c1053873a1a1dc592e02caf62b5e5f9aba3ad))
|
|
41
|
+
- **readme:** 更新交流反馈和捐赠链接 ([266e788](https://github.com/anyup/uView-Pro/commit/266e7883a4e2f3ea8058e0bba0b7ce07a972bad8))
|
|
42
|
+
|
|
43
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
44
|
+
|
|
45
|
+
- **theme:** 修复不使用 u-config-privider 全局注入时,部分颜色变量不存在的问题 ([cd82d9d](https://github.com/anyup/uView-Pro/commit/cd82d9da3e8fd6066177e3b78b855583e2756a5f))
|
|
46
|
+
|
|
47
|
+
### 👥 Contributors
|
|
48
|
+
|
|
49
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
50
|
+
|
|
16
51
|
## 0.4.2(2025-12-01)
|
|
17
52
|
|
|
18
53
|
### 📝 Documentation | 文档
|
|
@@ -249,7 +249,7 @@ function getPropByPath(obj: any, path: string) {
|
|
|
249
249
|
function getRules() {
|
|
250
250
|
// 父组件的所有规则
|
|
251
251
|
let rules = parentExposed?.value?.rules?.value || {};
|
|
252
|
-
rules = rules ? rules[props.prop] : [];
|
|
252
|
+
rules = rules ? rules[props.prop] || getPropByPath(rules,props.prop.replace(/(\.|^)(\d+)\./,'.defaultField.fields.')).v : [];
|
|
253
253
|
// 保证返回的是一个数组形式
|
|
254
254
|
return [].concat(rules || []);
|
|
255
255
|
}
|
|
@@ -60,12 +60,14 @@
|
|
|
60
60
|
@input="handleInput"
|
|
61
61
|
@confirm="onConfirm"
|
|
62
62
|
/>
|
|
63
|
+
<view class="u-input__select-overlay" v-if="type === 'select'" @tap.stop="inputClick"></view>
|
|
63
64
|
<view class="u-input__right-icon u-flex">
|
|
64
65
|
<view
|
|
65
66
|
class="u-input__right-icon__clear u-input__right-icon__item"
|
|
66
67
|
v-if="clearable && modelValue != '' && !disabled"
|
|
68
|
+
@click.stop="onClear"
|
|
67
69
|
>
|
|
68
|
-
<u-icon size="32" name="close-circle-fill" color="var(--u-light-color)"
|
|
70
|
+
<u-icon size="32" name="close-circle-fill" color="var(--u-light-color)" />
|
|
69
71
|
</view>
|
|
70
72
|
<view
|
|
71
73
|
class="u-input__right-icon__clear u-input__right-icon__item"
|
|
@@ -255,6 +257,12 @@ defineExpose({
|
|
|
255
257
|
flex: 1;
|
|
256
258
|
@include vue-flex;
|
|
257
259
|
|
|
260
|
+
&__select-overlay {
|
|
261
|
+
position: absolute;
|
|
262
|
+
inset: 0;
|
|
263
|
+
z-index: 1;
|
|
264
|
+
}
|
|
265
|
+
|
|
258
266
|
&__input {
|
|
259
267
|
//height: 70rpx;
|
|
260
268
|
font-size: 28rpx;
|
|
@@ -281,6 +289,7 @@ defineExpose({
|
|
|
281
289
|
padding: 1px 4px;
|
|
282
290
|
border-radius: 10px;
|
|
283
291
|
line-height: 16px;
|
|
292
|
+
z-index: 2;
|
|
284
293
|
}
|
|
285
294
|
|
|
286
295
|
&--border {
|
|
@@ -293,6 +302,9 @@ defineExpose({
|
|
|
293
302
|
}
|
|
294
303
|
|
|
295
304
|
&__right-icon {
|
|
305
|
+
position: relative;
|
|
306
|
+
z-index: 2;
|
|
307
|
+
|
|
296
308
|
&__item {
|
|
297
309
|
margin-left: 10rpx;
|
|
298
310
|
}
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
:style="progressStyle"
|
|
18
18
|
>
|
|
19
19
|
<slot v-if="slots.default" />
|
|
20
|
-
<
|
|
20
|
+
<text class="u-progress-text" v-else-if="showPercent">
|
|
21
21
|
{{ percent + '%' }}
|
|
22
|
-
</
|
|
22
|
+
</text>
|
|
23
23
|
</view>
|
|
24
24
|
</view>
|
|
25
25
|
</template>
|
|
@@ -114,6 +114,11 @@ const progressStyle = computed(() => {
|
|
|
114
114
|
animation: progress-stripes 2s linear infinite;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
.u-progress-text {
|
|
118
|
+
color: var(--u-light-color);
|
|
119
|
+
padding: 0 10rpx;
|
|
120
|
+
}
|
|
121
|
+
|
|
117
122
|
@keyframes progress-stripes {
|
|
118
123
|
0% {
|
|
119
124
|
background-position: 0 0;
|
|
@@ -15,11 +15,11 @@ export const SwitchProps = {
|
|
|
15
15
|
/** 开关尺寸,单位rpx */
|
|
16
16
|
size: { type: [Number, String] as PropType<number | string>, default: 50 },
|
|
17
17
|
/** 打开时的颜色 */
|
|
18
|
-
activeColor: { type: String, default: ()
|
|
18
|
+
activeColor: { type: String, default: 'var(--u-type-primary)' },
|
|
19
19
|
/** 关闭时的颜色 */
|
|
20
20
|
inactiveColor: { type: String, default: 'var(--u-white-color)' },
|
|
21
|
-
/** v-model
|
|
22
|
-
modelValue: { type:
|
|
21
|
+
/** v-model 绑定值,开关状态值 */
|
|
22
|
+
modelValue: { type: [Number, String, Boolean] as PropType<number | string | boolean>, default: false },
|
|
23
23
|
/** 是否开启轻微震动反馈 */
|
|
24
24
|
vibrateShort: { type: Boolean, default: false },
|
|
25
25
|
/** 打开时的值 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="u-switch"
|
|
4
|
-
:class="[
|
|
4
|
+
:class="[isChecked ? 'u-switch--on' : '', disabled ? 'u-switch--disabled' : '', customClass]"
|
|
5
5
|
@tap="onClick"
|
|
6
6
|
:style="$u.toStyle(switchStyle, customStyle)"
|
|
7
7
|
>
|
|
@@ -53,20 +53,28 @@ const props = defineProps(SwitchProps);
|
|
|
53
53
|
|
|
54
54
|
const emit = defineEmits(['update:modelValue', 'change']);
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* 计算属性:是否处于激活状态
|
|
58
|
+
* 通过比较modelValue和activeValue来确定开关的真实状态
|
|
59
|
+
*/
|
|
60
|
+
const isChecked = computed(() => {
|
|
61
|
+
return props.modelValue === props.activeValue;
|
|
62
|
+
});
|
|
63
|
+
|
|
56
64
|
/**
|
|
57
65
|
* 计算开关样式
|
|
58
66
|
*/
|
|
59
67
|
const switchStyle = computed(() => {
|
|
60
68
|
let style: Record<string, string> = {};
|
|
61
69
|
style.fontSize = props.size + 'rpx';
|
|
62
|
-
style.backgroundColor =
|
|
70
|
+
style.backgroundColor = isChecked.value ? props.activeColor : props.inactiveColor;
|
|
63
71
|
return style;
|
|
64
72
|
});
|
|
65
73
|
/**
|
|
66
74
|
* 计算加载动画颜色
|
|
67
75
|
*/
|
|
68
76
|
const loadingColor = computed(() => {
|
|
69
|
-
return
|
|
77
|
+
return isChecked.value ? props.activeColor : null;
|
|
70
78
|
});
|
|
71
79
|
|
|
72
80
|
/**
|
|
@@ -76,10 +84,13 @@ function onClick() {
|
|
|
76
84
|
if (!props.disabled && !props.loading) {
|
|
77
85
|
// 使手机产生短促震动,微信小程序有效,APP(HX 2.6.8)和H5无效
|
|
78
86
|
if (props.vibrateShort) uni.vibrateShort();
|
|
79
|
-
|
|
87
|
+
|
|
88
|
+
// 根据当前状态切换到另一个值
|
|
89
|
+
const newValue = isChecked.value ? props.inactiveValue : props.activeValue;
|
|
90
|
+
emit('update:modelValue', newValue);
|
|
80
91
|
// 放到下一个生命周期,因为双向绑定的value修改父组件状态需要时间,且是异步的
|
|
81
92
|
nextTick(() => {
|
|
82
|
-
emit('change',
|
|
93
|
+
emit('change', newValue);
|
|
83
94
|
});
|
|
84
95
|
}
|
|
85
96
|
}
|
|
@@ -113,11 +124,6 @@ function onClick() {
|
|
|
113
124
|
border-radius: 100%;
|
|
114
125
|
z-index: 1;
|
|
115
126
|
background-color: var(--u-bg-white);
|
|
116
|
-
background-color: var(--u-bg-white);
|
|
117
|
-
box-shadow:
|
|
118
|
-
0 3px 1px 0 rgba(0, 0, 0, 0.05),
|
|
119
|
-
0 2px 2px 0 rgba(0, 0, 0, 0.1),
|
|
120
|
-
0 3px 3px 0 rgba(0, 0, 0, 0.05);
|
|
121
127
|
box-shadow:
|
|
122
128
|
0 3px 1px 0 rgba(0, 0, 0, 0.05),
|
|
123
129
|
0 2px 2px 0 rgba(0, 0, 0, 0.1),
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
customClass
|
|
10
10
|
]"
|
|
11
11
|
class="u-tag"
|
|
12
|
-
:style="$u.toStyle(customStyle)"
|
|
12
|
+
:style="$u.toStyle(tagStyle, customStyle)"
|
|
13
13
|
@tap="clickTag"
|
|
14
14
|
>
|
|
15
|
-
|
|
15
|
+
<slot>
|
|
16
|
+
{{ text }}
|
|
17
|
+
</slot>
|
|
16
18
|
<view class="u-icon-wrap" @tap.stop>
|
|
17
19
|
<u-icon
|
|
18
20
|
@click="close"
|
|
@@ -75,7 +77,7 @@ const props = defineProps(TagProps);
|
|
|
75
77
|
/**
|
|
76
78
|
* 计算 tag 的自定义样式
|
|
77
79
|
*/
|
|
78
|
-
const
|
|
80
|
+
const tagStyle = computed(() => {
|
|
79
81
|
let style: Record<string, any> = {};
|
|
80
82
|
// 文字颜色(如果有此值,会覆盖type值的颜色)
|
|
81
83
|
if (props.color) style.color = props.color;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "uview-pro",
|
|
3
3
|
"name": "uview-pro",
|
|
4
4
|
"displayName": "【支持鸿蒙】uView Pro|基于Vue3+TS的80+精选UI组件库,支持多主题,暗黑模式",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.5",
|
|
6
6
|
"description": "uView Pro,是全面支持Vue3+TS的uni-app生态框架,80+精选组件,支持安卓,iOS,鸿蒙,各小程序平台,支持多主题,一键暗黑模式",
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"module": "index.ts",
|
package/types/global.d.ts
CHANGED
|
@@ -133,6 +133,8 @@ export type FormRuleItem = {
|
|
|
133
133
|
type?: string;
|
|
134
134
|
validator?: (rule: any, value: any, callback: any) => boolean;
|
|
135
135
|
asyncValidator?: (rule: any, value: any, callback: any) => void;
|
|
136
|
+
fields?: FormRules;
|
|
137
|
+
defaultField?: FormRuleItem;
|
|
136
138
|
};
|
|
137
139
|
export type FormRules = Record<string, FormRuleItem | FormRuleItem[]>;
|
|
138
140
|
|