Latest updates from IceHrmPro
This commit is contained in:
179
web/node_modules/antd/lib/skeleton/Skeleton.js
generated
vendored
Normal file
179
web/node_modules/antd/lib/skeleton/Skeleton.js
generated
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
var _Title = _interopRequireDefault(require("./Title"));
|
||||
|
||||
var _Paragraph = _interopRequireDefault(require("./Paragraph"));
|
||||
|
||||
var _configProvider = require("../config-provider");
|
||||
|
||||
var _Element = _interopRequireDefault(require("./Element"));
|
||||
|
||||
var _Avatar = _interopRequireDefault(require("./Avatar"));
|
||||
|
||||
var _Button = _interopRequireDefault(require("./Button"));
|
||||
|
||||
var _Input = _interopRequireDefault(require("./Input"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function getComponentProps(prop) {
|
||||
if (prop && _typeof(prop) === 'object') {
|
||||
return prop;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
function getAvatarBasicProps(hasTitle, hasParagraph) {
|
||||
if (hasTitle && !hasParagraph) {
|
||||
// Square avatar
|
||||
return {
|
||||
size: 'large',
|
||||
shape: 'square'
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
size: 'large',
|
||||
shape: 'circle'
|
||||
};
|
||||
}
|
||||
|
||||
function getTitleBasicProps(hasAvatar, hasParagraph) {
|
||||
if (!hasAvatar && hasParagraph) {
|
||||
return {
|
||||
width: '38%'
|
||||
};
|
||||
}
|
||||
|
||||
if (hasAvatar && hasParagraph) {
|
||||
return {
|
||||
width: '50%'
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
function getParagraphBasicProps(hasAvatar, hasTitle) {
|
||||
var basicProps = {}; // Width
|
||||
|
||||
if (!hasAvatar || !hasTitle) {
|
||||
basicProps.width = '61%';
|
||||
} // Rows
|
||||
|
||||
|
||||
if (!hasAvatar && hasTitle) {
|
||||
basicProps.rows = 3;
|
||||
} else {
|
||||
basicProps.rows = 2;
|
||||
}
|
||||
|
||||
return basicProps;
|
||||
}
|
||||
|
||||
var Skeleton = function Skeleton(props) {
|
||||
var renderSkeleton = function renderSkeleton(_ref) {
|
||||
var getPrefixCls = _ref.getPrefixCls,
|
||||
direction = _ref.direction;
|
||||
var customizePrefixCls = props.prefixCls,
|
||||
loading = props.loading,
|
||||
className = props.className,
|
||||
children = props.children,
|
||||
avatar = props.avatar,
|
||||
title = props.title,
|
||||
paragraph = props.paragraph,
|
||||
active = props.active;
|
||||
var prefixCls = getPrefixCls('skeleton', customizePrefixCls);
|
||||
|
||||
if (loading || !('loading' in props)) {
|
||||
var _classNames;
|
||||
|
||||
var hasAvatar = !!avatar;
|
||||
var hasTitle = !!title;
|
||||
var hasParagraph = !!paragraph; // Avatar
|
||||
|
||||
var avatarNode;
|
||||
|
||||
if (hasAvatar) {
|
||||
var avatarProps = _extends(_extends({
|
||||
prefixCls: "".concat(prefixCls, "-avatar")
|
||||
}, getAvatarBasicProps(hasTitle, hasParagraph)), getComponentProps(avatar)); // We direct use SkeletonElement as avatar in skeleton internal.
|
||||
|
||||
|
||||
avatarNode = /*#__PURE__*/React.createElement("div", {
|
||||
className: "".concat(prefixCls, "-header")
|
||||
}, /*#__PURE__*/React.createElement(_Element["default"], avatarProps));
|
||||
}
|
||||
|
||||
var contentNode;
|
||||
|
||||
if (hasTitle || hasParagraph) {
|
||||
// Title
|
||||
var $title;
|
||||
|
||||
if (hasTitle) {
|
||||
var titleProps = _extends(_extends({
|
||||
prefixCls: "".concat(prefixCls, "-title")
|
||||
}, getTitleBasicProps(hasAvatar, hasParagraph)), getComponentProps(title));
|
||||
|
||||
$title = /*#__PURE__*/React.createElement(_Title["default"], titleProps);
|
||||
} // Paragraph
|
||||
|
||||
|
||||
var paragraphNode;
|
||||
|
||||
if (hasParagraph) {
|
||||
var paragraphProps = _extends(_extends({
|
||||
prefixCls: "".concat(prefixCls, "-paragraph")
|
||||
}, getParagraphBasicProps(hasAvatar, hasTitle)), getComponentProps(paragraph));
|
||||
|
||||
paragraphNode = /*#__PURE__*/React.createElement(_Paragraph["default"], paragraphProps);
|
||||
}
|
||||
|
||||
contentNode = /*#__PURE__*/React.createElement("div", {
|
||||
className: "".concat(prefixCls, "-content")
|
||||
}, $title, paragraphNode);
|
||||
}
|
||||
|
||||
var cls = (0, _classnames["default"])(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-with-avatar"), hasAvatar), _defineProperty(_classNames, "".concat(prefixCls, "-active"), active), _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _classNames));
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
className: cls
|
||||
}, avatarNode, contentNode);
|
||||
}
|
||||
|
||||
return children;
|
||||
};
|
||||
|
||||
return /*#__PURE__*/React.createElement(_configProvider.ConfigConsumer, null, renderSkeleton);
|
||||
};
|
||||
|
||||
Skeleton.defaultProps = {
|
||||
avatar: false,
|
||||
title: true,
|
||||
paragraph: true
|
||||
};
|
||||
Skeleton.Button = _Button["default"];
|
||||
Skeleton.Avatar = _Avatar["default"];
|
||||
Skeleton.Input = _Input["default"];
|
||||
var _default = Skeleton;
|
||||
exports["default"] = _default;
|
||||
Reference in New Issue
Block a user