Latest updates from IceHrmPro

This commit is contained in:
Thilina Pituwala
2020-05-20 18:47:29 +02:00
parent 60c92d7935
commit 7453a58aad
18012 changed files with 2089245 additions and 10173 deletions

24
web/node_modules/antd/es/modal/ActionButton.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import * as React from 'react';
import { ButtonType, ButtonProps } from '../button/button';
export interface ActionButtonProps {
type?: ButtonType;
actionFn?: (...args: any[]) => any | PromiseLike<any>;
closeModal: Function;
autoFocus?: boolean;
buttonProps?: ButtonProps;
}
export interface ActionButtonState {
loading: ButtonProps['loading'];
}
export default class ActionButton extends React.Component<ActionButtonProps, ActionButtonState> {
timeoutId: number;
clicked: boolean;
state: {
loading: boolean;
};
componentDidMount(): void;
componentWillUnmount(): void;
handlePromiseOnOk(returnValueOfOnOk?: PromiseLike<any>): void;
onClick: () => void;
render(): JSX.Element;
}

145
web/node_modules/antd/es/modal/ActionButton.js generated vendored Normal file
View File

@@ -0,0 +1,145 @@
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); }
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Button from '../button';
var ActionButton = /*#__PURE__*/function (_React$Component) {
_inherits(ActionButton, _React$Component);
var _super = _createSuper(ActionButton);
function ActionButton() {
var _this;
_classCallCheck(this, ActionButton);
_this = _super.apply(this, arguments);
_this.state = {
loading: false
};
_this.onClick = function () {
var _this$props = _this.props,
actionFn = _this$props.actionFn,
closeModal = _this$props.closeModal;
if (_this.clicked) {
return;
}
_this.clicked = true;
if (!actionFn) {
closeModal();
return;
}
var returnValueOfOnOk;
if (actionFn.length) {
returnValueOfOnOk = actionFn(closeModal); // https://github.com/ant-design/ant-design/issues/23358
_this.clicked = false;
} else {
returnValueOfOnOk = actionFn();
if (!returnValueOfOnOk) {
closeModal();
return;
}
}
_this.handlePromiseOnOk(returnValueOfOnOk);
};
return _this;
}
_createClass(ActionButton, [{
key: "componentDidMount",
value: function componentDidMount() {
if (this.props.autoFocus) {
var $this = ReactDOM.findDOMNode(this);
this.timeoutId = setTimeout(function () {
return $this.focus();
});
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
clearTimeout(this.timeoutId);
}
}, {
key: "handlePromiseOnOk",
value: function handlePromiseOnOk(returnValueOfOnOk) {
var _this2 = this;
var closeModal = this.props.closeModal;
if (!returnValueOfOnOk || !returnValueOfOnOk.then) {
return;
}
this.setState({
loading: true
});
returnValueOfOnOk.then(function () {
// It's unnecessary to set loading=false, for the Modal will be unmounted after close.
// this.setState({ loading: false });
closeModal.apply(void 0, arguments);
}, function (e) {
// Emit error when catch promise reject
// eslint-disable-next-line no-console
console.error(e); // See: https://github.com/ant-design/ant-design/issues/6183
_this2.setState({
loading: false
});
_this2.clicked = false;
});
}
}, {
key: "render",
value: function render() {
var _this$props2 = this.props,
type = _this$props2.type,
children = _this$props2.children,
buttonProps = _this$props2.buttonProps;
var loading = this.state.loading;
return /*#__PURE__*/React.createElement(Button, _extends({
type: type,
onClick: this.onClick,
loading: loading
}, buttonProps), children);
}
}]);
return ActionButton;
}(React.Component);
export { ActionButton as default };

9
web/node_modules/antd/es/modal/ConfirmDialog.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/// <reference types="react" />
import { ModalFuncProps } from './Modal';
interface ConfirmDialogProps extends ModalFuncProps {
afterClose?: () => void;
close: (...args: any[]) => void;
autoFocusButton?: null | 'ok' | 'cancel';
}
declare const ConfirmDialog: (props: ConfirmDialogProps) => JSX.Element;
export default ConfirmDialog;

90
web/node_modules/antd/es/modal/ConfirmDialog.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
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; }
import * as React from 'react';
import classNames from 'classnames';
import Dialog from './Modal';
import ActionButton from './ActionButton';
import warning from '../_util/warning';
var ConfirmDialog = function ConfirmDialog(props) {
var icon = props.icon,
onCancel = props.onCancel,
onOk = props.onOk,
close = props.close,
zIndex = props.zIndex,
afterClose = props.afterClose,
visible = props.visible,
keyboard = props.keyboard,
centered = props.centered,
getContainer = props.getContainer,
maskStyle = props.maskStyle,
okText = props.okText,
okButtonProps = props.okButtonProps,
cancelText = props.cancelText,
cancelButtonProps = props.cancelButtonProps;
warning(!(typeof icon === 'string' && icon.length > 2), 'Modal', "`icon` is using ReactNode instead of string naming in v4. Please check `".concat(icon, "` at https://ant.design/components/icon")); // 支持传入{ icon: null }来隐藏`Modal.confirm`默认的Icon
var okType = props.okType || 'primary';
var prefixCls = props.prefixCls || 'ant-modal';
var contentPrefixCls = "".concat(prefixCls, "-confirm"); // 默认为 true保持向下兼容
var okCancel = 'okCancel' in props ? props.okCancel : true;
var width = props.width || 416;
var style = props.style || {};
var mask = props.mask === undefined ? true : props.mask; // 默认为 false保持旧版默认行为
var maskClosable = props.maskClosable === undefined ? false : props.maskClosable;
var autoFocusButton = props.autoFocusButton === null ? false : props.autoFocusButton || 'ok';
var transitionName = props.transitionName || 'zoom';
var maskTransitionName = props.maskTransitionName || 'fade';
var classString = classNames(contentPrefixCls, "".concat(contentPrefixCls, "-").concat(props.type), props.className);
var cancelButton = okCancel && /*#__PURE__*/React.createElement(ActionButton, {
actionFn: onCancel,
closeModal: close,
autoFocus: autoFocusButton === 'cancel',
buttonProps: cancelButtonProps
}, cancelText);
return /*#__PURE__*/React.createElement(Dialog, {
prefixCls: prefixCls,
className: classString,
wrapClassName: classNames(_defineProperty({}, "".concat(contentPrefixCls, "-centered"), !!props.centered)),
onCancel: function onCancel() {
return close({
triggerCancel: true
});
},
visible: visible,
title: "",
transitionName: transitionName,
footer: "",
maskTransitionName: maskTransitionName,
mask: mask,
maskClosable: maskClosable,
maskStyle: maskStyle,
style: style,
width: width,
zIndex: zIndex,
afterClose: afterClose,
keyboard: keyboard,
centered: centered,
getContainer: getContainer
}, /*#__PURE__*/React.createElement("div", {
className: "".concat(contentPrefixCls, "-body-wrapper")
}, /*#__PURE__*/React.createElement("div", {
className: "".concat(contentPrefixCls, "-body")
}, icon, props.title === undefined ? null : /*#__PURE__*/React.createElement("span", {
className: "".concat(contentPrefixCls, "-title")
}, props.title), /*#__PURE__*/React.createElement("div", {
className: "".concat(contentPrefixCls, "-content")
}, props.content)), /*#__PURE__*/React.createElement("div", {
className: "".concat(contentPrefixCls, "-btns")
}, cancelButton, /*#__PURE__*/React.createElement(ActionButton, {
type: okType,
actionFn: onOk,
closeModal: close,
autoFocus: autoFocusButton === 'ok',
buttonProps: okButtonProps
}, okText))));
};
export default ConfirmDialog;

