65 lines
1.4 KiB
JavaScript
65 lines
1.4 KiB
JavaScript
|
import "../../../src/components/VGrid/_grid.sass";
|
||
|
import "../../../src/components/VGrid/VGrid.sass";
|
||
|
import Grid from './grid';
|
||
|
import mergeData from '../../util/mergeData';
|
||
|
/* @vue/component */
|
||
|
|
||
|
export default Grid('container').extend({
|
||
|
name: 'v-container',
|
||
|
functional: true,
|
||
|
props: {
|
||
|
id: String,
|
||
|
tag: {
|
||
|
type: String,
|
||
|
default: 'div'
|
||
|
},
|
||
|
fluid: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
}
|
||
|
},
|
||
|
|
||
|
render(h, {
|
||
|
props,
|
||
|
data,
|
||
|
children
|
||
|
}) {
|
||
|
let classes;
|
||
|
const {
|
||
|
attrs
|
||
|
} = data;
|
||
|
|
||
|
if (attrs) {
|
||
|
// reset attrs to extract utility clases like pa-3
|
||
|
data.attrs = {};
|
||
|
classes = Object.keys(attrs).filter(key => {
|
||
|
// TODO: Remove once resolved
|
||
|
// https://github.com/vuejs/vue/issues/7841
|
||
|
if (key === 'slot') return false;
|
||
|
const value = attrs[key]; // add back data attributes like data-test="foo" but do not
|
||
|
// add them as classes
|
||
|
|
||
|
if (key.startsWith('data-')) {
|
||
|
data.attrs[key] = value;
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return value || typeof value === 'string';
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (props.id) {
|
||
|
data.domProps = data.domProps || {};
|
||
|
data.domProps.id = props.id;
|
||
|
}
|
||
|
|
||
|
return h(props.tag, mergeData(data, {
|
||
|
staticClass: 'container',
|
||
|
class: Array({
|
||
|
'container--fluid': props.fluid
|
||
|
}).concat(classes || [])
|
||
|
}), children);
|
||
|
}
|
||
|
|
||
|
});
|
||
|
//# sourceMappingURL=VContainer.js.map
|