SModal.js 52 KB

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