uview-plus 3.3.6 → 3.3.8

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.
Files changed (46) hide show
  1. package/changelog.md +58 -0
  2. package/components/u-action-sheet/props.js +6 -1
  3. package/components/u-action-sheet/u-action-sheet.vue +4 -5
  4. package/components/u-cell/u-cell.vue +20 -1
  5. package/components/u-checkbox/u-checkbox.vue +29 -19
  6. package/components/u-code/u-code.vue +0 -5
  7. package/components/u-collapse-item/props.js +6 -1
  8. package/components/u-collapse-item/u-collapse-item.vue +5 -3
  9. package/components/u-count-down/u-count-down.vue +0 -5
  10. package/components/u-dropdown/u-dropdown.vue +1 -1
  11. package/components/u-form-item/u-form-item.vue +1 -1
  12. package/components/u-grid-item/u-grid-item.vue +0 -5
  13. package/components/u-index-list/props.js +6 -1
  14. package/components/u-index-list/u-index-list.vue +168 -42
  15. package/components/u-lazy-load/u-lazy-load.vue +10 -3
  16. package/components/u-loading-icon/u-loading-icon.vue +2 -0
  17. package/components/u-modal/u-modal.vue +6 -3
  18. package/components/u-notify/u-notify.vue +0 -5
  19. package/components/u-number-box/u-number-box.vue +1 -0
  20. package/components/u-parse/node/node.vue +9 -1
  21. package/components/u-parse/u-parse.vue +1 -7
  22. package/components/u-picker/u-picker.vue +1 -0
  23. package/components/u-popup/u-popup.vue +3 -1
  24. package/components/u-row-notice/u-row-notice.vue +1 -8
  25. package/components/u-scroll-list/nvue.js +1 -1
  26. package/components/u-scroll-list/u-scroll-list.vue +5 -2
  27. package/components/u-slider/props.js +45 -19
  28. package/components/u-slider/u-slider.vue +414 -7
  29. package/components/u-sticky/u-sticky.vue +0 -5
  30. package/components/u-swipe-action-item/nvue.js +0 -5
  31. package/components/u-tabbar-item/u-tabbar-item.vue +3 -0
  32. package/components/u-tabs/u-tabs.vue +21 -4
  33. package/components/u-toast/u-toast.vue +10 -10
  34. package/components/u-upload/u-upload.vue +9 -4
  35. package/components/u-upload/utils.js +10 -4
  36. package/components/u-waterfall/u-waterfall.vue +11 -5
  37. package/libs/config/props/actionSheet.js +2 -1
  38. package/libs/config/props/collapseItem.js +2 -1
  39. package/libs/config/props/indexList.js +2 -1
  40. package/libs/config/props/slider.js +3 -1
  41. package/libs/css/common.scss +1 -1
  42. package/libs/css/flex.scss +3 -0
  43. package/libs/mixin/mixin.js +23 -8
  44. package/package.json +1 -1
  45. package/types/index.d.ts +154 -29
  46. package/components/u-slider/nvue - /345/211/257/346/234/254.js" +0 -180
@@ -2,6 +2,7 @@
2
2
  <view class="u-toast">
3
3
  <u-overlay
4
4
  :show="isShow"
5
+ :zIndex="tmpConfig.overlay ? 10070 : -1"
5
6
  :custom-style="overlayStyle"
6
7
  >
7
8
  <view
@@ -54,7 +55,7 @@
54
55
  * @property {String} icon 图标,或者绝对路径的图片
55
56
  * @property {String} type 主题类型 (默认 default)
56
57
  * @property {Boolean} show 是否显示该组件 (默认 false)
