Skip to content

Commit 4c6dd4d

Browse files
committed
test: placeholder-card.spec.ts
test: placeholder-table.spec.ts refactor: use PlaceholderAnimation external type in Placeholder comps refactor: use PlaceholderSize external type in Placeholder comps feat(BPlaceholderTable): slot thead to overwrite default thead feat(BPlaceholderTable): slot tfoot to overwrite default tfoot feat(BPlaceholderTable): bplaceholder thead attrs are separated feat(BPlaceholderTable): bplaceholder tfoot attrs are separated fix(BPlaceholderCard): remove unnecessary inner div on body refactor(BPlaceholderCard): use external PlaceholderAnimation type refactor(BPlaceholderCard): use external PlaceholderSize type refactor(BPlaceholder): use external PlaceholderAnimation type refactor(BPlaceholder): use external PlaceholderSize type
1 parent 041156d commit 4c6dd4d

File tree

8 files changed

+1244
-53
lines changed

8 files changed

+1244
-53
lines changed

packages/bootstrap-vue-3/src/components/BPlaceholder/BPlaceholder.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
<script setup lang="ts">
66
import {computed, StyleValue} from 'vue'
7-
import {ColorVariant} from '../../types'
7+
import {ColorVariant, PlaceholderAnimation, PlaceholderSize} from '../../types'
88
99
interface Props {
1010
tag?: string
1111
width?: string | number
1212
cols?: string | number
1313
variant?: ColorVariant
14-
size?: 'xs' | 'sm' | 'lg'
15-
animation?: 'glow' | 'wave'
14+
size?: PlaceholderSize
15+
animation?: PlaceholderAnimation
1616
}
1717
1818
const props = withDefaults(defineProps<Props>(), {

packages/bootstrap-vue-3/src/components/BPlaceholder/BPlaceholderCard.vue

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
</slot>
1313
</template>
1414
<slot>
15-
<div>
16-
<b-placeholder cols="7" />
17-
<b-placeholder cols="4" />
18-
<b-placeholder cols="4" />
19-
<b-placeholder cols="6" />
20-
<b-placeholder cols="8" />
21-
</div>
15+
<b-placeholder cols="7" />
16+
<b-placeholder cols="4" />
17+
<b-placeholder cols="4" />
18+
<b-placeholder cols="6" />
19+
<b-placeholder cols="8" />
2220
</slot>
2321
<template v-if="!noFooterBoolean" #footer>
2422
<slot name="footer">
@@ -32,23 +30,23 @@
3230
import BCard from '../BCard/BCard.vue'
3331
import BCardImg from '../BCard/BCardImg.vue'
3432
import BPlaceholder from './BPlaceholder.vue'
35-
import {Booleanish, ColorVariant} from '../../types'
33+
import {Booleanish, ColorVariant, PlaceholderAnimation, PlaceholderSize} from '../../types'
3634
import {computed, toRef} from 'vue'
3735
import {useBooleanish} from '../../composables'
3836
3937
interface Props {
4038
noHeader?: Booleanish
4139
headerWidth?: string | number
4240
headerVariant?: ColorVariant
43-
headerAnimation?: 'glow' | 'wave'
44-
headerSize?: 'xs' | 'sm' | 'lg'
41+
headerAnimation?: PlaceholderAnimation
42+
headerSize?: PlaceholderSize
4543
noFooter?: Booleanish
4644
footerWidth?: string | number
4745
footerVariant?: ColorVariant
48-
footerAnimation?: 'glow' | 'wave'
49-
footerSize?: 'xs' | 'sm' | 'lg'
50-
animation?: 'glow' | 'wave'
51-
size?: 'xs' | 'sm' | 'lg'
46+
footerAnimation?: PlaceholderAnimation
47+
footerSize?: PlaceholderSize
48+
animation?: PlaceholderAnimation
49+
size?: PlaceholderSize
5250
variant?: ColorVariant
5351
noButton?: Booleanish
5452
imgBottom?: Booleanish

packages/bootstrap-vue-3/src/components/BPlaceholder/BPlaceholderTable.vue

Lines changed: 65 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,96 @@
11
<template>
2-
<b-table-simple v-bind="tableProps">
3-
<thead v-if="!hideHeaderBoolean">
4-
<tr>
5-
<th v-for="(_, i) in headerColumns ?? columns" :key="i">
6-
<b-placeholder v-bind="placeholderAttrs" :width="headerWidth" />
7-
</th>
8-
</tr>
9-
</thead>
10-
<tbody>
11-
<tr v-for="(_, j) in rows" :key="j">
12-
<td v-for="(__, k) in columns" :key="k">
13-
<b-placeholder v-bind="placeholderAttrs" :width="cellWidth" />
14-
</td>
15-
</tr>
16-
</tbody>
17-
<tfoot v-if="showFooterBoolean">
18-
<tr>
19-
<th v-for="(_, l) in footerColumns ?? columns" :key="l">
20-
<b-placeholder v-bind="placeholderAttrs" :width="footerWidth" />
21-
</th>
22-
</tr>
23-
</tfoot>
2+
<b-table-simple>
3+
<slot name="thead">
4+
<thead v-if="!hideHeaderBoolean">
5+
<tr>
6+
<th v-for="(_, i) in headerColumns ?? columns" :key="i">
7+
<b-placeholder v-bind="headerAttrs" />
8+
</th>
9+
</tr>
10+
</thead>
11+
</slot>
12+
<slot>
13+
<tbody>
14+
<tr v-for="(_, j) in rows" :key="j">
15+
<td v-for="(__, k) in columns" :key="k">
16+
<b-placeholder v-bind="placeholderAttrs" />
17+
</td>
18+
</tr>
19+
</tbody>
20+
</slot>
21+
<slot name="tfoot">
22+
<tfoot v-if="showFooterBoolean">
23+
<tr>
24+
<th v-for="(_, l) in footerColumns ?? columns" :key="l">
25+
<b-placeholder v-bind="footerAttrs" />
26+
</th>
27+
</tr>
28+
</tfoot>
29+
</slot>
2430
</b-table-simple>
2531
</template>
2632

2733
<script setup lang="ts">
2834
// import type {BSkeletonTableProps} from '../../types/components'
2935
import {computed, toRef} from 'vue'
30-
import type {Booleanish, ColorVariant} from '../../types'
36+
import type {Booleanish, ColorVariant, PlaceholderAnimation, PlaceholderSize} from '../../types'
3137
import {useBooleanish} from '../../composables'
3238
import BTableSimple from '../BTable/BTableSimple.vue'
3339
import BPlaceholder from './BPlaceholder.vue'
3440
3541
interface BSkeletonTableProps {
36-
animation?: 'wave' | 'glow'
37-
columns?: number
38-
hideHeader?: Booleanish
3942
rows?: number
40-
showFooter?: Booleanish
41-
variant?: ColorVariant
42-
size?: 'xs' | 'sm' | 'lg'
43-
tableProps?: Record<string, unknown>
44-
footerWidth?: string | number
45-
headerWidth?: string | number
43+
44+
columns?: number
4645
cellWidth?: string | number
46+
size?: PlaceholderSize
47+
animation?: PlaceholderAnimation
48+
variant?: ColorVariant
49+
4750
headerColumns?: number
51+
hideHeader?: Booleanish
52+
headerCellWidth?: string | number
53+
headerSize?: PlaceholderSize
54+
headerAnimation?: PlaceholderAnimation
55+
headerVariant?: ColorVariant
56+
4857
footerColumns?: number
58+
showFooter?: Booleanish
59+
footerCellWidth?: string | number
60+
footerSize?: PlaceholderSize
61+
footerAnimation?: PlaceholderAnimation
62+
footerVariant?: ColorVariant
4963
}
5064
5165
const props = withDefaults(defineProps<BSkeletonTableProps>(), {
5266
columns: 5,
53-
hideHeader: false,
5467
rows: 3,
55-
showFooter: false,
5668
cellWidth: 100,
57-
footerWidth: 100,
58-
headerWidth: 100,
69+
showFooter: false,
70+
footerCellWidth: 100,
71+
hideHeader: false,
72+
headerCellWidth: 100,
5973
})
6074
6175
const placeholderAttrs = computed(() => ({
6276
size: props.size,
6377
variant: props.variant,
6478
animation: props.animation,
79+
width: props.cellWidth,
80+
}))
81+
82+
const headerAttrs = computed(() => ({
83+
size: props.headerSize,
84+
variant: props.headerVariant,
85+
animation: props.headerAnimation,
86+
width: props.headerCellWidth,
87+
}))
88+
89+
const footerAttrs = computed(() => ({
90+
size: props.footerSize,
91+
variant: props.footerVariant,
92+
animation: props.footerAnimation,
93+
width: props.footerCellWidth,
6594
}))
6695
6796
const hideHeaderBoolean = useBooleanish(toRef(props, 'hideHeader'))

0 commit comments

Comments
 (0)