SModal.js 46 KB

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