57
- * @property {Boolean} overlay 是否显示透明遮罩,防止点击穿透 (默认 false
58
+ * @property {Boolean} overlay 是否显示透明遮罩,防止点击穿透 (默认 true
58
59
  * @property {String} position 位置 (默认 'center' )
59
60
  * @property {Object} params 跳转的参数
60
61
  * @property {String | Number} duration 展示时间,单位ms (默认 2000 )
@@ -80,7 +81,7 @@
80
81
  icon: true, // 显示的图标
81
82
  position: 'center', // toast出现的位置
82
83
  complete: null, // 执行完后的回调函数
83
- overlay: false, // 是否防止触摸穿透
84
+ overlay: true, // 是否防止触摸穿透
84
85
  loading: false, // 是否加载中状态
85
86
  },
86
87
  tmpConfig: {}, // 将用户配置和内置配置合并后的临时配置变量
@@ -92,10 +93,14 @@
92
93
  if(!this.tmpConfig.icon || this.tmpConfig.icon == 'none') {
93
94
  return '';
94
95
  }
95
- if (['error', 'warning', 'success', 'primary'].includes(this.tmpConfig.type)) {
96
- return type2icon(this.tmpConfig.type)
96
+ if (this.tmpConfig.icon === true) {
97
+ if (['error', 'warning', 'success', 'primary'].includes(this.tmpConfig.type)) {
98
+ return type2icon(this.tmpConfig.type)
99
+ } else {
100
+ return ''
101
+ }
97
102
  } else {
98
- return ''
103
+ return this.tmpConfig.icon
99
104
  }
100
105
  },
101
106
  overlayStyle() {
@@ -178,12 +183,7 @@
178
183
  this.timer = null
179
184
  }
180
185
  },
181
- // #ifdef VUE2
182
- beforeDestroy() {
183
- // #endif
184
- // #ifdef VUE3
185
186
  beforeUnmount() {
186
- // #endif
187
187
  this.clearTimer()
188
188
  }
189
189
  }
@@ -94,7 +94,13 @@
94
94
 
95
95
  <template v-if="isInCount">
96
96
  <view
97
- v-if="$slots.default || $slots.$default"
97
+ v-if="$slots.trigger"
98
+ @tap="chooseFile"
99
+ >
100
+ <slot name="trigger" />
101
+ </view>
102
+ <view
103
+ v-else-if="!$slots.trigger && ($slots.default || $slots.$default)"
98
104
  @tap="chooseFile"
99
105
  >
100
106
  <slot />
@@ -123,7 +129,6 @@
123
129
  </view>
124
130
  </template>
125
131
  </view>
126
-
127
132
  </view>
128
133
  </template>
129
134
 
@@ -332,7 +337,7 @@
332
337
  });
333
338
  },
334
339
  onPreviewVideo(event) {
335
- if (!this.data.previewFullImage) return;
340
+ if (!this.previewFullImage) return;
336
341
  const {
337
342
  index
338
343
  } = event.currentTarget.dataset;
@@ -360,7 +365,7 @@
360
365
  index
361
366
  } = event.currentTarget.dataset;
362
367
  const item = this.data.lists[index];
363
- if (!this.data.previewFullImage) return;
368
+ if (!this.previewFullImage) return;
364
369
  switch (item.type) {
365
370
  case 'video':
366
371
  this.onPreviewVideo(event);
@@ -19,7 +19,8 @@ function formatImage(res) {
19
19
  thumb: item.path,
20
20
  size: item.size,
21
21
  // #ifdef H5
22
- name: item.name
22
+ name: item.name,
23
+ file: item
23
24
  // #endif
24
25
  }))
25
26
  }
@@ -33,7 +34,8 @@ function formatVideo(res) {
33
34
  thumb: res.thumbTempFilePath,
34
35
  size: res.size,
35
36
  // #ifdef H5
36
- name: res.name
37
+ name: res.name,
38
+ file: res
37
39
  // #endif
38
40
  }
39
41
  ]
@@ -45,7 +47,10 @@ function formatMedia(res) {
45
47
  type: res.type,
46
48
  url: item.tempFilePath,
47
49
  thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath,
48
- size: item.size
50
+ size: item.size,
51
+ // #ifdef H5
52
+ file: item
53
+ // #endif
49
54
  }))
50
55
  }
51
56
 
@@ -56,7 +61,8 @@ function formatFile(res) {
56
61
  size:item.size,
57
62
  // #ifdef H5
58
63
  name: item.name,
59
- type: item.type
64
+ type: item.type,
65
+ file: item
60
66
  // #endif
61
67
  }))
62
68
  }
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <view class="u-waterfall">
3
- <view id="u-left-column" class="u-column">
3
+ <view ref="u-left-column" id="u-left-column" class="u-column">
4
4
  <slot name="left" :leftList="leftList"></slot>
5
5
  </view>
6
- <view id="u-right-column" class="u-column">
6
+ <view ref="u-right-column" id="u-right-column" class="u-column">
7
7
  <slot name="right" :rightList="rightList"></slot>
8
8
  </view>
9
9
  </view>
