@a2simcode/ui 0.0.240 → 0.0.242
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/dist/components/table/index.d.ts +15 -0
- package/dist/components/table/src/table.vue.d.ts +15 -0
- package/dist/components/table-panel/index.d.ts +15 -0
- package/dist/components/table-panel/src/table-panel.vue.d.ts +15 -0
- package/dist/simcode-ui.es.js +2612 -2589
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/docs/components/meta/comp.ts +1 -1
- package/docs/components/meta/input-button.ts +10 -0
- package/docs/components/meta/input-code.ts +10 -0
- package/docs/components/meta/select.ts +1 -1
- package/docs/components/meta/table-panel.ts +272 -260
- package/docs/components/meta/table.ts +409 -403
- package/docs/components/table-panel.md +15 -0
- package/docs/components/table.md +15 -0
- package/docs/examples/table/column-filter.vue +96 -0
- package/docs/examples/table-panel/column-filter.vue +116 -0
- package/package.json +1 -1
|
@@ -15,6 +15,19 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
</Demo>
|
|
17
17
|
|
|
18
|
+
## 隐藏列
|
|
19
|
+
|
|
20
|
+
通过 `columnFilter` 传入需要隐藏的列 id 数组。
|
|
21
|
+
|
|
22
|
+
<Demo :source-code="tablePanelColumnFilterCode">
|
|
23
|
+
<template #source>
|
|
24
|
+
<table-panel-column-filter />
|
|
25
|
+
</template>
|
|
26
|
+
<template #description>
|
|
27
|
+
示例通过按钮动态修改 `columnFilter`,表格面板会自动刷新列。
|
|
28
|
+
</template>
|
|
29
|
+
</Demo>
|
|
30
|
+
|
|
18
31
|
## 树形数据
|
|
19
32
|
|
|
20
33
|
当 `isTree` 为 `true` 时,可配合 `parentKey` 将扁平数据自动转换为树形结构展示。
|
|
@@ -254,6 +267,7 @@ interface LoadDataParams {
|
|
|
254
267
|
|
|
255
268
|
<script setup>
|
|
256
269
|
import TablePanelBasic from '../examples/table-panel/basic.vue'
|
|
270
|
+
import TablePanelColumnFilter from '../examples/table-panel/column-filter.vue'
|
|
257
271
|
import TablePanelTreeParentKey from '../examples/table-panel/tree-parent-key.vue'
|
|
258
272
|
import TablePanelFilter from '../examples/table-panel/filter.vue'
|
|
259
273
|
import TablePanelSearchList from '../examples/table-panel/search-list.vue'
|
|
@@ -268,6 +282,7 @@ import TablePanelMask from '../examples/table-panel/mask.vue'
|
|
|
268
282
|
import tablePanelApi from './meta/table-panel'
|
|
269
283
|
|
|
270
284
|
import tablePanelBasicCode from '../examples/table-panel/basic.vue?raw'
|
|
285
|
+
import tablePanelColumnFilterCode from '../examples/table-panel/column-filter.vue?raw'
|
|
271
286
|
import tablePanelTreeParentKeyCode from '../examples/table-panel/tree-parent-key.vue?raw'
|
|
272
287
|
import tablePanelFilterCode from '../examples/table-panel/filter.vue?raw'
|
|
273
288
|
import tablePanelSearchListCode from '../examples/table-panel/search-list.vue?raw'
|
package/docs/components/table.md
CHANGED
|
@@ -15,6 +15,19 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
</Demo>
|
|
17
17
|
|
|
18
|
+
## 隐藏列
|
|
19
|
+
|
|
20
|
+
通过 `columnFilter` 传入需要隐藏的列 id 数组。
|
|
21
|
+
|
|
22
|
+
<Demo :source-code="tableColumnFilterCode">
|
|
23
|
+
<template #source>
|
|
24
|
+
<table-column-filter />
|
|
25
|
+
</template>
|
|
26
|
+
<template #description>
|
|
27
|
+
示例通过按钮动态修改 `columnFilter`,表格会自动刷新列。
|
|
28
|
+
</template>
|
|
29
|
+
</Demo>
|
|
30
|
+
|
|
18
31
|
## 动态类型渲染
|
|
19
32
|
|
|
20
33
|
<Demo :source-code="tableDynamicTypeCode">
|
|
@@ -377,6 +390,7 @@
|
|
|
377
390
|
|
|
378
391
|
<script setup>
|
|
379
392
|
import TableBasic from '../examples/table/basic.vue'
|
|
393
|
+
import TableColumnFilter from '../examples/table/column-filter.vue'
|
|
380
394
|
import TableTag from '../examples/table/tag.vue'
|
|
381
395
|
import TableIcon from '../examples/table/icon.vue'
|
|
382
396
|
import TableLink from '../examples/table/link.vue'
|
|
@@ -406,6 +420,7 @@ import TableRowDrag from '../examples/table/row-drag.vue'
|
|
|
406
420
|
import tableApi from './meta/table'
|
|
407
421
|
|
|
408
422
|
import tableBasicCode from '../examples/table/basic.vue?raw'
|
|
423
|
+
import tableColumnFilterCode from '../examples/table/column-filter.vue?raw'
|
|
409
424
|
import tableTagCode from '../examples/table/tag.vue?raw'
|
|
410
425
|
import tableIconCode from '../examples/table/icon.vue?raw'
|
|
411
426
|
import tableLinkCode from '../examples/table/link.vue?raw'
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="position: relative; width: 100%; height: 560px">
|
|
3
|
+
<div style="display: flex; align-items: center; gap: 8px; padding: 0 0 10px">
|
|
4
|
+
<div>当前隐藏列: {{ hiddenColumnsLabel }}</div>
|
|
5
|
+
<j-button type="text" label="隐藏状态列" @click="hide('status')" />
|
|
6
|
+
<j-button type="text" label="显示状态列" @click="show('status')" />
|
|
7
|
+
<j-button type="text" label="隐藏更新时间列" @click="hide('updateTime')" />
|
|
8
|
+
<j-button type="text" label="显示更新时间列" @click="show('updateTime')" />
|
|
9
|
+
<j-button type="text" label="重置" @click="reset()" />
|
|
10
|
+
</div>
|
|
11
|
+
<j-table :columns="columns" :records="records" :column-filter="hiddenColumns" />
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { computed, ref } from 'vue'
|
|
17
|
+
|
|
18
|
+
const columns = ref([
|
|
19
|
+
{
|
|
20
|
+
id: 'name',
|
|
21
|
+
config: {
|
|
22
|
+
label: '名称',
|
|
23
|
+
width: 'auto',
|
|
24
|
+
align: 'left',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'status',
|
|
29
|
+
config: {
|
|
30
|
+
label: '状态',
|
|
31
|
+
width: 'auto',
|
|
32
|
+
align: 'center',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'updateTime',
|
|
37
|
+
config: {
|
|
38
|
+
label: '最近更新时间',
|
|
39
|
+
width: 'auto',
|
|
40
|
+
align: 'center',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'owner',
|
|
45
|
+
config: {
|
|
46
|
+
label: '负责人',
|
|
47
|
+
width: 'auto',
|
|
48
|
+
align: 'center',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
const records = ref([
|
|
54
|
+
{
|
|
55
|
+
name: '项目A',
|
|
56
|
+
status: '进行中',
|
|
57
|
+
updateTime: '2025-12-25 20:55:52',
|
|
58
|
+
owner: '张三',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: '项目B',
|
|
62
|
+
status: '已完成',
|
|
63
|
+
updateTime: '2025-12-25 20:51:17',
|
|
64
|
+
owner: '李四',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: '项目C',
|
|
68
|
+
status: '待审核',
|
|
69
|
+
updateTime: '2025-12-25 20:51:11',
|
|
70
|
+
owner: '王五',
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
const hiddenColumns = ref<string[]>(['status'])
|
|
75
|
+
|
|
76
|
+
const hide = (id: string) => {
|
|
77
|
+
if (!hiddenColumns.value.includes(id)) {
|
|
78
|
+
hiddenColumns.value.push(id)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const show = (id: string) => {
|
|
83
|
+
const index = hiddenColumns.value.indexOf(id)
|
|
84
|
+
if (index >= 0) {
|
|
85
|
+
hiddenColumns.value.splice(index, 1)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const reset = () => {
|
|
90
|
+
hiddenColumns.value.splice(0, hiddenColumns.value.length)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const hiddenColumnsLabel = computed(() => {
|
|
94
|
+
return hiddenColumns.value.length > 0 ? hiddenColumns.value.join('、') : '无'
|
|
95
|
+
})
|
|
96
|
+
</script>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="position: relative; width: 100%; height: 560px">
|
|
3
|
+
<div style="display: flex; align-items: center; gap: 8px; padding: 0 0 10px">
|
|
4
|
+
<div>当前隐藏列: {{ hiddenColumnsLabel }}</div>
|
|
5
|
+
<j-button type="text" label="隐藏状态列" @click="hide('status')" />
|
|
6
|
+
<j-button type="text" label="显示状态列" @click="show('status')" />
|
|
7
|
+
<j-button type="text" label="隐藏更新时间列" @click="hide('updateTime')" />
|
|
8
|
+
<j-button type="text" label="显示更新时间列" @click="show('updateTime')" />
|
|
9
|
+
<j-button type="text" label="重置" @click="reset()" />
|
|
10
|
+
</div>
|
|
11
|
+
<j-table-panel
|
|
12
|
+
row-key="id"
|
|
13
|
+
:columns="columns"
|
|
14
|
+
:load-data="loadData"
|
|
15
|
+
:column-filter="hiddenColumns"
|
|
16
|
+
:show-filter-button="false"
|
|
17
|
+
:show-order-button="false"
|
|
18
|
+
:show-column-button="false"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { computed, ref } from 'vue'
|
|
25
|
+
|
|
26
|
+
const columns = ref([
|
|
27
|
+
{
|
|
28
|
+
id: 'name',
|
|
29
|
+
type: '',
|
|
30
|
+
config: {
|
|
31
|
+
label: '名称',
|
|
32
|
+
width: 'auto',
|
|
33
|
+
align: 'left',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'status',
|
|
38
|
+
type: '',
|
|
39
|
+
config: {
|
|
40
|
+
label: '状态',
|
|
41
|
+
width: 'auto',
|
|
42
|
+
align: 'center',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'updateTime',
|
|
47
|
+
type: '',
|
|
48
|
+
config: {
|
|
49
|
+
label: '最近更新时间',
|
|
50
|
+
width: 'auto',
|
|
51
|
+
align: 'center',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'owner',
|
|
56
|
+
type: '',
|
|
57
|
+
config: {
|
|
58
|
+
label: '负责人',
|
|
59
|
+
width: 'auto',
|
|
60
|
+
align: 'center',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
const records = ref([
|
|
66
|
+
{
|
|
67
|
+
id: 'A',
|
|
68
|
+
name: '项目A',
|
|
69
|
+
status: '进行中',
|
|
70
|
+
updateTime: '2025-12-25 20:55:52',
|
|
71
|
+
owner: '张三',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'B',
|
|
75
|
+
name: '项目B',
|
|
76
|
+
status: '已完成',
|
|
77
|
+
updateTime: '2025-12-25 20:51:17',
|
|
78
|
+
owner: '李四',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'C',
|
|
82
|
+
name: '项目C',
|
|
83
|
+
status: '待审核',
|
|
84
|
+
updateTime: '2025-12-25 20:51:11',
|
|
85
|
+
owner: '王五',
|
|
86
|
+
},
|
|
87
|
+
])
|
|
88
|
+
|
|
89
|
+
const loadData = async () => {
|
|
90
|
+
return records.value
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const hiddenColumns = ref<string[]>(['status'])
|
|
94
|
+
|
|
95
|
+
const hide = (id: string) => {
|
|
96
|
+
if (!hiddenColumns.value.includes(id)) {
|
|
97
|
+
hiddenColumns.value.push(id)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const show = (id: string) => {
|
|
102
|
+
const index = hiddenColumns.value.indexOf(id)
|
|
103
|
+
if (index >= 0) {
|
|
104
|
+
hiddenColumns.value.splice(index, 1)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const reset = () => {
|
|
109
|
+
hiddenColumns.value.splice(0, hiddenColumns.value.length)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const hiddenColumnsLabel = computed(() => {
|
|
113
|
+
return hiddenColumns.value.length > 0 ? hiddenColumns.value.join('、') : '无'
|
|
114
|
+
})
|
|
115
|
+
</script>
|
|
116
|
+
|