uview-plus 3.3.66 → 3.3.68
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 +14 -0
- package/components/u--form/u--form.vue +8 -3
- package/components/u-calendar/calendar.js +3 -1
- package/components/u-calendar/header.vue +1 -1
- package/components/u-calendar/month.vue +24 -3
- package/components/u-calendar/props.js +9 -1
- package/components/u-calendar/u-calendar.vue +2 -0
- package/components/u-form/u-form.vue +13 -7
- package/components/u-navbar/u-navbar.vue +7 -2
- package/components/u-number-box/u-number-box.vue +2 -0
- package/components/u-picker/props.js +5 -0
- package/components/u-picker/u-picker.vue +7 -2
- package/libs/config/config.js +5 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 3.3.68(2025-02-12)
|
|
2
|
+
fix: 修复weekText类型
|
|
3
|
+
|
|
4
|
+
feat: 日历增加单选与多选指定禁止选中的日期功能
|
|
5
|
+
|
|
6
|
+
fix: NumberBox删除数字时取值有误 #613
|
|
7
|
+
|
|
8
|
+
## 3.3.67(2025-02-11)
|
|
9
|
+
feat: navbar支持返回全局拦截器配置
|
|
10
|
+
|
|
11
|
+
feat: 表单-校验-支持无提示-得到校验结果
|
|
12
|
+
|
|
13
|
+
feat: picker传递hasInput属性时候,可以禁用输入框点击
|
|
14
|
+
|
|
1
15
|
## 3.3.66(2025-02-09)
|
|
2
16
|
feat: steps-item增加content插槽
|
|
3
17
|
|
|
@@ -42,8 +42,13 @@
|
|
|
42
42
|
// 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则
|
|
43
43
|
setRules(rules) {
|
|
44
44
|
this.$refs.uForm.setRules(rules)
|
|
45
|
-
},
|
|
46
|
-
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* 校验全部数据
|
|
48
|
+
* @param {Object} options
|
|
49
|
+
* @param {Boolean} options.showErrorMsg -是否显示校验信息,
|
|
50
|
+
*/
|
|
51
|
+
validate(options) {
|
|
47
52
|
/**
|
|
48
53
|
* 在微信小程序中,通过this.$parent拿到的父组件是u--form,而不是其内嵌的u-form
|
|
49
54
|
* 导致在u-form组件中,拿不到对应的children数组,从而校验无效,所以这里每次调用u-form组件中的
|
|
@@ -52,7 +57,7 @@
|
|
|
52
57
|
// #ifdef MP-WEIXIN
|
|
53
58
|
this.setMpData()
|
|
54
59
|
// #endif
|
|
55
|
-
return this.$refs.uForm.validate()
|
|
60
|
+
return this.$refs.uForm.validate(options)
|
|
56
61
|
},
|
|
57
62
|
validateField(value, callback) {
|
|
58
63
|
// #ifdef MP-WEIXIN
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
:class="[item1.selected && 'u-calendar-month__days__day__select--selected']">
|
|
13
13
|
<view class="u-calendar-month__days__day__select" :style="[daySelectStyle(index, index1, item1)]">
|
|
14
14
|
<text class="u-calendar-month__days__day__select__info"
|
|
15
|
-
:class="[item1.disabled
|
|
15
|
+
:class="[(item1.disabled || isForbid(item1) ) ? 'u-calendar-month__days__day__select__info--disabled' : '']"
|
|
16
16
|
:style="[textStyle(item1)]">{{ item1.day }}</text>
|
|
17
17
|
<text v-if="getBottomInfo(index, index1, item1)"
|
|
18
18
|
class="u-calendar-month__days__day__select__buttom-info"
|
|
19
|
-
:class="[item1.disabled
|
|
19
|
+
:class="[(item1.disabled || isForbid(item1) ) ? 'u-calendar-month__days__day__select__buttom-info--disabled' : '']"
|
|
20
20
|
:style="[textStyle(item1)]">{{ getBottomInfo(index, index1, item1) }}</text>
|
|
21
21
|
<text v-if="item1.dot" class="u-calendar-month__days__day__select__dot"></text>
|
|
22
22
|
</view>
|
|
@@ -126,6 +126,14 @@
|
|
|
126
126
|
allowSameDay: {
|
|
127
127
|
type: Boolean,
|
|
128
128
|
default: false
|
|
129
|
+
},
|
|
130
|
+
forbidDays: {
|
|
131
|
+
type: Array,
|
|
132
|
+
default: () => []
|
|
133
|
+
},
|
|
134
|
+
forbidDaysToast: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: ''
|
|
129
137
|
}
|
|
130
138
|
},
|
|
131
139
|
data() {
|
|
@@ -167,7 +175,7 @@
|
|
|
167
175
|
style.marginLeft = addUnit(week * dayWidth, 'px')
|
|
168
176
|
}
|
|
169
177
|
if (this.mode === 'range') {
|
|
170
|
-
// 之所以需要这么写,是因为DCloud公司的iOS
|
|
178
|
+
// 之所以需要这么写,是因为DCloud公司的iOS客户端导致的bug
|
|
171
179
|
style.paddingLeft = 0
|
|
172
180
|
style.paddingRight = 0
|
|
173
181
|
style.paddingBottom = 0
|
|
@@ -297,6 +305,13 @@
|
|
|
297
305
|
})
|
|
298
306
|
})
|
|
299
307
|
},
|
|
308
|
+
isForbid(item) {
|
|
309
|
+
let date = dayjs(item.date).format("YYYY-MM-DD")
|
|
310
|
+
if (this.mode !== 'range' && this.forbidDays.includes(date)) {
|
|
311
|
+
return true
|
|
312
|
+
}
|
|
313
|
+
return false
|
|
314
|
+
},
|
|
300
315
|
// 判断两个日期是否相等
|
|
301
316
|
dateSame(date1, date2) {
|
|
302
317
|
return dayjs(date1).isSame(dayjs(date2))
|
|
@@ -362,6 +377,12 @@
|
|
|
362
377
|
this.item = item
|
|
363
378
|
const date = dayjs(item.date).format("YYYY-MM-DD")
|
|
364
379
|
if (item.disabled) return
|
|
380
|
+
if (this.isForbid(item)) {
|
|
381
|
+
uni.showToast({
|
|
382
|
+
title: this.forbidDaysToast
|
|
383
|
+
})
|
|
384
|
+
return
|
|
385
|
+
}
|
|
365
386
|
// 对上一次选择的日期数组进行深度克隆
|
|
366
387
|
let selected = deepClone(this.selected)
|
|
367
388
|
if (this.mode === 'single') {
|
|
@@ -147,6 +147,14 @@ export const props = defineMixin({
|
|
|
147
147
|
weekText: {
|
|
148
148
|
type: Array,
|
|
149
149
|
default: defProps.calendar.weekText
|
|
150
|
-
}
|
|
150
|
+
},
|
|
151
|
+
forbidDays: {
|
|
152
|
+
type: Array,
|
|
153
|
+
default: defProps.calendar.forbidDays
|
|
154
|
+
},
|
|
155
|
+
forbidDaysToast:{
|
|
156
|
+
type: String,
|
|
157
|
+
default: defProps.calendar.forbidDaysToast
|
|
158
|
+
},
|
|
151
159
|
}
|
|
152
160
|
})
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
128
|
// 对部分表单字段进行校验
|
|
129
|
-
async validateField(value, callback, event = null) {
|
|
129
|
+
async validateField(value, callback, event = null,options) {
|
|
130
130
|
// $nextTick是必须的,否则model的变更,可能会延后于此方法的执行
|
|
131
131
|
this.$nextTick(() => {
|
|
132
132
|
// 校验错误信息,返回给回调方法,用于存放所有form-item的错误信息
|
|
@@ -190,10 +190,12 @@
|
|
|
190
190
|
});
|
|
191
191
|
errorsRes.push(...errors);
|
|
192
192
|
childErrors.push(...errors);
|
|
193
|
+
}
|
|
194
|
+
//没有配置,或者配置了showErrorMsg为true时候,才修改子组件message,默认没有配置
|
|
195
|
+
if(!options||options?.showErrorMsg==true){
|
|
196
|
+
child.message =
|
|
197
|
+
childErrors[0]?.message ? childErrors[0].message : null;
|
|
193
198
|
}
|
|
194
|
-
child.message =
|
|
195
|
-
childErrors[0]?.message ? childErrors[0].message : null;
|
|
196
|
-
|
|
197
199
|
if (i == (rules.length - 1)) {
|
|
198
200
|
resolve(errorsRes)
|
|
199
201
|
}
|
|
@@ -217,8 +219,12 @@
|
|
|
217
219
|
});
|
|
218
220
|
});
|
|
219
221
|
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
/**
|
|
223
|
+
* 校验全部数据
|
|
224
|
+
* @param {Object} options
|
|
225
|
+
* @param {Boolean} options.showErrorMsg -是否显示校验信息,
|
|
226
|
+
*/
|
|
227
|
+
validate(options) {
|
|
222
228
|
// 开发环境才提示,生产环境不会提示
|
|
223
229
|
if (process.env.NODE_ENV === 'development' && Object.keys(this.formRules).length === 0) {
|
|
224
230
|
error('未设置rules,请看文档说明!如果已经设置,请刷新页面。');
|
|
@@ -240,7 +246,7 @@
|
|
|
240
246
|
} else {
|
|
241
247
|
resolve(true)
|
|
242
248
|
}
|
|
243
|
-
});
|
|
249
|
+
},null,options);
|
|
244
250
|
});
|
|
245
251
|
});
|
|
246
252
|
},
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
import { props } from './props';
|
|
78
78
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
79
79
|
import { mixin } from '../../libs/mixin/mixin';
|
|
80
|
+
import config from '../../libs/config/config';
|
|
80
81
|
import { addUnit, addStyle, getPx, getWindowInfo } from '../../libs/function/index';
|
|
81
82
|
/**
|
|
82
83
|
* Navbar 自定义导航栏
|
|
@@ -120,8 +121,12 @@
|
|
|
120
121
|
leftClick() {
|
|
121
122
|
// 如果配置了autoBack,自动返回上一页
|
|
122
123
|
this.$emit('leftClick')
|
|
123
|
-
if(
|
|
124
|
-
|
|
124
|
+
if (config.interceptor.navbarLeftClick != null) {
|
|
125
|
+
config.interceptor.navbarLeftClick()
|
|
126
|
+
} else {
|
|
127
|
+
if(this.autoBack) {
|
|
128
|
+
uni.navigateBack()
|
|
129
|
+
}
|
|
125
130
|
}
|
|
126
131
|
},
|
|
127
132
|
// 点击右侧区域
|
|
@@ -313,6 +313,8 @@
|
|
|
313
313
|
// 为空返回
|
|
314
314
|
if (value === '') return
|
|
315
315
|
let formatted = this.filter(value)
|
|
316
|
+
// https://github.com/ijry/uview-plus/issues/613
|
|
317
|
+
this.emitChange(value);
|
|
316
318
|
// 最大允许的小数长度
|
|
317
319
|
if (this.decimalLength !== null && formatted.indexOf('.') !== -1) {
|
|
318
320
|
const pair = formatted.split('.');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-picker-warrper">
|
|
3
|
-
<view v-if="hasInput" class="u-picker-input cursor-pointer" @click="
|
|
3
|
+
<view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
|
|
4
4
|
<slot>
|
|
5
|
-
<up-input :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
|
|
5
|
+
<up-input :disabled="disabled" :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
|
|
6
6
|
<div class="input-cover"></div>
|
|
7
7
|
</slot>
|
|
8
8
|
</view>
|
|
@@ -177,6 +177,11 @@ export default {
|
|
|
177
177
|
methods: {
|
|
178
178
|
addUnit,
|
|
179
179
|
testArray: test.array,
|
|
180
|
+
onShowByClickInput(){
|
|
181
|
+
if(!this.disabled){
|
|
182
|
+
this.showByClickInput=!this.showByClickInput;
|
|
183
|
+
}
|
|
184
|
+
},
|
|
180
185
|
// 获取item需要显示的文字,判别为对象还是文本
|
|
181
186
|
getItemText(item) {
|
|
182
187
|
if (test.object(item)) {
|
package/libs/config/config.js
CHANGED
package/package.json
CHANGED