8000 feat(config): improved defaults handling (closes #4507, #5138, #5291, #5459, #5958) by Hiws · Pull Request #5981 · bootstrap-vue/bootstrap-vue · GitHub
[go: up one dir, main page]

Skip to content

feat(config): improved defaults handling (closes #4507, #5138, #5291, #5459, #5958) #5981

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 124 commits into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
2de6af8
specify support of sidebar + array
Hiws Oct 12, 2020
f6aec8a
Merge branch 'dev' of https://github.com/bootstrap-vue/bootstrap-vue …
Hiws Oct 14, 2020
95b4fd1
Merge branch 'dev' of https://github.com/bootstrap-vue/bootstrap-vue …
Hiws Oct 28, 2020
86ddf36
Initial Concept
Hiws Oct 28, 2020
db85eb2
remove test code
Hiws Oct 28, 2020
a5b59c3
Remove `config-default.js`
Hiws Oct 29, 2020
45998b0
Merge branch 'dev' into new-config
Hiws Oct 29, 2020
c3d180d
Update componentdoc.vue
jacobmllr95 Oct 30, 2020
92ef9ee
Update bootstrap-vue.js
jacobmllr95 Oct 30, 2020
8ca7552
Merge branch 'dev' into new-config
Hiws Oct 30, 2020
4f6a4ff
feat(config): code improvements
jacobmllr95 Oct 30, 2020
78f07b4
Merge branch 'new-config' of https://github.com/Hiws/bootstrap-vue in…
jacobmllr95 Oct 30, 2020
29a54f9
fix: fallback config handling for date/time components
jacobmllr95 Oct 30, 2020
3fec43e
update calendar.js
Hiws Oct 30, 2020
40ab8b0
feat(config): make all props configurable [WIP]
jacobmllr95 Oct 30, 2020
f92cd94
Merge branch 'new-config' of https://github.com/Hiws/bootstrap-vue in…
jacobmllr95 Oct 30, 2020
2f7aed2
Update aspect.js
jacobmllr95 Oct 30, 2020
b0b3002
Update avatar-group.js
jacobmllr95 Oct 30, 2020
9db432a
Update avatar.js
jacobmllr95 Oct 30, 2020
819199e
Update form-datepicker.js
jacobmllr95 Oct 30, 2020
9c853a2
fix(config): default value handling in `makePropsConfigurable()`
jacobmllr95 Oct 30, 2020
6964866
Update config.spec.js
jacobmllr95 Oct 30, 2020
e03c645
Update config.js
jacobmllr95 Oct 30, 2020
fa657f9
Merge branch 'dev' into new-config
jacobmllr95 Oct 30, 2020
4df4b04
Update componentdoc.vue
jacobmllr95 Oct 30, 2020
5ee0c5d
Apply `makePropsConfigurable` to all components
Hiws Oct 30, 2020
d9e5150
Merge branch 'new-config' of https://github.com/Hiws/bootstrap-vue in…
jacobmllr95 Oct 30, 2020
5bc0598
Update object.js
jacobmllr95 Oct 30, 2020
3f299e8
Update object.js
jacobmllr95 Oct 30, 2020
786886f
fix linting errors
Hiws Oct 30, 2020
4ab791f
Revert "fix linting errors"
jacobmllr95 Oct 30, 2020
18d274b
Update form-input.js
jacobmllr95 Oct 30, 2020
04c53a5
Update form-spinbutton.js
jacobmllr95 Oct 30, 2020
a73be57
fix(form-file): `fileNameFormatter` prop handling
jacobmllr95 Oct 30, 2020
c7e26fa
fix: property `validator` context
jacobmllr95 Oct 30, 2020
86f259d
Update form-tags.js
jacobmllr95 Oct 30, 2020
76dc640
Update pagination-nav.js
jacobmllr95 Oct 30, 2020
febb1e0
Update toast.js
jacobmllr95 Oct 30, 2020
4fb985d
Update button.js
jacobmllr95 Oct 30, 2020
6c8963c
Update calendar.js
jacobmllr95 Oct 30, 2020
eb32292
Update bv-modal.js
jacobmllr95 Oct 30, 2020
f705ac0
Update form-size.js
jacobmllr95 Oct 30, 2020
982b461
Update mixin-selectable.js
jacobmllr95 Oct 30, 2020
d766009
Update mixin-tfoot.js
jacobmllr95 Oct 30, 2020
778aba7
Update mixin-thead.js
jacobmllr95 Oct 30, 2020
a417ac2
Update bv-toast.js
jacobmllr95 Oct 30, 2020
92799ea
Update popover.js
jacobmllr95 Oct 30, 2020
bbe6e93
Update tooltip.js
jacobmllr95 Oct 30, 2020
045bac7
Update tbody.js
jacobmllr95 Oct 30, 2020
accbb46
Update td.js
jacobmllr95 Oct 30, 2020
832dd80
Update tfoot.js
jacobmllr95 Oct 30, 2020
5cda3fd
Update thead.js
jacobmllr95 Oct 30, 2020
a59e71f
Update tr.js
jacobmllr95 Oct 30, 2020
3efdefd
Update pagination.js
jacobmllr95 Oct 30, 2020
0133f00
Update button-group.js
jacobmllr95 Oct 30, 2020
6259a4a
Update button.js
jacobmllr95 Oct 30, 2020
3f57de9
Update form-datepicker.js
jacobmllr95 Oct 30, 2020
adce3f9
Update form-timepicker.js
jacobmllr95 Oct 30, 2020
7294473
Update time.js
jacobmllr95 Oct 30, 2020
30d5ddd
Update button-toolbar.js
jacobmllr95 Oct 30, 2020
7654cfc
Update calendar.js
jacobmllr95 Oct 30, 2020
e6d6112
Update form-file.js
jacobmllr95 Oct 30, 2020
44745c3
Update form-rating.js
jacobmllr95 Oct 30, 2020
c1b4ff1
Update mixin-options.js
jacobmllr95 Oct 30, 2020
f47b85f
Update form-spinbutton.js
jacobmllr95 Oct 30, 2020
3fb87f3
Update form-tags.js
jacobmllr95 Oct 30, 2020
50397eb
Update nav-item.js
jacobmllr95 Oct 30, 2020
1b20ad7
Update mixin-busy.js
jacobmllr95 Oct 30, 2020
b64cb83
Update mixin-caption.js
jacobmllr95 Oct 30, 2020
e3fe4f8
Update mixin-empty.js
jacobmllr95 Oct 30, 2020
c1d02ec
Update mixin-filtering.js
jacobmllr95 Oct 30, 2020
3e36641
Update mixin-items.js
jacobmllr95 Oct 30, 2020
56e40a8
Update mixin-pagination.js
jacobmllr95 Oct 30, 2020
4f5cf04
Update mixin-provider.js
jacobmllr95 Oct 30, 2020
0286366
Update mixin-sorting.js
jacobmllr95 Oct 30, 2020
f8d6dd0
Update mixin-stacked.js
jacobmllr95 Oct 30, 2020
e9c0f38
Update mixin-table-renderer.js
jacobmllr95 Oct 30, 2020
5ec5bd1
Update mixin-tbody-row.js
jacobmllr95 Oct 30, 2020
2035e1b
Update icon.js
jacobmllr95 Oct 30, 2020
6918e98
Update iconstack.js
jacobmllr95 Oct 30, 2020
069e516
Update card.js
jacobmllr95 Oct 30, 2020
fe28045
Update dropdown.js
jacobmllr95 Oct 30, 2020
0aeaa66
Update form-options.js
jacobmllr95 Oct 30, 2020
b590146
Update form-radio-check-group.js
jacobmllr95 Oct 30, 2020
386bfc2
Update form-radio-check.js
jacobmllr95 Oct 30, 2020
0e894a7
Update form-text.js
jacobmllr95 Oct 30, 2020
1824fab
Update form.js
jacobmllr95 Oct 30, 2020
fee0123
Update mixin-filtering.js
jacobmllr95 Oct 30, 2020
31391b0
Update pagination.js
jacobmllr95 Oct 30, 2020
ee190f8
Update form-text.js
jacobmllr95 Oct 30, 2020
cabca98
Update modal.js
jacobmllr95 Oct 30, 2020
d3b5b6a
chore: remove redundant istanbul ignores
jacobmllr95 Oct 30, 2020
57c0dda
fix: add back some istanbul ignore
jacobmllr95 Oct 30, 2020
f8a8cc5
Merge branch 'dev' into new-config
jacobmllr95 Oct 31, 2020
d196103
Merge branch 'dev' into new-config
jacobmllr95 Nov 1, 2020
43b005d
Merge branch 'dev' into new-config
jacobmllr95 Nov 1, 2020
2fe5a94
Merge branch 'dev' into new-config
jacobmllr95 Nov 3, 2020
c36774d
Merge remote-tracking branch 'origin/dev' into pr/5981
jacobmllr95 Nov 5, 2020
a5bcf8a
fix(config): ensure props from mixins are configurabel via component …
jacobmllr95 Nov 5, 2020
7adfce4
fix: resuse `form-plain` mixin everywhere
jacobmllr95 Nov 5, 2020
056a145
feat: improve form control mixins
jacobmllr95 Nov 5, 2020
adbeeeb
Update README.md
jacobmllr95 Nov 5, 2020
067285f
Update componentdoc.vue
jacobmllr95 Nov 5, 2020
8e13555
Update SECURITY.md
jacobmllr95 Nov 5, 2020
05a2812
Update README.md
jacobmllr95 Nov 5, 2020
43cb3b3
Merge branch 'dev' into new-config
jacobmllr95 Nov 5, 2020
1f4a5f2
Update breadcrumb.js
jacobmllr95 Nov 5, 2020
2616b94
fix: size prop default value
jacobmllr95 Nov 5, 2020
deb9b3c
Update input-group.js
jacobmllr95 Nov 5, 2020
55268fa
fix(config): `makePropsConfigurable()` usage without key
jacobmllr95 Nov 5, 2020
68ca7d3
Merge branch 'dev' into new-config
jacobmllr95 Nov 5, 2020
5342fff
Update config.js
jacobmllr95 Nov 5, 2020
adac05a
Update config.js
jacobmllr95 Nov 5, 2020
d05a782
Update button-close.js
jacobmllr95 Nov 5, 2020
9a73516
Update toaster.js
jacobmllr95 Nov 5, 2020
8f98a25
Update calendar.js
jacobmllr95 Nov 5, 2020
68d9681
Update carousel.js
jacobmllr95 Nov 5, 2020
99d25c5
Update dropdown.js
jacobmllr95 Nov 5, 2020
177725c
Update dropdown.spec.js
jacobmllr95 Nov 5, 2020
eb16293
Update img-lazy.js
jacobmllr95 Nov 5, 2020
c9b14e2
Update config.spec.js
jacobmllr95 Nov 6, 2020
4baa858
Update avatar.js
jacobmllr95 Nov 6, 2020
9c667de
feat: further improve shared form props usage
jacobmllr95 Nov 6, 2020
248fbca
Merge branch 'dev' into new-config
jacobmllr95 Nov 6, 2020
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
7 changes: 5 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@

## Reporting a Vulnerability

The BootstrapVue team takes security issues very seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
The BootstrapVue team takes security issues very seriously. We appreciate your efforts to
responsibly disclose your findings, and will make every effort to acknowledge your contributions.

To report a security issue, email [bootstrapvue.js@gmail.com](mailto:security@bootstrapvue.js@gmail.com) and include the word "SECURITY" in the subject line.
To report a security issue, email
[bootstrapvue.js@gmail.com](mailto:security@bootstrapvue.js@gmail.com) and include the word
"SECURITY" in the subject line.

We'll endeavor to respond quickly, and will keep you updated throughout the process.
11 changes: 5 additions & 6 deletions docs/components/componentdoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
<anchored-heading :id="`comp-ref-${componentName}-props`" level="4" class="mb-3">
Properties
</anchored-heading>

<p>
All property default values are <b-link href="/docs/reference/settings">globally configurable</b-link>.
</p>

<b-table
:items="propsItems"
:fields="propsFields"
Expand All @@ -98,7 +103,6 @@
<template #cell(prop)="{ value, item }">
<code class="text-nowrap notranslate" translate="no">{{ value }}</code><br>
<b-badge v-if="item.required" variant="info">Required</b-badge>
<b-badge v-if="item.settings" variant="dark" href="/docs/reference/settings" title="Configurable in settings">Settings</b-badge>
<b-badge v-if="item.version" variant="secondary">v{{ item.version }}+</b-badge>
<b-badge v-if="item.isVModel" variant="primary">v-model</b-badge>
<b-badge v-if="item.xss" variant="warning">Use with caution</b-badge>
Expand Down Expand Up @@ -298,7 +302,6 @@
<script>
import Vue from 'vue'
import commonProps from '../common-props.json'
import { defaultConfig } from '../content'
import { getComponentName, getCleanComponentName, kebabCase } from '../utils'
import AnchoredHeading from './anchored-heading'

Expand Down Expand Up @@ -425,7 +428,6 @@ export default {
propsItems() {
const props = this.componentProps
const propsMetaObj = this.componentPropsMetaObj
const componentSettings = defaultConfig[this.componentOptions.name] || {}

return Object.keys(props).map(prop => {
const p = props[prop]
Expand Down Expand Up @@ -457,16 +459,13 @@ export default {
? ''
: String(JSON.stringify(defaultValue, undefined, 1)).replace(/"/g, "'")

const settings = Object.prototype.hasOwnProperty.call(componentSettings, prop)

return {
prop: kebabCase(prop),
type,
defaultValue,
required: p.required || false,
description: meta.description || '',
version: meta.version || '',
settings,
xss: /[a-z]Html$/.test(prop),
isVModel: this.componentVModel && this.componentVModel.prop === prop,
deprecated: p.deprecated || false,
Expand Down
2 changes: 0 additions & 2 deletions docs/content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { importAll, parseVersion, parseFullVersion } from '~/utils'
import { version, dependencies, devDependencies, description } from '~/../package.json'
import DEFAULT_CONFIG from '~/../src/utils/config-defaults'

const componentsContext = require.context('~/../src/components/', true, /package.json/)
export const components = importAll(componentsContext)
Expand Down Expand Up @@ -92,7 +91,6 @@ export const vueVersion = parseVersion(devDependencies.vue)
export const vueVersionMinor = vueVersion.replace(minorRE, '$1')
export const vueVersionMajor = vueVersion.replace(majorRE, '$1')

export const defaultConfig = DEFAULT_CONFIG
export const bvDescription = description

export { version }
92 changes: 76 additions & 16 deletions docs/markdown/reference/settings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,76 @@ Note that it is not possible to change the defaults when using BootstrapVue via

### Default configuration

Default breakpoint names are stored in the `breakpoints` property, default form control size is
stored under the `formControls` property, while component specific defaults are keyed by their
<samp>PascalCase</samp> name with the props as <samp>camelCase</samp> properties. Only properties
defined in the default configuration can be overridden. Attempting to set a config property that is
not defined in the default will generate a console warning.
Default breakpoint names are stored in the `breakpoints` property and all other shared component
configurations (like `formControls`) are listed below.

Component specific defaults are keyed by their `PascalCase` name with the props as `camelCase`
properties.

```json
{{ defaultConfig }}
{
// Breakpoint configuration
"breakpoints": ["xs", "sm", "md", "lg", "xl"],

// Shared component configuration
"formControls": {
"disabled": undefined,
"required": false,
"form": undefined,
"autofocus": false,
"plain": false,
"size": undefined
},
"formOptionControls": {
"options": [],
"valueField": "value",
"textField": "text",
"htmlField": "html",
"disabledField": "disabled"
},
"formRadioCheckGroups": {
"validated": false,
"ariaInvalid": false,
"stacked": false,
"buttons": false,
"buttonVariant": undefined,
"plain": false
},
"formRadioCheckControls": {
"value": undefined,
"checked": undefined,
"inline": false,
"button": false,
"buttonVariant": undefined,
"ariaLabel": undefined,
"ariaLabelledby": undefined,
"plain": false
},
"formState": {
"state": null
},
"formTextControls": {
"value": "",
"ariaInvalid": false,
"readonly": false,
"plaintext": false,
"autocomplete": undefined,
"placeholder": undefined,
"formatter": undefined,
"lazyFormatter": false,
"trim": false,
"number": false,
"lazy": false,
"debounce": 0
},

// Component configuration
"BAlert": {
"variant": "info"
// ...
}
// ...
}
```

### Setting new configuration values
Expand All @@ -30,11 +92,12 @@ When you `Vue.use(BootstrapVue)`, you can optionally pass a configuration object
values to replace the default values. For example if you wish to define new breakpoint names (which
will generate appropriate properties on components such as `<b-col>` and `<b-form-group>`), so that
the new breakpoints are `['aa', 'bb', 'cc', 'dd']` then `<b-col>` will now have `bb`, `cc`, and `dd`
props instead of `sm`, `md`, `lg` and `xl` props (Similar for the `label-cols-{breakpoint}` and
`label-align-{breakpoint}`props on `<b-form-group>`):
props instead of `sm`, `md`, `lg` and `xl` props (similar for the `label-cols-{breakpoint}` and
`label-align-{breakpoint}` props on `<b-form-group>`):

```js
import BootstrapVue from 'bootstrap-vue'

Vue.use(BootstrapVue, {
breakpoints: [`xs`, 'sm', 'md', 'lg', 'xl', 'xxl']
})
Expand All @@ -44,6 +107,7 @@ Or if changing the default variants for `<b-button>` and `<b-alert>`:

```js
import BootstrapVue from 'bootstrap-vue'

Vue.use(BootstrapVue, {
BAlert: { variant: 'danger' },
BButton: { variant: 'primary' }
Expand Down Expand Up @@ -72,7 +136,6 @@ and subsequent changes to the breakpoints will **not** be reflected.
<!-- eslint-disable import/first, import/no-duplicates -->

```js
// Component group plugins
import { LayoutPlugin, AlertPlugin, ButtonPlugin } from 'bootstrap-vue'

// Supply configs via each plugin as it is `Vue.use()`'d
Expand All @@ -86,7 +149,6 @@ Vue.use(ButtonPlugin, { BButton: { variant: 'primary' } })
<!-- eslint-disable import/first, import/no-duplicates -->

```js
// Component group plugins
import { LayoutPlugin, AlertPlugin, ButtonPlugin } from 'bootstrap-vue'

// Supply complete config to first `Vue.use()`'d plugin
Expand All @@ -104,7 +166,6 @@ Vue.use(ButtonPlugin)
<!-- eslint-disable import/first, import/no-duplicates -->

```js
// BootstrapVue configuration helper plugin and Component group plugins
import { BVConfigPlugin, LayoutPlugin, AlertPlugin, ButtonPlugin } from 'bootstrap-vue'

// Supply complete config to the BVConfigPlugin helper plugin
Expand All @@ -125,7 +186,6 @@ Vue.use(ButtonPlugin)
<!-- eslint-disable import/first, import/no-duplicates -->

```js
// Import BootstrapVue configuration helper plugin and Individual components
import { BVConfigPlugin, BAlert, BButton, BRow, BCol } from 'bootstrap-vue'

// Supply complete config to the BVConfig helper plugin
Expand Down Expand Up @@ -161,12 +221,12 @@ in **Example 3** and **Example 4** above. The `BVConfigPlugin` plugin should be
entry point of your app, and **before** any `Vue.use()` of component plugins or `Vue.component()` or
individual components.

### Setting the config via Nuxt.js BootstrapVue plugin
### Setting the config via Nuxt.js module

Refer to the [Getting Started](/docs/#nuxtjs-plugin-module) documentation for information on passing
the config object to the Nuxt.js plugin module.
Refer to the [Getting Started](/docs/#nuxtjs-module) documentation for information on passing the
config object to the BootstrapVue Nuxt.js module.

## Disabling BootstrapVue console warnings
## Disabling console warnings

BootstrapVue will warn (via `console.warn()`) when you try and use a deprecated prop, or pass an
invalid value to certain props. These warnings are provided to help you ensure that your application
Expand Down
2 changes: 0 additions & 2 deletions docs/pages/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
bootstrapVersion,
bootstrapVersionMajor,
bootstrapVersionMinor,
defaultConfig,
nuxtVersion,
nuxtVersionMajor,
nuxtVersionMinor,
Expand Down Expand Up @@ -45,7 +44,6 @@ export default {
bootstrapVersionMinor,
bootstrapVersionMajor,
bootstrapIconsCount,
defaultConfig,
nuxtVersion,
nuxtVersionMinor,
nuxtVersionMajor,
Expand Down
12 changes: 3 additions & 9 deletions docs/pages/docs/reference/_slug.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import hljs from '~/utils/hljs'
import MainDocs from '~/components/main-docs'
import docsMixin from '~/plugins/docs-mixin'
import { reference as referenceMeta, defaultConfig } from '~/content'
import { reference as referenceMeta } from '~/content'

const getReadmeData = name => {
try {
Expand All @@ -11,8 +10,6 @@ const getReadmeData = name => {
}
}

const replacer = (key, value) => (typeof value === 'undefined' ? null : value)

// @vue/component
export default {
name: 'BDVReference',
Expand All @@ -25,11 +22,8 @@ export default {
const name = params.slug
const meta = referenceMeta[name]
const readmeData = (await getReadmeData(name)).default
let { titleLead = '', body = '', baseTOC = {}, loadError = false } = readmeData
body = body.replace(
'{{ defaultConfig }}',
hljs.highlight('json', JSON.stringify(defaultConfig || {}, replacer, 2)).value
)
const { titleLead = '', body = '', baseTOC = {}, loadError = false } = readmeData

return { meta, titleLead, body, baseTOC, loadError }
},
render(h) {
Expand Down
47 changes: 25 additions & 22 deletions src/components/alert/alert.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from '../../vue'
import { NAME_ALERT } from '../../constants/components'
import { getComponentConfig } from '../../utils/config'
import { makePropsConfigurable } from '../../utils/config'
import { requestAF } from '../../utils/dom'
import { isBoolean, isNumeric } from '../../utils/inspect'
import { toInteger } from '../../utils/number'
Expand Down Expand Up @@ -37,28 +37,31 @@ export const BAlert = /*#__PURE__*/ Vue.extend({
prop: 'show',
event: 'input'
},
props: {
variant: {
type: String,
default: () => getComponentConfig(NAME_ALERT, 'variant')
},
dismissible: {
type: Boolean,
default: false
},
dismissLabel: {
type: String,
default: () => getComponentConfig(NAME_ALERT, 'dismissLabel')
},
show: {
type: [Boolean, Number, String],
default: false
props: makePropsConfigurable(
{
variant: {
type: String,
default: 'info'
},
dismissible: {
type: Boolean,
default: false
},
dismissLabel: {
type: String,
default: 'Close'
},
show: {
type: [Boolean, Number, String],
default: false
},
fade: {
type: Boolean,
default: false
}
},
fade: {
type: Boolean,
default: false
}
},
NAME_ALERT
),
data() {
return {
countDown: 0,
Expand Down
26 changes: 15 additions & 11 deletions src/components/aspect/aspect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Vue from '../../vue'
import { NAME_ASPECT } from '../../constants/components'
import { RX_ASPECT, RX_ASPECT_SEPARATOR } from '../../constants/regex'
import { makePropsConfigurable } from '../../utils/config'
import { mathAbs } from '../../utils/math'
import { toFloat } from '../../utils/number'
import normalizeSlotMixin from '../../mixins/normalize-slot'
Expand All @@ -12,18 +13,21 @@ const CLASS_NAME = 'b-aspect'
export const BAspect = /*#__PURE__*/ Vue.extend({
name: NAME_ASPECT,
mixins: [normalizeSlotMixin],
props: {
aspect: {
// Accepts a number (i.e. `16 / 9`, `1`, `4 / 3`)
// Or a string (i.e. '16/9', '16:9', '4:3' '1:1')
type: [Number, String],
default: '1:1'
props: makePropsConfigurable(
{
aspect: {
// Accepts a number (i.e. `16 / 9`, `1`, `4 / 3`)
// Or a string (i.e. '16/9', '16:9', '4:3' '1:1')
type: [Number, String],
default: '1:1'
},
tag: {
type: String,
default: 'div'
}
},
tag: {
type: String,
default: 'div'
}
},
NAME_ASPECT
),
computed: {
padding() {
const aspect = this.aspect
Expand Down
Loading
0