@seed-ship/mcp-ui-solid 4.3.1 → 4.3.2

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.
@@ -345,6 +345,7 @@ function TableRenderer(props: {
345
345
  setSortDir('asc')
346
346
  }
347
347
  setClientPage(0)
348
+ setProgressivePages(1)
348
349
  }
349
350
 
350
351
  const sortedRows = createMemo(() => {
@@ -374,22 +375,36 @@ function TableRenderer(props: {
374
375
  return sortDir() === 'asc' ? '\u2191' : '\u2193'
375
376
  }
376
377
 
377
- // ─── Client-side pagination (v4.0.4) ─────────────────────
378
+ // ─── Client-side pagination (v4.0.4, progressive mode v4.3.2) ─────
378
379
  const clientPageSize = () => tableParams.pageSize ?? 25
379
380
  const hasServerPagination = () => !!tableParams.pagination
381
+ const isProgressiveMode = () => !!tableParams.showAllLabel
380
382
  const needsClientPagination = () =>
381
383
  !hasServerPagination() && clientPageSize() > 0 && sortedRows().length > clientPageSize()
382
384
  const [clientPage, setClientPage] = createSignal(tableParams.initialPage ?? 0)
385
+ // Progressive mode: track how many pages to show (append)
386
+ const [progressivePages, setProgressivePages] = createSignal(1)
383
387
  const clientTotalPages = () => needsClientPagination() ? Math.ceil(sortedRows().length / clientPageSize()) : 1
384
388
  const clientVisibleRows = createMemo(() => {
385
389
  if (!needsClientPagination()) return sortedRows()
390
+ if (isProgressiveMode()) {
391
+ // Progressive: show first N * pageSize rows
392
+ return sortedRows().slice(0, progressivePages() * clientPageSize())
393
+ }
386
394
  const start = clientPage() * clientPageSize()
387
395
  return sortedRows().slice(start, start + clientPageSize())
388
396
  })
389
- const clientRangeStart = () => needsClientPagination() ? clientPage() * clientPageSize() + 1 : 1
397
+ const clientRangeStart = () => needsClientPagination()
398
+ ? (isProgressiveMode() ? 1 : clientPage() * clientPageSize() + 1)
399
+ : 1
390
400
  const clientRangeEnd = () => needsClientPagination()
391
- ? Math.min((clientPage() + 1) * clientPageSize(), sortedRows().length)
401
+ ? (isProgressiveMode()
402
+ ? Math.min(progressivePages() * clientPageSize(), sortedRows().length)
403
+ : Math.min((clientPage() + 1) * clientPageSize(), sortedRows().length))
392
404
  : sortedRows().length
405
+ const progressiveHasMore = () => isProgressiveMode() && needsClientPagination() && progressivePages() < clientTotalPages()
406
+ const progressiveRemaining = () => sortedRows().length - progressivePages() * clientPageSize()
407
+ const showMoreLabel = () => tableParams.showAllLabel || 'Show more'
393
408
 
394
409
  // ─── Virtualization ──────────────────────────────────────
395
410
  const [virtualizer, setVirtualizer] = createSignal<any>(null)
@@ -685,8 +700,8 @@ function TableRenderer(props: {
685
700
  </div>
686
701
  </Show>
687
702
 
688
- {/* Client-side auto-pagination (v4.0.4) */}
689
- <Show when={needsClientPagination()}>
703
+ {/* Client-side paged pagination (v4.0.4) */}
704
+ <Show when={needsClientPagination() && !isProgressiveMode()}>
690
705
  <div class="mt-3 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400">
691
706
  <span>
692
707
  Showing {clientRangeStart()}&ndash;{clientRangeEnd()} of {allRows().length.toLocaleString('fr-FR')}
@@ -710,6 +725,23 @@ function TableRenderer(props: {
710
725
  </div>
711
726
  </div>
712
727
  </Show>
728
+
729
+ {/* Client-side progressive pagination (v4.3.2) */}
730
+ <Show when={needsClientPagination() && isProgressiveMode()}>
731
+ <div class="mt-3 flex flex-col items-center gap-2 text-xs text-gray-500 dark:text-gray-400">
732
+ <span>
733
+ {clientRangeStart()}&ndash;{clientRangeEnd()} of {allRows().length.toLocaleString('fr-FR')}
734
+ </span>
735
+ <Show when={progressiveHasMore()}>
736
+ <button
737
+ class="px-4 py-1.5 rounded-md bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 transition-colors"
738
+ onClick={() => setProgressivePages(p => p + 1)}
739
+ >
740
+ {showMoreLabel()} ({Math.min(progressiveRemaining(), clientPageSize())} suivant{Math.min(progressiveRemaining(), clientPageSize()) > 1 ? 'es' : 'e'})
741
+ </button>
742
+ </Show>
743
+ </div>
744
+ </Show>
713
745
  </div>
714
746
  </div>
715
747
  </ExpandableWrapper>