uview-plus 3.3.67 → 3.3.69

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## 3.3.69(2025-02-19)
2
+ picker允许传递禁用颜色props
3
+
4
+ slider组件isRange状态下增加min max插槽分开显示内容
5
+
6
+ feat: 新增经典下拉框组件up-select
7
+
8
+ ## 3.3.68(2025-02-12)
9
+ fix: 修复weekText类型
10
+
11
+ feat: 日历增加单选与多选指定禁止选中的日期功能
12
+
13
+ fix: NumberBox删除数字时取值有误 #613
14
+
1
15
  ## 3.3.67(2025-02-11)
2
16
  feat: navbar支持返回全局拦截器配置
3
17
 
@@ -38,6 +38,8 @@ export default {
38
38
  allowSameDay: false,
39
39
  round: 0,
40
40
  monthNum: 3,
41
- weekText: ['一', '二', '三', '四', '五', '六', '日']
41
+ weekText: ['一', '二', '三', '四', '五', '六', '日'],
42
+ forbidDays: [],
43
+ forbidDaysToast: '该日期已禁用',
42
44
  }
43
45
  }
@@ -49,7 +49,7 @@
49
49
  },
50
50
  // 星期文本
51
51
  weekText: {
52
- type: Boolean,
52
+ type: Array,
53
53
  default: () => {
54
54
  return ['一', '二', '三', '四', '五', '六', '日']
55
55
  }
@@ -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 && 'u-calendar-month__days__day__select__info--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 && 'u-calendar-month__days__day__select__buttom-info--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客户端的开发者能力有限导致的bug
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
  })
@@ -42,6 +42,8 @@
42
42
  :rangePrompt="rangePrompt"
43
43
  :showRangePrompt="showRangePrompt"
44
44
  :allowSameDay="allowSameDay"
45
+ :forbidDays="forbidDays"
46
+ :forbidDaysToast="forbidDaysToast"
45
47
  ref="month"
46
48
  @monthSelected="monthSelected"
47
49
  @updateMonthTop="updateMonthTop"
