@a2simcode/ui 0.0.86 → 0.0.88
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/input-layer/index.d.ts +52 -2
- package/dist/components/input-layer/src/input-layer.vue.d.ts +52 -2
- package/dist/components/table-panel/index.d.ts +78 -3
- package/dist/components/table-panel/src/table-panel.vue.d.ts +76 -1
- package/dist/simcode-ui.es.js +2722 -2698
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/docs/components/meta/table-panel.ts +30 -0
- package/docs/components/table-panel.md +31 -28
- package/docs/examples/table-panel/button-visibility.vue +88 -0
- package/docs/examples/table-panel/get-selection.vue +111 -0
- package/package.json +1 -1
|
@@ -127,6 +127,36 @@ export default {
|
|
|
127
127
|
"description": "高亮模式 cross 十字 row 行 column 列 cell 单元格",
|
|
128
128
|
"type": "'cross' | 'row' | 'column' | 'cell'",
|
|
129
129
|
"default": "'row'"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "showFilterButton",
|
|
133
|
+
"description": "是否显示筛选按钮(包含右侧固定筛选面板)",
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"default": "true"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "showOrderButton",
|
|
139
|
+
"description": "是否显示排序按钮",
|
|
140
|
+
"type": "boolean",
|
|
141
|
+
"default": "true"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "showColumnButton",
|
|
145
|
+
"description": "是否显示列管理按钮",
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"default": "true"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "showRefreshButton",
|
|
151
|
+
"description": "是否显示刷新按钮",
|
|
152
|
+
"type": "boolean",
|
|
153
|
+
"default": "true"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "showFullscreenButton",
|
|
157
|
+
"description": "是否显示全屏按钮",
|
|
158
|
+
"type": "boolean",
|
|
159
|
+
"default": "true"
|
|
130
160
|
}
|
|
131
161
|
],
|
|
132
162
|
"events": [
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
</template>
|
|
60
60
|
</Demo>
|
|
61
61
|
|
|
62
|
-
|
|
63
62
|
## 多选功能
|
|
64
63
|
|
|
65
64
|
通过 `is-multiple` 属性开启多选功能。多选功能支持两种使用场景:
|
|
@@ -118,42 +117,42 @@
|
|
|
118
117
|
- 如果数据被刷新或重新加载,有批处理按钮时会清空选中状态,无批处理按钮时会尝试保留仍然存在的记录
|
|
119
118
|
|
|
120
119
|
3. **获取选中数据**:
|
|
121
|
-
|
|
122
|
-
<template>
|
|
123
|
-
|
|
120
|
+
<Demo :source-code="tablePanelGetSelectionCode">
|
|
121
|
+
<template #source>
|
|
122
|
+
<table-panel-get-selection />
|
|
123
|
+
</template>
|
|
124
|
+
<template #description>
|
|
125
|
+
通过 `@select` 监听选中变化;通过组件实例方法 `getSelection()` 获取选中数据,`clearSelection()` 清空选中。
|
|
124
126
|
</template>
|
|
125
|
-
|
|
126
|
-
import { ref } from 'vue'
|
|
127
|
-
|
|
128
|
-
const tablePanelRef = ref()
|
|
129
|
-
|
|
130
|
-
// 方式1: 通过事件监听
|
|
131
|
-
const handleSelect = (selectedRecords) => {
|
|
132
|
-
console.log('选中的记录:', selectedRecords)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// 方式2: 通过组件实例方法
|
|
136
|
-
const getSelected = () => {
|
|
137
|
-
const selected = tablePanelRef.value?.getSelection()
|
|
138
|
-
console.log('选中的记录:', selected)
|
|
139
|
-
}
|
|
140
|
-
</script>
|
|
141
|
-
```
|
|
127
|
+
</Demo>
|
|
142
128
|
|
|
143
129
|
4. **两种模式的区别**:
|
|
144
130
|
|
|
145
|
-
| 特性
|
|
146
|
-
|
|
147
|
-
| 工具栏按钮
|
|
148
|
-
| 查询设置按钮
|
|
149
|
-
| 选中状态保持
|
|
150
|
-
| 仅显示选中模式 | 支持
|
|
151
|
-
| 适用场景
|
|
131
|
+
| 特性 | 无批处理按钮 | 有批处理按钮 |
|
|
132
|
+
| -------------- | ---------------------------------------- | ------------------------ |
|
|
133
|
+
| 工具栏按钮 | 始终显示 | 选中后切换为选中控制按钮 |
|
|
134
|
+
| 查询设置按钮 | 选中后仍显示,进入"仅显示选中"模式后隐藏 | 选中后立即隐藏 |
|
|
135
|
+
| 选中状态保持 | 跨页保持,刷新后尝试保留 | 跨页保持,刷新后清空 |
|
|
136
|
+
| 仅显示选中模式 | 支持 | 支持 |
|
|
137
|
+
| 适用场景 | 需要获取选中数据,但操作在外部处理 | 需要批量操作功能 |
|
|
152
138
|
|
|
153
139
|
## 批量操作
|
|
154
140
|
|
|
155
141
|
批量操作是多选功能的一种扩展使用方式,详见上面的"多选功能"章节中的"带批处理按钮的多选"部分。
|
|
156
142
|
|
|
143
|
+
## 按钮显示控制
|
|
144
|
+
|
|
145
|
+
可以通过属性控制右上角功能按钮是否显示。
|
|
146
|
+
|
|
147
|
+
<Demo :source-code="tablePanelButtonVisibilityCode">
|
|
148
|
+
<template #source>
|
|
149
|
+
<table-panel-button-visibility />
|
|
150
|
+
</template>
|
|
151
|
+
<template #description>
|
|
152
|
+
通过 `showFilterButton / showOrderButton / showColumnButton / showRefreshButton / showFullscreenButton` 控制按钮显示。
|
|
153
|
+
</template>
|
|
154
|
+
</Demo>
|
|
155
|
+
|
|
157
156
|
## API
|
|
158
157
|
|
|
159
158
|
<ApiTable :data="tablePanelApi" componentName="table-panel" />
|
|
@@ -207,6 +206,8 @@ import TablePanelPagination from '../examples/table-panel/pagination.vue'
|
|
|
207
206
|
import TablePanelMultipleSelection from '../examples/table-panel/multiple-selection.vue'
|
|
208
207
|
import TablePanelBatchOperations from '../examples/table-panel/batch-operations.vue'
|
|
209
208
|
import TablePanelSubTableLazy from '../examples/table-panel/sub-table-lazy.vue'
|
|
209
|
+
import TablePanelGetSelection from '../examples/table-panel/get-selection.vue'
|
|
210
|
+
import TablePanelButtonVisibility from '../examples/table-panel/button-visibility.vue'
|
|
210
211
|
import tablePanelApi from './meta/table-panel'
|
|
211
212
|
|
|
212
213
|
import tablePanelBasicCode from '../examples/table-panel/basic.vue?raw'
|
|
@@ -215,4 +216,6 @@ import tablePanelPaginationCode from '../examples/table-panel/pagination.vue?raw
|
|
|
215
216
|
import tablePanelMultipleSelectionCode from '../examples/table-panel/multiple-selection.vue?raw'
|
|
216
217
|
import tablePanelBatchOperationsCode from '../examples/table-panel/batch-operations.vue?raw'
|
|
217
218
|
import tablePanelSubTableLazyCode from '../examples/table-panel/sub-table-lazy.vue?raw'
|
|
219
|
+
import tablePanelGetSelectionCode from '../examples/table-panel/get-selection.vue?raw'
|
|
220
|
+
import tablePanelButtonVisibilityCode from '../examples/table-panel/button-visibility.vue?raw'
|
|
218
221
|
</script>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="position: relative; width: 100%; height: 620px">
|
|
3
|
+
<div style="margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px">
|
|
4
|
+
<label style="display: flex; align-items: center; gap: 6px">
|
|
5
|
+
<input v-model="showFilterButton" type="checkbox" />
|
|
6
|
+
筛选
|
|
7
|
+
</label>
|
|
8
|
+
<label style="display: flex; align-items: center; gap: 6px">
|
|
9
|
+
<input v-model="showOrderButton" type="checkbox" />
|
|
10
|
+
排序
|
|
11
|
+
</label>
|
|
12
|
+
<label style="display: flex; align-items: center; gap: 6px">
|
|
13
|
+
<input v-model="showColumnButton" type="checkbox" />
|
|
14
|
+
列管理
|
|
15
|
+
</label>
|
|
16
|
+
<label style="display: flex; align-items: center; gap: 6px">
|
|
17
|
+
<input v-model="showRefreshButton" type="checkbox" />
|
|
18
|
+
刷新
|
|
19
|
+
</label>
|
|
20
|
+
<label style="display: flex; align-items: center; gap: 6px">
|
|
21
|
+
<input v-model="showFullscreenButton" type="checkbox" />
|
|
22
|
+
全屏
|
|
23
|
+
</label>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<j-table-panel
|
|
27
|
+
row-key="orderId"
|
|
28
|
+
:columns="columns"
|
|
29
|
+
:load-data="loadData"
|
|
30
|
+
:show-filter-button="showFilterButton"
|
|
31
|
+
:show-order-button="showOrderButton"
|
|
32
|
+
:show-column-button="showColumnButton"
|
|
33
|
+
:show-refresh-button="showRefreshButton"
|
|
34
|
+
:show-fullscreen-button="showFullscreenButton"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import { ref } from 'vue'
|
|
41
|
+
|
|
42
|
+
const showFilterButton = ref(true)
|
|
43
|
+
const showOrderButton = ref(true)
|
|
44
|
+
const showColumnButton = ref(true)
|
|
45
|
+
const showRefreshButton = ref(true)
|
|
46
|
+
const showFullscreenButton = ref(true)
|
|
47
|
+
|
|
48
|
+
const columns = ref([
|
|
49
|
+
{
|
|
50
|
+
id: 'orderId',
|
|
51
|
+
type: '',
|
|
52
|
+
config: {
|
|
53
|
+
label: '订单号',
|
|
54
|
+
width: 150,
|
|
55
|
+
filter: { isSearchKeyword: true },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'customerId',
|
|
60
|
+
type: '',
|
|
61
|
+
config: {
|
|
62
|
+
label: '客户编号',
|
|
63
|
+
width: 120,
|
|
64
|
+
filter: { isSearchKeyword: true },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'productName',
|
|
69
|
+
type: '',
|
|
70
|
+
config: {
|
|
71
|
+
label: '产品名称',
|
|
72
|
+
filter: { isSearchKeyword: true },
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
const mockData = [
|
|
78
|
+
{ orderId: 'CA-2016-152156', customerId: 'CG-12520', productName: 'Canon ImageCLASS 2200' },
|
|
79
|
+
{ orderId: 'CA-2017-152157', customerId: 'DV-13045', productName: 'Logitech Mouse' },
|
|
80
|
+
{ orderId: 'US-2017-108966', customerId: 'SO-20335', productName: 'HON Mesh Task Chair' },
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
const loadData = async () => {
|
|
84
|
+
return new Promise((resolve) => {
|
|
85
|
+
setTimeout(() => resolve(mockData), 200)
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="position: relative; width: 100%; height: 560px">
|
|
3
|
+
<div style="margin-bottom: 8px; display: flex; gap: 8px; align-items: center">
|
|
4
|
+
<j-button type="primary" label="获取选中" @click="handleGetSelection" />
|
|
5
|
+
<j-button type="text" label="清空选中" @click="handleClearSelection" />
|
|
6
|
+
<div style="font-size: 12px; color: var(--j-color-text-tertiary)">
|
|
7
|
+
当前选中:{{ selectedRecords.length }} 条
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<j-table-panel
|
|
12
|
+
ref="tablePanelRef"
|
|
13
|
+
row-key="orderId"
|
|
14
|
+
:columns="columns"
|
|
15
|
+
:load-data="loadData"
|
|
16
|
+
is-multiple
|
|
17
|
+
@select="handleSelect"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { ref } from 'vue'
|
|
24
|
+
import { ElMessage } from 'element-plus'
|
|
25
|
+
|
|
26
|
+
const tablePanelRef = ref<any>()
|
|
27
|
+
const selectedRecords = ref<Record<string, any>[]>([])
|
|
28
|
+
|
|
29
|
+
const columns = ref([
|
|
30
|
+
{
|
|
31
|
+
id: 'orderId',
|
|
32
|
+
type: '',
|
|
33
|
+
config: {
|
|
34
|
+
label: '订单号',
|
|
35
|
+
width: 150,
|
|
36
|
+
filter: { isSearchKeyword: true },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'customerId',
|
|
41
|
+
type: '',
|
|
42
|
+
config: {
|
|
43
|
+
label: '客户编号',
|
|
44
|
+
width: 120,
|
|
45
|
+
filter: { isSearchKeyword: true },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'productName',
|
|
50
|
+
type: '',
|
|
51
|
+
config: {
|
|
52
|
+
label: '产品名称',
|
|
53
|
+
filter: { isSearchKeyword: true },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'category',
|
|
58
|
+
type: '',
|
|
59
|
+
config: {
|
|
60
|
+
label: '类别',
|
|
61
|
+
width: 120,
|
|
62
|
+
dataType: 'options',
|
|
63
|
+
options: [
|
|
64
|
+
{ label: '办公用品', value: '办公用品' },
|
|
65
|
+
{ label: '科技产品', value: '科技产品' },
|
|
66
|
+
{ label: '家具', value: '家具' },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
const mockData = [
|
|
73
|
+
{
|
|
74
|
+
orderId: 'CA-2016-152156',
|
|
75
|
+
customerId: 'CG-12520',
|
|
76
|
+
productName: 'Canon ImageCLASS 2200 Advanced Copier',
|
|
77
|
+
category: '办公用品',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
orderId: 'CA-2017-152157',
|
|
81
|
+
customerId: 'DV-13045',
|
|
82
|
+
productName: 'Logitech Wireless Mouse',
|
|
83
|
+
category: '科技产品',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
orderId: 'US-2017-108966',
|
|
87
|
+
customerId: 'SO-20335',
|
|
88
|
+
productName: 'HON Mesh Task Chair',
|
|
89
|
+
category: '家具',
|
|
90
|
+
},
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
const loadData = async () => {
|
|
94
|
+
return new Promise((resolve) => {
|
|
95
|
+
setTimeout(() => resolve(mockData), 200)
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const handleSelect = (records: Record<string, any>[]) => {
|
|
100
|
+
selectedRecords.value = records || []
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const handleGetSelection = () => {
|
|
104
|
+
const selection = tablePanelRef.value?.getSelection?.() || []
|
|
105
|
+
ElMessage.info(`当前选中 ${selection.length} 条`)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const handleClearSelection = () => {
|
|
109
|
+
tablePanelRef.value?.clearSelection?.()
|
|
110
|
+
}
|
|
111
|
+
</script>
|