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