@innertia-solutions/nuxt-theme-spark 0.1.38 → 0.1.40

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(Boolean)
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
@@ -232,7 +232,11 @@ const loadFromCacheOnMount = async () => {
232
232
  sorting.value = cached.sorting
233
233
  columnFilters.value = cached.columnFilters
234
234
  columnVisibility.value = cached.columnVisibility
235
- if (cached.columnOrder?.length) columnOrder.value = cached.columnOrder
235
+ if (cached.columnOrder?.length) {
236
+ const order = cached.columnOrder.filter(id => id !== 'select')
237
+ if (props.checkable) order.unshift('select')
238
+ columnOrder.value = order
239
+ }
236
240
  lastDataLength.value = cached.data.length
237
241
  isDataFromCache.value = true
238
242
 
@@ -294,12 +298,16 @@ const onHeaderDragOver = (e, colId) => { e.preventDefault(); dragOverHeaderId.va
294
298
  const onHeaderDragLeave = () => { dragOverHeaderId.value = null }
295
299
  const onHeaderDrop = (colId) => {
296
300
  if (!draggedHeaderId || draggedHeaderId === colId) return
301
+ if (colId === 'select') return
297
302
  const order = [...columnOrder.value]
298
303
  const from = order.indexOf(draggedHeaderId)
299
304
  const to = order.indexOf(colId)
300
305
  if (from < 0 || to < 0) return
301
306
  order.splice(from, 1)
302
307
  order.splice(to, 0, draggedHeaderId)
308
+ // keep 'select' pinned first
309
+ const selIdx = order.indexOf('select')
310
+ if (selIdx > 0) { order.splice(selIdx, 1); order.unshift('select') }
303
311
  columnOrder.value = order
304
312
  draggedHeaderId = null
305
313
  dragOverHeaderId.value = null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/nuxt-theme-spark",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "Innertia Solutions — Spark theme: backoffice, landing and mobile components and layouts",
5
5
  "keywords": [
6
6
  "nuxt",