Skip to content

Commit f5ff21f

Browse files
authored
Merge branch 'dev' into tmorehouse/input-lazy
2 parents c4e038d + c7bc62c commit f5ff21f

File tree

7 files changed

+104
-50
lines changed

7 files changed

+104
-50
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ Released: (2019-02-14)
20322032
- **table:** add support for transitions on tbody element
20332033
([#1821](https://github.com/bootstrap-vue/bootstrap-vue/issues/1821))
20342034
([#2450](https://github.com/bootstrap-vue/bootstrap-vue/issues/2450))
2035-
([91514af](https://github.com/bootstrap-vue/bootstrap-vue/commit/91514af))
2035+
([91514af](https://github.com/bootstrap-vue/bootstrap-vue/commit/91514af445221286ef0bc55985556d58e3c54fdc))
20362036
- **table:** add table row middle click (auxclicked) event
20372037
([#2425](https://github.com/bootstrap-vue/bootstrap-vue/issues/2425))
20382038
([23250a2](https://github.com/bootstrap-vue/bootstrap-vue/commit/23250a2))
@@ -2261,7 +2261,7 @@ Released: 2018-04-01
22612261
### Bug Fixes v2.0.0-rc.4
22622262

22632263
- **build:** don't exclude lodash.get
2264-
([543c3c2](https://github.com/bootstrap-vue/bootstrap-vue/commit/543c3c2))
2264+
([543c3c2](https://github.com/bootstrap-vue/bootstrap-vue/commit/543c3c2f9aeccffb03c571aeea93333774243ab3))
22652265
- **card:** pass children instead of default prop to sub-components
22662266
([63b35e3](https://github.com/bootstrap-vue/bootstrap-vue/commit/63b35e3))
22672267

src/components/layout/README.md

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ functional layout components.
1111

1212
## How it works
1313

14-
Bootstrap's grid system uses a series of containers, rows, and columns to lay out and align content.
15-
It's built with flexbox and is fully responsive. Below is an example and an in-depth look at how the
16-
grid comes together.
14+
Bootstrap's grid system uses a series of containers, rows, and columns to layout and align content.
15+
It's built with
16+
[flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox)
17+
and is fully responsive. Below is an example and an in-depth look at how the grid comes together.
1718

1819
```html
1920
<b-container class="bv-example-row">
@@ -29,17 +30,18 @@ grid comes together.
2930

3031
The above example creates three equal-width columns on small, medium, large, and extra large devices
3132
using Bootstrap v4's predefined grid classes. Those columns are centered in the page with the parent
32-
.container.
33-
34-
Here's how it works:
35-
36-
- Containers provide a means to center your site's contents. Use `<b-container>` for fixed width or
37-
`<b-container fluid>` for full width.
38-
- Rows are horizontal groups of columns that ensure your columns are lined up properly. We use the
39-
negative margin method on `<b-row>` to ensure all your content is aligned properly down the left
40-
side.
41-
- Content should be placed within `<b-col>` columns, and only columns may be immediate children of
42-
`<b-row>`.
33+
`.container`.
34+
35+
Breaking it down, here's how it works:
36+
37+
- Containers provide a means to center and horizontally pad your site's contents. Use
38+
`<b-container>` for a responsive pixel width or `<b-container fluid>` for `width: 100%` across all
39+
viewport and device sizes.
40+
- Rows are wrappers for columns. Each column has horizontal `padding` (called a gutter) for
41+
controlling the space between them. This `padding` is then counteracted on the rows with negative
42+
margins. This way, all the content in your columns is visually aligned down the left side.
43+
- In a grid layout, content must be placed within columns and only columns may be immediate children
44+
of rows.
4345
- Thanks to flexbox, grid columns without a set width will automatically layout with equal widths.
4446
For example, four instances of `<b-col sm="auto">` will each automatically be 25% wide for small
4547
breakpoints.
@@ -50,20 +52,21 @@ Here's how it works:
5052
possible 12 per row, at the various breakpoints. So, if you want three equal-width columns at
5153
breakpoint `sm`, you can use `<b-col sm="4">`. the special value `auto` can be used to take up the
5254
remaining available column space in a row.
53-
- Column widths, internally, are set in percentages, so they're always fluid and sized relative to
54-
their parent element.
55-
- Columns have horizontal padding to create the gutters between individual columns, however, you can
56-
remove the margin from `<b-row>` and padding from `<b-col>` by setting the `no-gutters` prop on
57-
`<b-row>`.
58-
- There are five grid tiers, one for each responsive breakpoint: all breakpoints (extra small),
59-
small, medium, large, and extra large.
60-
- Grid tiers are based on minimum widths, meaning they apply to that one tier and all those above it
61-
(e.g., `<b-col sm="4">` applies to small, medium, large, and extra large devices).
55+
- Column `width`s are set in percentages, so they're always fluid and sized relative to their parent
56+
element.
57+
- Columns have horizontal `padding` to create the gutters between individual columns, however, you
58+
can remove the `margin` from `<b-row>` and `padding` from `<b-col>` by setting the `no-gutters`
59+
prop on `<b-row>`.
60+
- To make the grid responsive, there are five grid breakpoints, one for each responsive breakpoint:
61+
all breakpoints (extra small), small, medium, large, and extra large.
62+
- Grid breakpoints are based on minimum width media queries, meaning **they apply to that one
63+
breakpoint and all those above it** (e.g., `<b-col sm="4">` applies to small, medium, large, and
64+
extra large devices, but not the first `xs` breakpoint).
6265
- You can use predefined grid classes or Sass mixins for more semantic markup.
6366

6467
Be aware of the limitations and [bugs around flexbox](https://github.com/philipwalton/flexbugs),
6568
like the
66-
[inability to use some HTML elements as flex containers](https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers).
69+
[inability to use some HTML elements as flex containers](https://github.com/philipwalton/flexbugs#flexbug-9).
6770

6871
## Containers `<b-container>`
6972

@@ -109,7 +112,7 @@ the class `row` applied to it, or - in the case of [forms](/docs/components/form
109112

110113
## Grid options
111114

112-
While Bootstrap uses `ems` or `rems` for defining most sizes, `px`s are used for grid breakpoints
115+
While Bootstrap uses `em`s or `rem`s for defining most sizes, `px`s are used for grid breakpoints
113116
and container widths. This is because the viewport width is in pixels and does not change with the
114117
[font size](https://drafts.csswg.org/mediaqueries-3/#units).
115118

@@ -198,8 +201,8 @@ like `<b-col sm="6">`.
198201

199202
### Equal-width columns
200203

201-
For example, here are two grid layouts that apply to every device and viewport, from xs to xl. Add
202-
any number of unit-less classes for each breakpoint you need and every column will be the same
204+
For example, here are two grid layouts that apply to every device and viewport, from `xs` to `xl`.
205+
Add any number of unit-less classes for each breakpoint you need and every column will be the same
203206
width.
204207

205208
```html
@@ -219,15 +222,16 @@ width.
219222
<!-- b-grid-equal-width.vue -->
220223
```
221224

222-
Equal-width columns can be broken into multiple lines, but there is a
223-
[Safari flexbox bug](https://github.com/philipwalton/flexbugs#11-min-and-max-size-declarations-are-ignored-when-wrapping-flex-items)
224-
that prevents this from working without an explicit flex-basis or border. Our example works thanks
225-
to the border being set; you can do the same with `.col { border: 1px solid transparent; }`.
226-
Alternatively, you can set the flex-basis to the width of the column (e.g.,
227-
`.col { flex: 1 0 50%; }`).
225+
### Equal-width multi-line
226+
227+
Create equal-width columns that span multiple lines by inserting a `.w-100` where you want the
228+
columns to break to a new line. Make the breaks responsive by mixing `.w-100` with some
229+
[responsive display utilities](https://getbootstrap.com/docs/4.3/utilities/display/).
228230

229-
Both these fixes have been documented in a
230-
[reduced test case outside Bootstrap](https://output.jsbin.com/micohor).
231+
There was a [Safari flexbox bug](https://github.com/philipwalton/flexbugs#flexbug-11) that prevented
232+
this from working without an explicit `flex-basis` or `border`. There are workarounds for older
233+
browser versions, but they shouldn't be necessary if your target browsers don't fall into the buggy
234+
versions.
231235

232236
```html
233237
<b-container class="bv-example-row">

src/components/table/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ sorts _before_ `z`) or Swedish set `sort-compare-locale="sv"` (in Swedish, `ä`
19321932
**Notes:**
19331933

19341934
- Refer to
1935-
[MDN `String.prototype.localeCompare()` documentation](https://developer.mozilla.org/enUS/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare)
1935+
[MDN `String.prototype.localeCompare()` documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare)
19361936
for details on the options object property values.
19371937
- Refer to
19381938
[MDN locales documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument)

src/components/table/helpers/mixin-tfoot.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ export default {
88
default: false
99
},
1010
footVariant: {
11-
type: String,
11+
type: String, // 'dark', 'light', or `null` (or custom)
1212
default: () => getComponentConfig('BTable', 'footVariant')
1313
},
14+
footRowVariant: {
15+
type: String, // Any Bootstrap theme variant (or custom). Falls back to `headRowVariant`
16+
default: null
17+
},
1418
tfootClass: {
1519
type: [String, Array, Object],
1620
default: null

src/components/table/helpers/mixin-thead.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import KeyCodes from '../../../utils/key-codes'
22
import startCase from '../../../utils/startcase'
33
import { getComponentConfig } from '../../../utils/config'
44
import { htmlOrText } from '../../../utils/html'
5+
import { isUndefinedOrNull } from '../../../utils/inspect'
56
import filterEvent from './filter-event'
67
import textSelectionActive from './text-selection-active'
78
import { BThead } from '../thead'
@@ -12,9 +13,13 @@ import { BTh } from '../th'
1213
export default {
1314
props: {
1415
headVariant: {
15-
type: String, // 'light', 'dark' or null (or custom)
16+
type: String, // 'light', 'dark' or `null` (or custom)
1617
default: () => getComponentConfig('BTable', 'headVariant')
1718
},
19+
headRowVariant: {
20+
type: String, // Any Bootstrap theme variant (or custom)
21+
default: null
22+
},
1823
theadClass: {
1924
type: [String, Array, Object]
2025
// default: undefined
@@ -50,12 +55,12 @@ export default {
5055
const fields = this.computedFields || []
5156

5257
if (this.isStackedAlways || fields.length === 0) {
53-
// In always stacked mode, we don't bother rendering the head/foot.
58+
// In always stacked mode, we don't bother rendering the head/foot
5459
// Or if no field headings (empty table)
5560
return h()
5661
}
5762

58-
// Refernce to `selectAllRows` and `clearSelected()`, if table is Selectable
63+
// Reference to `selectAllRows` and `clearSelected()`, if table is selectable
5964
const selectAllRows = this.isSelectable ? this.selectAllRows : () => {}
6065
const clearSelected = this.isSelectable ? this.clearSelected : () => {}
6166

@@ -142,7 +147,12 @@ export default {
142147
// Genrate the row(s)
143148
const $trs = []
144149
if (isFoot) {
145-
$trs.push(h(BTr, { class: this.tfootTrClass }, $cells))
150+
const trProps = {
151+
variant: isUndefinedOrNull(this.footRowVariant)
152+
? this.headRowVariant
153+
: this.footRowVariant
154+
}
155+
$trs.push(h(BTr, { class: this.tfootTrClass, props: trProps }, $cells))
146156
} else {
147157
const scope = {
148158
columns: fields.length,
@@ -152,7 +162,9 @@ export default {
152162
clearSelected
153163
}
154164
$trs.push(this.normalizeSlot('thead-top', scope) || h())
155-
$trs.push(h(BTr, { class: this.theadTrClass }, $cells))
165+
$trs.push(
166+
h(BTr, { class: this.theadTrClass, props: { variant: this.headRowVariant } }, $cells)
167+
)
156168
}
157169

158170
return h(

src/components/table/package.json

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,21 @@
7575
},
7676
{
7777
"prop": "headVariant",
78-
"description": "Header variant: 'light' or 'dark', or unset"
78+
"description": "Header variant: 'light' or 'dark', or unset. May take precedence over head-row-variant"
79+
},
80+
{
81+
"prop": "headRowVariant",
82+
"version": "2.1.0",
83+
"description": "Apply a Bootstrap theme color variant to the tr element in the thead"
7984
},
8085
{
8186
"prop": "footVariant",
82-
"description": "Footer variant: 'light' or 'dark', or unset"
87+
"description": "Footer variant: 'light' or 'dark', or unset. May take precedence over foot-row-variant"
88+
},
89+
{
90+
"prop": "footRowVariant",
91+
"version": "2.1.0",
92+
"description": "Apply a Bootstrap theme color variant to the tr element in the tfoot. Falls back to head-row-variant"
8393
},
8494
{
8595
"prop": "tbodyTransitionProps",
@@ -989,11 +999,21 @@
989999
},
9901000
{
9911001
"prop": "headVariant",
992-
"description": "Header variant: 'light' or 'dark', or unset"
1002+
"description": "Header variant: 'light' or 'dark', or unset. May take precedence over head-row-variant"
1003+
},
1004+
{
1005+
"prop": "headRowVariant",
1006+
"version": "2.1.0",
1007+
"description": "Apply a Bootstrap theme color variant to the tr element in the thead"
9931008
},
9941009
{
9951010
"prop": "footVariant",
996-
"description": "Footer variant: 'light' or 'dark', or unset"
1011+
"description": "Footer variant: 'light' or 'dark', or unset. May take precedence over foot-row-variant"
1012+
},
1013+
{
1014+
"prop": "footRowVariant",
1015+
"version": "2.1.0",
1016+
"description": "Apply a Bootstrap theme color variant to the tr element in the tfoot. Falls back to head-row-variant"
9971017
},
9981018
{
9991019
"prop": "tbodyTransitionProps",

src/components/table/tr.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export const props = {
88
}
99
}
1010

11+
const LIGHT = 'light'
12+
const DARK = 'dark'
13+
1114
// @vue/component
1215
export const BTr = /*#__PURE__*/ Vue.extend({
1316
name: 'BTr',
@@ -62,10 +65,21 @@ export const BTr = /*#__PURE__*/ Vue.extend({
6265
},
6366
headVariant() {
6467
// Sniffed by <b-td> / <b-th>
65-
return this.bvTableRowGroup.headVariant
68+
return this.inThead ? this.bvTableRowGroup.headVariant : null
69+
},
70+
footVariant() {
71+
// Sniffed by <b-td> / <b-th>
72+
return this.inTfoot ? this.bvTableRowGroup.footVariant : null
73+
},
74+
isRowDark() {
75+
return this.headVariant === LIGHT || this.footVariant === LIGHT
76+
? false
77+
: this.headVariant === DARK || this.footVariant === DARK
78+
? true
79+
: this.isDark
6680
},
6781
trClasses() {
68-
return [this.variant ? `${this.isDark ? 'bg' : 'table'}-${this.variant}` : null]
82+
return [this.variant ? `${this.isRowDark ? 'bg' : 'table'}-${this.variant}` : null]
6983
},
7084
trAttrs() {
7185
return { role: 'row', ...this.$attrs }

0 commit comments

Comments
 (0)