SModal.js 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870
  1. var bt = Object.defineProperty, ht = Object.defineProperties;
  2. var xt = Object.getOwnPropertyDescriptors;
  3. var Ee = Object.getOwnPropertySymbols;
  4. var St = Object.prototype.hasOwnProperty, $t = Object.prototype.propertyIsEnumerable;
  5. var De = (e, t, o) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, ve = (e, t) => {
  6. for (var o in t || (t = {}))
  7. St.call(t, o) && De(e, o, t[o]);
  8. if (Ee)
  9. for (var o of Ee(t))
  10. $t.call(t, o) && De(e, o, t[o]);
  11. return e;
  12. }, Fe = (e, t) => ht(e, xt(t));
  13. import { defineComponent as J, ref as B, computed as Q, createVNode as a, Transition as Qe, withDirectives as Ze, vShow as qe, nextTick as Je, shallowRef as D, watch as j, onBeforeUnmount as et, watchEffect as tt, Fragment as Me, render as Le, unref as Ie, isRef as ot, toRefs as wt, customRef as Tt, getCurrentScope as Bt, onScopeDispose as Pt, useAttrs as Ft, resolveComponent as we, openBlock as E, createBlock as ne, mergeProps as Ot, withCtx as k, createElementVNode as pe, createElementBlock as le, renderList as ke, createCommentVNode as q, renderSlot as _e, normalizeStyle as Mt, resolveDynamicComponent as At, createTextVNode as ue, toDisplayString as ae } from "vue";
  14. import Ht from "./ModalHeader.js";
  15. import { cQ as It, aI as nt, P as N, _ as P, az as lt, d as f, au as Nt, c as ye, o as at, i as Be, cR as zt, K as We, cS as Rt, bZ as Et, g as Dt, m as Lt, bM as kt, r as _t, cO as Wt, aH as Vt, aL as Ne, u as jt, bA as it, a3 as Te, c1 as Gt, B as Ae, cT as Xt, e as ge, cU as Kt, a as Yt, bs as Ut, br as Qt, bt as Zt, cV as qt, cW as Jt, cX as eo, cP as to, cY as oo, cZ as no, aM as lo, n as ao, ao as io } from "./index2.js";
  16. import { A as Ve } from "./ActionButton.js";
  17. import { T as ro, _ as so } from "./index11.js";
  18. import { _ as co, S as uo } from "./index10.js";
  19. const fo = new nt("antFadeIn", {
  20. "0%": {
  21. opacity: 0
  22. },
  23. "100%": {
  24. opacity: 1
  25. }
  26. }), mo = new nt("antFadeOut", {
  27. "0%": {
  28. opacity: 1
  29. },
  30. "100%": {
  31. opacity: 0
  32. }
  33. }), vo = function(e) {
  34. let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
  35. const {
  36. antCls: o
  37. } = e, n = `${o}-fade`, l = t ? "&" : "";
  38. return [It(n, fo, mo, e.motionDurationMid, t), {
  39. [`
  40. ${l}${n}-enter,
  41. ${l}${n}-appear
  42. `]: {
  43. opacity: 0,
  44. animationTimingFunction: "linear"
  45. },
  46. [`${l}${n}-leave`]: {
  47. animationTimingFunction: "linear"
  48. }
  49. }];
  50. };
  51. function ze() {
  52. return {
  53. keyboard: {
  54. type: Boolean,
  55. default: void 0
  56. },
  57. mask: {
  58. type: Boolean,
  59. default: void 0
  60. },
  61. afterClose: Function,
  62. closable: {
  63. type: Boolean,
  64. default: void 0
  65. },
  66. maskClosable: {
  67. type: Boolean,
  68. default: void 0
  69. },
  70. visible: {
  71. type: Boolean,
  72. default: void 0
  73. },
  74. destroyOnClose: {
  75. type: Boolean,
  76. default: void 0
  77. },
  78. mousePosition: N.shape({
  79. x: Number,
  80. y: Number
  81. }).loose,
  82. title: N.any,
  83. footer: N.any,
  84. transitionName: String,
  85. maskTransitionName: String,
  86. animation: N.any,
  87. maskAnimation: N.any,
  88. wrapStyle: {
  89. type: Object,
  90. default: void 0
  91. },
  92. bodyStyle: {
  93. type: Object,
  94. default: void 0
  95. },
  96. maskStyle: {
  97. type: Object,
  98. default: void 0
  99. },
  100. prefixCls: String,
  101. wrapClassName: String,
  102. rootClassName: String,
  103. width: [String, Number],
  104. height: [String, Number],
  105. zIndex: Number,
  106. bodyProps: N.any,
  107. maskProps: N.any,
  108. wrapProps: N.any,
  109. getContainer: N.any,
  110. dialogStyle: {
  111. type: Object,
  112. default: void 0
  113. },
  114. dialogClass: String,
  115. closeIcon: N.any,
  116. forceRender: {
  117. type: Boolean,
  118. default: void 0
  119. },
  120. getOpenCount: Function,
  121. // https://github.com/ant-design/ant-design/issues/19771
  122. // https://github.com/react-component/dialog/issues/95
  123. focusTriggerAfterClose: {
  124. type: Boolean,
  125. default: void 0
  126. },
  127. onClose: Function,
  128. modalRender: Function
  129. };
  130. }
  131. function je(e, t, o) {
  132. let n = t;
  133. return !n && o && (n = `${e}-${o}`), n;
  134. }
  135. let Ge = -1;
  136. function po() {
  137. return Ge += 1, Ge;
  138. }
  139. function Xe(e, t) {
  140. let o = e[`page${t ? "Y" : "X"}Offset`];
  141. const n = `scroll${t ? "Top" : "Left"}`;
  142. if (typeof o != "number") {
  143. const l = e.document;
  144. o = l.documentElement[n], typeof o != "number" && (o = l.body[n]);
  145. }
  146. return o;
  147. }
  148. function go(e) {
  149. const t = e.getBoundingClientRect(), o = {
  150. left: t.left,
  151. top: t.top
  152. }, n = e.ownerDocument, l = n.defaultView || n.parentWindow;
  153. return o.left += Xe(l), o.top += Xe(l, !0), o;
  154. }
  155. const yo = {
  156. width: 0,
  157. height: 0,
  158. overflow: "hidden",
  159. outline: "none"
  160. }, Co = {
  161. outline: "none"
  162. }, bo = J({
  163. compatConfig: {
  164. MODE: 3
  165. },
  166. name: "DialogContent",
  167. inheritAttrs: !1,
  168. props: f(f({}, ze()), {
  169. motionName: String,
  170. ariaId: String,
  171. onVisibleChanged: Function,
  172. onMousedown: Function,
  173. onMouseup: Function
  174. }),
  175. setup(e, t) {
  176. let {
  177. expose: o,
  178. slots: n,
  179. attrs: l
  180. } = t;
  181. const i = B(), p = B(), m = B();
  182. o({
  183. focus: () => {
  184. var s;
  185. (s = i.value) === null || s === void 0 || s.focus({
  186. preventScroll: !0
  187. });
  188. },
  189. changeActive: (s) => {
  190. const {
  191. activeElement: r
  192. } = document;
  193. s && r === p.value ? i.value.focus({
  194. preventScroll: !0
  195. }) : !s && r === i.value && p.value.focus({
  196. preventScroll: !0
  197. });
  198. }
  199. });
  200. const $ = B(), v = Q(() => {
  201. const {
  202. width: s,
  203. height: r
  204. } = e, y = {};
  205. return s !== void 0 && (y.width = typeof s == "number" ? `${s}px` : s), r !== void 0 && (y.height = typeof r == "number" ? `${r}px` : r), $.value && (y.transformOrigin = $.value), y;
  206. }), u = () => {
  207. Je(() => {
  208. if (m.value) {
  209. const s = go(m.value);
  210. $.value = e.mousePosition ? `${e.mousePosition.x - s.left}px ${e.mousePosition.y - s.top}px` : "";
  211. }
  212. });
  213. }, d = (s) => {
  214. e.onVisibleChanged(s);
  215. };
  216. return () => {
  217. var s, r, y, x;
  218. const {
  219. prefixCls: w,
  220. footer: c = (s = n.footer) === null || s === void 0 ? void 0 : s.call(n),
  221. title: h = (r = n.title) === null || r === void 0 ? void 0 : r.call(n),
  222. ariaId: C,
  223. closable: T,
  224. closeIcon: F = (y = n.closeIcon) === null || y === void 0 ? void 0 : y.call(n),
  225. onClose: O,
  226. bodyStyle: z,
  227. bodyProps: g,
  228. onMousedown: A,
  229. onMouseup: S,
  230. visible: H,
  231. modalRender: M = n.modalRender,
  232. destroyOnClose: G,
  233. motionName: X
  234. } = e;
  235. let L;
  236. c && (L = a("div", {
  237. class: `${w}-footer`
  238. }, [c]));
  239. let R;
  240. h && (R = a("div", {
  241. class: `${w}-header`
  242. }, [a("div", {
  243. class: `${w}-title`,
  244. id: C
  245. }, [h])]));
  246. let Y;
  247. T && (Y = a("button", {
  248. type: "button",
  249. onClick: O,
  250. "aria-label": "Close",
  251. class: `${w}-close`
  252. }, [F || a("span", {
  253. class: `${w}-close-x`
  254. }, null)]));
  255. const W = a("div", {
  256. class: `${w}-content`
  257. }, [Y, R, a("div", P({
  258. class: `${w}-body`,
  259. style: z
  260. }, g), [(x = n.default) === null || x === void 0 ? void 0 : x.call(n)]), L]), U = lt(X);
  261. return a(Qe, P(P({}, U), {}, {
  262. onBeforeEnter: u,
  263. onAfterEnter: () => d(!0),
  264. onAfterLeave: () => d(!1)
  265. }), {
  266. default: () => [H || !G ? Ze(a("div", P(P({}, l), {}, {
  267. ref: m,
  268. key: "dialog-element",
  269. role: "document",
  270. style: [v.value, l.style],
  271. class: [w, l.class],
  272. onMousedown: A,
  273. onMouseup: S
  274. }), [a("div", {
  275. tabindex: 0,
  276. ref: i,
  277. style: Co
  278. }, [M ? M({
  279. originVNode: W
  280. }) : W]), a("div", {
  281. tabindex: 0,
  282. ref: p,
  283. style: yo
  284. }, null)]), [[qe, H]]) : null]
  285. });
  286. };
  287. }
  288. }), ho = J({
  289. compatConfig: {
  290. MODE: 3
  291. },
  292. name: "DialogMask",
  293. props: {
  294. prefixCls: String,
  295. visible: Boolean,
  296. motionName: String,
  297. maskProps: Object
  298. },
  299. setup(e, t) {
  300. return () => {
  301. const {
  302. prefixCls: o,
  303. visible: n,
  304. maskProps: l,
  305. motionName: i
  306. } = e, p = lt(i);
  307. return a(Qe, p, {
  308. default: () => [Ze(a("div", P({
  309. class: `${o}-mask`
  310. }, l), null), [[qe, n]])]
  311. });
  312. };
  313. }
  314. }), Ke = J({
  315. compatConfig: {
  316. MODE: 3
  317. },
  318. name: "VcDialog",
  319. inheritAttrs: !1,
  320. props: Be(f(f({}, ze()), {
  321. getOpenCount: Function,
  322. scrollLocker: Object
  323. }), {
  324. mask: !0,
  325. visible: !1,
  326. keyboard: !0,
  327. closable: !0,
  328. maskClosable: !0,
  329. destroyOnClose: !1,
  330. prefixCls: "rc-dialog",
  331. getOpenCount: () => null,
  332. focusTriggerAfterClose: !0
  333. }),
  334. setup(e, t) {
  335. let {
  336. attrs: o,
  337. slots: n
  338. } = t;
  339. const l = D(), i = D(), p = D(), m = D(e.visible), $ = D(`vcDialogTitle${po()}`), v = (c) => {
  340. var h, C;
  341. if (c)
  342. zt(i.value, document.activeElement) || (l.value = document.activeElement, (h = p.value) === null || h === void 0 || h.focus());
  343. else {
  344. const T = m.value;
  345. if (m.value = !1, e.mask && l.value && e.focusTriggerAfterClose) {
  346. try {
  347. l.value.focus({
  348. preventScroll: !0
  349. });
  350. } catch (F) {
  351. }
  352. l.value = null;
  353. }
  354. T && ((C = e.afterClose) === null || C === void 0 || C.call(e));
  355. }
  356. }, u = (c) => {
  357. var h;
  358. (h = e.onClose) === null || h === void 0 || h.call(e, c);
  359. }, d = D(!1), s = D(), r = () => {
  360. clearTimeout(s.value), d.value = !0;
  361. }, y = () => {
  362. s.value = setTimeout(() => {
  363. d.value = !1;
  364. });
  365. }, x = (c) => {
  366. if (!e.maskClosable) return null;
  367. d.value ? d.value = !1 : i.value === c.target && u(c);
  368. }, w = (c) => {
  369. if (e.keyboard && c.keyCode === We.ESC) {
  370. c.stopPropagation(), u(c);
  371. return;
  372. }
  373. e.visible && c.keyCode === We.TAB && p.value.changeActive(!c.shiftKey);
  374. };
  375. return j(() => e.visible, () => {
  376. e.visible && (m.value = !0);
  377. }, {
  378. flush: "post"
  379. }), et(() => {
  380. var c;
  381. clearTimeout(s.value), (c = e.scrollLocker) === null || c === void 0 || c.unLock();
  382. }), tt(() => {
  383. var c, h;
  384. (c = e.scrollLocker) === null || c === void 0 || c.unLock(), m.value && ((h = e.scrollLocker) === null || h === void 0 || h.lock());
  385. }), () => {
  386. const {
  387. prefixCls: c,
  388. mask: h,
  389. visible: C,
  390. maskTransitionName: T,
  391. maskAnimation: F,
  392. zIndex: O,
  393. wrapClassName: z,
  394. rootClassName: g,
  395. wrapStyle: A,
  396. closable: S,
  397. maskProps: H,
  398. maskStyle: M,
  399. transitionName: G,
  400. animation: X,
  401. wrapProps: L,
  402. title: R = n.title
  403. } = e, {
  404. style: Y,
  405. class: W
  406. } = o;
  407. return a("div", P({
  408. class: [`${c}-root`, g]
  409. }, Nt(e, {
  410. data: !0
  411. })), [a(ho, {
  412. prefixCls: c,
  413. visible: h && C,
  414. motionName: je(c, T, F),
  415. style: f({
  416. zIndex: O
  417. }, M),
  418. maskProps: H
  419. }, null), a("div", P({
  420. tabIndex: -1,
  421. onKeydown: w,
  422. class: ye(`${c}-wrap`, z),
  423. ref: i,
  424. onClick: x,
  425. role: "dialog",
  426. "aria-labelledby": R ? $.value : null,
  427. style: f(f({
  428. zIndex: O
  429. }, A), {
  430. display: m.value ? null : "none"
  431. })
  432. }, L), [a(bo, P(P({}, at(e, ["scrollLocker"])), {}, {
  433. style: Y,
  434. class: W,
  435. onMousedown: r,
  436. onMouseup: y,
  437. ref: p,
  438. closable: S,
  439. ariaId: $.value,
  440. prefixCls: c,
  441. visible: C,
  442. onClose: u,
  443. onVisibleChanged: v,
  444. motionName: je(c, G, X)
  445. }), n)])]);
  446. };
  447. }
  448. }), xo = ze(), So = J({
  449. compatConfig: {
  450. MODE: 3
  451. },
  452. name: "DialogWrap",
  453. inheritAttrs: !1,
  454. props: Be(xo, {
  455. visible: !1
  456. }),
  457. setup(e, t) {
  458. let {
  459. attrs: o,
  460. slots: n
  461. } = t;
  462. const l = B(e.visible);
  463. return Rt({}, {
  464. inTriggerContext: !1
  465. }), j(() => e.visible, () => {
  466. e.visible && (l.value = !0);
  467. }, {
  468. flush: "post"
  469. }), () => {
  470. const {
  471. visible: i,
  472. getContainer: p,
  473. forceRender: m,
  474. destroyOnClose: $ = !1,
  475. afterClose: v
  476. } = e;
  477. let u = f(f(f({}, e), o), {
  478. ref: "_component",
  479. key: "dialog"
  480. });
  481. return p === !1 ? a(Ke, P(P({}, u), {}, {
  482. getOpenCount: () => 2
  483. }), n) : !m && $ && !l.value ? null : a(Et, {
  484. autoLock: !0,
  485. visible: i,
  486. forceRender: m,
  487. getContainer: p
  488. }, {
  489. default: (d) => (u = f(f(f({}, u), d), {
  490. afterClose: () => {
  491. v == null || v(), l.value = !1;
  492. }
  493. }), a(Ke, u, n))
  494. });
  495. };
  496. }
  497. });
  498. function Ye(e) {
  499. return {
  500. position: e,
  501. top: 0,
  502. insetInlineEnd: 0,
  503. bottom: 0,
  504. insetInlineStart: 0
  505. };
  506. }
  507. const $o = (e) => {
  508. const {
  509. componentCls: t
  510. } = e;
  511. return [{
  512. [`${t}-root`]: {
  513. [`${t}${e.antCls}-zoom-enter, ${t}${e.antCls}-zoom-appear`]: {
  514. // reset scale avoid mousePosition bug
  515. transform: "none",
  516. opacity: 0,
  517. animationDuration: e.motionDurationSlow,
  518. // https://github.com/ant-design/ant-design/issues/11777
  519. userSelect: "none"
  520. },
  521. [`${t}${e.antCls}-zoom-leave ${t}-content`]: {
  522. pointerEvents: "none"
  523. },
  524. [`${t}-mask`]: f(f({}, Ye("fixed")), {
  525. zIndex: e.zIndexPopupBase,
  526. height: "100%",
  527. backgroundColor: e.colorBgMask,
  528. [`${t}-hidden`]: {
  529. display: "none"
  530. }
  531. }),
  532. [`${t}-wrap`]: f(f({}, Ye("fixed")), {
  533. overflow: "auto",
  534. outline: 0,
  535. WebkitOverflowScrolling: "touch"
  536. })
  537. }
  538. }, {
  539. [`${t}-root`]: vo(e)
  540. }];
  541. }, wo = (e) => {
  542. const {
  543. componentCls: t
  544. } = e;
  545. return [
  546. // ======================== Root =========================
  547. {
  548. [`${t}-root`]: {
  549. [`${t}-wrap`]: {
  550. zIndex: e.zIndexPopupBase,
  551. position: "fixed",
  552. inset: 0,
  553. overflow: "auto",
  554. outline: 0,
  555. WebkitOverflowScrolling: "touch"
  556. },
  557. [`${t}-wrap-rtl`]: {
  558. direction: "rtl"
  559. },
  560. [`${t}-centered`]: {
  561. textAlign: "center",
  562. "&::before": {
  563. display: "inline-block",
  564. width: 0,
  565. height: "100%",
  566. verticalAlign: "middle",
  567. content: '""'
  568. },
  569. [t]: {
  570. top: 0,
  571. display: "inline-block",
  572. paddingBottom: 0,
  573. textAlign: "start",
  574. verticalAlign: "middle"
  575. }
  576. },
  577. [`@media (max-width: ${e.screenSMMax})`]: {
  578. [t]: {
  579. maxWidth: "calc(100vw - 16px)",
  580. margin: `${e.marginXS} auto`
  581. },
  582. [`${t}-centered`]: {
  583. [t]: {
  584. flex: 1
  585. }
  586. }
  587. }
  588. }
  589. },
  590. // ======================== Modal ========================
  591. {
  592. [t]: f(f({}, _t(e)), {
  593. pointerEvents: "none",
  594. position: "relative",
  595. top: 100,
  596. width: "auto",
  597. maxWidth: `calc(100vw - ${e.margin * 2}px)`,
  598. margin: "0 auto",
  599. paddingBottom: e.paddingLG,
  600. [`${t}-title`]: {
  601. margin: 0,
  602. color: e.modalHeadingColor,
  603. fontWeight: e.fontWeightStrong,
  604. fontSize: e.modalHeaderTitleFontSize,
  605. lineHeight: e.modalHeaderTitleLineHeight,
  606. wordWrap: "break-word"
  607. },
  608. [`${t}-content`]: {
  609. position: "relative",
  610. backgroundColor: e.modalContentBg,
  611. backgroundClip: "padding-box",
  612. border: 0,
  613. borderRadius: e.borderRadiusLG,
  614. boxShadow: e.boxShadowSecondary,
  615. pointerEvents: "auto",
  616. padding: `${e.paddingMD}px ${e.paddingContentHorizontalLG}px`
  617. },
  618. [`${t}-close`]: f({
  619. position: "absolute",
  620. top: (e.modalHeaderCloseSize - e.modalCloseBtnSize) / 2,
  621. insetInlineEnd: (e.modalHeaderCloseSize - e.modalCloseBtnSize) / 2,
  622. zIndex: e.zIndexPopupBase + 10,
  623. padding: 0,
  624. color: e.modalCloseColor,
  625. fontWeight: e.fontWeightStrong,
  626. lineHeight: 1,
  627. textDecoration: "none",
  628. background: "transparent",
  629. borderRadius: e.borderRadiusSM,
  630. width: e.modalConfirmIconSize,
  631. height: e.modalConfirmIconSize,
  632. border: 0,
  633. outline: 0,
  634. cursor: "pointer",
  635. transition: `color ${e.motionDurationMid}, background-color ${e.motionDurationMid}`,
  636. "&-x": {
  637. display: "block",
  638. fontSize: e.fontSizeLG,
  639. fontStyle: "normal",
  640. lineHeight: `${e.modalCloseBtnSize}px`,
  641. textAlign: "center",
  642. textTransform: "none",
  643. textRendering: "auto"
  644. },
  645. "&:hover": {
  646. color: e.modalIconHoverColor,
  647. backgroundColor: e.wireframe ? "transparent" : e.colorFillContent,
  648. textDecoration: "none"
  649. },
  650. "&:active": {
  651. backgroundColor: e.wireframe ? "transparent" : e.colorFillContentHover
  652. }
  653. }, Wt(e)),
  654. [`${t}-header`]: {
  655. color: e.colorText,
  656. background: e.modalHeaderBg,
  657. borderRadius: `${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`,
  658. marginBottom: e.marginXS
  659. },
  660. [`${t}-body`]: {
  661. fontSize: e.fontSize,
  662. lineHeight: e.lineHeight,
  663. wordWrap: "break-word"
  664. },
  665. [`${t}-footer`]: {
  666. textAlign: "end",
  667. background: e.modalFooterBg,
  668. marginTop: e.marginSM,
  669. [`${e.antCls}-btn + ${e.antCls}-btn:not(${e.antCls}-dropdown-trigger)`]: {
  670. marginBottom: 0,
  671. marginInlineStart: e.marginXS
  672. }
  673. },
  674. [`${t}-open`]: {
  675. overflow: "hidden"
  676. }
  677. })
  678. },
  679. // ======================== Pure =========================
  680. {
  681. [`${t}-pure-panel`]: {
  682. top: "auto",
  683. padding: 0,
  684. display: "flex",
  685. flexDirection: "column",
  686. [`${t}-content,
  687. ${t}-body,
  688. ${t}-confirm-body-wrapper`]: {
  689. display: "flex",
  690. flexDirection: "column",
  691. flex: "auto"
  692. },
  693. [`${t}-confirm-body`]: {
  694. marginBottom: "auto"
  695. }
  696. }
  697. }
  698. ];
  699. }, To = (e) => {
  700. const {
  701. componentCls: t
  702. } = e, o = `${t}-confirm`;
  703. return {
  704. [o]: {
  705. "&-rtl": {
  706. direction: "rtl"
  707. },
  708. [`${e.antCls}-modal-header`]: {
  709. display: "none"
  710. },
  711. [`${o}-body-wrapper`]: f({}, Vt()),
  712. [`${o}-body`]: {
  713. display: "flex",
  714. flexWrap: "wrap",
  715. alignItems: "center",
  716. [`${o}-title`]: {
  717. flex: "0 0 100%",
  718. display: "block",
  719. // create BFC to avoid
  720. // https://user-images.githubusercontent.com/507615/37702510-ba844e06-2d2d-11e8-9b67-8e19be57f445.png
  721. overflow: "hidden",
  722. color: e.colorTextHeading,
  723. fontWeight: e.fontWeightStrong,
  724. fontSize: e.modalHeaderTitleFontSize,
  725. lineHeight: e.modalHeaderTitleLineHeight,
  726. [`+ ${o}-content`]: {
  727. marginBlockStart: e.marginXS,
  728. flexBasis: "100%",
  729. maxWidth: `calc(100% - ${e.modalConfirmIconSize + e.marginSM}px)`
  730. }
  731. },
  732. [`${o}-content`]: {
  733. color: e.colorText,
  734. fontSize: e.fontSize
  735. },
  736. [`> ${e.iconCls}`]: {
  737. flex: "none",
  738. marginInlineEnd: e.marginSM,
  739. fontSize: e.modalConfirmIconSize,
  740. [`+ ${o}-title`]: {
  741. flex: 1
  742. },
  743. // `content` after `icon` should set marginLeft
  744. [`+ ${o}-title + ${o}-content`]: {
  745. marginInlineStart: e.modalConfirmIconSize + e.marginSM
  746. }
  747. }
  748. },
  749. [`${o}-btns`]: {
  750. textAlign: "end",
  751. marginTop: e.marginSM,
  752. [`${e.antCls}-btn + ${e.antCls}-btn`]: {
  753. marginBottom: 0,
  754. marginInlineStart: e.marginXS
  755. }
  756. }
  757. },
  758. [`${o}-error ${o}-body > ${e.iconCls}`]: {
  759. color: e.colorError
  760. },
  761. [`${o}-warning ${o}-body > ${e.iconCls},
  762. ${o}-confirm ${o}-body > ${e.iconCls}`]: {
  763. color: e.colorWarning
  764. },
  765. [`${o}-info ${o}-body > ${e.iconCls}`]: {
  766. color: e.colorInfo
  767. },
  768. [`${o}-success ${o}-body > ${e.iconCls}`]: {
  769. color: e.colorSuccess
  770. },
  771. // https://github.com/ant-design/ant-design/issues/37329
  772. [`${t}-zoom-leave ${t}-btns`]: {
  773. pointerEvents: "none"
  774. }
  775. };
  776. }, Bo = (e) => {
  777. const {
  778. componentCls: t
  779. } = e;
  780. return {
  781. [`${t}-root`]: {
  782. [`${t}-wrap-rtl`]: {
  783. direction: "rtl",
  784. [`${t}-confirm-body`]: {
  785. direction: "rtl"
  786. }
  787. }
  788. }
  789. };
  790. }, Po = (e) => {
  791. const {
  792. componentCls: t,
  793. antCls: o
  794. } = e, n = `${t}-confirm`;
  795. return {
  796. [t]: {
  797. [`${t}-content`]: {
  798. padding: 0
  799. },
  800. [`${t}-header`]: {
  801. padding: e.modalHeaderPadding,
  802. borderBottom: `${e.modalHeaderBorderWidth}px ${e.modalHeaderBorderStyle} ${e.modalHeaderBorderColorSplit}`,
  803. marginBottom: 0
  804. },
  805. [`${t}-body`]: {
  806. padding: e.modalBodyPadding
  807. },
  808. [`${t}-footer`]: {
  809. padding: `${e.modalFooterPaddingVertical}px ${e.modalFooterPaddingHorizontal}px`,
  810. borderTop: `${e.modalFooterBorderWidth}px ${e.modalFooterBorderStyle} ${e.modalFooterBorderColorSplit}`,
  811. borderRadius: `0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`,
  812. marginTop: 0
  813. }
  814. },
  815. [n]: {
  816. [`${o}-modal-body`]: {
  817. padding: `${e.padding * 2}px ${e.padding * 2}px ${e.paddingLG}px`
  818. },
  819. [`${n}-body`]: {
  820. [`> ${e.iconCls}`]: {
  821. marginInlineEnd: e.margin,
  822. // `content` after `icon` should set marginLeft
  823. [`+ ${n}-title + ${n}-content`]: {
  824. marginInlineStart: e.modalConfirmIconSize + e.margin
  825. }
  826. }
  827. },
  828. [`${n}-btns`]: {
  829. marginTop: e.marginLG
  830. }
  831. }
  832. };
  833. }, Fo = Dt("Modal", (e) => {
  834. const t = e.padding, o = e.fontSizeHeading5, n = e.lineHeightHeading5, l = Lt(e, {
  835. modalBodyPadding: e.paddingLG,
  836. modalHeaderBg: e.colorBgElevated,
  837. modalHeaderPadding: `${t}px ${e.paddingLG}px`,
  838. modalHeaderBorderWidth: e.lineWidth,
  839. modalHeaderBorderStyle: e.lineType,
  840. modalHeaderTitleLineHeight: n,
  841. modalHeaderTitleFontSize: o,
  842. modalHeaderBorderColorSplit: e.colorSplit,
  843. modalHeaderCloseSize: n * o + t * 2,
  844. modalContentBg: e.colorBgElevated,
  845. modalHeadingColor: e.colorTextHeading,
  846. modalCloseColor: e.colorTextDescription,
  847. modalFooterBg: "transparent",
  848. modalFooterBorderColorSplit: e.colorSplit,
  849. modalFooterBorderStyle: e.lineType,
  850. modalFooterPaddingVertical: e.paddingXS,
  851. modalFooterPaddingHorizontal: e.padding,
  852. modalFooterBorderWidth: e.lineWidth,
  853. modalConfirmTitleFontSize: e.fontSizeLG,
  854. modalIconHoverColor: e.colorIconHover,
  855. modalConfirmIconSize: e.fontSize * e.lineHeight,
  856. modalCloseBtnSize: e.controlHeightLG * 0.55
  857. });
  858. return [wo(l), To(l), Bo(l), $o(l), e.wireframe && Po(l), kt(l, "zoom")];
  859. });
  860. var Oo = function(e, t) {
  861. var o = {};
  862. for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
  863. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, n = Object.getOwnPropertySymbols(e); l < n.length; l++)
  864. t.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (o[n[l]] = e[n[l]]);
  865. return o;
  866. };
  867. let He;
  868. const Mo = (e) => {
  869. He = {
  870. x: e.pageX,
  871. y: e.pageY
  872. }, setTimeout(() => He = null, 100);
  873. };
  874. Kt() && Yt(document.documentElement, "click", Mo, !0);
  875. const Ao = () => ({
  876. prefixCls: String,
  877. /** @deprecated Please use `open` instead. */
  878. visible: {
  879. type: Boolean,
  880. default: void 0
  881. },
  882. open: {
  883. type: Boolean,
  884. default: void 0
  885. },
  886. confirmLoading: {
  887. type: Boolean,
  888. default: void 0
  889. },
  890. title: N.any,
  891. closable: {
  892. type: Boolean,
  893. default: void 0
  894. },
  895. closeIcon: N.any,
  896. onOk: Function,
  897. onCancel: Function,
  898. "onUpdate:visible": Function,
  899. "onUpdate:open": Function,
  900. onChange: Function,
  901. afterClose: Function,
  902. centered: {
  903. type: Boolean,
  904. default: void 0
  905. },
  906. width: [String, Number],
  907. footer: N.any,
  908. okText: N.any,
  909. okType: String,
  910. cancelText: N.any,
  911. icon: N.any,
  912. maskClosable: {
  913. type: Boolean,
  914. default: void 0
  915. },
  916. forceRender: {
  917. type: Boolean,
  918. default: void 0
  919. },
  920. okButtonProps: ge(),
  921. cancelButtonProps: ge(),
  922. destroyOnClose: {
  923. type: Boolean,
  924. default: void 0
  925. },
  926. wrapClassName: String,
  927. maskTransitionName: String,
  928. transitionName: String,
  929. getContainer: {
  930. type: [String, Function, Boolean, Object],
  931. default: void 0
  932. },
  933. zIndex: Number,
  934. bodyStyle: ge(),
  935. maskStyle: ge(),
  936. mask: {
  937. type: Boolean,
  938. default: void 0
  939. },
  940. keyboard: {
  941. type: Boolean,
  942. default: void 0
  943. },
  944. wrapProps: Object,
  945. focusTriggerAfterClose: {
  946. type: Boolean,
  947. default: void 0
  948. },
  949. modalRender: Function,
  950. mousePosition: ge()
  951. }), _ = J({
  952. compatConfig: {
  953. MODE: 3
  954. },
  955. name: "AModal",
  956. inheritAttrs: !1,
  957. props: Be(Ao(), {
  958. width: 520,
  959. confirmLoading: !1,
  960. okType: "primary"
  961. }),
  962. setup(e, t) {
  963. let {
  964. emit: o,
  965. slots: n,
  966. attrs: l
  967. } = t;
  968. const [i] = Ne("Modal"), {
  969. prefixCls: p,
  970. rootPrefixCls: m,
  971. direction: $,
  972. getPopupContainer: v
  973. } = jt("modal", e), [u, d] = Fo(p);
  974. it(e.visible === void 0, "Modal", "`visible` will be removed in next major version, please use `open` instead.");
  975. const s = (x) => {
  976. o("update:visible", !1), o("update:open", !1), o("cancel", x), o("change", !1);
  977. }, r = (x) => {
  978. o("ok", x);
  979. }, y = () => {
  980. var x, w;
  981. const {
  982. okText: c = (x = n.okText) === null || x === void 0 ? void 0 : x.call(n),
  983. okType: h,
  984. cancelText: C = (w = n.cancelText) === null || w === void 0 ? void 0 : w.call(n),
  985. confirmLoading: T
  986. } = e;
  987. return a(Me, null, [a(Ae, P({
  988. onClick: s
  989. }, e.cancelButtonProps), {
  990. default: () => [C || i.value.cancelText]
  991. }), a(Ae, P(P({}, Xt(h)), {}, {
  992. loading: T,
  993. onClick: r
  994. }, e.okButtonProps), {
  995. default: () => [c || i.value.okText]
  996. })]);
  997. };
  998. return () => {
  999. var x, w;
  1000. const {
  1001. prefixCls: c,
  1002. visible: h,
  1003. open: C,
  1004. wrapClassName: T,
  1005. centered: F,
  1006. getContainer: O,
  1007. closeIcon: z = (x = n.closeIcon) === null || x === void 0 ? void 0 : x.call(n),
  1008. focusTriggerAfterClose: g = !0
  1009. } = e, A = Oo(e, ["prefixCls", "visible", "open", "wrapClassName", "centered", "getContainer", "closeIcon", "focusTriggerAfterClose"]), S = ye(T, {
  1010. [`${p.value}-centered`]: !!F,
  1011. [`${p.value}-wrap-rtl`]: $.value === "rtl"
  1012. });
  1013. return u(a(So, P(P(P({}, A), l), {}, {
  1014. rootClassName: d.value,
  1015. class: ye(d.value, l.class),
  1016. getContainer: O || (v == null ? void 0 : v.value),
  1017. prefixCls: p.value,
  1018. wrapClassName: S,
  1019. visible: C != null ? C : h,
  1020. onClose: s,
  1021. focusTriggerAfterClose: g,
  1022. transitionName: Te(m.value, "zoom", e.transitionName),
  1023. maskTransitionName: Te(m.value, "fade", e.maskTransitionName),
  1024. mousePosition: (w = A.mousePosition) !== null && w !== void 0 ? w : He
  1025. }), f(f({}, n), {
  1026. footer: n.footer || y,
  1027. closeIcon: () => a("span", {
  1028. class: `${p.value}-close-x`
  1029. }, [z || a(Gt, {
  1030. class: `${p.value}-close-icon`
  1031. }, null)])
  1032. })));
  1033. };
  1034. }
  1035. });
  1036. function de(e) {
  1037. return typeof e == "function" ? e() : e;
  1038. }
  1039. const rt = J({
  1040. name: "ConfirmDialog",
  1041. inheritAttrs: !1,
  1042. 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"],
  1043. setup(e, t) {
  1044. let {
  1045. attrs: o
  1046. } = t;
  1047. const [n] = Ne("Modal");
  1048. return process.env.NODE_ENV !== "production" && it(e.visible === void 0, "Modal", "`visible` is deprecated, please use `open` instead."), () => {
  1049. const {
  1050. icon: l,
  1051. onCancel: i,
  1052. onOk: p,
  1053. close: m,
  1054. okText: $,
  1055. closable: v = !1,
  1056. zIndex: u,
  1057. afterClose: d,
  1058. keyboard: s,
  1059. centered: r,
  1060. getContainer: y,
  1061. maskStyle: x,
  1062. okButtonProps: w,
  1063. cancelButtonProps: c,
  1064. okCancel: h,
  1065. width: C = 416,
  1066. mask: T = !0,
  1067. maskClosable: F = !1,
  1068. type: O,
  1069. open: z,
  1070. title: g,
  1071. content: A,
  1072. direction: S,
  1073. closeIcon: H,
  1074. modalRender: M,
  1075. focusTriggerAfterClose: G,
  1076. rootPrefixCls: X,
  1077. bodyStyle: L,
  1078. wrapClassName: R,
  1079. footer: Y
  1080. } = e;
  1081. let W = l;
  1082. if (!l && l !== null)
  1083. switch (O) {
  1084. case "info":
  1085. W = a(qt, null, null);
  1086. break;
  1087. case "success":
  1088. W = a(Zt, null, null);
  1089. break;
  1090. case "error":
  1091. W = a(Qt, null, null);
  1092. break;
  1093. default:
  1094. W = a(Ut, null, null);
  1095. }
  1096. const U = e.okType || "primary", fe = e.prefixCls || "ant-modal", ee = `${fe}-confirm`, me = o.style || {}, be = h != null ? h : O === "confirm", he = e.autoFocusButton === null ? !1 : e.autoFocusButton || "ok", re = `${fe}-confirm`, Pe = ye(re, `${re}-${e.type}`, {
  1097. [`${re}-rtl`]: S === "rtl"
  1098. }, o.class), se = n.value, b = be && a(Ve, {
  1099. actionFn: i,
  1100. close: m,
  1101. autofocus: he === "cancel",
  1102. buttonProps: c,
  1103. prefixCls: `${X}-btn`
  1104. }, {
  1105. default: () => [de(e.cancelText) || se.cancelText]
  1106. });
  1107. return a(_, {
  1108. prefixCls: fe,
  1109. class: Pe,
  1110. wrapClassName: ye({
  1111. [`${re}-centered`]: !!r
  1112. }, R),
  1113. onCancel: (V) => m == null ? void 0 : m({
  1114. triggerCancel: !0
  1115. }, V),
  1116. open: z,
  1117. title: "",
  1118. footer: "",
  1119. transitionName: Te(X, "zoom", e.transitionName),
  1120. maskTransitionName: Te(X, "fade", e.maskTransitionName),
  1121. mask: T,
  1122. maskClosable: F,
  1123. maskStyle: x,
  1124. style: me,
  1125. bodyStyle: L,
  1126. width: C,
  1127. zIndex: u,
  1128. afterClose: d,
  1129. keyboard: s,
  1130. centered: r,
  1131. getContainer: y,
  1132. closable: v,
  1133. closeIcon: H,
  1134. modalRender: M,
  1135. focusTriggerAfterClose: G
  1136. }, {
  1137. default: () => [a("div", {
  1138. class: `${ee}-body-wrapper`
  1139. }, [a("div", {
  1140. class: `${ee}-body`
  1141. }, [de(W), g === void 0 ? null : a("span", {
  1142. class: `${ee}-title`
  1143. }, [de(g)]), a("div", {
  1144. class: `${ee}-content`
  1145. }, [de(A)])]), Y !== void 0 ? de(Y) : a("div", {
  1146. class: `${ee}-btns`
  1147. }, [b, a(Ve, {
  1148. type: U,
  1149. actionFn: p,
  1150. close: m,
  1151. autofocus: he === "ok",
  1152. buttonProps: w,
  1153. prefixCls: `${X}-btn`
  1154. }, {
  1155. default: () => [de($) || (be ? se.okText : se.justOkText)]
  1156. })])])]
  1157. });
  1158. };
  1159. }
  1160. }), ie = [], Ce = (e) => {
  1161. const t = document.createDocumentFragment();
  1162. let o = f(f({}, at(e, ["parentContext", "appContext"])), {
  1163. close: i,
  1164. open: !0
  1165. }), n = null;
  1166. function l() {
  1167. n && (Le(null, t), n = null);
  1168. for (var v = arguments.length, u = new Array(v), d = 0; d < v; d++)
  1169. u[d] = arguments[d];
  1170. const s = u.some((r) => r && r.triggerCancel);
  1171. e.onCancel && s && e.onCancel(() => {
  1172. }, ...u.slice(1));
  1173. for (let r = 0; r < ie.length; r++)
  1174. if (ie[r] === i) {
  1175. ie.splice(r, 1);
  1176. break;
  1177. }
  1178. }
  1179. function i() {
  1180. for (var v = arguments.length, u = new Array(v), d = 0; d < v; d++)
  1181. u[d] = arguments[d];
  1182. o = f(f({}, o), {
  1183. open: !1,
  1184. afterClose: () => {
  1185. typeof e.afterClose == "function" && e.afterClose(), l.apply(this, u);
  1186. }
  1187. }), o.visible && delete o.visible, p(o);
  1188. }
  1189. function p(v) {
  1190. typeof v == "function" ? o = v(o) : o = f(f({}, o), v), n && Jt(n, o, t);
  1191. }
  1192. const m = (v) => {
  1193. const u = eo, d = u.prefixCls, s = v.prefixCls || `${d}-modal`, r = u.iconPrefixCls, y = oo();
  1194. return a(to, P(P({}, u), {}, {
  1195. prefixCls: d
  1196. }), {
  1197. default: () => [a(rt, P(P({}, v), {}, {
  1198. rootPrefixCls: d,
  1199. prefixCls: s,
  1200. iconPrefixCls: r,
  1201. locale: y,
  1202. cancelText: v.cancelText || y.cancelText
  1203. }), null)]
  1204. });
  1205. };
  1206. function $(v) {
  1207. const u = a(m, f({}, v));
  1208. return u.appContext = e.parentContext || e.appContext || u.appContext, Le(u, t), u;
  1209. }
  1210. return n = $(o), ie.push(i), {
  1211. destroy: i,
  1212. update: p
  1213. };
  1214. };
  1215. function st(e) {
  1216. return f(f({}, e), {
  1217. type: "warning"
  1218. });
  1219. }
  1220. function ct(e) {
  1221. return f(f({}, e), {
  1222. type: "info"
  1223. });
  1224. }
  1225. function ut(e) {
  1226. return f(f({}, e), {
  1227. type: "success"
  1228. });
  1229. }
  1230. function dt(e) {
  1231. return f(f({}, e), {
  1232. type: "error"
  1233. });
  1234. }
  1235. function ft(e) {
  1236. return f(f({}, e), {
  1237. type: "confirm"
  1238. });
  1239. }
  1240. const Ho = () => ({
  1241. config: Object,
  1242. afterClose: Function,
  1243. destroyAction: Function,
  1244. open: Boolean
  1245. }), Io = J({
  1246. name: "HookModal",
  1247. inheritAttrs: !1,
  1248. props: Be(Ho(), {
  1249. config: {
  1250. width: 520,
  1251. okType: "primary"
  1252. }
  1253. }),
  1254. setup(e, t) {
  1255. let {
  1256. expose: o
  1257. } = t;
  1258. var n;
  1259. const l = Q(() => e.open), i = Q(() => e.config), {
  1260. direction: p,
  1261. getPrefixCls: m
  1262. } = no(), $ = m("modal"), v = m(), u = () => {
  1263. var y, x;
  1264. e == null || e.afterClose(), (x = (y = i.value).afterClose) === null || x === void 0 || x.call(y);
  1265. }, d = function() {
  1266. e.destroyAction(...arguments);
  1267. };
  1268. o({
  1269. destroy: d
  1270. });
  1271. const s = (n = i.value.okCancel) !== null && n !== void 0 ? n : i.value.type === "confirm", [r] = Ne("Modal", lo.Modal);
  1272. return () => a(rt, P(P({
  1273. prefixCls: $,
  1274. rootPrefixCls: v
  1275. }, i.value), {}, {
  1276. close: d,
  1277. open: l.value,
  1278. afterClose: u,
  1279. okText: i.value.okText || (s ? r == null ? void 0 : r.value.okText : r == null ? void 0 : r.value.justOkText),
  1280. direction: i.value.direction || p.value,
  1281. cancelText: i.value.cancelText || (r == null ? void 0 : r.value.cancelText)
  1282. }), null);
  1283. }
  1284. });
  1285. let Ue = 0;
  1286. const No = J({
  1287. name: "ElementsHolder",
  1288. inheritAttrs: !1,
  1289. setup(e, t) {
  1290. let {
  1291. expose: o
  1292. } = t;
  1293. const n = D([]);
  1294. return o({
  1295. addModal: (i) => (n.value.push(i), n.value = n.value.slice(), () => {
  1296. n.value = n.value.filter((p) => p !== i);
  1297. })
  1298. }), () => n.value.map((i) => i());
  1299. }
  1300. });
  1301. function zo() {
  1302. const e = D(null), t = D([]);
  1303. j(t, () => {
  1304. t.value.length && ([...t.value].forEach((p) => {
  1305. p();
  1306. }), t.value = []);
  1307. }, {
  1308. immediate: !0
  1309. });
  1310. const o = (i) => function(m) {
  1311. var $;
  1312. Ue += 1;
  1313. const v = D(!0), u = D(null), d = D(Ie(m)), s = D({});
  1314. j(() => m, (C) => {
  1315. w(f(f({}, ot(C) ? C.value : C), s.value));
  1316. });
  1317. const r = function() {
  1318. v.value = !1;
  1319. for (var C = arguments.length, T = new Array(C), F = 0; F < C; F++)
  1320. T[F] = arguments[F];
  1321. const O = T.some((z) => z && z.triggerCancel);
  1322. d.value.onCancel && O && d.value.onCancel(() => {
  1323. }, ...T.slice(1));
  1324. };
  1325. let y;
  1326. const x = () => a(Io, {
  1327. key: `modal-${Ue}`,
  1328. config: i(d.value),
  1329. ref: u,
  1330. open: v.value,
  1331. destroyAction: r,
  1332. afterClose: () => {
  1333. y == null || y();
  1334. }
  1335. }, null);
  1336. y = ($ = e.value) === null || $ === void 0 ? void 0 : $.addModal(x), y && ie.push(y);
  1337. const w = (C) => {
  1338. d.value = f(f({}, d.value), C);
  1339. };
  1340. return {
  1341. destroy: () => {
  1342. u.value ? r() : t.value = [...t.value, r];
  1343. },
  1344. update: (C) => {
  1345. s.value = C, u.value ? w(C) : t.value = [...t.value, () => w(C)];
  1346. }
  1347. };
  1348. }, n = Q(() => ({
  1349. info: o(ct),
  1350. success: o(ut),
  1351. error: o(dt),
  1352. warning: o(st),
  1353. confirm: o(ft)
  1354. })), l = Symbol("modalHolderKey");
  1355. return [n.value, () => a(No, {
  1356. key: l,
  1357. ref: e
  1358. }, null)];
  1359. }
  1360. function mt(e) {
  1361. return Ce(st(e));
  1362. }
  1363. _.useModal = zo;
  1364. _.info = function(t) {
  1365. return Ce(ct(t));
  1366. };
  1367. _.success = function(t) {
  1368. return Ce(ut(t));
  1369. };
  1370. _.error = function(t) {
  1371. return Ce(dt(t));
  1372. };
  1373. _.warning = mt;
  1374. _.warn = mt;
  1375. _.confirm = function(t) {
  1376. return Ce(ft(t));
  1377. };
  1378. _.destroyAll = function() {
  1379. for (; ie.length; ) {
  1380. const t = ie.pop();
  1381. t && t();
  1382. }
  1383. };
  1384. _.install = function(e) {
  1385. return e.component(_.name, _), e;
  1386. };
  1387. function Ro(e) {
  1388. return Bt() ? (Pt(e), !0) : !1;
  1389. }
  1390. function I(e) {
  1391. return typeof e == "function" ? e() : Ie(e);
  1392. }
  1393. const vt = typeof window != "undefined" && typeof document != "undefined";
  1394. typeof WorkerGlobalScope != "undefined" && globalThis instanceof WorkerGlobalScope;
  1395. const Eo = Object.prototype.toString, Do = (e) => Eo.call(e) === "[object Object]", Lo = () => {
  1396. };
  1397. function ko(e, t = {}) {
  1398. if (!ot(e))
  1399. return wt(e);
  1400. const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
  1401. for (const n in e.value)
  1402. o[n] = Tt(() => ({
  1403. get() {
  1404. return e.value[n];
  1405. },
  1406. set(l) {
  1407. var i;
  1408. if ((i = I(t.replaceRef)) != null ? i : !0)
  1409. if (Array.isArray(e.value)) {
  1410. const m = [...e.value];
  1411. m[n] = l, e.value = m;
  1412. } else {
  1413. const m = Fe(ve({}, e.value), { [n]: l });
  1414. Object.setPrototypeOf(m, Object.getPrototypeOf(e.value)), e.value = m;
  1415. }
  1416. else
  1417. e.value[n] = l;
  1418. }
  1419. }));
  1420. return o;
  1421. }
  1422. const pt = vt ? window : void 0;
  1423. function _o(e) {
  1424. var t;
  1425. const o = I(e);
  1426. return (t = o == null ? void 0 : o.$el) != null ? t : o;
  1427. }
  1428. function Oe(...e) {
  1429. let t, o, n, l;
  1430. if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([o, n, l] = e, t = pt) : [t, o, n, l] = e, !t)
  1431. return Lo;
  1432. Array.isArray(o) || (o = [o]), Array.isArray(n) || (n = [n]);
  1433. const i = [], p = () => {
  1434. i.forEach((u) => u()), i.length = 0;
  1435. }, m = (u, d, s, r) => (u.addEventListener(d, s, r), () => u.removeEventListener(d, s, r)), $ = j(
  1436. () => [_o(t), I(l)],
  1437. ([u, d]) => {
  1438. if (p(), !u)
  1439. return;
  1440. const s = Do(d) ? ve({}, d) : d;
  1441. i.push(
  1442. ...o.flatMap((r) => n.map((y) => m(u, r, y, s)))
  1443. );
  1444. },
  1445. { immediate: !0, flush: "post" }
  1446. ), v = () => {
  1447. $(), p();
  1448. };
  1449. return Ro(v), v;
  1450. }
  1451. function Wo(e, t = {}) {
  1452. var o, n;
  1453. const {
  1454. pointerTypes: l,
  1455. preventDefault: i,
  1456. stopPropagation: p,
  1457. exact: m,
  1458. onMove: $,
  1459. onEnd: v,
  1460. onStart: u,
  1461. initialValue: d,
  1462. axis: s = "both",
  1463. draggingElement: r = pt,
  1464. containerElement: y,
  1465. handle: x = e,
  1466. buttons: w = [0]
  1467. } = t, c = B(
  1468. (o = I(d)) != null ? o : { x: 0, y: 0 }
  1469. ), h = B(), C = (g) => l ? l.includes(g.pointerType) : !0, T = (g) => {
  1470. I(i) && g.preventDefault(), I(p) && g.stopPropagation();
  1471. }, F = (g) => {
  1472. var A;
  1473. if (!I(w).includes(g.button) || I(t.disabled) || !C(g) || I(m) && g.target !== I(e))
  1474. return;
  1475. const S = I(y), H = (A = S == null ? void 0 : S.getBoundingClientRect) == null ? void 0 : A.call(S), M = I(e).getBoundingClientRect(), G = {
  1476. x: g.clientX - (S ? M.left - H.left + S.scrollLeft : M.left),
  1477. y: g.clientY - (S ? M.top - H.top + S.scrollTop : M.top)
  1478. };
  1479. (u == null ? void 0 : u(G, g)) !== !1 && (h.value = G, T(g));
  1480. }, O = (g) => {
  1481. if (I(t.disabled) || !C(g) || !h.value)
  1482. return;
  1483. const A = I(y), S = I(e).getBoundingClientRect();
  1484. let { x: H, y: M } = c.value;
  1485. (s === "x" || s === "both") && (H = g.clientX - h.value.x, A && (H = Math.min(Math.max(0, H), A.scrollWidth - S.width))), (s === "y" || s === "both") && (M = g.clientY - h.value.y, A && (M = Math.min(Math.max(0, M), A.scrollHeight - S.height))), c.value = {
  1486. x: H,
  1487. y: M
  1488. }, $ == null || $(c.value, g), T(g);
  1489. }, z = (g) => {
  1490. I(t.disabled) || !C(g) || h.value && (h.value = void 0, v == null || v(c.value, g), T(g));
  1491. };
  1492. if (vt) {
  1493. const g = { capture: (n = t.capture) != null ? n : !0 };
  1494. Oe(x, "pointerdown", F, g), Oe(r, "pointermove", O, g), Oe(r, "pointerup", z, g);
  1495. }
  1496. return Fe(ve({}, ko(c)), {
  1497. position: c,
  1498. isDragging: Q(() => !!h.value),
  1499. style: Q(
  1500. () => `left:${c.value.x}px;top:${c.value.y}px;`
  1501. )
  1502. });
  1503. }
  1504. const Vo = { class: "modalHeader" }, jo = {
  1505. key: 0,
  1506. class: "tabs-wrap"
  1507. }, Go = {
  1508. key: 1,
  1509. class: "step-wrap",
  1510. ref: "stepRef"
  1511. }, Xo = { class: "modal-body-container" }, Ko = /* @__PURE__ */ Object.assign({ name: "SModal" }, {
  1512. __name: "SModal",
  1513. props: {
  1514. loading: {
  1515. type: Boolean,
  1516. default: !1
  1517. },
  1518. centered: {
  1519. type: Boolean,
  1520. default: !0
  1521. },
  1522. maskClosable: {
  1523. type: Boolean,
  1524. default: !0
  1525. },
  1526. mask: {
  1527. type: Boolean,
  1528. default: !0
  1529. },
  1530. topStyle: {
  1531. type: String,
  1532. default: ""
  1533. },
  1534. closable: {
  1535. type: Boolean,
  1536. default: !0
  1537. },
  1538. destroyOnClose: {
  1539. type: Boolean,
  1540. default: !1
  1541. },
  1542. keyboardOpen: {
  1543. type: Boolean,
  1544. default: !0
  1545. },
  1546. title: {
  1547. type: String,
  1548. default: ""
  1549. },
  1550. value: {
  1551. type: Boolean,
  1552. default: !1
  1553. },
  1554. width: {
  1555. type: [String, Number],
  1556. default: "60vw"
  1557. },
  1558. boxHeight: {
  1559. type: [String, Number],
  1560. default: 60
  1561. },
  1562. bodyStyle: {
  1563. type: Object,
  1564. default() {
  1565. return {
  1566. overflowX: "hidden",
  1567. overflowY: "auto"
  1568. };
  1569. }
  1570. },
  1571. showFullScreen: {
  1572. type: Boolean,
  1573. default: !0
  1574. },
  1575. tabs: {
  1576. type: Array,
  1577. default: () => []
  1578. },
  1579. tabKey: {
  1580. type: Object,
  1581. default: () => ({
  1582. label: "label",
  1583. value: "value"
  1584. })
  1585. },
  1586. steps: {
  1587. type: Array,
  1588. default: () => []
  1589. },
  1590. stepDefaultActive: {
  1591. type: Number,
  1592. default: 0
  1593. },
  1594. stepValid: {
  1595. type: Function,
  1596. default: void 0
  1597. },
  1598. saveBtnText: {
  1599. type: String,
  1600. default: window.$l("保存")
  1601. }
  1602. },
  1603. emits: [
  1604. "update:value",
  1605. "handCancel",
  1606. "afterClose",
  1607. "tabsChange",
  1608. "stepCallback",
  1609. "handSave"
  1610. ],
  1611. setup(e, { emit: t }) {
  1612. const o = e, n = t, l = Ft(), i = B(null), p = B(), { x: m, y: $, isDragging: v } = Wo(i), u = B(0), d = B(0), s = B(!1), r = B(0), y = B(0), x = B(0), w = B(0), c = B({ left: 0, right: 0, top: 0, bottom: 0 }), h = B(null), C = B(null), T = B(o.width), F = B(), O = B(o.value), z = Q(() => o.tabKey && o.tabKey.value || "value"), g = B("");
  1613. j(() => o.tabs, () => {
  1614. const b = o.tabs || [];
  1615. if (!b.length) {
  1616. g.value = "";
  1617. return;
  1618. }
  1619. const V = z.value;
  1620. b.some((K) => K && K[V] === g.value) || (g.value = b[0][V]);
  1621. }, { immediate: !0, deep: !0 });
  1622. const S = B(0), H = Q(() => S.value === o.steps.length - 1), M = Q(() => ({
  1623. transform: `translate(${r.value}px, ${y.value}px)`
  1624. })), G = B(ve({}, o.bodyStyle));
  1625. let X = -1, L = null, R = null;
  1626. const Y = (b) => {
  1627. p.value = b, i.value = F.value ? null : b;
  1628. }, W = () => {
  1629. const b = h.value;
  1630. if (!b) return;
  1631. const V = i.value, K = C.value, Z = b.scrollHeight || b.clientHeight;
  1632. if (!Z) return;
  1633. const xe = (V == null ? void 0 : V.clientHeight) || 0, Se = (K == null ? void 0 : K.clientHeight) || 0, $e = document.body.offsetHeight, te = Z + xe + Se + 85 >= $e ? $e - xe - Se - 82 : Z;
  1634. te <= 0 || te === X || (X = te, G.value = Object.assign({ height: `${te}px` }, o.bodyStyle));
  1635. }, U = () => {
  1636. Je(() => {
  1637. L || (L = requestAnimationFrame(() => {
  1638. L = null, W();
  1639. }));
  1640. });
  1641. }, fe = () => {
  1642. T.value = "100vw", F.value = "s-full-modal", i.value = null, r.value = 0, y.value = 0;
  1643. }, ee = () => {
  1644. T.value = o.width, F.value = "", i.value = p.value;
  1645. }, me = () => {
  1646. n("update:value", !1), n("handCancel");
  1647. }, be = () => {
  1648. F.value = "", i.value = p.value, T.value = o.width, n("afterClose");
  1649. }, he = (b) => {
  1650. g.value = b, n("tabsChange", b);
  1651. };
  1652. function re() {
  1653. S.value--, n("stepCallback", "prev", S.value);
  1654. }
  1655. function Pe() {
  1656. if (!window.$utils.isFunction(o.stepValid)) {
  1657. S.value++, n("stepCallback", "next", S.value);
  1658. return;
  1659. }
  1660. o.stepValid(S.value).then((b) => {
  1661. b && (S.value++, n("stepCallback", "next", S.value));
  1662. });
  1663. }
  1664. function se() {
  1665. n("handSave", "save");
  1666. }
  1667. return tt(() => {
  1668. s.value && (r.value = x.value + Math.min(Math.max(c.value.left, m.value), c.value.right) - u.value, y.value = w.value + Math.min(Math.max(c.value.top, $.value), c.value.bottom) - d.value);
  1669. }), j([m, $], () => {
  1670. var b, V;
  1671. if (!s.value) {
  1672. u.value = m.value, d.value = $.value;
  1673. const K = document.body.getBoundingClientRect(), Z = (V = (b = i.value) == null ? void 0 : b.getBoundingClientRect()) != null ? V : { width: 0, height: 0 };
  1674. c.value.right = K.width - Z.width, c.value.bottom = K.height - Z.height, x.value = r.value, w.value = y.value;
  1675. }
  1676. s.value = !0;
  1677. }), j(v, () => {
  1678. v.value || (s.value = !1);
  1679. }), j(h, (b) => {
  1680. R && (R.disconnect(), R = null), b && typeof ResizeObserver != "undefined" && (R = new ResizeObserver(() => U()), R.observe(b)), U();
  1681. }), j(
  1682. () => o.value,
  1683. (b) => {
  1684. b ? (O.value = !0, U()) : O.value = !1;
  1685. },
  1686. { deep: !0 }
  1687. ), j(
  1688. () => O.value,
  1689. (b) => {
  1690. b && U();
  1691. }
  1692. ), j(
  1693. () => o.value,
  1694. () => {
  1695. o.value && U();
  1696. },
  1697. { immediate: !0 }
  1698. ), et(() => {
  1699. R && (R.disconnect(), R = null), L && (cancelAnimationFrame(L), L = null);
  1700. }), (b, V) => {
  1701. const K = so, Z = ro, xe = uo, Se = co, $e = io, te = we("close-outlined"), ce = Ae, Re = we("save-outlined"), gt = we("arrow-left-outlined"), yt = we("arrow-right-outlined"), Ct = _;
  1702. return E(), ne(Ct, Ot({
  1703. open: O.value,
  1704. "body-style": G.value,
  1705. width: T.value,
  1706. centered: e.centered,
  1707. onCancel: me,
  1708. afterClose: be,
  1709. destroyOnClose: e.destroyOnClose,
  1710. keyboard: e.keyboardOpen,
  1711. style: e.topStyle,
  1712. maskClosable: e.maskClosable,
  1713. mask: e.mask,
  1714. "wrap-class-name": "s-modal " + F.value
  1715. }, Ie(l)), {
  1716. title: k(() => [
  1717. pe("div", Vo, [
  1718. pe("div", {
  1719. ref: Y,
  1720. class: "draggableTitle"
  1721. }, ae(e.title), 513),
  1722. a(Ht, {
  1723. width: T.value,
  1724. showFullScreen: e.showFullScreen,
  1725. onFullScreen: fe,
  1726. onReduction: ee
  1727. }, null, 8, ["width", "showFullScreen"])
  1728. ])
  1729. ]),
  1730. footer: k(() => [
  1731. b.$slots.footer ? (E(), le("div", {
  1732. key: 0,
  1733. ref_key: "footerSlot",
  1734. ref: C
  1735. }, [
  1736. _e(b.$slots, "footer", {}, void 0, !0)
  1737. ], 512)) : q("", !0),
  1738. !b.$slots.footer && (!e.steps || !e.steps.length) ? (E(), le("div", {
  1739. key: 1,
  1740. ref_key: "footerSlot",
  1741. ref: C
  1742. }, [
  1743. a(ce, { onClick: me }, {
  1744. default: k(() => [
  1745. a(te),
  1746. ue(ae(b.$l("关闭")), 1)
  1747. ]),
  1748. _: 1
  1749. }),
  1750. a(ce, {
  1751. style: { "margin-right": "8px" },
  1752. type: "primary",
  1753. onClick: se
  1754. }, {
  1755. default: k(() => [
  1756. a(Re),
  1757. ue(" " + ae(b.$l(e.saveBtnText)), 1)
  1758. ]),
  1759. _: 1
  1760. })
  1761. ], 512)) : q("", !0),
  1762. e.steps && e.steps.length > 0 ? (E(), le("div", {
  1763. key: 2,
  1764. ref_key: "footerSlot",
  1765. ref: C
  1766. }, [
  1767. a(ce, { onClick: me }, {
  1768. default: k(() => [
  1769. a(te),
  1770. ue(ae(b.$l("关闭")), 1)
  1771. ]),
  1772. _: 1
  1773. }),
  1774. e.steps.length ? (E(), ne(ce, {
  1775. key: 0,
  1776. disabled: S.value === e.stepDefaultActive,
  1777. onClick: re
  1778. }, {
  1779. default: k(() => [
  1780. a(gt),
  1781. ue(ae(b.$l("上一步")), 1)
  1782. ]),
  1783. _: 1
  1784. }, 8, ["disabled"])) : q("", !0),
  1785. e.steps.length ? (E(), ne(ce, {
  1786. key: 1,
  1787. type: "primary",
  1788. disabled: S.value === e.steps.length - 1,
  1789. onClick: Pe
  1790. }, {
  1791. default: k(() => [
  1792. a(yt),
  1793. ue(ae(b.$l("下一步")), 1)
  1794. ]),
  1795. _: 1
  1796. }, 8, ["disabled"])) : q("", !0),
  1797. H.value ? (E(), ne(ce, {
  1798. key: 2,
  1799. style: { "margin-right": "8px" },
  1800. type: "primary",
  1801. onClick: se
  1802. }, {
  1803. default: k(() => [
  1804. a(Re),
  1805. ue(" " + ae(b.$l(e.saveBtnText)), 1)
  1806. ]),
  1807. _: 1
  1808. })) : q("", !0)
  1809. ], 512)) : q("", !0)
  1810. ]),
  1811. modalRender: k(({ originVNode: oe }) => [
  1812. pe("div", {
  1813. style: Mt(M.value)
  1814. }, [
  1815. (E(), ne(At(oe)))
  1816. ], 4)
  1817. ]),
  1818. default: k(() => [
  1819. a($e, { spinning: e.loading }, {
  1820. default: k(() => [
  1821. pe("div", {
  1822. ref_key: "bodySlot",
  1823. ref: h
  1824. }, [
  1825. e.tabs && e.tabs.length > 0 ? (E(), le("div", jo, [
  1826. a(Z, {
  1827. "active-key": g.value,
  1828. onChange: he
  1829. }, {
  1830. default: k(() => [
  1831. (E(!0), le(Me, null, ke(e.tabs, (oe) => (E(), ne(K, {
  1832. tab: oe[e.tabKey.label],
  1833. key: oe[z.value]
  1834. }, null, 8, ["tab"]))), 128))
  1835. ]),
  1836. _: 1
  1837. }, 8, ["active-key"])
  1838. ])) : q("", !0),
  1839. e.steps && e.steps.length ? (E(), le("div", Go, [
  1840. a(Se, {
  1841. current: S.value,
  1842. type: "navigation",
  1843. size: "small"
  1844. }, {
  1845. default: k(() => [
  1846. (E(!0), le(Me, null, ke(e.steps, (oe) => (E(), ne(xe, {
  1847. title: oe,
  1848. key: oe,
  1849. disabled: !0
  1850. }, null, 8, ["title"]))), 128))
  1851. ]),
  1852. _: 1
  1853. }, 8, ["current"])
  1854. ], 512)) : q("", !0),
  1855. pe("div", Xo, [
  1856. _e(b.$slots, "default", {}, void 0, !0)
  1857. ])
  1858. ], 512)
  1859. ]),
  1860. _: 3
  1861. }, 8, ["spinning"])
  1862. ]),
  1863. _: 3
  1864. }, 16, ["open", "body-style", "width", "centered", "destroyOnClose", "keyboard", "style", "maskClosable", "mask", "wrap-class-name"]);
  1865. };
  1866. }
  1867. }), tn = /* @__PURE__ */ ao(Ko, [["__scopeId", "data-v-5b9cbe76"]]);
  1868. export {
  1869. tn as default
  1870. };