@@ -11,6 +11,10 @@ export const props = defineMixin({
11
11
  type: Boolean,
12
12
  default: () => false
13
13
  },
14
+ disabledColor:{
15
+ type: String,
16
+ default: () => defProps.input.disabledColor
17
+ },
14
18
  placeholder: {
15
19
  type: String,
16
20
  default: () => '请选择'
@@ -10,6 +10,7 @@
10
10
  border="surround"
11
11
  v-model="inputValue"
12
12
  :disabled="disabled"
13
+ :disabledColor="disabledColor"
13
14
  ></up-input>
14
15
  <div class="input-cover">
15
16
  </div>
@@ -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('.');
@@ -11,6 +11,10 @@ export const props = defineMixin({
11
11
  type: Boolean,
12
12
  default: false
13
13
  },
14
+ disabledColor:{
15
+ type: String,
16
+ default: () => defProps.input.disabledColor
17
+ },
14
18
  hasInput: {
15
19
  type: Boolean,
16
20
  default: false
@@ -2,7 +2,7 @@
2
2
  <view class="u-picker-warrper">
3
3
  <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
4
4
  <slot>
5
- <up-input :disabled="disabled" :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
5
+ <up-input :disabled="disabled" :disabledColor="disabledColor" :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
6
6
  <div class="input-cover"></div>
7
7
  </slot>
8
8
  </view>
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <view class="u-select">
3
+ <view class="u-select__content">
4
+ <view class="u-select__label" @click="openSelect">
5
+ <slot name="text">
6
+ <text class="u-select__text">
7
+ {{ label }}
8
+ </text>
9
+ </slot>
10
+ <slot name="icon">
11
+ <u-icon name="arrow-down" :size="iconSize" :color="iconColor"></u-icon>
12
+ </slot>
13
+ </view>
14
+ <view class="u-select__options"
15
+ :style="{zIndex: zIndex}" v-if="isOpen">
16
+ <slot name="options">
17
+ <view class="u-select__options_item"
18
+ :class="current == item[keyName] ? 'active': ''"
19
+ :key="index" v-for="(item, index) in options"
20
+ @click="selectItem(item)">
21
+ <slot name="optionItem" :item="item">
22
+ <text class="u-select__item_text" :style="{color: itemColor}">
23
+ {{item.name}}
24
+ </text>
25
+ </slot>
26
+ </view>
27
+ </slot>
28
+ </view>
29
+ </view>
30
+ </view>
31
+ </template>
32
+
33
+ <script>
34
+ export default {
35
+ name:"up-select",
36
+ emits: ['update:current', 'select'],
37
+ props: {
38
+ label: {
39
+ type: String,
40
+ default: '选项'
41
+ },
42
+ options: {
43
+ type: Array,
44
+ default: () => {
45
+ return []
46
+ }
47
+ },
48
+ keyName: {
49
+ type: String,
50
+ default: 'id'
51
+ },
52
+ current: {
53
+ type: [String, Number],
54
+ default: ''
55
+ },
56
+ zIndex: {
57
+ type: Number,
58
+ default: 10
59
+ },
60
+ itemColor: {
61
+ type: String,
62
+ default: '#333333'
63
+ },
64
+ iconColor: {
65
+ type: String,
66
+ default: ''
67
+ },
68
+ iconSize: {
69
+ type: [String],
70
+ default: '13px'
71
+ }
72
+ } ,
73
+ data() {
74
+ return {
75
+ isOpen: false
76
+ }
77
+ },
78
+ mounted() {
79
+ },
80
+ methods: {
81
+ openSelect() {
82
+ this.isOpen = !this.isOpen
83
+ },
84
+ selectItem(item) {
85
+ this.isOpen = false
86
+ this.$emit('update:current', item[this.keyName])
87
+ this.$emit('select', item)
88
+ }
89
+ }
90
+ }
91
+ </script>
92
+
93
+ <style lang="scss" scoped>
94
+ .u-select__content {
95
+ position: relative;
96
+ .u-select__label {
97
+ display: flex;
98
+ /* #ifdef H5 */
99
+ &:hover {
100
+ cursor: pointer;
101
+ }
102
+ /* #endif */
103
+ }
104
+ .u-select__text {
105
+ margin-right: 2px;
106
+ }
107
+ .u-select__options {
108
+ min-width: 100px;
109
+ border-radius: 4px;
110
+ border: 1px solid #f1f1f1;
111
+ background-color: #fff;
112
+ position: absolute;
113
+ top: 20px;
114
+ left: 0;
115
+ .u-select__options_item {
116
+ padding: 10px 12px;
117
+ width: 100%;
118
+ height: 100%;
119
+ &:hover {
120
+ background-color: #f7f7f7;
121
+ }
122
+ /* #ifdef H5 */
123
+ &:hover {
124
+ cursor: pointer;
125
+ }
126
+ .u-select__item_text {
127
+ &:hover {
128
+ cursor: pointer;
129
+ }
130
+ }
131
+ /* #endif */
132
+ }
133
+ }
134
+ }
135
+ </style>
@@ -58,7 +58,7 @@
58
58
  <view class="u-slider__button-wrap u-slider__button-wrap-0" @touchstart="onTouchStart($event, 0)"
59
59
  @touchmove="onTouchMove($event, 0)" @touchend="onTouchEnd($event, 0)"
60
60
  @touchcancel="onTouchEnd($event, 0)" :style="{left: (getPx(barStyle0.width) + getPx(blockSize)/2) + 'px'}">
61
- <slot v-if="$slots.default || $slots.$default"/>
61
+ <slot name="min" v-if="$slots.min || $slots.$min"/>
62
62
  <view v-else class="u-slider__button" :style="[blockStyle, {
63
63
  height: getPx(blockSize, true),
64
64
  width: getPx(blockSize, true),
@@ -69,7 +69,8 @@
69
69
  <view class="u-slider__button-wrap" @touchstart="onTouchStart"
70
70
  @touchmove="onTouchMove" @touchend="onTouchEnd"
71
71
  @touchcancel="onTouchEnd" :style="{left: (getPx(barStyle.width) + getPx(blockSize)/2) + 'px'}">
72
- <slot v-if="$slots.default || $slots.$default"/>
72
+ <slot name="max" v-if="isRange && ($slots.max || $slots.$max)"/>
73
+ <slot v-else-if="$slots.default || $slots.$default"/>
73
74
  <view v-else class="u-slider__button" :style="[blockStyle, {
74
75
  height: getPx(blockSize, true),
75
76
  width: getPx(blockSize, true),
@@ -386,7 +387,7 @@
386
387
  return this.rangeValue
387
388
  } else {
388
389
  return valueFormat
389
- }
390
+ }
390
391
  },
391
392
  format(value, index = 1) {
392
393
  // 将小数变成整数,为了减少对视图的更新,造成视图层与逻辑层的阻塞
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.3.67",
5
+ "version": "3.3.69",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",