uview-plus 3.4.65 → 3.4.67

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,15 @@
1
+ ## 3.4.67(2025-08-02)
2
+ feat: number-box支持disabledBgColor参数
3
+
4
+ ## 3.4.66(2025-08-01)
5
+ improvment: 增加组件图标
6
+
7
+ feat: table2组件新增列排序插槽
8
+
9
+ fix: 分段器组件onWindowResize使用条件编译
10
+
11
+ fix: 修复u-line-1单行省略样式
12
+
1
13
  ## 3.4.65(2025-07-26)
2
14
  fix: 修复部分环境下字体图标全局加载问题
3
15
 
@@ -29,6 +29,7 @@ export default {
29
29
  buttonSize: 30,
30
30
  buttonRadius: '0px',
31
31
  bgColor: '#EBECEE',
32
+ disabledBgColor: '#f7f8fa',
32
33
  inputBgColor: '#EBECEE',
33
34
  cursorSpacing: 100,
34
35
  disableMinus: false,
@@ -106,6 +106,11 @@ export const props = defineMixin({
106
106
  type: String,
107
107
  default: () => defProps.numberBox.bgColor
108
108
  },
109
+ // 按钮禁用背景色
110
+ disabledBgColor: {
111
+ type: String,
112
+ default: () => defProps.numberBox.disabledBgColor
113
+ },
109
114
  // 输入框背景颜色
110
115
  inputBgColor: {
111
116
  type: String,
@@ -184,7 +184,7 @@
184
184
  borderRadius: this.buttonRadius
185
185
  }
186
186
  if (this.isDisabled(type)) {
187
- style.backgroundColor = '#f7f8fa'
187
+ style.backgroundColor = this.disabledBgColor
188
188
  }
189
189
  return style
190
190
  }
@@ -210,13 +210,17 @@ export default {
210
210
  },
211
211
  mounted() {
212
212
  this.init();
213
+ // #ifndef APP || MP-WEIXIN || MP-LARK|| MP-QQ || H5
213
214
  this.windowResizeCallback = (res) => {
214
215
  this.init();
215
216
  }
216
217
  uni.onWindowResize(this.windowResizeCallback)
218
+ // #endif
217
219
  },
218
220
  beforeUnmount() {
221
+ // #ifndef APP || MP-WEIXIN || MP-LARK|| MP-QQ || H5
219
222
  uni.offWindowResize(this.windowResizeCallback)
223
+ // #endif
220
224
  },
221
225
  emits: ["change", "update:current"],
222
226
  methods: {
@@ -4,19 +4,24 @@
4
4
  <view v-if="showHeader" class="u-table-header" :class="{ 'u-table-sticky': fixedHeader }" :style="{minWidth: scrollWidth}">
5
5
  <view class="u-table-row">
6
6
  <view v-for="(col, colIndex) in columns" :key="col.key" class="u-table-cell"
7
- :style="headerColStyle(col)"
7
+ :style="headerColStyle(col)"
8
8
  :class="[
9
9
  col.align ? 'u-text-' + col.align : '',
10
10
  headerCellClassName ? headerCellClassName(col) : '',
11
11
  col.fixed === 'left' ? 'u-table-fixed-left' : '',
12
12
  col.fixed === 'right' ? 'u-table-fixed-right' : ''
13
- ]" @click="handleHeaderClick(col)">
14
- <slot name="header" :column="col" :columnIndex="colIndex" :level="1">
15
- {{ col.title }}
13
+ ]" @click="handleHeaderClick(col)">
14
+ <slot name="header" :column="col" :columnIndex="colIndex" :level="1">
16
15
  </slot>
17
- <view v-if="col.sortable">
18
- {{ getSortIcon(col.key) }}
19
- </view>
16
+ <text v-if="!$slots['header']">{{ col.title }}</text>
17
+ <template v-if="col.sortable">
18
+ <slot name="headerSort" :sortStatus="getSortValue(col.key)" :column="col"
19
+ :columnIndex="colIndex" :level="1">
20
+ </slot>
21
+ <view v-if="!$slots['headerSort']">
22
+ {{ getSortIcon(col.key) }}
23
+ </view>
24
+ </template>
20
25
  </view>
21
26
  </view>
22
27
  </view>
@@ -30,28 +35,28 @@
30
35
  rowClassName ? rowClassName(row, index) : '',
31
36
  stripe && index % 2 === 1 ? 'u-table-row-zebra' : ''
32
37
  ]" @click="handleRowClick(row)">
33
- <view v-for="(col, colIndex) in columns" :key="col.key"
38
+ <view v-for="(col, colIndex) in columns" :key="col.key"
34
39
  class="u-table-cell" :class="[
35
40
  col.align ? 'u-text-' + col.align : '',
36
41
  cellClassName ? cellClassName(row, col) : '',
37
42
  col.fixed === 'left' ? 'u-table-fixed-left' : '',
38
43
  col.fixed === 'right' ? 'u-table-fixed-right' : ''