106
web/node_modules/antd/es/modal/Modal.d.ts generated vendored Normal file
View File

@@ -0,0 +1,106 @@
import * as React from 'react';
import useModal from './useModal';
import { ButtonType, ButtonProps } from '../button/button';
import { ConfigConsumerProps } from '../config-provider';
export declare const destroyFns: Array<() => void>;
export interface ModalProps {
/** 对话框是否可见 */
visible?: boolean;
/** 确定按钮 loading */
confirmLoading?: boolean;
/** 标题 */
title?: React.ReactNode | string;
/** 是否显示右上角的关闭按钮 */
closable?: boolean;
/** 点击确定回调 */
onOk?: (e: React.MouseEvent<HTMLElement>) => void;
/** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */
onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
afterClose?: () => void;
/** 垂直居中 */
centered?: boolean;
/** 宽度 */
width?: string | number;
/** 底部内容 */
footer?: React.ReactNode;
/** 确认按钮文字 */
okText?: React.ReactNode;
/** 确认按钮类型 */
okType?: ButtonType;
/** 取消按钮文字 */
cancelText?: React.ReactNode;
/** 点击蒙层是否允许关闭 */
maskClosable?: boolean;
/** 强制渲染 Modal */
forceRender?: boolean;
okButtonProps?: ButtonProps;
cancelButtonProps?: ButtonProps;
destroyOnClose?: boolean;
style?: React.CSSProperties;
wrapClassName?: string;
maskTransitionName?: string;
transitionName?: string;
className?: string;
getContainer?: string | HTMLElement | getContainerFunc | false | null;
zIndex?: number;
bodyStyle?: React.CSSProperties;
maskStyle?: React.CSSProperties;
mask?: boolean;
keyboard?: boolean;
wrapProps?: any;
prefixCls?: string;
closeIcon?: React.ReactNode;
}
declare type getContainerFunc = () => HTMLElement;
export interface ModalFuncProps {
prefixCls?: string;
className?: string;
visible?: boolean;
title?: React.ReactNode;
content?: React.ReactNode;
onOk?: (...args: any[]) => any;
onCancel?: (...args: any[]) => any;
okButtonProps?: ButtonProps;
cancelButtonProps?: ButtonProps;
centered?: boolean;
width?: string | number;
okText?: React.ReactNode;
okType?: ButtonType;
cancelText?: React.ReactNode;
icon?: React.ReactNode;
mask?: boolean;
maskClosable?: boolean;
zIndex?: number;
okCancel?: boolean;
style?: React.CSSProperties;
maskStyle?: React.CSSProperties;
type?: string;
keyboard?: boolean;
getContainer?: string | HTMLElement | getContainerFunc | false | null;
autoFocusButton?: null | 'ok' | 'cancel';
transitionName?: string;
maskTransitionName?: string;
}
export interface ModalLocale {
okText: string;
cancelText: string;
justOkText: string;
}
export default class Modal extends React.Component<ModalProps, {}> {
static destroyAll: () => void;
static useModal: typeof useModal;
static defaultProps: {
width: number;
transitionName: string;
maskTransitionName: string;
confirmLoading: boolean;
visible: boolean;
okType: "link" | "default" | "primary" | "ghost" | "dashed" | "danger";
};
handleCancel: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
handleOk: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
renderFooter: (locale: ModalLocale) => JSX.Element;
renderModal: ({ getPopupContainer: getContextPopupContainer, getPrefixCls, direction, }: ConfigConsumerProps) => JSX.Element;
render(): JSX.Element;
}
export {};

