Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.3 KiB

4 years ago
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(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(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; }
// Generic Bootstrap v4 fade (no-fade) transition component
//
// Assumes that `show` class is not required when
// the transition has finished the enter transition
// (show and fade classes are only applied during transition)
import Vue, { mergeData } from '../vue';
import { NAME_TRANSITION } from '../constants/components';
import { isPlainObject } from './inspect';
var NO_FADE_PROPS = {
name: '',
enterClass: '',
enterActiveClass: '',
enterToClass: 'show',
leaveClass: 'show',
leaveActiveClass: '',
leaveToClass: ''
};
var FADE_PROPS = _objectSpread(_objectSpread({}, NO_FADE_PROPS), {}, {
enterActiveClass: 'fade',
leaveActiveClass: 'fade'
}); // @vue/component
export var BVTransition = /*#__PURE__*/Vue.extend({
name: NAME_TRANSITION,
functional: true,
props: {
noFade: {
// Only applicable to the built in transition
// Has no effect if `trans-props` provided
type: Boolean,
default: false
},
appear: {
// Has no effect if `trans-props` provided
type: Boolean,
default: false
},
mode: {
// Can be overridden by user supplied trans-props
type: String // default: undefined
},
// For user supplied transitions (if needed)
transProps: {
type: Object,
default: null
}
},
render: function render(h, _ref) {
var children = _ref.children,
data = _ref.data,
props = _ref.props;
var transProps = props.transProps;
if (!isPlainObject(transProps)) {
transProps = props.noFade ? NO_FADE_PROPS : FADE_PROPS;
if (props.appear) {
// Default the appear classes to equal the enter classes
transProps = _objectSpread(_objectSpread({}, transProps), {}, {
appear: true,
appearClass: transProps.enterClass,
appearActiveClass: transProps.enterActiveClass,
appearToClass: transProps.enterToClass
});
}
}
transProps = _objectSpread(_objectSpread({
mode: props.mode
}, transProps), {}, {
// We always need `css` true
css: true
});
return h('transition', // Any transition event listeners will get merged here
mergeData(data, {
props: transProps
}), children);
}
});
export default BVTransition;