@a2simcode/ui 0.0.241 → 0.0.243
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/editors/j-comp-editor.d.ts +1 -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 +2616 -2586
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/docs/components/meta/table-panel.ts +7 -1
- package/docs/components/meta/table.ts +10 -4
- 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
|
@@ -12,6 +12,12 @@ export default {
|
|
|
12
12
|
"type": "SchemaConfig[]",
|
|
13
13
|
"default": "() => []"
|
|
14
14
|
},
|
|
15
|
+
{
|
|
16
|
+
"name": "columnFilter",
|
|
17
|
+
"description": "列过滤(用于隐藏列)",
|
|
18
|
+
"type": "string[]",
|
|
19
|
+
"default": "() => []"
|
|
20
|
+
},
|
|
15
21
|
{
|
|
16
22
|
"name": "searchList",
|
|
17
23
|
"description": "固定过滤条件",
|
|
@@ -145,7 +151,7 @@ export default {
|
|
|
145
151
|
{
|
|
146
152
|
"name": "actionFilter",
|
|
147
153
|
"description": "行内操作按钮过滤方法",
|
|
148
|
-
"type": "(params: {\n action: ButtonCompType\n record: Record<string, any>\n recordIndex: number\n col: number\n row: number\n table: any\n}) =>\n | boolean\n | {\n display?: boolean\n disabled?: boolean\n }\n | null\n | undefined",
|
|
154
|
+
"type": "(params: {\r\n action: ButtonCompType\r\n record: Record<string, any>\r\n recordIndex: number\r\n col: number\r\n row: number\r\n table: any\r\n}) =>\r\n | boolean\r\n | {\r\n display?: boolean\r\n disabled?: boolean\r\n }\r\n | null\r\n | undefined",
|
|
149
155
|
"default": "null"
|
|
150
156
|
},
|
|
151
157
|
{
|
|
@@ -18,6 +18,12 @@ export default {
|
|
|
18
18
|
"type": "ColumnSchemaConfig[]",
|
|
19
19
|
"default": "() => []"
|
|
20
20
|
},
|
|
21
|
+
{
|
|
22
|
+
"name": "columnFilter",
|
|
23
|
+
"description": "列过滤(用于隐藏列)",
|
|
24
|
+
"type": "string[]",
|
|
25
|
+
"default": "() => []"
|
|
26
|
+
},
|
|
21
27
|
{
|
|
22
28
|
"name": "records",
|
|
23
29
|
"description": "表格数据",
|
|
@@ -122,7 +128,7 @@ export default {
|
|
|
122
128
|
{
|
|
123
129
|
"name": "actionFilter",
|
|
124
130
|
"description": "行内操作按钮过滤方法",
|
|
125
|
-
"type": "(params: {\n action: ButtonCompType\n record: Record<string, any>\n recordIndex: number\n col: number\n row: number\n table: any\n}) =>\n | boolean\n | {\n display?: boolean\n disabled?: boolean\n }\n | null\n | undefined",
|
|
131
|
+
"type": "(params: {\r\n action: ButtonCompType\r\n record: Record<string, any>\r\n recordIndex: number\r\n col: number\r\n row: number\r\n table: any\r\n}) =>\r\n | boolean\r\n | {\r\n display?: boolean\r\n disabled?: boolean\r\n }\r\n | null\r\n | undefined",
|
|
126
132
|
"default": "null"
|
|
127
133
|
},
|
|
128
134
|
{
|
|
@@ -207,7 +213,7 @@ export default {
|
|
|
207
213
|
{
|
|
208
214
|
"name": "selectionChanged",
|
|
209
215
|
"description": "选中数据变化时触发",
|
|
210
|
-
"type": "{\n isMultiple: boolean\n selections: Record<string, any>[]\n record: Record<string, any>\n checked: boolean\n}"
|
|
216
|
+
"type": "{\r\n isMultiple: boolean\r\n selections: Record<string, any>[]\r\n record: Record<string, any>\r\n checked: boolean\r\n}"
|
|
211
217
|
},
|
|
212
218
|
{
|
|
213
219
|
"name": "selectRecordsChanged",
|
|
@@ -242,7 +248,7 @@ export default {
|
|
|
242
248
|
{
|
|
243
249
|
"name": "change",
|
|
244
250
|
"description": "变更事件",
|
|
245
|
-
"type": "{\n id: string\n value: any\n data: any\n formData: Record<string, any>\n tableData: Record<string, any>[]\n type: 'add' | 'delete' | 'update' | 'sort'\n}"
|
|
251
|
+
"type": "{\r\n id: string\r\n value: any\r\n data: any\r\n formData: Record<string, any>\r\n tableData: Record<string, any>[]\r\n type: 'add' | 'delete' | 'update' | 'sort'\r\n}"
|
|
246
252
|
}
|
|
247
253
|
],
|
|
248
254
|
"slots": [],
|
|
@@ -389,7 +395,7 @@ export default {
|
|
|
389
395
|
},
|
|
390
396
|
{
|
|
391
397
|
"name": "config",
|
|
392
|
-
"type": "TableColumnCompConfig & {\n /**\n * @zh 列的标题\n */\n label: string\n }",
|
|
398
|
+
"type": "TableColumnCompConfig & {\r\n /**\r\n * @zh 列的标题\r\n */\r\n label: string\r\n }",
|
|
393
399
|
"description": "列配置"
|
|
394
400
|
},
|
|
395
401
|
{
|
|
@@ -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
|
+
|