176
web/node_modules/antd/es/modal/Modal.js generated vendored Normal file
View File

@@ -0,0 +1,176 @@
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 _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 Dialog from 'rc-dialog';
import classNames from 'classnames';
import addEventListener from "rc-util/es/Dom/addEventListener";
import CloseOutlined from '@ant-design/icons/CloseOutlined';
import useModal from './useModal';
import { getConfirmLocale } from './locale';
import Button from '../button';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { ConfigConsumer } from '../config-provider';
var mousePosition;
export var destroyFns = []; // ref: https://github.com/ant-design/ant-design/issues/15795
var getClickPosition = function getClickPosition(e) {
mousePosition = {
x: e.pageX,
y: e.pageY
}; // 100ms 内发生过点击事件,则从点击位置动画展示
// 否则直接 zoom 展示
// 这样可以兼容非点击方式展开
setTimeout(function () {
return mousePosition = null;
}, 100);
}; // 只有点击事件支持从鼠标位置动画展开
if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
addEventListener(document.documentElement, 'click', getClickPosition);
}
var Modal = /*#__PURE__*/function (_React$Component) {
_inherits(Modal, _React$Component);
var _super = _createSuper(Modal);
function Modal() {
var _this;
_classCallCheck(this, Modal);
_this = _super.apply(this, arguments);
_this.handleCancel = function (e) {
var onCancel = _this.props.onCancel;
if (onCancel) {
onCancel(e);
}
};
_this.handleOk = function (e) {
var onOk = _this.props.onOk;
if (onOk) {
onOk(e);
}
};
_this.renderFooter = function (locale) {
var _this$props = _this.props,
okText = _this$props.okText,
okType = _this$props.okType,
cancelText = _this$props.cancelText,
confirmLoading = _this$props.confirmLoading;
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, _extends({
onClick: _this.handleCancel
}, _this.props.cancelButtonProps), cancelText || locale.cancelText), /*#__PURE__*/React.createElement(Button, _extends({
type: okType,
loading: confirmLoading,
onClick: _this.handleOk
}, _this.props.okButtonProps), okText || locale.okText));
};
_this.renderModal = function (_ref) {
var _classNames;
var getContextPopupContainer = _ref.getPopupContainer,
getPrefixCls = _ref.getPrefixCls,
direction = _ref.direction;
var _a = _this.props,
customizePrefixCls = _a.prefixCls,
footer = _a.footer,
visible = _a.visible,
wrapClassName = _a.wrapClassName,
centered = _a.centered,
getContainer = _a.getContainer,
closeIcon = _a.closeIcon,
restProps = __rest(_a, ["prefixCls", "footer", "visible", "wrapClassName", "centered", "getContainer", "closeIcon"]);
var prefixCls = getPrefixCls('modal', customizePrefixCls);
var defaultFooter = /*#__PURE__*/React.createElement(LocaleReceiver, {
componentName: "Modal",
defaultLocale: getConfirmLocale()
}, _this.renderFooter);
var closeIconToRender = /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-close-x")
}, closeIcon || /*#__PURE__*/React.createElement(CloseOutlined, {
className: "".concat(prefixCls, "-close-icon")
}));
var wrapClassNameExtended = classNames(wrapClassName, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-centered"), !!centered), _defineProperty(_classNames, "".concat(prefixCls, "-wrap-rtl"), direction === 'rtl'), _classNames));
return /*#__PURE__*/React.createElement(Dialog, _extends({}, restProps, {
getContainer: getContainer === undefined ? getContextPopupContainer : getContainer,
prefixCls: prefixCls,
wrapClassName: wrapClassNameExtended,
footer: footer === undefined ? defaultFooter : footer,
visible: visible,
mousePosition: mousePosition,
onClose: _this.handleCancel,
closeIcon: closeIconToRender
}));
};
return _this;
}
_createClass(Modal, [{
key: "render",
value: function render() {
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderModal);
}
}]);
return Modal;
}(React.Component);
export { Modal as default };
Modal.useModal = useModal;
Modal.defaultProps = {
width: 520,
transitionName: 'zoom',
maskTransitionName: 'fade',
confirmLoading: false,
visible: false,
okType: 'primary'
};

