index3.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. import { d as B, P as c, f as j, j as Se, a4 as ke, c as G, _ as P, o as fe, K as xe, i as pe, aU as $e, g as Oe, m as Pe, u as De, h as ne, aV as oe, a5 as ae, S as re, aW as _e, b as Ne, aX as K, at as Ie } from "./index2.js";
  2. import { defineComponent as q, shallowRef as O, onMounted as me, nextTick as W, watch as E, onUnmounted as ve, createVNode as u, Transition as le, withDirectives as ie, vShow as se, ref as Me, computed as I, inject as Te, provide as je } from "vue";
  3. const ye = () => ({
  4. prefixCls: String,
  5. width: c.oneOfType([c.string, c.number]),
  6. height: c.oneOfType([c.string, c.number]),
  7. style: {
  8. type: Object,
  9. default: void 0
  10. },
  11. class: String,
  12. rootClassName: String,
  13. rootStyle: j(),
  14. placement: {
  15. type: String
  16. },
  17. wrapperClassName: String,
  18. level: {
  19. type: [String, Array]
  20. },
  21. levelMove: {
  22. type: [Number, Function, Array]
  23. },
  24. duration: String,
  25. ease: String,
  26. showMask: {
  27. type: Boolean,
  28. default: void 0
  29. },
  30. maskClosable: {
  31. type: Boolean,
  32. default: void 0
  33. },
  34. maskStyle: {
  35. type: Object,
  36. default: void 0
  37. },
  38. afterVisibleChange: Function,
  39. keyboard: {
  40. type: Boolean,
  41. default: void 0
  42. },
  43. contentWrapperStyle: Se(),
  44. autofocus: {
  45. type: Boolean,
  46. default: void 0
  47. },
  48. open: {
  49. type: Boolean,
  50. default: void 0
  51. },
  52. // Motion
  53. motion: ke(),
  54. maskMotion: j()
  55. }), Be = () => B(B({}, ye()), {
  56. forceRender: {
  57. type: Boolean,
  58. default: void 0
  59. },
  60. getContainer: c.oneOfType([c.string, c.func, c.object, c.looseBool])
  61. }), Ee = () => B(B({}, ye()), {
  62. getContainer: Function,
  63. getOpenCount: Function,
  64. scrollLocker: c.any,
  65. inline: Boolean
  66. });
  67. function Ve(e) {
  68. return Array.isArray(e) ? e : [e];
  69. }
  70. const Ae = {
  71. transition: "transitionend",
  72. WebkitTransition: "webkitTransitionEnd",
  73. MozTransition: "transitionend",
  74. OTransition: "oTransitionEnd otransitionend"
  75. };
  76. Object.keys(Ae).filter((e) => {
  77. if (typeof document == "undefined")
  78. return !1;
  79. const o = document.getElementsByTagName("html")[0];
  80. return e in (o ? o.style : {});
  81. })[0];
  82. const Fe = !(typeof window != "undefined" && window.document && window.document.createElement);
  83. var ze = function(e, o) {
  84. var l = {};
  85. for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && o.indexOf(t) < 0 && (l[t] = e[t]);
  86. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
  87. o.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (l[t[i]] = e[t[i]]);
  88. return l;
  89. };
  90. const de = q({
  91. compatConfig: {
  92. MODE: 3
  93. },
  94. inheritAttrs: !1,
  95. props: Ee(),
  96. emits: ["close", "handleClick", "change"],
  97. setup(e, o) {
  98. let {
  99. emit: l,
  100. slots: t
  101. } = o;
  102. const i = O(), S = O(), D = O(), b = O(), w = O();
  103. let m = [];
  104. `${Number((Date.now() + Math.random()).toString().replace(".", Math.round(Math.random() * 9).toString())).toString(16)}`, me(() => {
  105. W(() => {
  106. var a;
  107. const {
  108. open: d,
  109. getContainer: f,
  110. showMask: k,
  111. autofocus: v
  112. } = e, p = f == null ? void 0 : f();
  113. _(e), d && (p && (p.parentNode, document.body), W(() => {
  114. v && h();
  115. }), k && ((a = e.scrollLocker) === null || a === void 0 || a.lock()));
  116. });
  117. }), E(() => e.level, () => {
  118. _(e);
  119. }, {
  120. flush: "post"
  121. }), E(() => e.open, () => {
  122. const {
  123. open: a,
  124. getContainer: d,
  125. scrollLocker: f,
  126. showMask: k,
  127. autofocus: v
  128. } = e, p = d == null ? void 0 : d();
  129. p && (p.parentNode, document.body), a ? (v && h(), k && (f == null || f.lock())) : f == null || f.unLock();
  130. }, {
  131. flush: "post"
  132. }), ve(() => {
  133. var a;
  134. const {
  135. open: d
  136. } = e;
  137. d && (document.body.style.touchAction = ""), (a = e.scrollLocker) === null || a === void 0 || a.unLock();
  138. }), E(() => e.placement, (a) => {
  139. a && (w.value = null);
  140. });
  141. const h = () => {
  142. var a, d;
  143. (d = (a = S.value) === null || a === void 0 ? void 0 : a.focus) === null || d === void 0 || d.call(a);
  144. }, y = (a) => {
  145. l("close", a);
  146. }, g = (a) => {
  147. a.keyCode === xe.ESC && (a.stopPropagation(), y(a));
  148. }, C = () => {
  149. const {
  150. open: a,
  151. afterVisibleChange: d
  152. } = e;
  153. d && d(!!a);
  154. }, _ = (a) => {
  155. let {
  156. level: d,
  157. getContainer: f
  158. } = a;
  159. if (Fe)
  160. return;
  161. const k = f == null ? void 0 : f(), v = k ? k.parentNode : null;
  162. m = [], d === "all" ? (v ? Array.prototype.slice.call(v.children) : []).forEach((x) => {
  163. x.nodeName !== "SCRIPT" && x.nodeName !== "STYLE" && x.nodeName !== "LINK" && x !== k && m.push(x);
  164. }) : d && Ve(d).forEach((p) => {
  165. document.querySelectorAll(p).forEach((x) => {
  166. m.push(x);
  167. });
  168. });
  169. }, M = (a) => {
  170. l("handleClick", a);
  171. }, N = O(!1);
  172. return E(S, () => {
  173. W(() => {
  174. N.value = !0;
  175. });
  176. }), () => {
  177. var a, d;
  178. const {
  179. width: f,
  180. height: k,
  181. open: v,
  182. prefixCls: p,
  183. placement: x,
  184. level: V,
  185. levelMove: A,
  186. ease: J,
  187. duration: Q,
  188. getContainer: Z,
  189. onChange: ee,
  190. afterVisibleChange: te,
  191. showMask: F,
  192. maskClosable: L,
  193. maskStyle: H,
  194. keyboard: R,
  195. getOpenCount: n,
  196. scrollLocker: r,
  197. contentWrapperStyle: s,
  198. style: $,
  199. class: T,
  200. rootClassName: U,
  201. rootStyle: X,
  202. maskMotion: he,
  203. motion: Y,
  204. inline: ge
  205. } = e, be = ze(e, ["width", "height", "open", "prefixCls", "placement", "level", "levelMove", "ease", "duration", "getContainer", "onChange", "afterVisibleChange", "showMask", "maskClosable", "maskStyle", "keyboard", "getOpenCount", "scrollLocker", "contentWrapperStyle", "style", "class", "rootClassName", "rootStyle", "maskMotion", "motion", "inline"]), z = v && N.value, we = G(p, {
  206. [`${p}-${x}`]: !0,
  207. [`${p}-open`]: z,
  208. [`${p}-inline`]: ge,
  209. "no-mask": !F,
  210. [U]: !0
  211. }), Ce = typeof Y == "function" ? Y(x) : Y;
  212. return u("div", P(P({}, fe(be, ["autofocus"])), {}, {
  213. tabindex: -1,
  214. class: we,
  215. style: X,
  216. ref: S,
  217. onKeydown: z && R ? g : void 0
  218. }), [u(le, he, {
  219. default: () => [F && ie(u("div", {
  220. class: `${p}-mask`,
  221. onClick: L ? y : void 0,
  222. style: H,
  223. ref: D
  224. }, null), [[se, z]])]
  225. }), u(le, P(P({}, Ce), {}, {
  226. onAfterEnter: C,
  227. onAfterLeave: C
  228. }), {
  229. default: () => [ie(u("div", {
  230. class: `${p}-content-wrapper`,
  231. style: [s],
  232. ref: i
  233. }, [u("div", {
  234. class: [`${p}-content`, T],
  235. style: $,
  236. ref: w
  237. }, [(a = t.default) === null || a === void 0 ? void 0 : a.call(t)]), t.handler ? u("div", {
  238. onClick: M,
  239. ref: b
  240. }, [(d = t.handler) === null || d === void 0 ? void 0 : d.call(t)]) : null]), [[se, z]])]
  241. })]);
  242. };
  243. }
  244. });
  245. var ce = function(e, o) {
  246. var l = {};
  247. for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && o.indexOf(t) < 0 && (l[t] = e[t]);
  248. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
  249. o.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (l[t[i]] = e[t[i]]);
  250. return l;
  251. };
  252. const We = q({
  253. compatConfig: {
  254. MODE: 3
  255. },
  256. inheritAttrs: !1,
  257. props: pe(Be(), {
  258. prefixCls: "drawer",
  259. placement: "left",
  260. getContainer: "body",
  261. level: "all",
  262. duration: ".3s",
  263. ease: "cubic-bezier(0.78, 0.14, 0.15, 0.86)",
  264. afterVisibleChange: () => {
  265. },
  266. showMask: !0,
  267. maskClosable: !0,
  268. maskStyle: {},
  269. wrapperClassName: "",
  270. keyboard: !0,
  271. forceRender: !1,
  272. autofocus: !0
  273. }),
  274. emits: ["handleClick", "close"],
  275. setup(e, o) {
  276. let {
  277. emit: l,
  278. slots: t
  279. } = o;
  280. const i = Me(null), S = (b) => {
  281. l("handleClick", b);
  282. }, D = (b) => {
  283. l("close", b);
  284. };
  285. return () => {
  286. const {
  287. getContainer: b,
  288. wrapperClassName: w,
  289. rootClassName: m,
  290. rootStyle: h,
  291. forceRender: y
  292. } = e, g = ce(e, ["getContainer", "wrapperClassName", "rootClassName", "rootStyle", "forceRender"]);
  293. let C = null;
  294. if (!b)
  295. return u(de, P(P({}, g), {}, {
  296. rootClassName: m,
  297. rootStyle: h,
  298. open: e.open,
  299. onClose: D,
  300. onHandleClick: S,
  301. inline: !0
  302. }), t);
  303. const _ = !!t.handler || y;
  304. return (_ || e.open || i.value) && (C = u($e, {
  305. autoLock: !0,
  306. visible: e.open,
  307. forceRender: _,
  308. getContainer: b,
  309. wrapperClassName: w
  310. }, {
  311. default: (M) => {
  312. var {
  313. visible: N,
  314. afterClose: a
  315. } = M, d = ce(M, ["visible", "afterClose"]);
  316. return u(de, P(P(P({
  317. ref: i
  318. }, g), d), {}, {
  319. rootClassName: m,
  320. rootStyle: h,
  321. open: N !== void 0 ? N : e.open,
  322. afterVisibleChange: a !== void 0 ? a : e.afterVisibleChange,
  323. onClose: D,
  324. onHandleClick: S
  325. }), t);
  326. }
  327. })), C;
  328. };
  329. }
  330. }), Le = (e) => {
  331. const {
  332. componentCls: o,
  333. motionDurationSlow: l
  334. } = e, t = {
  335. "&-enter, &-appear, &-leave": {
  336. "&-start": {
  337. transition: "none"
  338. },
  339. "&-active": {
  340. transition: `all ${l}`
  341. }
  342. }
  343. };
  344. return {
  345. [o]: {
  346. // ======================== Mask ========================
  347. [`${o}-mask-motion`]: {
  348. "&-enter, &-appear, &-leave": {
  349. "&-active": {
  350. transition: `all ${l}`
  351. }
  352. },
  353. "&-enter, &-appear": {
  354. opacity: 0,
  355. "&-active": {
  356. opacity: 1
  357. }
  358. },
  359. "&-leave": {
  360. opacity: 1,
  361. "&-active": {
  362. opacity: 0
  363. }
  364. }
  365. },
  366. // ======================= Panel ========================
  367. [`${o}-panel-motion`]: {
  368. // Left
  369. "&-left": [t, {
  370. "&-enter, &-appear": {
  371. "&-start": {
  372. transform: "translateX(-100%) !important"
  373. },
  374. "&-active": {
  375. transform: "translateX(0)"
  376. }
  377. },
  378. "&-leave": {
  379. transform: "translateX(0)",
  380. "&-active": {
  381. transform: "translateX(-100%)"
  382. }
  383. }
  384. }],
  385. // Right
  386. "&-right": [t, {
  387. "&-enter, &-appear": {
  388. "&-start": {
  389. transform: "translateX(100%) !important"
  390. },
  391. "&-active": {
  392. transform: "translateX(0)"
  393. }
  394. },
  395. "&-leave": {
  396. transform: "translateX(0)",
  397. "&-active": {
  398. transform: "translateX(100%)"
  399. }
  400. }
  401. }],
  402. // Top
  403. "&-top": [t, {
  404. "&-enter, &-appear": {
  405. "&-start": {
  406. transform: "translateY(-100%) !important"
  407. },
  408. "&-active": {
  409. transform: "translateY(0)"
  410. }
  411. },
  412. "&-leave": {
  413. transform: "translateY(0)",
  414. "&-active": {
  415. transform: "translateY(-100%)"
  416. }
  417. }
  418. }],
  419. // Bottom
  420. "&-bottom": [t, {
  421. "&-enter, &-appear": {
  422. "&-start": {
  423. transform: "translateY(100%) !important"
  424. },
  425. "&-active": {
  426. transform: "translateY(0)"
  427. }
  428. },
  429. "&-leave": {
  430. transform: "translateY(0)",
  431. "&-active": {
  432. transform: "translateY(100%)"
  433. }
  434. }
  435. }]
  436. }
  437. }
  438. };
  439. }, He = (e) => {
  440. const {
  441. componentCls: o,
  442. zIndexPopup: l,
  443. colorBgMask: t,
  444. colorBgElevated: i,
  445. motionDurationSlow: S,
  446. motionDurationMid: D,
  447. padding: b,
  448. paddingLG: w,
  449. fontSizeLG: m,
  450. lineHeightLG: h,
  451. lineWidth: y,
  452. lineType: g,
  453. colorSplit: C,
  454. marginSM: _,
  455. colorIcon: M,
  456. colorIconHover: N,
  457. colorText: a,
  458. fontWeightStrong: d,
  459. drawerFooterPaddingVertical: f,
  460. drawerFooterPaddingHorizontal: k
  461. } = e, v = `${o}-content-wrapper`;
  462. return {
  463. [o]: {
  464. position: "fixed",
  465. inset: 0,
  466. zIndex: l,
  467. pointerEvents: "none",
  468. "&-pure": {
  469. position: "relative",
  470. background: i,
  471. [`&${o}-left`]: {
  472. boxShadow: e.boxShadowDrawerLeft
  473. },
  474. [`&${o}-right`]: {
  475. boxShadow: e.boxShadowDrawerRight
  476. },
  477. [`&${o}-top`]: {
  478. boxShadow: e.boxShadowDrawerUp
  479. },
  480. [`&${o}-bottom`]: {
  481. boxShadow: e.boxShadowDrawerDown
  482. }
  483. },
  484. "&-inline": {
  485. position: "absolute"
  486. },
  487. // ====================== Mask ======================
  488. [`${o}-mask`]: {
  489. position: "absolute",
  490. inset: 0,
  491. zIndex: l,
  492. background: t,
  493. pointerEvents: "auto"
  494. },
  495. // ==================== Content =====================
  496. [v]: {
  497. position: "absolute",
  498. zIndex: l,
  499. transition: `all ${S}`,
  500. "&-hidden": {
  501. display: "none"
  502. }
  503. },
  504. // Placement
  505. [`&-left > ${v}`]: {
  506. top: 0,
  507. bottom: 0,
  508. left: {
  509. _skip_check_: !0,
  510. value: 0
  511. },
  512. boxShadow: e.boxShadowDrawerLeft
  513. },
  514. [`&-right > ${v}`]: {
  515. top: 0,
  516. right: {
  517. _skip_check_: !0,
  518. value: 0
  519. },
  520. bottom: 0,
  521. boxShadow: e.boxShadowDrawerRight
  522. },
  523. [`&-top > ${v}`]: {
  524. top: 0,
  525. insetInline: 0,
  526. boxShadow: e.boxShadowDrawerUp
  527. },
  528. [`&-bottom > ${v}`]: {
  529. bottom: 0,
  530. insetInline: 0,
  531. boxShadow: e.boxShadowDrawerDown
  532. },
  533. [`${o}-content`]: {
  534. width: "100%",
  535. height: "100%",
  536. overflow: "auto",
  537. background: i,
  538. pointerEvents: "auto"
  539. },
  540. // ===================== Panel ======================
  541. [`${o}-wrapper-body`]: {
  542. display: "flex",
  543. flexDirection: "column",
  544. width: "100%",
  545. height: "100%"
  546. },
  547. // Header
  548. [`${o}-header`]: {
  549. display: "flex",
  550. flex: 0,
  551. alignItems: "center",
  552. padding: `${b}px ${w}px`,
  553. fontSize: m,
  554. lineHeight: h,
  555. borderBottom: `${y}px ${g} ${C}`,
  556. "&-title": {
  557. display: "flex",
  558. flex: 1,
  559. alignItems: "center",
  560. minWidth: 0,
  561. minHeight: 0
  562. }
  563. },
  564. [`${o}-extra`]: {
  565. flex: "none"
  566. },
  567. [`${o}-close`]: {
  568. display: "inline-block",
  569. marginInlineEnd: _,
  570. color: M,
  571. fontWeight: d,
  572. fontSize: m,
  573. fontStyle: "normal",
  574. lineHeight: 1,
  575. textAlign: "center",
  576. textTransform: "none",
  577. textDecoration: "none",
  578. background: "transparent",
  579. border: 0,
  580. outline: 0,
  581. cursor: "pointer",
  582. transition: `color ${D}`,
  583. textRendering: "auto",
  584. "&:focus, &:hover": {
  585. color: N,
  586. textDecoration: "none"
  587. }
  588. },
  589. [`${o}-title`]: {
  590. flex: 1,
  591. margin: 0,
  592. color: a,
  593. fontWeight: e.fontWeightStrong,
  594. fontSize: m,
  595. lineHeight: h
  596. },
  597. // Body
  598. [`${o}-body`]: {
  599. flex: 1,
  600. minWidth: 0,
  601. minHeight: 0,
  602. padding: w,
  603. overflow: "auto"
  604. },
  605. // Footer
  606. [`${o}-footer`]: {
  607. flexShrink: 0,
  608. padding: `${f}px ${k}px`,
  609. borderTop: `${y}px ${g} ${C}`
  610. },
  611. // ====================== RTL =======================
  612. "&-rtl": {
  613. direction: "rtl"
  614. }
  615. }
  616. };
  617. }, Re = Oe("Drawer", (e) => {
  618. const o = Pe(e, {
  619. drawerFooterPaddingVertical: e.paddingXS,
  620. drawerFooterPaddingHorizontal: e.padding
  621. });
  622. return [He(o), Le(o)];
  623. }, (e) => ({
  624. zIndexPopup: e.zIndexPopupBase
  625. }));
  626. var Ue = function(e, o) {
  627. var l = {};
  628. for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && o.indexOf(t) < 0 && (l[t] = e[t]);
  629. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
  630. o.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (l[t[i]] = e[t[i]]);
  631. return l;
  632. };
  633. const Xe = ["top", "right", "bottom", "left"], ue = {
  634. distance: 180
  635. }, Ye = () => ({
  636. autofocus: {
  637. type: Boolean,
  638. default: void 0
  639. },
  640. closable: {
  641. type: Boolean,
  642. default: void 0
  643. },
  644. closeIcon: c.any,
  645. destroyOnClose: {
  646. type: Boolean,
  647. default: void 0
  648. },
  649. forceRender: {
  650. type: Boolean,
  651. default: void 0
  652. },
  653. getContainer: {
  654. type: [String, Function, Boolean, Object],
  655. default: void 0
  656. },
  657. maskClosable: {
  658. type: Boolean,
  659. default: void 0
  660. },
  661. mask: {
  662. type: Boolean,
  663. default: void 0
  664. },
  665. maskStyle: j(),
  666. rootClassName: String,
  667. rootStyle: j(),
  668. size: {
  669. type: String
  670. },
  671. drawerStyle: j(),
  672. headerStyle: j(),
  673. bodyStyle: j(),
  674. contentWrapperStyle: {
  675. type: Object,
  676. default: void 0
  677. },
  678. title: c.any,
  679. /** @deprecated Please use `open` instead */
  680. visible: {
  681. type: Boolean,
  682. default: void 0
  683. },
  684. open: {
  685. type: Boolean,
  686. default: void 0
  687. },
  688. width: c.oneOfType([c.string, c.number]),
  689. height: c.oneOfType([c.string, c.number]),
  690. zIndex: Number,
  691. prefixCls: String,
  692. push: c.oneOfType([c.looseBool, {
  693. type: Object
  694. }]),
  695. placement: c.oneOf(Xe),
  696. keyboard: {
  697. type: Boolean,
  698. default: void 0
  699. },
  700. extra: c.any,
  701. footer: c.any,
  702. footerStyle: j(),
  703. level: c.any,
  704. levelMove: {
  705. type: [Number, Array, Function]
  706. },
  707. handle: c.any,
  708. /** @deprecated Use `@afterVisibleChange` instead */
  709. afterVisibleChange: Function,
  710. /** @deprecated Please use `@afterOpenChange` instead */
  711. onAfterVisibleChange: Function,
  712. onAfterOpenChange: Function,
  713. /** @deprecated Please use `onUpdate:open` instead */
  714. "onUpdate:visible": Function,
  715. "onUpdate:open": Function,
  716. onClose: Function
  717. }), Ke = q({
  718. compatConfig: {
  719. MODE: 3
  720. },
  721. name: "ADrawer",
  722. inheritAttrs: !1,
  723. props: pe(Ye(), {
  724. closable: !0,
  725. placement: "right",
  726. maskClosable: !0,
  727. mask: !0,
  728. level: null,
  729. keyboard: !0,
  730. push: ue
  731. }),
  732. slots: Object,
  733. // emits: ['update:visible', 'close', 'afterVisibleChange'],
  734. setup(e, o) {
  735. let {
  736. emit: l,
  737. slots: t,
  738. attrs: i
  739. } = o;
  740. const S = O(!1), D = O(!1), b = O(null), w = O(!1), m = O(!1), h = I(() => {
  741. var n;
  742. return (n = e.open) !== null && n !== void 0 ? n : e.visible;
  743. });
  744. E(h, () => {
  745. h.value ? w.value = !0 : m.value = !1;
  746. }, {
  747. immediate: !0
  748. }), E([h, w], () => {
  749. h.value && w.value && (m.value = !0);
  750. }, {
  751. immediate: !0
  752. });
  753. const y = Te("parentDrawerOpts", null), {
  754. prefixCls: g,
  755. getPopupContainer: C,
  756. direction: _
  757. } = De("drawer", e), [M, N] = Re(g), a = I(() => (
  758. // 有可能为 false,所以不能直接判断
  759. e.getContainer === void 0 && (C != null && C.value) ? () => C.value(document.body) : e.getContainer
  760. ));
  761. ne(!e.afterVisibleChange, "Drawer", "`afterVisibleChange` prop is deprecated, please use `@afterVisibleChange` event instead"), process.env.NODE_ENV !== "production" && [["visible", "open"], ["onUpdate:visible", "onUpdate:open"], ["onAfterVisibleChange", "onAfterOpenChange"]].forEach((n) => {
  762. let [r, s] = n;
  763. ne(!e[r], "Drawer", `\`${r}\` is deprecated, please use \`${s}\` instead.`);
  764. }), je("parentDrawerOpts", {
  765. setPush: () => {
  766. S.value = !0;
  767. },
  768. setPull: () => {
  769. S.value = !1, W(() => {
  770. k();
  771. });
  772. }
  773. }), me(() => {
  774. h.value && y && y.setPush();
  775. }), ve(() => {
  776. y && y.setPull();
  777. }), E(m, () => {
  778. y && (m.value ? y.setPush() : y.setPull());
  779. }, {
  780. flush: "post"
  781. });
  782. const k = () => {
  783. var n, r;
  784. (r = (n = b.value) === null || n === void 0 ? void 0 : n.domFocus) === null || r === void 0 || r.call(n);
  785. }, v = (n) => {
  786. l("update:visible", !1), l("update:open", !1), l("close", n);
  787. }, p = (n) => {
  788. var r;
  789. n || (D.value === !1 && (D.value = !0), e.destroyOnClose && (w.value = !1)), (r = e.afterVisibleChange) === null || r === void 0 || r.call(e, n), l("afterVisibleChange", n), l("afterOpenChange", n);
  790. }, x = I(() => {
  791. const {
  792. push: n,
  793. placement: r
  794. } = e;
  795. let s;
  796. return typeof n == "boolean" ? s = n ? ue.distance : 0 : s = n.distance, s = parseFloat(String(s || 0)), r === "left" || r === "right" ? `translateX(${r === "left" ? s : -s}px)` : r === "top" || r === "bottom" ? `translateY(${r === "top" ? s : -s}px)` : null;
  797. }), V = I(() => {
  798. var n;
  799. return (n = e.width) !== null && n !== void 0 ? n : e.size === "large" ? 736 : 378;
  800. }), A = I(() => {
  801. var n;
  802. return (n = e.height) !== null && n !== void 0 ? n : e.size === "large" ? 736 : 378;
  803. }), J = I(() => {
  804. const {
  805. mask: n,
  806. placement: r
  807. } = e;
  808. if (!m.value && !n)
  809. return {};
  810. const s = {};
  811. return r === "left" || r === "right" ? s.width = oe(V.value) ? `${V.value}px` : V.value : s.height = oe(A.value) ? `${A.value}px` : A.value, s;
  812. }), Q = I(() => {
  813. const {
  814. zIndex: n,
  815. contentWrapperStyle: r
  816. } = e, s = J.value;
  817. return [{
  818. zIndex: n,
  819. transform: S.value ? x.value : void 0
  820. }, B({}, r), s];
  821. }), Z = (n) => {
  822. const {
  823. closable: r,
  824. headerStyle: s
  825. } = e, $ = K(t, e, "extra"), T = K(t, e, "title");
  826. return !T && !r ? null : u("div", {
  827. class: G(`${n}-header`, {
  828. [`${n}-header-close-only`]: r && !T && !$
  829. }),
  830. style: s
  831. }, [u("div", {
  832. class: `${n}-header-title`
  833. }, [ee(n), T && u("div", {
  834. class: `${n}-title`
  835. }, [T])]), $ && u("div", {
  836. class: `${n}-extra`
  837. }, [$])]);
  838. }, ee = (n) => {
  839. var r;
  840. const {
  841. closable: s
  842. } = e, $ = t.closeIcon ? (r = t.closeIcon) === null || r === void 0 ? void 0 : r.call(t) : e.closeIcon;
  843. return s && u("button", {
  844. key: "closer",
  845. onClick: v,
  846. "aria-label": "Close",
  847. class: `${n}-close`
  848. }, [$ === void 0 ? u(Ie, null, null) : $]);
  849. }, te = (n) => {
  850. var r;
  851. if (D.value && !e.forceRender && !w.value)
  852. return null;
  853. const {
  854. bodyStyle: s,
  855. drawerStyle: $
  856. } = e;
  857. return u("div", {
  858. class: `${n}-wrapper-body`,
  859. style: $
  860. }, [Z(n), u("div", {
  861. key: "body",
  862. class: `${n}-body`,
  863. style: s
  864. }, [(r = t.default) === null || r === void 0 ? void 0 : r.call(t)]), F(n)]);
  865. }, F = (n) => {
  866. const r = K(t, e, "footer");
  867. if (!r)
  868. return null;
  869. const s = `${n}-footer`;
  870. return u("div", {
  871. class: s,
  872. style: e.footerStyle
  873. }, [r]);
  874. }, L = I(() => G({
  875. "no-mask": !e.mask,
  876. [`${g.value}-rtl`]: _.value === "rtl"
  877. }, e.rootClassName, N.value)), H = I(() => ae(re(g.value, "mask-motion"))), R = (n) => ae(re(g.value, `panel-motion-${n}`));
  878. return () => {
  879. const {
  880. width: n,
  881. height: r,
  882. placement: s,
  883. mask: $,
  884. forceRender: T
  885. } = e, U = Ue(e, ["width", "height", "placement", "mask", "forceRender"]), X = B(B(B({}, i), fe(U, ["size", "closeIcon", "closable", "destroyOnClose", "drawerStyle", "headerStyle", "bodyStyle", "title", "push", "onAfterVisibleChange", "onClose", "onUpdate:visible", "onUpdate:open", "visible"])), {
  886. forceRender: T,
  887. onClose: v,
  888. afterVisibleChange: p,
  889. handler: !1,
  890. prefixCls: g.value,
  891. open: m.value,
  892. showMask: $,
  893. placement: s,
  894. ref: b
  895. });
  896. return M(u(_e, null, {
  897. default: () => [u(We, P(P({}, X), {}, {
  898. maskMotion: H.value,
  899. motion: R,
  900. width: V.value,
  901. height: A.value,
  902. getContainer: a.value,
  903. rootClassName: L.value,
  904. rootStyle: e.rootStyle,
  905. contentWrapperStyle: Q.value
  906. }), {
  907. handler: e.handle ? () => e.handle : t.handle,
  908. default: () => te(g.value)
  909. })]
  910. }));
  911. };
  912. }
  913. }), Je = Ne(Ke);
  914. export {
  915. Je as _
  916. };