| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870 |
- var bt = Object.defineProperty, ht = Object.defineProperties;
- var xt = Object.getOwnPropertyDescriptors;
- var Ee = Object.getOwnPropertySymbols;
- var St = Object.prototype.hasOwnProperty, $t = Object.prototype.propertyIsEnumerable;
- var De = (e, t, o) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, ve = (e, t) => {
- for (var o in t || (t = {}))
- St.call(t, o) && De(e, o, t[o]);
- if (Ee)
- for (var o of Ee(t))
- $t.call(t, o) && De(e, o, t[o]);
- return e;
- }, Fe = (e, t) => ht(e, xt(t));
- import { defineComponent as Z, ref as B, computed as Q, createVNode as a, Transition as Qe, withDirectives as qe, vShow as Je, nextTick as Ze, shallowRef as D, watch as j, onBeforeUnmount as et, watchEffect as tt, Fragment as Ae, render as Le, unref as Ie, isRef as ot, toRefs as wt, customRef as Tt, getCurrentScope as Bt, onScopeDispose as Pt, useAttrs as Ft, resolveComponent as we, openBlock as E, createBlock as ne, mergeProps as Ot, withCtx as k, createElementVNode as pe, createElementBlock as le, renderList as ke, createCommentVNode as J, renderSlot as _e, normalizeStyle as At, resolveDynamicComponent as Mt, createTextVNode as de, toDisplayString as ae } from "vue";
- import Ht from "./ModalHeader.js";
- import { d1 as It, cw as nt, P as N, _ as P, ba as lt, d as f, cJ as Nt, c as ye, o as at, i as Be, d2 as zt, K as We, d3 as Rt, bQ as Et, g as Dt, m as Lt, bC as kt, r as _t, cH as Wt, cN as Vt, b3 as Ne, u as jt, bq as it, a3 as Te, bU as Gt, B as Me, d4 as Kt, e as ge, d5 as Xt, a as Yt, be as Ut, bd as Qt, bf as qt, d6 as Jt, d7 as Zt, d8 as eo, c$ as to, d9 as oo, da as no, b5 as lo, n as ao, aA as io } from "./index2.js";
- import { A as Ve } from "./ActionButton.js";
- import { T as ro, _ as so } from "./index12.js";
- import { _ as co, S as uo } from "./index11.js";
- const fo = new nt("antFadeIn", {
- "0%": {
- opacity: 0
- },
- "100%": {
- opacity: 1
- }
- }), mo = new nt("antFadeOut", {
- "0%": {
- opacity: 1
- },
- "100%": {
- opacity: 0
- }
- }), vo = function(e) {
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
- const {
- antCls: o
- } = e, n = `${o}-fade`, l = t ? "&" : "";
- return [It(n, fo, mo, e.motionDurationMid, t), {
- [`
- ${l}${n}-enter,
- ${l}${n}-appear
- `]: {
- opacity: 0,
- animationTimingFunction: "linear"
- },
- [`${l}${n}-leave`]: {
- animationTimingFunction: "linear"
- }
- }];
- };
- function ze() {
- 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: N.shape({
- x: Number,
- y: Number
- }).loose,
- title: N.any,
- footer: N.any,
- transitionName: String,
- maskTransitionName: String,
- animation: N.any,
- maskAnimation: N.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: N.any,
- maskProps: N.any,
- wrapProps: N.any,
- getContainer: N.any,
- dialogStyle: {
- type: Object,
- default: void 0
- },
- dialogClass: String,
- closeIcon: N.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 je(e, t, o) {
- let n = t;
- return !n && o && (n = `${e}-${o}`), n;
- }
- let Ge = -1;
- function po() {
- return Ge += 1, Ge;
- }
- function Ke(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 go(e) {
- const t = e.getBoundingClientRect(), o = {
- left: t.left,
- top: t.top
- }, n = e.ownerDocument, l = n.defaultView || n.parentWindow;
- return o.left += Ke(l), o.top += Ke(l, !0), o;
- }
- const yo = {
- width: 0,
- height: 0,
- overflow: "hidden",
- outline: "none"
- }, Co = {
- outline: "none"
- }, bo = Z({
- compatConfig: {
- MODE: 3
- },
- name: "DialogContent",
- inheritAttrs: !1,
- props: f(f({}, ze()), {
- motionName: String,
- ariaId: String,
- onVisibleChanged: Function,
- onMousedown: Function,
- onMouseup: Function
- }),
- setup(e, t) {
- let {
- expose: o,
- slots: n,
- attrs: l
- } = t;
- const i = B(), p = B(), m = B();
- o({
- focus: () => {
- var s;
- (s = i.value) === null || s === void 0 || s.focus({
- preventScroll: !0
- });
- },
- changeActive: (s) => {
- const {
- activeElement: r
- } = document;
- s && r === p.value ? i.value.focus({
- preventScroll: !0
- }) : !s && r === i.value && p.value.focus({
- preventScroll: !0
- });
- }
- });
- const $ = B(), v = Q(() => {
- const {
- width: s,
- height: r
- } = e, y = {};
- return s !== void 0 && (y.width = typeof s == "number" ? `${s}px` : s), r !== void 0 && (y.height = typeof r == "number" ? `${r}px` : r), $.value && (y.transformOrigin = $.value), y;
- }), d = () => {
- Ze(() => {
- if (m.value) {
- const s = go(m.value);
- $.value = e.mousePosition ? `${e.mousePosition.x - s.left}px ${e.mousePosition.y - s.top}px` : "";
- }
- });
- }, u = (s) => {
- e.onVisibleChanged(s);
- };
- return () => {
- var s, r, y, x;
- const {
- prefixCls: w,
- footer: c = (s = n.footer) === null || s === void 0 ? void 0 : s.call(n),
- title: h = (r = n.title) === null || r === void 0 ? void 0 : r.call(n),
- ariaId: C,
- closable: T,
- closeIcon: F = (y = n.closeIcon) === null || y === void 0 ? void 0 : y.call(n),
- onClose: O,
- bodyStyle: z,
- bodyProps: g,
- onMousedown: M,
- onMouseup: S,
- visible: H,
- modalRender: A = n.modalRender,
- destroyOnClose: G,
- motionName: K
- } = e;
- let L;
- c && (L = a("div", {
- class: `${w}-footer`
- }, [c]));
- let R;
- h && (R = a("div", {
- class: `${w}-header`
- }, [a("div", {
- class: `${w}-title`,
- id: C
- }, [h])]));
- let Y;
- T && (Y = a("button", {
- type: "button",
- onClick: O,
- "aria-label": "Close",
- class: `${w}-close`
- }, [F || a("span", {
- class: `${w}-close-x`
- }, null)]));
- const W = a("div", {
- class: `${w}-content`
- }, [Y, R, a("div", P({
- class: `${w}-body`,
- style: z
- }, g), [(x = n.default) === null || x === void 0 ? void 0 : x.call(n)]), L]), U = lt(K);
- return a(Qe, P(P({}, U), {}, {
- onBeforeEnter: d,
- onAfterEnter: () => u(!0),
- onAfterLeave: () => u(!1)
- }), {
- default: () => [H || !G ? qe(a("div", P(P({}, l), {}, {
- ref: m,
- key: "dialog-element",
- role: "document",
- style: [v.value, l.style],
- class: [w, l.class],
- onMousedown: M,
- onMouseup: S
- }), [a("div", {
- tabindex: 0,
- ref: i,
- style: Co
- }, [A ? A({
- originVNode: W
- }) : W]), a("div", {
- tabindex: 0,
- ref: p,
- style: yo
- }, null)]), [[Je, H]]) : null]
- });
- };
- }
- }), ho = Z({
- 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: i
- } = e, p = lt(i);
- return a(Qe, p, {
- default: () => [qe(a("div", P({
- class: `${o}-mask`
- }, l), null), [[Je, n]])]
- });
- };
- }
- }), Xe = Z({
- compatConfig: {
- MODE: 3
- },
- name: "VcDialog",
- inheritAttrs: !1,
- props: Be(f(f({}, ze()), {
- 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 = D(), i = D(), p = D(), m = D(e.visible), $ = D(`vcDialogTitle${po()}`), v = (c) => {
- var h, C;
- if (c)
- zt(i.value, document.activeElement) || (l.value = document.activeElement, (h = p.value) === null || h === void 0 || h.focus());
- else {
- const T = m.value;
- if (m.value = !1, e.mask && l.value && e.focusTriggerAfterClose) {
- try {
- l.value.focus({
- preventScroll: !0
- });
- } catch (F) {
- }
- l.value = null;
- }
- T && ((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 = D(!1), s = D(), r = () => {
- clearTimeout(s.value), u.value = !0;
- }, y = () => {
- s.value = setTimeout(() => {
- u.value = !1;
- });
- }, x = (c) => {
- if (!e.maskClosable) return null;
- u.value ? u.value = !1 : i.value === c.target && d(c);
- }, w = (c) => {
- if (e.keyboard && c.keyCode === We.ESC) {
- c.stopPropagation(), d(c);
- return;
- }
- e.visible && c.keyCode === We.TAB && p.value.changeActive(!c.shiftKey);
- };
- return j(() => e.visible, () => {
- e.visible && (m.value = !0);
- }, {
- flush: "post"
- }), et(() => {
- var c;
- clearTimeout(s.value), (c = e.scrollLocker) === null || c === void 0 || c.unLock();
- }), tt(() => {
- 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: T,
- maskAnimation: F,
- zIndex: O,
- wrapClassName: z,
- rootClassName: g,
- wrapStyle: M,
- closable: S,
- maskProps: H,
- maskStyle: A,
- transitionName: G,
- animation: K,
- wrapProps: L,
- title: R = n.title
- } = e, {
- style: Y,
- class: W
- } = o;
- return a("div", P({
- class: [`${c}-root`, g]
- }, Nt(e, {
- data: !0
- })), [a(ho, {
- prefixCls: c,
- visible: h && C,
- motionName: je(c, T, F),
- style: f({
- zIndex: O
- }, A),
- maskProps: H
- }, null), a("div", P({
- tabIndex: -1,
- onKeydown: w,
- class: ye(`${c}-wrap`, z),
- ref: i,
- onClick: x,
- role: "dialog",
- "aria-labelledby": R ? $.value : null,
- style: f(f({
- zIndex: O
- }, M), {
- display: m.value ? null : "none"
- })
- }, L), [a(bo, P(P({}, at(e, ["scrollLocker"])), {}, {
- style: Y,
- class: W,
- onMousedown: r,
- onMouseup: y,
- ref: p,
- closable: S,
- ariaId: $.value,
- prefixCls: c,
- visible: C,
- onClose: d,
- onVisibleChanged: v,
- motionName: je(c, G, K)
- }), n)])]);
- };
- }
- }), xo = ze(), So = Z({
- compatConfig: {
- MODE: 3
- },
- name: "DialogWrap",
- inheritAttrs: !1,
- props: Be(xo, {
- visible: !1
- }),
- setup(e, t) {
- let {
- attrs: o,
- slots: n
- } = t;
- const l = B(e.visible);
- return Rt({}, {
- inTriggerContext: !1
- }), j(() => e.visible, () => {
- e.visible && (l.value = !0);
- }, {
- flush: "post"
- }), () => {
- const {
- visible: i,
- getContainer: p,
- forceRender: m,
- destroyOnClose: $ = !1,
- afterClose: v
- } = e;
- let d = f(f(f({}, e), o), {
- ref: "_component",
- key: "dialog"
- });
- return p === !1 ? a(Xe, P(P({}, d), {}, {
- getOpenCount: () => 2
- }), n) : !m && $ && !l.value ? null : a(Et, {
- autoLock: !0,
- visible: i,
- forceRender: m,
- getContainer: p
- }, {
- default: (u) => (d = f(f(f({}, d), u), {
- afterClose: () => {
- v == null || v(), l.value = !1;
- }
- }), a(Xe, d, n))
- });
- };
- }
- });
- function Ye(e) {
- return {
- position: e,
- top: 0,
- insetInlineEnd: 0,
- bottom: 0,
- insetInlineStart: 0
- };
- }
- const $o = (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({}, Ye("fixed")), {
- zIndex: e.zIndexPopupBase,
- height: "100%",
- backgroundColor: e.colorBgMask,
- [`${t}-hidden`]: {
- display: "none"
- }
- }),
- [`${t}-wrap`]: f(f({}, Ye("fixed")), {
- overflow: "auto",
- outline: 0,
- WebkitOverflowScrolling: "touch"
- })
- }
- }, {
- [`${t}-root`]: vo(e)
- }];
- }, wo = (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({}, _t(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
- }
- }, Wt(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"
- }
- }
- }
- ];
- }, To = (e) => {
- const {
- componentCls: t
- } = e, o = `${t}-confirm`;
- return {
- [o]: {
- "&-rtl": {
- direction: "rtl"
- },
- [`${e.antCls}-modal-header`]: {
- display: "none"
- },
- [`${o}-body-wrapper`]: f({}, Vt()),
- [`${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"
- }
- };
- }, Bo = (e) => {
- const {
- componentCls: t
- } = e;
- return {
- [`${t}-root`]: {
- [`${t}-wrap-rtl`]: {
- direction: "rtl",
- [`${t}-confirm-body`]: {
- direction: "rtl"
- }
- }
- }
- };
- }, Po = (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
- }
- }
- };
- }, Fo = Dt("Modal", (e) => {
- const t = e.padding, o = e.fontSizeHeading5, n = e.lineHeightHeading5, l = Lt(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 [wo(l), To(l), Bo(l), $o(l), e.wireframe && Po(l), kt(l, "zoom")];
- });
- var Oo = 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 He;
- const Ao = (e) => {
- He = {
- x: e.pageX,
- y: e.pageY
- }, setTimeout(() => He = null, 100);
- };
- Xt() && Yt(document.documentElement, "click", Ao, !0);
- const Mo = () => ({
- 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: N.any,
- closable: {
- type: Boolean,
- default: void 0
- },
- closeIcon: N.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: N.any,
- okText: N.any,
- okType: String,
- cancelText: N.any,
- icon: N.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()
- }), _ = Z({
- compatConfig: {
- MODE: 3
- },
- name: "AModal",
- inheritAttrs: !1,
- props: Be(Mo(), {
- width: 520,
- confirmLoading: !1,
- okType: "primary"
- }),
- setup(e, t) {
- let {
- emit: o,
- slots: n,
- attrs: l
- } = t;
- const [i] = Ne("Modal"), {
- prefixCls: p,
- rootPrefixCls: m,
- direction: $,
- getPopupContainer: v
- } = jt("modal", e), [d, u] = Fo(p);
- it(e.visible === void 0, "Modal", "`visible` will be removed in next major version, please use `open` instead.");
- const s = (x) => {
- o("update:visible", !1), o("update:open", !1), o("cancel", x), o("change", !1);
- }, r = (x) => {
- o("ok", x);
- }, y = () => {
- var x, w;
- const {
- okText: c = (x = n.okText) === null || x === void 0 ? void 0 : x.call(n),
- okType: h,
- cancelText: C = (w = n.cancelText) === null || w === void 0 ? void 0 : w.call(n),
- confirmLoading: T
- } = e;
- return a(Ae, null, [a(Me, P({
- onClick: s
- }, e.cancelButtonProps), {
- default: () => [C || i.value.cancelText]
- }), a(Me, P(P({}, Kt(h)), {}, {
- loading: T,
- onClick: r
- }, e.okButtonProps), {
- default: () => [c || i.value.okText]
- })]);
- };
- return () => {
- var x, w;
- const {
- prefixCls: c,
- visible: h,
- open: C,
- wrapClassName: T,
- centered: F,
- getContainer: O,
- closeIcon: z = (x = n.closeIcon) === null || x === void 0 ? void 0 : x.call(n),
- focusTriggerAfterClose: g = !0
- } = e, M = Oo(e, ["prefixCls", "visible", "open", "wrapClassName", "centered", "getContainer", "closeIcon", "focusTriggerAfterClose"]), S = ye(T, {
- [`${p.value}-centered`]: !!F,
- [`${p.value}-wrap-rtl`]: $.value === "rtl"
- });
- return d(a(So, P(P(P({}, M), l), {}, {
- rootClassName: u.value,
- class: ye(u.value, l.class),
- getContainer: O || (v == null ? void 0 : v.value),
- prefixCls: p.value,
- wrapClassName: S,
- visible: C != null ? C : h,
- onClose: s,
- focusTriggerAfterClose: g,
- transitionName: Te(m.value, "zoom", e.transitionName),
- maskTransitionName: Te(m.value, "fade", e.maskTransitionName),
- mousePosition: (w = M.mousePosition) !== null && w !== void 0 ? w : He
- }), f(f({}, n), {
- footer: n.footer || y,
- closeIcon: () => a("span", {
- class: `${p.value}-close-x`
- }, [z || a(Gt, {
- class: `${p.value}-close-icon`
- }, null)])
- })));
- };
- }
- });
- function ue(e) {
- return typeof e == "function" ? e() : e;
- }
- const rt = Z({
- 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] = Ne("Modal");
- return process.env.NODE_ENV !== "production" && it(e.visible === void 0, "Modal", "`visible` is deprecated, please use `open` instead."), () => {
- const {
- icon: l,
- onCancel: i,
- onOk: p,
- close: m,
- okText: $,
- closable: v = !1,
- zIndex: d,
- afterClose: u,
- keyboard: s,
- centered: r,
- getContainer: y,
- maskStyle: x,
- okButtonProps: w,
- cancelButtonProps: c,
- okCancel: h,
- width: C = 416,
- mask: T = !0,
- maskClosable: F = !1,
- type: O,
- open: z,
- title: g,
- content: M,
- direction: S,
- closeIcon: H,
- modalRender: A,
- focusTriggerAfterClose: G,
- rootPrefixCls: K,
- bodyStyle: L,
- wrapClassName: R,
- footer: Y
- } = e;
- let W = l;
- if (!l && l !== null)
- switch (O) {
- case "info":
- W = a(Jt, null, null);
- break;
- case "success":
- W = a(qt, null, null);
- break;
- case "error":
- W = a(Qt, null, null);
- break;
- default:
- W = a(Ut, null, null);
- }
- const U = e.okType || "primary", fe = e.prefixCls || "ant-modal", ee = `${fe}-confirm`, me = o.style || {}, be = h != null ? h : O === "confirm", he = e.autoFocusButton === null ? !1 : e.autoFocusButton || "ok", re = `${fe}-confirm`, Pe = ye(re, `${re}-${e.type}`, {
- [`${re}-rtl`]: S === "rtl"
- }, o.class), se = n.value, b = be && a(Ve, {
- actionFn: i,
- close: m,
- autofocus: he === "cancel",
- buttonProps: c,
- prefixCls: `${K}-btn`
- }, {
- default: () => [ue(e.cancelText) || se.cancelText]
- });
- return a(_, {
- prefixCls: fe,
- class: Pe,
- wrapClassName: ye({
- [`${re}-centered`]: !!r
- }, R),
- onCancel: (V) => m == null ? void 0 : m({
- triggerCancel: !0
- }, V),
- open: z,
- title: "",
- footer: "",
- transitionName: Te(K, "zoom", e.transitionName),
- maskTransitionName: Te(K, "fade", e.maskTransitionName),
- mask: T,
- maskClosable: F,
- maskStyle: x,
- style: me,
- bodyStyle: L,
- width: C,
- zIndex: d,
- afterClose: u,
- keyboard: s,
- centered: r,
- getContainer: y,
- closable: v,
- closeIcon: H,
- modalRender: A,
- focusTriggerAfterClose: G
- }, {
- default: () => [a("div", {
- class: `${ee}-body-wrapper`
- }, [a("div", {
- class: `${ee}-body`
- }, [ue(W), g === void 0 ? null : a("span", {
- class: `${ee}-title`
- }, [ue(g)]), a("div", {
- class: `${ee}-content`
- }, [ue(M)])]), Y !== void 0 ? ue(Y) : a("div", {
- class: `${ee}-btns`
- }, [b, a(Ve, {
- type: U,
- actionFn: p,
- close: m,
- autofocus: he === "ok",
- buttonProps: w,
- prefixCls: `${K}-btn`
- }, {
- default: () => [ue($) || (be ? se.okText : se.justOkText)]
- })])])]
- });
- };
- }
- }), ie = [], Ce = (e) => {
- const t = document.createDocumentFragment();
- let o = f(f({}, at(e, ["parentContext", "appContext"])), {
- close: i,
- open: !0
- }), n = null;
- function l() {
- n && (Le(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((r) => r && r.triggerCancel);
- e.onCancel && s && e.onCancel(() => {
- }, ...d.slice(1));
- for (let r = 0; r < ie.length; r++)
- if (ie[r] === i) {
- ie.splice(r, 1);
- break;
- }
- }
- function i() {
- 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 && Zt(n, o, t);
- }
- const m = (v) => {
- const d = eo, u = d.prefixCls, s = v.prefixCls || `${u}-modal`, r = d.iconPrefixCls, y = oo();
- return a(to, P(P({}, d), {}, {
- prefixCls: u
- }), {
- default: () => [a(rt, P(P({}, v), {}, {
- rootPrefixCls: u,
- prefixCls: s,
- iconPrefixCls: r,
- locale: y,
- cancelText: v.cancelText || y.cancelText
- }), null)]
- });
- };
- function $(v) {
- const d = a(m, f({}, v));
- return d.appContext = e.parentContext || e.appContext || d.appContext, Le(d, t), d;
- }
- return n = $(o), ie.push(i), {
- destroy: i,
- update: p
- };
- };
- function st(e) {
- return f(f({}, e), {
- type: "warning"
- });
- }
- function ct(e) {
- return f(f({}, e), {
- type: "info"
- });
- }
- function dt(e) {
- return f(f({}, e), {
- type: "success"
- });
- }
- function ut(e) {
- return f(f({}, e), {
- type: "error"
- });
- }
- function ft(e) {
- return f(f({}, e), {
- type: "confirm"
- });
- }
- const Ho = () => ({
- config: Object,
- afterClose: Function,
- destroyAction: Function,
- open: Boolean
- }), Io = Z({
- name: "HookModal",
- inheritAttrs: !1,
- props: Be(Ho(), {
- config: {
- width: 520,
- okType: "primary"
- }
- }),
- setup(e, t) {
- let {
- expose: o
- } = t;
- var n;
- const l = Q(() => e.open), i = Q(() => e.config), {
- direction: p,
- getPrefixCls: m
- } = no(), $ = m("modal"), v = m(), d = () => {
- var y, x;
- e == null || e.afterClose(), (x = (y = i.value).afterClose) === null || x === void 0 || x.call(y);
- }, u = function() {
- e.destroyAction(...arguments);
- };
- o({
- destroy: u
- });
- const s = (n = i.value.okCancel) !== null && n !== void 0 ? n : i.value.type === "confirm", [r] = Ne("Modal", lo.Modal);
- return () => a(rt, P(P({
- prefixCls: $,
- rootPrefixCls: v
- }, i.value), {}, {
- close: u,
- open: l.value,
- afterClose: d,
- okText: i.value.okText || (s ? r == null ? void 0 : r.value.okText : r == null ? void 0 : r.value.justOkText),
- direction: i.value.direction || p.value,
- cancelText: i.value.cancelText || (r == null ? void 0 : r.value.cancelText)
- }), null);
- }
- });
- let Ue = 0;
- const No = Z({
- name: "ElementsHolder",
- inheritAttrs: !1,
- setup(e, t) {
- let {
- expose: o
- } = t;
- const n = D([]);
- return o({
- addModal: (i) => (n.value.push(i), n.value = n.value.slice(), () => {
- n.value = n.value.filter((p) => p !== i);
- })
- }), () => n.value.map((i) => i());
- }
- });
- function zo() {
- const e = D(null), t = D([]);
- j(t, () => {
- t.value.length && ([...t.value].forEach((p) => {
- p();
- }), t.value = []);
- }, {
- immediate: !0
- });
- const o = (i) => function(m) {
- var $;
- Ue += 1;
- const v = D(!0), d = D(null), u = D(Ie(m)), s = D({});
- j(() => m, (C) => {
- w(f(f({}, ot(C) ? C.value : C), s.value));
- });
- const r = function() {
- v.value = !1;
- for (var C = arguments.length, T = new Array(C), F = 0; F < C; F++)
- T[F] = arguments[F];
- const O = T.some((z) => z && z.triggerCancel);
- u.value.onCancel && O && u.value.onCancel(() => {
- }, ...T.slice(1));
- };
- let y;
- const x = () => a(Io, {
- key: `modal-${Ue}`,
- config: i(u.value),
- ref: d,
- open: v.value,
- destroyAction: r,
- afterClose: () => {
- y == null || y();
- }
- }, null);
- y = ($ = e.value) === null || $ === void 0 ? void 0 : $.addModal(x), y && ie.push(y);
- const w = (C) => {
- u.value = f(f({}, u.value), C);
- };
- return {
- destroy: () => {
- d.value ? r() : t.value = [...t.value, r];
- },
- update: (C) => {
- s.value = C, d.value ? w(C) : t.value = [...t.value, () => w(C)];
- }
- };
- }, n = Q(() => ({
- info: o(ct),
- success: o(dt),
- error: o(ut),
- warning: o(st),
- confirm: o(ft)
- })), l = Symbol("modalHolderKey");
- return [n.value, () => a(No, {
- key: l,
- ref: e
- }, null)];
- }
- function mt(e) {
- return Ce(st(e));
- }
- _.useModal = zo;
- _.info = function(t) {
- return Ce(ct(t));
- };
- _.success = function(t) {
- return Ce(dt(t));
- };
- _.error = function(t) {
- return Ce(ut(t));
- };
- _.warning = mt;
- _.warn = mt;
- _.confirm = function(t) {
- return Ce(ft(t));
- };
- _.destroyAll = function() {
- for (; ie.length; ) {
- const t = ie.pop();
- t && t();
- }
- };
- _.install = function(e) {
- return e.component(_.name, _), e;
- };
- function Ro(e) {
- return Bt() ? (Pt(e), !0) : !1;
- }
- function I(e) {
- return typeof e == "function" ? e() : Ie(e);
- }
- const vt = typeof window != "undefined" && typeof document != "undefined";
- typeof WorkerGlobalScope != "undefined" && globalThis instanceof WorkerGlobalScope;
- const Eo = Object.prototype.toString, Do = (e) => Eo.call(e) === "[object Object]", Lo = () => {
- };
- function ko(e, t = {}) {
- if (!ot(e))
- return wt(e);
- const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
- for (const n in e.value)
- o[n] = Tt(() => ({
- get() {
- return e.value[n];
- },
- set(l) {
- var i;
- if ((i = I(t.replaceRef)) != null ? i : !0)
- if (Array.isArray(e.value)) {
- const m = [...e.value];
- m[n] = l, e.value = m;
- } else {
- const m = Fe(ve({}, e.value), { [n]: l });
- Object.setPrototypeOf(m, Object.getPrototypeOf(e.value)), e.value = m;
- }
- else
- e.value[n] = l;
- }
- }));
- return o;
- }
- const pt = vt ? window : void 0;
- function _o(e) {
- var t;
- const o = I(e);
- return (t = o == null ? void 0 : o.$el) != null ? t : o;
- }
- function Oe(...e) {
- let t, o, n, l;
- if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([o, n, l] = e, t = pt) : [t, o, n, l] = e, !t)
- return Lo;
- Array.isArray(o) || (o = [o]), Array.isArray(n) || (n = [n]);
- const i = [], p = () => {
- i.forEach((d) => d()), i.length = 0;
- }, m = (d, u, s, r) => (d.addEventListener(u, s, r), () => d.removeEventListener(u, s, r)), $ = j(
- () => [_o(t), I(l)],
- ([d, u]) => {
- if (p(), !d)
- return;
- const s = Do(u) ? ve({}, u) : u;
- i.push(
- ...o.flatMap((r) => n.map((y) => m(d, r, y, s)))
- );
- },
- { immediate: !0, flush: "post" }
- ), v = () => {
- $(), p();
- };
- return Ro(v), v;
- }
- function Wo(e, t = {}) {
- var o, n;
- const {
- pointerTypes: l,
- preventDefault: i,
- stopPropagation: p,
- exact: m,
- onMove: $,
- onEnd: v,
- onStart: d,
- initialValue: u,
- axis: s = "both",
- draggingElement: r = pt,
- containerElement: y,
- handle: x = e,
- buttons: w = [0]
- } = t, c = B(
- (o = I(u)) != null ? o : { x: 0, y: 0 }
- ), h = B(), C = (g) => l ? l.includes(g.pointerType) : !0, T = (g) => {
- I(i) && g.preventDefault(), I(p) && g.stopPropagation();
- }, F = (g) => {
- var M;
- if (!I(w).includes(g.button) || I(t.disabled) || !C(g) || I(m) && g.target !== I(e))
- return;
- const S = I(y), H = (M = S == null ? void 0 : S.getBoundingClientRect) == null ? void 0 : M.call(S), A = I(e).getBoundingClientRect(), G = {
- x: g.clientX - (S ? A.left - H.left + S.scrollLeft : A.left),
- y: g.clientY - (S ? A.top - H.top + S.scrollTop : A.top)
- };
- (d == null ? void 0 : d(G, g)) !== !1 && (h.value = G, T(g));
- }, O = (g) => {
- if (I(t.disabled) || !C(g) || !h.value)
- return;
- const M = I(y), S = I(e).getBoundingClientRect();
- let { x: H, y: A } = c.value;
- (s === "x" || s === "both") && (H = g.clientX - h.value.x, M && (H = Math.min(Math.max(0, H), M.scrollWidth - S.width))), (s === "y" || s === "both") && (A = g.clientY - h.value.y, M && (A = Math.min(Math.max(0, A), M.scrollHeight - S.height))), c.value = {
- x: H,
- y: A
- }, $ == null || $(c.value, g), T(g);
- }, z = (g) => {
- I(t.disabled) || !C(g) || h.value && (h.value = void 0, v == null || v(c.value, g), T(g));
- };
- if (vt) {
- const g = { capture: (n = t.capture) != null ? n : !0 };
- Oe(x, "pointerdown", F, g), Oe(r, "pointermove", O, g), Oe(r, "pointerup", z, g);
- }
- return Fe(ve({}, ko(c)), {
- position: c,
- isDragging: Q(() => !!h.value),
- style: Q(
- () => `left:${c.value.x}px;top:${c.value.y}px;`
- )
- });
- }
- const Vo = { class: "modalHeader" }, jo = {
- key: 0,
- class: "tabs-wrap"
- }, Go = {
- key: 1,
- class: "step-wrap",
- ref: "stepRef"
- }, Ko = { class: "modal-body-container" }, Xo = /* @__PURE__ */ Object.assign({ name: "SModal" }, {
- __name: "SModal",
- props: {
- 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
- },
- keyboardOpen: {
- type: Boolean,
- default: !0
- },
- title: {
- type: String,
- default: ""
- },
- value: {
- type: Boolean,
- default: !1
- },
- width: {
- type: [String, Number],
- default: "60vw"
- },
- boxHeight: {
- type: [String, Number],
- default: 60
- },
- bodyStyle: {
- type: Object,
- default() {
- return {
- overflowX: "hidden",
- overflowY: "auto"
- };
- }
- },
- showFullScreen: {
- type: Boolean,
- default: !0
- },
- tabs: {
- type: Array,
- default: () => []
- },
- tabKey: {
- type: Object,
- default: () => ({
- label: "label",
- value: "value"
- })
- },
- steps: {
- type: Array,
- default: () => []
- },
- stepDefaultActive: {
- type: Number,
- default: 0
- },
- 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 = Ft(), i = B(null), p = B(), { x: m, y: $, isDragging: v } = Wo(i), d = B(0), u = B(0), s = B(!1), r = B(0), y = B(0), x = B(0), w = B(0), c = B({ left: 0, right: 0, top: 0, bottom: 0 }), h = B(null), C = B(null), T = B(o.width), F = B(), O = B(o.value), z = Q(() => o.tabKey && o.tabKey.value || "value"), g = B("");
- j(() => o.tabs, () => {
- const b = o.tabs || [];
- if (!b.length) {
- g.value = "";
- return;
- }
- const V = z.value;
- b.some((X) => X && X[V] === g.value) || (g.value = b[0][V]);
- }, { immediate: !0, deep: !0 });
- const S = B(0), H = Q(() => S.value === o.steps.length - 1), A = Q(() => ({
- transform: `translate(${r.value}px, ${y.value}px)`
- })), G = B(ve({}, o.bodyStyle));
- let K = -1, L = null, R = null;
- const Y = (b) => {
- p.value = b, i.value = F.value ? null : b;
- }, W = () => {
- const b = h.value;
- if (!b) return;
- const V = i.value, X = C.value, q = b.scrollHeight || b.clientHeight;
- if (!q) return;
- const xe = (V == null ? void 0 : V.clientHeight) || 0, Se = (X == null ? void 0 : X.clientHeight) || 0, $e = document.body.offsetHeight, te = q + xe + Se + 85 >= $e ? $e - xe - Se - 82 : q;
- te <= 0 || te === K || (K = te, G.value = Object.assign({ height: `${te}px` }, o.bodyStyle));
- }, U = () => {
- Ze(() => {
- L || (L = requestAnimationFrame(() => {
- L = null, W();
- }));
- });
- }, fe = () => {
- T.value = "100vw", F.value = "s-full-modal", i.value = null, r.value = 0, y.value = 0;
- }, ee = () => {
- T.value = o.width, F.value = "", i.value = p.value;
- }, me = () => {
- n("update:value", !1), n("handCancel");
- }, be = () => {
- F.value = "", i.value = p.value, T.value = o.width, n("afterClose");
- }, he = (b) => {
- g.value = b, n("tabsChange", b);
- };
- function re() {
- S.value--, n("stepCallback", "prev", S.value);
- }
- function Pe() {
- if (!window.$utils.isFunction(o.stepValid)) {
- S.value++, n("stepCallback", "next", S.value);
- return;
- }
- o.stepValid(S.value).then((b) => {
- b && (S.value++, n("stepCallback", "next", S.value));
- });
- }
- function se() {
- n("handSave", "save");
- }
- return tt(() => {
- s.value && (r.value = x.value + Math.min(Math.max(c.value.left, m.value), c.value.right) - d.value, y.value = w.value + Math.min(Math.max(c.value.top, $.value), c.value.bottom) - u.value);
- }), j([m, $], () => {
- var b, V;
- if (!s.value) {
- d.value = m.value, u.value = $.value;
- const X = document.body.getBoundingClientRect(), q = (V = (b = i.value) == null ? void 0 : b.getBoundingClientRect()) != null ? V : { width: 0, height: 0 };
- c.value.right = X.width - q.width, c.value.bottom = X.height - q.height, x.value = r.value, w.value = y.value;
- }
- s.value = !0;
- }), j(v, () => {
- v.value || (s.value = !1);
- }), j(h, (b) => {
- R && (R.disconnect(), R = null), b && typeof ResizeObserver != "undefined" && (R = new ResizeObserver(() => U()), R.observe(b)), U();
- }), j(
- () => o.value,
- (b) => {
- b ? (O.value = !0, U()) : O.value = !1;
- },
- { deep: !0 }
- ), j(
- () => O.value,
- (b) => {
- b && U();
- }
- ), j(
- () => o.value,
- () => {
- o.value && U();
- },
- { immediate: !0 }
- ), et(() => {
- R && (R.disconnect(), R = null), L && (cancelAnimationFrame(L), L = null);
- }), (b, V) => {
- const X = so, q = ro, xe = uo, Se = co, $e = io, te = we("poweroff-outlined"), ce = Me, Re = we("save-outlined"), gt = we("arrow-left-outlined"), yt = we("arrow-right-outlined"), Ct = _;
- return E(), ne(Ct, Ot({
- open: O.value,
- "body-style": G.value,
- width: T.value,
- centered: e.centered,
- onCancel: me,
- afterClose: be,
- destroyOnClose: e.destroyOnClose,
- keyboard: e.keyboardOpen,
- style: e.topStyle,
- maskClosable: e.maskClosable,
- mask: e.mask,
- "wrap-class-name": "s-modal " + F.value
- }, Ie(l)), {
- title: k(() => [
- pe("div", Vo, [
- pe("div", {
- ref: Y,
- class: "draggableTitle"
- }, ae(e.title), 513),
- a(Ht, {
- width: T.value,
- showFullScreen: e.showFullScreen,
- onFullScreen: fe,
- onReduction: ee
- }, null, 8, ["width", "showFullScreen"])
- ])
- ]),
- footer: k(() => [
- b.$slots.footer ? (E(), le("div", {
- key: 0,
- ref_key: "footerSlot",
- ref: C
- }, [
- _e(b.$slots, "footer", {}, void 0, !0)
- ], 512)) : J("", !0),
- !b.$slots.footer && (!e.steps || !e.steps.length) ? (E(), le("div", {
- key: 1,
- ref_key: "footerSlot",
- ref: C
- }, [
- a(ce, { onClick: me }, {
- default: k(() => [
- a(te),
- de(ae(b.$l("关闭")), 1)
- ]),
- _: 1
- }),
- a(ce, {
- style: { "margin-right": "8px" },
- type: "primary",
- onClick: se
- }, {
- default: k(() => [
- a(Re),
- de(" " + ae(b.$l(e.saveBtnText)), 1)
- ]),
- _: 1
- })
- ], 512)) : J("", !0),
- e.steps && e.steps.length > 0 ? (E(), le("div", {
- key: 2,
- ref_key: "footerSlot",
- ref: C
- }, [
- a(ce, { onClick: me }, {
- default: k(() => [
- a(te),
- de(ae(b.$l("关闭")), 1)
- ]),
- _: 1
- }),
- e.steps.length ? (E(), ne(ce, {
- key: 0,
- disabled: S.value === e.stepDefaultActive,
- onClick: re
- }, {
- default: k(() => [
- a(gt),
- de(ae(b.$l("上一步")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])) : J("", !0),
- e.steps.length ? (E(), ne(ce, {
- key: 1,
- type: "primary",
- disabled: S.value === e.steps.length - 1,
- onClick: Pe
- }, {
- default: k(() => [
- a(yt),
- de(ae(b.$l("下一步")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])) : J("", !0),
- H.value ? (E(), ne(ce, {
- key: 2,
- style: { "margin-right": "8px" },
- type: "primary",
- onClick: se
- }, {
- default: k(() => [
- a(Re),
- de(" " + ae(b.$l(e.saveBtnText)), 1)
- ]),
- _: 1
- })) : J("", !0)
- ], 512)) : J("", !0)
- ]),
- modalRender: k(({ originVNode: oe }) => [
- pe("div", {
- style: At(A.value)
- }, [
- (E(), ne(Mt(oe)))
- ], 4)
- ]),
- default: k(() => [
- a($e, { spinning: e.loading }, {
- default: k(() => [
- pe("div", {
- ref_key: "bodySlot",
- ref: h
- }, [
- e.tabs && e.tabs.length > 0 ? (E(), le("div", jo, [
- a(q, {
- "active-key": g.value,
- onChange: he
- }, {
- default: k(() => [
- (E(!0), le(Ae, null, ke(e.tabs, (oe) => (E(), ne(X, {
- tab: oe[e.tabKey.label],
- key: oe[z.value]
- }, null, 8, ["tab"]))), 128))
- ]),
- _: 1
- }, 8, ["active-key"])
- ])) : J("", !0),
- e.steps && e.steps.length ? (E(), le("div", Go, [
- a(Se, {
- current: S.value,
- type: "navigation",
- size: "small"
- }, {
- default: k(() => [
- (E(!0), le(Ae, null, ke(e.steps, (oe) => (E(), ne(xe, {
- title: oe,
- key: oe,
- disabled: !0
- }, null, 8, ["title"]))), 128))
- ]),
- _: 1
- }, 8, ["current"])
- ], 512)) : J("", !0),
- pe("div", Ko, [
- _e(b.$slots, "default", {}, void 0, !0)
- ])
- ], 512)
- ]),
- _: 3
- }, 8, ["spinning"])
- ]),
- _: 3
- }, 16, ["open", "body-style", "width", "centered", "destroyOnClose", "keyboard", "style", "maskClosable", "mask", "wrap-class-name"]);
- };
- }
- }), tn = /* @__PURE__ */ ao(Xo, [["__scopeId", "data-v-1e66a060"]]);
- export {
- tn as default
- };
|