22
web/node_modules/antd/es/modal/confirm.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { ModalFuncProps } from './Modal';
export declare type ModalFunc = (props: ModalFuncProps) => {
destroy: () => void;
update: (newConfig: ModalFuncProps) => void;
};
export interface ModalStaticFunctions {
info: ModalFunc;
success: ModalFunc;
error: ModalFunc;
warn: ModalFunc;
warning: ModalFunc;
confirm: ModalFunc;
}
export default function confirm(config: ModalFuncProps): {
destroy: (...args: any[]) => void;
update: (newConfig: ModalFuncProps) => void;
};
export declare function withWarn(props: ModalFuncProps): ModalFuncProps;
export declare function withInfo(props: ModalFuncProps): ModalFuncProps;
export declare function withSuccess(props: ModalFuncProps): ModalFuncProps;
export declare function withError(props: ModalFuncProps): ModalFuncProps;
export declare function withConfirm(props: ModalFuncProps): ModalFuncProps;

132
web/node_modules/antd/es/modal/confirm.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
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 * as ReactDOM from 'react-dom';
import InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined';
import CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined';
import CloseCircleOutlined from '@ant-design/icons/CloseCircleOutlined';
import ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';
import { getConfirmLocale } from './locale';
import { destroyFns } from './Modal';
import ConfirmDialog from './ConfirmDialog';
export default function confirm(config) {
var div = document.createElement('div');
document.body.appendChild(div); // eslint-disable-next-line no-use-before-define
var currentConfig = _extends(_extends({}, config), {
close: close,
visible: true
});
function destroy() {
var unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult && div.parentNode) {
div.parentNode.removeChild(div);
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var triggerCancel = args.some(function (param) {
return param && param.triggerCancel;
});
if (config.onCancel && triggerCancel) {
config.onCancel.apply(config, args);
}
for (var i = 0; i < destroyFns.length; i++) {
var fn = destroyFns[i]; // eslint-disable-next-line no-use-before-define
if (fn === close) {
destroyFns.splice(i, 1);
break;
}
}
}
function render(_a) {
var okText = _a.okText,
cancelText = _a.cancelText,
props = __rest(_a, ["okText", "cancelText"]);
var runtimeLocale = getConfirmLocale();
ReactDOM.render( /*#__PURE__*/React.createElement(ConfirmDialog, _extends({}, props, {
okText: okText || (props.okCancel ? runtimeLocale.okText : runtimeLocale.justOkText),
cancelText: cancelText || runtimeLocale.cancelText
})), div);
}
function close() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
currentConfig = _extends(_extends({}, currentConfig), {
visible: false,
afterClose: destroy.bind.apply(destroy, [this].concat(args))
});
render(currentConfig);
}
function update(newConfig) {
currentConfig = _extends(_extends({}, currentConfig), newConfig);
render(currentConfig);
}
render(currentConfig);
destroyFns.push(close);
return {
destroy: close,
update: update
};
}
export function withWarn(props) {
return _extends({
type: 'warning',
icon: /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null),
okCancel: false
}, props);
}
export function withInfo(props) {
return _extends({
type: 'info',
icon: /*#__PURE__*/React.createElement(InfoCircleOutlined, null),
okCancel: false
}, props);
}
export function withSuccess(props) {
return _extends({
type: 'success',
icon: /*#__PURE__*/React.createElement(CheckCircleOutlined, null),
okCancel: false
}, props);
}
export function withError(props) {
return _extends({
type: 'error',
icon: /*#__PURE__*/React.createElement(CloseCircleOutlined, null),
okCancel: false
}, props);
}
export function withConfirm(props) {
return _extends({
type: 'confirm',
okCancel: true
}, props);
}

