n20-common-lib 3.0.29 → 3.0.31
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/package.json +1 -1
- package/src/components/TablePro/index.vue +67 -16
- package/src/components/TableSetSize/index.vue +9 -2
- package/style/fonts/iconfont.38d4b428.woff +0 -0
- package/style/fonts/iconfont.b56977e8.woff2 +0 -0
- package/style/fonts/{iconfont.da8f3f01.ttf → iconfont.f0839d3b.ttf} +0 -0
- package/style/index.css +2 -2
- package/theme/blue.css +3 -0
- package/theme/cctcRed.css +3 -0
- package/theme/fonts/SIMSUN.5e0c362c.ttf +0 -0
- package/theme/fonts/element-icons.535877f5.woff +0 -0
- package/theme/fonts/element-icons.732389de.ttf +0 -0
- package/theme/fonts/iconfont.09d221ee.woff +0 -0
- package/theme/fonts/iconfont.1c4bfacc.ttf +0 -0
- package/theme/fonts/iconfont.38d4b428.woff +0 -0
- package/theme/fonts/iconfont.a6f34dc7.woff2 +0 -0
- package/theme/fonts/iconfont.b56977e8.woff2 +0 -0
- package/theme/fonts/iconfont.f0839d3b.ttf +0 -0
- package/theme/fonts/iconfont.f4c32765.ttf +0 -0
- package/theme/green.css +3 -0
- package/theme/lightBlue.css +3 -0
- package/theme/orange.css +3 -0
- package/theme/purple.css +3 -0
- package/theme/red.css +3 -0
- package/theme/yellow.css +3 -0
- package/style/fonts/iconfont.15a3ce0f.woff2 +0 -0
- package/style/fonts/iconfont.ed15bc90.woff +0 -0
package/package.json
CHANGED
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
@cell-mouseenter="handleCellMouseEnter"
|
|
58
58
|
@cell-mouseleave="handleCellMouseLeave"
|
|
59
59
|
@scroll="handleTableScroll"
|
|
60
|
+
@toggle-tree-expand="syncExpandState"
|
|
60
61
|
>
|
|
61
62
|
<template v-for="(item, i) in _columns">
|
|
62
63
|
<slot v-if="item.slotName" :name="item.slotName" :column="item"></slot>
|
|
@@ -196,24 +197,34 @@
|
|
|
196
197
|
</template>
|
|
197
198
|
</vxe-column>
|
|
198
199
|
</template>
|
|
199
|
-
<vxe-column
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
200
|
+
<vxe-column fixed="right" header-class-name="fixed-column__static" :min-width="clacStaticColumnWidth">
|
|
201
|
+
<template #header>
|
|
202
|
+
<div class="flex-box flex-v flex-c">
|
|
203
|
+
<i
|
|
204
|
+
v-if="showColumn"
|
|
205
|
+
v-title="$lc('设置显示列')"
|
|
206
|
+
class="v3-icon-system-solution pointer"
|
|
207
|
+
:class="hoverIconKey === 'showColumn' ? 'color-primary' : ''"
|
|
208
|
+
@mouseenter="hoverIconKey = 'showColumn'"
|
|
209
|
+
@mouseleave="hoverIconKey = null"
|
|
210
|
+
@click="$emit('visible-column')"
|
|
211
|
+
></i>
|
|
212
|
+
<tableSetSize v-if="showSetsize" :size="sizeC" v-bind="$attrs" @update:size="sizeUp" @resize="sizeSet" />
|
|
213
|
+
<i
|
|
214
|
+
v-if="$attrs.treeConfig || $attrs['tree-config']"
|
|
215
|
+
v-title="!isExpand ? $lc('展开分组') : $lc('折叠分组')"
|
|
216
|
+
class="pointer"
|
|
217
|
+
:class="[isExpand ? 'v3-icon-group-collapse' : 'v3-icon-group-expand', hoverIconKey === 'toggleExpand' ? 'color-primary' : '']"
|
|
218
|
+
@mouseenter="hoverIconKey = 'toggleExpand'"
|
|
219
|
+
@mouseleave="hoverIconKey = null"
|
|
220
|
+
@click="toggleExpand"
|
|
221
|
+
></i>
|
|
222
|
+
</div>
|
|
223
|
+
</template>
|
|
213
224
|
</vxe-column>
|
|
214
225
|
<template #empty>
|
|
215
226
|
<slot name="empty">
|
|
216
|
-
<empty type="
|
|
227
|
+
<empty type="noData" :content="$lc('暂无数据')" :height="200" :width="200" />
|
|
217
228
|
</slot>
|
|
218
229
|
</template>
|
|
219
230
|
</vxe-table>
|
|
@@ -429,7 +440,9 @@ export default {
|
|
|
429
440
|
hoverHideTimer: null, // 隐藏延迟定时器
|
|
430
441
|
isHoverOnBtnGroup: false, // 鼠标是否在按钮组上
|
|
431
442
|
isDropdownVisible: false, // "更多"下拉菜单是否展开
|
|
432
|
-
hoverHeaderProp: null // 当前悬停表头列的 prop
|
|
443
|
+
hoverHeaderProp: null, // 当前悬停表头列的 prop
|
|
444
|
+
hoverIconKey: null, // 当前悬停的静态列头图标标识
|
|
445
|
+
isExpand: false
|
|
433
446
|
}
|
|
434
447
|
},
|
|
435
448
|
computed: {
|
|
@@ -474,6 +487,12 @@ export default {
|
|
|
474
487
|
right: 0, // 固定在右侧设置列按钮左边
|
|
475
488
|
height: `${this.hoverBtnsPosition.height}px`
|
|
476
489
|
}
|
|
490
|
+
},
|
|
491
|
+
// 计算列宽
|
|
492
|
+
clacStaticColumnWidth() {
|
|
493
|
+
const hasExpand = this.$attrs.expandConfig || this.$attrs['expand-config']
|
|
494
|
+
const activeCount = [this.showColumn, this.showSetsize, hasExpand].filter(Boolean).length
|
|
495
|
+
return activeCount === 3 ? 100 : activeCount === 2 ? 80 : 50
|
|
477
496
|
}
|
|
478
497
|
},
|
|
479
498
|
watch: {
|
|
@@ -499,6 +518,38 @@ export default {
|
|
|
499
518
|
this.clearHoverTimers()
|
|
500
519
|
},
|
|
501
520
|
methods: {
|
|
521
|
+
/**
|
|
522
|
+
* 一键展开/折叠表格树形行(仅处理第一层级数据行)
|
|
523
|
+
* 通过 vxe-table 的 setTreeExpand API 批量设置顶层行的展开状态,
|
|
524
|
+
* await Promise 完成后再同步 isExpand 状态,保证图标与实际展开状态一致
|
|
525
|
+
* 不直接操作 DOM,不影响排序、筛选等原有逻辑
|
|
526
|
+
* @returns {Promise<void>}
|
|
527
|
+
*/
|
|
528
|
+
async toggleExpand() {
|
|
529
|
+
const $table = this.$refs.vxeTable
|
|
530
|
+
if (!$table) return
|
|
531
|
+
// 仅取顶层数据行(data prop 中的第一层,不包含子级)
|
|
532
|
+
const topLevelRows = this.data || []
|
|
533
|
+
if (topLevelRows.length === 0) return
|
|
534
|
+
// 切换展开状态:当前已展开则折叠,当前已折叠则展开
|
|
535
|
+
const nextExpand = !this.isExpand
|
|
536
|
+
// setTreeExpand 返回 Promise,await 确保展开动作完成后再更新图标状态
|
|
537
|
+
await $table.setTreeExpand(topLevelRows, nextExpand)
|
|
538
|
+
this.isExpand = nextExpand
|
|
539
|
+
},
|
|
540
|
+
/**
|
|
541
|
+
* 同步单行手动展开/折叠后的图标状态
|
|
542
|
+
* 监听 vxe-table toggle-tree-expand 事件,根据当前所有顶层行展开情况更新 isExpand
|
|
543
|
+
* @param {Object} expandRecords - vxe-table 当前所有已展开的行记录
|
|
544
|
+
* @returns {void}
|
|
545
|
+
*/
|
|
546
|
+
syncExpandState({ expandRecords }) {
|
|
547
|
+
const topLevelRows = this.data || []
|
|
548
|
+
if (topLevelRows.length === 0) return
|
|
549
|
+
// 若顶层行全部处于展开状态则认为是"已展开",否则为"未全部展开"
|
|
550
|
+
const expandSet = new Set(expandRecords)
|
|
551
|
+
this.isExpand = topLevelRows.every((row) => expandSet.has(row))
|
|
552
|
+
},
|
|
502
553
|
// 锁定列:将该列 fixed 设为 'left',直接修改 prop 对象并刷新表格
|
|
503
554
|
lockColumn(item) {
|
|
504
555
|
if (item.fixed || item.static) return
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-dropdown @command="setSize">
|
|
3
|
-
<i
|
|
3
|
+
<i
|
|
4
|
+
v-title="$lc('行高')"
|
|
5
|
+
class="v3-icon-line-height pointer"
|
|
6
|
+
:class="hoverIconKey === 'height' ? 'color-primary' : ''"
|
|
7
|
+
@mouseenter="hoverIconKey = 'height'"
|
|
8
|
+
@mouseleave="hoverIconKey = null"
|
|
9
|
+
></i>
|
|
4
10
|
<el-dropdown-menu slot="dropdown">
|
|
5
11
|
<el-dropdown-item command="small">{{ _lang === 'zh' ? '默认' : 'small' }}</el-dropdown-item>
|
|
6
12
|
<el-dropdown-item command="mini">{{ _lang === 'zh' ? '紧凑' : 'mini' }}</el-dropdown-item>
|
|
@@ -36,7 +42,8 @@ export default {
|
|
|
36
42
|
data() {
|
|
37
43
|
let _this = this
|
|
38
44
|
return {
|
|
39
|
-
sizeC: localStorage.getItem('table-size') || _this.size
|
|
45
|
+
sizeC: localStorage.getItem('table-size') || _this.size,
|
|
46
|
+
hoverIconKey: null
|
|
40
47
|
}
|
|
41
48
|
},
|
|
42
49
|
watch: {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|