Latest updates from IceHrmPro
This commit is contained in:
36
web/node_modules/antd/es/typography/Base.d.ts
generated
vendored
Normal file
36
web/node_modules/antd/es/typography/Base.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import { TypographyProps } from './Typography';
|
||||
export declare type BaseType = 'secondary' | 'danger' | 'warning';
|
||||
interface CopyConfig {
|
||||
text?: string;
|
||||
onCopy?: () => void;
|
||||
}
|
||||
interface EditConfig {
|
||||
editing?: boolean;
|
||||
onStart?: () => void;
|
||||
onChange?: (value: string) => void;
|
||||
}
|
||||
interface EllipsisConfig {
|
||||
rows?: number;
|
||||
expandable?: boolean;
|
||||
suffix?: string;
|
||||
onExpand?: React.MouseEventHandler<HTMLElement>;
|
||||
}
|
||||
export interface BlockProps extends TypographyProps {
|
||||
title?: string;
|
||||
editable?: boolean | EditConfig;
|
||||
copyable?: boolean | CopyConfig;
|
||||
type?: BaseType;
|
||||
disabled?: boolean;
|
||||
ellipsis?: boolean | EllipsisConfig;
|
||||
code?: boolean;
|
||||
mark?: boolean;
|
||||
underline?: boolean;
|
||||
delete?: boolean;
|
||||
strong?: boolean;
|
||||
}
|
||||
interface InternalBlockProps extends BlockProps {
|
||||
component: string;
|
||||
}
|
||||
declare const _default: React.FC<InternalBlockProps>;
|
||||
export default _default;
|
||||
521
web/node_modules/antd/es/typography/Base.js
generated
vendored
Normal file
521
web/node_modules/antd/es/typography/Base.js
generated
vendored
Normal file
@@ -0,0 +1,521 @@
|
||||
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
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 _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 _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); return Constructor; }
|
||||
|
||||
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var __rest = this && this.__rest || function (s, e) {
|
||||
var t = {};
|
||||
|
||||
for (var p in s) {
|
||||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
}
|
||||
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import toArray from "rc-util/es/Children/toArray";
|
||||
import findDOMNode from "rc-util/es/Dom/findDOMNode";
|
||||
import copy from 'copy-to-clipboard';
|
||||
import omit from 'omit.js';
|
||||
import EditOutlined from '@ant-design/icons/EditOutlined';
|
||||
import CheckOutlined from '@ant-design/icons/CheckOutlined';
|
||||
import CopyOutlined from '@ant-design/icons/CopyOutlined';
|
||||
import ResizeObserver from 'rc-resize-observer';
|
||||
import { configConsumerProps } from '../config-provider';
|
||||
import { withConfigConsumer } from '../config-provider/context';
|
||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||
import warning from '../_util/warning';
|
||||
import TransButton from '../_util/transButton';
|
||||
import raf from '../_util/raf';
|
||||
import isStyleSupport from '../_util/styleChecker';
|
||||
import Tooltip from '../tooltip';
|
||||
import Typography from './Typography';
|
||||
import Editable from './Editable';
|
||||
import measure from './util';
|
||||
var isLineClampSupport = isStyleSupport('webkitLineClamp');
|
||||
var isTextOverflowSupport = isStyleSupport('textOverflow');
|
||||
|
||||
function wrapperDecorations(_ref, content) {
|
||||
var mark = _ref.mark,
|
||||
code = _ref.code,
|
||||
underline = _ref.underline,
|
||||
del = _ref["delete"],
|
||||
strong = _ref.strong;
|
||||
var currentContent = content;
|
||||
|
||||
function wrap(needed, tag) {
|
||||
if (!needed) return;
|
||||
currentContent = React.createElement(tag, {}, currentContent);
|
||||
}
|
||||
|
||||
wrap(strong, 'strong');
|
||||
wrap(underline, 'u');
|
||||
wrap(del, 'del');
|
||||
wrap(code, 'code');
|
||||
wrap(mark, 'mark');
|
||||
return currentContent;
|
||||
}
|
||||
|
||||
var ELLIPSIS_STR = '...';
|
||||
|
||||
var Base = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(Base, _React$Component);
|
||||
|
||||
var _super = _createSuper(Base);
|
||||
|
||||
function Base() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Base);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
_this.state = {
|
||||
edit: false,
|
||||
copied: false,
|
||||
ellipsisText: '',
|
||||
ellipsisContent: null,
|
||||
isEllipsis: false,
|
||||
expanded: false,
|
||||
clientRendered: false
|
||||
}; // =============== Expand ===============
|
||||
|
||||
_this.onExpandClick = function (e) {
|
||||
var _this$getEllipsis = _this.getEllipsis(),
|
||||
onExpand = _this$getEllipsis.onExpand;
|
||||
|
||||
_this.setState({
|
||||
expanded: true
|
||||
});
|
||||
|
||||
if (onExpand) {
|
||||
onExpand(e);
|
||||
}
|
||||
}; // ================ Edit ================
|
||||
|
||||
|
||||
_this.onEditClick = function () {
|
||||
_this.triggerEdit(true);
|
||||
};
|
||||
|
||||
_this.onEditChange = function (value) {
|
||||
var _this$getEditable = _this.getEditable(),
|
||||
onChange = _this$getEditable.onChange;
|
||||
|
||||
if (onChange) {
|
||||
onChange(value);
|
||||
}
|
||||
|
||||
_this.triggerEdit(false);
|
||||
};
|
||||
|
||||
_this.onEditCancel = function () {
|
||||
_this.triggerEdit(false);
|
||||
}; // ================ Copy ================
|
||||
|
||||
|
||||
_this.onCopyClick = function () {
|
||||
var _this$props = _this.props,
|
||||
children = _this$props.children,
|
||||
copyable = _this$props.copyable;
|
||||
|
||||
var copyConfig = _extends({}, _typeof(copyable) === 'object' ? copyable : null);
|
||||
|
||||
if (copyConfig.text === undefined) {
|
||||
copyConfig.text = String(children);
|
||||
}
|
||||
|
||||
copy(copyConfig.text || '');
|
||||
|
||||
_this.setState({
|
||||
copied: true
|
||||
}, function () {
|
||||
if (copyConfig.onCopy) {
|
||||
copyConfig.onCopy();
|
||||
}
|
||||
|
||||
_this.copyId = window.setTimeout(function () {
|
||||
_this.setState({
|
||||
copied: false
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
};
|
||||
|
||||
_this.setContentRef = function (node) {
|
||||
_this.content = node;
|
||||
};
|
||||
|
||||
_this.setEditRef = function (node) {
|
||||
_this.editIcon = node;
|
||||
};
|
||||
|
||||
_this.triggerEdit = function (edit) {
|
||||
var _this$getEditable2 = _this.getEditable(),
|
||||
onStart = _this$getEditable2.onStart;
|
||||
|
||||
if (edit && onStart) {
|
||||
onStart();
|
||||
}
|
||||
|
||||
_this.setState({
|
||||
edit: edit
|
||||
}, function () {
|
||||
if (!edit && _this.editIcon) {
|
||||
_this.editIcon.focus();
|
||||
}
|
||||
});
|
||||
}; // ============== Ellipsis ==============
|
||||
|
||||
|
||||
_this.resizeOnNextFrame = function () {
|
||||
raf.cancel(_this.rafId);
|
||||
_this.rafId = raf(function () {
|
||||
// Do not bind `syncEllipsis`. It need for test usage on prototype
|
||||
_this.syncEllipsis();
|
||||
});
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Base, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.setState({
|
||||
clientRendered: true
|
||||
});
|
||||
this.resizeOnNextFrame();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
var children = this.props.children;
|
||||
var ellipsis = this.getEllipsis();
|
||||
var prevEllipsis = this.getEllipsis(prevProps);
|
||||
|
||||
if (children !== prevProps.children || ellipsis.rows !== prevEllipsis.rows) {
|
||||
this.resizeOnNextFrame();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
window.clearTimeout(this.copyId);
|
||||
raf.cancel(this.rafId);
|
||||
}
|
||||
}, {
|
||||
key: "getEditable",
|
||||
value: function getEditable(props) {
|
||||
var edit = this.state.edit;
|
||||
|
||||
var _ref2 = props || this.props,
|
||||
editable = _ref2.editable;
|
||||
|
||||
if (!editable) return {
|
||||
editing: edit
|
||||
};
|
||||
return _extends({
|
||||
editing: edit
|
||||
}, _typeof(editable) === 'object' ? editable : null);
|
||||
}
|
||||
}, {
|
||||
key: "getEllipsis",
|
||||
value: function getEllipsis(props) {
|
||||
var _ref3 = props || this.props,
|
||||
ellipsis = _ref3.ellipsis;
|
||||
|
||||
if (!ellipsis) return {};
|
||||
return _extends({
|
||||
rows: 1,
|
||||
expandable: false
|
||||
}, _typeof(ellipsis) === 'object' ? ellipsis : null);
|
||||
}
|
||||
}, {
|
||||
key: "canUseCSSEllipsis",
|
||||
value: function canUseCSSEllipsis() {
|
||||
var clientRendered = this.state.clientRendered;
|
||||
var _this$props2 = this.props,
|
||||
editable = _this$props2.editable,
|
||||
copyable = _this$props2.copyable;
|
||||
|
||||
var _this$getEllipsis2 = this.getEllipsis(),
|
||||
rows = _this$getEllipsis2.rows,
|
||||
expandable = _this$getEllipsis2.expandable,
|
||||
suffix = _this$getEllipsis2.suffix;
|
||||
|
||||
if (suffix) return false; // Can't use css ellipsis since we need to provide the place for button
|
||||
|
||||
if (editable || copyable || expandable || !clientRendered) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rows === 1) {
|
||||
return isTextOverflowSupport;
|
||||
}
|
||||
|
||||
return isLineClampSupport;
|
||||
}
|
||||
}, {
|
||||
key: "syncEllipsis",
|
||||
value: function syncEllipsis() {
|
||||
var _this$state = this.state,
|
||||
ellipsisText = _this$state.ellipsisText,
|
||||
isEllipsis = _this$state.isEllipsis,
|
||||
expanded = _this$state.expanded;
|
||||
|
||||
var _this$getEllipsis3 = this.getEllipsis(),
|
||||
rows = _this$getEllipsis3.rows,
|
||||
suffix = _this$getEllipsis3.suffix;
|
||||
|
||||
var children = this.props.children;
|
||||
if (!rows || rows < 0 || !this.content || expanded) return; // Do not measure if css already support ellipsis
|
||||
|
||||
if (this.canUseCSSEllipsis()) return;
|
||||
warning(toArray(children).every(function (child) {
|
||||
return typeof child === 'string';
|
||||
}), 'Typography', '`ellipsis` should use string as children only.');
|
||||
|
||||
var _measure = measure(findDOMNode(this.content), {
|
||||
rows: rows,
|
||||
suffix: suffix
|
||||
}, children, this.renderOperations(true), ELLIPSIS_STR),
|
||||
content = _measure.content,
|
||||
text = _measure.text,
|
||||
ellipsis = _measure.ellipsis;
|
||||
|
||||
if (ellipsisText !== text || isEllipsis !== ellipsis) {
|
||||
this.setState({
|
||||
ellipsisText: text,
|
||||
ellipsisContent: content,
|
||||
isEllipsis: ellipsis
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "renderExpand",
|
||||
value: function renderExpand(forceRender) {
|
||||
var _this$getEllipsis4 = this.getEllipsis(),
|
||||
expandable = _this$getEllipsis4.expandable;
|
||||
|
||||
var prefixCls = this.props.prefixCls;
|
||||
var _this$state2 = this.state,
|
||||
expanded = _this$state2.expanded,
|
||||
isEllipsis = _this$state2.isEllipsis;
|
||||
if (!expandable) return null; // force render expand icon for measure usage or it will cause dead loop
|
||||
|
||||
if (!forceRender && (expanded || !isEllipsis)) return null;
|
||||
return /*#__PURE__*/React.createElement("a", {
|
||||
key: "expand",
|
||||
className: "".concat(prefixCls, "-expand"),
|
||||
onClick: this.onExpandClick,
|
||||
"aria-label": this.expandStr
|
||||
}, this.expandStr);
|
||||
}
|
||||
}, {
|
||||
key: "renderEdit",
|
||||
value: function renderEdit() {
|
||||
var _this$props3 = this.props,
|
||||
editable = _this$props3.editable,
|
||||
prefixCls = _this$props3.prefixCls;
|
||||
if (!editable) return;
|
||||
return /*#__PURE__*/React.createElement(Tooltip, {
|
||||
key: "edit",
|
||||
title: this.editStr
|
||||
}, /*#__PURE__*/React.createElement(TransButton, {
|
||||
ref: this.setEditRef,
|
||||
className: "".concat(prefixCls, "-edit"),
|
||||
onClick: this.onEditClick,
|
||||
"aria-label": this.editStr
|
||||
}, /*#__PURE__*/React.createElement(EditOutlined, {
|
||||
role: "button"
|
||||
})));
|
||||
}
|
||||
}, {
|
||||
key: "renderCopy",
|
||||
value: function renderCopy() {
|
||||
var copied = this.state.copied;
|
||||
var _this$props4 = this.props,
|
||||
copyable = _this$props4.copyable,
|
||||
prefixCls = _this$props4.prefixCls;
|
||||
if (!copyable) return;
|
||||
var title = copied ? this.copiedStr : this.copyStr;
|
||||
return /*#__PURE__*/React.createElement(Tooltip, {
|
||||
key: "copy",
|
||||
title: title
|
||||
}, /*#__PURE__*/React.createElement(TransButton, {
|
||||
className: classNames("".concat(prefixCls, "-copy"), copied && "".concat(prefixCls, "-copy-success")),
|
||||
onClick: this.onCopyClick,
|
||||
"aria-label": title
|
||||
}, copied ? /*#__PURE__*/React.createElement(CheckOutlined, null) : /*#__PURE__*/React.createElement(CopyOutlined, null)));
|
||||
}
|
||||
}, {
|
||||
key: "renderEditInput",
|
||||
value: function renderEditInput() {
|
||||
var _this$props5 = this.props,
|
||||
children = _this$props5.children,
|
||||
prefixCls = _this$props5.prefixCls,
|
||||
className = _this$props5.className,
|
||||
style = _this$props5.style,
|
||||
direction = _this$props5.direction;
|
||||
return /*#__PURE__*/React.createElement(Editable, {
|
||||
value: typeof children === 'string' ? children : '',
|
||||
onSave: this.onEditChange,
|
||||
onCancel: this.onEditCancel,
|
||||
prefixCls: prefixCls,
|
||||
className: className,
|
||||
style: style,
|
||||
direction: direction
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderOperations",
|
||||
value: function renderOperations(forceRenderExpanded) {
|
||||
return [this.renderExpand(forceRenderExpanded), this.renderEdit(), this.renderCopy()].filter(function (node) {
|
||||
return node;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderContent",
|
||||
value: function renderContent() {
|
||||
var _this2 = this;
|
||||
|
||||
var _this$state3 = this.state,
|
||||
ellipsisContent = _this$state3.ellipsisContent,
|
||||
isEllipsis = _this$state3.isEllipsis,
|
||||
expanded = _this$state3.expanded;
|
||||
|
||||
var _a = this.props,
|
||||
component = _a.component,
|
||||
children = _a.children,
|
||||
className = _a.className,
|
||||
prefixCls = _a.prefixCls,
|
||||
type = _a.type,
|
||||
disabled = _a.disabled,
|
||||
style = _a.style,
|
||||
title = _a.title,
|
||||
restProps = __rest(_a, ["component", "children", "className", "prefixCls", "type", "disabled", "style", "title"]);
|
||||
|
||||
var _this$getEllipsis5 = this.getEllipsis(),
|
||||
rows = _this$getEllipsis5.rows,
|
||||
suffix = _this$getEllipsis5.suffix;
|
||||
|
||||
var textProps = omit(restProps, ['prefixCls', 'editable', 'copyable', 'ellipsis', 'mark', 'underline', 'mark', 'code', 'delete', 'underline', 'strong'].concat(_toConsumableArray(configConsumerProps)));
|
||||
var cssEllipsis = this.canUseCSSEllipsis();
|
||||
var cssTextOverflow = rows === 1 && cssEllipsis;
|
||||
var cssLineClamp = rows && rows > 1 && cssEllipsis;
|
||||
var textNode = children;
|
||||
var ariaLabel; // Only use js ellipsis when css ellipsis not support
|
||||
|
||||
if (rows && isEllipsis && !expanded && !cssEllipsis) {
|
||||
ariaLabel = title;
|
||||
|
||||
if (!title && (typeof children === 'string' || typeof children === 'number')) {
|
||||
ariaLabel = String(children);
|
||||
} // We move full content to outer element to avoid repeat read the content by accessibility
|
||||
|
||||
|
||||
textNode = /*#__PURE__*/React.createElement("span", {
|
||||
title: ariaLabel,
|
||||
"aria-hidden": "true"
|
||||
}, ellipsisContent, ELLIPSIS_STR, suffix);
|
||||
} else {
|
||||
textNode = /*#__PURE__*/React.createElement(React.Fragment, null, children, suffix);
|
||||
}
|
||||
|
||||
textNode = wrapperDecorations(this.props, textNode);
|
||||
return /*#__PURE__*/React.createElement(LocaleReceiver, {
|
||||
componentName: "Text"
|
||||
}, function (_ref4) {
|
||||
var _classNames;
|
||||
|
||||
var edit = _ref4.edit,
|
||||
copyStr = _ref4.copy,
|
||||
copied = _ref4.copied,
|
||||
expand = _ref4.expand;
|
||||
_this2.editStr = edit;
|
||||
_this2.copyStr = copyStr;
|
||||
_this2.copiedStr = copied;
|
||||
_this2.expandStr = expand;
|
||||
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
||||
onResize: _this2.resizeOnNextFrame,
|
||||
disabled: !rows
|
||||
}, /*#__PURE__*/React.createElement(Typography, _extends({
|
||||
className: classNames(className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(type), type), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames, "".concat(prefixCls, "-ellipsis"), rows), _defineProperty(_classNames, "".concat(prefixCls, "-ellipsis-single-line"), cssTextOverflow), _defineProperty(_classNames, "".concat(prefixCls, "-ellipsis-multiple-line"), cssLineClamp), _classNames)),
|
||||
style: _extends(_extends({}, style), {
|
||||
WebkitLineClamp: cssLineClamp ? rows : null
|
||||
}),
|
||||
component: component,
|
||||
ref: _this2.setContentRef,
|
||||
"aria-label": ariaLabel
|
||||
}, textProps), textNode, _this2.renderOperations()));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$getEditable3 = this.getEditable(),
|
||||
editing = _this$getEditable3.editing;
|
||||
|
||||
if (editing) {
|
||||
return this.renderEditInput();
|
||||
}
|
||||
|
||||
return this.renderContent();
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps) {
|
||||
var children = nextProps.children,
|
||||
editable = nextProps.editable;
|
||||
warning(!editable || typeof children === 'string', 'Typography', 'When `editable` is enabled, the `children` should use string.');
|
||||
return {};
|
||||
}
|
||||
}]);
|
||||
|
||||
return Base;
|
||||
}(React.Component);
|
||||
|
||||
Base.defaultProps = {
|
||||
children: ''
|
||||
};
|
||||
export default withConfigConsumer({
|
||||
prefixCls: 'typography'
|
||||
})(Base);
|
||||
36
web/node_modules/antd/es/typography/Editable.d.ts
generated
vendored
Normal file
36
web/node_modules/antd/es/typography/Editable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import TextArea from '../input/TextArea';
|
||||
interface EditableProps {
|
||||
prefixCls?: string;
|
||||
value?: string;
|
||||
['aria-label']?: string;
|
||||
onSave: (value: string) => void;
|
||||
onCancel: () => void;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
direction?: 'ltr' | 'rtl';
|
||||
}
|
||||
interface EditableState {
|
||||
current: string;
|
||||
prevValue?: string;
|
||||
}
|
||||
declare class Editable extends React.Component<EditableProps, EditableState> {
|
||||
static getDerivedStateFromProps(nextProps: EditableProps, prevState: EditableState): Partial<EditableState>;
|
||||
textarea?: TextArea;
|
||||
lastKeyCode?: number;
|
||||
inComposition?: boolean;
|
||||
state: {
|
||||
current: string;
|
||||
};
|
||||
componentDidMount(): void;
|
||||
onChange: React.ChangeEventHandler<HTMLTextAreaElement>;
|
||||
onCompositionStart: () => void;
|
||||
onCompositionEnd: () => void;
|
||||
onKeyDown: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
||||
onKeyUp: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
||||
onBlur: React.FocusEventHandler<HTMLTextAreaElement>;
|
||||
confirmChange: () => void;
|
||||
setTextarea: (textarea: TextArea) => void;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default Editable;
|
||||
163
web/node_modules/antd/es/typography/Editable.js
generated
vendored
Normal file
163
web/node_modules/antd/es/typography/Editable.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
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 _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); return Constructor; }
|
||||
|
||||
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import EnterOutlined from '@ant-design/icons/EnterOutlined';
|
||||
import TextArea from '../input/TextArea';
|
||||
|
||||
var Editable = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(Editable, _React$Component);
|
||||
|
||||
var _super = _createSuper(Editable);
|
||||
|
||||
function Editable() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Editable);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
_this.inComposition = false;
|
||||
_this.state = {
|
||||
current: ''
|
||||
};
|
||||
|
||||
_this.onChange = function (_ref) {
|
||||
var value = _ref.target.value;
|
||||
|
||||
_this.setState({
|
||||
current: value.replace(/[\n\r]/g, '')
|
||||
});
|
||||
};
|
||||
|
||||
_this.onCompositionStart = function () {
|
||||
_this.inComposition = true;
|
||||
};
|
||||
|
||||
_this.onCompositionEnd = function () {
|
||||
_this.inComposition = false;
|
||||
};
|
||||
|
||||
_this.onKeyDown = function (_ref2) {
|
||||
var keyCode = _ref2.keyCode;
|
||||
// We don't record keyCode when IME is using
|
||||
if (_this.inComposition) return;
|
||||
_this.lastKeyCode = keyCode;
|
||||
};
|
||||
|
||||
_this.onKeyUp = function (_ref3) {
|
||||
var keyCode = _ref3.keyCode,
|
||||
ctrlKey = _ref3.ctrlKey,
|
||||
altKey = _ref3.altKey,
|
||||
metaKey = _ref3.metaKey,
|
||||
shiftKey = _ref3.shiftKey;
|
||||
var onCancel = _this.props.onCancel; // Check if it's a real key
|
||||
|
||||
if (_this.lastKeyCode === keyCode && !_this.inComposition && !ctrlKey && !altKey && !metaKey && !shiftKey) {
|
||||
if (keyCode === KeyCode.ENTER) {
|
||||
_this.confirmChange();
|
||||
} else if (keyCode === KeyCode.ESC) {
|
||||
onCancel();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_this.onBlur = function () {
|
||||
_this.confirmChange();
|
||||
};
|
||||
|
||||
_this.confirmChange = function () {
|
||||
var current = _this.state.current;
|
||||
var onSave = _this.props.onSave;
|
||||
onSave(current.trim());
|
||||
};
|
||||
|
||||
_this.setTextarea = function (textarea) {
|
||||
_this.textarea = textarea;
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Editable, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
if (this.textarea && this.textarea.resizableTextArea) {
|
||||
var textArea = this.textarea.resizableTextArea.textArea;
|
||||
textArea.focus();
|
||||
var length = textArea.value.length;
|
||||
textArea.setSelectionRange(length, length);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var current = this.state.current;
|
||||
var _this$props = this.props,
|
||||
prefixCls = _this$props.prefixCls,
|
||||
ariaLabel = _this$props['aria-label'],
|
||||
className = _this$props.className,
|
||||
style = _this$props.style,
|
||||
direction = _this$props.direction;
|
||||
var textAreaClassName = classNames(prefixCls, className, "".concat(prefixCls, "-edit-content"), _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'));
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
className: textAreaClassName,
|
||||
style: style
|
||||
}, /*#__PURE__*/React.createElement(TextArea, {
|
||||
ref: this.setTextarea,
|
||||
value: current,
|
||||
onChange: this.onChange,
|
||||
onKeyDown: this.onKeyDown,
|
||||
onKeyUp: this.onKeyUp,
|
||||
onCompositionStart: this.onCompositionStart,
|
||||
onCompositionEnd: this.onCompositionEnd,
|
||||
onBlur: this.onBlur,
|
||||
"aria-label": ariaLabel,
|
||||
autoSize: true
|
||||
}), /*#__PURE__*/React.createElement(EnterOutlined, {
|
||||
className: "".concat(prefixCls, "-edit-content-confirm")
|
||||
}));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
var prevValue = prevState.prevValue;
|
||||
var value = nextProps.value;
|
||||
var newState = {
|
||||
prevValue: value
|
||||
};
|
||||
|
||||
if (prevValue !== value) {
|
||||
newState.current = value;
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Editable;
|
||||
}(React.Component);
|
||||
|
||||
export default Editable;
|
||||
6
web/node_modules/antd/es/typography/Paragraph.d.ts
generated
vendored
Normal file
6
web/node_modules/antd/es/typography/Paragraph.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { BlockProps } from './Base';
|
||||
export interface ParagraphProps extends BlockProps {
|
||||
}
|
||||
declare const Paragraph: React.FC<ParagraphProps>;
|
||||
export default Paragraph;
|
||||
12
web/node_modules/antd/es/typography/Paragraph.js
generated
vendored
Normal file
12
web/node_modules/antd/es/typography/Paragraph.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
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); }
|
||||
|
||||
import * as React from 'react';
|
||||
import Base from './Base';
|
||||
|
||||
var Paragraph = function Paragraph(props) {
|
||||
return /*#__PURE__*/React.createElement(Base, _extends({}, props, {
|
||||
component: "div"
|
||||
}));
|
||||
};
|
||||
|
||||
export default Paragraph;
|
||||
7
web/node_modules/antd/es/typography/Text.d.ts
generated
vendored
Normal file
7
web/node_modules/antd/es/typography/Text.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { BlockProps } from './Base';
|
||||
export interface TextProps extends BlockProps {
|
||||
ellipsis?: boolean;
|
||||
}
|
||||
declare const Text: React.FC<TextProps>;
|
||||
export default Text;
|
||||
33
web/node_modules/antd/es/typography/Text.js
generated
vendored
Normal file
33
web/node_modules/antd/es/typography/Text.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
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); }
|
||||
|
||||
var __rest = this && this.__rest || function (s, e) {
|
||||
var t = {};
|
||||
|
||||
for (var p in s) {
|
||||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
}
|
||||
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
import * as React from 'react';
|
||||
import warning from '../_util/warning';
|
||||
import Base from './Base';
|
||||
|
||||
var Text = function Text(_a) {
|
||||
var ellipsis = _a.ellipsis,
|
||||
restProps = __rest(_a, ["ellipsis"]);
|
||||
|
||||
warning(_typeof(ellipsis) !== 'object', 'Typography.Text', '`ellipsis` only supports boolean value.');
|
||||
return /*#__PURE__*/React.createElement(Base, _extends({}, restProps, {
|
||||
ellipsis: !!ellipsis,
|
||||
component: "span"
|
||||
}));
|
||||
};
|
||||
|
||||
export default Text;
|
||||
9
web/node_modules/antd/es/typography/Title.d.ts
generated
vendored
Normal file
9
web/node_modules/antd/es/typography/Title.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { BlockProps } from './Base';
|
||||
import { Omit } from '../_util/type';
|
||||
declare const TITLE_ELE_LIST: [1, 2, 3, 4];
|
||||
export declare type TitleProps = Omit<BlockProps & {
|
||||
level?: typeof TITLE_ELE_LIST[number];
|
||||
}, 'strong'>;
|
||||
declare const Title: React.FC<TitleProps>;
|
||||
export default Title;
|
||||
41
web/node_modules/antd/es/typography/Title.js
generated
vendored
Normal file
41
web/node_modules/antd/es/typography/Title.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
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); }
|
||||
|
||||
var __rest = this && this.__rest || function (s, e) {
|
||||
var t = {};
|
||||
|
||||
for (var p in s) {
|
||||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
}
|
||||
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
import * as React from 'react';
|
||||
import warning from 'warning';
|
||||
import Base from './Base';
|
||||
import { tupleNum } from '../_util/type';
|
||||
var TITLE_ELE_LIST = tupleNum(1, 2, 3, 4);
|
||||
|
||||
var Title = function Title(props) {
|
||||
var _props$level = props.level,
|
||||
level = _props$level === void 0 ? 1 : _props$level,
|
||||
restProps = __rest(props, ["level"]);
|
||||
|
||||
var component;
|
||||
|
||||
if (TITLE_ELE_LIST.indexOf(level) !== -1) {
|
||||
component = "h".concat(level);
|
||||
} else {
|
||||
warning(false, 'Title only accept `1 | 2 | 3 | 4` as `level` value.');
|
||||
component = 'h1';
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(Base, _extends({}, restProps, {
|
||||
component: component
|
||||
}));
|
||||
};
|
||||
|
||||
export default Title;
|
||||
11
web/node_modules/antd/es/typography/Typography.d.ts
generated
vendored
Normal file
11
web/node_modules/antd/es/typography/Typography.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
export interface TypographyProps {
|
||||
id?: string;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
children?: React.ReactNode;
|
||||
['aria-label']?: string;
|
||||
}
|
||||
declare const ExportTypography: React.FC<TypographyProps>;
|
||||
export default ExportTypography;
|
||||
113
web/node_modules/antd/es/typography/Typography.js
generated
vendored
Normal file
113
web/node_modules/antd/es/typography/Typography.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
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 _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); return Constructor; }
|
||||
|
||||
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
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 _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; }
|
||||
|
||||
var __rest = this && this.__rest || function (s, e) {
|
||||
var t = {};
|
||||
|
||||
for (var p in s) {
|
||||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
}
|
||||
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { ConfigConsumer } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import { composeRef } from '../_util/ref';
|
||||
|
||||
var Typography = function Typography(_a, ref) {
|
||||
var customizePrefixCls = _a.prefixCls,
|
||||
_a$component = _a.component,
|
||||
component = _a$component === void 0 ? 'article' : _a$component,
|
||||
className = _a.className,
|
||||
ariaLabel = _a['aria-label'],
|
||||
setContentRef = _a.setContentRef,
|
||||
children = _a.children,
|
||||
restProps = __rest(_a, ["prefixCls", "component", "className", 'aria-label', "setContentRef", "children"]);
|
||||
|
||||
var mergedRef = ref;
|
||||
|
||||
if (setContentRef) {
|
||||
warning(false, 'Typography', '`setContentRef` is deprecated. Please use `ref` instead.');
|
||||
mergedRef = composeRef(ref, setContentRef);
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref) {
|
||||
var getPrefixCls = _ref.getPrefixCls,
|
||||
direction = _ref.direction;
|
||||
var Component = component;
|
||||
var prefixCls = getPrefixCls('typography', customizePrefixCls);
|
||||
var componentClassName = classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'));
|
||||
return /*#__PURE__*/React.createElement(Component, _extends({
|
||||
className: componentClassName,
|
||||
"aria-label": ariaLabel,
|
||||
ref: mergedRef
|
||||
}, restProps), children);
|
||||
});
|
||||
};
|
||||
|
||||
var RefTypography;
|
||||
|
||||
if (React.forwardRef) {
|
||||
RefTypography = React.forwardRef(Typography);
|
||||
RefTypography.displayName = 'Typography';
|
||||
} else {
|
||||
var TypographyWrapper = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(TypographyWrapper, _React$Component);
|
||||
|
||||
var _super = _createSuper(TypographyWrapper);
|
||||
|
||||
function TypographyWrapper() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, TypographyWrapper);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
_this.state = {};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(TypographyWrapper, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return /*#__PURE__*/React.createElement(Typography, this.props);
|
||||
}
|
||||
}]);
|
||||
|
||||
return TypographyWrapper;
|
||||
}(React.Component);
|
||||
|
||||
RefTypography = TypographyWrapper;
|
||||
} // es default export should use const instead of let
|
||||
|
||||
|
||||
var ExportTypography = RefTypography;
|
||||
export default ExportTypography;
|
||||
11
web/node_modules/antd/es/typography/index.d.ts
generated
vendored
Normal file
11
web/node_modules/antd/es/typography/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import OriginTypography from './Typography';
|
||||
import Text from './Text';
|
||||
import Title from './Title';
|
||||
import Paragraph from './Paragraph';
|
||||
export declare type TypographyProps = typeof OriginTypography & {
|
||||
Text: typeof Text;
|
||||
Title: typeof Title;
|
||||
Paragraph: typeof Paragraph;
|
||||
};
|
||||
declare const Typography: TypographyProps;
|
||||
export default Typography;
|
||||
9
web/node_modules/antd/es/typography/index.js
generated
vendored
Normal file
9
web/node_modules/antd/es/typography/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import OriginTypography from './Typography';
|
||||
import Text from './Text';
|
||||
import Title from './Title';
|
||||
import Paragraph from './Paragraph';
|
||||
var Typography = OriginTypography;
|
||||
Typography.Text = Text;
|
||||
Typography.Title = Title;
|
||||
Typography.Paragraph = Paragraph;
|
||||
export default Typography;
|
||||
5
web/node_modules/antd/es/typography/style/css.js
generated
vendored
Normal file
5
web/node_modules/antd/es/typography/style/css.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import '../../style/index.css';
|
||||
import './index.css'; // style dependencies
|
||||
|
||||
import '../../tooltip/style/css';
|
||||
import '../../input/style/css';
|
||||
255
web/node_modules/antd/es/typography/style/index.css
generated
vendored
Normal file
255
web/node_modules/antd/es/typography/style/index.css
generated
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
|
||||
/* stylelint-disable no-duplicate-selectors */
|
||||
/* stylelint-disable */
|
||||
/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
|
||||
.ant-typography {
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
}
|
||||
.ant-typography.ant-typography-secondary {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
.ant-typography.ant-typography-warning {
|
||||
color: #faad14;
|
||||
}
|
||||
.ant-typography.ant-typography-danger {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
.ant-typography.ant-typography-disabled {
|
||||
color: rgba(0, 0, 0, 0.25);
|
||||
cursor: not-allowed;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
div.ant-typography,
|
||||
.ant-typography p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
h1.ant-typography,
|
||||
.ant-typography h1 {
|
||||
margin-bottom: 0.5em;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
font-weight: 600;
|
||||
font-size: 38px;
|
||||
line-height: 1.23;
|
||||
}
|
||||
h2.ant-typography,
|
||||
.ant-typography h2 {
|
||||
margin-bottom: 0.5em;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
font-weight: 600;
|
||||
font-size: 30px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
h3.ant-typography,
|
||||
.ant-typography h3 {
|
||||
margin-bottom: 0.5em;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
font-weight: 600;
|
||||
font-size: 24px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
h4.ant-typography,
|
||||
.ant-typography h4 {
|
||||
margin-bottom: 0.5em;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
font-weight: 600;
|
||||
font-size: 20px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.ant-typography + h1.ant-typography,
|
||||
.ant-typography + h2.ant-typography,
|
||||
.ant-typography + h3.ant-typography,
|
||||
.ant-typography + h4.ant-typography {
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
.ant-typography div + h1,
|
||||
.ant-typography ul + h1,
|
||||
.ant-typography li + h1,
|
||||
.ant-typography p + h1,
|
||||
.ant-typography h1 + h1,
|
||||
.ant-typography h2 + h1,
|
||||
.ant-typography h3 + h1,
|
||||
.ant-typography h4 + h1,
|
||||
.ant-typography div + h2,
|
||||
.ant-typography ul + h2,
|
||||
.ant-typography li + h2,
|
||||
.ant-typography p + h2,
|
||||
.ant-typography h1 + h2,
|
||||
.ant-typography h2 + h2,
|
||||
.ant-typography h3 + h2,
|
||||
.ant-typography h4 + h2,
|
||||
.ant-typography div + h3,
|
||||
.ant-typography ul + h3,
|
||||
.ant-typography li + h3,
|
||||
.ant-typography p + h3,
|
||||
.ant-typography h1 + h3,
|
||||
.ant-typography h2 + h3,
|
||||
.ant-typography h3 + h3,
|
||||
.ant-typography h4 + h3,
|
||||
.ant-typography div + h4,
|
||||
.ant-typography ul + h4,
|
||||
.ant-typography li + h4,
|
||||
.ant-typography p + h4,
|
||||
.ant-typography h1 + h4,
|
||||
.ant-typography h2 + h4,
|
||||
.ant-typography h3 + h4,
|
||||
.ant-typography h4 + h4 {
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
span.ant-typography-ellipsis {
|
||||
display: inline-block;
|
||||
}
|
||||
.ant-typography a {
|
||||
color: #1890ff;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
-webkit-transition: color 0.3s;
|
||||
transition: color 0.3s;
|
||||
}
|
||||
.ant-typography a:focus,
|
||||
.ant-typography a:hover {
|
||||
color: #40a9ff;
|
||||
}
|
||||
.ant-typography a:active {
|
||||
color: #096dd9;
|
||||
}
|
||||
.ant-typography a:active,
|
||||
.ant-typography a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.ant-typography a[disabled] {
|
||||
color: rgba(0, 0, 0, 0.25);
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
.ant-typography code {
|
||||
margin: 0 0.2em;
|
||||
padding: 0.2em 0.4em 0.1em;
|
||||
font-size: 85%;
|
||||
background: rgba(0, 0, 0, 0.06);
|
||||
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.ant-typography mark {
|
||||
padding: 0;
|
||||
background-color: #ffe58f;
|
||||
}
|
||||
.ant-typography u,
|
||||
.ant-typography ins {
|
||||
text-decoration: underline;
|
||||
-webkit-text-decoration-skip: ink;
|
||||
text-decoration-skip-ink: auto;
|
||||
}
|
||||
.ant-typography s,
|
||||
.ant-typography del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.ant-typography strong {
|
||||
font-weight: 600;
|
||||
}
|
||||
.ant-typography-expand,
|
||||
.ant-typography-edit,
|
||||
.ant-typography-copy {
|
||||
color: #1890ff;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
-webkit-transition: color 0.3s;
|
||||
transition: color 0.3s;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.ant-typography-expand:focus,
|
||||
.ant-typography-edit:focus,
|
||||
.ant-typography-copy:focus,
|
||||
.ant-typography-expand:hover,
|
||||
.ant-typography-edit:hover,
|
||||
.ant-typography-copy:hover {
|
||||
color: #40a9ff;
|
||||
}
|
||||
.ant-typography-expand:active,
|
||||
.ant-typography-edit:active,
|
||||
.ant-typography-copy:active {
|
||||
color: #096dd9;
|
||||
}
|
||||
.ant-typography-copy-success,
|
||||
.ant-typography-copy-success:hover,
|
||||
.ant-typography-copy-success:focus {
|
||||
color: #52c41a;
|
||||
}
|
||||
.ant-typography-edit-content {
|
||||
position: relative;
|
||||
}
|
||||
div.ant-typography-edit-content {
|
||||
left: -12px;
|
||||
margin-top: -5px;
|
||||
margin-bottom: calc(1em - 4px - 2px);
|
||||
}
|
||||
.ant-typography-edit-content-confirm {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 8px;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
pointer-events: none;
|
||||
}
|
||||
.ant-typography-edit-content textarea {
|
||||
-moz-transition: none;
|
||||
}
|
||||
.ant-typography ul,
|
||||
.ant-typography ol {
|
||||
margin: 0 0 1em 0;
|
||||
padding: 0;
|
||||
}
|
||||
.ant-typography ul li,
|
||||
.ant-typography ol li {
|
||||
margin: 0 0 0 20px;
|
||||
padding: 0 0 0 4px;
|
||||
}
|
||||
.ant-typography ul {
|
||||
list-style-type: circle;
|
||||
}
|
||||
.ant-typography ul ul {
|
||||
list-style-type: disc;
|
||||
}
|
||||
.ant-typography ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
.ant-typography-ellipsis-single-line {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
span.ant-typography-ellipsis-single-line {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.ant-typography-ellipsis-multiple-line {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
/*! autoprefixer: ignore next */
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.ant-typography-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
.ant-typography-rtl .ant-typography-expand,
|
||||
.ant-typography-rtl .ant-typography-edit,
|
||||
.ant-typography-rtl .ant-typography-copy {
|
||||
margin-right: 8px;
|
||||
margin-left: 0;
|
||||
}
|
||||
div.ant-typography-edit-content.ant-typography-rtl {
|
||||
right: -12px;
|
||||
left: auto;
|
||||
}
|
||||
.ant-typography-rtl .ant-typography-edit-content-confirm {
|
||||
right: auto;
|
||||
left: 10px;
|
||||
}
|
||||
.ant-typography-rtl.ant-typography ul li,
|
||||
.ant-typography-rtl.ant-typography ol li {
|
||||
margin: 0 20px 0 0;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
4
web/node_modules/antd/es/typography/style/index.d.ts
generated
vendored
Normal file
4
web/node_modules/antd/es/typography/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import '../../style/index.less';
|
||||
import './index.less';
|
||||
import '../../tooltip/style';
|
||||
import '../../input/style';
|
||||
5
web/node_modules/antd/es/typography/style/index.js
generated
vendored
Normal file
5
web/node_modules/antd/es/typography/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import '../../style/index.less';
|
||||
import './index.less'; // style dependencies
|
||||
|
||||
import '../../tooltip/style';
|
||||
import '../../input/style';
|
||||
211
web/node_modules/antd/es/typography/style/index.less
generated
vendored
Normal file
211
web/node_modules/antd/es/typography/style/index.less
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
@import '../../style/themes/index';
|
||||
@import '../../style/mixins/index';
|
||||
|
||||
@typography-prefix-cls: ~'@{ant-prefix}-typography';
|
||||
|
||||
// =============== Basic ===============
|
||||
.@{typography-prefix-cls} {
|
||||
color: @text-color;
|
||||
|
||||
&&-secondary {
|
||||
color: @text-color-secondary;
|
||||
}
|
||||
|
||||
&&-warning {
|
||||
color: @warning-color;
|
||||
}
|
||||
|
||||
&&-danger {
|
||||
color: @error-color;
|
||||
}
|
||||
|
||||
&&-disabled {
|
||||
color: @disabled-color;
|
||||
cursor: not-allowed;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
// Tag
|
||||
div&,
|
||||
p {
|
||||
.typography-paragraph();
|
||||
}
|
||||
|
||||
h1&,
|
||||
h1 {
|
||||
.typography-title-1();
|
||||
}
|
||||
h2&,
|
||||
h2 {
|
||||
.typography-title-2();
|
||||
}
|
||||
h3&,
|
||||
h3 {
|
||||
.typography-title-3();
|
||||
}
|
||||
h4&,
|
||||
h4 {
|
||||
.typography-title-4();
|
||||
}
|
||||
|
||||
h1&,
|
||||
h2&,
|
||||
h3&,
|
||||
h4& {
|
||||
.@{typography-prefix-cls} + & {
|
||||
margin-top: @typography-title-margin-top;
|
||||
}
|
||||
}
|
||||
|
||||
div,
|
||||
ul,
|
||||
li,
|
||||
p,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
+ h1,
|
||||
+ h2,
|
||||
+ h3,
|
||||
+ h4 {
|
||||
margin-top: @typography-title-margin-top;
|
||||
}
|
||||
}
|
||||
|
||||
span&-ellipsis {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
a {
|
||||
.operation-unit();
|
||||
|
||||
&:active,
|
||||
&:hover {
|
||||
text-decoration: @link-hover-decoration;
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
color: @disabled-color;
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
margin: 0 0.2em;
|
||||
padding: 0.2em 0.4em 0.1em;
|
||||
font-size: 85%;
|
||||
background: rgba(0, 0, 0, 0.06);
|
||||
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
mark {
|
||||
padding: 0;
|
||||
background-color: @gold-3;
|
||||
}
|
||||
|
||||
u,
|
||||
ins {
|
||||
text-decoration: underline;
|
||||
text-decoration-skip-ink: auto;
|
||||
}
|
||||
|
||||
s,
|
||||
del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
// Operation
|
||||
&-expand,
|
||||
&-edit,
|
||||
&-copy {
|
||||
.operation-unit();
|
||||
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
&-copy-success {
|
||||
&,
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: @success-color;
|
||||
}
|
||||
}
|
||||
|
||||
// Text input area
|
||||
&-edit-content {
|
||||
position: relative;
|
||||
|
||||
div& {
|
||||
left: -@input-padding-horizontal - 1px;
|
||||
margin-top: -@input-padding-vertical-base - 1px;
|
||||
// stylelint-disable-next-line function-calc-no-invalid
|
||||
margin-bottom: calc(1em - @input-padding-vertical-base - 2px);
|
||||
}
|
||||
|
||||
&-confirm {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 8px;
|
||||
color: @text-color-secondary;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
// Fix Editable Textarea flash in Firefox
|
||||
textarea {
|
||||
-moz-transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
// list
|
||||
ul,
|
||||
ol {
|
||||
margin: 0 0 1em 0;
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
margin: 0 0 0 20px;
|
||||
padding: 0 0 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: circle;
|
||||
|
||||
ul {
|
||||
list-style-type: disc;
|
||||
}
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
// ============ Ellipsis ============
|
||||
&-ellipsis-single-line {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
// https://blog.csdn.net/iefreer/article/details/50421025
|
||||
span& {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
&-ellipsis-multiple-line {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
/*! autoprefixer: ignore next */
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@import './rtl';
|
||||
48
web/node_modules/antd/es/typography/style/rtl.less
generated
vendored
Normal file
48
web/node_modules/antd/es/typography/style/rtl.less
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
@import '../../style/themes/index';
|
||||
@import '../../style/mixins/index';
|
||||
|
||||
@typography-prefix-cls: ~'@{ant-prefix}-typography';
|
||||
|
||||
.@{typography-prefix-cls} {
|
||||
&-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
// Operation
|
||||
&-expand,
|
||||
&-edit,
|
||||
&-copy {
|
||||
.@{typography-prefix-cls}-rtl & {
|
||||
margin-right: 8px;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Text input area
|
||||
&-edit-content {
|
||||
div& {
|
||||
&.@{typography-prefix-cls}-rtl {
|
||||
right: -@input-padding-horizontal - 1px;
|
||||
left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&-confirm {
|
||||
.@{typography-prefix-cls}-rtl & {
|
||||
right: auto;
|
||||
left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// list
|
||||
ul,
|
||||
ol {
|
||||
li {
|
||||
.@{typography-prefix-cls}-rtl& {
|
||||
margin: 0 20px 0 0;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
web/node_modules/antd/es/typography/util.d.ts
generated
vendored
Normal file
11
web/node_modules/antd/es/typography/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
interface Option {
|
||||
rows: number;
|
||||
suffix?: string;
|
||||
}
|
||||
declare const _default: (originEle: HTMLElement, option: Option, content: React.ReactNode, fixedContent: React.ReactNode[], ellipsisStr: string) => {
|
||||
content: React.ReactNode;
|
||||
text: string;
|
||||
ellipsis: boolean;
|
||||
};
|
||||
export default _default;
|
||||
208
web/node_modules/antd/es/typography/util.js
generated
vendored
Normal file
208
web/node_modules/antd/es/typography/util.js
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import * as React from 'react';
|
||||
import toArray from "rc-util/es/Children/toArray"; // We only handle element & text node.
|
||||
|
||||
var ELEMENT_NODE = 1;
|
||||
var TEXT_NODE = 3;
|
||||
var COMMENT_NODE = 8;
|
||||
var ellipsisContainer;
|
||||
var wrapperStyle = {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
display: 'inline',
|
||||
lineHeight: 'inherit'
|
||||
};
|
||||
|
||||
function pxToNumber(value) {
|
||||
if (!value) return 0;
|
||||
var match = value.match(/^\d*(\.\d*)?/);
|
||||
return match ? Number(match[0]) : 0;
|
||||
}
|
||||
|
||||
function styleToString(style) {
|
||||
// There are some different behavior between Firefox & Chrome.
|
||||
// We have to handle this ourself.
|
||||
var styleNames = Array.prototype.slice.apply(style);
|
||||
return styleNames.map(function (name) {
|
||||
return "".concat(name, ": ").concat(style.getPropertyValue(name), ";");
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function mergeChildren(children) {
|
||||
var childList = [];
|
||||
children.forEach(function (child) {
|
||||
var prevChild = childList[childList.length - 1];
|
||||
|
||||
if (typeof child === 'string' && typeof prevChild === 'string') {
|
||||
childList[childList.length - 1] += child;
|
||||
} else {
|
||||
childList.push(child);
|
||||
}
|
||||
});
|
||||
return childList;
|
||||
}
|
||||
|
||||
export default (function (originEle, option, content, fixedContent, ellipsisStr) {
|
||||
if (!ellipsisContainer) {
|
||||
ellipsisContainer = document.createElement('div');
|
||||
ellipsisContainer.setAttribute('aria-hidden', 'true');
|
||||
document.body.appendChild(ellipsisContainer);
|
||||
}
|
||||
|
||||
var rows = option.rows,
|
||||
_option$suffix = option.suffix,
|
||||
suffix = _option$suffix === void 0 ? '' : _option$suffix; // Get origin style
|
||||
|
||||
var originStyle = window.getComputedStyle(originEle);
|
||||
var originCSS = styleToString(originStyle);
|
||||
var lineHeight = pxToNumber(originStyle.lineHeight);
|
||||
var maxHeight = Math.round(lineHeight * (rows + 1) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom)); // Set shadow
|
||||
|
||||
ellipsisContainer.setAttribute('style', originCSS);
|
||||
ellipsisContainer.style.position = 'fixed';
|
||||
ellipsisContainer.style.left = '0';
|
||||
ellipsisContainer.style.height = 'auto';
|
||||
ellipsisContainer.style.minHeight = 'auto';
|
||||
ellipsisContainer.style.maxHeight = 'auto';
|
||||
ellipsisContainer.style.top = '-999999px';
|
||||
ellipsisContainer.style.zIndex = '-1000'; // clean up css overflow
|
||||
|
||||
ellipsisContainer.style.textOverflow = 'clip';
|
||||
ellipsisContainer.style.whiteSpace = 'normal';
|
||||
ellipsisContainer.style.webkitLineClamp = 'none'; // Render in the fake container
|
||||
|
||||
var contentList = mergeChildren(toArray(content));
|
||||
render( /*#__PURE__*/React.createElement("div", {
|
||||
style: wrapperStyle
|
||||
}, /*#__PURE__*/React.createElement("span", {
|
||||
style: wrapperStyle
|
||||
}, contentList, suffix), /*#__PURE__*/React.createElement("span", {
|
||||
style: wrapperStyle
|
||||
}, fixedContent)), ellipsisContainer); // wrap in an div for old version react
|
||||
// Check if ellipsis in measure div is height enough for content
|
||||
|
||||
function inRange() {
|
||||
return ellipsisContainer.offsetHeight < maxHeight;
|
||||
} // Skip ellipsis if already match
|
||||
|
||||
|
||||
if (inRange()) {
|
||||
unmountComponentAtNode(ellipsisContainer);
|
||||
return {
|
||||
content: content,
|
||||
text: ellipsisContainer.innerHTML,
|
||||
ellipsis: false
|
||||
};
|
||||
} // We should clone the childNode since they're controlled by React and we can't reuse it without warning
|
||||
|
||||
|
||||
var childNodes = Array.prototype.slice.apply(ellipsisContainer.childNodes[0].childNodes[0].cloneNode(true).childNodes).filter(function (_ref) {
|
||||
var nodeType = _ref.nodeType;
|
||||
return nodeType !== COMMENT_NODE;
|
||||
});
|
||||
var fixedNodes = Array.prototype.slice.apply(ellipsisContainer.childNodes[0].childNodes[1].cloneNode(true).childNodes);
|
||||
unmountComponentAtNode(ellipsisContainer); // ========================= Find match ellipsis content =========================
|
||||
|
||||
var ellipsisChildren = [];
|
||||
ellipsisContainer.innerHTML = ''; // Create origin content holder
|
||||
|
||||
var ellipsisContentHolder = document.createElement('span');
|
||||
ellipsisContainer.appendChild(ellipsisContentHolder);
|
||||
var ellipsisTextNode = document.createTextNode(ellipsisStr + suffix);
|
||||
ellipsisContentHolder.appendChild(ellipsisTextNode);
|
||||
fixedNodes.forEach(function (childNode) {
|
||||
ellipsisContainer.appendChild(childNode);
|
||||
}); // Append before fixed nodes
|
||||
|
||||
function appendChildNode(node) {
|
||||
ellipsisContentHolder.insertBefore(node, ellipsisTextNode);
|
||||
} // Get maximum text
|
||||
|
||||
|
||||
function measureText(textNode, fullText) {
|
||||
var startLoc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
var endLoc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fullText.length;
|
||||
var lastSuccessLoc = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
||||
var midLoc = Math.floor((startLoc + endLoc) / 2);
|
||||
var currentText = fullText.slice(0, midLoc);
|
||||
textNode.textContent = currentText;
|
||||
|
||||
if (startLoc >= endLoc - 1) {
|
||||
// Loop when step is small
|
||||
for (var step = endLoc; step >= startLoc; step -= 1) {
|
||||
var currentStepText = fullText.slice(0, step);
|
||||
textNode.textContent = currentStepText;
|
||||
|
||||
if (inRange() || !currentStepText) {
|
||||
return step === fullText.length ? {
|
||||
finished: false,
|
||||
reactNode: fullText
|
||||
} : {
|
||||
finished: true,
|
||||
reactNode: currentStepText
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inRange()) {
|
||||
return measureText(textNode, fullText, midLoc, endLoc, midLoc);
|
||||
}
|
||||
|
||||
return measureText(textNode, fullText, startLoc, midLoc, lastSuccessLoc);
|
||||
}
|
||||
|
||||
function measureNode(childNode, index) {
|
||||
var type = childNode.nodeType;
|
||||
|
||||
if (type === ELEMENT_NODE) {
|
||||
// We don't split element, it will keep if whole element can be displayed.
|
||||
appendChildNode(childNode);
|
||||
|
||||
if (inRange()) {
|
||||
return {
|
||||
finished: false,
|
||||
reactNode: contentList[index]
|
||||
};
|
||||
} // Clean up if can not pull in
|
||||
|
||||
|
||||
ellipsisContentHolder.removeChild(childNode);
|
||||
return {
|
||||
finished: true,
|
||||
reactNode: null
|
||||
};
|
||||
}
|
||||
|
||||
if (type === TEXT_NODE) {
|
||||
var fullText = childNode.textContent || '';
|
||||
var textNode = document.createTextNode(fullText);
|
||||
appendChildNode(textNode);
|
||||
return measureText(textNode, fullText);
|
||||
} // Not handle other type of content
|
||||
// PS: This code should not be attached after react 16
|
||||
|
||||
|
||||
return {
|
||||
finished: false,
|
||||
reactNode: null
|
||||
};
|
||||
}
|
||||
|
||||
childNodes.some(function (childNode, index) {
|
||||
var _measureNode = measureNode(childNode, index),
|
||||
finished = _measureNode.finished,
|
||||
reactNode = _measureNode.reactNode;
|
||||
|
||||
if (reactNode) {
|
||||
ellipsisChildren.push(reactNode);
|
||||
}
|
||||
|
||||
return finished;
|
||||
});
|
||||
return {
|
||||
content: ellipsisChildren,
|
||||
text: ellipsisContainer.innerHTML,
|
||||
ellipsis: true
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user