7
web/node_modules/antd/es/modal/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import OriginModal from './Modal';
import { ModalStaticFunctions } from './confirm';
export { ActionButtonProps } from './ActionButton';
export { ModalProps, ModalFuncProps } from './Modal';
declare type Modal = typeof OriginModal & ModalStaticFunctions;
declare const Modal: Modal;
export default Modal;

39
web/node_modules/antd/es/modal/index.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import OriginModal, { destroyFns } from './Modal';
import confirm, { withWarn, withInfo, withSuccess, withError, withConfirm } from './confirm';
function modalWarn(props) {
return confirm(withWarn(props));
}
var Modal = OriginModal;
Modal.info = function infoFn(props) {
return confirm(withInfo(props));
};
Modal.success = function successFn(props) {
return confirm(withSuccess(props));
};
Modal.error = function errorFn(props) {
return confirm(withError(props));
};
Modal.warning = modalWarn;
Modal.warn = modalWarn;
Modal.confirm = function confirmFn(props) {
return confirm(withConfirm(props));
};
Modal.destroyAll = function destroyAllFn() {
while (destroyFns.length) {
var close = destroyFns.pop();
if (close) {
close();
}
}
};
export default Modal;

7
web/node_modules/antd/es/modal/locale.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export interface ModalLocale {
okText: string;
cancelText: string;
justOkText: string;
}
export declare function changeConfirmLocale(newLocale?: ModalLocale): void;
export declare function getConfirmLocale(): ModalLocale;

16
web/node_modules/antd/es/modal/locale.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
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 defaultLocale from '../locale/default';
var runtimeLocale = _extends({}, defaultLocale.Modal);
export function changeConfirmLocale(newLocale) {
if (newLocale) {
runtimeLocale = _extends(_extends({}, runtimeLocale), newLocale);
} else {
runtimeLocale = _extends({}, defaultLocale.Modal);
}
}
export function getConfirmLocale() {
return runtimeLocale;
}

78
web/node_modules/antd/es/modal/style/confirm.less generated vendored Normal file
View File

@@ -0,0 +1,78 @@
@import '../../style/mixins/index';
@confirm-prefix-cls: ~'@{ant-prefix}-modal-confirm';
.@{confirm-prefix-cls} {
.@{ant-prefix}-modal-header {
display: none;
}
.@{ant-prefix}-modal-close {
display: none;
}
.@{ant-prefix}-modal-body {
padding: @modal-confirm-body-padding;
}
&-body-wrapper {
.clearfix();
}
&-body {
.@{confirm-prefix-cls}-title {
display: block;
// create BFC to avoid
// https://user-images.githubusercontent.com/507615/37702510-ba844e06-2d2d-11e8-9b67-8e19be57f445.png
overflow: hidden;
color: @heading-color;
font-weight: 500;
font-size: @font-size-lg;
line-height: 1.4;
}
.@{confirm-prefix-cls}-content {
margin-top: 8px;
color: @text-color;
font-size: @font-size-base;
}
> .@{iconfont-css-prefix} {
float: left;
margin-right: 16px;
font-size: 22px;
// `content` after `icon` should set marginLeft
+ .@{confirm-prefix-cls}-title + .@{confirm-prefix-cls}-content {
margin-left: 38px;
}
}
}
.@{confirm-prefix-cls}-btns {
float: right;
margin-top: 24px;
button + button {
margin-bottom: 0;
margin-left: 8px;
}
}
&-error &-body > .@{iconfont-css-prefix} {
color: @error-color;
}
&-warning &-body > .@{iconfont-css-prefix},
&-confirm &-body > .@{iconfont-css-prefix} {
color: @warning-color;
}
&-info &-body > .@{iconfont-css-prefix} {
color: @info-color;
}
&-success &-body > .@{iconfont-css-prefix} {
color: @success-color;
}
}

4
web/node_modules/antd/es/modal/style/css.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import '../../style/index.css';
import './index.css'; // style dependencies
import '../../button/style/css';

3
web/node_modules/antd/es/modal/style/customize.less generated vendored Normal file
View File

@@ -0,0 +1,3 @@
@import './index.less';
.popover-customize-bg(@dialog-prefix-cls, @popover-background);

