@bjj/nuxt-layer-shadcn-ui 0.11.10 → 0.11.12

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.
@@ -164,6 +164,12 @@ export const PageScroll: Story = {
164
164
  args: { height: undefined },
165
165
  }
166
166
 
167
+ /** `autoFetch=false` keeps the table idle on mount — click the refresh button in the footer (or call `refresh()` via the exposed ref) to load the first page. */
168
+ export const NoAutoFetch: Story = {
169
+ parameters: noControls,
170
+ args: { autoFetch: false },
171
+ }
172
+
167
173
  /** First page loads, but every subsequent `loadMore` call rejects — the bottom loader is replaced by a retry prompt. */
168
174
  export const Errored: Story = {
169
175
  parameters: {
@@ -34,6 +34,9 @@ const hasMore = ref(true)
34
34
  const errored = ref(false)
35
35
  const total = ref<number | undefined>(undefined)
36
36
  const requestVersion = ref(0)
37
+ // Tracks whether a fetch has ever been initiated. Gates the IntersectionChecker
38
+ // so `autoFetch=false` doesn't get bypassed by the observer firing on mount.
39
+ const started = ref(false)
37
40
 
38
41
  const sortState = ref<{ sortBy: string | null, sortOrder: number | null }>({
39
42
  sortBy: props.filters?.sortBy ? String(props.filters.sortBy) : null,
@@ -42,6 +45,16 @@ const sortState = ref<{ sortBy: string | null, sortOrder: number | null }>({
42
45
 
43
46
  const isInitialLoad = computed(() => loading.value && internalData.value.length === 0)
44
47
 
48
+ // Precise gate for the bodyEnd slot. Without this, the slot's outer v-if can
49
+ // be true while every inner branch is false, leaving Vue to register an empty
50
+ // slot — DataTable's `$slots.bodyEnd` check then renders a blank trailing row.
51
+ const showBodyEnd = computed(() => {
52
+ if (isInitialLoad.value) return false
53
+ if (errored.value) return true
54
+ if (!hasMore.value) return internalData.value.length > 0
55
+ return started.value
56
+ })
57
+
45
58
  // -- IntersectionObserver root: only when internal scroll is active --
46
59
 
47
60
  const dataTableRef = ref<{ scrollEl?: HTMLElement } | null>(null)
@@ -101,6 +114,7 @@ function resetState () {
101
114
  async function loadMore () {
102
115
  if (loading.value || !hasMore.value) return
103
116
 
117
+ started.value = true
104
118
  // Calling loadMore is the retry path; the IntersectionChecker is hidden
105
119
  // while errored, so it can't trigger this branch on its own.
106
120
  errored.value = false
@@ -213,7 +227,7 @@ onMounted(() => {
213
227
  </template>
214
228
 
215
229
  <template
216
- v-if="!isInitialLoad && (hasMore || internalData.length > 0)"
230
+ v-if="showBodyEnd"
217
231
  #bodyEnd
218
232
  >
219
233
  <div
@@ -238,7 +252,7 @@ onMounted(() => {
238
252
  </Button>
239
253
  </div>
240
254
  <EffectIntersectionChecker
241
- v-else-if="!isInitialLoad"
255
+ v-else-if="started"
242
256
  :disabled="loading"
243
257
  :options="intersectionOptions"
244
258
  class="flex items-center justify-center"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjj/nuxt-layer-shadcn-ui",
3
- "version": "0.11.10",
3
+ "version": "0.11.12",
4
4
  "description": "Nuxt layer providing shadcn-vue based UI components",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -42,5 +42,5 @@
42
42
  "vue-i18n": "^11",
43
43
  "vue-router": "^4 || ^5"
44
44
  },
45
- "gitHead": "a4211b0981d194c33509a377b05ee3901783ee91"
45
+ "gitHead": "19b43efa4c4d0eea452d05559a5ef5f973958938"
46
46
  }