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