242
web/node_modules/antd/es/modal/style/index.css generated vendored Normal file
View File

@@ -0,0 +1,242 @@
/* 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-modal {
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
color: rgba(0, 0, 0, 0.65);
font-size: 14px;
font-variant: tabular-nums;
line-height: 1.5715;
list-style: none;
-webkit-font-feature-settings: 'tnum';
font-feature-settings: 'tnum';
position: relative;
top: 100px;
width: auto;
margin: 0 auto;
padding-bottom: 24px;
pointer-events: none;
}
.ant-modal-wrap {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1000;
overflow: auto;
outline: 0;
-webkit-overflow-scrolling: touch;
}
.ant-modal-title {
margin: 0;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
font-size: 16px;
line-height: 22px;
word-wrap: break-word;
}
.ant-modal-content {
position: relative;
background-color: #fff;
background-clip: padding-box;
border: 0;
border-radius: 2px;
-webkit-box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
pointer-events: auto;
}
.ant-modal-close {
position: absolute;
top: 0;
right: 0;
z-index: 10;
padding: 0;
color: rgba(0, 0, 0, 0.45);
font-weight: 700;
line-height: 1;
text-decoration: none;
background: transparent;
border: 0;
outline: 0;
cursor: pointer;
-webkit-transition: color 0.3s;
transition: color 0.3s;
}
.ant-modal-close-x {
display: block;
width: 56px;
height: 56px;
font-size: 16px;
font-style: normal;
line-height: 56px;
text-align: center;
text-transform: none;
text-rendering: auto;
}
.ant-modal-close:focus,
.ant-modal-close:hover {
color: rgba(0, 0, 0, 0.75);
text-decoration: none;
}
.ant-modal-header {
padding: 16px 24px;
color: rgba(0, 0, 0, 0.65);
background: #fff;
border-bottom: 1px solid #f0f0f0;
border-radius: 2px 2px 0 0;
}
.ant-modal-body {
padding: 24px;
font-size: 14px;
line-height: 1.5715;
word-wrap: break-word;
}
.ant-modal-footer {
padding: 10px 16px;
text-align: right;
background: transparent;
border-top: 1px solid #f0f0f0;
border-radius: 0 0 2px 2px;
}
.ant-modal-footer button + button {
margin-bottom: 0;
margin-left: 8px;
}
.ant-modal.zoom-enter,
.ant-modal.zoom-appear {
-webkit-transform: none;
transform: none;
opacity: 0;
-webkit-animation-duration: 0.3s;
animation-duration: 0.3s;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.ant-modal-mask {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1000;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
filter: alpha(opacity=50);
}
.ant-modal-mask-hidden {
display: none;
}
.ant-modal-open {
overflow: hidden;
}
.ant-modal-centered {
text-align: center;
}
.ant-modal-centered::before {
display: inline-block;
width: 0;
height: 100%;
vertical-align: middle;
content: '';
}
.ant-modal-centered .ant-modal {
top: 0;
display: inline-block;
text-align: left;
vertical-align: middle;
}
@media (max-width: 767px) {
.ant-modal {
max-width: calc(100vw - 16px);
margin: 8px auto;
}
.ant-modal-centered .ant-modal {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
}
}
.ant-modal-confirm .ant-modal-header {
display: none;
}
.ant-modal-confirm .ant-modal-close {
display: none;
}
.ant-modal-confirm .ant-modal-body {
padding: 32px 32px 24px;
}
.ant-modal-confirm-body-wrapper::before {
display: table;
content: '';
}
.ant-modal-confirm-body-wrapper::after {
display: table;
clear: both;
content: '';
}
.ant-modal-confirm-body .ant-modal-confirm-title {
display: block;
overflow: hidden;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
font-size: 16px;
line-height: 1.4;
}
.ant-modal-confirm-body .ant-modal-confirm-content {
margin-top: 8px;
color: rgba(0, 0, 0, 0.65);
font-size: 14px;
}
.ant-modal-confirm-body > .anticon {
float: left;
margin-right: 16px;
font-size: 22px;
}
.ant-modal-confirm-body > .anticon + .ant-modal-confirm-title + .ant-modal-confirm-content {
margin-left: 38px;
}
.ant-modal-confirm .ant-modal-confirm-btns {
float: right;
margin-top: 24px;
}
.ant-modal-confirm .ant-modal-confirm-btns button + button {
margin-bottom: 0;
margin-left: 8px;
}
.ant-modal-confirm-error .ant-modal-confirm-body > .anticon {
color: #ff4d4f;
}
.ant-modal-confirm-warning .ant-modal-confirm-body > .anticon,
.ant-modal-confirm-confirm .ant-modal-confirm-body > .anticon {
color: #faad14;
}
.ant-modal-confirm-info .ant-modal-confirm-body > .anticon {
color: #1890ff;
}
.ant-modal-confirm-success .ant-modal-confirm-body > .anticon {
color: #52c41a;
}
.ant-modal-wrap-rtl {
direction: rtl;
}
.ant-modal-wrap-rtl .ant-modal-close {
right: initial;
left: 0;
}
.ant-modal-wrap-rtl .ant-modal-footer {
text-align: left;
}
.ant-modal-wrap-rtl .ant-modal-footer button + button {
margin-right: 8px;
margin-left: 0;
}
.ant-modal-wrap-rtl.ant-modal-centered .ant-modal {
text-align: right;
}

3
web/node_modules/antd/es/modal/style/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import '../../style/index.less';
import './index.less';
import '../../button/style';

4
web/node_modules/antd/es/modal/style/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import '../../style/index.less';
import './index.less'; // style dependencies
import '../../button/style';

6
web/node_modules/antd/es/modal/style/index.less generated vendored Normal file
View File

@@ -0,0 +1,6 @@
@import '../../style/themes/index';
@import '../../style/mixins/index';
@import './modal';
@import './confirm';
@import './customize';
@import './rtl';

164
web/node_modules/antd/es/modal/style/modal.less generated vendored Normal file
View File

@@ -0,0 +1,164 @@
@dialog-prefix-cls: ~'@{ant-prefix}-modal';
@table-prefix-cls: ~'@{ant-prefix}-table';
.@{dialog-prefix-cls} {
.reset-component;
position: relative;
top: 100px;
width: auto;
margin: 0 auto;
padding-bottom: 24px;
pointer-events: none;
&-wrap {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: @zindex-modal;
overflow: auto;
outline: 0;
-webkit-overflow-scrolling: touch;
}
&-title {
margin: 0;
color: @modal-heading-color;
font-weight: 500;
font-size: @font-size-lg;
line-height: 22px;
word-wrap: break-word;
}
&-content {
position: relative;
background-color: @modal-content-bg;
background-clip: padding-box;
border: 0;
border-radius: @border-radius-base;
box-shadow: @shadow-2;
pointer-events: auto;
}
&-close {
position: absolute;
top: 0;
right: 0;
z-index: @zindex-popup-close;
padding: 0;
color: @text-color-secondary;
font-weight: 700;
line-height: 1;
text-decoration: none;
background: transparent;
border: 0;
outline: 0;
cursor: pointer;
transition: color 0.3s;
&-x {
display: block;
width: @modal-header-close-size;
height: @modal-header-close-size;
font-size: @font-size-lg;
font-style: normal;
line-height: @modal-header-close-size;
text-align: center;
text-transform: none;
text-rendering: auto;
}
&:focus,
&:hover {
color: @icon-color-hover;
text-decoration: none;
}
}
&-header {
padding: @modal-header-padding;
color: @text-color;
background: @modal-header-bg;
border-bottom: @border-width-base @border-style-base @modal-header-border-color-split;
border-radius: @border-radius-base @border-radius-base 0 0;
}
&-body {
padding: @modal-body-padding;
font-size: @font-size-base;
line-height: @line-height-base;
word-wrap: break-word;
}
&-footer {
padding: @modal-footer-padding-vertical @modal-footer-padding-horizontal;
text-align: right;
background: @modal-footer-bg;
border-top: @border-width-base @border-style-base @modal-footer-border-color-split;
border-radius: 0 0 @border-radius-base @border-radius-base;
button + button {
margin-bottom: 0;
margin-left: 8px;
}
}
&.zoom-enter,
&.zoom-appear {
transform: none; // reset scale avoid mousePosition bug
opacity: 0;
animation-duration: @animation-duration-slow;
user-select: none; // https://github.com/ant-design/ant-design/issues/11777
}
&-mask {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: @zindex-modal-mask;
height: 100%;
background-color: @modal-mask-bg;
filter: ~'alpha(opacity=50)';
&-hidden {
display: none;
}
}
&-open {
overflow: hidden;
}
}
.@{dialog-prefix-cls}-centered {
text-align: center;
&::before {
display: inline-block;
width: 0;
height: 100%;
vertical-align: middle;
content: '';
}
.@{dialog-prefix-cls} {
top: 0;
display: inline-block;
text-align: left;
vertical-align: middle;
}
}
@media (max-width: @screen-sm-max) {
.@{dialog-prefix-cls} {
max-width: calc(100vw - 16px);
margin: 8px auto;
}
.@{dialog-prefix-cls}-centered {
.@{dialog-prefix-cls} {
flex: 1;
}
}
}

40
web/node_modules/antd/es/modal/style/rtl.less generated vendored Normal file
View File

@@ -0,0 +1,40 @@
@import '../../style/themes/index';
@import '../../style/mixins/index';
@dialog-prefix-cls: ~'@{ant-prefix}-modal';
@dialog-wrap-rtl-cls: ~'@{dialog-prefix-cls}-wrap-rtl';
.@{dialog-prefix-cls} {
&-wrap {
&-rtl {
direction: rtl;
}
}
&-close {
.@{dialog-wrap-rtl-cls} & {
right: initial;
left: 0;
}
}
&-footer {
.@{dialog-wrap-rtl-cls} & {
text-align: left;
}
button + button {
.@{dialog-wrap-rtl-cls} & {
margin-right: 8px;
margin-left: 0;
}
}
}
}
.@{dialog-prefix-cls}-centered {
.@{dialog-prefix-cls} {
.@{dialog-wrap-rtl-cls}& {
text-align: right;
}
}
}

12
web/node_modules/antd/es/modal/useModal/HookModal.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import { ModalFuncProps } from '../Modal';
export interface HookModalProps {
afterClose: () => void;
config: ModalFuncProps;
}
export interface HookModalRef {
destroy: () => void;
update: (config: ModalFuncProps) => void;
}
declare const _default: React.ForwardRefExoticComponent<HookModalProps & React.RefAttributes<HookModalRef>>;
export default _default;

62
web/node_modules/antd/es/modal/useModal/HookModal.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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 _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import * as React from 'react';
import ConfirmDialog from '../ConfirmDialog';
import defaultLocale from '../../locale/default';
import LocaleReceiver from '../../locale-provider/LocaleReceiver';
var HookModal = function HookModal(_ref, ref) {
var afterClose = _ref.afterClose,
config = _ref.config;
var _React$useState = React.useState(true),
_React$useState2 = _slicedToArray(_React$useState, 2),
visible = _React$useState2[0],
setVisible = _React$useState2[1];
var _React$useState3 = React.useState(config),
_React$useState4 = _slicedToArray(_React$useState3, 2),
innerConfig = _React$useState4[0],
setInnerConfig = _React$useState4[1];
function close() {
setVisible(false);
}
React.useImperativeHandle(ref, function () {
return {
destroy: close,
update: function update(newConfig) {
setInnerConfig(function (originConfig) {
return _extends(_extends({}, originConfig), newConfig);
});
}
};
});
return /*#__PURE__*/React.createElement(LocaleReceiver, {
componentName: "Modal",
defaultLocale: defaultLocale.Modal
}, function (modalLocale) {
return /*#__PURE__*/React.createElement(ConfirmDialog, _extends({}, innerConfig, {
close: close,
visible: visible,
afterClose: afterClose,
okText: innerConfig.okText || (innerConfig.okCancel ? modalLocale.okText : modalLocale.justOkText),
cancelText: innerConfig.cancelText || modalLocale.cancelText
}));
});
};
export default React.forwardRef(HookModal);

