@innertia-solutions/nuxt-theme-spark 0.1.66 → 0.1.68

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.
@@ -46,17 +46,11 @@ const mergedParams = computed(() => ({
46
46
  const previewRow = ref(null)
47
47
  const currentRatio = ref(props.splitRatio)
48
48
  const containerRef = ref(null)
49
- const hasPreviewSlot = computed(() => !!slots.preview)
50
- const showPreview = computed(() => !!previewRow.value && hasPreviewSlot.value)
51
-
52
49
  const closePreview = () => { previewRow.value = null }
53
50
 
54
51
  const handleRowClick = (row) => {
55
- if (hasPreviewSlot.value) {
56
- previewRow.value = previewRow.value?.id === row.id ? null : row
57
- } else {
58
- emit('row-click', row)
59
- }
52
+ previewRow.value = previewRow.value?.id === row.id ? null : row
53
+ if (!slots.preview) emit('row-click', row)
60
54
  }
61
55
 
62
56
  const startResize = (e) => {
@@ -132,12 +126,12 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef })
132
126
 
133
127
  <template>
134
128
  <div class="relative" ref="containerRef">
135
- <div :class="showPreview ? 'flex items-stretch gap-3' : ''">
129
+ <div :class="previewRow && $slots.preview ? 'flex items-stretch gap-3' : ''">
136
130
 
137
131
  <!-- Card -->
138
132
  <div
139
133
  class="relative bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-2xl shadow-sm overflow-hidden"
140
- :style="showPreview ? { width: currentRatio + '%', minWidth: 0, flexShrink: 0 } : {}"
134
+ :style="previewRow && $slots.preview ? { width: currentRatio + '%', minWidth: 0, flexShrink: 0 } : {}"
141
135
  >
142
136
  <!-- Toolbar -->
143
137
  <div class="flex flex-wrap items-center gap-3 px-4 py-3 border-b border-slate-200 dark:border-slate-700">
@@ -227,6 +221,7 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef })
227
221
  :show-reload-button="showReloadButton"
228
222
  :click-row-to-open="clickRowToOpen"
229
223
  :preview-row-id="previewRow?.id ?? null"
224
+ :preview-mode="!!$slots.preview"
230
225
  @row-click="handleRowClick"
231
226
  @loaded="emit('loaded', $event)"
232
227
  >
@@ -238,7 +233,7 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef })
238
233
 
239
234
  <!-- Resize handle -->
240
235
  <div
241
- v-if="showPreview"
236
+ v-if="previewRow && $slots.preview"
242
237
  class="w-3 flex items-center justify-center cursor-col-resize shrink-0 group"
243
238
  @mousedown="startResize"
244
239
  >
@@ -255,7 +250,7 @@ defineExpose({ getSelectedRows, reload, clearCache, exportTable, tableRef })
255
250
  leave-to-class="opacity-0 translate-x-4"
256
251
  >
257
252
  <div
258
- v-if="showPreview"
253
+ v-if="previewRow && $slots.preview"
259
254
  class="bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-2xl shadow-sm overflow-hidden flex flex-col"
260
255
  :style="{ width: (100 - currentRatio) + '%', minWidth: 0, flexShrink: 0 }"
261
256
  >
@@ -21,6 +21,7 @@ const props = defineProps({
21
21
  gridClass: { type: String, default: 'grid grid-cols-2 lg:grid-cols-3 gap-4' },
22
22
  clickRowToOpen: { type: Boolean, default: false },
23
23
  previewRowId: { type: [String, Number], default: null },
24
+ previewMode: { type: Boolean, default: false },
24
25
  })
25
26
 
26
27
  const emit = defineEmits(['update:search', 'row-click', 'loaded'])
@@ -420,7 +421,7 @@ const resetPerPage = () => {
420
421
 
421
422
  // ─── Row click ────────────────────────────────────────────────────────────────
422
423
  const hasRowClickListener = computed(() => !!instance?.vnode?.props?.onRowClick)
423
- const isRowClickEnabled = computed(() => props.clickRowToOpen || hasRowClickListener.value)
424
+ const isRowClickEnabled = computed(() => props.clickRowToOpen || props.previewMode || hasRowClickListener.value)
424
425
 
425
426
  const interactiveSelector = [
426
427
  'a', 'button', 'input', 'select', 'textarea', 'label', 'summary',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/nuxt-theme-spark",
3
- "version": "0.1.66",
3
+ "version": "0.1.68",
4
4
  "description": "Innertia Solutions — Spark theme: backoffice, landing and mobile components and layouts",
5
5
  "keywords": [
6
6
  "nuxt",