@innertia-solutions/nuxt-theme-spark 0.1.43 → 0.1.45

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.
@@ -37,7 +37,7 @@ const isDataFromCache = ref(false)
37
37
  const lastDataLength = ref(10)
38
38
  const lastRowHeight = ref(48)
39
39
  const tableBodyRef = ref(null)
40
- const skeletonRows = computed(() => Array.from({ length: lastDataLength.value }))
40
+ const skeletonRows = computed(() => Array.from({ length: Math.max(lastDataLength.value, pagination.value.pageSize) }))
41
41
  const isGridView = computed(() => props.viewMode === 'grid')
42
42
 
43
43
  // ─── TanStack state ───────────────────────────────────────────────────────────
@@ -141,10 +141,6 @@ const buildRequestParams = () => {
141
141
  const fetchData = async () => {
142
142
  if (tableData.value.length > 0) {
143
143
  lastDataLength.value = tableData.value.length
144
- if (tableBodyRef.value?.children[0]) {
145
- const h = tableBodyRef.value.children[0].getBoundingClientRect().height
146
- if (h > 0) lastRowHeight.value = h
147
- }
148
144
  }
149
145
 
150
146
  tableData.value = []
@@ -248,6 +244,17 @@ const loadFromCacheOnMount = async () => {
248
244
  }
249
245
 
250
246
  // ─── Watchers ─────────────────────────────────────────────────────────────────
247
+ watch(tableData, (newData) => {
248
+ if (newData.length > 0 && tableBodyRef.value) {
249
+ const firstDataRow = Array.from(tableBodyRef.value.children).find(el => el.dataset.rowType === 'data')
250
+ if (firstDataRow) {
251
+ const h = firstDataRow.getBoundingClientRect().height
252
+ if (h > 0) lastRowHeight.value = h
253
+ lastDataLength.value = newData.length
254
+ }
255
+ }
256
+ }, { flush: 'post' })
257
+
251
258
  watch(pagination, () => { if (!isRestoring.value) scheduleFetch(0) }, { deep: true })
252
259
  watch(sorting, () => { if (!isRestoring.value) scheduleFetch(0) }, { deep: true })
253
260
  watch(columnFilters, () => { if (!isRestoring.value) scheduleFetch(300) }, { deep: true })
@@ -569,6 +576,7 @@ defineExpose({
569
576
  v-else
570
577
  v-for="row in table.getRowModel().rows"
571
578
  :key="row.id"
579
+ data-row-type="data"
572
580
  @click="(e) => handleRowClick(row, e)"
573
581
  @keydown="(e) => handleRowKeydown(row, e)"
574
582
  :tabindex="isRowClickEnabled ? 0 : undefined"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/nuxt-theme-spark",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "Innertia Solutions — Spark theme: backoffice, landing and mobile components and layouts",
5
5
  "keywords": [
6
6
  "nuxt",