170 lines
6.6 KiB
JavaScript
170 lines
6.6 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = void 0;
|
||
|
|
||
|
require("../../../src/components/VToolbar/VToolbar.sass");
|
||
|
|
||
|
var _VSheet = _interopRequireDefault(require("../VSheet/VSheet"));
|
||
|
|
||
|
var _VImg = _interopRequireDefault(require("../VImg/VImg"));
|
||
|
|
||
|
var _helpers = require("../../util/helpers");
|
||
|
|
||
|
var _console = require("../../util/console");
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
||
|
|
||
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
||
|
|
||
|
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||
|
|
||
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||
|
|
||
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||
|
|
||
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||
|
|
||
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||
|
|
||
|
/* @vue/component */
|
||
|
var _default = _VSheet.default.extend({
|
||
|
name: 'v-toolbar',
|
||
|
props: {
|
||
|
absolute: Boolean,
|
||
|
bottom: Boolean,
|
||
|
collapse: Boolean,
|
||
|
dense: Boolean,
|
||
|
extended: Boolean,
|
||
|
extensionHeight: {
|
||
|
default: 48,
|
||
|
type: [Number, String]
|
||
|
},
|
||
|
flat: Boolean,
|
||
|
floating: Boolean,
|
||
|
prominent: Boolean,
|
||
|
short: Boolean,
|
||
|
src: {
|
||
|
type: [String, Object],
|
||
|
default: ''
|
||
|
},
|
||
|
tag: {
|
||
|
type: String,
|
||
|
default: 'header'
|
||
|
},
|
||
|
tile: {
|
||
|
type: Boolean,
|
||
|
default: true
|
||
|
}
|
||
|
},
|
||
|
data: function data() {
|
||
|
return {
|
||
|
isExtended: false
|
||
|
};
|
||
|
},
|
||
|
computed: {
|
||
|
computedHeight: function computedHeight() {
|
||
|
var height = this.computedContentHeight;
|
||
|
if (!this.isExtended) return height;
|
||
|
var extensionHeight = parseInt(this.extensionHeight);
|
||
|
return this.isCollapsed ? height : height + (!isNaN(extensionHeight) ? extensionHeight : 0);
|
||
|
},
|
||
|
computedContentHeight: function computedContentHeight() {
|
||
|
if (this.height) return parseInt(this.height);
|
||
|
if (this.isProminent && this.dense) return 96;
|
||
|
if (this.isProminent && this.short) return 112;
|
||
|
if (this.isProminent) return 128;
|
||
|
if (this.dense) return 48;
|
||
|
if (this.short || this.$vuetify.breakpoint.smAndDown) return 56;
|
||
|
return 64;
|
||
|
},
|
||
|
classes: function classes() {
|
||
|
return _objectSpread({}, _VSheet.default.options.computed.classes.call(this), {
|
||
|
'v-toolbar': true,
|
||
|
'v-toolbar--absolute': this.absolute,
|
||
|
'v-toolbar--bottom': this.bottom,
|
||
|
'v-toolbar--collapse': this.collapse,
|
||
|
'v-toolbar--collapsed': this.isCollapsed,
|
||
|
'v-toolbar--dense': this.dense,
|
||
|
'v-toolbar--extended': this.isExtended,
|
||
|
'v-toolbar--flat': this.flat,
|
||
|
'v-toolbar--floating': this.floating,
|
||
|
'v-toolbar--prominent': this.isProminent
|
||
|
});
|
||
|
},
|
||
|
isCollapsed: function isCollapsed() {
|
||
|
return this.collapse;
|
||
|
},
|
||
|
isProminent: function isProminent() {
|
||
|
return this.prominent;
|
||
|
},
|
||
|
styles: function styles() {
|
||
|
return this.measurableStyles;
|
||
|
}
|
||
|
},
|
||
|
created: function created() {
|
||
|
var _this = this;
|
||
|
|
||
|
var breakingProps = [['app', '<v-app-bar app>'], ['manual-scroll', '<v-app-bar :value="false">'], ['clipped-left', '<v-app-bar clipped-left>'], ['clipped-right', '<v-app-bar clipped-right>'], ['inverted-scroll', '<v-app-bar inverted-scroll>'], ['scroll-off-screen', '<v-app-bar scroll-off-screen>'], ['scroll-target', '<v-app-bar scroll-target>'], ['scroll-threshold', '<v-app-bar scroll-threshold>'], ['card', '<v-app-bar flat>']];
|
||
|
/* istanbul ignore next */
|
||
|
|
||
|
breakingProps.forEach(function (_ref) {
|
||
|
var _ref2 = _slicedToArray(_ref, 2),
|
||
|
original = _ref2[0],
|
||
|
replacement = _ref2[1];
|
||
|
|
||
|
if (_this.$attrs.hasOwnProperty(original)) (0, _console.breaking)(original, replacement, _this);
|
||
|
});
|
||
|
},
|
||
|
methods: {
|
||
|
genBackground: function genBackground() {
|
||
|
var props = {
|
||
|
height: (0, _helpers.convertToUnit)(this.computedHeight),
|
||
|
src: this.src
|
||
|
};
|
||
|
var image = this.$scopedSlots.img ? this.$scopedSlots.img({
|
||
|
props: props
|
||
|
}) : this.$createElement(_VImg.default, {
|
||
|
props: props
|
||
|
});
|
||
|
return this.$createElement('div', {
|
||
|
staticClass: 'v-toolbar__image'
|
||
|
}, [image]);
|
||
|
},
|
||
|
genContent: function genContent() {
|
||
|
return this.$createElement('div', {
|
||
|
staticClass: 'v-toolbar__content',
|
||
|
style: {
|
||
|
height: (0, _helpers.convertToUnit)(this.computedContentHeight)
|
||
|
}
|
||
|
}, (0, _helpers.getSlot)(this));
|
||
|
},
|
||
|
genExtension: function genExtension() {
|
||
|
return this.$createElement('div', {
|
||
|
staticClass: 'v-toolbar__extension',
|
||
|
style: {
|
||
|
height: (0, _helpers.convertToUnit)(this.extensionHeight)
|
||
|
}
|
||
|
}, (0, _helpers.getSlot)(this, 'extension'));
|
||
|
}
|
||
|
},
|
||
|
render: function render(h) {
|
||
|
this.isExtended = this.extended || !!this.$scopedSlots.extension;
|
||
|
var children = [this.genContent()];
|
||
|
var data = this.setBackgroundColor(this.color, {
|
||
|
class: this.classes,
|
||
|
style: this.styles,
|
||
|
on: this.$listeners
|
||
|
});
|
||
|
if (this.isExtended) children.push(this.genExtension());
|
||
|
if (this.src || this.$scopedSlots.img) children.unshift(this.genBackground());
|
||
|
return h(this.tag, data, children);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
exports.default = _default;
|
||
|
//# sourceMappingURL=VToolbar.js.map
|