@@ -18,6 +18,8 @@
18
18
  * @property {String Number} add-time 单条数据添加到队列的时间间隔,单位ms,见上方注意事项说明(默认200)
19
19
  * @example <u-waterfall :flowList="flowList"></u-waterfall>
20
20
  */
21
+ import { mpMixin } from '../../libs/mixin/mpMixin';
22
+ import { mixin } from '../../libs/mixin/mixin';
21
23
  export default {
22
24
  name: "u-waterfall",
23
25
  props: {
@@ -54,6 +56,7 @@
54
56
  default: 'id'
55
57
  }
56
58
  },
59
+ mixins: [mpMixin, mixin],
57
60
  data() {
58
61
  return {
59
62
  leftList: [],
@@ -156,7 +159,7 @@
156
159
  // #endif
157
160
  // #ifdef VUE3
158
161
  index = this.modelValue.findIndex(val => val[this.idKey] == id);
159
- if (index != -1) this.$emit('input', this.modelValue.splice(index, 1));
162
+ if (index != -1) this.$emit('update:modelValue', this.modelValue.splice(index, 1));
160
163
  // #endif
161
164
  },
162
165
  // 修改某条数据的某个属性
@@ -216,10 +219,13 @@
216
219
  @include flex;
217
220
  flex: 1;
218
221
  flex-direction: column;
219
- height: auto;
222
+ overflow: hidden;
223
+ /* #ifndef APP-NVUE */
224
+ height: 100%;
225
+ /* #endif */
220
226
  }
221
227
 
222
228
  .u-image {
223
- width: 100%;
229
+ max-width: 100%;
224
230
  }
225
231
  </style>
@@ -20,6 +20,7 @@ export default {
20
20
  safeAreaInsetBottom: true,
21
21
  openType: '',
22
22
  closeOnClickOverlay: true,
23
- round: 0
23
+ round: 0,
24
+ wrapMaxHeight: '600px'
24
25
  }
25
26
  }
@@ -20,6 +20,7 @@ export default {
20
20
  align: 'left',
21
21
  name: '',
22
22
  icon: '',
23
- duration: 300
23
+ duration: 300,
24
+ showRight: true
24
25
  }
25
26
  }
@@ -14,6 +14,7 @@ export default {
14
14
  activeColor: '#5677fc',
15
15
  indexList: [],
16
16
  sticky: true,
17
- customNavHeight: 0
17
+ customNavHeight: 0,
18
+ safeBottomFix: false
18
19
  }
19
20
  }
@@ -20,6 +20,8 @@ export default {
20
20
  blockColor: '#ffffff',
21
21
  showValue: false,
22
22
  disabled:false,
23
- blockStyle: {}
23
+ blockStyle: {},
24
+ useNative: false,
25
+ height: '2px'
24
26
  }
25
27
  }
@@ -96,7 +96,7 @@
96
96
  }
97
97
 
98
98
  .cursor-pointer {
99
- /* #ifndef APP-NVUE */
99
+ /* #ifdef H5 */
100
100
  cursor: pointer;
101
101
  /* #endif */
102
102
  }
@@ -216,6 +216,7 @@
216
216
  // 多轴交叉时的对齐方式
217
217
 
218
218
  // 起点对齐
219
+ /* #ifndef APP-NVUE */
219
220
  .u-flex-content-start {
220
221
  align-content: flex-start;
221
222
  }
@@ -258,6 +259,8 @@
258
259
  flex-shrink: 1;
259
260
  }
260
261
 
262
+ /* #endif */
263
+
261
264
  // 定义内外边距,历遍1-80