3
web/node_modules/antd/es/modal/useModal/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import * as React from 'react';
import { ModalStaticFunctions } from '../confirm';
export default function useModal(): [Omit<ModalStaticFunctions, 'warn'>, React.ReactElement];

60
web/node_modules/antd/es/modal/useModal/index.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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 _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import * as React from 'react';
import usePatchElement from '../../_util/usePatchElement';
import HookModal from './HookModal';
import { withConfirm, withInfo, withSuccess, withError, withWarn } from '../confirm';
var uuid = 0;
export default function useModal() {
var _usePatchElement = usePatchElement(),
_usePatchElement2 = _slicedToArray(_usePatchElement, 2),
elements = _usePatchElement2[0],
patchElement = _usePatchElement2[1];
function getConfirmFunc(withFunc) {
return function hookConfirm(config) {
uuid += 1;
var modalRef = React.createRef();
var closeFunc;
var modal = /*#__PURE__*/React.createElement(HookModal, {
key: "modal-".concat(uuid),
config: withFunc(config),
ref: modalRef,
afterClose: function afterClose() {
closeFunc();
}
});
closeFunc = patchElement(modal);
return {
destroy: function destroy() {
if (modalRef.current) {
modalRef.current.destroy();
}
},
update: function update(newConfig) {
if (modalRef.current) {
modalRef.current.update(newConfig);
}
}
};
};
}
return [{
info: getConfirmFunc(withInfo),
success: getConfirmFunc(withSuccess),
error: getConfirmFunc(withError),
warning: getConfirmFunc(withWarn),
confirm: getConfirmFunc(withConfirm)
}, /*#__PURE__*/React.createElement(React.Fragment, null, elements)];
}