verce-vue-test 0.0.1 → 0.0.2
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
CHANGED
|
@@ -91,6 +91,7 @@ type ColumnOption = {
|
|
|
91
91
|
key: string // 列唯一标识
|
|
92
92
|
label: string // 列显示名称
|
|
93
93
|
visible: boolean // 是否可见
|
|
94
|
+
disabled: boolean // 是否禁用选择
|
|
94
95
|
vnode: VNode // 列的 VNode 节点
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -144,10 +145,15 @@ const currentPageSize = computed({
|
|
|
144
145
|
|
|
145
146
|
// 是否全选(弹窗中的临时状态)
|
|
146
147
|
const isAllSelected = computed({
|
|
147
|
-
get: () =>
|
|
148
|
+
get: () => {
|
|
149
|
+
const selectable = pendingColumnOptions.value.filter(col => !col.disabled)
|
|
150
|
+
return selectable.length > 0 && selectable.every(col => col.visible)
|
|
151
|
+
},
|
|
148
152
|
set: value => {
|
|
149
153
|
pendingColumnOptions.value.forEach(col => {
|
|
150
|
-
col.
|
|
154
|
+
if (!col.disabled) {
|
|
155
|
+
col.visible = value
|
|
156
|
+
}
|
|
151
157
|
})
|
|
152
158
|
},
|
|
153
159
|
})
|
|
@@ -211,6 +217,7 @@ const restoreColumnConfig = () => {
|
|
|
211
217
|
|
|
212
218
|
// 遍历列选项,更新可见性状态
|
|
213
219
|
columnOptions.value.forEach(column => {
|
|
220
|
+
if (column.disabled) return
|
|
214
221
|
const match = cacheColumns.find(item => item.key === column.key)
|
|
215
222
|
if (match) {
|
|
216
223
|
column.visible = match.visible
|
|
@@ -289,10 +296,12 @@ const initColumns = () => {
|
|
|
289
296
|
const children = flattenVNodes(rawChildren)
|
|
290
297
|
|
|
291
298
|
columnOptions.value = children.map((vnode, index) => {
|
|
299
|
+
const columnProps = vnode.props as Record<string, any> | null
|
|
292
300
|
return {
|
|
293
301
|
key: getColumnKey(vnode, index),
|
|
294
302
|
label: getColumnLabel(vnode, index),
|
|
295
303
|
visible: true,
|
|
304
|
+
disabled: columnProps?.disabled ?? false,
|
|
296
305
|
vnode,
|
|
297
306
|
}
|
|
298
307
|
})
|
|
@@ -399,6 +408,7 @@ initColumns()
|
|
|
399
408
|
>
|
|
400
409
|
<el-checkbox
|
|
401
410
|
v-model="column.visible"
|
|
411
|
+
:disabled="column.disabled"
|
|
402
412
|
>
|
|
403
413
|
{{ column.label }}
|
|
404
414
|
</el-checkbox>
|