uview-plus 3.4.105 → 3.4.107

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,9 @@
1
+ ## 3.4.107(2025-08-20)
2
+ feat: input组件支持密码显示切换
3
+
4
+ ## 3.4.106(2025-08-20)
5
+ feat: tooltip组件支持左右方向弹窗
6
+
1
7
  ## 3.4.105(2025-08-19)
2
8
  feat: 增加markdown解析器组件AI对话流式响应示例
3
9
 
@@ -3,9 +3,9 @@
3
3
  * @Description :
4
4
  * @version : 1.0
5
5
  * @Date : 2021-08-20 16:44:21
6
- * @LastAuthor : LQ
7
- * @lastTime : 2021-08-20 17:13:55
8
- * @FilePath : /u-view2.0/uview-ui/libs/config/props/input.js
6
+ * @LastAuthor : jry
7
+ * @lastTime : 2025-08-20 10:21:55
8
+ * @FilePath : /uview-plus/libs/config/props/input.js
9
9
  */
10
10
  export default {
11
11
  // index 组件
@@ -44,6 +44,7 @@ export default {
44
44
  readonly: false,
45
45
  shape: 'square',
46
46
  formatter: null,
47
- cursorColor: ''
47
+ cursorColor: '',
48
+ passwordVisibilityToggle: true
48
49
  }
49
50
  }
@@ -199,5 +199,10 @@ export const props = defineMixin({
199
199
  type: String,
200
200
  default: () => defProps.input.cursorColor
201
201
  },
202
+ // 密码类型可见性切换
203
+ passwordVisibilityToggle: {
204
+ type: Boolean,
205
+ default: () => defProps.input.passwordVisibilityToggle
206
+ }
202
207
  }
203
208
  })
@@ -21,7 +21,7 @@
21
21
  ref="input-native"
22
22
  class="u-input__content__field-wrapper__field"
23
23
  :style="[inputStyle]"
24
- :type="type"
24
+ :type="showPassword && 'password' == type ? 'text' : type"
25
25
  :focus="focus"
26
26
  :cursor="cursor"
27
27
  :value="innerValue"
@@ -39,7 +39,7 @@
39
39
  :adjust-position="adjustPosition"
40
40
  :selection-end="selectionEnd"
41
41
  :selection-start="selectionStart"
42
- :password="password || type === 'password' || false"
42
+ :password="isPassword"
43
43
  :ignoreCompositionEvent="ignoreCompositionEvent"
44
44
  @input="onInput"
45
45
  @blur="onBlur"
@@ -61,6 +61,15 @@
61
61
  customStyle="line-height: 12px"
62
62
  ></up-icon>
63
63
  </view>
64
+ <view
65
+ class="u-input__content__subfix-password-shower"
66
+ v-if="(type == 'password' || password) && passwordVisibilityToggle"
67
+ >
68
+ <up-icon @click="showPassword = !showPassword"
69
+ :name="showPassword ? 'eye-off' : 'eye-fill'"
70
+ size="18"
71
+ ></up-icon>
72
+ </view>
64
73
  <view
65
74
  class="u-input__content__subfix-icon"
66
75
  v-if="suffixIcon || $slots.suffix"
@@ -142,7 +151,8 @@ export default {
142
151
  // value绑定值的变化是由内部还是外部引起的
143
152
  changeFromInner: false,
144
153
  // 过滤处理方法
145
- innerFormatter: value => value
154
+ innerFormatter: value => value,
155
+ showPassword: false
146
156
  };
147
157
  },
148
158
  created() {
@@ -178,6 +188,21 @@ export default {
178
188
  }
179
189
  },
180
190
  computed: {
191
+ // 是否密码
192
+ isPassword() {
193
+ let ret = false;
194
+ if(this.password) {
195
+ ret = true;
196
+ } else if (this.type == 'password') {
197
+ ret = true;
198
+ } else {
199
+ ret = false;
200
+ }
201
+ if (this.showPassword) {
202
+ ret = false;
203
+ }
204
+ return ret;
205
+ },
181
206
  // 是否显示清除控件
182
207
  isShowClear() {
183
208
  const { clearable, readonly, focused, innerValue } = this;
@@ -32,7 +32,7 @@ export const props = defineMixin({
32
32
  type: String,
33
33
  default: () => defProps.tooltip.popupBgColor
34
34
  },
35
- // 弹出提示的方向,top-上方,bottom-下方
35
+ // 弹出提示的方向,top-上方,bottom-下方,left-左方,right-右方
36
36
  direction: {
37
37
  type: String,
38
38
  default: () => defProps.tooltip.direction
@@ -68,4 +68,4 @@ export const props = defineMixin({
68
68
  default: () => defProps.tooltip.triggerMode
69
69
  },
70
70
  }
71
- })
71
+ })
@@ -9,13 +9,12 @@
9
9
  @click="overlayClickHandler"
