@@ -45,21 +45,10 @@ export const BTd = /*#__PURE__*/ Vue.extend({
4545 mixins : [ normalizeSlotMixin ] ,
4646 inheritAttrs : false ,
4747 inject : {
48- // Injections for feature / attribute detection
49- bvTable : {
50- default : null
51- } ,
52- bvTableTbody : {
53- default : null
54- } ,
55- bvTableThead : {
56- default : null
57- } ,
58- bvTableTfoot : {
59- default : null
60- } ,
6148 bvTableTr : {
62- default : null
49+ default ( ) /* istanbul ignore next */ {
50+ return { }
51+ }
6352 }
6453 } ,
6554 props,
@@ -68,72 +57,82 @@ export const BTd = /*#__PURE__*/ Vue.extend({
6857 // Overridden by <b-th>
6958 return 'td'
7059 } ,
60+ inTbody ( ) {
61+ return this . bvTableTr . inTbody
62+ } ,
63+ inThead ( ) {
64+ return this . bvTableTr . inThead
65+ } ,
66+ inTfoot ( ) {
67+ return this . bvTableTr . inTfoot
68+ } ,
7169 isDark ( ) {
72- return this . bvTable && this . bvTable . dark
70+ return this . bvTableTr . isDark
7371 } ,
7472 isStacked ( ) {
75- return this . bvTable && this . bvTable . isStacked
73+ return this . bvTableTr . isStacked
7674 } ,
7775 isStackedCell ( ) {
7876 // We only support stacked-heading in tbody in stacked mode
79- return this . bvTableTbody && this . isStacked
77+ return this . inTbody && this . isStacked
8078 } ,
8179 isResponsive ( ) {
82- return this . bvTable && this . bvTable . isResponsive && ! this . isStacked
80+ return this . bvTableTr . isResponsive
8381 } ,
8482 isStickyHeader ( ) {
8583 // Needed to handle header background classes, due to lack of
8684 // background color inheritance with Bootstrap v4 table CSS
8785 // Sticky headers only apply to cells in table `thead`
88- return (
89- ! this . isStacked &&
90- this . bvTable &&
91- this . bvTableThead &&
92- this . bvTableTr &&
93- this . bvTable . stickyHeader
94- )
86+ return this . bvTableTr . isStickyHeader
9587 } ,
9688 isStickyColumn ( ) {
9789 // Needed to handle header background classes, due to lack of
9890 // background color inheritance with Bootstrap v4 table CSS
9991 // Sticky column cells are only available in responsive
10092 // mode (horizontal scrolling) or when sticky header mode
10193 // Applies to cells in `thead`, `tbody` and `tfoot`
102- return (
103- ( this . isResponsive || this . isStickyHeader ) &&
104- this . stickyColumn &&
105- ! this . isStacked &&
106- this . bvTable &&
107- this . bvTableTr
108- )
94+ return ! this . isStacked && ( this . isResponsive || this . isStickyHeader ) && this . stickyColumn
95+ } ,
96+ rowVariant ( ) {
97+ return this . bvTableTr . variant
98+ } ,
99+ headVariant ( ) {
100+ return this . bvTableTr . headVariant
101+ } ,
102+ footVariant ( ) /* istanbul ignore next: need to add in tests for footer variant */ {
103+ return this . bvTableTr . footVariant
104+ } ,
105+ tableVariant ( ) {
106+ return this . bvTableTr . tableVariant
107+ } ,
108+ computedColspan ( ) {
109+ return parseSpan ( this . colspan )
110+ } ,
111+ computedRowspan ( ) {
112+ return parseSpan ( this . rowspan )
109113 } ,
110114 cellClasses ( ) {
111115 // We use computed props here for improved performance by caching
112116 // the results of the string interpolation
117+ // TODO: need to add handling for footVariant
113118 let variant = this . variant
114119 if (
115- ( ! variant && this . isStickyHeader && ! this . bvTableThead . headVariant ) ||
120+ ( ! variant && this . isStickyHeader && ! this . headVariant ) ||
116121 ( ! variant && this . isStickyColumn )
117122 ) {
118123 // Needed for sticky-header mode as Bootstrap v4 table cells do
119124 // not inherit parent's background-color. Boo!
120- variant = this . bvTableTr . variant || this . bvTable . tableVariant || 'b-table-default'
125+ variant = this . rowVariant || this . tableVariant || 'b-table-default'
121126 }
122127 return [
123128 variant ? `${ this . isDark ? 'bg' : 'table' } -${ variant } ` : null ,
124129 this . isStickyColumn ? 'b-table-sticky-column' : null
125130 ]
126131 } ,
127- computedColspan ( ) {
128- return parseSpan ( this . colspan )
129- } ,
130- computedRowspan ( ) {
131- return parseSpan ( this . rowspan )
132- } ,
133132 cellAttrs ( ) {
134133 // We use computed props here for improved performance by caching
135134 // the results of the object spread (Object.assign)
136- const headOrFoot = this . bvTableThead || this . bvTableTfoot
135+ const headOrFoot = this . inThead || this . inTfoot
137136 // Make sure col/rowspan's are > 0 or null
138137 const colspan = this . computedColspan
139138 const rowspan = this . computedRowspan
0 commit comments