243 lines
9.3 KiB
JavaScript
243 lines
9.3 KiB
JavaScript
|
this.primereact = this.primereact || {};
|
||
|
this.primereact.csstransition = (function (exports, React, reactTransitionGroup, PrimeReact, utils) {
|
||
|
'use strict';
|
||
|
|
||
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||
|
|
||
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
||
|
var PrimeReact__default = /*#__PURE__*/_interopDefaultLegacy(PrimeReact);
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
function _classCallCheck(instance, Constructor) {
|
||
|
if (!(instance instanceof Constructor)) {
|
||
|
throw new TypeError("Cannot call a class as a function");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function _defineProperties(target, props) {
|
||
|
for (var i = 0; i < props.length; i++) {
|
||
|
var descriptor = props[i];
|
||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||
|
descriptor.configurable = true;
|
||
|
if ("value" in descriptor) descriptor.writable = true;
|
||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function _createClass(Constructor, protoProps, staticProps) {
|
||
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
||
|
Object.defineProperty(Constructor, "prototype", {
|
||
|
writable: false
|
||
|
});
|
||
|
return Constructor;
|
||
|
}
|
||
|
|
||
|
function _assertThisInitialized(self) {
|
||
|
if (self === void 0) {
|
||
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||
|
}
|
||
|
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
function _setPrototypeOf(o, p) {
|
||
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
||
|
o.__proto__ = p;
|
||
|
return o;
|
||
|
};
|
||
|
|
||
|
return _setPrototypeOf(o, p);
|
||
|
}
|
||
|
|
||
|
function _inherits(subClass, superClass) {
|
||
|
if (typeof superClass !== "function" && superClass !== null) {
|
||
|
throw new TypeError("Super expression must either be null or a function");
|
||
|
}
|
||
|
|
||
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||
|
constructor: {
|
||
|
value: subClass,
|
||
|
writable: true,
|
||
|
configurable: true
|
||
|
}
|
||
|
});
|
||
|
Object.defineProperty(subClass, "prototype", {
|
||
|
writable: false
|
||
|
});
|
||
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
||
|
}
|
||
|
|
||
|
function _typeof(obj) {
|
||
|
"@babel/helpers - typeof";
|
||
|
|
||
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
||
|
return typeof obj;
|
||
|
} : function (obj) {
|
||
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||
|
}, _typeof(obj);
|
||
|
}
|
||
|
|
||
|
function _possibleConstructorReturn(self, call) {
|
||
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
||
|
return call;
|
||
|
} else if (call !== void 0) {
|
||
|
throw new TypeError("Derived constructors may only return object or undefined");
|
||
|
}
|
||
|
|
||
|
return _assertThisInitialized(self);
|
||
|
}
|
||
|
|
||
|
function _getPrototypeOf(o) {
|
||
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
||
|
return o.__proto__ || Object.getPrototypeOf(o);
|
||
|
};
|
||
|
return _getPrototypeOf(o);
|
||
|
}
|
||
|
|
||
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
||
|
|
||
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||
|
|
||
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||
|
var CSSTransition = /*#__PURE__*/function (_Component) {
|
||
|
_inherits(CSSTransition, _Component);
|
||
|
|
||
|
var _super = _createSuper(CSSTransition);
|
||
|
|
||
|
function CSSTransition(props) {
|
||
|
var _this;
|
||
|
|
||
|
_classCallCheck(this, CSSTransition);
|
||
|
|
||
|
_this = _super.call(this, props);
|
||
|
_this.onEnter = _this.onEnter.bind(_assertThisInitialized(_this));
|
||
|
_this.onEntering = _this.onEntering.bind(_assertThisInitialized(_this));
|
||
|
_this.onEntered = _this.onEntered.bind(_assertThisInitialized(_this));
|
||
|
_this.onExit = _this.onExit.bind(_assertThisInitialized(_this));
|
||
|
_this.onExiting = _this.onExiting.bind(_assertThisInitialized(_this));
|
||
|
_this.onExited = _this.onExited.bind(_assertThisInitialized(_this));
|
||
|
return _this;
|
||
|
}
|
||
|
|
||
|
_createClass(CSSTransition, [{
|
||
|
key: "disabled",
|
||
|
get: function get() {
|
||
|
return this.props.disabled || this.props.options && this.props.options.disabled || !PrimeReact__default["default"].cssTransition;
|
||
|
}
|
||
|
}, {
|
||
|
key: "onEnter",
|
||
|
value: function onEnter(node, isAppearing) {
|
||
|
this.props.onEnter && this.props.onEnter(node, isAppearing); // component
|
||
|
|
||
|
this.props.options && this.props.options.onEnter && this.props.options.onEnter(node, isAppearing); // user option
|
||
|
}
|
||
|
}, {
|
||
|
key: "onEntering",
|
||
|
value: function onEntering(node, isAppearing) {
|
||
|
this.props.onEntering && this.props.onEntering(node, isAppearing); // component
|
||
|
|
||
|
this.props.options && this.props.options.onEntering && this.props.options.onEntering(node, isAppearing); // user option
|
||
|
}
|
||
|
}, {
|
||
|
key: "onEntered",
|
||
|
value: function onEntered(node, isAppearing) {
|
||
|
this.props.onEntered && this.props.onEntered(node, isAppearing); // component
|
||
|
|
||
|
this.props.options && this.props.options.onEntered && this.props.options.onEntered(node, isAppearing); // user option
|
||
|
}
|
||
|
}, {
|
||
|
key: "onExit",
|
||
|
value: function onExit(node) {
|
||
|
this.props.onExit && this.props.onExit(node); // component
|
||
|
|
||
|
this.props.options && this.props.options.onExit && this.props.options.onExit(node); // user option
|
||
|
}
|
||
|
}, {
|
||
|
key: "onExiting",
|
||
|
value: function onExiting(node) {
|
||
|
this.props.onExiting && this.props.onExiting(node); // component
|
||
|
|
||
|
this.props.options && this.props.options.onExiting && this.props.options.onExiting(node); // user option
|
||
|
}
|
||
|
}, {
|
||
|
key: "onExited",
|
||
|
value: function onExited(node) {
|
||
|
this.props.onExited && this.props.onExited(node); // component
|
||
|
|
||
|
this.props.options && this.props.options.onExited && this.props.options.onExited(node); // user option
|
||
|
}
|
||
|
}, {
|
||
|
key: "componentDidUpdate",
|
||
|
value: function componentDidUpdate(prevProps) {
|
||
|
if (this.props["in"] !== prevProps["in"] && this.disabled) {
|
||
|
// no animation
|
||
|
var node = utils.ObjectUtils.getRefElement(this.props.nodeRef);
|
||
|
|
||
|
if (this.props["in"]) {
|
||
|
this.onEnter(node, true);
|
||
|
this.onEntering(node, true);
|
||
|
this.onEntered(node, true);
|
||
|
} else {
|
||
|
this.onExit(node);
|
||
|
this.onExiting(node);
|
||
|
this.onExited(node);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}, {
|
||
|
key: "render",
|
||
|
value: function render() {
|
||
|
if (this.disabled) {
|
||
|
return this.props["in"] ? this.props.children : null;
|
||
|
} else {
|
||
|
var immutableProps = {
|
||
|
nodeRef: this.props.nodeRef,
|
||
|
"in": this.props["in"],
|
||
|
onEnter: this.onEnter,
|
||
|
onEntering: this.onEntering,
|
||
|
onEntered: this.onEntered,
|
||
|
onExit: this.onExit,
|
||
|
onExiting: this.onExiting,
|
||
|
onExited: this.onExited
|
||
|
};
|
||
|
var mutableProps = {
|
||
|
classNames: this.props.classNames,
|
||
|
timeout: this.props.timeout,
|
||
|
unmountOnExit: this.props.unmountOnExit
|
||
|
};
|
||
|
|
||
|
var props = _objectSpread(_objectSpread(_objectSpread({}, mutableProps), this.props.options || {}), immutableProps);
|
||
|
|
||
|
return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.CSSTransition, props, this.props.children);
|
||
|
}
|
||
|
}
|
||
|
}]);
|
||
|
|
||
|
return CSSTransition;
|
||
|
}(React.Component);
|
||
|
|
||
|
exports.CSSTransition = CSSTransition;
|
||
|
|
||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
|
||
|
return exports;
|
||
|
|
||
|
})({}, React, ReactTransitionGroup, primereact.api, primereact.utils);
|