first commit
This commit is contained in:
23
frontend/node_modules/antd/lib/message/PurePanel.d.ts
generated
vendored
Normal file
23
frontend/node_modules/antd/lib/message/PurePanel.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import * as React from 'react';
|
||||
import type { NoticeProps } from 'rc-notification/lib/Notice';
|
||||
import type { NoticeType } from './interface';
|
||||
export declare const TypeIcon: {
|
||||
info: React.JSX.Element;
|
||||
success: React.JSX.Element;
|
||||
error: React.JSX.Element;
|
||||
warning: React.JSX.Element;
|
||||
loading: React.JSX.Element;
|
||||
};
|
||||
export interface PureContentProps {
|
||||
prefixCls: string;
|
||||
type?: NoticeType;
|
||||
icon?: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
export declare const PureContent: React.FC<PureContentProps>;
|
||||
export interface PurePanelProps extends Omit<NoticeProps, 'prefixCls' | 'eventKey'>, Omit<PureContentProps, 'prefixCls' | 'children'> {
|
||||
prefixCls?: string;
|
||||
}
|
||||
/** @private Internal Component. Do not use in your production. */
|
||||
declare const PurePanel: React.FC<PurePanelProps>;
|
||||
export default PurePanel;
|
||||
73
frontend/node_modules/antd/lib/message/PurePanel.js
generated
vendored
Normal file
73
frontend/node_modules/antd/lib/message/PurePanel.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.TypeIcon = exports.PureContent = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _CheckCircleFilled = _interopRequireDefault(require("@ant-design/icons/CheckCircleFilled"));
|
||||
var _CloseCircleFilled = _interopRequireDefault(require("@ant-design/icons/CloseCircleFilled"));
|
||||
var _ExclamationCircleFilled = _interopRequireDefault(require("@ant-design/icons/ExclamationCircleFilled"));
|
||||
var _InfoCircleFilled = _interopRequireDefault(require("@ant-design/icons/InfoCircleFilled"));
|
||||
var _LoadingOutlined = _interopRequireDefault(require("@ant-design/icons/LoadingOutlined"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcNotification = require("rc-notification");
|
||||
var _configProvider = require("../config-provider");
|
||||
var _useCSSVarCls = _interopRequireDefault(require("../config-provider/hooks/useCSSVarCls"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var __rest = void 0 && (void 0).__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;
|
||||
};
|
||||
const TypeIcon = exports.TypeIcon = {
|
||||
info: /*#__PURE__*/React.createElement(_InfoCircleFilled.default, null),
|
||||
success: /*#__PURE__*/React.createElement(_CheckCircleFilled.default, null),
|
||||
error: /*#__PURE__*/React.createElement(_CloseCircleFilled.default, null),
|
||||
warning: /*#__PURE__*/React.createElement(_ExclamationCircleFilled.default, null),
|
||||
loading: /*#__PURE__*/React.createElement(_LoadingOutlined.default, null)
|
||||
};
|
||||
const PureContent = ({
|
||||
prefixCls,
|
||||
type,
|
||||
icon,
|
||||
children
|
||||
}) => (/*#__PURE__*/React.createElement("div", {
|
||||
className: (0, _classnames.default)(`${prefixCls}-custom-content`, `${prefixCls}-${type}`)
|
||||
}, icon || TypeIcon[type], /*#__PURE__*/React.createElement("span", null, children)));
|
||||
/** @private Internal Component. Do not use in your production. */
|
||||
exports.PureContent = PureContent;
|
||||
const PurePanel = props => {
|
||||
const {
|
||||
prefixCls: staticPrefixCls,
|
||||
className,
|
||||
type,
|
||||
icon,
|
||||
content
|
||||
} = props,
|
||||
restProps = __rest(props, ["prefixCls", "className", "type", "icon", "content"]);
|
||||
const {
|
||||
getPrefixCls
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const prefixCls = staticPrefixCls || getPrefixCls('message');
|
||||
const rootCls = (0, _useCSSVarCls.default)(prefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls, rootCls);
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement(_rcNotification.Notice, Object.assign({}, restProps, {
|
||||
prefixCls: prefixCls,
|
||||
className: (0, _classnames.default)(className, hashId, `${prefixCls}-notice-pure-panel`, cssVarCls, rootCls),
|
||||
eventKey: "pure",
|
||||
duration: null,
|
||||
content: /*#__PURE__*/React.createElement(PureContent, {
|
||||
prefixCls: prefixCls,
|
||||
type: type,
|
||||
icon: icon
|
||||
}, content)
|
||||
})));
|
||||
};
|
||||
var _default = exports.default = PurePanel;
|
||||
27
frontend/node_modules/antd/lib/message/index.d.ts
generated
vendored
Normal file
27
frontend/node_modules/antd/lib/message/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import type { ArgsProps, ConfigOptions, MessageType, TypeOpen } from './interface';
|
||||
import PurePanel from './PurePanel';
|
||||
import useMessage from './useMessage';
|
||||
export type { ArgsProps };
|
||||
declare function setMessageGlobalConfig(config: ConfigOptions): void;
|
||||
interface BaseMethods {
|
||||
open: (config: ArgsProps) => MessageType;
|
||||
destroy: (key?: React.Key) => void;
|
||||
config: typeof setMessageGlobalConfig;
|
||||
useMessage: typeof useMessage;
|
||||
/** @private Internal Component. Do not use in your production. */
|
||||
_InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel;
|
||||
}
|
||||
interface MessageMethods {
|
||||
info: TypeOpen;
|
||||
success: TypeOpen;
|
||||
error: TypeOpen;
|
||||
warning: TypeOpen;
|
||||
loading: TypeOpen;
|
||||
}
|
||||
declare const staticMethods: MessageMethods & BaseMethods;
|
||||
declare const actWrapper: (wrapper: any) => void;
|
||||
export { actWrapper };
|
||||
declare const actDestroy: () => void;
|
||||
export { actDestroy };
|
||||
export default staticMethods;
|
||||
263
frontend/node_modules/antd/lib/message/index.js
generated
vendored
Normal file
263
frontend/node_modules/antd/lib/message/index.js
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.actWrapper = exports.actDestroy = void 0;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _context = require("../app/context");
|
||||
var _configProvider = _interopRequireWildcard(require("../config-provider"));
|
||||
var _UnstableContext = require("../config-provider/UnstableContext");
|
||||
var _PurePanel = _interopRequireDefault(require("./PurePanel"));
|
||||
var _useMessage = _interopRequireWildcard(require("./useMessage"));
|
||||
var _util = require("./util");
|
||||
let message = null;
|
||||
let act = callback => callback();
|
||||
let taskQueue = [];
|
||||
let defaultGlobalConfig = {};
|
||||
function getGlobalContext() {
|
||||
const {
|
||||
getContainer,
|
||||
duration,
|
||||
rtl,
|
||||
maxCount,
|
||||
top
|
||||
} = defaultGlobalConfig;
|
||||
const mergedContainer = (getContainer === null || getContainer === void 0 ? void 0 : getContainer()) || document.body;
|
||||
return {
|
||||
getContainer: () => mergedContainer,
|
||||
duration,
|
||||
rtl,
|
||||
maxCount,
|
||||
top
|
||||
};
|
||||
}
|
||||
const GlobalHolder = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
||||
const {
|
||||
messageConfig,
|
||||
sync
|
||||
} = props;
|
||||
const {
|
||||
getPrefixCls
|
||||
} = (0, _react.useContext)(_configProvider.ConfigContext);
|
||||
const prefixCls = defaultGlobalConfig.prefixCls || getPrefixCls('message');
|
||||
const appConfig = (0, _react.useContext)(_context.AppConfigContext);
|
||||
const [api, holder] = (0, _useMessage.useInternalMessage)(Object.assign(Object.assign(Object.assign({}, messageConfig), {
|
||||
prefixCls
|
||||
}), appConfig.message));
|
||||
_react.default.useImperativeHandle(ref, () => {
|
||||
const instance = Object.assign({}, api);
|
||||
Object.keys(instance).forEach(method => {
|
||||
instance[method] = (...args) => {
|
||||
sync();
|
||||
return api[method].apply(api, args);
|
||||
};
|
||||
});
|
||||
return {
|
||||
instance,
|
||||
sync
|
||||
};
|
||||
});
|
||||
return holder;
|
||||
});
|
||||
const GlobalHolderWrapper = /*#__PURE__*/_react.default.forwardRef((_, ref) => {
|
||||
const [messageConfig, setMessageConfig] = _react.default.useState(getGlobalContext);
|
||||
const sync = () => {
|
||||
setMessageConfig(getGlobalContext);
|
||||
};
|
||||
_react.default.useEffect(sync, []);
|
||||
const global = (0, _configProvider.globalConfig)();
|
||||
const rootPrefixCls = global.getRootPrefixCls();
|
||||
const rootIconPrefixCls = global.getIconPrefixCls();
|
||||
const theme = global.getTheme();
|
||||
const dom = /*#__PURE__*/_react.default.createElement(GlobalHolder, {
|
||||
ref: ref,
|
||||
sync: sync,
|
||||
messageConfig: messageConfig
|
||||
});
|
||||
return /*#__PURE__*/_react.default.createElement(_configProvider.default, {
|
||||
prefixCls: rootPrefixCls,
|
||||
iconPrefixCls: rootIconPrefixCls,
|
||||
theme: theme
|
||||
}, global.holderRender ? global.holderRender(dom) : dom);
|
||||
});
|
||||
const flushMessageQueue = () => {
|
||||
if (!message) {
|
||||
const holderFragment = document.createDocumentFragment();
|
||||
const newMessage = {
|
||||
fragment: holderFragment
|
||||
};
|
||||
message = newMessage;
|
||||
// Delay render to avoid sync issue
|
||||
act(() => {
|
||||
const reactRender = (0, _UnstableContext.unstableSetRender)();
|
||||
reactRender(/*#__PURE__*/_react.default.createElement(GlobalHolderWrapper, {
|
||||
ref: node => {
|
||||
const {
|
||||
instance,
|
||||
sync
|
||||
} = node || {};
|
||||
// React 18 test env will throw if call immediately in ref
|
||||
Promise.resolve().then(() => {
|
||||
if (!newMessage.instance && instance) {
|
||||
newMessage.instance = instance;
|
||||
newMessage.sync = sync;
|
||||
flushMessageQueue();
|
||||
}
|
||||
});
|
||||
}
|
||||
}), holderFragment);
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Notification not ready
|
||||
if (!message.instance) {
|
||||
return;
|
||||
}
|
||||
// >>> Execute task
|
||||
taskQueue.forEach(task => {
|
||||
const {
|
||||
type,
|
||||
skipped
|
||||
} = task;
|
||||
// Only `skipped` when user call notice but cancel it immediately
|
||||
// and instance not ready
|
||||
if (!skipped) {
|
||||
switch (type) {
|
||||
case 'open':
|
||||
{
|
||||
act(() => {
|
||||
const closeFn = message.instance.open(Object.assign(Object.assign({}, defaultGlobalConfig), task.config));
|
||||
closeFn === null || closeFn === void 0 ? void 0 : closeFn.then(task.resolve);
|
||||
task.setCloseFn(closeFn);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'destroy':
|
||||
act(() => {
|
||||
message === null || message === void 0 ? void 0 : message.instance.destroy(task.key);
|
||||
});
|
||||
break;
|
||||
// Other type open
|
||||
default:
|
||||
{
|
||||
act(() => {
|
||||
var _message$instance;
|
||||
const closeFn = (_message$instance = message.instance)[type].apply(_message$instance, (0, _toConsumableArray2.default)(task.args));
|
||||
closeFn === null || closeFn === void 0 ? void 0 : closeFn.then(task.resolve);
|
||||
task.setCloseFn(closeFn);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// Clean up
|
||||
taskQueue = [];
|
||||
};
|
||||
// ==============================================================================
|
||||
// == Export ==
|
||||
// ==============================================================================
|
||||
function setMessageGlobalConfig(config) {
|
||||
defaultGlobalConfig = Object.assign(Object.assign({}, defaultGlobalConfig), config);
|
||||
// Trigger sync for it
|
||||
act(() => {
|
||||
var _a;
|
||||
(_a = message === null || message === void 0 ? void 0 : message.sync) === null || _a === void 0 ? void 0 : _a.call(message);
|
||||
});
|
||||
}
|
||||
function open(config) {
|
||||
const result = (0, _util.wrapPromiseFn)(resolve => {
|
||||
let closeFn;
|
||||
const task = {
|
||||
type: 'open',
|
||||
config,
|
||||
resolve,
|
||||
setCloseFn: fn => {
|
||||
closeFn = fn;
|
||||
}
|
||||
};
|
||||
taskQueue.push(task);
|
||||
return () => {
|
||||
if (closeFn) {
|
||||
act(() => {
|
||||
closeFn();
|
||||
});
|
||||
} else {
|
||||
task.skipped = true;
|
||||
}
|
||||
};
|
||||
});
|
||||
flushMessageQueue();
|
||||
return result;
|
||||
}
|
||||
function typeOpen(type, args) {
|
||||
const global = (0, _configProvider.globalConfig)();
|
||||
if (process.env.NODE_ENV !== 'production' && !global.holderRender) {
|
||||
(0, _configProvider.warnContext)('message');
|
||||
}
|
||||
const result = (0, _util.wrapPromiseFn)(resolve => {
|
||||
let closeFn;
|
||||
const task = {
|
||||
type,
|
||||
args,
|
||||
resolve,
|
||||
setCloseFn: fn => {
|
||||
closeFn = fn;
|
||||
}
|
||||
};
|
||||
taskQueue.push(task);
|
||||
return () => {
|
||||
if (closeFn) {
|
||||
act(() => {
|
||||
closeFn();
|
||||
});
|
||||
} else {
|
||||
task.skipped = true;
|
||||
}
|
||||
};
|
||||
});
|
||||
flushMessageQueue();
|
||||
return result;
|
||||
}
|
||||
const destroy = key => {
|
||||
taskQueue.push({
|
||||
type: 'destroy',
|
||||
key
|
||||
});
|
||||
flushMessageQueue();
|
||||
};
|
||||
const methods = ['success', 'info', 'warning', 'error', 'loading'];
|
||||
const baseStaticMethods = {
|
||||
open,
|
||||
destroy,
|
||||
config: setMessageGlobalConfig,
|
||||
useMessage: _useMessage.default,
|
||||
_InternalPanelDoNotUseOrYouWillBeFired: _PurePanel.default
|
||||
};
|
||||
const staticMethods = baseStaticMethods;
|
||||
methods.forEach(type => {
|
||||
staticMethods[type] = (...args) => typeOpen(type, args);
|
||||
});
|
||||
// ==============================================================================
|
||||
// == Test ==
|
||||
// ==============================================================================
|
||||
const noop = () => {};
|
||||
let _actWrapper = noop;
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
_actWrapper = wrapper => {
|
||||
act = wrapper;
|
||||
};
|
||||
}
|
||||
const actWrapper = exports.actWrapper = _actWrapper;
|
||||
let _actDestroy = noop;
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
_actDestroy = () => {
|
||||
message = null;
|
||||
};
|
||||
}
|
||||
const actDestroy = exports.actDestroy = _actDestroy;
|
||||
var _default = exports.default = staticMethods;
|
||||
66
frontend/node_modules/antd/lib/message/interface.d.ts
generated
vendored
Normal file
66
frontend/node_modules/antd/lib/message/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import type * as React from 'react';
|
||||
export type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading';
|
||||
export interface ConfigOptions {
|
||||
top?: string | number;
|
||||
duration?: number;
|
||||
prefixCls?: string;
|
||||
getContainer?: () => HTMLElement;
|
||||
transitionName?: string;
|
||||
maxCount?: number;
|
||||
rtl?: boolean;
|
||||
}
|
||||
export interface ArgsProps {
|
||||
/**
|
||||
* @descCN 消息通知的内容,接收组件或者字符串
|
||||
* @descEN The content of the message notification, receiving component or string
|
||||
*/
|
||||
content: React.ReactNode;
|
||||
/**
|
||||
* @descCN 消息通知持续显示的时间
|
||||
* @descEN How long the message notification remains displayed
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* @descCN 消息通知的类型,可以是 'info'、'success'、'error'、'warning' 或 'loading'
|
||||
* @descEN The type of message notification, which can be 'info', 'success', 'error', 'warning' or 'loading'
|
||||
*/
|
||||
type?: NoticeType;
|
||||
/**
|
||||
* @descCN 消息通知关闭时进行调用的回调函数
|
||||
* @descEN The callback function called when the message notification is closed
|
||||
*/
|
||||
onClose?: () => void;
|
||||
icon?: React.ReactNode;
|
||||
key?: string | number;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
/**
|
||||
* @descCN 消息通知点击时的回调函数
|
||||
* @descEN Callback function when message notification is clicked
|
||||
*/
|
||||
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
||||
}
|
||||
export type JointContent = React.ReactNode | ArgsProps;
|
||||
export interface MessageType extends PromiseLike<boolean> {
|
||||
(): void;
|
||||
}
|
||||
export type TypeOpen = (content: JointContent,
|
||||
/**
|
||||
* @descCN 消息通知持续显示的时间,也可以直接使用 onClose。
|
||||
* @descEN You can also use onClose directly to determine how long the message notification continues to be displayed.
|
||||
*/
|
||||
duration?: number | VoidFunction,
|
||||
/**
|
||||
* @descCN 消息通知关闭时进行调用的回调函数
|
||||
* @descEN The callback function called when the message notification is closed
|
||||
*/
|
||||
onClose?: VoidFunction) => MessageType;
|
||||
export interface MessageInstance {
|
||||
info: TypeOpen;
|
||||
success: TypeOpen;
|
||||
error: TypeOpen;
|
||||
warning: TypeOpen;
|
||||
loading: TypeOpen;
|
||||
open: (args: ArgsProps) => MessageType;
|
||||
destroy: (key?: React.Key) => void;
|
||||
}
|
||||
5
frontend/node_modules/antd/lib/message/interface.js
generated
vendored
Normal file
5
frontend/node_modules/antd/lib/message/interface.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
23
frontend/node_modules/antd/lib/message/style/index.d.ts
generated
vendored
Normal file
23
frontend/node_modules/antd/lib/message/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { GetDefaultToken } from '../../theme/internal';
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {
|
||||
/**
|
||||
* @desc 提示框 z-index
|
||||
* @descEN z-index of Message
|
||||
*/
|
||||
zIndexPopup: number;
|
||||
/**
|
||||
* @desc 提示框背景色
|
||||
* @descEN Background color of Message
|
||||
*/
|
||||
contentBg: string;
|
||||
/**
|
||||
* @desc 提示框内边距
|
||||
* @descEN Padding of Message
|
||||
*/
|
||||
contentPadding: CSSProperties['padding'];
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Message'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
163
frontend/node_modules/antd/lib/message/style/index.js
generated
vendored
Normal file
163
frontend/node_modules/antd/lib/message/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.prepareComponentToken = exports.default = void 0;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _hooks = require("../../_util/hooks");
|
||||
var _style = require("../../style");
|
||||
var _internal = require("../../theme/internal");
|
||||
const genMessageStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
iconCls,
|
||||
boxShadow,
|
||||
colorText,
|
||||
colorSuccess,
|
||||
colorError,
|
||||
colorWarning,
|
||||
colorInfo,
|
||||
fontSizeLG,
|
||||
motionEaseInOutCirc,
|
||||
motionDurationSlow,
|
||||
marginXS,
|
||||
paddingXS,
|
||||
borderRadiusLG,
|
||||
zIndexPopup,
|
||||
// Custom token
|
||||
contentPadding,
|
||||
contentBg
|
||||
} = token;
|
||||
const noticeCls = `${componentCls}-notice`;
|
||||
const messageMoveIn = new _cssinjs.Keyframes('MessageMoveIn', {
|
||||
'0%': {
|
||||
padding: 0,
|
||||
transform: 'translateY(-100%)',
|
||||
opacity: 0
|
||||
},
|
||||
'100%': {
|
||||
padding: paddingXS,
|
||||
transform: 'translateY(0)',
|
||||
opacity: 1
|
||||
}
|
||||
});
|
||||
const messageMoveOut = new _cssinjs.Keyframes('MessageMoveOut', {
|
||||
'0%': {
|
||||
maxHeight: token.height,
|
||||
padding: paddingXS,
|
||||
opacity: 1
|
||||
},
|
||||
'100%': {
|
||||
maxHeight: 0,
|
||||
padding: 0,
|
||||
opacity: 0
|
||||
}
|
||||
});
|
||||
const noticeStyle = {
|
||||
padding: paddingXS,
|
||||
textAlign: 'center',
|
||||
[`${componentCls}-custom-content`]: {
|
||||
display: 'flex',
|
||||
alignItems: 'center'
|
||||
},
|
||||
[`${componentCls}-custom-content > ${iconCls}`]: {
|
||||
marginInlineEnd: marginXS,
|
||||
// affected by ltr or rtl
|
||||
fontSize: fontSizeLG
|
||||
},
|
||||
[`${noticeCls}-content`]: {
|
||||
display: 'inline-block',
|
||||
padding: contentPadding,
|
||||
background: contentBg,
|
||||
borderRadius: borderRadiusLG,
|
||||
boxShadow,
|
||||
pointerEvents: 'all'
|
||||
},
|
||||
[`${componentCls}-success > ${iconCls}`]: {
|
||||
color: colorSuccess
|
||||
},
|
||||
[`${componentCls}-error > ${iconCls}`]: {
|
||||
color: colorError
|
||||
},
|
||||
[`${componentCls}-warning > ${iconCls}`]: {
|
||||
color: colorWarning
|
||||
},
|
||||
[`${componentCls}-info > ${iconCls},
|
||||
${componentCls}-loading > ${iconCls}`]: {
|
||||
color: colorInfo
|
||||
}
|
||||
};
|
||||
return [
|
||||
// ============================ Holder ============================
|
||||
{
|
||||
[componentCls]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
color: colorText,
|
||||
position: 'fixed',
|
||||
top: marginXS,
|
||||
width: '100%',
|
||||
pointerEvents: 'none',
|
||||
zIndex: zIndexPopup,
|
||||
[`${componentCls}-move-up`]: {
|
||||
animationFillMode: 'forwards'
|
||||
},
|
||||
[`
|
||||
${componentCls}-move-up-appear,
|
||||
${componentCls}-move-up-enter
|
||||
`]: {
|
||||
animationName: messageMoveIn,
|
||||
animationDuration: motionDurationSlow,
|
||||
animationPlayState: 'paused',
|
||||
animationTimingFunction: motionEaseInOutCirc
|
||||
},
|
||||
[`
|
||||
${componentCls}-move-up-appear${componentCls}-move-up-appear-active,
|
||||
${componentCls}-move-up-enter${componentCls}-move-up-enter-active
|
||||
`]: {
|
||||
animationPlayState: 'running'
|
||||
},
|
||||
[`${componentCls}-move-up-leave`]: {
|
||||
animationName: messageMoveOut,
|
||||
animationDuration: motionDurationSlow,
|
||||
animationPlayState: 'paused',
|
||||
animationTimingFunction: motionEaseInOutCirc
|
||||
},
|
||||
[`${componentCls}-move-up-leave${componentCls}-move-up-leave-active`]: {
|
||||
animationPlayState: 'running'
|
||||
},
|
||||
'&-rtl': {
|
||||
direction: 'rtl',
|
||||
span: {
|
||||
direction: 'rtl'
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// ============================ Notice ============================
|
||||
{
|
||||
[componentCls]: {
|
||||
[`${noticeCls}-wrapper`]: Object.assign({}, noticeStyle)
|
||||
}
|
||||
},
|
||||
// ============================= Pure =============================
|
||||
{
|
||||
[`${componentCls}-notice-pure-panel`]: Object.assign(Object.assign({}, noticeStyle), {
|
||||
padding: 0,
|
||||
textAlign: 'start'
|
||||
})
|
||||
}];
|
||||
};
|
||||
const prepareComponentToken = token => ({
|
||||
zIndexPopup: token.zIndexPopupBase + _hooks.CONTAINER_MAX_OFFSET + 10,
|
||||
contentBg: token.colorBgElevated,
|
||||
contentPadding: `${(token.controlHeightLG - token.fontSize * token.lineHeight) / 2}px ${token.paddingSM}px`
|
||||
});
|
||||
// ============================== Export ==============================
|
||||
exports.prepareComponentToken = prepareComponentToken;
|
||||
var _default = exports.default = (0, _internal.genStyleHooks)('Message', token => {
|
||||
// Gen-style functions here
|
||||
const combinedToken = (0, _internal.mergeToken)(token, {
|
||||
height: 150
|
||||
});
|
||||
return genMessageStyle(combinedToken);
|
||||
}, prepareComponentToken);
|
||||
8
frontend/node_modules/antd/lib/message/useMessage.d.ts
generated
vendored
Normal file
8
frontend/node_modules/antd/lib/message/useMessage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import type { ConfigOptions, MessageInstance } from './interface';
|
||||
type HolderProps = ConfigOptions & {
|
||||
onAllRemoved?: VoidFunction;
|
||||
};
|
||||
export declare function useInternalMessage(messageConfig?: HolderProps): readonly [MessageInstance, React.ReactElement];
|
||||
export default function useMessage(messageConfig?: ConfigOptions): readonly [MessageInstance, React.ReactElement<unknown, string | React.JSXElementConstructor<any>>];
|
||||
export {};
|
||||
227
frontend/node_modules/antd/lib/message/useMessage.js
generated
vendored
Normal file
227
frontend/node_modules/antd/lib/message/useMessage.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useMessage;
|
||||
exports.useInternalMessage = useInternalMessage;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _CloseOutlined = _interopRequireDefault(require("@ant-design/icons/CloseOutlined"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcNotification = require("rc-notification");
|
||||
var _warning = require("../_util/warning");
|
||||
var _configProvider = require("../config-provider");
|
||||
var _useCSSVarCls = _interopRequireDefault(require("../config-provider/hooks/useCSSVarCls"));
|
||||
var _PurePanel = require("./PurePanel");
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var _util = require("./util");
|
||||
var __rest = void 0 && (void 0).__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;
|
||||
};
|
||||
const DEFAULT_OFFSET = 8;
|
||||
const DEFAULT_DURATION = 3;
|
||||
const Wrapper = ({
|
||||
children,
|
||||
prefixCls
|
||||
}) => {
|
||||
const rootCls = (0, _useCSSVarCls.default)(prefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls, rootCls);
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement(_rcNotification.NotificationProvider, {
|
||||
classNames: {
|
||||
list: (0, _classnames.default)(hashId, cssVarCls, rootCls)
|
||||
}
|
||||
}, children));
|
||||
};
|
||||
const renderNotifications = (node, {
|
||||
prefixCls,
|
||||
key
|
||||
}) => (/*#__PURE__*/React.createElement(Wrapper, {
|
||||
prefixCls: prefixCls,
|
||||
key: key
|
||||
}, node));
|
||||
const Holder = /*#__PURE__*/React.forwardRef((props, ref) => {
|
||||
const {
|
||||
top,
|
||||
prefixCls: staticPrefixCls,
|
||||
getContainer: staticGetContainer,
|
||||
maxCount,
|
||||
duration = DEFAULT_DURATION,
|
||||
rtl,
|
||||
transitionName,
|
||||
onAllRemoved
|
||||
} = props;
|
||||
const {
|
||||
getPrefixCls,
|
||||
getPopupContainer,
|
||||
message,
|
||||
direction
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const prefixCls = staticPrefixCls || getPrefixCls('message');
|
||||
// =============================== Style ===============================
|
||||
const getStyle = () => ({
|
||||
left: '50%',
|
||||
transform: 'translateX(-50%)',
|
||||
top: top !== null && top !== void 0 ? top : DEFAULT_OFFSET
|
||||
});
|
||||
const getClassName = () => (0, _classnames.default)({
|
||||
[`${prefixCls}-rtl`]: rtl !== null && rtl !== void 0 ? rtl : direction === 'rtl'
|
||||
});
|
||||
// ============================== Motion ===============================
|
||||
const getNotificationMotion = () => (0, _util.getMotion)(prefixCls, transitionName);
|
||||
// ============================ Close Icon =============================
|
||||
const mergedCloseIcon = /*#__PURE__*/React.createElement("span", {
|
||||
className: `${prefixCls}-close-x`
|
||||
}, /*#__PURE__*/React.createElement(_CloseOutlined.default, {
|
||||
className: `${prefixCls}-close-icon`
|
||||
}));
|
||||
// ============================== Origin ===============================
|
||||
const [api, holder] = (0, _rcNotification.useNotification)({
|
||||
prefixCls,
|
||||
style: getStyle,
|
||||
className: getClassName,
|
||||
motion: getNotificationMotion,
|
||||
closable: false,
|
||||
closeIcon: mergedCloseIcon,
|
||||
duration,
|
||||
getContainer: () => (staticGetContainer === null || staticGetContainer === void 0 ? void 0 : staticGetContainer()) || (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer()) || document.body,
|
||||
maxCount,
|
||||
onAllRemoved,
|
||||
renderNotifications
|
||||
});
|
||||
// ================================ Ref ================================
|
||||
React.useImperativeHandle(ref, () => Object.assign(Object.assign({}, api), {
|
||||
prefixCls,
|
||||
message
|
||||
}));
|
||||
return holder;
|
||||
});
|
||||
// ==============================================================================
|
||||
// == Hook ==
|
||||
// ==============================================================================
|
||||
let keyIndex = 0;
|
||||
function useInternalMessage(messageConfig) {
|
||||
const holderRef = React.useRef(null);
|
||||
const warning = (0, _warning.devUseWarning)('Message');
|
||||
// ================================ API ================================
|
||||
const wrapAPI = React.useMemo(() => {
|
||||
// Wrap with notification content
|
||||
// >>> close
|
||||
const close = key => {
|
||||
var _a;
|
||||
(_a = holderRef.current) === null || _a === void 0 ? void 0 : _a.close(key);
|
||||
};
|
||||
// >>> Open
|
||||
const open = config => {
|
||||
if (!holderRef.current) {
|
||||
process.env.NODE_ENV !== "production" ? warning(false, 'usage', 'You are calling notice in render which will break in React 18 concurrent mode. Please trigger in effect instead.') : void 0;
|
||||
const fakeResult = () => {};
|
||||
// eslint-disable-next-line react-hooks/immutability
|
||||
fakeResult.then = () => {};
|
||||
return fakeResult;
|
||||
}
|
||||
const {
|
||||
open: originOpen,
|
||||
prefixCls,
|
||||
message
|
||||
} = holderRef.current;
|
||||
const noticePrefixCls = `${prefixCls}-notice`;
|
||||
const {
|
||||
content,
|
||||
icon,
|
||||
type,
|
||||
key,
|
||||
className,
|
||||
style,
|
||||
onClose
|
||||
} = config,
|
||||
restConfig = __rest(config, ["content", "icon", "type", "key", "className", "style", "onClose"]);
|
||||
let mergedKey = key;
|
||||
if (mergedKey === undefined || mergedKey === null) {
|
||||
keyIndex += 1;
|
||||
mergedKey = `antd-message-${keyIndex}`;
|
||||
}
|
||||
return (0, _util.wrapPromiseFn)(resolve => {
|
||||
originOpen(Object.assign(Object.assign({}, restConfig), {
|
||||
key: mergedKey,
|
||||
content: (/*#__PURE__*/React.createElement(_PurePanel.PureContent, {
|
||||
prefixCls: prefixCls,
|
||||
type: type,
|
||||
icon: icon
|
||||
}, content)),
|
||||
placement: 'top',
|
||||
className: (0, _classnames.default)(type && `${noticePrefixCls}-${type}`, className, message === null || message === void 0 ? void 0 : message.className),
|
||||
style: Object.assign(Object.assign({}, message === null || message === void 0 ? void 0 : message.style), style),
|
||||
onClose: () => {
|
||||
onClose === null || onClose === void 0 ? void 0 : onClose();
|
||||
resolve();
|
||||
}
|
||||
}));
|
||||
// Return close function
|
||||
return () => {
|
||||
close(mergedKey);
|
||||
};
|
||||
});
|
||||
};
|
||||
// >>> destroy
|
||||
const destroy = key => {
|
||||
var _a;
|
||||
if (key !== undefined) {
|
||||
close(key);
|
||||
} else {
|
||||
(_a = holderRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
||||
}
|
||||
};
|
||||
const clone = {
|
||||
open,
|
||||
destroy
|
||||
};
|
||||
const keys = ['info', 'success', 'warning', 'error', 'loading'];
|
||||
keys.forEach(type => {
|
||||
const typeOpen = (jointContent, duration, onClose) => {
|
||||
let config;
|
||||
if (jointContent && typeof jointContent === 'object' && 'content' in jointContent) {
|
||||
config = jointContent;
|
||||
} else {
|
||||
config = {
|
||||
content: jointContent
|
||||
};
|
||||
}
|
||||
// Params
|
||||
let mergedDuration;
|
||||
let mergedOnClose;
|
||||
if (typeof duration === 'function') {
|
||||
mergedOnClose = duration;
|
||||
} else {
|
||||
mergedDuration = duration;
|
||||
mergedOnClose = onClose;
|
||||
}
|
||||
const mergedConfig = Object.assign(Object.assign({
|
||||
onClose: mergedOnClose,
|
||||
duration: mergedDuration
|
||||
}, config), {
|
||||
type
|
||||
});
|
||||
return open(mergedConfig);
|
||||
};
|
||||
clone[type] = typeOpen;
|
||||
});
|
||||
return clone;
|
||||
}, []);
|
||||
// ============================== Return ===============================
|
||||
return [wrapAPI, /*#__PURE__*/React.createElement(Holder, Object.assign({
|
||||
key: "message-holder"
|
||||
}, messageConfig, {
|
||||
ref: holderRef
|
||||
}))];
|
||||
}
|
||||
function useMessage(messageConfig) {
|
||||
return useInternalMessage(messageConfig);
|
||||
}
|
||||
4
frontend/node_modules/antd/lib/message/util.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/message/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { CSSMotionProps } from 'rc-motion';
|
||||
export declare function getMotion(prefixCls: string, transitionName?: string): CSSMotionProps;
|
||||
/** Wrap message open with promise like function */
|
||||
export declare function wrapPromiseFn(openFn: (resolve: VoidFunction) => VoidFunction): any;
|
||||
27
frontend/node_modules/antd/lib/message/util.js
generated
vendored
Normal file
27
frontend/node_modules/antd/lib/message/util.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getMotion = getMotion;
|
||||
exports.wrapPromiseFn = wrapPromiseFn;
|
||||
function getMotion(prefixCls, transitionName) {
|
||||
return {
|
||||
motionName: transitionName !== null && transitionName !== void 0 ? transitionName : `${prefixCls}-move-up`
|
||||
};
|
||||
}
|
||||
/** Wrap message open with promise like function */
|
||||
function wrapPromiseFn(openFn) {
|
||||
let closeFn;
|
||||
const closePromise = new Promise(resolve => {
|
||||
closeFn = openFn(() => {
|
||||
resolve(true);
|
||||
});
|
||||
});
|
||||
const result = () => {
|
||||
closeFn === null || closeFn === void 0 ? void 0 : closeFn();
|
||||
};
|
||||
result.then = (filled, rejected) => closePromise.then(filled, rejected);
|
||||
result.promise = closePromise;
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user