Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(b-form-group): remove deprecated props horizontal and breakpoint #3879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/components/form-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,11 @@ of the width of the rendered row (handy if you have custom Bootstrap with an odd
<!-- b-form-group-horizontal.vue -->
```

**Deprecation warning:** The props `horizontal` and `breakpoint` have been deprecated in favour of
using the `label-cols` and `label-cols-{breakpoint}` props.

### Label size

You can control the label text size match the size of your form input(s) via the optional
`label-size` prop. Values can be `'sm'` or `'lg'` for small or large label, respectively. Sizes work
for both `horizontal` and non-horizontal form groups.
for both horizontal and non-horizontal form groups.

```html
<div>
Expand Down
28 changes: 0 additions & 28 deletions src/components/form-group/form-group.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Utils
import memoize from '../../utils/memoize'
import upperFirst from '../../utils/upper-first'
import warn from '../../utils/warn'
import { arrayIncludes } from '../../utils/array'
import { getBreakpointsUpCached } from '../../utils/config'
import { select, selectAll, isVisible, setAttr, removeAttr, getAttr } from '../../utils/dom'
Expand All @@ -25,9 +24,6 @@ const NAME = 'BFormGroup'
// Selector for finding first input in the form-group
const SELECTOR = 'input:not([disabled]),textarea:not([disabled]),select:not([disabled])'

const DEPRECATED_MSG =
'Props "horizontal" and "breakpoint" are deprecated. Use "label-cols(-{breakpoint})" props instead.'

// Render helper functions (here rather than polluting the instance with more methods)
const renderInvalidFeedback = (h, ctx) => {
const content = ctx.normalizeSlot('invalid-feedback') || ctx.invalidFeedback
Expand Down Expand Up @@ -235,18 +231,6 @@ const generateProps = () => {
disabled: {
type: Boolean,
default: false
},
horizontal: {
// Deprecated
type: Boolean,
default: false,
deprecated: DEPRECATED_MSG
},
breakpoint: {
// Deprecated (ignored if horizontal is not true)
type: String,
default: null, // legacy value 'sm',
deprecated: DEPRECATED_MSG
}
}
}
Expand All @@ -268,18 +252,6 @@ export const BFormGroup = {
computed: {
labelColProps() {
const props = {}
/* istanbul ignore next: deprecated */
if (this.horizontal) {
// Deprecated setting of horizontal/breakpoint props
/* istanbul ignore next */
warn(`b-form-group: ${DEPRECATED_MSG}`)
// Legacy default is breakpoint sm and cols 3
const bp = this.breakpoint || getBreakpointsUpCached()[1] // 'sm'
const cols = parseInt(this.labelCols, 10) || 3
props[bp] = cols > 0 ? cols : 3
// We then return the single breakpoint prop for legacy compatibility
return props
}
getBreakpointsUpCached().forEach(breakpoint => {
// Grab the value if the label column breakpoint prop
let propVal = this[makePropName(breakpoint, 'labelCols')]
Expand Down