SModal.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860
  1. var gt = Object.defineProperty, yt = Object.defineProperties;
  2. var Ct = Object.getOwnPropertyDescriptors;
  3. var Ne = Object.getOwnPropertySymbols;
  4. var bt = Object.prototype.hasOwnProperty, ht = Object.prototype.propertyIsEnumerable;
  5. var ze = (e, t, o) => t in e ? gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, me = (e, t) => {
  6. for (var o in t || (t = {}))
  7. bt.call(t, o) && ze(e, o, t[o]);
  8. if (Ne)
  9. for (var o of Ne(t))
  10. ht.call(t, o) && ze(e, o, t[o]);
  11. return e;
  12. }, Te = (e, t) => yt(e, Ct(t));
  13. import { defineComponent as q, ref as B, computed as Z, createVNode as a, Transition as Ke, withDirectives as Ye, vShow as Ue, nextTick as Qe, shallowRef as D, watch as j, onBeforeUnmount as Ze, watchEffect as qe, Fragment as Pe, render as Re, unref as Me, isRef as Je, toRefs as xt, customRef as St, getCurrentScope as $t, onScopeDispose as wt, useAttrs as Tt, resolveComponent as xe, openBlock as E, createBlock as ne, mergeProps as Bt, withCtx as L, createElementVNode as ve, createElementBlock as le, renderList as Ee, createCommentVNode as Q, renderSlot as De, normalizeStyle as Pt, resolveDynamicComponent as Ft, createTextVNode as ce, toDisplayString as ae } from "vue";
  14. import Ot from "./ModalHeader.js";
  15. import { cQ as Mt, aI as et, P as R, _ as P, az as tt, d as f, au as At, c as ge, o as ot, i as $e, cR as Ht, K as Le, cS as It, bZ as Nt, g as zt, m as Rt, bM as Et, r as Dt, cO as Lt, aH as kt, aL as Ae, u as Wt, bA as nt, a3 as Se, c1 as _t, B as Fe, cT as Vt, e as pe, cU as jt, a as Gt, bs as Xt, br as Kt, bt as Yt, cV as Ut, cW as Qt, cX as Zt, cP as qt, cY as Jt, cZ as eo, aM as to, n as oo, ao as no } from "./index2.js";
  16. import { A as ke } from "./ActionButton.js";
  17. import { T as lo, _ as ao } from "./index11.js";
  18. import { _ as io, S as ro } from "./index10.js";
  19. const so = new et("antFadeIn", {
  20. "0%": {
  21. opacity: 0
  22. },
  23. "100%": {
  24. opacity: 1
  25. }
  26. }), co = new et("antFadeOut", {
  27. "0%": {
  28. opacity: 1
  29. },
  30. "100%": {
  31. opacity: 0
  32. }
  33. }), uo = 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 [Mt(n, so, co, 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 He() {
  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: R.shape({
  79. x: Number,
  80. y: Number
  81. }).loose,
  82. title: R.any,
  83. footer: R.any,
  84. transitionName: String,
  85. maskTransitionName: String,
  86. animation: R.any,
  87. maskAnimation: R.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: R.any,
  107. maskProps: R.any,
  108. wrapProps: R.any,
  109. getContainer: R.any,
  110. dialogStyle: {
  111. type: Object,
  112. default: void 0
  113. },
  114. dialogClass: String,
  115. closeIcon: R.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 We(e, t, o) {
  132. let n = t;
  133. return !n && o && (n = `${e}-${o}`), n;
  134. }
  135. let _e = -1;
  136. function fo() {
  137. return _e += 1, _e;
  138. }
  139. function Ve(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 mo(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 += Ve(l), o.top += Ve(l, !0), o;
  154. }
  155. const vo = {
  156. width: 0,
  157. height: 0,
  158. overflow: "hidden",
  159. outline: "none"
  160. }, po = {
  161. outline: "none"
  162. }, go = q({
  163. compatConfig: {
  164. MODE: 3
  165. },
  166. name: "DialogContent",
  167. inheritAttrs: !1,
  168. props: f(f({}, He()), {
  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 S = B(), v = Z(() => {
  201. const {
  202. width: s,
  203. height: r
  204. } = e, g = {};
  205. 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;
  206. }), d = () => {
  207. Qe(() => {
  208. if (m.value) {
  209. const s = mo(m.value);
  210. S.value = e.mousePosition ? `${e.mousePosition.x - s.left}px ${e.mousePosition.y - s.top}px` : "";
  211. }
  212. });
  213. }, u = (s) => {
  214. e.onVisibleChanged(s);
  215. };
  216. return () => {
  217. var s, r, g, x;
  218. const {
  219. prefixCls: $,
  220. footer: c = (s = n.footer) === null || s === void 0 ? void 0 : s.call(n),
  221. title: C = (r = n.title) === null || r === void 0 ? void 0 : r.call(n),
  222. ariaId: y,
  223. closable: w,
  224. closeIcon: O = (g = n.closeIcon) === null || g === void 0 ? void 0 : g.call(n),
  225. onClose: A,
  226. bodyStyle: T,
  227. bodyProps: b,
  228. onMousedown: H,
  229. onMouseup: M,
  230. visible: I,
  231. modalRender: F = n.modalRender,
  232. destroyOnClose: N,
  233. motionName: G
  234. } = e;
  235. let U;
  236. c && (U = a("div", {
  237. class: `${$}-footer`
  238. }, [c]));
  239. let W;
  240. C && (W = a("div", {
  241. class: `${$}-header`
  242. }, [a("div", {
  243. class: `${$}-title`,
  244. id: y
  245. }, [C])]));
  246. let K;
  247. w && (K = a("button", {
  248. type: "button",
  249. onClick: A,
  250. "aria-label": "Close",
  251. class: `${$}-close`
  252. }, [O || a("span", {
  253. class: `${$}-close-x`
  254. }, null)]));
  255. const _ = a("div", {
  256. class: `${$}-content`
  257. }, [K, W, a("div", P({
  258. class: `${$}-body`,
  259. style: T
  260. }, b), [(x = n.default) === null || x === void 0 ? void 0 : x.call(n)]), U]), J = tt(G);
  261. return a(Ke, P(P({}, J), {}, {
  262. onBeforeEnter: d,
  263. onAfterEnter: () => u(!0),
  264. onAfterLeave: () => u(!1)
  265. }), {
  266. default: () => [I || !N ? Ye(a("div", P(P({}, l), {}, {
  267. ref: m,
  268. key: "dialog-element",
  269. role: "document",
  270. style: [v.value, l.style],
  271. class: [$, l.class],
  272. onMousedown: H,
  273. onMouseup: M
  274. }), [a("div", {
  275. tabindex: 0,
  276. ref: i,
  277. style: po
  278. }, [F ? F({
  279. originVNode: _
  280. }) : _]), a("div", {
  281. tabindex: 0,
  282. ref: p,
  283. style: vo
  284. }, null)]), [[Ue, I]]) : null]
  285. });
  286. };
  287. }
  288. }), yo = q({
  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 = tt(i);
  307. return a(Ke, p, {
  308. default: () => [Ye(a("div", P({
  309. class: `${o}-mask`
  310. }, l), null), [[Ue, n]])]
  311. });
  312. };
  313. }
  314. }), je = q({
  315. compatConfig: {
  316. MODE: 3
  317. },
  318. name: "VcDialog",
  319. inheritAttrs: !1,
  320. props: $e(f(f({}, He()), {
  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), S = D(`vcDialogTitle${fo()}`), v = (c) => {
  340. var C, y;
  341. if (c)
  342. Ht(i.value, document.activeElement) || (l.value = document.activeElement, (C = p.value) === null || C === void 0 || C.focus());
  343. else {
  344. const w = 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 (O) {
  351. }
  352. l.value = null;
  353. }
  354. w && ((y = e.afterClose) === null || y === void 0 || y.call(e));
  355. }
  356. }, d = (c) => {
  357. var C;
  358. (C = e.onClose) === null || C === void 0 || C.call(e, c);
  359. }, u = D(!1), s = D(), r = () => {
  360. clearTimeout(s.value), u.value = !0;
  361. }, g = () => {
  362. s.value = setTimeout(() => {
  363. u.value = !1;
  364. });
  365. }, x = (c) => {
  366. if (!e.maskClosable) return null;
  367. u.value ? u.value = !1 : i.value === c.target && d(c);
  368. }, $ = (c) => {
  369. if (e.keyboard && c.keyCode === Le.ESC) {
  370. c.stopPropagation(), d(c);
  371. return;
  372. }
  373. e.visible && c.keyCode === Le.TAB && p.value.changeActive(!c.shiftKey);
  374. };
  375. return j(() => e.visible, () => {
  376. e.visible && (m.value = !0);
  377. }, {
  378. flush: "post"
  379. }), Ze(() => {
  380. var c;
  381. clearTimeout(s.value), (c = e.scrollLocker) === null || c === void 0 || c.unLock();
  382. }), qe(() => {
  383. var c, C;
  384. (c = e.scrollLocker) === null || c === void 0 || c.unLock(), m.value && ((C = e.scrollLocker) === null || C === void 0 || C.lock());
  385. }), () => {
  386. const {
  387. prefixCls: c,
  388. mask: C,
  389. visible: y,
  390. maskTransitionName: w,
  391. maskAnimation: O,
  392. zIndex: A,
  393. wrapClassName: T,
  394. rootClassName: b,
  395. wrapStyle: H,
  396. closable: M,
  397. maskProps: I,
  398. maskStyle: F,
  399. transitionName: N,
  400. animation: G,
  401. wrapProps: U,
  402. title: W = n.title
  403. } = e, {
  404. style: K,
  405. class: _
  406. } = o;
  407. return a("div", P({
  408. class: [`${c}-root`, b]
  409. }, At(e, {
  410. data: !0
  411. })), [a(yo, {
  412. prefixCls: c,
  413. visible: C && y,
  414. motionName: We(c, w, O),
  415. style: f({
  416. zIndex: A
  417. }, F),
  418. maskProps: I
  419. }, null), a("div", P({
  420. tabIndex: -1,
  421. onKeydown: $,
  422. class: ge(`${c}-wrap`, T),
  423. ref: i,
  424. onClick: x,
  425. role: "dialog",
  426. "aria-labelledby": W ? S.value : null,
  427. style: f(f({
  428. zIndex: A
  429. }, H), {
  430. display: m.value ? null : "none"
  431. })
  432. }, U), [a(go, P(P({}, ot(e, ["scrollLocker"])), {}, {
  433. style: K,
  434. class: _,
  435. onMousedown: r,
  436. onMouseup: g,
  437. ref: p,
  438. closable: M,
  439. ariaId: S.value,
  440. prefixCls: c,
  441. visible: y,
  442. onClose: d,
  443. onVisibleChanged: v,
  444. motionName: We(c, N, G)
  445. }), n)])]);
  446. };
  447. }
  448. }), Co = He(), bo = q({
  449. compatConfig: {
  450. MODE: 3
  451. },
  452. name: "DialogWrap",
  453. inheritAttrs: !1,
  454. props: $e(Co, {
  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 It({}, {
  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: S = !1,
  475. afterClose: v
  476. } = e;
  477. let d = f(f(f({}, e), o), {
  478. ref: "_component",
  479. key: "dialog"
  480. });
  481. return p === !1 ? a(je, P(P({}, d), {}, {
  482. getOpenCount: () => 2
  483. }), n) : !m && S && !l.value ? null : a(Nt, {
  484. autoLock: !0,
  485. visible: i,
  486. forceRender: m,
  487. getContainer: p
  488. }, {
  489. default: (u) => (d = f(f(f({}, d), u), {
  490. afterClose: () => {
  491. v == null || v(), l.value = !1;
  492. }
  493. }), a(je, d, n))
  494. });
  495. };
  496. }
  497. });
  498. function Ge(e) {
  499. return {
  500. position: e,
  501. top: 0,
  502. insetInlineEnd: 0,
  503. bottom: 0,
  504. insetInlineStart: 0
  505. };
  506. }
  507. const ho = (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({}, Ge("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({}, Ge("fixed")), {
  533. overflow: "auto",
  534. outline: 0,
  535. WebkitOverflowScrolling: "touch"
  536. })
  537. }
  538. }, {
  539. [`${t}-root`]: uo(e)
  540. }];
  541. }, xo = (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({}, Dt(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. }, Lt(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. }, So = (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({}, kt()),
  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. }, $o = (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. }, wo = (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. }, To = zt("Modal", (e) => {
  834. const t = e.padding, o = e.fontSizeHeading5, n = e.lineHeightHeading5, l = Rt(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 [xo(l), So(l), $o(l), ho(l), e.wireframe && wo(l), Et(l, "zoom")];
  859. });
  860. var Bo = 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 Oe;
  868. const Po = (e) => {
  869. Oe = {
  870. x: e.pageX,
  871. y: e.pageY
  872. }, setTimeout(() => Oe = null, 100);
  873. };
  874. jt() && Gt(document.documentElement, "click", Po, !0);
  875. const Fo = () => ({
  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: R.any,
  891. closable: {
  892. type: Boolean,
  893. default: void 0
  894. },
  895. closeIcon: R.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: R.any,
  908. okText: R.any,
  909. okType: String,
  910. cancelText: R.any,
  911. icon: R.any,
  912. maskClosable: {
  913. type: Boolean,
  914. default: void 0
  915. },
  916. forceRender: {
  917. type: Boolean,
  918. default: void 0
  919. },
  920. okButtonProps: pe(),
  921. cancelButtonProps: pe(),
  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: pe(),
  935. maskStyle: pe(),
  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: pe()
  951. }), k = q({
  952. compatConfig: {
  953. MODE: 3
  954. },
  955. name: "AModal",
  956. inheritAttrs: !1,
  957. props: $e(Fo(), {
  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] = Ae("Modal"), {
  969. prefixCls: p,
  970. rootPrefixCls: m,
  971. direction: S,
  972. getPopupContainer: v
  973. } = Wt("modal", e), [d, u] = To(p);
  974. nt(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. }, g = () => {
  980. var x, $;
  981. const {
  982. okText: c = (x = n.okText) === null || x === void 0 ? void 0 : x.call(n),
  983. okType: C,
  984. cancelText: y = ($ = n.cancelText) === null || $ === void 0 ? void 0 : $.call(n),
  985. confirmLoading: w
  986. } = e;
  987. return a(Pe, null, [a(Fe, P({
  988. onClick: s
  989. }, e.cancelButtonProps), {
  990. default: () => [y || i.value.cancelText]
  991. }), a(Fe, P(P({}, Vt(C)), {}, {
  992. loading: w,
  993. onClick: r
  994. }, e.okButtonProps), {
  995. default: () => [c || i.value.okText]
  996. })]);
  997. };
  998. return () => {
  999. var x, $;
  1000. const {
  1001. prefixCls: c,
  1002. visible: C,
  1003. open: y,
  1004. wrapClassName: w,
  1005. centered: O,
  1006. getContainer: A,
  1007. closeIcon: T = (x = n.closeIcon) === null || x === void 0 ? void 0 : x.call(n),
  1008. focusTriggerAfterClose: b = !0
  1009. } = e, H = Bo(e, ["prefixCls", "visible", "open", "wrapClassName", "centered", "getContainer", "closeIcon", "focusTriggerAfterClose"]), M = ge(w, {
  1010. [`${p.value}-centered`]: !!O,
  1011. [`${p.value}-wrap-rtl`]: S.value === "rtl"
  1012. });
  1013. return d(a(bo, P(P(P({}, H), l), {}, {
  1014. rootClassName: u.value,
  1015. class: ge(u.value, l.class),
  1016. getContainer: A || (v == null ? void 0 : v.value),
  1017. prefixCls: p.value,
  1018. wrapClassName: M,
  1019. visible: y != null ? y : C,
  1020. onClose: s,
  1021. focusTriggerAfterClose: b,
  1022. transitionName: Se(m.value, "zoom", e.transitionName),
  1023. maskTransitionName: Se(m.value, "fade", e.maskTransitionName),
  1024. mousePosition: ($ = H.mousePosition) !== null && $ !== void 0 ? $ : Oe
  1025. }), f(f({}, n), {
  1026. footer: n.footer || g,
  1027. closeIcon: () => a("span", {
  1028. class: `${p.value}-close-x`
  1029. }, [T || a(_t, {
  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 lt = q({
  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] = Ae("Modal");
  1048. return process.env.NODE_ENV !== "production" && nt(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: S,
  1055. closable: v = !1,
  1056. zIndex: d,
  1057. afterClose: u,
  1058. keyboard: s,
  1059. centered: r,
  1060. getContainer: g,
  1061. maskStyle: x,
  1062. okButtonProps: $,
  1063. cancelButtonProps: c,
  1064. okCancel: C,
  1065. width: y = 416,
  1066. mask: w = !0,
  1067. maskClosable: O = !1,
  1068. type: A,
  1069. open: T,
  1070. title: b,
  1071. content: H,
  1072. direction: M,
  1073. closeIcon: I,
  1074. modalRender: F,
  1075. focusTriggerAfterClose: N,
  1076. rootPrefixCls: G,
  1077. bodyStyle: U,
  1078. wrapClassName: W,
  1079. footer: K
  1080. } = e;
  1081. let _ = l;
  1082. if (!l && l !== null)
  1083. switch (A) {
  1084. case "info":
  1085. _ = a(Ut, null, null);
  1086. break;
  1087. case "success":
  1088. _ = a(Yt, null, null);
  1089. break;
  1090. case "error":
  1091. _ = a(Kt, null, null);
  1092. break;
  1093. default:
  1094. _ = a(Xt, null, null);
  1095. }
  1096. const J = e.okType || "primary", ue = e.prefixCls || "ant-modal", ee = `${ue}-confirm`, we = o.style || {}, Ce = C != null ? C : A === "confirm", fe = e.autoFocusButton === null ? !1 : e.autoFocusButton || "ok", h = `${ue}-confirm`, Y = ge(h, `${h}-${e.type}`, {
  1097. [`${h}-rtl`]: M === "rtl"
  1098. }, o.class), V = n.value, X = Ce && a(ke, {
  1099. actionFn: i,
  1100. close: m,
  1101. autofocus: fe === "cancel",
  1102. buttonProps: c,
  1103. prefixCls: `${G}-btn`
  1104. }, {
  1105. default: () => [de(e.cancelText) || V.cancelText]
  1106. });
  1107. return a(k, {
  1108. prefixCls: ue,
  1109. class: Y,
  1110. wrapClassName: ge({
  1111. [`${h}-centered`]: !!r
  1112. }, W),
  1113. onCancel: (re) => m == null ? void 0 : m({
  1114. triggerCancel: !0
  1115. }, re),
  1116. open: T,
  1117. title: "",
  1118. footer: "",
  1119. transitionName: Se(G, "zoom", e.transitionName),
  1120. maskTransitionName: Se(G, "fade", e.maskTransitionName),
  1121. mask: w,
  1122. maskClosable: O,
  1123. maskStyle: x,
  1124. style: we,
  1125. bodyStyle: U,
  1126. width: y,
  1127. zIndex: d,
  1128. afterClose: u,
  1129. keyboard: s,
  1130. centered: r,
  1131. getContainer: g,
  1132. closable: v,
  1133. closeIcon: I,
  1134. modalRender: F,
  1135. focusTriggerAfterClose: N
  1136. }, {
  1137. default: () => [a("div", {
  1138. class: `${ee}-body-wrapper`
  1139. }, [a("div", {
  1140. class: `${ee}-body`
  1141. }, [de(_), b === void 0 ? null : a("span", {
  1142. class: `${ee}-title`
  1143. }, [de(b)]), a("div", {
  1144. class: `${ee}-content`
  1145. }, [de(H)])]), K !== void 0 ? de(K) : a("div", {
  1146. class: `${ee}-btns`
  1147. }, [X, a(ke, {
  1148. type: J,
  1149. actionFn: p,
  1150. close: m,
  1151. autofocus: fe === "ok",
  1152. buttonProps: $,
  1153. prefixCls: `${G}-btn`
  1154. }, {
  1155. default: () => [de(S) || (Ce ? V.okText : V.justOkText)]
  1156. })])])]
  1157. });
  1158. };
  1159. }
  1160. }), ie = [], ye = (e) => {
  1161. const t = document.createDocumentFragment();
  1162. let o = f(f({}, ot(e, ["parentContext", "appContext"])), {
  1163. close: i,
  1164. open: !0
  1165. }), n = null;
  1166. function l() {
  1167. n && (Re(null, t), n = null);
  1168. for (var v = arguments.length, d = new Array(v), u = 0; u < v; u++)
  1169. d[u] = arguments[u];
  1170. const s = d.some((r) => r && r.triggerCancel);
  1171. e.onCancel && s && e.onCancel(() => {
  1172. }, ...d.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, d = new Array(v), u = 0; u < v; u++)
  1181. d[u] = arguments[u];
  1182. o = f(f({}, o), {
  1183. open: !1,
  1184. afterClose: () => {
  1185. typeof e.afterClose == "function" && e.afterClose(), l.apply(this, d);
  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 && Qt(n, o, t);
  1191. }
  1192. const m = (v) => {
  1193. const d = Zt, u = d.prefixCls, s = v.prefixCls || `${u}-modal`, r = d.iconPrefixCls, g = Jt();
  1194. return a(qt, P(P({}, d), {}, {
  1195. prefixCls: u
  1196. }), {
  1197. default: () => [a(lt, P(P({}, v), {}, {
  1198. rootPrefixCls: u,
  1199. prefixCls: s,
  1200. iconPrefixCls: r,
  1201. locale: g,
  1202. cancelText: v.cancelText || g.cancelText
  1203. }), null)]
  1204. });
  1205. };
  1206. function S(v) {
  1207. const d = a(m, f({}, v));
  1208. return d.appContext = e.parentContext || e.appContext || d.appContext, Re(d, t), d;
  1209. }
  1210. return n = S(o), ie.push(i), {
  1211. destroy: i,
  1212. update: p
  1213. };
  1214. };
  1215. function at(e) {
  1216. return f(f({}, e), {
  1217. type: "warning"
  1218. });
  1219. }
  1220. function it(e) {
  1221. return f(f({}, e), {
  1222. type: "info"
  1223. });
  1224. }
  1225. function rt(e) {
  1226. return f(f({}, e), {
  1227. type: "success"
  1228. });
  1229. }
  1230. function st(e) {
  1231. return f(f({}, e), {
  1232. type: "error"
  1233. });
  1234. }
  1235. function ct(e) {
  1236. return f(f({}, e), {
  1237. type: "confirm"
  1238. });
  1239. }
  1240. const Oo = () => ({
  1241. config: Object,
  1242. afterClose: Function,
  1243. destroyAction: Function,
  1244. open: Boolean
  1245. }), Mo = q({
  1246. name: "HookModal",
  1247. inheritAttrs: !1,
  1248. props: $e(Oo(), {
  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 = Z(() => e.open), i = Z(() => e.config), {
  1260. direction: p,
  1261. getPrefixCls: m
  1262. } = eo(), S = m("modal"), v = m(), d = () => {
  1263. var g, x;
  1264. e == null || e.afterClose(), (x = (g = i.value).afterClose) === null || x === void 0 || x.call(g);
  1265. }, u = function() {
  1266. e.destroyAction(...arguments);
  1267. };
  1268. o({
  1269. destroy: u
  1270. });
  1271. const s = (n = i.value.okCancel) !== null && n !== void 0 ? n : i.value.type === "confirm", [r] = Ae("Modal", to.Modal);
  1272. return () => a(lt, P(P({
  1273. prefixCls: S,
  1274. rootPrefixCls: v
  1275. }, i.value), {}, {
  1276. close: u,
  1277. open: l.value,
  1278. afterClose: d,
  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 Xe = 0;
  1286. const Ao = q({
  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 Ho() {
  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 S;
  1312. Xe += 1;
  1313. const v = D(!0), d = D(null), u = D(Me(m)), s = D({});
  1314. j(() => m, (y) => {
  1315. $(f(f({}, Je(y) ? y.value : y), s.value));
  1316. });
  1317. const r = function() {
  1318. v.value = !1;
  1319. for (var y = arguments.length, w = new Array(y), O = 0; O < y; O++)
  1320. w[O] = arguments[O];
  1321. const A = w.some((T) => T && T.triggerCancel);
  1322. u.value.onCancel && A && u.value.onCancel(() => {
  1323. }, ...w.slice(1));
  1324. };
  1325. let g;
  1326. const x = () => a(Mo, {
  1327. key: `modal-${Xe}`,
  1328. config: i(u.value),
  1329. ref: d,
  1330. open: v.value,
  1331. destroyAction: r,
  1332. afterClose: () => {
  1333. g == null || g();
  1334. }
  1335. }, null);
  1336. g = (S = e.value) === null || S === void 0 ? void 0 : S.addModal(x), g && ie.push(g);
  1337. const $ = (y) => {
  1338. u.value = f(f({}, u.value), y);
  1339. };
  1340. return {
  1341. destroy: () => {
  1342. d.value ? r() : t.value = [...t.value, r];
  1343. },
  1344. update: (y) => {
  1345. s.value = y, d.value ? $(y) : t.value = [...t.value, () => $(y)];
  1346. }
  1347. };
  1348. }, n = Z(() => ({
  1349. info: o(it),
  1350. success: o(rt),
  1351. error: o(st),
  1352. warning: o(at),
  1353. confirm: o(ct)
  1354. })), l = Symbol("modalHolderKey");
  1355. return [n.value, () => a(Ao, {
  1356. key: l,
  1357. ref: e
  1358. }, null)];
  1359. }
  1360. function dt(e) {
  1361. return ye(at(e));
  1362. }
  1363. k.useModal = Ho;
  1364. k.info = function(t) {
  1365. return ye(it(t));
  1366. };
  1367. k.success = function(t) {
  1368. return ye(rt(t));
  1369. };
  1370. k.error = function(t) {
  1371. return ye(st(t));
  1372. };
  1373. k.warning = dt;
  1374. k.warn = dt;
  1375. k.confirm = function(t) {
  1376. return ye(ct(t));
  1377. };
  1378. k.destroyAll = function() {
  1379. for (; ie.length; ) {
  1380. const t = ie.pop();
  1381. t && t();
  1382. }
  1383. };
  1384. k.install = function(e) {
  1385. return e.component(k.name, k), e;
  1386. };
  1387. function Io(e) {
  1388. return $t() ? (wt(e), !0) : !1;
  1389. }
  1390. function z(e) {
  1391. return typeof e == "function" ? e() : Me(e);
  1392. }
  1393. const ut = typeof window != "undefined" && typeof document != "undefined";
  1394. typeof WorkerGlobalScope != "undefined" && globalThis instanceof WorkerGlobalScope;
  1395. const No = Object.prototype.toString, zo = (e) => No.call(e) === "[object Object]", Ro = () => {
  1396. };
  1397. function Eo(e, t = {}) {
  1398. if (!Je(e))
  1399. return xt(e);
  1400. const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
  1401. for (const n in e.value)
  1402. o[n] = St(() => ({
  1403. get() {
  1404. return e.value[n];
  1405. },
  1406. set(l) {
  1407. var i;
  1408. if ((i = z(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 = Te(me({}, 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 ft = ut ? window : void 0;
  1423. function Do(e) {
  1424. var t;
  1425. const o = z(e);
  1426. return (t = o == null ? void 0 : o.$el) != null ? t : o;
  1427. }
  1428. function Be(...e) {
  1429. let t, o, n, l;
  1430. if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([o, n, l] = e, t = ft) : [t, o, n, l] = e, !t)
  1431. return Ro;
  1432. Array.isArray(o) || (o = [o]), Array.isArray(n) || (n = [n]);
  1433. const i = [], p = () => {
  1434. i.forEach((d) => d()), i.length = 0;
  1435. }, m = (d, u, s, r) => (d.addEventListener(u, s, r), () => d.removeEventListener(u, s, r)), S = j(
  1436. () => [Do(t), z(l)],
  1437. ([d, u]) => {
  1438. if (p(), !d)
  1439. return;
  1440. const s = zo(u) ? me({}, u) : u;
  1441. i.push(
  1442. ...o.flatMap((r) => n.map((g) => m(d, r, g, s)))
  1443. );
  1444. },
  1445. { immediate: !0, flush: "post" }
  1446. ), v = () => {
  1447. S(), p();
  1448. };
  1449. return Io(v), v;
  1450. }
  1451. function Lo(e, t = {}) {
  1452. var o, n;
  1453. const {
  1454. pointerTypes: l,
  1455. preventDefault: i,
  1456. stopPropagation: p,
  1457. exact: m,
  1458. onMove: S,
  1459. onEnd: v,
  1460. onStart: d,
  1461. initialValue: u,
  1462. axis: s = "both",
  1463. draggingElement: r = ft,
  1464. containerElement: g,
  1465. handle: x = e,
  1466. buttons: $ = [0]
  1467. } = t, c = B(
  1468. (o = z(u)) != null ? o : { x: 0, y: 0 }
  1469. ), C = B(), y = (b) => l ? l.includes(b.pointerType) : !0, w = (b) => {
  1470. z(i) && b.preventDefault(), z(p) && b.stopPropagation();
  1471. }, O = (b) => {
  1472. var H;
  1473. if (!z($).includes(b.button) || z(t.disabled) || !y(b) || z(m) && b.target !== z(e))
  1474. return;
  1475. const M = z(g), I = (H = M == null ? void 0 : M.getBoundingClientRect) == null ? void 0 : H.call(M), F = z(e).getBoundingClientRect(), N = {
  1476. x: b.clientX - (M ? F.left - I.left + M.scrollLeft : F.left),
  1477. y: b.clientY - (M ? F.top - I.top + M.scrollTop : F.top)
  1478. };
  1479. (d == null ? void 0 : d(N, b)) !== !1 && (C.value = N, w(b));
  1480. }, A = (b) => {
  1481. if (z(t.disabled) || !y(b) || !C.value)
  1482. return;
  1483. const H = z(g), M = z(e).getBoundingClientRect();
  1484. let { x: I, y: F } = c.value;
  1485. (s === "x" || s === "both") && (I = b.clientX - C.value.x, H && (I = Math.min(Math.max(0, I), H.scrollWidth - M.width))), (s === "y" || s === "both") && (F = b.clientY - C.value.y, H && (F = Math.min(Math.max(0, F), H.scrollHeight - M.height))), c.value = {
  1486. x: I,
  1487. y: F
  1488. }, S == null || S(c.value, b), w(b);
  1489. }, T = (b) => {
  1490. z(t.disabled) || !y(b) || C.value && (C.value = void 0, v == null || v(c.value, b), w(b));
  1491. };
  1492. if (ut) {
  1493. const b = { capture: (n = t.capture) != null ? n : !0 };
  1494. Be(x, "pointerdown", O, b), Be(r, "pointermove", A, b), Be(r, "pointerup", T, b);
  1495. }
  1496. return Te(me({}, Eo(c)), {
  1497. position: c,
  1498. isDragging: Z(() => !!C.value),
  1499. style: Z(
  1500. () => `left:${c.value.x}px;top:${c.value.y}px;`
  1501. )
  1502. });
  1503. }
  1504. const ko = { class: "modalHeader" }, Wo = {
  1505. key: 0,
  1506. class: "tabs-wrap"
  1507. }, _o = {
  1508. key: 1,
  1509. class: "step-wrap",
  1510. ref: "stepRef"
  1511. }, Vo = { class: "modal-body-container" }, jo = /* @__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 = Tt(), i = B(null), p = B(), { x: m, y: S, isDragging: v } = Lo(i), d = B(0), u = B(0), s = B(!1), r = B(0), g = B(0), x = B(0), $ = B(0), c = B({ left: 0, right: 0, top: 0, bottom: 0 }), C = B(null), y = B(null), w = B(o.width), O = B(), A = B(o.value), T = B(0), b = Z(() => T.value === o.steps.length - 1), H = Z(() => ({
  1613. transform: `translate(${r.value}px, ${g.value}px)`
  1614. })), M = B(me({}, o.bodyStyle));
  1615. let I = -1, F = null, N = null;
  1616. const G = (h) => {
  1617. p.value = h, i.value = O.value ? null : h;
  1618. }, U = () => {
  1619. const h = C.value;
  1620. if (!h) return;
  1621. const Y = i.value, V = y.value, X = h.scrollHeight || h.clientHeight;
  1622. if (!X) return;
  1623. const re = (Y == null ? void 0 : Y.clientHeight) || 0, be = (V == null ? void 0 : V.clientHeight) || 0, he = document.body.offsetHeight, te = X + re + be + 85 >= he ? he - re - be - 82 : X;
  1624. te <= 0 || te === I || (I = te, M.value = Object.assign({ height: `${te}px` }, o.bodyStyle));
  1625. }, W = () => {
  1626. Qe(() => {
  1627. F || (F = requestAnimationFrame(() => {
  1628. F = null, U();
  1629. }));
  1630. });
  1631. }, K = () => {
  1632. w.value = "100vw", O.value = "s-full-modal", i.value = null, r.value = 0, g.value = 0;
  1633. }, _ = () => {
  1634. w.value = o.width, O.value = "", i.value = p.value;
  1635. }, J = () => {
  1636. n("update:value", !1), n("handCancel");
  1637. }, ue = () => {
  1638. O.value = "", i.value = p.value, w.value = o.width, n("afterClose");
  1639. }, ee = (h) => {
  1640. n("tabsChange", h);
  1641. };
  1642. function we() {
  1643. T.value--, n("stepCallback", "prev", T.value);
  1644. }
  1645. function Ce() {
  1646. if (!window.$utils.isFunction(o.stepValid)) {
  1647. T.value++, n("stepCallback", "next", T.value);
  1648. return;
  1649. }
  1650. o.stepValid(T.value).then((h) => {
  1651. h && (T.value++, n("stepCallback", "next", T.value));
  1652. });
  1653. }
  1654. function fe() {
  1655. n("handSave", "save");
  1656. }
  1657. return qe(() => {
  1658. 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);
  1659. }), j([m, S], () => {
  1660. var h, Y;
  1661. if (!s.value) {
  1662. d.value = m.value, u.value = S.value;
  1663. const V = document.body.getBoundingClientRect(), X = (Y = (h = i.value) == null ? void 0 : h.getBoundingClientRect()) != null ? Y : { width: 0, height: 0 };
  1664. c.value.right = V.width - X.width, c.value.bottom = V.height - X.height, x.value = r.value, $.value = g.value;
  1665. }
  1666. s.value = !0;
  1667. }), j(v, () => {
  1668. v.value || (s.value = !1);
  1669. }), j(C, (h) => {
  1670. N && (N.disconnect(), N = null), h && typeof ResizeObserver != "undefined" && (N = new ResizeObserver(() => W()), N.observe(h)), W();
  1671. }), j(
  1672. () => o.value,
  1673. (h) => {
  1674. h ? (A.value = !0, W()) : A.value = !1;
  1675. },
  1676. { deep: !0 }
  1677. ), j(
  1678. () => A.value,
  1679. (h) => {
  1680. h && W();
  1681. }
  1682. ), j(
  1683. () => o.value,
  1684. () => {
  1685. o.value && W();
  1686. },
  1687. { immediate: !0 }
  1688. ), Ze(() => {
  1689. N && (N.disconnect(), N = null), F && (cancelAnimationFrame(F), F = null);
  1690. }), (h, Y) => {
  1691. const V = ao, X = lo, re = ro, be = io, he = no, te = xe("close-outlined"), se = Fe, Ie = xe("save-outlined"), mt = xe("arrow-left-outlined"), vt = xe("arrow-right-outlined"), pt = k;
  1692. return E(), ne(pt, Bt({
  1693. open: A.value,
  1694. "body-style": M.value,
  1695. width: w.value,
  1696. centered: e.centered,
  1697. onCancel: J,
  1698. afterClose: ue,
  1699. destroyOnClose: e.destroyOnClose,
  1700. keyboard: e.keyboardOpen,
  1701. style: e.topStyle,
  1702. maskClosable: e.maskClosable,
  1703. mask: e.mask,
  1704. "wrap-class-name": "s-modal " + O.value
  1705. }, Me(l)), {
  1706. title: L(() => [
  1707. ve("div", ko, [
  1708. ve("div", {
  1709. ref: G,
  1710. class: "draggableTitle"
  1711. }, ae(e.title), 513),
  1712. a(Ot, {
  1713. width: w.value,
  1714. showFullScreen: e.showFullScreen,
  1715. onFullScreen: K,
  1716. onReduction: _
  1717. }, null, 8, ["width", "showFullScreen"])
  1718. ])
  1719. ]),
  1720. footer: L(() => [
  1721. h.$slots.footer ? (E(), le("div", {
  1722. key: 0,
  1723. ref_key: "footerSlot",
  1724. ref: y
  1725. }, [
  1726. De(h.$slots, "footer", {}, void 0, !0)
  1727. ], 512)) : Q("", !0),
  1728. !h.$slots.footer && (!e.steps || !e.steps.length) ? (E(), le("div", {
  1729. key: 1,
  1730. ref_key: "footerSlot",
  1731. ref: y
  1732. }, [
  1733. a(se, { onClick: J }, {
  1734. default: L(() => [
  1735. a(te),
  1736. ce(ae(h.$l("关闭")), 1)
  1737. ]),
  1738. _: 1
  1739. }),
  1740. a(se, {
  1741. style: { "margin-right": "8px" },
  1742. type: "primary",
  1743. onClick: fe
  1744. }, {
  1745. default: L(() => [
  1746. a(Ie),
  1747. ce(" " + ae(h.$l(e.saveBtnText)), 1)
  1748. ]),
  1749. _: 1
  1750. })
  1751. ], 512)) : Q("", !0),
  1752. e.steps && e.steps.length > 0 ? (E(), le("div", {
  1753. key: 2,
  1754. ref_key: "footerSlot",
  1755. ref: y
  1756. }, [
  1757. a(se, { onClick: J }, {
  1758. default: L(() => [
  1759. a(te),
  1760. ce(ae(h.$l("关闭")), 1)
  1761. ]),
  1762. _: 1
  1763. }),
  1764. e.steps.length ? (E(), ne(se, {
  1765. key: 0,
  1766. disabled: T.value === e.stepDefaultActive,
  1767. onClick: we
  1768. }, {
  1769. default: L(() => [
  1770. a(mt),
  1771. ce(ae(h.$l("上一步")), 1)
  1772. ]),
  1773. _: 1
  1774. }, 8, ["disabled"])) : Q("", !0),
  1775. e.steps.length ? (E(), ne(se, {
  1776. key: 1,
  1777. type: "primary",
  1778. disabled: T.value === e.steps.length - 1,
  1779. onClick: Ce
  1780. }, {
  1781. default: L(() => [
  1782. a(vt),
  1783. ce(ae(h.$l("下一步")), 1)
  1784. ]),
  1785. _: 1
  1786. }, 8, ["disabled"])) : Q("", !0),
  1787. b.value ? (E(), ne(se, {
  1788. key: 2,
  1789. style: { "margin-right": "8px" },
  1790. type: "primary",
  1791. onClick: fe
  1792. }, {
  1793. default: L(() => [
  1794. a(Ie),
  1795. ce(" " + ae(h.$l(e.saveBtnText)), 1)
  1796. ]),
  1797. _: 1
  1798. })) : Q("", !0)
  1799. ], 512)) : Q("", !0)
  1800. ]),
  1801. modalRender: L(({ originVNode: oe }) => [
  1802. ve("div", {
  1803. style: Pt(H.value)
  1804. }, [
  1805. (E(), ne(Ft(oe)))
  1806. ], 4)
  1807. ]),
  1808. default: L(() => [
  1809. a(he, { spinning: e.loading }, {
  1810. default: L(() => [
  1811. ve("div", {
  1812. ref_key: "bodySlot",
  1813. ref: C
  1814. }, [
  1815. e.tabs && e.tabs.length > 0 ? (E(), le("div", Wo, [
  1816. a(X, {
  1817. "default-active-key": e.tabs[0][e.tabKey.label],
  1818. onChange: ee
  1819. }, {
  1820. default: L(() => [
  1821. (E(!0), le(Pe, null, Ee(e.tabs, (oe) => (E(), ne(V, {
  1822. tab: oe[e.tabKey.label],
  1823. key: oe[e.tabKey.value]
  1824. }, null, 8, ["tab"]))), 128))
  1825. ]),
  1826. _: 1
  1827. }, 8, ["default-active-key"])
  1828. ])) : Q("", !0),
  1829. e.steps && e.steps.length ? (E(), le("div", _o, [
  1830. a(be, {
  1831. current: T.value,
  1832. type: "navigation",
  1833. size: "small"
  1834. }, {
  1835. default: L(() => [
  1836. (E(!0), le(Pe, null, Ee(e.steps, (oe) => (E(), ne(re, {
  1837. title: oe,
  1838. key: oe,
  1839. disabled: !0
  1840. }, null, 8, ["title"]))), 128))
  1841. ]),
  1842. _: 1
  1843. }, 8, ["current"])
  1844. ], 512)) : Q("", !0),
  1845. ve("div", Vo, [
  1846. De(h.$slots, "default", {}, void 0, !0)
  1847. ])
  1848. ], 512)
  1849. ]),
  1850. _: 3
  1851. }, 8, ["spinning"])
  1852. ]),
  1853. _: 3
  1854. }, 16, ["open", "body-style", "width", "centered", "destroyOnClose", "keyboard", "style", "maskClosable", "mask", "wrap-class-name"]);
  1855. };
  1856. }
  1857. }), qo = /* @__PURE__ */ oo(jo, [["__scopeId", "data-v-c3b5b9cf"]]);
  1858. export {
  1859. qo as default
  1860. };