10
10
  ></u-overlay>
11
11
  <view class="u-tooltip__wrapper">
12
- <view class="u-tooltip__trigger" @click.stop="clickHander"
12
+ <view class="u-tooltip__trigger" :id="textId"
13
+ :ref="textId" @click.stop="clickHander"
13
14
  @longpress.stop="longpressHandler">
14
15
  <slot name="trigger"></slot>
15
16
  <text v-if="!$slots['trigger']"
16
17
  class="u-tooltip__wrapper__text"
17
- :id="textId"
18
- :ref="textId"
19
18
  :userSelect="false"
20
19
  :selectable="false"
21
20
  :style="{
@@ -156,11 +155,13 @@
156
155
  screenGap: 12,
157
156
  // 三角形指示器的宽高,由于对元素进行了角度旋转,精确计算指示器位置时,需要用到其尺寸信息
158
157
  indicatorWidth: 14,
158
+ tooltipStyle: {}
159
159
  }
160
160
  },
161
161
  watch: {
162
- propsChange() {
163
- this.getElRect()
162
+ async propsChange() {
163
+ await this.getElRect()
164
+ this.getTooltipStyle();
164
165
  }
165
166
  },
166
167
  computed: {
@@ -169,37 +170,7 @@
169
170
  propsChange() {
170
171
  return [this.text, this.buttons]
171
172
  },
172
- // 计算气泡和指示器的位置信息
173
- tooltipStyle() {
174
- const style = {
175
- transform: `translateY(${this.direction === 'top' ? '-100%' : '100%'})`,
176
- },
177
- sysInfo = getWindowInfo()
178
- if (this.tooltipInfo.width / 2 > this.textInfo.left + this.textInfo.width / 2 - this.screenGap) {
179
- this.indicatorStyle = {}
180
- style.left = `-${addUnit(this.textInfo.left - this.screenGap)}`
181
- this.indicatorStyle.left = addUnit(this.textInfo.width / 2 - getPx(style.left) - this.indicatorWidth /
182
- 2)
183
- } else if (this.tooltipInfo.width / 2 > sysInfo.windowWidth - this.textInfo.right + this.textInfo.width / 2 -
184
- this.screenGap) {
185
- this.indicatorStyle = {}
186
- style.right = `-${addUnit(sysInfo.windowWidth - this.textInfo.right - this.screenGap)}`
187
- this.indicatorStyle.right = addUnit(this.textInfo.width / 2 - getPx(style.right) - this
188
- .indicatorWidth / 2)
189
- } else {
190
- const left = Math.abs(this.textInfo.width / 2 - this.tooltipInfo.width / 2)
191
- style.left = this.textInfo.width > this.tooltipInfo.width ? addUnit(left) : -addUnit(left)
192
- this.indicatorStyle = {}
193
- }
194
- if (this.direction === 'top') {
195
- style.marginTop = '-10px'
196
- this.indicatorStyle.bottom = '-4px'
197
- } else {
198
- style.marginBottom = '-10px'
199
- this.indicatorStyle.top = '-4px'
200
- }
201
- return style
202
- }
173
+
203
174
  },
204
175
  mounted() {
205
176
  this.init()
@@ -208,11 +179,64 @@
208
179
  methods: {
209
180
  addStyle,
210
181
  addUnit,
211
- init() {
212
- this.getElRect()
182
+ async init() {
183
+ await this.getElRect()
184
+ this.getTooltipStyle();
185
+ },
186
+ // 计算气泡和指示器的位置信息
187
+ getTooltipStyle() {
188
+ const style = {},
189
+ sysInfo = getWindowInfo()
190
+ if (this.direction === 'left') {
191
+ // 右侧显示逻辑
192
+ style.transform = ``
193
+ // 垂直居中对齐
194
+ style.top = '-' + addUnit((this.tooltipInfo.height - this.indicatorWidth) / 2, 'px')
195
+ style.right = addUnit(this.textInfo.width + this.indicatorWidth, 'px')
196
+ this.indicatorStyle = {}
197
+ this.indicatorStyle.right = '-4px'
198
+ this.indicatorStyle.top = addUnit((this.tooltipInfo.height - this.indicatorWidth) / 2, 'px')
199
+ } else if (this.direction === 'right') {
200
+ // 右侧显示逻辑
201
+ style.transform = ``
202
+ // 垂直居中对齐
203
+ style.top = addUnit((this.textInfo.height - this.tooltipInfo.height) / 2, 'px')
204
+ style.left = addUnit(this.textInfo.width + this.indicatorWidth, 'px')
205
+ this.indicatorStyle = {}
206
+ this.indicatorStyle.left = '-4px'
207
+ this.indicatorStyle.top = addUnit((this.textInfo.height - this.indicatorWidth) / 2, 'px')
208
+ } else if (this.direction === 'top' || this.direction === 'bottom') {
209
+ style.transform = `translateY(${this.direction === 'top' ? '-100%' : '100%'})`
210
+ if (this.tooltipInfo.width / 2 > this.textInfo.left + this.textInfo.width / 2 - this.screenGap) {
211
+ this.indicatorStyle = {}
212
+ style.left = `-${addUnit(this.textInfo.left - this.screenGap)}`
213
+ this.indicatorStyle.left = addUnit(this.textInfo.width / 2 - getPx(style.left) - this.indicatorWidth /
214
+ 2, 'px')
215
+ } else if (this.tooltipInfo.width / 2 > sysInfo.windowWidth - this.textInfo.right + this.textInfo.width / 2 -
216
+ this.screenGap) {
217
+ this.indicatorStyle = {}
218
+ style.right = `-${addUnit(sysInfo.windowWidth - this.textInfo.right - this.screenGap)}`
219
+ this.indicatorStyle.right = addUnit(this.textInfo.width / 2 - getPx(style.right) - this
220
+ .indicatorWidth / 2)
221
+ } else {
222
+ const left = Math.abs(this.textInfo.width / 2 - this.tooltipInfo.width / 2)
223
+ style.left = this.textInfo.width > this.tooltipInfo.width ? addUnit(left) : -addUnit(left)
224
+ this.indicatorStyle = {}
225
+ }
226
+ if (this.direction === 'top') {
227
+ style.marginTop = '-10px'
228
+ this.indicatorStyle.bottom = '-4px'
229
+ } else {
230
+ style.marginBottom = '-10px'
231
+ this.indicatorStyle.top = '-4px'
232
+ }
233
+ }
234
+ this.tooltipStyle = style
235
+ return style
213
236
  },
214
237
  // 点击触发事件
215
- clickHander() {
238
+ async clickHander() {
239
+ // this.getTooltipStyle();
216
240
  if (this.triggerMode == 'click') {
217
241
  this.tooltipTop = 0
218
242
  this.showTooltip = true
@@ -220,6 +244,7 @@
220
244
  },
221
245
  // 长按触发事件
222
246
  async longpressHandler() {
247
+ // this.getTooltipStyle();
223
248
  if (this.triggerMode == 'longpress') {
224
249
  this.tooltipTop = 0
225
250
  this.showTooltip = true
@@ -238,7 +263,7 @@
238
263
  // 查询内容高度
239
264
  queryRect(ref) {
240
265
  // #ifndef APP-NVUE
241
- // $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://ijry.github.io/uview-plus/js/getRect.html
266
+ // $uGetRect为uview-plus自带的节点查询简化方法,详见文档介绍:https://ijry.github.io/uview-plus/js/getRect.html
242
267
  // 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
243
268
  return new Promise(resolve => {
244
269
  this.$uGetRect(`#${ref}`).then(size => {
@@ -259,17 +284,16 @@
259
284
  },
260
285
  // 元素尺寸
261
286
  getElRect() {
262
- // 调用之前,先将指示器调整到屏幕外,方便获取尺寸
263
- this.showTooltip = true
264
- this.tooltipTop = -10000
265
- sleep(500).then(() => {
266
- this.queryRect(this.tooltipId).then(size => {
267
- this.tooltipInfo = size
287
+ return new Promise(async(resolve) => {
288
+ // 调用之前,先将指示器调整到屏幕外,方便获取尺寸
289
+ this.showTooltip = true
290
+ this.tooltipTop = -10000
291
+ sleep(500).then(async () => {
292
+ this.tooltipInfo = await this.queryRect(this.tooltipId)
268
293
  // 获取气泡尺寸之后,将其隐藏,为了让下次切换气泡显示与隐藏时,有淡入淡出的效果
269
294
  this.showTooltip = false
270
- })
271
- this.queryRect(this.textId).then(size => {
272
- this.textInfo = size
295
+ this.textInfo = await this.queryRect(this.textId)
296
+ resolve()
273
297
  })
274
298
  })
275
299
  },
@@ -360,4 +384,4 @@
360
384
  }
361
385
  }
362
386
  }
363
- </style>
387
+ </style>
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "零云®uview-plus3.0重磅发布,全面的Vue3鸿蒙跨端移动组件库,组件丰富维护更新稳定。",
5
- "version": "3.4.105",
6
- "description": "零云®uview-plus已兼容vue3,100+全面的组件和便捷的工具会让您信手拈来。近期新增拖动排序、条码、图片裁剪、下拉刷新、虚拟列表、签名等。",
5
+ "version": "3.4.107",
6
+ "description": "零云®uview-plus已兼容vue3,100+全面的组件和便捷的工具会让您信手拈来。近期新增拖动排序、条码、图片裁剪、下拉刷新、虚拟列表、签名、Markdown等。",
7
7
  "keywords": [
8
8
  "uview",
9
9
  "uview-plus",