9898 v-bind =" field.tdAttr"
9999 :class =" getFieldRowClasses(field, item)"
100100 >
101+ <label v-if =" stacked && labelStackedBoolean" class =" b-table-stacked-label" >{{
102+ getFieldHeadLabel(field)
103+ }}</label >
101104 <slot
102105 v-if =" $slots['cell(' + field.key + ')'] || $slots['cell()']"
103106 :name =" $slots['cell(' + field.key + ')'] ? 'cell(' + field.key + ')' : 'cell()'"
@@ -222,6 +225,8 @@ interface BTableProps {
222225 responsive? : boolean | ' sm' | ' md' | ' lg' | ' xl' | ' xxl'
223226 small? : Booleanish
224227 striped? : Booleanish
228+ stacked? : boolean | ' sm' | ' md' | ' lg' | ' xl' | ' xxl' // boolean | Breakpoint
229+ labelStacked? : boolean
225230 variant? : ColorVariant
226231 sortBy? : string
227232 sortDesc? : Booleanish
@@ -254,6 +259,8 @@ const props = withDefaults(defineProps<BTableProps>(), {
254259 responsive: false ,
255260 small: false ,
256261 striped: false ,
262+ labelStacked: false ,
263+ stacked: false ,
257264 sortDesc: false ,
258265 sortInternal: true ,
259266 selectable: false ,
@@ -312,11 +319,12 @@ const sortDescBoolean = useBooleanish(toRef(props, 'sortDesc'))
312319const sortInternalBoolean = useBooleanish (toRef (props , ' sortInternal' ))
313320const selectableBoolean = useBooleanish (toRef (props , ' selectable' ))
314321const stickySelectBoolean = useBooleanish (toRef (props , ' stickySelect' ))
322+ const labelStackedBoolean = useBooleanish (toRef (props , ' labelStacked' ))
315323const busyBoolean = useBooleanish (toRef (props , ' busy' ))
316324const showEmptyBoolean = useBooleanish (toRef (props , ' showEmpty' ))
317- const noProviderPagingBoolean = useBooleanish (toRef (props , ' showEmpty ' ))
318- const noProviderSortingBoolean = useBooleanish (toRef (props , ' showEmpty ' ))
319- const noProviderFilteringBoolean = useBooleanish (toRef (props , ' showEmpty ' ))
325+ const noProviderPagingBoolean = useBooleanish (toRef (props , ' noProviderPaging ' ))
326+ const noProviderSortingBoolean = useBooleanish (toRef (props , ' noProviderSorting ' ))
327+ const noProviderFilteringBoolean = useBooleanish (toRef (props , ' noProviderFiltering ' ))
320328
321329const internalBusyFlag = ref (busyBoolean .value )
322330itemHelper .filterEvent .value = async (items ) => {
@@ -351,6 +359,7 @@ const containerAttrs = computed(() => ({
351359 hover: props .hover ,
352360 responsive: props .responsive ,
353361 striped: props .striped ,
362+ stacked: props .stacked ,
354363 small: props .small ,
355364 tableClass: tableClasses .value ,
356365 tableVariant: props .variant ,
@@ -376,14 +385,21 @@ const isSortable = computed(
376385
377386const requireItemsMapping = computed (() => isSortable .value && sortInternalBoolean .value === true )
378387const computedItems = computed (() => {
379- if (usesProvider .value ) return itemHelper .internalItems .value
380- return requireItemsMapping .value
388+ const items = usesProvider .value
389+ ? itemHelper .internalItems .value
390+ : requireItemsMapping .value
381391 ? itemHelper .mapItems (props .fields , props .items , props , {
382392 isSortable ,
383393 isFilterableTable ,
384394 sortDescBoolean ,
385395 })
386396 : props .items
397+
398+ if (props .perPage !== undefined ) {
399+ const startIndex = (props .currentPage - 1 ) * props .perPage
400+ return items .splice (startIndex , props .perPage )
401+ }
402+ return items
387403})
388404
389405const getFieldHeadLabel = (field : TableField ) => {
@@ -589,6 +605,7 @@ const providerPropsWatch = async (prop: string, val: any, oldVal: any) => {
589605
590606 // stop provide when paging
591607 const inNoProvider = (key : NoProviderTypes ) => props .noProvider && props .noProvider .includes (key )
608+ const notifyFiltered = ! [' currentPage' , ' perPage' ].includes (prop )
592609 const noProvideWhenPaging =
593610 [' currentPage' , ' perPage' ].includes (prop ) &&
594611 (inNoProvider (' paging' ) || noProviderPagingBoolean .value === true )
@@ -604,6 +621,8 @@ const providerPropsWatch = async (prop: string, val: any, oldVal: any) => {
604621 }
605622
606623 await callItemsProvider ()
624+
625+ if (notifyFiltered ) itemHelper .notifyFilteredItems ()
607626}
608627
609628watch (
0 commit comments