This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/es5/components/VGrid/VCol.js

169 lines
5.3 KiB
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("../../../src/components/VGrid/VGrid.sass");
var _vue = _interopRequireDefault(require("vue"));
var _mergeData = _interopRequireDefault(require("../../util/mergeData"));
var _helpers = require("../../util/helpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; }
// no xs
var breakpoints = ['sm', 'md', 'lg', 'xl'];
var breakpointProps = function () {
return breakpoints.reduce(function (props, val) {
props[val] = {
type: [Boolean, String, Number],
default: false
};
return props;
}, {});
}();
var offsetProps = function () {
return breakpoints.reduce(function (props, val) {
props['offset' + (0, _helpers.upperFirst)(val)] = {
type: [String, Number],
default: null
};
return props;
}, {});
}();
var orderProps = function () {
return breakpoints.reduce(function (props, val) {
props['order' + (0, _helpers.upperFirst)(val)] = {
type: [String, Number],
default: null
};
return props;
}, {});
}();
var propMap = {
col: Object.keys(breakpointProps),
offset: Object.keys(offsetProps),
order: Object.keys(orderProps)
};
function breakpointClass(type, prop, val) {
var className = type;
if (val == null || val === false) {
return undefined;
}
if (prop) {
var breakpoint = prop.replace(type, '');
className += "-".concat(breakpoint);
} // Handling the boolean style prop when accepting [Boolean, String, Number]
// means Vue will not convert <v-col sm></v-col> to sm: true for us.
// Since the default is false, an empty string indicates the prop's presence.
if (type === 'col' && (val === '' || val === true)) {
// .col-md
return className.toLowerCase();
} // .order-md-6
className += "-".concat(val);
return className.toLowerCase();
}
var cache = new Map();
var _default = _vue.default.extend({
name: 'v-col',
functional: true,
props: _objectSpread({
cols: {
type: [Boolean, String, Number],
default: false
}
}, breakpointProps, {
offset: {
type: [String, Number],
default: null
}
}, offsetProps, {
order: {
type: [String, Number],
default: null
}
}, orderProps, {
alignSelf: {
type: String,
default: null,
validator: function validator(str) {
return ['auto', 'start', 'end', 'center', 'baseline', 'stretch'].includes(str);
}
},
tag: {
type: String,
default: 'div'
}
}),
render: function render(h, _ref) {
var props = _ref.props,
data = _ref.data,
children = _ref.children,
parent = _ref.parent;
// Super-fast memoization based on props, 5x faster than JSON.stringify
var cacheKey = '';
for (var prop in props) {
cacheKey += String(props[prop]);
}
var classList = cache.get(cacheKey);
if (!classList) {
(function () {
var _classList$push;
classList = []; // Loop through `col`, `offset`, `order` breakpoint props
var type;
for (type in propMap) {
propMap[type].forEach(function (prop) {
var value = props[prop];
var className = breakpointClass(type, prop, value);
if (className) classList.push(className);
});
}
var hasColClasses = classList.some(function (className) {
return className.startsWith('col-');
});
classList.push((_classList$push = {
// Default to .col if no other col-{bp}-* classes generated nor `cols` specified.
col: !hasColClasses || !props.cols
}, _defineProperty(_classList$push, "col-".concat(props.cols), props.cols), _defineProperty(_classList$push, "offset-".concat(props.offset), props.offset), _defineProperty(_classList$push, "order-".concat(props.order), props.order), _defineProperty(_classList$push, "align-self-".concat(props.alignSelf), props.alignSelf), _classList$push));
cache.set(cacheKey, classList);
})();
}
return h(props.tag, (0, _mergeData.default)(data, {
class: classList
}), children);
}
});
exports.default = _default;
//# sourceMappingURL=VCol.js.map