| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918 |
- var xt = Object.defineProperty, $t = Object.defineProperties;
- var wt = Object.getOwnPropertyDescriptors;
- var ke = Object.getOwnPropertySymbols;
- var Tt = Object.prototype.hasOwnProperty, Bt = Object.prototype.propertyIsEnumerable;
- var _e = (e, t, o) => t in e ? xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, pe = (e, t) => {
- for (var o in t || (t = {}))
- Tt.call(t, o) && _e(e, o, t[o]);
- if (ke)
- for (var o of ke(t))
- Bt.call(t, o) && _e(e, o, t[o]);
- return e;
- }, Me = (e, t) => $t(e, wt(t));
- import { defineComponent as te, ref as T, computed as q, createVNode as a, Transition as Ze, withDirectives as et, vShow as tt, nextTick as ot, shallowRef as L, watch as _, onBeforeUnmount as nt, watchEffect as lt, Fragment as He, render as We, unref as Ne, isRef as at, toRefs as Pt, customRef as Ft, getCurrentScope as Ot, onScopeDispose as Mt, useAttrs as At, resolveComponent as we, openBlock as D, createBlock as ne, mergeProps as Ht, withCtx as N, createElementVNode as de, createElementBlock as le, renderList as Ve, createCommentVNode as ee, renderSlot as je, normalizeStyle as zt, resolveDynamicComponent as It, createTextVNode as ue, toDisplayString as ae } from "vue";
- import Nt from "./ModalHeader.js";
- import { d3 as Rt, cy as it, P as E, _ as P, bb as rt, d as f, cL as Et, c as ye, o as st, i as Be, d4 as Dt, K as Ge, d5 as Lt, bR as kt, g as _t, m as Wt, bD as Vt, r as jt, cJ as Gt, cP as Kt, b4 as Re, u as Xt, br as ct, a4 as Te, bV as Yt, B as ze, d6 as Ut, e as ge, d7 as Qt, a as qt, bf as Jt, be as Zt, bg as eo, d8 as to, d9 as oo, da as no, d1 as lo, db as ao, dc as io, b6 as ro, n as so, aB as co } from "./index2.js";
- import { A as Ke } from "./ActionButton.js";
- import { T as uo, _ as fo } from "./index13.js";
- import { _ as mo, S as vo } from "./index12.js";
- import { S as po } from "./index9.js";
- const go = new it("antFadeIn", {
- "0%": {
- opacity: 0
- },
- "100%": {
- opacity: 1
- }
- }), yo = new it("antFadeOut", {
- "0%": {
- opacity: 1
- },
- "100%": {
- opacity: 0
- }
- }), Co = function(e) {
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
- const {
- antCls: o
- } = e, n = `${o}-fade`, l = t ? "&" : "";
- return [Rt(n, go, yo, e.motionDurationMid, t), {
- [`
- ${l}${n}-enter,
- ${l}${n}-appear
- `]: {
- opacity: 0,
- animationTimingFunction: "linear"
- },
- [`${l}${n}-leave`]: {
- animationTimingFunction: "linear"
- }
- }];
- };
- function Ee() {
- return {
- keyboard: {
- type: Boolean,
- default: void 0
- },
- mask: {
- type: Boolean,
- default: void 0
- },
- afterClose: Function,
- closable: {
- type: Boolean,
- default: void 0
- },
- maskClosable: {
- type: Boolean,
- default: void 0
- },
- visible: {
- type: Boolean,
- default: void 0
- },
- destroyOnClose: {
- type: Boolean,
- default: void 0
- },
- mousePosition: E.shape({
- x: Number,
- y: Number
- }).loose,
- title: E.any,
- footer: E.any,
- transitionName: String,
- maskTransitionName: String,
- animation: E.any,
- maskAnimation: E.any,
- wrapStyle: {
- type: Object,
- default: void 0
- },
- bodyStyle: {
- type: Object,
- default: void 0
- },
- maskStyle: {
- type: Object,
- default: void 0
- },
- prefixCls: String,
- wrapClassName: String,
- rootClassName: String,
- width: [String, Number],
- height: [String, Number],
- zIndex: Number,
- bodyProps: E.any,
- maskProps: E.any,
- wrapProps: E.any,
- getContainer: E.any,
- dialogStyle: {
- type: Object,
- default: void 0
- },
- dialogClass: String,
- closeIcon: E.any,
- forceRender: {
- type: Boolean,
- default: void 0
- },
- getOpenCount: Function,
- // https://github.com/ant-design/ant-design/issues/19771
- // https://github.com/react-component/dialog/issues/95
- focusTriggerAfterClose: {
- type: Boolean,
- default: void 0
- },
- onClose: Function,
- modalRender: Function
- };
- }
- function Xe(e, t, o) {
- let n = t;
- return !n && o && (n = `${e}-${o}`), n;
- }
- let Ye = -1;
- function bo() {
- return Ye += 1, Ye;
- }
- function Ue(e, t) {
- let o = e[`page${t ? "Y" : "X"}Offset`];
- const n = `scroll${t ? "Top" : "Left"}`;
- if (typeof o != "number") {
- const l = e.document;
- o = l.documentElement[n], typeof o != "number" && (o = l.body[n]);
- }
- return o;
- }
- function ho(e) {
- const t = e.getBoundingClientRect(), o = {
- left: t.left,
- top: t.top
- }, n = e.ownerDocument, l = n.defaultView || n.parentWindow;
- return o.left += Ue(l), o.top += Ue(l, !0), o;
- }
- const So = {
- width: 0,
- height: 0,
- overflow: "hidden",
- outline: "none"
- }, xo = {
- outline: "none"
- }, $o = te({
- compatConfig: {
- MODE: 3
- },
- name: "DialogContent",
- inheritAttrs: !1,
- props: f(f({}, Ee()), {
- motionName: String,
- ariaId: String,
- onVisibleChanged: Function,
- onMousedown: Function,
- onMouseup: Function
- }),
- setup(e, t) {
- let {
- expose: o,
- slots: n,
- attrs: l
- } = t;
- const r = T(), p = T(), m = T();
- o({
- focus: () => {
- var s;
- (s = r.value) === null || s === void 0 || s.focus({
- preventScroll: !0
- });
- },
- changeActive: (s) => {
- const {
- activeElement: i
- } = document;
- s && i === p.value ? r.value.focus({
- preventScroll: !0
- }) : !s && i === r.value && p.value.focus({
- preventScroll: !0
- });
- }
- });
- const x = T(), v = q(() => {
- const {
- width: s,
- height: i
- } = e, y = {};
- return s !== void 0 && (y.width = typeof s == "number" ? `${s}px` : s), i !== void 0 && (y.height = typeof i == "number" ? `${i}px` : i), x.value && (y.transformOrigin = x.value), y;
- }), d = () => {
- ot(() => {
- if (m.value) {
- const s = ho(m.value);
- x.value = e.mousePosition ? `${e.mousePosition.x - s.left}px ${e.mousePosition.y - s.top}px` : "";
- }
- });
- }, u = (s) => {
- e.onVisibleChanged(s);
- };
- return () => {
- var s, i, y, S;
- const {
- prefixCls: $,
- footer: c = (s = n.footer) === null || s === void 0 ? void 0 : s.call(n),
- title: h = (i = n.title) === null || i === void 0 ? void 0 : i.call(n),
- ariaId: C,
- closable: B,
- closeIcon: O = (y = n.closeIcon) === null || y === void 0 ? void 0 : y.call(n),
- onClose: A,
- bodyStyle: z,
- bodyProps: b,
- onMousedown: F,
- onMouseup: M,
- visible: w,
- modalRender: H = n.modalRender,
- destroyOnClose: X,
- motionName: G
- } = e;
- let U;
- c && (U = a("div", {
- class: `${$}-footer`
- }, [c]));
- let k;
- h && (k = a("div", {
- class: `${$}-header`
- }, [a("div", {
- class: `${$}-title`,
- id: C
- }, [h])]));
- let I;
- B && (I = a("button", {
- type: "button",
- onClick: A,
- "aria-label": "Close",
- class: `${$}-close`
- }, [O || a("span", {
- class: `${$}-close-x`
- }, null)]));
- const V = a("div", {
- class: `${$}-content`
- }, [I, k, a("div", P({
- class: `${$}-body`,
- style: z
- }, b), [(S = n.default) === null || S === void 0 ? void 0 : S.call(n)]), U]), me = rt(G);
- return a(Ze, P(P({}, me), {}, {
- onBeforeEnter: d,
- onAfterEnter: () => u(!0),
- onAfterLeave: () => u(!1)
- }), {
- default: () => [w || !X ? et(a("div", P(P({}, l), {}, {
- ref: m,
- key: "dialog-element",
- role: "document",
- style: [v.value, l.style],
- class: [$, l.class],
- onMousedown: F,
- onMouseup: M
- }), [a("div", {
- tabindex: 0,
- ref: r,
- style: xo
- }, [H ? H({
- originVNode: V
- }) : V]), a("div", {
- tabindex: 0,
- ref: p,
- style: So
- }, null)]), [[tt, w]]) : null]
- });
- };
- }
- }), wo = te({
- compatConfig: {
- MODE: 3
- },
- name: "DialogMask",
- props: {
- prefixCls: String,
- visible: Boolean,
- motionName: String,
- maskProps: Object
- },
- setup(e, t) {
- return () => {
- const {
- prefixCls: o,
- visible: n,
- maskProps: l,
- motionName: r
- } = e, p = rt(r);
- return a(Ze, p, {
- default: () => [et(a("div", P({
- class: `${o}-mask`
- }, l), null), [[tt, n]])]
- });
- };
- }
- }), Qe = te({
- compatConfig: {
- MODE: 3
- },
- name: "VcDialog",
- inheritAttrs: !1,
- props: Be(f(f({}, Ee()), {
- getOpenCount: Function,
- scrollLocker: Object
- }), {
- mask: !0,
- visible: !1,
- keyboard: !0,
- closable: !0,
- maskClosable: !0,
- destroyOnClose: !1,
- prefixCls: "rc-dialog",
- getOpenCount: () => null,
- focusTriggerAfterClose: !0
- }),
- setup(e, t) {
- let {
- attrs: o,
- slots: n
- } = t;
- const l = L(), r = L(), p = L(), m = L(e.visible), x = L(`vcDialogTitle${bo()}`), v = (c) => {
- var h, C;
- if (c)
- Dt(r.value, document.activeElement) || (l.value = document.activeElement, (h = p.value) === null || h === void 0 || h.focus());
- else {
- const B = m.value;
- if (m.value = !1, e.mask && l.value && e.focusTriggerAfterClose) {
- try {
- l.value.focus({
- preventScroll: !0
- });
- } catch (O) {
- }
- l.value = null;
- }
- B && ((C = e.afterClose) === null || C === void 0 || C.call(e));
- }
- }, d = (c) => {
- var h;
- (h = e.onClose) === null || h === void 0 || h.call(e, c);
- }, u = L(!1), s = L(), i = () => {
- clearTimeout(s.value), u.value = !0;
- }, y = () => {
- s.value = setTimeout(() => {
- u.value = !1;
- });
- }, S = (c) => {
- if (!e.maskClosable) return null;
- u.value ? u.value = !1 : r.value === c.target && d(c);
- }, $ = (c) => {
- if (e.keyboard && c.keyCode === Ge.ESC) {
- c.stopPropagation(), d(c);
- return;
- }
- e.visible && c.keyCode === Ge.TAB && p.value.changeActive(!c.shiftKey);
- };
- return _(() => e.visible, () => {
- e.visible && (m.value = !0);
- }, {
- flush: "post"
- }), nt(() => {
- var c;
- clearTimeout(s.value), (c = e.scrollLocker) === null || c === void 0 || c.unLock();
- }), lt(() => {
- var c, h;
- (c = e.scrollLocker) === null || c === void 0 || c.unLock(), m.value && ((h = e.scrollLocker) === null || h === void 0 || h.lock());
- }), () => {
- const {
- prefixCls: c,
- mask: h,
- visible: C,
- maskTransitionName: B,
- maskAnimation: O,
- zIndex: A,
- wrapClassName: z,
- rootClassName: b,
- wrapStyle: F,
- closable: M,
- maskProps: w,
- maskStyle: H,
- transitionName: X,
- animation: G,
- wrapProps: U,
- title: k = n.title
- } = e, {
- style: I,
- class: V
- } = o;
- return a("div", P({
- class: [`${c}-root`, b]
- }, Et(e, {
- data: !0
- })), [a(wo, {
- prefixCls: c,
- visible: h && C,
- motionName: Xe(c, B, O),
- style: f({
- zIndex: A
- }, H),
- maskProps: w
- }, null), a("div", P({
- tabIndex: -1,
- onKeydown: $,
- class: ye(`${c}-wrap`, z),
- ref: r,
- onClick: S,
- role: "dialog",
- "aria-labelledby": k ? x.value : null,
- style: f(f({
- zIndex: A
- }, F), {
- display: m.value ? null : "none"
- })
- }, U), [a($o, P(P({}, st(e, ["scrollLocker"])), {}, {
- style: I,
- class: V,
- onMousedown: i,
- onMouseup: y,
- ref: p,
- closable: M,
- ariaId: x.value,
- prefixCls: c,
- visible: C,
- onClose: d,
- onVisibleChanged: v,
- motionName: Xe(c, X, G)
- }), n)])]);
- };
- }
- }), To = Ee(), Bo = te({
- compatConfig: {
- MODE: 3
- },
- name: "DialogWrap",
- inheritAttrs: !1,
- props: Be(To, {
- visible: !1
- }),
- setup(e, t) {
- let {
- attrs: o,
- slots: n
- } = t;
- const l = T(e.visible);
- return Lt({}, {
- inTriggerContext: !1
- }), _(() => e.visible, () => {
- e.visible && (l.value = !0);
- }, {
- flush: "post"
- }), () => {
- const {
- visible: r,
- getContainer: p,
- forceRender: m,
- destroyOnClose: x = !1,
- afterClose: v
- } = e;
- let d = f(f(f({}, e), o), {
- ref: "_component",
- key: "dialog"
- });
- return p === !1 ? a(Qe, P(P({}, d), {}, {
- getOpenCount: () => 2
- }), n) : !m && x && !l.value ? null : a(kt, {
- autoLock: !0,
- visible: r,
- forceRender: m,
- getContainer: p
- }, {
- default: (u) => (d = f(f(f({}, d), u), {
- afterClose: () => {
- v == null || v(), l.value = !1;
- }
- }), a(Qe, d, n))
- });
- };
- }
- });
- function qe(e) {
- return {
- position: e,
- top: 0,
- insetInlineEnd: 0,
- bottom: 0,
- insetInlineStart: 0
- };
- }
- const Po = (e) => {
- const {
- componentCls: t
- } = e;
- return [{
- [`${t}-root`]: {
- [`${t}${e.antCls}-zoom-enter, ${t}${e.antCls}-zoom-appear`]: {
- // reset scale avoid mousePosition bug
- transform: "none",
- opacity: 0,
- animationDuration: e.motionDurationSlow,
- // https://github.com/ant-design/ant-design/issues/11777
- userSelect: "none"
- },
- [`${t}${e.antCls}-zoom-leave ${t}-content`]: {
- pointerEvents: "none"
- },
- [`${t}-mask`]: f(f({}, qe("fixed")), {
- zIndex: e.zIndexPopupBase,
- height: "100%",
- backgroundColor: e.colorBgMask,
- [`${t}-hidden`]: {
- display: "none"
- }
- }),
- [`${t}-wrap`]: f(f({}, qe("fixed")), {
- overflow: "auto",
- outline: 0,
- WebkitOverflowScrolling: "touch"
- })
- }
- }, {
- [`${t}-root`]: Co(e)
- }];
- }, Fo = (e) => {
- const {
- componentCls: t
- } = e;
- return [
- // ======================== Root =========================
- {
- [`${t}-root`]: {
- [`${t}-wrap`]: {
- zIndex: e.zIndexPopupBase,
- position: "fixed",
- inset: 0,
- overflow: "auto",
- outline: 0,
- WebkitOverflowScrolling: "touch"
- },
- [`${t}-wrap-rtl`]: {
- direction: "rtl"
- },
- [`${t}-centered`]: {
- textAlign: "center",
- "&::before": {
- display: "inline-block",
- width: 0,
- height: "100%",
- verticalAlign: "middle",
- content: '""'
- },
- [t]: {
- top: 0,
- display: "inline-block",
- paddingBottom: 0,
- textAlign: "start",
- verticalAlign: "middle"
- }
- },
- [`@media (max-width: ${e.screenSMMax})`]: {
- [t]: {
- maxWidth: "calc(100vw - 16px)",
- margin: `${e.marginXS} auto`
- },
- [`${t}-centered`]: {
- [t]: {
- flex: 1
- }
- }
- }
- }
- },
- // ======================== Modal ========================
- {
- [t]: f(f({}, jt(e)), {
- pointerEvents: "none",
- position: "relative",
- top: 100,
- width: "auto",
- maxWidth: `calc(100vw - ${e.margin * 2}px)`,
- margin: "0 auto",
- paddingBottom: e.paddingLG,
- [`${t}-title`]: {
- margin: 0,
- color: e.modalHeadingColor,
- fontWeight: e.fontWeightStrong,
- fontSize: e.modalHeaderTitleFontSize,
- lineHeight: e.modalHeaderTitleLineHeight,
- wordWrap: "break-word"
- },
- [`${t}-content`]: {
- position: "relative",
- backgroundColor: e.modalContentBg,
- backgroundClip: "padding-box",
- border: 0,
- borderRadius: e.borderRadiusLG,
- boxShadow: e.boxShadowSecondary,
- pointerEvents: "auto",
- padding: `${e.paddingMD}px ${e.paddingContentHorizontalLG}px`
- },
- [`${t}-close`]: f({
- position: "absolute",
- top: (e.modalHeaderCloseSize - e.modalCloseBtnSize) / 2,
- insetInlineEnd: (e.modalHeaderCloseSize - e.modalCloseBtnSize) / 2,
- zIndex: e.zIndexPopupBase + 10,
- padding: 0,
- color: e.modalCloseColor,
- fontWeight: e.fontWeightStrong,
- lineHeight: 1,
- textDecoration: "none",
- background: "transparent",
- borderRadius: e.borderRadiusSM,
- width: e.modalConfirmIconSize,
- height: e.modalConfirmIconSize,
- border: 0,
- outline: 0,
- cursor: "pointer",
- transition: `color ${e.motionDurationMid}, background-color ${e.motionDurationMid}`,
- "&-x": {
- display: "block",
- fontSize: e.fontSizeLG,
- fontStyle: "normal",
- lineHeight: `${e.modalCloseBtnSize}px`,
- textAlign: "center",
- textTransform: "none",
- textRendering: "auto"
- },
- "&:hover": {
- color: e.modalIconHoverColor,
- backgroundColor: e.wireframe ? "transparent" : e.colorFillContent,
- textDecoration: "none"
- },
- "&:active": {
- backgroundColor: e.wireframe ? "transparent" : e.colorFillContentHover
- }
- }, Gt(e)),
- [`${t}-header`]: {
- color: e.colorText,
- background: e.modalHeaderBg,
- borderRadius: `${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`,
- marginBottom: e.marginXS
- },
- [`${t}-body`]: {
- fontSize: e.fontSize,
- lineHeight: e.lineHeight,
- wordWrap: "break-word"
- },
- [`${t}-footer`]: {
- textAlign: "end",
- background: e.modalFooterBg,
- marginTop: e.marginSM,
- [`${e.antCls}-btn + ${e.antCls}-btn:not(${e.antCls}-dropdown-trigger)`]: {
- marginBottom: 0,
- marginInlineStart: e.marginXS
- }
- },
- [`${t}-open`]: {
- overflow: "hidden"
- }
- })
- },
- // ======================== Pure =========================
- {
- [`${t}-pure-panel`]: {
- top: "auto",
- padding: 0,
- display: "flex",
- flexDirection: "column",
- [`${t}-content,
- ${t}-body,
- ${t}-confirm-body-wrapper`]: {
- display: "flex",
- flexDirection: "column",
- flex: "auto"
- },
- [`${t}-confirm-body`]: {
- marginBottom: "auto"
- }
- }
- }
- ];
- }, Oo = (e) => {
- const {
- componentCls: t
- } = e, o = `${t}-confirm`;
- return {
- [o]: {
- "&-rtl": {
- direction: "rtl"
- },
- [`${e.antCls}-modal-header`]: {
- display: "none"
- },
- [`${o}-body-wrapper`]: f({}, Kt()),
- [`${o}-body`]: {
- display: "flex",
- flexWrap: "wrap",
- alignItems: "center",
- [`${o}-title`]: {
- flex: "0 0 100%",
- display: "block",
- // create BFC to avoid
- // https://user-images.githubusercontent.com/507615/37702510-ba844e06-2d2d-11e8-9b67-8e19be57f445.png
- overflow: "hidden",
- color: e.colorTextHeading,
- fontWeight: e.fontWeightStrong,
- fontSize: e.modalHeaderTitleFontSize,
- lineHeight: e.modalHeaderTitleLineHeight,
- [`+ ${o}-content`]: {
- marginBlockStart: e.marginXS,
- flexBasis: "100%",
- maxWidth: `calc(100% - ${e.modalConfirmIconSize + e.marginSM}px)`
- }
- },
- [`${o}-content`]: {
- color: e.colorText,
- fontSize: e.fontSize
- },
- [`> ${e.iconCls}`]: {
- flex: "none",
- marginInlineEnd: e.marginSM,
- fontSize: e.modalConfirmIconSize,
- [`+ ${o}-title`]: {
- flex: 1
- },
- // `content` after `icon` should set marginLeft
- [`+ ${o}-title + ${o}-content`]: {
- marginInlineStart: e.modalConfirmIconSize + e.marginSM
- }
- }
- },
- [`${o}-btns`]: {
- textAlign: "end",
- marginTop: e.marginSM,
- [`${e.antCls}-btn + ${e.antCls}-btn`]: {
- marginBottom: 0,
- marginInlineStart: e.marginXS
- }
- }
- },
- [`${o}-error ${o}-body > ${e.iconCls}`]: {
- color: e.colorError
- },
- [`${o}-warning ${o}-body > ${e.iconCls},
- ${o}-confirm ${o}-body > ${e.iconCls}`]: {
- color: e.colorWarning
- },
- [`${o}-info ${o}-body > ${e.iconCls}`]: {
- color: e.colorInfo
- },
- [`${o}-success ${o}-body > ${e.iconCls}`]: {
- color: e.colorSuccess
- },
- // https://github.com/ant-design/ant-design/issues/37329
- [`${t}-zoom-leave ${t}-btns`]: {
- pointerEvents: "none"
- }
- };
- }, Mo = (e) => {
- const {
- componentCls: t
- } = e;
- return {
- [`${t}-root`]: {
- [`${t}-wrap-rtl`]: {
- direction: "rtl",
- [`${t}-confirm-body`]: {
- direction: "rtl"
- }
- }
- }
- };
- }, Ao = (e) => {
- const {
- componentCls: t,
- antCls: o
- } = e, n = `${t}-confirm`;
- return {
- [t]: {
- [`${t}-content`]: {
- padding: 0
- },
- [`${t}-header`]: {
- padding: e.modalHeaderPadding,
- borderBottom: `${e.modalHeaderBorderWidth}px ${e.modalHeaderBorderStyle} ${e.modalHeaderBorderColorSplit}`,
- marginBottom: 0
- },
- [`${t}-body`]: {
- padding: e.modalBodyPadding
- },
- [`${t}-footer`]: {
- padding: `${e.modalFooterPaddingVertical}px ${e.modalFooterPaddingHorizontal}px`,
- borderTop: `${e.modalFooterBorderWidth}px ${e.modalFooterBorderStyle} ${e.modalFooterBorderColorSplit}`,
- borderRadius: `0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`,
- marginTop: 0
- }
- },
- [n]: {
- [`${o}-modal-body`]: {
- padding: `${e.padding * 2}px ${e.padding * 2}px ${e.paddingLG}px`
- },
- [`${n}-body`]: {
- [`> ${e.iconCls}`]: {
- marginInlineEnd: e.margin,
- // `content` after `icon` should set marginLeft
- [`+ ${n}-title + ${n}-content`]: {
- marginInlineStart: e.modalConfirmIconSize + e.margin
- }
- }
- },
- [`${n}-btns`]: {
- marginTop: e.marginLG
- }
- }
- };
- }, Ho = _t("Modal", (e) => {
- const t = e.padding, o = e.fontSizeHeading5, n = e.lineHeightHeading5, l = Wt(e, {
- modalBodyPadding: e.paddingLG,
- modalHeaderBg: e.colorBgElevated,
- modalHeaderPadding: `${t}px ${e.paddingLG}px`,
- modalHeaderBorderWidth: e.lineWidth,
- modalHeaderBorderStyle: e.lineType,
- modalHeaderTitleLineHeight: n,
- modalHeaderTitleFontSize: o,
- modalHeaderBorderColorSplit: e.colorSplit,
- modalHeaderCloseSize: n * o + t * 2,
- modalContentBg: e.colorBgElevated,
- modalHeadingColor: e.colorTextHeading,
- modalCloseColor: e.colorTextDescription,
- modalFooterBg: "transparent",
- modalFooterBorderColorSplit: e.colorSplit,
- modalFooterBorderStyle: e.lineType,
- modalFooterPaddingVertical: e.paddingXS,
- modalFooterPaddingHorizontal: e.padding,
- modalFooterBorderWidth: e.lineWidth,
- modalConfirmTitleFontSize: e.fontSizeLG,
- modalIconHoverColor: e.colorIconHover,
- modalConfirmIconSize: e.fontSize * e.lineHeight,
- modalCloseBtnSize: e.controlHeightLG * 0.55
- });
- return [Fo(l), Oo(l), Mo(l), Po(l), e.wireframe && Ao(l), Vt(l, "zoom")];
- });
- var zo = function(e, t) {
- var o = {};
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, n = Object.getOwnPropertySymbols(e); l < n.length; l++)
- t.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (o[n[l]] = e[n[l]]);
- return o;
- };
- let Ie;
- const Io = (e) => {
- Ie = {
- x: e.pageX,
- y: e.pageY
- }, setTimeout(() => Ie = null, 100);
- };
- Qt() && qt(document.documentElement, "click", Io, !0);
- const No = () => ({
- prefixCls: String,
- /** @deprecated Please use `open` instead. */
- visible: {
- type: Boolean,
- default: void 0
- },
- open: {
- type: Boolean,
- default: void 0
- },
- confirmLoading: {
- type: Boolean,
- default: void 0
- },
- title: E.any,
- closable: {
- type: Boolean,
- default: void 0
- },
- closeIcon: E.any,
- onOk: Function,
- onCancel: Function,
- "onUpdate:visible": Function,
- "onUpdate:open": Function,
- onChange: Function,
- afterClose: Function,
- centered: {
- type: Boolean,
- default: void 0
- },
- width: [String, Number],
- footer: E.any,
- okText: E.any,
- okType: String,
- cancelText: E.any,
- icon: E.any,
- maskClosable: {
- type: Boolean,
- default: void 0
- },
- forceRender: {
- type: Boolean,
- default: void 0
- },
- okButtonProps: ge(),
- cancelButtonProps: ge(),
- destroyOnClose: {
- type: Boolean,
- default: void 0
- },
- wrapClassName: String,
- maskTransitionName: String,
- transitionName: String,
- getContainer: {
- type: [String, Function, Boolean, Object],
- default: void 0
- },
- zIndex: Number,
- bodyStyle: ge(),
- maskStyle: ge(),
- mask: {
- type: Boolean,
- default: void 0
- },
- keyboard: {
- type: Boolean,
- default: void 0
- },
- wrapProps: Object,
- focusTriggerAfterClose: {
- type: Boolean,
- default: void 0
- },
- modalRender: Function,
- mousePosition: ge()
- }), W = te({
- compatConfig: {
- MODE: 3
- },
- name: "AModal",
- inheritAttrs: !1,
- props: Be(No(), {
- width: 520,
- confirmLoading: !1,
- okType: "primary"
- }),
- setup(e, t) {
- let {
- emit: o,
- slots: n,
- attrs: l
- } = t;
- const [r] = Re("Modal"), {
- prefixCls: p,
- rootPrefixCls: m,
- direction: x,
- getPopupContainer: v
- } = Xt("modal", e), [d, u] = Ho(p);
- ct(e.visible === void 0, "Modal", "`visible` will be removed in next major version, please use `open` instead.");
- const s = (S) => {
- o("update:visible", !1), o("update:open", !1), o("cancel", S), o("change", !1);
- }, i = (S) => {
- o("ok", S);
- }, y = () => {
- var S, $;
- const {
- okText: c = (S = n.okText) === null || S === void 0 ? void 0 : S.call(n),
- okType: h,
- cancelText: C = ($ = n.cancelText) === null || $ === void 0 ? void 0 : $.call(n),
- confirmLoading: B
- } = e;
- return a(He, null, [a(ze, P({
- onClick: s
- }, e.cancelButtonProps), {
- default: () => [C || r.value.cancelText]
- }), a(ze, P(P({}, Ut(h)), {}, {
- loading: B,
- onClick: i
- }, e.okButtonProps), {
- default: () => [c || r.value.okText]
- })]);
- };
- return () => {
- var S, $;
- const {
- prefixCls: c,
- visible: h,
- open: C,
- wrapClassName: B,
- centered: O,
- getContainer: A,
- closeIcon: z = (S = n.closeIcon) === null || S === void 0 ? void 0 : S.call(n),
- focusTriggerAfterClose: b = !0
- } = e, F = zo(e, ["prefixCls", "visible", "open", "wrapClassName", "centered", "getContainer", "closeIcon", "focusTriggerAfterClose"]), M = ye(B, {
- [`${p.value}-centered`]: !!O,
- [`${p.value}-wrap-rtl`]: x.value === "rtl"
- });
- return d(a(Bo, P(P(P({}, F), l), {}, {
- rootClassName: u.value,
- class: ye(u.value, l.class),
- getContainer: A || (v == null ? void 0 : v.value),
- prefixCls: p.value,
- wrapClassName: M,
- visible: C != null ? C : h,
- onClose: s,
- focusTriggerAfterClose: b,
- transitionName: Te(m.value, "zoom", e.transitionName),
- maskTransitionName: Te(m.value, "fade", e.maskTransitionName),
- mousePosition: ($ = F.mousePosition) !== null && $ !== void 0 ? $ : Ie
- }), f(f({}, n), {
- footer: n.footer || y,
- closeIcon: () => a("span", {
- class: `${p.value}-close-x`
- }, [z || a(Yt, {
- class: `${p.value}-close-icon`
- }, null)])
- })));
- };
- }
- });
- function fe(e) {
- return typeof e == "function" ? e() : e;
- }
- const dt = te({
- name: "ConfirmDialog",
- inheritAttrs: !1,
- props: ["icon", "onCancel", "onOk", "close", "closable", "zIndex", "afterClose", "visible", "open", "keyboard", "centered", "getContainer", "maskStyle", "okButtonProps", "cancelButtonProps", "okType", "prefixCls", "okCancel", "width", "mask", "maskClosable", "okText", "cancelText", "autoFocusButton", "transitionName", "maskTransitionName", "type", "title", "content", "direction", "rootPrefixCls", "bodyStyle", "closeIcon", "modalRender", "focusTriggerAfterClose", "wrapClassName", "confirmPrefixCls", "footer"],
- setup(e, t) {
- let {
- attrs: o
- } = t;
- const [n] = Re("Modal");
- return process.env.NODE_ENV !== "production" && ct(e.visible === void 0, "Modal", "`visible` is deprecated, please use `open` instead."), () => {
- const {
- icon: l,
- onCancel: r,
- onOk: p,
- close: m,
- okText: x,
- closable: v = !1,
- zIndex: d,
- afterClose: u,
- keyboard: s,
- centered: i,
- getContainer: y,
- maskStyle: S,
- okButtonProps: $,
- cancelButtonProps: c,
- okCancel: h,
- width: C = 416,
- mask: B = !0,
- maskClosable: O = !1,
- type: A,
- open: z,
- title: b,
- content: F,
- direction: M,
- closeIcon: w,
- modalRender: H,
- focusTriggerAfterClose: X,
- rootPrefixCls: G,
- bodyStyle: U,
- wrapClassName: k,
- footer: I
- } = e;
- let V = l;
- if (!l && l !== null)
- switch (A) {
- case "info":
- V = a(to, null, null);
- break;
- case "success":
- V = a(eo, null, null);
- break;
- case "error":
- V = a(Zt, null, null);
- break;
- default:
- V = a(Jt, null, null);
- }
- const me = e.okType || "primary", Q = e.prefixCls || "ant-modal", Y = `${Q}-confirm`, Pe = o.style || {}, be = h != null ? h : A === "confirm", re = e.autoFocusButton === null ? !1 : e.autoFocusButton || "ok", se = `${Q}-confirm`, Fe = ye(se, `${se}-${e.type}`, {
- [`${se}-rtl`]: M === "rtl"
- }, o.class), ve = n.value, Oe = be && a(Ke, {
- actionFn: r,
- close: m,
- autofocus: re === "cancel",
- buttonProps: c,
- prefixCls: `${G}-btn`
- }, {
- default: () => [fe(e.cancelText) || ve.cancelText]
- });
- return a(W, {
- prefixCls: Q,
- class: Fe,
- wrapClassName: ye({
- [`${se}-centered`]: !!i
- }, k),
- onCancel: (he) => m == null ? void 0 : m({
- triggerCancel: !0
- }, he),
- open: z,
- title: "",
- footer: "",
- transitionName: Te(G, "zoom", e.transitionName),
- maskTransitionName: Te(G, "fade", e.maskTransitionName),
- mask: B,
- maskClosable: O,
- maskStyle: S,
- style: Pe,
- bodyStyle: U,
- width: C,
- zIndex: d,
- afterClose: u,
- keyboard: s,
- centered: i,
- getContainer: y,
- closable: v,
- closeIcon: w,
- modalRender: H,
- focusTriggerAfterClose: X
- }, {
- default: () => [a("div", {
- class: `${Y}-body-wrapper`
- }, [a("div", {
- class: `${Y}-body`
- }, [fe(V), b === void 0 ? null : a("span", {
- class: `${Y}-title`
- }, [fe(b)]), a("div", {
- class: `${Y}-content`
- }, [fe(F)])]), I !== void 0 ? fe(I) : a("div", {
- class: `${Y}-btns`
- }, [Oe, a(Ke, {
- type: me,
- actionFn: p,
- close: m,
- autofocus: re === "ok",
- buttonProps: $,
- prefixCls: `${G}-btn`
- }, {
- default: () => [fe(x) || (be ? ve.okText : ve.justOkText)]
- })])])]
- });
- };
- }
- }), ie = [], Ce = (e) => {
- const t = document.createDocumentFragment();
- let o = f(f({}, st(e, ["parentContext", "appContext"])), {
- close: r,
- open: !0
- }), n = null;
- function l() {
- n && (We(null, t), n = null);
- for (var v = arguments.length, d = new Array(v), u = 0; u < v; u++)
- d[u] = arguments[u];
- const s = d.some((i) => i && i.triggerCancel);
- e.onCancel && s && e.onCancel(() => {
- }, ...d.slice(1));
- for (let i = 0; i < ie.length; i++)
- if (ie[i] === r) {
- ie.splice(i, 1);
- break;
- }
- }
- function r() {
- for (var v = arguments.length, d = new Array(v), u = 0; u < v; u++)
- d[u] = arguments[u];
- o = f(f({}, o), {
- open: !1,
- afterClose: () => {
- typeof e.afterClose == "function" && e.afterClose(), l.apply(this, d);
- }
- }), o.visible && delete o.visible, p(o);
- }
- function p(v) {
- typeof v == "function" ? o = v(o) : o = f(f({}, o), v), n && oo(n, o, t);
- }
- const m = (v) => {
- const d = no, u = d.prefixCls, s = v.prefixCls || `${u}-modal`, i = d.iconPrefixCls, y = ao();
- return a(lo, P(P({}, d), {}, {
- prefixCls: u
- }), {
- default: () => [a(dt, P(P({}, v), {}, {
- rootPrefixCls: u,
- prefixCls: s,
- iconPrefixCls: i,
- locale: y,
- cancelText: v.cancelText || y.cancelText
- }), null)]
- });
- };
- function x(v) {
- const d = a(m, f({}, v));
- return d.appContext = e.parentContext || e.appContext || d.appContext, We(d, t), d;
- }
- return n = x(o), ie.push(r), {
- destroy: r,
- update: p
- };
- };
- function ut(e) {
- return f(f({}, e), {
- type: "warning"
- });
- }
- function ft(e) {
- return f(f({}, e), {
- type: "info"
- });
- }
- function mt(e) {
- return f(f({}, e), {
- type: "success"
- });
- }
- function vt(e) {
- return f(f({}, e), {
- type: "error"
- });
- }
- function pt(e) {
- return f(f({}, e), {
- type: "confirm"
- });
- }
- const Ro = () => ({
- config: Object,
- afterClose: Function,
- destroyAction: Function,
- open: Boolean
- }), Eo = te({
- name: "HookModal",
- inheritAttrs: !1,
- props: Be(Ro(), {
- config: {
- width: 520,
- okType: "primary"
- }
- }),
- setup(e, t) {
- let {
- expose: o
- } = t;
- var n;
- const l = q(() => e.open), r = q(() => e.config), {
- direction: p,
- getPrefixCls: m
- } = io(), x = m("modal"), v = m(), d = () => {
- var y, S;
- e == null || e.afterClose(), (S = (y = r.value).afterClose) === null || S === void 0 || S.call(y);
- }, u = function() {
- e.destroyAction(...arguments);
- };
- o({
- destroy: u
- });
- const s = (n = r.value.okCancel) !== null && n !== void 0 ? n : r.value.type === "confirm", [i] = Re("Modal", ro.Modal);
- return () => a(dt, P(P({
- prefixCls: x,
- rootPrefixCls: v
- }, r.value), {}, {
- close: u,
- open: l.value,
- afterClose: d,
- okText: r.value.okText || (s ? i == null ? void 0 : i.value.okText : i == null ? void 0 : i.value.justOkText),
- direction: r.value.direction || p.value,
- cancelText: r.value.cancelText || (i == null ? void 0 : i.value.cancelText)
- }), null);
- }
- });
- let Je = 0;
- const Do = te({
- name: "ElementsHolder",
- inheritAttrs: !1,
- setup(e, t) {
- let {
- expose: o
- } = t;
- const n = L([]);
- return o({
- addModal: (r) => (n.value.push(r), n.value = n.value.slice(), () => {
- n.value = n.value.filter((p) => p !== r);
- })
- }), () => n.value.map((r) => r());
- }
- });
- function Lo() {
- const e = L(null), t = L([]);
- _(t, () => {
- t.value.length && ([...t.value].forEach((p) => {
- p();
- }), t.value = []);
- }, {
- immediate: !0
- });
- const o = (r) => function(m) {
- var x;
- Je += 1;
- const v = L(!0), d = L(null), u = L(Ne(m)), s = L({});
- _(() => m, (C) => {
- $(f(f({}, at(C) ? C.value : C), s.value));
- });
- const i = function() {
- v.value = !1;
- for (var C = arguments.length, B = new Array(C), O = 0; O < C; O++)
- B[O] = arguments[O];
- const A = B.some((z) => z && z.triggerCancel);
- u.value.onCancel && A && u.value.onCancel(() => {
- }, ...B.slice(1));
- };
- let y;
- const S = () => a(Eo, {
- key: `modal-${Je}`,
- config: r(u.value),
- ref: d,
- open: v.value,
- destroyAction: i,
- afterClose: () => {
- y == null || y();
- }
- }, null);
- y = (x = e.value) === null || x === void 0 ? void 0 : x.addModal(S), y && ie.push(y);
- const $ = (C) => {
- u.value = f(f({}, u.value), C);
- };
- return {
- destroy: () => {
- d.value ? i() : t.value = [...t.value, i];
- },
- update: (C) => {
- s.value = C, d.value ? $(C) : t.value = [...t.value, () => $(C)];
- }
- };
- }, n = q(() => ({
- info: o(ft),
- success: o(mt),
- error: o(vt),
- warning: o(ut),
- confirm: o(pt)
- })), l = Symbol("modalHolderKey");
- return [n.value, () => a(Do, {
- key: l,
- ref: e
- }, null)];
- }
- function gt(e) {
- return Ce(ut(e));
- }
- W.useModal = Lo;
- W.info = function(t) {
- return Ce(ft(t));
- };
- W.success = function(t) {
- return Ce(mt(t));
- };
- W.error = function(t) {
- return Ce(vt(t));
- };
- W.warning = gt;
- W.warn = gt;
- W.confirm = function(t) {
- return Ce(pt(t));
- };
- W.destroyAll = function() {
- for (; ie.length; ) {
- const t = ie.pop();
- t && t();
- }
- };
- W.install = function(e) {
- return e.component(W.name, W), e;
- };
- function ko(e) {
- return Ot() ? (Mt(e), !0) : !1;
- }
- function R(e) {
- return typeof e == "function" ? e() : Ne(e);
- }
- const yt = typeof window != "undefined" && typeof document != "undefined";
- typeof WorkerGlobalScope != "undefined" && globalThis instanceof WorkerGlobalScope;
- const _o = Object.prototype.toString, Wo = (e) => _o.call(e) === "[object Object]", Vo = () => {
- };
- function jo(e, t = {}) {
- if (!at(e))
- return Pt(e);
- const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
- for (const n in e.value)
- o[n] = Ft(() => ({
- get() {
- return e.value[n];
- },
- set(l) {
- var r;
- if ((r = R(t.replaceRef)) != null ? r : !0)
- if (Array.isArray(e.value)) {
- const m = [...e.value];
- m[n] = l, e.value = m;
- } else {
- const m = Me(pe({}, e.value), { [n]: l });
- Object.setPrototypeOf(m, Object.getPrototypeOf(e.value)), e.value = m;
- }
- else
- e.value[n] = l;
- }
- }));
- return o;
- }
- const Ct = yt ? window : void 0;
- function Go(e) {
- var t;
- const o = R(e);
- return (t = o == null ? void 0 : o.$el) != null ? t : o;
- }
- function Ae(...e) {
- let t, o, n, l;
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([o, n, l] = e, t = Ct) : [t, o, n, l] = e, !t)
- return Vo;
- Array.isArray(o) || (o = [o]), Array.isArray(n) || (n = [n]);
- const r = [], p = () => {
- r.forEach((d) => d()), r.length = 0;
- }, m = (d, u, s, i) => (d.addEventListener(u, s, i), () => d.removeEventListener(u, s, i)), x = _(
- () => [Go(t), R(l)],
- ([d, u]) => {
- if (p(), !d)
- return;
- const s = Wo(u) ? pe({}, u) : u;
- r.push(
- ...o.flatMap((i) => n.map((y) => m(d, i, y, s)))
- );
- },
- { immediate: !0, flush: "post" }
- ), v = () => {
- x(), p();
- };
- return ko(v), v;
- }
- function Ko(e, t = {}) {
- var o, n;
- const {
- pointerTypes: l,
- preventDefault: r,
- stopPropagation: p,
- exact: m,
- onMove: x,
- onEnd: v,
- onStart: d,
- initialValue: u,
- axis: s = "both",
- draggingElement: i = Ct,
- containerElement: y,
- handle: S = e,
- buttons: $ = [0]
- } = t, c = T(
- (o = R(u)) != null ? o : { x: 0, y: 0 }
- ), h = T(), C = (b) => l ? l.includes(b.pointerType) : !0, B = (b) => {
- R(r) && b.preventDefault(), R(p) && b.stopPropagation();
- }, O = (b) => {
- var F;
- if (!R($).includes(b.button) || R(t.disabled) || !C(b) || R(m) && b.target !== R(e))
- return;
- const M = R(y), w = (F = M == null ? void 0 : M.getBoundingClientRect) == null ? void 0 : F.call(M), H = R(e).getBoundingClientRect(), X = {
- x: b.clientX - (M ? H.left - w.left + M.scrollLeft : H.left),
- y: b.clientY - (M ? H.top - w.top + M.scrollTop : H.top)
- };
- (d == null ? void 0 : d(X, b)) !== !1 && (h.value = X, B(b));
- }, A = (b) => {
- if (R(t.disabled) || !C(b) || !h.value)
- return;
- const F = R(y), M = R(e).getBoundingClientRect();
- let { x: w, y: H } = c.value;
- (s === "x" || s === "both") && (w = b.clientX - h.value.x, F && (w = Math.min(Math.max(0, w), F.scrollWidth - M.width))), (s === "y" || s === "both") && (H = b.clientY - h.value.y, F && (H = Math.min(Math.max(0, H), F.scrollHeight - M.height))), c.value = {
- x: w,
- y: H
- }, x == null || x(c.value, b), B(b);
- }, z = (b) => {
- R(t.disabled) || !C(b) || h.value && (h.value = void 0, v == null || v(c.value, b), B(b));
- };
- if (yt) {
- const b = { capture: (n = t.capture) != null ? n : !0 };
- Ae(S, "pointerdown", O, b), Ae(i, "pointermove", A, b), Ae(i, "pointerup", z, b);
- }
- return Me(pe({}, jo(c)), {
- position: c,
- isDragging: q(() => !!h.value),
- style: q(
- () => `left:${c.value.x}px;top:${c.value.y}px;`
- )
- });
- }
- const Xo = { class: "modalHeader" }, Yo = {
- key: 0,
- class: "tabs-wrap"
- }, Uo = {
- key: 1,
- class: "step-wrap",
- ref: "stepRef"
- }, Qo = { class: "modal-body-container" }, qo = /* @__PURE__ */ Object.assign({ name: "SModal" }, {
- __name: "SModal",
- props: {
- // 确定按钮 loading,保存中禁止关闭
- loading: {
- type: Boolean,
- default: !1
- },
- // 是否垂直居中显示
- centered: {
- type: Boolean,
- default: !0
- },
- // 点遮罩是否关闭
- maskClosable: {
- type: Boolean,
- default: !0
- },
- // 是否显示遮罩
- mask: {
- type: Boolean,
- default: !0
- },
- // 非居中时的距顶距离
- topStyle: {
- type: String,
- default: ""
- },
- // 是否显示右上角关闭按钮
- closable: {
- type: Boolean,
- default: !0
- },
- // 关闭后是否销毁内容
- destroyOnClose: {
- type: Boolean,
- default: !1
- },
- // 是否支持 Esc 关闭
- keyboardOpen: {
- type: Boolean,
- default: !0
- },
- // 弹窗标题
- title: {
- type: String,
- default: ""
- },
- // 显隐(v-model:value)
- value: {
- type: Boolean,
- default: !1
- },
- // 弹窗宽度,默认 60vw
- width: {
- type: [String, Number],
- default: "60vw"
- },
- // 内容区高度占视口的百分比(60 = 60vh)
- boxHeight: {
- type: [String, Number],
- default: 60
- },
- // 内容区样式,默认纵向滚动、隐藏横向滚动
- bodyStyle: {
- type: Object,
- default() {
- return {
- overflowX: "hidden",
- overflowY: "auto"
- };
- }
- },
- // 是否显示全屏按钮
- showFullScreen: {
- type: Boolean,
- default: !0
- },
- // 是否默认以全屏状态展示,仍可点右上角还原
- defaultFullScreen: {
- type: Boolean,
- default: !1
- },
- // 页签配置,传了才显示页签区
- tabs: {
- type: Array,
- default: () => []
- },
- // 页签字段映射:{ label, value }
- tabKey: {
- type: Object,
- default: () => ({
- label: "label",
- value: "value"
- })
- },
- // 步骤条配置,传了才显示步骤区
- steps: {
- type: Array,
- default: () => []
- },
- // 步骤条默认选中下标
- stepDefaultActive: {
- type: Number,
- default: 0
- },
- // 切换步骤前的校验函数,返回 false 停在当前步
- stepValid: {
- type: Function,
- default: void 0
- },
- // 确定按钮文案
- saveBtnText: {
- type: String,
- default: window.$l("保存")
- }
- },
- emits: [
- "update:value",
- "handCancel",
- "afterClose",
- "tabsChange",
- "stepCallback",
- "handSave"
- ],
- setup(e, { emit: t }) {
- const o = e, n = t, l = At(), r = T(null), p = T(), { x: m, y: x, isDragging: v } = Ko(r), d = T(0), u = T(0), s = T(!1), i = T(0), y = T(0), S = T(0), $ = T(0), c = T({ left: 0, right: 0, top: 0, bottom: 0 }), h = T(null), C = T(null), B = T(o.defaultFullScreen ? "100vw" : o.width), O = T(o.defaultFullScreen ? "s-full-modal" : ""), A = T(o.value), z = T(8), b = q(() => o.tabKey && o.tabKey.value || "value"), F = T("");
- _(() => o.tabs, () => {
- const g = o.tabs || [];
- if (!g.length) {
- F.value = "";
- return;
- }
- const j = b.value;
- g.some((K) => K && K[j] === F.value) || (F.value = g[0][j]);
- }, { immediate: !0, deep: !0 });
- const w = T(0), H = q(() => w.value === o.steps.length - 1), X = q(() => ({
- transform: `translate(${i.value}px, ${y.value}px)`
- })), G = T(pe({}, o.bodyStyle));
- let U = -1, k = null, I = null;
- const V = (g) => {
- p.value = g, r.value = O.value ? null : g;
- }, me = () => {
- const g = h.value;
- if (!g) return;
- const j = r.value, K = C.value, J = g.scrollHeight || g.clientHeight;
- if (!J) return;
- const Se = (j == null ? void 0 : j.clientHeight) || 0, xe = (K == null ? void 0 : K.clientHeight) || 0, $e = document.body.offsetHeight, Z = J + Se + xe + 85 >= $e ? $e - Se - xe - 82 : J;
- Z <= 0 || Z === U || (U = Z, G.value = Object.assign({ height: `${Z}px` }, o.bodyStyle));
- }, Q = () => {
- ot(() => {
- k || (k = requestAnimationFrame(() => {
- k = null, me();
- }));
- });
- }, Y = (g) => {
- g ? (B.value = "100vw", O.value = "s-full-modal", r.value = null, i.value = 0, y.value = 0) : (B.value = o.width, O.value = "", r.value = p.value);
- }, Pe = () => {
- Y(!0);
- }, be = () => {
- Y(!1);
- }, re = () => {
- n("update:value", !1), n("handCancel");
- }, se = () => {
- Y(o.defaultFullScreen), n("afterClose");
- };
- _(
- () => o.defaultFullScreen,
- (g) => Y(g)
- );
- const Fe = (g) => {
- F.value = g, n("tabsChange", g);
- };
- function ve() {
- w.value--, n("stepCallback", "prev", w.value);
- }
- function Oe() {
- if (!window.$utils.isFunction(o.stepValid)) {
- w.value++, n("stepCallback", "next", w.value);
- return;
- }
- o.stepValid(w.value).then((g) => {
- g && (w.value++, n("stepCallback", "next", w.value));
- });
- }
- function he() {
- n("handSave", "save");
- }
- return lt(() => {
- s.value && (i.value = S.value + Math.min(Math.max(c.value.left, m.value), c.value.right) - d.value, y.value = $.value + Math.min(Math.max(c.value.top, x.value), c.value.bottom) - u.value);
- }), _([m, x], () => {
- var g, j;
- if (!s.value) {
- d.value = m.value, u.value = x.value;
- const K = document.body.getBoundingClientRect(), J = (j = (g = r.value) == null ? void 0 : g.getBoundingClientRect()) != null ? j : { width: 0, height: 0 };
- c.value.right = K.width - J.width, c.value.bottom = K.height - J.height, S.value = i.value, $.value = y.value;
- }
- s.value = !0;
- }), _(v, () => {
- v.value || (s.value = !1);
- }), _(h, (g) => {
- I && (I.disconnect(), I = null), g && typeof ResizeObserver != "undefined" && (I = new ResizeObserver(() => Q()), I.observe(g)), Q();
- }), _(
- () => o.value,
- (g) => {
- g ? (A.value = !0, Q()) : A.value = !1;
- },
- { deep: !0 }
- ), _(
- () => A.value,
- (g) => {
- g && Q();
- }
- ), _(
- () => o.value,
- () => {
- o.value && Q();
- },
- { immediate: !0 }
- ), nt(() => {
- I && (I.disconnect(), I = null), k && (cancelAnimationFrame(k), k = null);
- }), (g, j) => {
- const K = fo, J = uo, Se = vo, xe = mo, $e = co, Z = po, De = we("poweroff-outlined"), ce = ze, Le = we("save-outlined"), bt = we("arrow-left-outlined"), ht = we("arrow-right-outlined"), St = W;
- return D(), ne(St, Ht({
- open: A.value,
- "body-style": G.value,
- width: B.value,
- centered: e.centered,
- onCancel: re,
- afterClose: se,
- destroyOnClose: e.destroyOnClose,
- keyboard: e.keyboardOpen,
- style: e.topStyle,
- maskClosable: e.maskClosable,
- mask: e.mask,
- "wrap-class-name": "s-modal " + O.value
- }, Ne(l)), {
- title: N(() => [
- de("div", Xo, [
- de("div", {
- ref: V,
- class: "draggableTitle"
- }, ae(e.title), 513),
- a(Nt, {
- width: B.value,
- showFullScreen: e.showFullScreen,
- onFullScreen: Pe,
- onReduction: be
- }, null, 8, ["width", "showFullScreen"])
- ])
- ]),
- footer: N(() => [
- j[0] || (j[0] = de("div", { class: "footer-top-border" }, null, -1)),
- g.$slots.footer ? (D(), le("div", {
- key: 0,
- ref_key: "footerSlot",
- ref: C
- }, [
- a(Z, { size: z.value }, {
- default: N(() => [
- je(g.$slots, "footer", {}, void 0, !0)
- ]),
- _: 3
- }, 8, ["size"])
- ], 512)) : ee("", !0),
- !g.$slots.footer && (!e.steps || !e.steps.length) ? (D(), le("div", {
- key: 1,
- ref_key: "footerSlot",
- ref: C
- }, [
- a(Z, { size: z.value }, {
- default: N(() => [
- a(ce, { onClick: re }, {
- default: N(() => [
- a(De),
- ue(ae(g.$l("关闭")), 1)
- ]),
- _: 1
- }),
- a(ce, {
- type: "primary",
- onClick: he
- }, {
- default: N(() => [
- a(Le),
- ue(" " + ae(g.$l(e.saveBtnText)), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["size"])
- ], 512)) : ee("", !0),
- e.steps && e.steps.length > 0 ? (D(), le("div", {
- key: 2,
- ref_key: "footerSlot",
- ref: C
- }, [
- a(Z, { size: z.value }, {
- default: N(() => [
- a(ce, { onClick: re }, {
- default: N(() => [
- a(De),
- ue(ae(g.$l("关闭")), 1)
- ]),
- _: 1
- }),
- e.steps.length ? (D(), ne(ce, {
- key: 0,
- disabled: w.value === e.stepDefaultActive,
- onClick: ve
- }, {
- default: N(() => [
- a(bt),
- ue(ae(g.$l("上一步")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])) : ee("", !0),
- e.steps.length ? (D(), ne(ce, {
- key: 1,
- type: "primary",
- disabled: w.value === e.steps.length - 1,
- onClick: Oe
- }, {
- default: N(() => [
- a(ht),
- ue(ae(g.$l("下一步")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])) : ee("", !0),
- H.value ? (D(), ne(ce, {
- key: 2,
- style: { "margin-right": "8px" },
- type: "primary",
- onClick: he
- }, {
- default: N(() => [
- a(Le),
- ue(" " + ae(g.$l(e.saveBtnText)), 1)
- ]),
- _: 1
- })) : ee("", !0)
- ]),
- _: 1
- }, 8, ["size"])
- ], 512)) : ee("", !0)
- ]),
- modalRender: N(({ originVNode: oe }) => [
- de("div", {
- style: zt(X.value)
- }, [
- (D(), ne(It(oe)))
- ], 4)
- ]),
- default: N(() => [
- a($e, { spinning: e.loading }, {
- default: N(() => [
- de("div", {
- ref_key: "bodySlot",
- ref: h
- }, [
- e.tabs && e.tabs.length > 0 ? (D(), le("div", Yo, [
- a(J, {
- "active-key": F.value,
- onChange: Fe
- }, {
- default: N(() => [
- (D(!0), le(He, null, Ve(e.tabs, (oe) => (D(), ne(K, {
- tab: oe[e.tabKey.label],
- key: oe[b.value]
- }, null, 8, ["tab"]))), 128))
- ]),
- _: 1
- }, 8, ["active-key"])
- ])) : ee("", !0),
- e.steps && e.steps.length ? (D(), le("div", Uo, [
- a(xe, {
- current: w.value,
- type: "navigation",
- size: "small"
- }, {
- default: N(() => [
- (D(!0), le(He, null, Ve(e.steps, (oe) => (D(), ne(Se, {
- title: oe,
- key: oe,
- disabled: !0
- }, null, 8, ["title"]))), 128))
- ]),
- _: 1
- }, 8, ["current"])
- ], 512)) : ee("", !0),
- de("div", Qo, [
- je(g.$slots, "default", {}, void 0, !0)
- ])
- ], 512)
- ]),
- _: 3
- }, 8, ["spinning"])
- ]),
- _: 3
- }, 16, ["open", "body-style", "width", "centered", "destroyOnClose", "keyboard", "style", "maskClosable", "mask", "wrap-class-name"]);
- };
- }
- }), rn = /* @__PURE__ */ so(qo, [["__scopeId", "data-v-64b8c7da"]]);
- export {
- rn as default
- };
|