@innertia-solutions/nuxt-theme-spark 0.1.38 → 0.1.39
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.
|
@@ -41,9 +41,9 @@ const showColumnPanel = ref(false)
|
|
|
41
41
|
const columnPanelRef = ref(null)
|
|
42
42
|
|
|
43
43
|
const orderedColumns = computed(() => {
|
|
44
|
-
if (!tableRef.value) return props.columns
|
|
45
|
-
const ids = tableRef.value.table.getAllLeafColumns().map(c => c.id)
|
|
46
|
-
return ids.map(id => props.columns.find(c => c.key === id)).filter(
|
|
44
|
+
if (!tableRef.value) return props.columns.filter(c => c.label)
|
|
45
|
+
const ids = tableRef.value.table.getAllLeafColumns().map(c => c.id).filter(id => id !== 'select')
|
|
46
|
+
return ids.map(id => props.columns.find(c => c.key === id)).filter(c => c?.label)
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
let draggedKey = null
|
|
@@ -60,6 +60,9 @@ const onDrop = (key) => {
|
|
|
60
60
|
if (from < 0 || to < 0) return
|
|
61
61
|
ids.splice(from, 1)
|
|
62
62
|
ids.splice(to, 0, draggedKey)
|
|
63
|
+
// keep 'select' pinned first
|
|
64
|
+
const selIdx = ids.indexOf('select')
|
|
65
|
+
if (selIdx > 0) { ids.splice(selIdx, 1); ids.unshift('select') }
|
|
63
66
|
tableRef.value?.setColumnOrder(ids)
|
|
64
67
|
draggedKey = null
|
|
65
68
|
dragOverKey.value = null
|
package/components/Table.vue
CHANGED
|
@@ -294,12 +294,16 @@ const onHeaderDragOver = (e, colId) => { e.preventDefault(); dragOverHeaderId.va
|
|
|
294
294
|
const onHeaderDragLeave = () => { dragOverHeaderId.value = null }
|
|
295
295
|
const onHeaderDrop = (colId) => {
|
|
296
296
|
if (!draggedHeaderId || draggedHeaderId === colId) return
|
|
297
|
+
if (colId === 'select') return
|
|
297
298
|
const order = [...columnOrder.value]
|
|
298
299
|
const from = order.indexOf(draggedHeaderId)
|
|
299
300
|
const to = order.indexOf(colId)
|
|
300
301
|
if (from < 0 || to < 0) return
|
|
301
302
|
order.splice(from, 1)
|
|
302
303
|
order.splice(to, 0, draggedHeaderId)
|
|
304
|
+
// keep 'select' pinned first
|
|
305
|
+
const selIdx = order.indexOf('select')
|
|
306
|
+
if (selIdx > 0) { order.splice(selIdx, 1); order.unshift('select') }
|
|
303
307
|
columnOrder.value = order
|
|
304
308
|
draggedHeaderId = null
|
|
305
309
|
dragOverHeaderId.value = null
|