262
265
  @for $i from 0 through 80 {
263
266
  // 只要双数和能被5除尽的数
@@ -1,7 +1,11 @@
1
1
  import { defineMixin } from '../vue'
2
- import { deepMerge, $parent } from '../function/index'
2
+ import { deepMerge, $parent, sleep } from '../function/index'
3
3
  import test from '../function/test'
4
4
  import route from '../util/route'
5
+ // #ifdef APP-NVUE
6
+ // 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
7
+ const dom = uni.requireNativePlugin('dom')
8
+ // #endif
5
9
 
6
10
  export const mixin = defineMixin({
7
11
  // 定义每个组件都可能需要用到的外部样式以及类名
@@ -107,6 +111,7 @@ export const mixin = defineMixin({
107
111
  // 解决办法为在组件根部再套一个没有任何作用的view元素
108
112
  $uGetRect(selector, all) {
109
113
  return new Promise((resolve) => {
114
+ // #ifndef APP-NVUE
110
115
  uni.createSelectorQuery()
111
116
  .in(this)[all ? 'selectAll' : 'select'](selector)
112
117
  .boundingClientRect((rect) => {
@@ -118,6 +123,22 @@ export const mixin = defineMixin({
118
123
  }
119
124
  })
120
125
  .exec()
126
+ // #endif
127
+
128
+ // #ifdef APP-NVUE
129
+ sleep(30).then(() => {
130
+ let selectorNvue = selector.substring(1) // 去掉开头的#或者.
131
+ let selectorRef = this.$refs[selectorNvue]
132
+ if (!selectorRef) {
133
+ console.log('不存在元素,请检查是否设置了ref属性' + selectorNvue + '。')
134
+ resolve({})
135
+ }
136
+ dom.getComponentRect(selectorRef, res => {
137
+ // console.log(res)
138
+ resolve(res.size)
139
+ })
140
+ })
141
+ // #endif
121
142
  })
122
143
  },
123
144
  getParentData(parentName = '') {
@@ -151,13 +172,7 @@ export const mixin = defineMixin({
151
172
  onReachBottom() {
152
173
  uni.$emit('uOnReachBottom')
153
174
  },
154
- // #ifdef VUE2
155
- // beforeDestroy()
156
- // #endif
157
- // #ifdef VUE3
158
- beforeUnmount()
159
- // #endif
160
- {
175
+ beforeUnmount() {
161
176
  // 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
162
177
  // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
163
178
  if (this.parent && test.array(this.parent.children)) {
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.6",
5
+ "version": "3.3.8",
6
6
  "description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",
package/types/index.d.ts CHANGED
@@ -1,35 +1,160 @@
1
1
  /// <reference path="./comps.d.ts" />
2
2
  declare module 'uview-plus' {
3
- export function install(): void //必要
4
- interface test {
5
- /** 邮箱格式校验 */
6
- email(email: string): boolean
7
- }
8
- interface $u {
9
- route: {},
10
- colorGradient: {},
11
- hexToRgb: {},
12
- rgbToHex: {},
13
- colorToRgba: {},
14
- test: test,
15
- type: {},
16
- http: {},
17
- config: {},
18
- zIndex: {},
19
- debounce: {},
20
- throttle: {},
21
- mixin: {},
22
- mpMixin: {},
23
- props: {},
24
- color: {},
25
- platform: {},
26
- }
3
+ export function install(): void //必要
4
+ interface test {
5
+ /** 邮箱格式校验 */
6
+ email(email: string): boolean
7
+ /** 手机号校验 */
8
+ mobile(phone: number): boolean;
9
+ /** url路径验证 */
10
+ url(value: string): boolean;
11
+ /** 验证日期格式 */
12
+ date(value: string | number): boolean;
13
+ /** 验证ISO类型的日期格式 YYYY-MM-DD | YYYY/MM/DD */
14
+ dateISO(value: string): boolean;
15
+ /** 验证十进制数字 */
16
+ number(value: number): boolean;
17
+ /** 验证字符串 */
18
+ string(value: string): boolean;
19
+ /** 验证整数 */
20
+ digits(value: number): boolean;
21
+ /** 验证身份证号码 */
22
+ idCard(value: string | number): boolean;
23
+ /** 是否车牌号 */
24
+ carNo(value: string): boolean;
25
+ /** 金额,只允许2位小数 */
26
+ amount(value: string | number): boolean;
27
+ /** 校验是否是中文 */
28
+ chinese(value: any): boolean;
29
+ /** 校验是否是字母 */
30
+ letter(value: any): boolean;
31
+ /** 校验字母或者数字 */
32
+ enOrNum(value: any): boolean;
33
+ /** 验证是否包含某个值 */
34
+ contains(source: string, value: string): boolean;
35
+ /** 验证一个值范围[min, max] */
36
+ range(value: string, between: number[]): boolean;
37
+ /** 验证一个长度范围[min, max] */
38
+ rangeLength(value: string, between: number[]): boolean;
39
+ /** 是否固定电话 */
40
+ landline(value: string | number): boolean;
41
+ /** 判断是否为空 */
42
+ empty(value: string | number | undefined | boolean | object | null): boolean;
43
+ /** 是否json字符串 */
44
+ jsonString(value: string): boolean;
45
+ /** 是否数组 */
46
+ array(value: any): boolean;
47
+ /** 是否对象 */
48
+ object(value: any): boolean;
49
+ /** 是否短信验证码 */
50
+ code(value: any, len: number): boolean;
51
+ /** 是否函数方法 */
52
+ func(value: any): boolean;
53
+ /** 是否promise对象 */
54
+ promise(value: any): boolean;
55
+ /** 是否图片格式 */
56
+ image(value: string): boolean;
57
+ /** 是否视频格式 */
58
+ video(value: string): boolean;
59
+ /** 是否为正则对象 */
60
+ regExp(value: any): boolean;
61
+ }
62
+ interface RouteParam {
63
+ type: 'navigateTo' | 'redirect' | 'switchTab' | 'reLaunch' | 'navigateBack';
64
+ /** 路由地址 */
65
+ url: string;
66
+ /** navigateBack页面后退时,回退的层数 */
67
+ delta?: number;
68
+ /** 传递的参数 */
69
+ params?: {};
70
+ /** 窗口动画,只在APP有效 */
71
+ animationType?: string;
72
+ /** 窗口动画持续时间,单位毫秒,只在APP有效 */
73
+ animationDuration?: number;
74
+ /** 是否需要拦截 */
75
+ intercept?: boolean;
76
+ }
77
+ interface Config {
78
+ v: string;
79
+ version: string;
80
+ color: Partial<Color>;
81
+ unit: 'px' | 'rpx'
82
+ }
83
+ interface Color {
84
+ primary: string,
85
+ info: string,
86
+ default: string,
87
+ warning: string,
88
+ error: string,
89
+ success: string,
90
+ mainColor: string,
91
+ contentColor: string,
92
+ tipsColor: string,
93
+ lightColor: string,
94
+ borderColor: string
95
+ }
96
+ interface GlobalConfig {
97
+ config: Partial<Config>;
98
+ props: {};
99
+ }
100
+ interface $u {
101
+ route: (url: string | RouteParam) => void;
102
+ /**
103
+ * 求两个颜色之间的渐变值
104
+ * @param {string} startColor 开始的颜色
105
+ * @param {string} endColor 结束的颜色
106
+ * @param {number} step 颜色等分的份额
107
+ */
108
+ colorGradient: (startColor: string, endColor: string, step: number) => any[];
109
+ /**
110
+ * 将hex表示方式转换为rgb
111
+ * @param color "#000000"-> "rgb(0,0,0)" | "rgb(0,0,0)" -> "#000000"
112
+ * @param str 是否返回颜色数组 true -> 不返回
113
+ * @returns
114
+ */
115
+ hexToRgb: (color: string, str?: boolean) => any[];
116
+ /**
117
+ * 将rgb表示方式转换为hex
118
+ */
119
+ rgbToHex: (color: string) => string;
120
+ /**
121
+ * 十六进制转换为rgb或rgba
122
+ * @param color
123
+ * @param alpha 透明度
124
+ * @returns rgba(255,255,255,0.5)字符串
125
+ */
126
+ colorToRgba: (color: string, alpha: number) => string;
127
+ test: test;
128
+ type: {},
129
+ http: {},
130
+ config: Config;
131
+ zIndex: {
132
+ toast: number;
133
+ noNetwork: number;
134
+ // popup包含popup,actionsheet,keyboard,picker的值
135
+ popup: number;
136
+ mask: number;
137
+ navbar: number;
138
+ topTips: number;
139
+ sticky: number;
140
+ indexListSticky: number;
141
+ },
142
+ debounce: (func, wait, immediate) => void;
143
+ throttle: (func, wait, immediate) => void;
144
+ mixin: {},
145
+ mpMixin: {},
146
+ props: {},
147
+ color: Color;
148
+ platform: string;
149
+ }
27
150
 
28
- global {
29
- interface Uni {
30
- $u: $u
31
- }
32
- }
151
+ export function setConfig(config: Partial<GlobalConfig>): void;
152
+
153
+ global {
154
+ interface Uni {
155
+ $u: $u
156
+ }
157
+ }
33
158
  }
34
159
  declare type UniCountDownRef = typeof import('./comps/countDown')['CountDownRef']
35
160
  declare type UniCountToRef = typeof import('./comps/countTo')['CountToRef']