UNPKG

ingenious-flow-designer

Version:

[演示地址](http://antd-vben5-pro.madong.tech/)

1,514 lines 84.3 kB
import { _ as _extends, x as localeValues, w as withInstall, n as warning, b as _objectSpread2, c as classNames, g as genComponentStyleHook, m as merge, y as resetComponent, N as useConfigContextInject, u as useConfigInject, O as wrapPromiseFn, Q as renderHelper, E as canUseDom, R as updateCSS, S as generate, p as useToken, T as useStyleRegister, I as resetIcon, U as defaultConfig, V as configProviderProps, W as defaultIconPrefixCls, X as createTheme, Y as seedToken, Z as useConfigContextProvider, $ as useProvideGlobalForm, j as useProviderSize, k as useProviderDisabled, a0 as LocaleReceiver, a1 as renderEmpty, a2 as DesignTokenProvider } from "./index-33HV6VHr.js"; import { createVNode, defineComponent, reactive, provide, watch, computed, onMounted, onUnmounted, Teleport, ref, TransitionGroup, shallowRef, render, toRaw, watchEffect } from "vue"; import { b as getTransitionGroupProps, P as Portal } from "./transition-iZRSBUt3.js"; import { I as Icon } from "./AntdIcon-BAqDAULg.js"; import { C as CloseOutlined } from "./CloseOutlined-B7BYqrrH.js"; import { K as Keyframe, g as getMotion$1 } from "./motionUtil-C3pKw7LX.js"; import { L as LoadingOutlined } from "./LoadingOutlined-SpxrkaN_.js"; import { C as CheckCircleFilled, E as ExclamationCircleFilled } from "./ExclamationCircleFilled-CdOsbs8Z.js"; import { C as CloseCircleFilled } from "./CloseCircleFilled-BNjiZWvd.js"; import { T as TinyColor } from "./index-i2BXpzPC.js"; var InfoCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "info-circle", "theme": "filled" }; function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key2) { _defineProperty$4(target, key2, source[key2]); }); } return target; } function _defineProperty$4(obj, key2, value) { if (key2 in obj) { Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value; } return obj; } var InfoCircleFilled = function InfoCircleFilled2(props, context) { var p = _objectSpread$4({}, props, context.attrs); return createVNode(Icon, _objectSpread$4({}, p, { "icon": InfoCircleFilled$1 }), null); }; InfoCircleFilled.displayName = "InfoCircleFilled"; InfoCircleFilled.inheritAttrs = false; let runtimeLocale = _extends({}, localeValues.Modal); function changeConfirmLocale(newLocale) { if (newLocale) { runtimeLocale = _extends(_extends({}, runtimeLocale), newLocale); } else { runtimeLocale = _extends({}, localeValues.Modal); } } function getConfirmLocale() { return runtimeLocale; } const ANT_MARK = "internalMark"; const LocaleProvider = defineComponent({ compatConfig: { MODE: 3 }, name: "ALocaleProvider", props: { locale: { type: Object }, ANT_MARK__: String }, setup(props, _ref) { let { slots } = _ref; warning(props.ANT_MARK__ === ANT_MARK, "LocaleProvider", "`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead"); const state = reactive({ antLocale: _extends(_extends({}, props.locale), { exist: true }), ANT_MARK__: ANT_MARK }); provide("localeData", state); watch(() => props.locale, (locale2) => { changeConfirmLocale(locale2 && locale2.Modal); state.antLocale = _extends(_extends({}, locale2), { exist: true }); }, { immediate: true }); return () => { var _a; return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots); }; } }); LocaleProvider.install = function(app) { app.component(LocaleProvider.name, LocaleProvider); return app; }; const locale = withInstall(LocaleProvider); const Notice = defineComponent({ name: "Notice", inheritAttrs: false, props: ["prefixCls", "duration", "updateMark", "noticeKey", "closeIcon", "closable", "props", "onClick", "onClose", "holder", "visible"], setup(props, _ref) { let { attrs, slots } = _ref; let closeTimer; let isUnMounted = false; const duration = computed(() => props.duration === void 0 ? 4.5 : props.duration); const startCloseTimer = () => { if (duration.value && !isUnMounted) { closeTimer = setTimeout(() => { close(); }, duration.value * 1e3); } }; const clearCloseTimer = () => { if (closeTimer) { clearTimeout(closeTimer); closeTimer = null; } }; const close = (e) => { if (e) { e.stopPropagation(); } clearCloseTimer(); const { onClose, noticeKey } = props; if (onClose) { onClose(noticeKey); } }; const restartCloseTimer = () => { clearCloseTimer(); startCloseTimer(); }; onMounted(() => { startCloseTimer(); }); onUnmounted(() => { isUnMounted = true; clearCloseTimer(); }); watch([duration, () => props.updateMark, () => props.visible], (_ref2, _ref3) => { let [preDuration, preUpdateMark, preVisible] = _ref2; let [newDuration, newUpdateMark, newVisible] = _ref3; if (preDuration !== newDuration || preUpdateMark !== newUpdateMark || preVisible !== newVisible && newVisible) { restartCloseTimer(); } }, { flush: "post" }); return () => { var _a, _b; const { prefixCls, closable, closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots), onClick, holder } = props; const { class: className, style } = attrs; const componentClass = `${prefixCls}-notice`; const dataOrAriaAttributeProps = Object.keys(attrs).reduce((acc, key2) => { if (key2.startsWith("data-") || key2.startsWith("aria-") || key2 === "role") { acc[key2] = attrs[key2]; } return acc; }, {}); const node = createVNode("div", _objectSpread2({ "class": classNames(componentClass, className, { [`${componentClass}-closable`]: closable }), "style": style, "onMouseenter": clearCloseTimer, "onMouseleave": startCloseTimer, "onClick": onClick }, dataOrAriaAttributeProps), [createVNode("div", { "class": `${componentClass}-content` }, [(_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots)]), closable ? createVNode("a", { "tabindex": 0, "onClick": close, "class": `${componentClass}-close` }, [closeIcon || createVNode("span", { "class": `${componentClass}-close-x` }, null)]) : null]); if (holder) { return createVNode(Teleport, { "to": holder }, { default: () => node }); } return node; }; } }); var __rest$4 = 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; }; let seed$1 = 0; const now$1 = Date.now(); function getUuid$1() { const id = seed$1; seed$1 += 1; return `rcNotification_${now$1}_${id}`; } const Notification$1 = defineComponent({ name: "Notification", inheritAttrs: false, props: ["prefixCls", "transitionName", "animation", "maxCount", "closeIcon", "hashId"], setup(props, _ref) { let { attrs, expose, slots } = _ref; const hookRefs = /* @__PURE__ */ new Map(); const notices = ref([]); const transitionProps = computed(() => { const { prefixCls, animation = "fade" } = props; let name = props.transitionName; if (!name && animation) { name = `${prefixCls}-${animation}`; } return getTransitionGroupProps(name); }); const add = (originNotice, holderCallback) => { const key2 = originNotice.key || getUuid$1(); const notice2 = _extends(_extends({}, originNotice), { key: key2 }); const { maxCount: maxCount2 } = props; const noticeIndex = notices.value.map((v) => v.notice.key).indexOf(key2); const updatedNotices = notices.value.concat(); if (noticeIndex !== -1) { updatedNotices.splice(noticeIndex, 1, { notice: notice2, holderCallback }); } else { if (maxCount2 && notices.value.length >= maxCount2) { notice2.key = updatedNotices[0].notice.key; notice2.updateMark = getUuid$1(); notice2.userPassKey = key2; updatedNotices.shift(); } updatedNotices.push({ notice: notice2, holderCallback }); } notices.value = updatedNotices; }; const remove = (removeKey) => { notices.value = toRaw(notices.value).filter((_ref2) => { let { notice: { key: key2, userPassKey } } = _ref2; const mergedKey = userPassKey || key2; return mergedKey !== removeKey; }); }; expose({ add, remove, notices }); return () => { var _a; const { prefixCls, closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots, { prefixCls }) } = props; const noticeNodes = notices.value.map((_ref3, index2) => { let { notice: notice2, holderCallback } = _ref3; const updateMark = index2 === notices.value.length - 1 ? notice2.updateMark : void 0; const { key: key2, userPassKey } = notice2; const { content } = notice2; const noticeProps = _extends(_extends(_extends({ prefixCls, closeIcon: typeof closeIcon === "function" ? closeIcon({ prefixCls }) : closeIcon }, notice2), notice2.props), { key: key2, noticeKey: userPassKey || key2, updateMark, onClose: (noticeKey) => { var _a2; remove(noticeKey); (_a2 = notice2.onClose) === null || _a2 === void 0 ? void 0 : _a2.call(notice2); }, onClick: notice2.onClick }); if (holderCallback) { return createVNode("div", { "key": key2, "class": `${prefixCls}-hook-holder`, "ref": (div) => { if (typeof key2 === "undefined") { return; } if (div) { hookRefs.set(key2, div); holderCallback(div, noticeProps); } else { hookRefs.delete(key2); } } }, null); } return createVNode(Notice, _objectSpread2(_objectSpread2({}, noticeProps), {}, { "class": classNames(noticeProps.class, props.hashId) }), { default: () => [typeof content === "function" ? content({ prefixCls }) : content] }); }); const className = { [prefixCls]: 1, [attrs.class]: !!attrs.class, [props.hashId]: true }; return createVNode("div", { "class": className, "style": attrs.style || { top: "65px", left: "50%" } }, [createVNode(TransitionGroup, _objectSpread2({ "tag": "div" }, transitionProps.value), { default: () => [noticeNodes] })]); }; } }); Notification$1.newInstance = function newNotificationInstance(properties, callback) { const _a = properties || {}, { name = "notification", getContainer: getContainer2, appContext, prefixCls: customizePrefixCls, rootPrefixCls: customRootPrefixCls, transitionName: customTransitionName, hasTransitionName: hasTransitionName2, useStyle: useStyle2 } = _a, props = __rest$4(_a, ["name", "getContainer", "appContext", "prefixCls", "rootPrefixCls", "transitionName", "hasTransitionName", "useStyle"]); const div = document.createElement("div"); if (getContainer2) { const root = getContainer2(); root.appendChild(div); } else { document.body.appendChild(div); } const Wrapper = defineComponent({ compatConfig: { MODE: 3 }, name: "NotificationWrapper", setup(_props, _ref4) { let { attrs } = _ref4; const notiRef = shallowRef(); const prefixCls = computed(() => globalConfigForApi.getPrefixCls(name, customizePrefixCls)); const [, hashId] = useStyle2(prefixCls); onMounted(() => { callback({ notice(noticeProps) { var _a2; (_a2 = notiRef.value) === null || _a2 === void 0 ? void 0 : _a2.add(noticeProps); }, removeNotice(key2) { var _a2; (_a2 = notiRef.value) === null || _a2 === void 0 ? void 0 : _a2.remove(key2); }, destroy() { render(null, div); if (div.parentNode) { div.parentNode.removeChild(div); } }, component: notiRef }); }); return () => { const global = globalConfigForApi; const rootPrefixCls = global.getRootPrefixCls(customRootPrefixCls, prefixCls.value); const transitionName2 = hasTransitionName2 ? customTransitionName : `${prefixCls.value}-${customTransitionName}`; return createVNode(ConfigProvider, _objectSpread2(_objectSpread2({}, global), {}, { "prefixCls": rootPrefixCls }), { default: () => [createVNode(Notification$1, _objectSpread2(_objectSpread2({ "ref": notiRef }, attrs), {}, { "prefixCls": prefixCls.value, "transitionName": transitionName2, "hashId": hashId.value }), null)] }); }; } }); const vm = createVNode(Wrapper, props); vm.appContext = appContext || vm.appContext; render(vm, div); }; let seed = 0; const now = Date.now(); function getUuid() { const id = seed; seed += 1; return `rcNotification_${now}_${id}`; } const Notification = defineComponent({ name: "HookNotification", inheritAttrs: false, props: ["prefixCls", "transitionName", "animation", "maxCount", "closeIcon", "hashId", "remove", "notices", "getStyles", "getClassName", "onAllRemoved", "getContainer"], setup(props, _ref) { let { attrs, slots } = _ref; const hookRefs = /* @__PURE__ */ new Map(); const notices = computed(() => props.notices); const transitionProps = computed(() => { let name = props.transitionName; if (!name && props.animation) { switch (typeof props.animation) { case "string": name = props.animation; break; case "function": name = props.animation().name; break; case "object": name = props.animation.name; break; default: name = `${props.prefixCls}-fade`; break; } } return getTransitionGroupProps(name); }); const remove = (key2) => props.remove(key2); const placements = ref({}); watch(notices, () => { const nextPlacements = {}; Object.keys(placements.value).forEach((placement) => { nextPlacements[placement] = []; }); props.notices.forEach((config) => { const { placement = "topRight" } = config.notice; if (placement) { nextPlacements[placement] = nextPlacements[placement] || []; nextPlacements[placement].push(config); } }); placements.value = nextPlacements; }); const placementList = computed(() => Object.keys(placements.value)); return () => { var _a; const { prefixCls, closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots, { prefixCls }) } = props; const noticeNodes = placementList.value.map((placement) => { var _a2, _b; const noticesForPlacement = placements.value[placement]; const classes = (_a2 = props.getClassName) === null || _a2 === void 0 ? void 0 : _a2.call(props, placement); const styles = (_b = props.getStyles) === null || _b === void 0 ? void 0 : _b.call(props, placement); const noticeNodesForPlacement = noticesForPlacement.map((_ref2, index2) => { let { notice: notice2, holderCallback } = _ref2; const updateMark = index2 === notices.value.length - 1 ? notice2.updateMark : void 0; const { key: key2, userPassKey } = notice2; const { content } = notice2; const noticeProps = _extends(_extends(_extends({ prefixCls, closeIcon: typeof closeIcon === "function" ? closeIcon({ prefixCls }) : closeIcon }, notice2), notice2.props), { key: key2, noticeKey: userPassKey || key2, updateMark, onClose: (noticeKey) => { var _a3; remove(noticeKey); (_a3 = notice2.onClose) === null || _a3 === void 0 ? void 0 : _a3.call(notice2); }, onClick: notice2.onClick }); if (holderCallback) { return createVNode("div", { "key": key2, "class": `${prefixCls}-hook-holder`, "ref": (div) => { if (typeof key2 === "undefined") { return; } if (div) { hookRefs.set(key2, div); holderCallback(div, noticeProps); } else { hookRefs.delete(key2); } } }, null); } return createVNode(Notice, _objectSpread2(_objectSpread2({}, noticeProps), {}, { "class": classNames(noticeProps.class, props.hashId) }), { default: () => [typeof content === "function" ? content({ prefixCls }) : content] }); }); const className = { [prefixCls]: 1, [`${prefixCls}-${placement}`]: 1, [attrs.class]: !!attrs.class, [props.hashId]: true, [classes]: !!classes }; function onAfterLeave() { var _a3; if (noticesForPlacement.length > 0) { return; } Reflect.deleteProperty(placements.value, placement); (_a3 = props.onAllRemoved) === null || _a3 === void 0 ? void 0 : _a3.call(props); } return createVNode("div", { "key": placement, "class": className, "style": attrs.style || styles || { top: "65px", left: "50%" } }, [createVNode(TransitionGroup, _objectSpread2(_objectSpread2({ "tag": "div" }, transitionProps.value), {}, { "onAfterLeave": onAfterLeave }), { default: () => [noticeNodesForPlacement] })]); }); return createVNode(Portal, { "getContainer": props.getContainer }, { default: () => [noticeNodes] }); }; } }); var __rest$3 = 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 defaultGetContainer$1 = () => document.body; let uniqueKey = 0; function mergeConfig() { const clone = {}; for (var _len = arguments.length, objList = new Array(_len), _key = 0; _key < _len; _key++) { objList[_key] = arguments[_key]; } objList.forEach((obj) => { if (obj) { Object.keys(obj).forEach((key2) => { const val = obj[key2]; if (val !== void 0) { clone[key2] = val; } }); } }); return clone; } function useNotification$1() { let rootConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const { getContainer: getContainer2 = defaultGetContainer$1, motion, prefixCls, maxCount: maxCount2, getClassName, getStyles, onAllRemoved } = rootConfig, shareConfig = __rest$3(rootConfig, ["getContainer", "motion", "prefixCls", "maxCount", "getClassName", "getStyles", "onAllRemoved"]); const notices = shallowRef([]); const notificationsRef = shallowRef(); const add = (originNotice, holderCallback) => { const key2 = originNotice.key || getUuid(); const notice2 = _extends(_extends({}, originNotice), { key: key2 }); const noticeIndex = notices.value.map((v) => v.notice.key).indexOf(key2); const updatedNotices = notices.value.concat(); if (noticeIndex !== -1) { updatedNotices.splice(noticeIndex, 1, { notice: notice2, holderCallback }); } else { if (maxCount2 && notices.value.length >= maxCount2) { notice2.key = updatedNotices[0].notice.key; notice2.updateMark = getUuid(); notice2.userPassKey = key2; updatedNotices.shift(); } updatedNotices.push({ notice: notice2, holderCallback }); } notices.value = updatedNotices; }; const removeNotice = (removeKey) => { notices.value = notices.value.filter((_ref) => { let { notice: { key: key2, userPassKey } } = _ref; const mergedKey = userPassKey || key2; return mergedKey !== removeKey; }); }; const destroy = () => { notices.value = []; }; const contextHolder = () => createVNode(Notification, { "ref": notificationsRef, "prefixCls": prefixCls, "maxCount": maxCount2, "notices": notices.value, "remove": removeNotice, "getClassName": getClassName, "getStyles": getStyles, "animation": motion, "hashId": rootConfig.hashId, "onAllRemoved": onAllRemoved, "getContainer": getContainer2 }, null); const taskQueue = shallowRef([]); const api2 = { open: (config) => { const mergedConfig = mergeConfig(shareConfig, config); if (mergedConfig.key === null || mergedConfig.key === void 0) { mergedConfig.key = `vc-notification-${uniqueKey}`; uniqueKey += 1; } taskQueue.value = [...taskQueue.value, { type: "open", config: mergedConfig }]; }, close: (key2) => { taskQueue.value = [...taskQueue.value, { type: "close", key: key2 }]; }, destroy: () => { taskQueue.value = [...taskQueue.value, { type: "destroy" }]; } }; watch(taskQueue, () => { if (taskQueue.value.length) { taskQueue.value.forEach((task) => { switch (task.type) { case "open": add(task.config); break; case "close": removeNotice(task.key); break; case "destroy": destroy(); break; } }); taskQueue.value = []; } }); return [api2, contextHolder]; } const genMessageStyle = (token) => { const { componentCls, iconCls, boxShadowSecondary, colorBgElevated, colorSuccess, colorError, colorWarning, colorInfo, fontSizeLG, motionEaseInOutCirc, motionDurationSlow, marginXS, paddingXS, borderRadiusLG, zIndexPopup, // Custom token messageNoticeContentPadding } = token; const messageMoveIn = new Keyframe("MessageMoveIn", { "0%": { padding: 0, transform: "translateY(-100%)", opacity: 0 }, "100%": { padding: paddingXS, transform: "translateY(0)", opacity: 1 } }); const messageMoveOut = new Keyframe("MessageMoveOut", { "0%": { maxHeight: token.height, padding: paddingXS, opacity: 1 }, "100%": { maxHeight: 0, padding: 0, opacity: 0 } }); return [ // ============================ Holder ============================ { [componentCls]: _extends(_extends({}, resetComponent(token)), { position: "fixed", top: marginXS, left: "50%", transform: "translateX(-50%)", 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}-notice`]: { padding: paddingXS, textAlign: "center", [iconCls]: { verticalAlign: "text-bottom", marginInlineEnd: marginXS, fontSize: fontSizeLG }, [`${componentCls}-notice-content`]: { display: "inline-block", padding: messageNoticeContentPadding, background: colorBgElevated, borderRadius: borderRadiusLG, boxShadow: boxShadowSecondary, 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 } } }, // ============================= Pure ============================= { [`${componentCls}-notice-pure-panel`]: { padding: 0, textAlign: "start" } } ]; }; const useStyle$2 = genComponentStyleHook("Message", (token) => { const combinedToken = merge(token, { messageNoticeContentPadding: `${(token.controlHeightLG - token.fontSize * token.lineHeight) / 2}px ${token.paddingSM}px` }); return [genMessageStyle(combinedToken)]; }, (token) => ({ height: 150, zIndexPopup: token.zIndexPopupBase + 10 })); const TypeIcon = { info: createVNode(InfoCircleFilled, null, null), success: createVNode(CheckCircleFilled, null, null), error: createVNode(CloseCircleFilled, null, null), warning: createVNode(ExclamationCircleFilled, null, null), loading: createVNode(LoadingOutlined, null, null) }; const PureContent$1 = defineComponent({ name: "PureContent", inheritAttrs: false, props: ["prefixCls", "type", "icon"], setup(props, _ref) { let { slots } = _ref; return () => { var _a; return createVNode("div", { "class": classNames(`${props.prefixCls}-custom-content`, `${props.prefixCls}-${props.type}`) }, [props.icon || TypeIcon[props.type], createVNode("span", null, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])]); }; } }); defineComponent({ name: "PurePanel", inheritAttrs: false, props: ["prefixCls", "class", "type", "icon", "content"], setup(props, _ref2) { let { slots, attrs } = _ref2; var _a; const { getPrefixCls } = useConfigContextInject(); const prefixCls = computed(() => props.prefixCls || getPrefixCls("message")); const [, hashId] = useStyle$2(prefixCls); return createVNode(Notice, _objectSpread2(_objectSpread2({}, attrs), {}, { "prefixCls": prefixCls.value, "class": classNames(hashId.value, `${prefixCls.value}-notice-pure-panel`), "noticeKey": "pure", "duration": null }), { default: () => [createVNode(PureContent$1, { "prefixCls": prefixCls.value, "type": props.type, "icon": props.icon }, { default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)] })] }); } }); var __rest$2 = 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$1 = 8; const DEFAULT_DURATION$1 = 3; const Holder$1 = defineComponent({ name: "Holder", inheritAttrs: false, props: ["top", "prefixCls", "getContainer", "maxCount", "duration", "rtl", "transitionName", "onAllRemoved", "animation", "staticGetContainer"], setup(props, _ref) { let { expose } = _ref; var _a, _b; const { getPrefixCls, getPopupContainer } = useConfigInject("message", props); const prefixCls = computed(() => getPrefixCls("message", props.prefixCls)); const [, hashId] = useStyle$2(prefixCls); const getStyles = () => { var _a2; const top = (_a2 = props.top) !== null && _a2 !== void 0 ? _a2 : DEFAULT_OFFSET$1; return { left: "50%", transform: "translateX(-50%)", top: typeof top === "number" ? `${top}px` : top }; }; const getClassName = () => classNames(hashId.value, props.rtl ? `${prefixCls.value}-rtl` : ""); const getNotificationMotion = () => { var _a2; return getMotion$1({ prefixCls: prefixCls.value, animation: (_a2 = props.animation) !== null && _a2 !== void 0 ? _a2 : `move-up`, transitionName: props.transitionName }); }; const mergedCloseIcon = createVNode("span", { "class": `${prefixCls.value}-close-x` }, [createVNode(CloseOutlined, { "class": `${prefixCls.value}-close-icon` }, null)]); const [api2, holder] = useNotification$1({ //@ts-ignore getStyles, prefixCls: prefixCls.value, getClassName, motion: getNotificationMotion, closable: false, closeIcon: mergedCloseIcon, duration: (_a = props.duration) !== null && _a !== void 0 ? _a : DEFAULT_DURATION$1, getContainer: (_b = props.staticGetContainer) !== null && _b !== void 0 ? _b : getPopupContainer.value, maxCount: props.maxCount, onAllRemoved: props.onAllRemoved }); expose(_extends(_extends({}, api2), { prefixCls, hashId })); return holder; } }); let keyIndex = 0; function useInternalMessage(messageConfig) { const holderRef = shallowRef(null); const holderKey = Symbol("messageHolderKey"); const close = (key2) => { var _a; (_a = holderRef.value) === null || _a === void 0 ? void 0 : _a.close(key2); }; const open = (config) => { if (!holderRef.value) { const fakeResult = () => { }; fakeResult.then = () => { }; return fakeResult; } const { open: originOpen, prefixCls, hashId } = holderRef.value; const noticePrefixCls = `${prefixCls}-notice`; const { content, icon, type, key: key2, class: className, onClose } = config, restConfig = __rest$2(config, ["content", "icon", "type", "key", "class", "onClose"]); let mergedKey = key2; if (mergedKey === void 0 || mergedKey === null) { keyIndex += 1; mergedKey = `antd-message-${keyIndex}`; } return wrapPromiseFn((resolve) => { originOpen(_extends(_extends({}, restConfig), { key: mergedKey, content: () => createVNode(PureContent$1, { "prefixCls": prefixCls, "type": type, "icon": typeof icon === "function" ? icon() : icon }, { default: () => [typeof content === "function" ? content() : content] }), placement: "top", // @ts-ignore class: classNames(type && `${noticePrefixCls}-${type}`, hashId, className), onClose: () => { onClose === null || onClose === void 0 ? void 0 : onClose(); resolve(); } })); return () => { close(mergedKey); }; }); }; const destroy = (key2) => { var _a; if (key2 !== void 0) { close(key2); } else { (_a = holderRef.value) === null || _a === void 0 ? void 0 : _a.destroy(); } }; const wrapAPI = { 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 }; } let mergedDuration; let mergedOnClose; if (typeof duration === "function") { mergedOnClose = duration; } else { mergedDuration = duration; mergedOnClose = onClose; } const mergedConfig = _extends(_extends({ onClose: mergedOnClose, duration: mergedDuration }, config), { type }); return open(mergedConfig); }; wrapAPI[type] = typeOpen; }); return [wrapAPI, () => createVNode(Holder$1, _objectSpread2(_objectSpread2({ "key": holderKey }, messageConfig), {}, { "ref": holderRef }), null)]; } function useMessage(messageConfig) { return useInternalMessage(messageConfig); } let defaultDuration$1 = 3; let defaultTop$1; let messageInstance; let key = 1; let localPrefixCls = ""; let transitionName = "move-up"; let hasTransitionName = false; let getContainer = () => document.body; let maxCount$1; let rtl$1 = false; function getKeyThenIncreaseKey() { return key++; } function setMessageConfig(options) { if (options.top !== void 0) { defaultTop$1 = options.top; messageInstance = null; } if (options.duration !== void 0) { defaultDuration$1 = options.duration; } if (options.prefixCls !== void 0) { localPrefixCls = options.prefixCls; } if (options.getContainer !== void 0) { getContainer = options.getContainer; messageInstance = null; } if (options.transitionName !== void 0) { transitionName = options.transitionName; messageInstance = null; hasTransitionName = true; } if (options.maxCount !== void 0) { maxCount$1 = options.maxCount; messageInstance = null; } if (options.rtl !== void 0) { rtl$1 = options.rtl; } } function getMessageInstance(args, callback) { if (messageInstance) { callback(messageInstance); return; } Notification$1.newInstance({ appContext: args.appContext, prefixCls: args.prefixCls || localPrefixCls, rootPrefixCls: args.rootPrefixCls, transitionName, hasTransitionName, style: { top: defaultTop$1 }, getContainer: getContainer || args.getPopupContainer, maxCount: maxCount$1, name: "message", useStyle: useStyle$2 }, (instance) => { if (messageInstance) { callback(messageInstance); return; } messageInstance = instance; callback(instance); }); } const typeToIcon$2 = { info: InfoCircleFilled, success: CheckCircleFilled, error: CloseCircleFilled, warning: ExclamationCircleFilled, loading: LoadingOutlined }; const typeList = Object.keys(typeToIcon$2); function notice$1(args) { const duration = args.duration !== void 0 ? args.duration : defaultDuration$1; const target = args.key || getKeyThenIncreaseKey(); const closePromise = new Promise((resolve) => { const callback = () => { if (typeof args.onClose === "function") { args.onClose(); } return resolve(true); }; getMessageInstance(args, (instance) => { instance.notice({ key: target, duration, style: args.style || {}, class: args.class, content: (_ref) => { let { prefixCls } = _ref; const Icon2 = typeToIcon$2[args.type]; const iconNode = Icon2 ? createVNode(Icon2, null, null) : ""; const messageClass = classNames(`${prefixCls}-custom-content`, { [`${prefixCls}-${args.type}`]: args.type, [`${prefixCls}-rtl`]: rtl$1 === true }); return createVNode("div", { "class": messageClass }, [typeof args.icon === "function" ? args.icon() : args.icon || iconNode, createVNode("span", null, [typeof args.content === "function" ? args.content() : args.content])]); }, onClose: callback, onClick: args.onClick }); }); }); const result = () => { if (messageInstance) { messageInstance.removeNotice(target); } }; result.then = (filled, rejected) => closePromise.then(filled, rejected); result.promise = closePromise; return result; } function isArgsProps(content) { return Object.prototype.toString.call(content) === "[object Object]" && !!content.content; } const api$1 = { open: notice$1, config: setMessageConfig, destroy(messageKey) { if (messageInstance) { if (messageKey) { const { removeNotice } = messageInstance; removeNotice(messageKey); } else { const { destroy } = messageInstance; destroy(); messageInstance = null; } } } }; function attachTypeApi(originalApi, type) { originalApi[type] = (content, duration, onClose) => { if (isArgsProps(content)) { return originalApi.open(_extends(_extends({}, content), { type })); } if (typeof duration === "function") { onClose = duration; duration = void 0; } return originalApi.open({ content, duration, type, onClose }); }; } typeList.forEach((type) => attachTypeApi(api$1, type)); api$1.warn = api$1.warning; api$1.useMessage = useMessage; const getInstance = () => process.env.NODE_ENV === "test" ? messageInstance : null; const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, attachTypeApi, default: api$1, getInstance, getKeyThenIncreaseKey, typeList }, Symbol.toStringTag, { value: "Module" })); var CheckCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "check-circle", "theme": "outlined" }; function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key2) { _defineProperty$3(target, key2, source[key2]); }); } return target; } function _defineProperty$3(obj, key2, value) { if (key2 in obj) { Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value; } return obj; } var CheckCircleOutlined = function CheckCircleOutlined2(props, context) { var p = _objectSpread$3({}, props, context.attrs); return createVNode(Icon, _objectSpread$3({}, p, { "icon": CheckCircleOutlined$1 }), null); }; CheckCircleOutlined.displayName = "CheckCircleOutlined"; CheckCircleOutlined.inheritAttrs = false; var InfoCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" }; function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key2) { _defineProperty$2(target, key2, source[key2]); }); } return target; } function _defineProperty$2(obj, key2, value) { if (key2 in obj) { Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value; } return obj; } var InfoCircleOutlined = function InfoCircleOutlined2(props, context) { var p = _objectSpread$2({}, props, context.attrs); return createVNode(Icon, _objectSpread$2({}, p, { "icon": InfoCircleOutlined$1 }), null); }; InfoCircleOutlined.displayName = "InfoCircleOutlined"; InfoCircleOutlined.inheritAttrs = false; var CloseCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" } }] }, "name": "close-circle", "theme": "outlined" }; function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key2) { _defineProperty$1(target, key2, source[key2]); }); } return target; } function _defineProperty$1(obj, key2, value) { if (key2 in obj) { Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value; } return obj; } var CloseCircleOutlined = function CloseCircleOutlined2(props, context) { var p = _objectSpread$1({}, props, context.attrs); return createVNode(Icon, _objectSpread$1({}, p, { "icon": CloseCircleOutlined$1 }), null); }; CloseCircleOutlined.displayName = "CloseCircleOutlined"; CloseCircleOutlined.inheritAttrs = false; var ExclamationCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" }; function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key2) { _defineProperty(target, key2, source[key2]); }); } return target; } function _defineProperty(obj, key2, value) { if (key2 in obj) { Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value; } return obj; } var ExclamationCircleOutlined = function ExclamationCircleOutlined2(props, context) { var p = _objectSpread({}, props, context.attrs); return createVNode(Icon, _objectSpread({}, p, { "icon": ExclamationCircleOutlined$1 }), null); }; ExclamationCircleOutlined.displayName = "ExclamationCircleOutlined"; ExclamationCircleOutlined.inheritAttrs = false; const genNotificationPlacementStyle = (token) => { const { componentCls, width, notificationMarginEdge } = token; const notificationTopFadeIn = new Keyframe("antNotificationTopFadeIn", { "0%": { marginTop: "-100%", opacity: 0 }, "100%": { marginTop: 0, opacity: 1 } }); const notificationBottomFadeIn = new Keyframe("antNotificationBottomFadeIn", { "0%": { marginBottom: "-100%", opacity: 0 }, "100%": { marginBottom: 0, opacity: 1 } }); const notificationLeftFadeIn = new Keyframe("antNotificationLeftFadeIn", { "0%": { right: { _skip_check_: true, value: width }, opacity: 0 }, "100%": { right: { _skip_check_: true, value: 0 }, opacity: 1 } }); return { [`&${componentCls}-top, &${componentCls}-bottom`]: { marginInline: 0 }, [`&${componentCls}-top`]: { [`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: { animationName: notificationTopFadeIn } }, [`&${componentCls}-bottom`]: { [`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: { animationName: notificationBottomFadeIn } }, [`&${componentCls}-topLeft, &${componentCls}-bottomLeft`]: { marginInlineEnd: 0, marginInlineStart: notificationMarginEdge, [`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: { animationName: notificationLeftFadeIn } } }; }; const genNotificationStyle = (token) => { const { iconCls, componentCls, // .ant-notification boxShadowSecondary, fontSizeLG, notificationMarginBottom, borderRadiusLG, colorSuccess, colorInfo, colorWarning, colorError, colorTextHeading, notificationBg, notificationPadding, notificationMarginEdge, motionDurationMid, motionEaseInOut, fontSize, lineHeight, width, notificationIconSize } = token; const noticeCls = `${componentCls}-notice`; const notificationFadeIn = new Keyframe("antNotificationFadeIn", { "0%": { left: { _skip_check_: true, value: width }, opacity: 0 }, "100%": { left: { _skip_