39
- ]" :style="cellStyleInner({row: row, column: col,
44
+ ]" :style="cellStyleInner({row: row, column: col,
40
45
  rowIndex: index, columnIndex: colIndex, level: 0})">
41
46
  <!-- 复选框列 -->
42
47
  <view v-if="col.type === 'selection'">
43
- <checkbox :checked="isSelected(row)"
48
+ <checkbox :checked="isSelected(row)"
44
49
  @click.stop="toggleSelect(row)" />
45
50
  </view>
46
51
 
47
52
  <!-- 树形结构展开图标 -->
48
- <view v-else-if="col.type === 'expand'"
53
+ <view v-else-if="col.type === 'expand'"
49
54
  @click.stop="toggleExpand(row)">
50
55
  {{ isExpanded(row) ? '▼' : '▶' }}
51
56
  </view>
52
57
 
53
58
  <!-- 默认插槽或文本 -->
54
- <slot name="cell" :row="row" :column="col"
59
+ <slot name="cell" :row="row" :column="col"
55
60
  :rowIndex="index" :columnIndex="colIndex">
56
61
  <view class="u-table-cell_content">
57
62
  {{ row[col.key] }}
@@ -65,9 +70,9 @@
65
70
  <view v-for="childRow in row[treeProps.children]" :key="childRow[rowKey]"
66
71
  class="u-table-row u-table-row-child">
67
72
  <view v-for="(col2, col2Index) in columns" :key="col2.key" class="u-table-cell"
68
- :style="cellStyleInner({row: childRow, column: col2,
73
+ :style="cellStyleInner({row: childRow, column: col2,
69
74
  rowIndex: index, columnIndex: col2Index, level: 1})">
70
- <slot name="cell" :row="childRow" :column="col2" :prow="row"
75
+ <slot name="cell" :row="childRow" :column="col2" :prow="row"
71
76
  :rowIndex="index" :columnIndex="col2Index" :level="1">
72
77
  <view class="u-table-cell_content">
73
78
  {{ childRow[col2.key] }}
@@ -80,8 +85,8 @@
80
85
  </template>
81
86
  <template v-else>
82
87
  <slot name="empty">
83
- <view class="u-table-empty">{{ emptyText }}</view>
84
88
  </slot>
89
+ <view v-if="!$slots['empty']" class="u-table-empty">{{ emptyText }}</view>
85
90
  </template>
86
91
  </view>
87
92
  </view>
@@ -151,10 +156,10 @@ export default {
151
156
  cellClassName: {
152
157
  type: Function,
153
158
  default: null
154
- },
155
- cellStyle: {
156
- type: Function,
157
- default: null
159
+ },
160
+ cellStyle: {
161
+ type: Function,
162
+ default: null
158
163
  },
159
164
  headerCellClassName: {
160
165
  type: Function,
@@ -241,37 +246,37 @@ export default {
241
246
  },
242
247
  mounted() {
243
248
  this.getComponentWidth()
244
- },
245
- computed: {
249
+ },
250
+ computed: {
246
251
  },
247
252
  methods: {
248
- addUnit,
249
- headerColStyle(col) {
250
- let style = {
251
- width: col.width ? addUnit(col.width) : 'auto',
252
- flex: col.width ? 'none' : 1
253
- };
254
- if (col?.style) {
255
- style = {...style, ...col?.style};
256
- }
257
- return style;
258
- },
259
- setCellStyle(e) {
260
- this.cellStyle = e
261
- },
262
- cellStyleInner(scope) {
263
- let style = {
264
- width: scope.column?.width ? addUnit(scope.column.width) : 'auto',
265
- flex: scope.column?.width ? 'none' : 1,
266
- paddingLeft: (24 * scope.level) + 'px'
267
- };
268
- if (this.cellStyle != null) {
269
- let styleCalc = this.cellStyle(scope)
270
- if (styleCalc != null) {
271
- style = {...style, ...styleCalc}
272
- }
273
- }
274
- return style;
253
+ addUnit,
254
+ headerColStyle(col) {
255
+ let style = {
256
+ width: col.width ? addUnit(col.width) : 'auto',
257
+ flex: col.width ? 'none' : 1
258
+ };
259
+ if (col?.style) {
260
+ style = {...style, ...col?.style};
261
+ }
262
+ return style;
263
+ },
264
+ setCellStyle(e) {
265
+ this.cellStyle = e
266
+ },
267
+ cellStyleInner(scope) {
268
+ let style = {
269
+ width: scope.column?.width ? addUnit(scope.column.width) : 'auto',
270
+ flex: scope.column?.width ? 'none' : 1,
271
+ paddingLeft: (24 * scope.level) + 'px'
272
+ };
273
+ if (this.cellStyle != null) {
274
+ let styleCalc = this.cellStyle(scope)
275
+ if (styleCalc != null) {
276
+ style = {...style, ...styleCalc}
277
+ }
278
+ }
279
+ return style;
275
280
  },
276
281
  // 获取组件的宽度
277
282
  async getComponentWidth() {
@@ -386,6 +391,12 @@ export default {
386
391
  return cond.order === 'ascending' ? '↑' : '↓';
387
392
  }
388
393
 
394
+ function getSortValue(field) {
395
+ const cond = sortConditions.value.find(c => c.field === field);
396
+ if (!cond) return '';
397
+ return cond.order === 'ascending';
398
+ }
399
+
389
400
  function toggleSelect(row) {
390
401
  const index = selectedRows.value.findIndex(r => r[props.rowKey] === row[props.rowKey]);
391
402
  if (index >= 0) {
@@ -424,6 +435,7 @@ export default {
424
435
  sortConditions,
425
436
  handleRowClick,
426
437
  handleHeaderClick,
438
+ getSortValue,
427
439
  getSortIcon,
428
440
  toggleSelect,
429
441
  isSelected,
@@ -13,7 +13,7 @@
13
13
 
14
14
  /* #ifndef APP-NVUE */
15
15
  // vue下,单行和多行显示省略号需要单独处理
16
- @if $i == '1' {
16
+ @if $i == 1 {
17
17
  overflow: hidden;
18
18
  white-space: nowrap;
19
19
  text-overflow: ellipsis;
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.4.65",
5
+ "version": "3.4.67",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水。",
7
7
  "keywords": [
8
8
  "uview",