index8.js 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996
  1. import { _ as w, b5 as en, m as ue, a8 as tn, b6 as be, b7 as Ce, P as Ee, a as re, w as Ue, b8 as he, Y as nn, o as on, b as ln, K as Oe, n as an, aQ as sn, b9 as rn, ba as cn, bb as dn, i as un, g as fn, a5 as vn, I as hn, J as gn, bc as dt, M as yn } from "./index2.js";
  2. import { createVNode as C, cloneVNode as Et, defineComponent as Ne, reactive as _e, ref as We, watch as ie, onUnmounted as Dt, onMounted as qe, onBeforeUnmount as rt, computed as E, shallowRef as L, toRaw as it, nextTick as Ae, onUpdated as Tt, watchEffect as Pe, provide as $t, inject as Nt, getCurrentInstance as pn, Transition as mn, withDirectives as bn, vShow as Sn, Fragment as xn } from "vue";
  3. import { e as ut, h as Ge, i as Xe, j as Mt, b as Kn, f as kn, c as wn, d as ft, k as Cn, l as vt, u as En, p as lt, a as at, m as me, n as Dn, o as ht, q as we, r as Tn, g as $n } from "./index4.js";
  4. import { p as Ot } from "./pickAttrs.js";
  5. const Je = (e, t) => {
  6. let {
  7. height: n,
  8. offset: o,
  9. prefixCls: l,
  10. onInnerResize: c
  11. } = e, {
  12. slots: i
  13. } = t;
  14. var v;
  15. let S = {}, f = {
  16. display: "flex",
  17. flexDirection: "column"
  18. };
  19. return o !== void 0 && (S = {
  20. height: `${n}px`,
  21. position: "relative",
  22. overflow: "hidden"
  23. }, f = w(w({}, f), {
  24. transform: `translateY(${o}px)`,
  25. position: "absolute",
  26. left: 0,
  27. right: 0,
  28. top: 0
  29. })), C("div", {
  30. style: S
  31. }, [C(en, {
  32. onResize: (K) => {
  33. let {
  34. offsetHeight: x
  35. } = K;
  36. x && c && c();
  37. }
  38. }, {
  39. default: () => [C("div", {
  40. style: f,
  41. class: ue({
  42. [`${l}-holder-inner`]: l
  43. })
  44. }, [(v = i.default) === null || v === void 0 ? void 0 : v.call(i)])]
  45. })]);
  46. };
  47. Je.displayName = "Filter";
  48. Je.inheritAttrs = !1;
  49. Je.props = {
  50. prefixCls: String,
  51. /** Virtual filler height. Should be `count * itemMinHeight` */
  52. height: Number,
  53. /** Set offset of visible items. Should be the top of start item position */
  54. offset: Number,
  55. onInnerResize: Function
  56. };
  57. const Pt = (e, t) => {
  58. let {
  59. setRef: n
  60. } = e, {
  61. slots: o
  62. } = t;
  63. var l;
  64. const c = tn((l = o.default) === null || l === void 0 ? void 0 : l.call(o));
  65. return c && c.length ? Et(c[0], {
  66. ref: n
  67. }) : c;
  68. };
  69. Pt.props = {
  70. setRef: {
  71. type: Function,
  72. default: () => {
  73. }
  74. }
  75. };
  76. const Nn = 20;
  77. function gt(e) {
  78. return "touches" in e ? e.touches[0].pageY : e.pageY;
  79. }
  80. const Mn = Ne({
  81. compatConfig: {
  82. MODE: 3
  83. },
  84. name: "ScrollBar",
  85. inheritAttrs: !1,
  86. props: {
  87. prefixCls: String,
  88. scrollTop: Number,
  89. scrollHeight: Number,
  90. height: Number,
  91. count: Number,
  92. onScroll: {
  93. type: Function
  94. },
  95. onStartMove: {
  96. type: Function
  97. },
  98. onStopMove: {
  99. type: Function
  100. }
  101. },
  102. setup() {
  103. return {
  104. moveRaf: null,
  105. scrollbarRef: ut(),
  106. thumbRef: ut(),
  107. visibleTimeout: null,
  108. state: _e({
  109. dragging: !1,
  110. pageY: null,
  111. startTop: null,
  112. visible: !1
  113. })
  114. };
  115. },
  116. watch: {
  117. scrollTop: {
  118. handler() {
  119. this.delayHidden();
  120. },
  121. flush: "post"
  122. }
  123. },
  124. mounted() {
  125. var e, t;
  126. (e = this.scrollbarRef.current) === null || e === void 0 || e.addEventListener("touchstart", this.onScrollbarTouchStart, Ce ? {
  127. passive: !1
  128. } : !1), (t = this.thumbRef.current) === null || t === void 0 || t.addEventListener("touchstart", this.onMouseDown, Ce ? {
  129. passive: !1
  130. } : !1);
  131. },
  132. beforeUnmount() {
  133. this.removeEvents(), clearTimeout(this.visibleTimeout);
  134. },
  135. methods: {
  136. delayHidden() {
  137. clearTimeout(this.visibleTimeout), this.state.visible = !0, this.visibleTimeout = setTimeout(() => {
  138. this.state.visible = !1;
  139. }, 2e3);
  140. },
  141. onScrollbarTouchStart(e) {
  142. e.preventDefault();
  143. },
  144. onContainerMouseDown(e) {
  145. e.stopPropagation(), e.preventDefault();
  146. },
  147. // ======================= Clean =======================
  148. patchEvents() {
  149. window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("mouseup", this.onMouseUp), this.thumbRef.current.addEventListener("touchmove", this.onMouseMove, Ce ? {
  150. passive: !1
  151. } : !1), this.thumbRef.current.addEventListener("touchend", this.onMouseUp);
  152. },
  153. removeEvents() {
  154. window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), this.scrollbarRef.current.removeEventListener("touchstart", this.onScrollbarTouchStart, Ce ? {
  155. passive: !1
  156. } : !1), this.thumbRef.current && (this.thumbRef.current.removeEventListener("touchstart", this.onMouseDown, Ce ? {
  157. passive: !1
  158. } : !1), this.thumbRef.current.removeEventListener("touchmove", this.onMouseMove, Ce ? {
  159. passive: !1
  160. } : !1), this.thumbRef.current.removeEventListener("touchend", this.onMouseUp)), be.cancel(this.moveRaf);
  161. },
  162. // ======================= Thumb =======================
  163. onMouseDown(e) {
  164. const {
  165. onStartMove: t
  166. } = this.$props;
  167. w(this.state, {
  168. dragging: !0,
  169. pageY: gt(e),
  170. startTop: this.getTop()
  171. }), t(), this.patchEvents(), e.stopPropagation(), e.preventDefault();
  172. },
  173. onMouseMove(e) {
  174. const {
  175. dragging: t,
  176. pageY: n,
  177. startTop: o
  178. } = this.state, {
  179. onScroll: l
  180. } = this.$props;
  181. if (be.cancel(this.moveRaf), t) {
  182. const c = gt(e) - n, i = o + c, v = this.getEnableScrollRange(), S = this.getEnableHeightRange(), f = S ? i / S : 0, K = Math.ceil(f * v);
  183. this.moveRaf = be(() => {
  184. l(K);
  185. });
  186. }
  187. },
  188. onMouseUp() {
  189. const {
  190. onStopMove: e
  191. } = this.$props;
  192. this.state.dragging = !1, e(), this.removeEvents();
  193. },
  194. // ===================== Calculate =====================
  195. getSpinHeight() {
  196. const {
  197. height: e,
  198. scrollHeight: t
  199. } = this.$props;
  200. let n = e / t * 100;
  201. return n = Math.max(n, Nn), n = Math.min(n, e / 2), Math.floor(n);
  202. },
  203. getEnableScrollRange() {
  204. const {
  205. scrollHeight: e,
  206. height: t
  207. } = this.$props;
  208. return e - t || 0;
  209. },
  210. getEnableHeightRange() {
  211. const {
  212. height: e
  213. } = this.$props, t = this.getSpinHeight();
  214. return e - t || 0;
  215. },
  216. getTop() {
  217. const {
  218. scrollTop: e
  219. } = this.$props, t = this.getEnableScrollRange(), n = this.getEnableHeightRange();
  220. return e === 0 || t === 0 ? 0 : e / t * n;
  221. },
  222. // Not show scrollbar when height is large than scrollHeight
  223. showScroll() {
  224. const {
  225. height: e,
  226. scrollHeight: t
  227. } = this.$props;
  228. return t > e;
  229. }
  230. },
  231. render() {
  232. const {
  233. dragging: e,
  234. visible: t
  235. } = this.state, {
  236. prefixCls: n
  237. } = this.$props, o = this.getSpinHeight() + "px", l = this.getTop() + "px", c = this.showScroll(), i = c && t;
  238. return C("div", {
  239. ref: this.scrollbarRef,
  240. class: ue(`${n}-scrollbar`, {
  241. [`${n}-scrollbar-show`]: c
  242. }),
  243. style: {
  244. width: "8px",
  245. top: 0,
  246. bottom: 0,
  247. right: 0,
  248. position: "absolute",
  249. display: i ? void 0 : "none"
  250. },
  251. onMousedown: this.onContainerMouseDown,
  252. onMousemove: this.delayHidden
  253. }, [C("div", {
  254. ref: this.thumbRef,
  255. class: ue(`${n}-scrollbar-thumb`, {
  256. [`${n}-scrollbar-thumb-moving`]: e
  257. }),
  258. style: {
  259. width: "100%",
  260. height: o,
  261. top: l,
  262. left: 0,
  263. position: "absolute",
  264. background: "rgba(0, 0, 0, 0.5)",
  265. borderRadius: "99px",
  266. cursor: "pointer",
  267. userSelect: "none"
  268. },
  269. onMousedown: this.onMouseDown
  270. }, null)]);
  271. }
  272. });
  273. function On(e, t, n, o) {
  274. const l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), i = We(Symbol("update"));
  275. ie(e, () => {
  276. i.value = Symbol("update");
  277. });
  278. let v;
  279. function S() {
  280. be.cancel(v);
  281. }
  282. function f() {
  283. S(), v = be(() => {
  284. l.forEach((x, m) => {
  285. if (x && x.offsetParent) {
  286. const {
  287. offsetHeight: D
  288. } = x;
  289. c.get(m) !== D && (i.value = Symbol("update"), c.set(m, x.offsetHeight));
  290. }
  291. });
  292. });
  293. }
  294. function K(x, m) {
  295. const D = t(x);
  296. l.get(D), m ? (l.set(D, m.$el || m), f()) : l.delete(D);
  297. }
  298. return Dt(() => {
  299. S();
  300. }), [K, f, c, i];
  301. }
  302. function Pn(e, t, n, o, l, c, i, v) {
  303. let S;
  304. return (f) => {
  305. if (f == null) {
  306. v();
  307. return;
  308. }
  309. be.cancel(S);
  310. const K = t.value, x = o.itemHeight;
  311. if (typeof f == "number")
  312. i(f);
  313. else if (f && typeof f == "object") {
  314. let m;
  315. const {
  316. align: D
  317. } = f;
  318. "index" in f ? {
  319. index: m
  320. } = f : m = K.findIndex((N) => l(N) === f.key);
  321. const {
  322. offset: j = 0
  323. } = f, y = (N, O) => {
  324. if (N < 0 || !e.value) return;
  325. const V = e.value.clientHeight;
  326. let T = !1, Y = O;
  327. if (V) {
  328. const B = O || D;
  329. let Q = 0, q = 0, A = 0;
  330. const G = Math.min(K.length, m);
  331. for (let U = 0; U <= G; U += 1) {
  332. const ee = l(K[U]);
  333. q = Q;
  334. const le = n.get(ee);
  335. A = q + (le === void 0 ? x : le), Q = A, U === m && le === void 0 && (T = !0);
  336. }
  337. const Z = e.value.scrollTop;
  338. let z = null;
  339. switch (B) {
  340. case "top":
  341. z = q - j;
  342. break;
  343. case "bottom":
  344. z = A - V + j;
  345. break;
  346. default: {
  347. const U = Z + V;
  348. q < Z ? Y = "top" : A > U && (Y = "bottom");
  349. }
  350. }
  351. z !== null && z !== Z && i(z);
  352. }
  353. S = be(() => {
  354. T && c(), y(N - 1, Y);
  355. }, 2);
  356. };
  357. y(5);
  358. }
  359. };
  360. }
  361. const In = typeof navigator == "object" && /Firefox/i.test(navigator.userAgent), It = (e, t) => {
  362. let n = !1, o = null;
  363. function l() {
  364. clearTimeout(o), n = !0, o = setTimeout(() => {
  365. n = !1;
  366. }, 50);
  367. }
  368. return function(c) {
  369. let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
  370. const v = (
  371. // Pass origin wheel when on the top
  372. c < 0 && e.value || // Pass origin wheel when on the bottom
  373. c > 0 && t.value
  374. );
  375. return i && v ? (clearTimeout(o), n = !1) : (!v || n) && l(), !n && v;
  376. };
  377. };
  378. function Ln(e, t, n, o) {
  379. let l = 0, c = null, i = null, v = !1;
  380. const S = It(t, n);
  381. function f(x) {
  382. if (!e.value) return;
  383. be.cancel(c);
  384. const {
  385. deltaY: m
  386. } = x;
  387. l += m, i = m, !S(m) && (In || x.preventDefault(), c = be(() => {
  388. o(l * (v ? 10 : 1)), l = 0;
  389. }));
  390. }
  391. function K(x) {
  392. e.value && (v = x.detail === i);
  393. }
  394. return [f, K];
  395. }
  396. const Hn = 14 / 15;
  397. function Rn(e, t, n) {
  398. let o = !1, l = 0, c = null, i = null;
  399. const v = () => {
  400. c && (c.removeEventListener("touchmove", S), c.removeEventListener("touchend", f));
  401. }, S = (m) => {
  402. if (o) {
  403. const D = Math.ceil(m.touches[0].pageY);
  404. let j = l - D;
  405. l = D, n(j) && m.preventDefault(), clearInterval(i), i = setInterval(() => {
  406. j *= Hn, (!n(j, !0) || Math.abs(j) <= 0.1) && clearInterval(i);
  407. }, 16);
  408. }
  409. }, f = () => {
  410. o = !1, v();
  411. }, K = (m) => {
  412. v(), m.touches.length === 1 && !o && (o = !0, l = Math.ceil(m.touches[0].pageY), c = m.target, c.addEventListener("touchmove", S, {
  413. passive: !1
  414. }), c.addEventListener("touchend", f));
  415. }, x = () => {
  416. };
  417. qe(() => {
  418. document.addEventListener("touchmove", x, {
  419. passive: !1
  420. }), ie(e, (m) => {
  421. t.value.removeEventListener("touchstart", K), v(), clearInterval(i), m && t.value.addEventListener("touchstart", K, {
  422. passive: !1
  423. });
  424. }, {
  425. immediate: !0
  426. });
  427. }), rt(() => {
  428. document.removeEventListener("touchmove", x);
  429. });
  430. }
  431. var Fn = function(e, t) {
  432. var n = {};
  433. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  434. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
  435. t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  436. return n;
  437. };
  438. const An = [], _n = {
  439. overflowY: "auto",
  440. overflowAnchor: "none"
  441. };
  442. function Bn(e, t, n, o, l, c) {
  443. let {
  444. getKey: i
  445. } = c;
  446. return e.slice(t, n + 1).map((v, S) => {
  447. const f = t + S, K = l(v, f, {
  448. // style: status === 'MEASURE_START' ? { visibility: 'hidden' } : {},
  449. }), x = i(v);
  450. return C(Pt, {
  451. key: x,
  452. setRef: (m) => o(v, m)
  453. }, {
  454. default: () => [K]
  455. });
  456. });
  457. }
  458. const jn = Ne({
  459. compatConfig: {
  460. MODE: 3
  461. },
  462. name: "List",
  463. inheritAttrs: !1,
  464. props: {
  465. prefixCls: String,
  466. data: Ee.array,
  467. height: Number,
  468. itemHeight: Number,
  469. /** If not match virtual scroll condition, Set List still use height of container. */
  470. fullHeight: {
  471. type: Boolean,
  472. default: void 0
  473. },
  474. itemKey: {
  475. type: [String, Number, Function],
  476. required: !0
  477. },
  478. component: {
  479. type: [String, Object]
  480. },
  481. /** Set `false` will always use real scroll instead of virtual one */
  482. virtual: {
  483. type: Boolean,
  484. default: void 0
  485. },
  486. children: Function,
  487. onScroll: Function,
  488. onMousedown: Function,
  489. onMouseenter: Function,
  490. onVisibleChange: Function
  491. },
  492. setup(e, t) {
  493. let {
  494. expose: n
  495. } = t;
  496. const o = E(() => {
  497. const {
  498. height: h,
  499. itemHeight: b,
  500. virtual: H
  501. } = e;
  502. return !!(H !== !1 && h && b);
  503. }), l = E(() => {
  504. const {
  505. height: h,
  506. itemHeight: b,
  507. data: H
  508. } = e;
  509. return o.value && H && b * H.length > h;
  510. }), c = _e({
  511. scrollTop: 0,
  512. scrollMoving: !1
  513. }), i = E(() => e.data || An), v = L([]);
  514. ie(i, () => {
  515. v.value = it(i.value).slice();
  516. }, {
  517. immediate: !0
  518. });
  519. const S = L((h) => {
  520. });
  521. ie(() => e.itemKey, (h) => {
  522. typeof h == "function" ? S.value = h : S.value = (b) => b == null ? void 0 : b[h];
  523. }, {
  524. immediate: !0
  525. });
  526. const f = L(), K = L(), x = L(), m = (h) => S.value(h), D = {
  527. getKey: m
  528. };
  529. function j(h) {
  530. let b;
  531. typeof h == "function" ? b = h(c.scrollTop) : b = h;
  532. const H = Q(b);
  533. f.value && (f.value.scrollTop = H), c.scrollTop = H;
  534. }
  535. const [y, N, O, V] = On(v, m), T = _e({
  536. scrollHeight: void 0,
  537. start: 0,
  538. end: 0,
  539. offset: void 0
  540. }), Y = L(0);
  541. qe(() => {
  542. Ae(() => {
  543. var h;
  544. Y.value = ((h = K.value) === null || h === void 0 ? void 0 : h.offsetHeight) || 0;
  545. });
  546. }), Tt(() => {
  547. Ae(() => {
  548. var h;
  549. Y.value = ((h = K.value) === null || h === void 0 ? void 0 : h.offsetHeight) || 0;
  550. });
  551. }), ie([o, v], () => {
  552. o.value || w(T, {
  553. scrollHeight: void 0,
  554. start: 0,
  555. end: v.value.length - 1,
  556. offset: void 0
  557. });
  558. }, {
  559. immediate: !0
  560. }), ie([o, v, Y, l], () => {
  561. o.value && !l.value && w(T, {
  562. scrollHeight: Y.value,
  563. start: 0,
  564. end: v.value.length - 1,
  565. offset: void 0
  566. }), f.value && (c.scrollTop = f.value.scrollTop);
  567. }, {
  568. immediate: !0
  569. }), ie([l, o, () => c.scrollTop, v, V, () => e.height, Y], () => {
  570. if (!o.value || !l.value)
  571. return;
  572. let h = 0, b, H, X;
  573. const de = v.value.length, ge = v.value, ye = c.scrollTop, {
  574. itemHeight: xe,
  575. height: Me
  576. } = e, Ie = ye + Me;
  577. for (let pe = 0; pe < de; pe += 1) {
  578. const Le = ge[pe], He = m(Le);
  579. let Ke = O.get(He);
  580. Ke === void 0 && (Ke = xe);
  581. const De = h + Ke;
  582. b === void 0 && De >= ye && (b = pe, H = h), X === void 0 && De > Ie && (X = pe), h = De;
  583. }
  584. b === void 0 && (b = 0, H = 0, X = Math.ceil(Me / xe)), X === void 0 && (X = de - 1), X = Math.min(X + 1, de), w(T, {
  585. scrollHeight: h,
  586. start: b,
  587. end: X,
  588. offset: H
  589. });
  590. }, {
  591. immediate: !0
  592. });
  593. const B = E(() => T.scrollHeight - e.height);
  594. function Q(h) {
  595. let b = h;
  596. return Number.isNaN(B.value) || (b = Math.min(b, B.value)), b = Math.max(b, 0), b;
  597. }
  598. const q = E(() => c.scrollTop <= 0), A = E(() => c.scrollTop >= B.value), G = It(q, A);
  599. function Z(h) {
  600. j(h);
  601. }
  602. function z(h) {
  603. var b;
  604. const {
  605. scrollTop: H
  606. } = h.currentTarget;
  607. H !== c.scrollTop && j(H), (b = e.onScroll) === null || b === void 0 || b.call(e, h);
  608. }
  609. const [U, ee] = Ln(o, q, A, (h) => {
  610. j((b) => b + h);
  611. });
  612. Rn(o, f, (h, b) => G(h, b) ? !1 : (U({
  613. preventDefault() {
  614. },
  615. deltaY: h
  616. }), !0));
  617. function le(h) {
  618. o.value && h.preventDefault();
  619. }
  620. const se = () => {
  621. f.value && (f.value.removeEventListener("wheel", U, Ce ? {
  622. passive: !1
  623. } : !1), f.value.removeEventListener("DOMMouseScroll", ee), f.value.removeEventListener("MozMousePixelScroll", le));
  624. };
  625. Pe(() => {
  626. Ae(() => {
  627. f.value && (se(), f.value.addEventListener("wheel", U, Ce ? {
  628. passive: !1
  629. } : !1), f.value.addEventListener("DOMMouseScroll", ee), f.value.addEventListener("MozMousePixelScroll", le));
  630. });
  631. }), rt(() => {
  632. se();
  633. });
  634. const Se = Pn(f, v, O, e, m, N, j, () => {
  635. var h;
  636. (h = x.value) === null || h === void 0 || h.delayHidden();
  637. });
  638. n({
  639. scrollTo: Se
  640. });
  641. const ce = E(() => {
  642. let h = null;
  643. return e.height && (h = w({
  644. [e.fullHeight ? "height" : "maxHeight"]: e.height + "px"
  645. }, _n), o.value && (h.overflowY = "hidden", c.scrollMoving && (h.pointerEvents = "none"))), h;
  646. });
  647. return ie([() => T.start, () => T.end, v], () => {
  648. if (e.onVisibleChange) {
  649. const h = v.value.slice(T.start, T.end + 1);
  650. e.onVisibleChange(h, v.value);
  651. }
  652. }, {
  653. flush: "post"
  654. }), {
  655. state: c,
  656. mergedData: v,
  657. componentStyle: ce,
  658. onFallbackScroll: z,
  659. onScrollBar: Z,
  660. componentRef: f,
  661. useVirtual: o,
  662. calRes: T,
  663. collectHeight: N,
  664. setInstance: y,
  665. sharedConfig: D,
  666. scrollBarRef: x,
  667. fillerInnerRef: K,
  668. delayHideScrollBar: () => {
  669. var h;
  670. (h = x.value) === null || h === void 0 || h.delayHidden();
  671. }
  672. };
  673. },
  674. render() {
  675. const e = w(w({}, this.$props), this.$attrs), {
  676. prefixCls: t = "rc-virtual-list",
  677. height: n,
  678. itemHeight: o,
  679. // eslint-disable-next-line no-unused-vars
  680. fullHeight: l,
  681. data: c,
  682. itemKey: i,
  683. virtual: v,
  684. component: S = "div",
  685. onScroll: f,
  686. children: K = this.$slots.default,
  687. style: x,
  688. class: m
  689. } = e, D = Fn(e, ["prefixCls", "height", "itemHeight", "fullHeight", "data", "itemKey", "virtual", "component", "onScroll", "children", "style", "class"]), j = ue(t, m), {
  690. scrollTop: y
  691. } = this.state, {
  692. scrollHeight: N,
  693. offset: O,
  694. start: V,
  695. end: T
  696. } = this.calRes, {
  697. componentStyle: Y,
  698. onFallbackScroll: B,
  699. onScrollBar: Q,
  700. useVirtual: q,
  701. collectHeight: A,
  702. sharedConfig: G,
  703. setInstance: Z,
  704. mergedData: z,
  705. delayHideScrollBar: U
  706. } = this;
  707. return C("div", re({
  708. style: w(w({}, x), {
  709. position: "relative"
  710. }),
  711. class: j
  712. }, D), [C(S, {
  713. class: `${t}-holder`,
  714. style: Y,
  715. ref: "componentRef",
  716. onScroll: B,
  717. onMouseenter: U
  718. }, {
  719. default: () => [C(Je, {
  720. prefixCls: t,
  721. height: N,
  722. offset: O,
  723. onInnerResize: A,
  724. ref: "fillerInnerRef"
  725. }, {
  726. default: () => Bn(z, V, T, Z, K, G)
  727. })]
  728. }), q && C(Mn, {
  729. ref: "scrollBarRef",
  730. prefixCls: t,
  731. scrollTop: y,
  732. height: n,
  733. scrollHeight: N,
  734. count: z.length,
  735. onScroll: Q,
  736. onStartMove: () => {
  737. this.state.scrollMoving = !0;
  738. },
  739. onStopMove: () => {
  740. this.state.scrollMoving = !1;
  741. }
  742. }, null)]);
  743. }
  744. }), Lt = Symbol("TreeContextKey"), Yn = Ne({
  745. compatConfig: {
  746. MODE: 3
  747. },
  748. name: "TreeContext",
  749. props: {
  750. value: {
  751. type: Object
  752. }
  753. },
  754. setup(e, t) {
  755. let {
  756. slots: n
  757. } = t;
  758. return $t(Lt, E(() => e.value)), () => {
  759. var o;
  760. return (o = n.default) === null || o === void 0 ? void 0 : o.call(n);
  761. };
  762. }
  763. }), ct = () => Nt(Lt, E(() => ({}))), Ht = Symbol("KeysStateKey"), zn = (e) => {
  764. $t(Ht, e);
  765. }, Rt = () => Nt(Ht, {
  766. expandedKeys: L([]),
  767. selectedKeys: L([]),
  768. loadedKeys: L([]),
  769. loadingKeys: L([]),
  770. checkedKeys: L([]),
  771. halfCheckedKeys: L([]),
  772. expandedKeysSet: E(() => /* @__PURE__ */ new Set()),
  773. selectedKeysSet: E(() => /* @__PURE__ */ new Set()),
  774. loadedKeysSet: E(() => /* @__PURE__ */ new Set()),
  775. loadingKeysSet: E(() => /* @__PURE__ */ new Set()),
  776. checkedKeysSet: E(() => /* @__PURE__ */ new Set()),
  777. halfCheckedKeysSet: E(() => /* @__PURE__ */ new Set()),
  778. flattenNodes: L([])
  779. }), Vn = (e) => {
  780. let {
  781. prefixCls: t,
  782. level: n,
  783. isStart: o,
  784. isEnd: l
  785. } = e;
  786. const c = `${t}-indent-unit`, i = [];
  787. for (let v = 0; v < n; v += 1)
  788. i.push(C("span", {
  789. key: v,
  790. class: {
  791. [c]: !0,
  792. [`${c}-start`]: o[v],
  793. [`${c}-end`]: l[v]
  794. }
  795. }, null));
  796. return C("span", {
  797. "aria-hidden": "true",
  798. class: `${t}-indent`
  799. }, [i]);
  800. }, Ft = {
  801. eventKey: [String, Number],
  802. prefixCls: String,
  803. // By parent
  804. // expanded: { type: Boolean, default: undefined },
  805. // selected: { type: Boolean, default: undefined },
  806. // checked: { type: Boolean, default: undefined },
  807. // loaded: { type: Boolean, default: undefined },
  808. // loading: { type: Boolean, default: undefined },
  809. // halfChecked: { type: Boolean, default: undefined },
  810. // dragOver: { type: Boolean, default: undefined },
  811. // dragOverGapTop: { type: Boolean, default: undefined },
  812. // dragOverGapBottom: { type: Boolean, default: undefined },
  813. // pos: String,
  814. title: Ee.any,
  815. /** New added in Tree for easy data access */
  816. data: {
  817. type: Object,
  818. default: void 0
  819. },
  820. parent: {
  821. type: Object,
  822. default: void 0
  823. },
  824. isStart: {
  825. type: Array
  826. },
  827. isEnd: {
  828. type: Array
  829. },
  830. active: {
  831. type: Boolean,
  832. default: void 0
  833. },
  834. onMousemove: {
  835. type: Function
  836. },
  837. // By user
  838. isLeaf: {
  839. type: Boolean,
  840. default: void 0
  841. },
  842. checkable: {
  843. type: Boolean,
  844. default: void 0
  845. },
  846. selectable: {
  847. type: Boolean,
  848. default: void 0
  849. },
  850. disabled: {
  851. type: Boolean,
  852. default: void 0
  853. },
  854. disableCheckbox: {
  855. type: Boolean,
  856. default: void 0
  857. },
  858. icon: Ee.any,
  859. switcherIcon: Ee.any,
  860. domRef: {
  861. type: Function
  862. }
  863. }, Un = {
  864. prefixCls: {
  865. type: String
  866. },
  867. // data: { type: Array as PropType<FlattenNode[]> },
  868. motion: {
  869. type: Object
  870. },
  871. focusable: {
  872. type: Boolean
  873. },
  874. activeItem: {
  875. type: Object
  876. },
  877. focused: {
  878. type: Boolean
  879. },
  880. tabindex: {
  881. type: Number
  882. },
  883. checkable: {
  884. type: Boolean
  885. },
  886. selectable: {
  887. type: Boolean
  888. },
  889. disabled: {
  890. type: Boolean
  891. },
  892. // expandedKeys: { type: Array as PropType<Key[]> },
  893. // selectedKeys: { type: Array as PropType<Key[]> },
  894. // checkedKeys: { type: Array as PropType<Key[]> },
  895. // loadedKeys: { type: Array as PropType<Key[]> },
  896. // loadingKeys: { type: Array as PropType<Key[]> },
  897. // halfCheckedKeys: { type: Array as PropType<Key[]> },
  898. // keyEntities: { type: Object as PropType<Record<Key, DataEntity<DataNode>>> },
  899. // dragging: { type: Boolean as PropType<boolean> },
  900. // dragOverNodeKey: { type: [String, Number] as PropType<Key> },
  901. // dropPosition: { type: Number as PropType<number> },
  902. // Virtual list
  903. height: {
  904. type: Number
  905. },
  906. itemHeight: {
  907. type: Number
  908. },
  909. virtual: {
  910. type: Boolean
  911. },
  912. onScroll: {
  913. type: Function
  914. },
  915. onKeydown: {
  916. type: Function
  917. },
  918. onFocus: {
  919. type: Function
  920. },
  921. onBlur: {
  922. type: Function
  923. },
  924. onActiveChange: {
  925. type: Function
  926. },
  927. onContextmenu: {
  928. type: Function
  929. },
  930. onListChangeStart: {
  931. type: Function
  932. },
  933. onListChangeEnd: {
  934. type: Function
  935. }
  936. }, Wn = () => ({
  937. prefixCls: String,
  938. focusable: {
  939. type: Boolean,
  940. default: void 0
  941. },
  942. activeKey: [Number, String],
  943. tabindex: Number,
  944. children: Ee.any,
  945. treeData: {
  946. type: Array
  947. },
  948. fieldNames: {
  949. type: Object
  950. },
  951. showLine: {
  952. type: [Boolean, Object],
  953. default: void 0
  954. },
  955. showIcon: {
  956. type: Boolean,
  957. default: void 0
  958. },
  959. icon: Ee.any,
  960. selectable: {
  961. type: Boolean,
  962. default: void 0
  963. },
  964. expandAction: [String, Boolean],
  965. disabled: {
  966. type: Boolean,
  967. default: void 0
  968. },
  969. multiple: {
  970. type: Boolean,
  971. default: void 0
  972. },
  973. checkable: {
  974. type: Boolean,
  975. default: void 0
  976. },
  977. checkStrictly: {
  978. type: Boolean,
  979. default: void 0
  980. },
  981. draggable: {
  982. type: [Function, Boolean]
  983. },
  984. defaultExpandParent: {
  985. type: Boolean,
  986. default: void 0
  987. },
  988. autoExpandParent: {
  989. type: Boolean,
  990. default: void 0
  991. },
  992. defaultExpandAll: {
  993. type: Boolean,
  994. default: void 0
  995. },
  996. defaultExpandedKeys: {
  997. type: Array
  998. },
  999. expandedKeys: {
  1000. type: Array
  1001. },
  1002. defaultCheckedKeys: {
  1003. type: Array
  1004. },
  1005. checkedKeys: {
  1006. type: [Object, Array]
  1007. },
  1008. defaultSelectedKeys: {
  1009. type: Array
  1010. },
  1011. selectedKeys: {
  1012. type: Array
  1013. },
  1014. allowDrop: {
  1015. type: Function
  1016. },
  1017. dropIndicatorRender: {
  1018. type: Function
  1019. },
  1020. onFocus: {
  1021. type: Function
  1022. },
  1023. onBlur: {
  1024. type: Function
  1025. },
  1026. onKeydown: {
  1027. type: Function
  1028. },
  1029. onContextmenu: {
  1030. type: Function
  1031. },
  1032. onClick: {
  1033. type: Function
  1034. },
  1035. onDblclick: {
  1036. type: Function
  1037. },
  1038. onScroll: {
  1039. type: Function
  1040. },
  1041. onExpand: {
  1042. type: Function
  1043. },
  1044. onCheck: {
  1045. type: Function
  1046. },
  1047. onSelect: {
  1048. type: Function
  1049. },
  1050. onLoad: {
  1051. type: Function
  1052. },
  1053. loadData: {
  1054. type: Function
  1055. },
  1056. loadedKeys: {
  1057. type: Array
  1058. },
  1059. onMouseenter: {
  1060. type: Function
  1061. },
  1062. onMouseleave: {
  1063. type: Function
  1064. },
  1065. onRightClick: {
  1066. type: Function
  1067. },
  1068. onDragstart: {
  1069. type: Function
  1070. },
  1071. onDragenter: {
  1072. type: Function
  1073. },
  1074. onDragover: {
  1075. type: Function
  1076. },
  1077. onDragleave: {
  1078. type: Function
  1079. },
  1080. onDragend: {
  1081. type: Function
  1082. },
  1083. onDrop: {
  1084. type: Function
  1085. },
  1086. /**
  1087. * Used for `rc-tree-select` only.
  1088. * Do not use in your production code directly since this will be refactor.
  1089. */
  1090. onActiveChange: {
  1091. type: Function
  1092. },
  1093. filterTreeNode: {
  1094. type: Function
  1095. },
  1096. motion: Ee.any,
  1097. switcherIcon: Ee.any,
  1098. // Virtual List
  1099. height: Number,
  1100. itemHeight: Number,
  1101. virtual: {
  1102. type: Boolean,
  1103. default: void 0
  1104. },
  1105. // direction for drag logic
  1106. direction: {
  1107. type: String
  1108. },
  1109. rootClassName: String,
  1110. rootStyle: Object
  1111. });
  1112. var Gn = function(e, t) {
  1113. var n = {};
  1114. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  1115. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
  1116. t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  1117. return n;
  1118. };
  1119. const yt = "open", pt = "close", Xn = "---", mt = Ne({
  1120. compatConfig: {
  1121. MODE: 3
  1122. },
  1123. name: "ATreeNode",
  1124. inheritAttrs: !1,
  1125. props: Ft,
  1126. isTreeNode: 1,
  1127. setup(e, t) {
  1128. let {
  1129. attrs: n,
  1130. slots: o,
  1131. expose: l
  1132. } = t;
  1133. Ue(!("slots" in e.data), `treeData slots is deprecated, please use ${Object.keys(e.data.slots || {}).map((a) => "`v-slot:" + a + "` ")}instead`);
  1134. const c = L(!1), i = ct(), {
  1135. expandedKeysSet: v,
  1136. selectedKeysSet: S,
  1137. loadedKeysSet: f,
  1138. loadingKeysSet: K,
  1139. checkedKeysSet: x,
  1140. halfCheckedKeysSet: m
  1141. } = Rt(), {
  1142. dragOverNodeKey: D,
  1143. dropPosition: j,
  1144. keyEntities: y
  1145. } = i.value, N = E(() => Ge(e.eventKey, {
  1146. expandedKeysSet: v.value,
  1147. selectedKeysSet: S.value,
  1148. loadedKeysSet: f.value,
  1149. loadingKeysSet: K.value,
  1150. checkedKeysSet: x.value,
  1151. halfCheckedKeysSet: m.value,
  1152. dragOverNodeKey: D,
  1153. dropPosition: j,
  1154. keyEntities: y
  1155. })), O = he(() => N.value.expanded), V = he(() => N.value.selected), T = he(() => N.value.checked), Y = he(() => N.value.loaded), B = he(() => N.value.loading), Q = he(() => N.value.halfChecked), q = he(() => N.value.dragOver), A = he(() => N.value.dragOverGapTop), G = he(() => N.value.dragOverGapBottom), Z = he(() => N.value.pos), z = L(), U = E(() => {
  1156. const {
  1157. eventKey: a
  1158. } = e, {
  1159. keyEntities: d
  1160. } = i.value, {
  1161. children: R
  1162. } = d[a] || {};
  1163. return !!(R || []).length;
  1164. }), ee = E(() => {
  1165. const {
  1166. isLeaf: a
  1167. } = e, {
  1168. loadData: d
  1169. } = i.value, R = U.value;
  1170. return a === !1 ? !1 : a || !d && !R || d && Y.value && !R;
  1171. }), le = E(() => ee.value ? null : O.value ? yt : pt), se = E(() => {
  1172. const {
  1173. disabled: a
  1174. } = e, {
  1175. disabled: d
  1176. } = i.value;
  1177. return !!(d || a);
  1178. }), Se = E(() => {
  1179. const {
  1180. checkable: a
  1181. } = e, {
  1182. checkable: d
  1183. } = i.value;
  1184. return !d || a === !1 ? !1 : d;
  1185. }), ce = E(() => {
  1186. const {
  1187. selectable: a
  1188. } = e, {
  1189. selectable: d
  1190. } = i.value;
  1191. return typeof a == "boolean" ? a : d;
  1192. }), W = E(() => {
  1193. const {
  1194. data: a,
  1195. active: d,
  1196. checkable: R,
  1197. disableCheckbox: J,
  1198. disabled: te,
  1199. selectable: ne
  1200. } = e;
  1201. return w(w({
  1202. active: d,
  1203. checkable: R,
  1204. disableCheckbox: J,
  1205. disabled: te,
  1206. selectable: ne
  1207. }, a), {
  1208. dataRef: a,
  1209. data: a,
  1210. isLeaf: ee.value,
  1211. checked: T.value,
  1212. expanded: O.value,
  1213. loading: B.value,
  1214. selected: V.value,
  1215. halfChecked: Q.value
  1216. });
  1217. }), h = pn(), b = E(() => {
  1218. const {
  1219. eventKey: a
  1220. } = e, {
  1221. keyEntities: d
  1222. } = i.value, {
  1223. parent: R
  1224. } = d[a] || {};
  1225. return w(w({}, Xe(w({}, e, N.value))), {
  1226. parent: R
  1227. });
  1228. }), H = _e({
  1229. eventData: b,
  1230. eventKey: E(() => e.eventKey),
  1231. selectHandle: z,
  1232. pos: Z,
  1233. key: h.vnode.key
  1234. });
  1235. l(H);
  1236. const X = (a) => {
  1237. const {
  1238. onNodeDoubleClick: d
  1239. } = i.value;
  1240. d(a, b.value);
  1241. }, de = (a) => {
  1242. if (se.value) return;
  1243. const {
  1244. onNodeSelect: d
  1245. } = i.value;
  1246. a.preventDefault(), d(a, b.value);
  1247. }, ge = (a) => {
  1248. if (se.value) return;
  1249. const {
  1250. disableCheckbox: d
  1251. } = e, {
  1252. onNodeCheck: R
  1253. } = i.value;
  1254. if (!Se.value || d) return;
  1255. a.preventDefault();
  1256. const J = !T.value;
  1257. R(a, b.value, J);
  1258. }, ye = (a) => {
  1259. const {
  1260. onNodeClick: d
  1261. } = i.value;
  1262. d(a, b.value), ce.value ? de(a) : ge(a);
  1263. }, xe = (a) => {
  1264. const {
  1265. onNodeMouseEnter: d
  1266. } = i.value;
  1267. d(a, b.value);
  1268. }, Me = (a) => {
  1269. const {
  1270. onNodeMouseLeave: d
  1271. } = i.value;
  1272. d(a, b.value);
  1273. }, Ie = (a) => {
  1274. const {
  1275. onNodeContextMenu: d
  1276. } = i.value;
  1277. d(a, b.value);
  1278. }, pe = (a) => {
  1279. const {
  1280. onNodeDragStart: d
  1281. } = i.value;
  1282. a.stopPropagation(), c.value = !0, d(a, H);
  1283. try {
  1284. a.dataTransfer.setData("text/plain", "");
  1285. } catch (R) {
  1286. }
  1287. }, Le = (a) => {
  1288. const {
  1289. onNodeDragEnter: d
  1290. } = i.value;
  1291. a.preventDefault(), a.stopPropagation(), d(a, H);
  1292. }, He = (a) => {
  1293. const {
  1294. onNodeDragOver: d
  1295. } = i.value;
  1296. a.preventDefault(), a.stopPropagation(), d(a, H);
  1297. }, Ke = (a) => {
  1298. const {
  1299. onNodeDragLeave: d
  1300. } = i.value;
  1301. a.stopPropagation(), d(a, H);
  1302. }, De = (a) => {
  1303. const {
  1304. onNodeDragEnd: d
  1305. } = i.value;
  1306. a.stopPropagation(), c.value = !1, d(a, H);
  1307. }, Qe = (a) => {
  1308. const {
  1309. onNodeDrop: d
  1310. } = i.value;
  1311. a.preventDefault(), a.stopPropagation(), c.value = !1, d(a, H);
  1312. }, Be = (a) => {
  1313. const {
  1314. onNodeExpand: d
  1315. } = i.value;
  1316. B.value || d(a, b.value);
  1317. }, je = () => {
  1318. const {
  1319. data: a
  1320. } = e, {
  1321. draggable: d
  1322. } = i.value;
  1323. return !!(d && (!d.nodeDraggable || d.nodeDraggable(a)));
  1324. }, Ye = () => {
  1325. const {
  1326. draggable: a,
  1327. prefixCls: d
  1328. } = i.value;
  1329. return a && (a != null && a.icon) ? C("span", {
  1330. class: `${d}-draggable-icon`
  1331. }, [a.icon]) : null;
  1332. }, Ze = () => {
  1333. var a, d, R;
  1334. const {
  1335. switcherIcon: J = o.switcherIcon || ((a = i.value.slots) === null || a === void 0 ? void 0 : a[(R = (d = e.data) === null || d === void 0 ? void 0 : d.slots) === null || R === void 0 ? void 0 : R.switcherIcon])
  1336. } = e, {
  1337. switcherIcon: te
  1338. } = i.value, ne = J || te;
  1339. return typeof ne == "function" ? ne(W.value) : ne;
  1340. }, ze = () => {
  1341. const {
  1342. loadData: a,
  1343. onNodeLoad: d
  1344. } = i.value;
  1345. B.value || a && O.value && !ee.value && !U.value && !Y.value && d(b.value);
  1346. };
  1347. qe(() => {
  1348. ze();
  1349. }), Tt(() => {
  1350. ze();
  1351. });
  1352. const et = () => {
  1353. const {
  1354. prefixCls: a
  1355. } = i.value, d = Ze();
  1356. if (ee.value)
  1357. return d !== !1 ? C("span", {
  1358. class: ue(`${a}-switcher`, `${a}-switcher-noop`)
  1359. }, [d]) : null;
  1360. const R = ue(`${a}-switcher`, `${a}-switcher_${O.value ? yt : pt}`);
  1361. return d !== !1 ? C("span", {
  1362. onClick: Be,
  1363. class: R
  1364. }, [d]) : null;
  1365. }, tt = () => {
  1366. var a, d;
  1367. const {
  1368. disableCheckbox: R
  1369. } = e, {
  1370. prefixCls: J
  1371. } = i.value, te = se.value;
  1372. return Se.value ? C("span", {
  1373. class: ue(`${J}-checkbox`, T.value && `${J}-checkbox-checked`, !T.value && Q.value && `${J}-checkbox-indeterminate`, (te || R) && `${J}-checkbox-disabled`),
  1374. onClick: ge
  1375. }, [(d = (a = i.value).customCheckable) === null || d === void 0 ? void 0 : d.call(a)]) : null;
  1376. }, Ve = () => {
  1377. const {
  1378. prefixCls: a
  1379. } = i.value;
  1380. return C("span", {
  1381. class: ue(`${a}-iconEle`, `${a}-icon__${le.value || "docu"}`, B.value && `${a}-icon_loading`)
  1382. }, null);
  1383. }, Te = () => {
  1384. const {
  1385. disabled: a,
  1386. eventKey: d
  1387. } = e, {
  1388. draggable: R,
  1389. dropLevelOffset: J,
  1390. dropPosition: te,
  1391. prefixCls: ne,
  1392. indent: s,
  1393. dropIndicatorRender: r,
  1394. dragOverNodeKey: u,
  1395. direction: p
  1396. } = i.value;
  1397. return !a && R !== !1 && u === d ? r({
  1398. dropPosition: te,
  1399. dropLevelOffset: J,
  1400. indent: s,
  1401. prefixCls: ne,
  1402. direction: p
  1403. }) : null;
  1404. }, nt = () => {
  1405. var a, d, R, J, te, ne;
  1406. const {
  1407. // title = slots.title ||
  1408. // context.value.slots?.[props.data?.slots?.title] ||
  1409. // context.value.slots?.title,
  1410. // selected,
  1411. icon: s = o.icon,
  1412. // loading,
  1413. data: r
  1414. } = e, u = o.title || ((a = i.value.slots) === null || a === void 0 ? void 0 : a[(R = (d = e.data) === null || d === void 0 ? void 0 : d.slots) === null || R === void 0 ? void 0 : R.title]) || ((J = i.value.slots) === null || J === void 0 ? void 0 : J.title) || e.title, {
  1415. prefixCls: p,
  1416. showIcon: $,
  1417. icon: k,
  1418. loadData: g
  1419. // slots: contextSlots,
  1420. } = i.value, I = se.value, _ = `${p}-node-content-wrapper`;
  1421. let M;
  1422. if ($) {
  1423. const oe = s || ((te = i.value.slots) === null || te === void 0 ? void 0 : te[(ne = r == null ? void 0 : r.slots) === null || ne === void 0 ? void 0 : ne.icon]) || k;
  1424. M = oe ? C("span", {
  1425. class: ue(`${p}-iconEle`, `${p}-icon__customize`)
  1426. }, [typeof oe == "function" ? oe(W.value) : oe]) : Ve();
  1427. } else g && B.value && (M = Ve());
  1428. let P;
  1429. typeof u == "function" ? P = u(W.value) : P = u, P = P === void 0 ? Xn : P;
  1430. const F = C("span", {
  1431. class: `${p}-title`
  1432. }, [P]);
  1433. return C("span", {
  1434. ref: z,
  1435. title: typeof u == "string" ? u : "",
  1436. class: ue(`${_}`, `${_}-${le.value || "normal"}`, !I && (V.value || c.value) && `${p}-node-selected`),
  1437. onMouseenter: xe,
  1438. onMouseleave: Me,
  1439. onContextmenu: Ie,
  1440. onClick: ye,
  1441. onDblclick: X
  1442. }, [M, F, Te()]);
  1443. };
  1444. return () => {
  1445. const a = w(w({}, e), n), {
  1446. eventKey: d,
  1447. isLeaf: R,
  1448. isStart: J,
  1449. isEnd: te,
  1450. domRef: ne,
  1451. active: s,
  1452. data: r,
  1453. onMousemove: u,
  1454. selectable: p
  1455. } = a, $ = Gn(a, ["eventKey", "isLeaf", "isStart", "isEnd", "domRef", "active", "data", "onMousemove", "selectable"]), {
  1456. prefixCls: k,
  1457. filterTreeNode: g,
  1458. keyEntities: I,
  1459. dropContainerKey: _,
  1460. dropTargetKey: M,
  1461. draggingNodeKey: P
  1462. } = i.value, F = se.value, oe = Ot($, {
  1463. aria: !0,
  1464. data: !0
  1465. }), {
  1466. level: fe
  1467. } = I[d] || {}, ve = te[te.length - 1], ae = je(), ke = !F && ae, Re = P === d, ot = p !== void 0 ? {
  1468. "aria-selected": !!p
  1469. } : void 0;
  1470. return C("div", re(re({
  1471. ref: ne,
  1472. class: ue(n.class, `${k}-treenode`, {
  1473. [`${k}-treenode-disabled`]: F,
  1474. [`${k}-treenode-switcher-${O.value ? "open" : "close"}`]: !R,
  1475. [`${k}-treenode-checkbox-checked`]: T.value,
  1476. [`${k}-treenode-checkbox-indeterminate`]: Q.value,
  1477. [`${k}-treenode-selected`]: V.value,
  1478. [`${k}-treenode-loading`]: B.value,
  1479. [`${k}-treenode-active`]: s,
  1480. [`${k}-treenode-leaf-last`]: ve,
  1481. [`${k}-treenode-draggable`]: ke,
  1482. dragging: Re,
  1483. "drop-target": M === d,
  1484. "drop-container": _ === d,
  1485. "drag-over": !F && q.value,
  1486. "drag-over-gap-top": !F && A.value,
  1487. "drag-over-gap-bottom": !F && G.value,
  1488. "filter-node": g && g(b.value)
  1489. }),
  1490. style: n.style,
  1491. draggable: ke,
  1492. "aria-grabbed": Re,
  1493. onDragstart: ke ? pe : void 0,
  1494. onDragenter: ae ? Le : void 0,
  1495. onDragover: ae ? He : void 0,
  1496. onDragleave: ae ? Ke : void 0,
  1497. onDrop: ae ? Qe : void 0,
  1498. onDragend: ae ? De : void 0,
  1499. onMousemove: u
  1500. }, ot), oe), [C(Vn, {
  1501. prefixCls: k,
  1502. level: fe,
  1503. isStart: J,
  1504. isEnd: te
  1505. }, null), Ye(), et(), tt(), nt()]);
  1506. };
  1507. }
  1508. });
  1509. var bt = function(e, t) {
  1510. var n = {};
  1511. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  1512. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
  1513. t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  1514. return n;
  1515. };
  1516. const qn = Ne({
  1517. compatConfig: {
  1518. MODE: 3
  1519. },
  1520. name: "MotionTreeNode",
  1521. inheritAttrs: !1,
  1522. props: w(w({}, Ft), {
  1523. active: Boolean,
  1524. motion: Object,
  1525. motionNodes: {
  1526. type: Array
  1527. },
  1528. onMotionStart: Function,
  1529. onMotionEnd: Function,
  1530. motionType: String
  1531. }),
  1532. setup(e, t) {
  1533. let {
  1534. attrs: n,
  1535. slots: o
  1536. } = t;
  1537. const l = L(!0), c = ct(), i = L(!1), v = E(() => e.motion ? e.motion : nn()), S = (f, K) => {
  1538. var x, m, D, j;
  1539. K === "appear" ? (m = (x = v.value) === null || x === void 0 ? void 0 : x.onAfterEnter) === null || m === void 0 || m.call(x, f) : K === "leave" && ((j = (D = v.value) === null || D === void 0 ? void 0 : D.onAfterLeave) === null || j === void 0 || j.call(D, f)), i.value || e.onMotionEnd(), i.value = !0;
  1540. };
  1541. return ie(() => e.motionNodes, () => {
  1542. e.motionNodes && e.motionType === "hide" && l.value && Ae(() => {
  1543. l.value = !1;
  1544. });
  1545. }, {
  1546. immediate: !0,
  1547. flush: "post"
  1548. }), qe(() => {
  1549. e.motionNodes && e.onMotionStart();
  1550. }), rt(() => {
  1551. e.motionNodes && S();
  1552. }), () => {
  1553. const {
  1554. motion: f,
  1555. motionNodes: K,
  1556. motionType: x,
  1557. active: m,
  1558. eventKey: D
  1559. } = e, j = bt(e, ["motion", "motionNodes", "motionType", "active", "eventKey"]);
  1560. return K ? C(mn, re(re({}, v.value), {}, {
  1561. appear: x === "show",
  1562. onAfterAppear: (y) => S(y, "appear"),
  1563. onAfterLeave: (y) => S(y, "leave")
  1564. }), {
  1565. default: () => [bn(C("div", {
  1566. class: `${c.value.prefixCls}-treenode-motion`
  1567. }, [K.map((y) => {
  1568. const N = bt(y.data, []), {
  1569. title: O,
  1570. key: V,
  1571. isStart: T,
  1572. isEnd: Y
  1573. } = y;
  1574. return delete N.children, C(mt, re(re({}, N), {}, {
  1575. title: O,
  1576. active: m,
  1577. data: y.data,
  1578. key: V,
  1579. eventKey: V,
  1580. isStart: T,
  1581. isEnd: Y
  1582. }), o);
  1583. })]), [[Sn, l.value]])]
  1584. }) : C(mt, re(re({
  1585. class: n.class,
  1586. style: n.style
  1587. }, j), {}, {
  1588. active: m,
  1589. eventKey: D
  1590. }), o);
  1591. };
  1592. }
  1593. });
  1594. function Jn() {
  1595. let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  1596. const n = e.length, o = t.length;
  1597. if (Math.abs(n - o) !== 1)
  1598. return {
  1599. add: !1,
  1600. key: null
  1601. };
  1602. function l(c, i) {
  1603. const v = /* @__PURE__ */ new Map();
  1604. c.forEach((f) => {
  1605. v.set(f, !0);
  1606. });
  1607. const S = i.filter((f) => !v.has(f));
  1608. return S.length === 1 ? S[0] : null;
  1609. }
  1610. return n < o ? {
  1611. add: !0,
  1612. key: l(e, t)
  1613. } : {
  1614. add: !1,
  1615. key: l(t, e)
  1616. };
  1617. }
  1618. function St(e, t, n) {
  1619. const o = e.findIndex((i) => i.key === n), l = e[o + 1], c = t.findIndex((i) => i.key === n);
  1620. if (l) {
  1621. const i = t.findIndex((v) => v.key === l.key);
  1622. return t.slice(c + 1, i);
  1623. }
  1624. return t.slice(c + 1);
  1625. }
  1626. var xt = function(e, t) {
  1627. var n = {};
  1628. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  1629. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
  1630. t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
  1631. return n;
  1632. };
  1633. const Kt = {
  1634. width: 0,
  1635. height: 0,
  1636. display: "flex",
  1637. overflow: "hidden",
  1638. opacity: 0,
  1639. border: 0,
  1640. padding: 0,
  1641. margin: 0
  1642. }, Qn = () => {
  1643. }, $e = `RC_TREE_MOTION_${Math.random()}`, st = {
  1644. key: $e
  1645. }, At = {
  1646. key: $e,
  1647. level: 0,
  1648. index: 0,
  1649. pos: "0",
  1650. node: st,
  1651. nodes: [st]
  1652. }, kt = {
  1653. parent: null,
  1654. children: [],
  1655. pos: At.pos,
  1656. data: st,
  1657. title: null,
  1658. key: $e,
  1659. /** Hold empty list here since we do not use it */
  1660. isStart: [],
  1661. isEnd: []
  1662. };
  1663. function wt(e, t, n, o) {
  1664. return t === !1 || !n ? e : e.slice(0, Math.ceil(n / o) + 1);
  1665. }
  1666. function Ct(e) {
  1667. const {
  1668. key: t,
  1669. pos: n
  1670. } = e;
  1671. return Mt(t, n);
  1672. }
  1673. function Zn(e) {
  1674. let t = String(e.key), n = e;
  1675. for (; n.parent; )
  1676. n = n.parent, t = `${n.key} > ${t}`;
  1677. return t;
  1678. }
  1679. const eo = Ne({
  1680. compatConfig: {
  1681. MODE: 3
  1682. },
  1683. name: "NodeList",
  1684. inheritAttrs: !1,
  1685. props: Un,
  1686. setup(e, t) {
  1687. let {
  1688. expose: n,
  1689. attrs: o
  1690. } = t;
  1691. const l = We(), c = We(), {
  1692. expandedKeys: i,
  1693. flattenNodes: v
  1694. } = Rt();
  1695. n({
  1696. scrollTo: (y) => {
  1697. l.value.scrollTo(y);
  1698. },
  1699. getIndentWidth: () => c.value.offsetWidth
  1700. });
  1701. const S = L(v.value), f = L([]), K = We(null);
  1702. function x() {
  1703. S.value = v.value, f.value = [], K.value = null, e.onListChangeEnd();
  1704. }
  1705. const m = ct();
  1706. ie([() => i.value.slice(), v], (y, N) => {
  1707. let [O, V] = y, [T, Y] = N;
  1708. const B = Jn(T, O);
  1709. if (B.key !== null) {
  1710. const {
  1711. virtual: Q,
  1712. height: q,
  1713. itemHeight: A
  1714. } = e;
  1715. if (B.add) {
  1716. const G = Y.findIndex((U) => {
  1717. let {
  1718. key: ee
  1719. } = U;
  1720. return ee === B.key;
  1721. }), Z = wt(St(Y, V, B.key), Q, q, A), z = Y.slice();
  1722. z.splice(G + 1, 0, kt), S.value = z, f.value = Z, K.value = "show";
  1723. } else {
  1724. const G = V.findIndex((U) => {
  1725. let {
  1726. key: ee
  1727. } = U;
  1728. return ee === B.key;
  1729. }), Z = wt(St(V, Y, B.key), Q, q, A), z = V.slice();
  1730. z.splice(G + 1, 0, kt), S.value = z, f.value = Z, K.value = "hide";
  1731. }
  1732. } else Y !== V && (S.value = V);
  1733. }), ie(() => m.value.dragging, (y) => {
  1734. y || x();
  1735. });
  1736. const D = E(() => e.motion === void 0 ? S.value : v.value), j = () => {
  1737. e.onActiveChange(null);
  1738. };
  1739. return () => {
  1740. const y = w(w({}, e), o), {
  1741. prefixCls: N,
  1742. selectable: O,
  1743. checkable: V,
  1744. disabled: T,
  1745. motion: Y,
  1746. height: B,
  1747. itemHeight: Q,
  1748. virtual: q,
  1749. focusable: A,
  1750. activeItem: G,
  1751. focused: Z,
  1752. tabindex: z,
  1753. onKeydown: U,
  1754. onFocus: ee,
  1755. onBlur: le,
  1756. onListChangeStart: se,
  1757. onListChangeEnd: Se
  1758. } = y, ce = xt(y, ["prefixCls", "selectable", "checkable", "disabled", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabindex", "onKeydown", "onFocus", "onBlur", "onListChangeStart", "onListChangeEnd"]);
  1759. return C(xn, null, [Z && G && C("span", {
  1760. style: Kt,
  1761. "aria-live": "assertive"
  1762. }, [Zn(G)]), C("div", null, [C("input", {
  1763. style: Kt,
  1764. disabled: A === !1 || T,
  1765. tabindex: A !== !1 ? z : null,
  1766. onKeydown: U,
  1767. onFocus: ee,
  1768. onBlur: le,
  1769. value: "",
  1770. onChange: Qn,
  1771. "aria-label": "for screen reader"
  1772. }, null)]), C("div", {
  1773. class: `${N}-treenode`,
  1774. "aria-hidden": !0,
  1775. style: {
  1776. position: "absolute",
  1777. pointerEvents: "none",
  1778. visibility: "hidden",
  1779. height: 0,
  1780. overflow: "hidden"
  1781. }
  1782. }, [C("div", {
  1783. class: `${N}-indent`
  1784. }, [C("div", {
  1785. ref: c,
  1786. class: `${N}-indent-unit`
  1787. }, null)])]), C(jn, re(re({}, on(ce, ["onActiveChange"])), {}, {
  1788. data: D.value,
  1789. itemKey: Ct,
  1790. height: B,
  1791. fullHeight: !1,
  1792. virtual: q,
  1793. itemHeight: Q,
  1794. prefixCls: `${N}-list`,
  1795. ref: l,
  1796. onVisibleChange: (W, h) => {
  1797. const b = new Set(W);
  1798. h.filter((X) => !b.has(X)).some((X) => Ct(X) === $e) && x();
  1799. }
  1800. }), {
  1801. default: (W) => {
  1802. const {
  1803. pos: h
  1804. } = W, b = xt(W.data, []), {
  1805. title: H,
  1806. key: X,
  1807. isStart: de,
  1808. isEnd: ge
  1809. } = W, ye = Mt(X, h);
  1810. return delete b.key, delete b.children, C(qn, re(re({}, b), {}, {
  1811. eventKey: ye,
  1812. title: H,
  1813. active: !!G && X === G.key,
  1814. data: W.data,
  1815. isStart: de,
  1816. isEnd: ge,
  1817. motion: Y,
  1818. motionNodes: X === $e ? f.value : null,
  1819. motionType: K.value,
  1820. onMotionStart: se,
  1821. onMotionEnd: x,
  1822. onMousemove: j
  1823. }), null);
  1824. }
  1825. })]);
  1826. };
  1827. }
  1828. });
  1829. function to(e) {
  1830. let {
  1831. dropPosition: t,
  1832. dropLevelOffset: n,
  1833. indent: o
  1834. } = e;
  1835. const l = {
  1836. pointerEvents: "none",
  1837. position: "absolute",
  1838. right: 0,
  1839. backgroundColor: "red",
  1840. height: "2px"
  1841. };
  1842. switch (t) {
  1843. case -1:
  1844. l.top = 0, l.left = `${-n * o}px`;
  1845. break;
  1846. case 1:
  1847. l.bottom = 0, l.left = `${-n * o}px`;
  1848. break;
  1849. case 0:
  1850. l.bottom = 0, l.left = `${o}`;
  1851. break;
  1852. }
  1853. return C("div", {
  1854. style: l
  1855. }, null);
  1856. }
  1857. const no = 10, ho = Ne({
  1858. compatConfig: {
  1859. MODE: 3
  1860. },
  1861. name: "Tree",
  1862. inheritAttrs: !1,
  1863. props: ln(Wn(), {
  1864. prefixCls: "vc-tree",
  1865. showLine: !1,
  1866. showIcon: !0,
  1867. selectable: !0,
  1868. multiple: !1,
  1869. checkable: !1,
  1870. disabled: !1,
  1871. checkStrictly: !1,
  1872. draggable: !1,
  1873. expandAction: !1,
  1874. defaultExpandParent: !0,
  1875. autoExpandParent: !1,
  1876. defaultExpandAll: !1,
  1877. defaultExpandedKeys: [],
  1878. defaultCheckedKeys: [],
  1879. defaultSelectedKeys: [],
  1880. dropIndicatorRender: to,
  1881. allowDrop: () => !0
  1882. }),
  1883. setup(e, t) {
  1884. let {
  1885. attrs: n,
  1886. slots: o,
  1887. expose: l
  1888. } = t;
  1889. const c = L(!1);
  1890. let i = {};
  1891. const v = L(), S = L([]), f = L([]), K = L([]), x = L([]), m = L([]), D = L([]), j = {}, y = _e({
  1892. draggingNodeKey: null,
  1893. dragChildrenKeys: [],
  1894. // dropTargetKey is the key of abstract-drop-node
  1895. // the abstract-drop-node is the real drop node when drag and drop
  1896. // not the DOM drag over node
  1897. dropTargetKey: null,
  1898. dropPosition: null,
  1899. dropContainerKey: null,
  1900. dropLevelOffset: null,
  1901. dropTargetPos: null,
  1902. dropAllowed: !0,
  1903. // the abstract-drag-over-node
  1904. // if mouse is on the bottom of top dom node or no the top of the bottom dom node
  1905. // abstract-drag-over-node is the top node
  1906. dragOverNodeKey: null
  1907. }), N = L([]);
  1908. ie([() => e.treeData, () => e.children], () => {
  1909. N.value = e.treeData !== void 0 ? e.treeData.slice() : Kn(it(e.children));
  1910. }, {
  1911. immediate: !0,
  1912. deep: !0
  1913. });
  1914. const O = L({}), V = L(!1), T = L(null), Y = L(!1), B = E(() => kn(e.fieldNames)), Q = L();
  1915. let q = null, A = null, G = null;
  1916. const Z = E(() => ({
  1917. expandedKeysSet: z.value,
  1918. selectedKeysSet: U.value,
  1919. loadedKeysSet: ee.value,
  1920. loadingKeysSet: le.value,
  1921. checkedKeysSet: se.value,
  1922. halfCheckedKeysSet: Se.value,
  1923. dragOverNodeKey: y.dragOverNodeKey,
  1924. dropPosition: y.dropPosition,
  1925. keyEntities: O.value
  1926. })), z = E(() => new Set(D.value)), U = E(() => new Set(S.value)), ee = E(() => new Set(x.value)), le = E(() => new Set(m.value)), se = E(() => new Set(f.value)), Se = E(() => new Set(K.value));
  1927. Pe(() => {
  1928. if (N.value) {
  1929. const s = wn(N.value, {
  1930. fieldNames: B.value
  1931. });
  1932. O.value = w({
  1933. [$e]: At
  1934. }, s.keyEntities);
  1935. }
  1936. });
  1937. let ce = !1;
  1938. ie(
  1939. [() => e.expandedKeys, () => e.autoExpandParent, O],
  1940. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  1941. (s, r) => {
  1942. let [u, p] = s, [$, k] = r, g = D.value;
  1943. if (e.expandedKeys !== void 0 || ce && p !== k)
  1944. g = e.autoExpandParent || !ce && e.defaultExpandParent ? ft(e.expandedKeys, O.value) : e.expandedKeys;
  1945. else if (!ce && e.defaultExpandAll) {
  1946. const I = w({}, O.value);
  1947. delete I[$e], g = Object.keys(I).map((_) => I[_].key);
  1948. } else !ce && e.defaultExpandedKeys && (g = e.autoExpandParent || e.defaultExpandParent ? ft(e.defaultExpandedKeys, O.value) : e.defaultExpandedKeys);
  1949. g && (D.value = g), ce = !0;
  1950. },
  1951. {
  1952. immediate: !0
  1953. }
  1954. );
  1955. const W = L([]);
  1956. Pe(() => {
  1957. W.value = Cn(N.value, D.value, B.value);
  1958. }), Pe(() => {
  1959. e.selectable && (e.selectedKeys !== void 0 ? S.value = vt(e.selectedKeys, e) : !ce && e.defaultSelectedKeys && (S.value = vt(e.defaultSelectedKeys, e)));
  1960. });
  1961. const {
  1962. maxLevel: h,
  1963. levelEntities: b
  1964. } = En(O);
  1965. Pe(() => {
  1966. if (e.checkable) {
  1967. let s;
  1968. if (e.checkedKeys !== void 0 ? s = lt(e.checkedKeys) || {} : !ce && e.defaultCheckedKeys ? s = lt(e.defaultCheckedKeys) || {} : N.value && (s = lt(e.checkedKeys) || {
  1969. checkedKeys: f.value,
  1970. halfCheckedKeys: K.value
  1971. }), s) {
  1972. let {
  1973. checkedKeys: r = [],
  1974. halfCheckedKeys: u = []
  1975. } = s;
  1976. e.checkStrictly || ({
  1977. checkedKeys: r,
  1978. halfCheckedKeys: u
  1979. } = at(r, !0, O.value, h.value, b.value)), f.value = r, K.value = u;
  1980. }
  1981. }
  1982. }), Pe(() => {
  1983. e.loadedKeys && (x.value = e.loadedKeys);
  1984. });
  1985. const H = () => {
  1986. w(y, {
  1987. dragOverNodeKey: null,
  1988. dropPosition: null,
  1989. dropLevelOffset: null,
  1990. dropTargetKey: null,
  1991. dropContainerKey: null,
  1992. dropTargetPos: null,
  1993. dropAllowed: !1
  1994. });
  1995. }, X = (s) => {
  1996. Q.value.scrollTo(s);
  1997. };
  1998. ie(() => e.activeKey, () => {
  1999. e.activeKey !== void 0 && (T.value = e.activeKey);
  2000. }, {
  2001. immediate: !0
  2002. }), ie(T, (s) => {
  2003. Ae(() => {
  2004. s !== null && X({
  2005. key: s
  2006. });
  2007. });
  2008. }, {
  2009. immediate: !0,
  2010. flush: "post"
  2011. });
  2012. const de = (s) => {
  2013. e.expandedKeys === void 0 && (D.value = s);
  2014. }, ge = () => {
  2015. y.draggingNodeKey !== null && w(y, {
  2016. draggingNodeKey: null,
  2017. dropPosition: null,
  2018. dropContainerKey: null,
  2019. dropTargetKey: null,
  2020. dropLevelOffset: null,
  2021. dropAllowed: !0,
  2022. dragOverNodeKey: null
  2023. }), q = null, G = null;
  2024. }, ye = (s, r) => {
  2025. const {
  2026. onDragend: u
  2027. } = e;
  2028. y.dragOverNodeKey = null, ge(), u == null || u({
  2029. event: s,
  2030. node: r.eventData
  2031. }), A = null;
  2032. }, xe = (s) => {
  2033. ye(s, null), window.removeEventListener("dragend", xe);
  2034. }, Me = (s, r) => {
  2035. const {
  2036. onDragstart: u
  2037. } = e, {
  2038. eventKey: p,
  2039. eventData: $
  2040. } = r;
  2041. A = r, q = {
  2042. x: s.clientX,
  2043. y: s.clientY
  2044. };
  2045. const k = me(D.value, p);
  2046. y.draggingNodeKey = p, y.dragChildrenKeys = Dn(p, O.value), v.value = Q.value.getIndentWidth(), de(k), window.addEventListener("dragend", xe), u && u({
  2047. event: s,
  2048. node: $
  2049. });
  2050. }, Ie = (s, r) => {
  2051. const {
  2052. onDragenter: u,
  2053. onExpand: p,
  2054. allowDrop: $,
  2055. direction: k
  2056. } = e, {
  2057. pos: g,
  2058. eventKey: I
  2059. } = r;
  2060. if (G !== I && (G = I), !A) {
  2061. H();
  2062. return;
  2063. }
  2064. const {
  2065. dropPosition: _,
  2066. dropLevelOffset: M,
  2067. dropTargetKey: P,
  2068. dropContainerKey: F,
  2069. dropTargetPos: oe,
  2070. dropAllowed: fe,
  2071. dragOverNodeKey: ve
  2072. } = ht(s, A, r, v.value, q, $, W.value, O.value, z.value, k);
  2073. if (
  2074. // don't allow drop inside its children
  2075. y.dragChildrenKeys.indexOf(P) !== -1 || // don't allow drop when drop is not allowed caculated by calcDropPosition
  2076. !fe
  2077. ) {
  2078. H();
  2079. return;
  2080. }
  2081. if (i || (i = {}), Object.keys(i).forEach((ae) => {
  2082. clearTimeout(i[ae]);
  2083. }), A.eventKey !== r.eventKey && (i[g] = window.setTimeout(() => {
  2084. if (y.draggingNodeKey === null) return;
  2085. let ae = D.value.slice();
  2086. const ke = O.value[r.eventKey];
  2087. ke && (ke.children || []).length && (ae = we(D.value, r.eventKey)), de(ae), p && p(ae, {
  2088. node: r.eventData,
  2089. expanded: !0,
  2090. nativeEvent: s
  2091. });
  2092. }, 800)), A.eventKey === P && M === 0) {
  2093. H();
  2094. return;
  2095. }
  2096. w(y, {
  2097. dragOverNodeKey: ve,
  2098. dropPosition: _,
  2099. dropLevelOffset: M,
  2100. dropTargetKey: P,
  2101. dropContainerKey: F,
  2102. dropTargetPos: oe,
  2103. dropAllowed: fe
  2104. }), u && u({
  2105. event: s,
  2106. node: r.eventData,
  2107. expandedKeys: D.value
  2108. });
  2109. }, pe = (s, r) => {
  2110. const {
  2111. onDragover: u,
  2112. allowDrop: p,
  2113. direction: $
  2114. } = e;
  2115. if (!A)
  2116. return;
  2117. const {
  2118. dropPosition: k,
  2119. dropLevelOffset: g,
  2120. dropTargetKey: I,
  2121. dropContainerKey: _,
  2122. dropAllowed: M,
  2123. dropTargetPos: P,
  2124. dragOverNodeKey: F
  2125. } = ht(s, A, r, v.value, q, p, W.value, O.value, z.value, $);
  2126. y.dragChildrenKeys.indexOf(I) !== -1 || !M || (A.eventKey === I && g === 0 ? y.dropPosition === null && y.dropLevelOffset === null && y.dropTargetKey === null && y.dropContainerKey === null && y.dropTargetPos === null && y.dropAllowed === !1 && y.dragOverNodeKey === null || H() : k === y.dropPosition && g === y.dropLevelOffset && I === y.dropTargetKey && _ === y.dropContainerKey && P === y.dropTargetPos && M === y.dropAllowed && F === y.dragOverNodeKey || w(y, {
  2127. dropPosition: k,
  2128. dropLevelOffset: g,
  2129. dropTargetKey: I,
  2130. dropContainerKey: _,
  2131. dropTargetPos: P,
  2132. dropAllowed: M,
  2133. dragOverNodeKey: F
  2134. }), u && u({
  2135. event: s,
  2136. node: r.eventData
  2137. }));
  2138. }, Le = (s, r) => {
  2139. G === r.eventKey && !s.currentTarget.contains(s.relatedTarget) && (H(), G = null);
  2140. const {
  2141. onDragleave: u
  2142. } = e;
  2143. u && u({
  2144. event: s,
  2145. node: r.eventData
  2146. });
  2147. }, He = function(s, r) {
  2148. let u = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
  2149. var p;
  2150. const {
  2151. dragChildrenKeys: $,
  2152. dropPosition: k,
  2153. dropTargetKey: g,
  2154. dropTargetPos: I,
  2155. dropAllowed: _
  2156. } = y;
  2157. if (!_) return;
  2158. const {
  2159. onDrop: M
  2160. } = e;
  2161. if (y.dragOverNodeKey = null, ge(), g === null) return;
  2162. const P = w(w({}, Ge(g, it(Z.value))), {
  2163. active: ((p = R.value) === null || p === void 0 ? void 0 : p.key) === g,
  2164. data: O.value[g].node
  2165. }), F = $.indexOf(g) !== -1;
  2166. Ue(!F, "Can not drop to dragNode's children node. Maybe this is a bug of ant-design-vue. Please report an issue.");
  2167. const oe = Tn(I), fe = {
  2168. event: s,
  2169. node: Xe(P),
  2170. dragNode: A ? A.eventData : null,
  2171. dragNodesKeys: [A.eventKey].concat($),
  2172. dropToGap: k !== 0,
  2173. dropPosition: k + Number(oe[oe.length - 1])
  2174. };
  2175. u || M == null || M(fe), A = null;
  2176. }, Ke = (s, r) => {
  2177. const {
  2178. expanded: u,
  2179. key: p
  2180. } = r, $ = W.value.filter((g) => g.key === p)[0], k = Xe(w(w({}, Ge(p, Z.value)), {
  2181. data: $.data
  2182. }));
  2183. de(u ? me(D.value, p) : we(D.value, p)), Te(s, k);
  2184. }, De = (s, r) => {
  2185. const {
  2186. onClick: u,
  2187. expandAction: p
  2188. } = e;
  2189. p === "click" && Ke(s, r), u && u(s, r);
  2190. }, Qe = (s, r) => {
  2191. const {
  2192. onDblclick: u,
  2193. expandAction: p
  2194. } = e;
  2195. (p === "doubleclick" || p === "dblclick") && Ke(s, r), u && u(s, r);
  2196. }, Be = (s, r) => {
  2197. let u = S.value;
  2198. const {
  2199. onSelect: p,
  2200. multiple: $
  2201. } = e, {
  2202. selected: k
  2203. } = r, g = r[B.value.key], I = !k;
  2204. I ? $ ? u = we(u, g) : u = [g] : u = me(u, g);
  2205. const _ = O.value, M = u.map((P) => {
  2206. const F = _[P];
  2207. return F ? F.node : null;
  2208. }).filter((P) => P);
  2209. e.selectedKeys === void 0 && (S.value = u), p && p(u, {
  2210. event: "select",
  2211. selected: I,
  2212. node: r,
  2213. selectedNodes: M,
  2214. nativeEvent: s
  2215. });
  2216. }, je = (s, r, u) => {
  2217. const {
  2218. checkStrictly: p,
  2219. onCheck: $
  2220. } = e, k = r[B.value.key];
  2221. let g;
  2222. const I = {
  2223. event: "check",
  2224. node: r,
  2225. checked: u,
  2226. nativeEvent: s
  2227. }, _ = O.value;
  2228. if (p) {
  2229. const M = u ? we(f.value, k) : me(f.value, k), P = me(K.value, k);
  2230. g = {
  2231. checked: M,
  2232. halfChecked: P
  2233. }, I.checkedNodes = M.map((F) => _[F]).filter((F) => F).map((F) => F.node), e.checkedKeys === void 0 && (f.value = M);
  2234. } else {
  2235. let {
  2236. checkedKeys: M,
  2237. halfCheckedKeys: P
  2238. } = at([...f.value, k], !0, _, h.value, b.value);
  2239. if (!u) {
  2240. const F = new Set(M);
  2241. F.delete(k), {
  2242. checkedKeys: M,
  2243. halfCheckedKeys: P
  2244. } = at(Array.from(F), {
  2245. checked: !1,
  2246. halfCheckedKeys: P
  2247. }, _, h.value, b.value);
  2248. }
  2249. g = M, I.checkedNodes = [], I.checkedNodesPositions = [], I.halfCheckedKeys = P, M.forEach((F) => {
  2250. const oe = _[F];
  2251. if (!oe) return;
  2252. const {
  2253. node: fe,
  2254. pos: ve
  2255. } = oe;
  2256. I.checkedNodes.push(fe), I.checkedNodesPositions.push({
  2257. node: fe,
  2258. pos: ve
  2259. });
  2260. }), e.checkedKeys === void 0 && (f.value = M, K.value = P);
  2261. }
  2262. $ && $(g, I);
  2263. }, Ye = (s) => {
  2264. const r = s[B.value.key], u = new Promise((p, $) => {
  2265. const {
  2266. loadData: k,
  2267. onLoad: g
  2268. } = e;
  2269. if (!k || ee.value.has(r) || le.value.has(r))
  2270. return null;
  2271. k(s).then(() => {
  2272. const _ = we(x.value, r), M = me(m.value, r);
  2273. g && g(_, {
  2274. event: "load",
  2275. node: s
  2276. }), e.loadedKeys === void 0 && (x.value = _), m.value = M, p();
  2277. }).catch((_) => {
  2278. const M = me(m.value, r);
  2279. if (m.value = M, j[r] = (j[r] || 0) + 1, j[r] >= no) {
  2280. Ue(!1, "Retry for `loadData` many times but still failed. No more retry.");
  2281. const P = we(x.value, r);
  2282. e.loadedKeys === void 0 && (x.value = P), p();
  2283. }
  2284. $(_);
  2285. }), m.value = we(m.value, r);
  2286. });
  2287. return u.catch(() => {
  2288. }), u;
  2289. }, Ze = (s, r) => {
  2290. const {
  2291. onMouseenter: u
  2292. } = e;
  2293. u && u({
  2294. event: s,
  2295. node: r
  2296. });
  2297. }, ze = (s, r) => {
  2298. const {
  2299. onMouseleave: u
  2300. } = e;
  2301. u && u({
  2302. event: s,
  2303. node: r
  2304. });
  2305. }, et = (s, r) => {
  2306. const {
  2307. onRightClick: u
  2308. } = e;
  2309. u && (s.preventDefault(), u({
  2310. event: s,
  2311. node: r
  2312. }));
  2313. }, tt = (s) => {
  2314. const {
  2315. onFocus: r
  2316. } = e;
  2317. V.value = !0, r && r(s);
  2318. }, Ve = (s) => {
  2319. const {
  2320. onBlur: r
  2321. } = e;
  2322. V.value = !1, d(null), r && r(s);
  2323. }, Te = (s, r) => {
  2324. let u = D.value;
  2325. const {
  2326. onExpand: p,
  2327. loadData: $
  2328. } = e, {
  2329. expanded: k
  2330. } = r, g = r[B.value.key];
  2331. if (Y.value)
  2332. return;
  2333. const I = u.indexOf(g), _ = !k;
  2334. if (Ue(k && I !== -1 || !k && I === -1, "Expand state not sync with index check"), _ ? u = we(u, g) : u = me(u, g), de(u), p && p(u, {
  2335. node: r,
  2336. expanded: _,
  2337. nativeEvent: s
  2338. }), _ && $) {
  2339. const M = Ye(r);
  2340. M && M.then(() => {
  2341. }).catch((P) => {
  2342. const F = me(D.value, g);
  2343. de(F), Promise.reject(P);
  2344. });
  2345. }
  2346. }, nt = () => {
  2347. Y.value = !0;
  2348. }, a = () => {
  2349. setTimeout(() => {
  2350. Y.value = !1;
  2351. });
  2352. }, d = (s) => {
  2353. const {
  2354. onActiveChange: r
  2355. } = e;
  2356. T.value !== s && (e.activeKey !== void 0 && (T.value = s), s !== null && X({
  2357. key: s
  2358. }), r && r(s));
  2359. }, R = E(() => T.value === null ? null : W.value.find((s) => {
  2360. let {
  2361. key: r
  2362. } = s;
  2363. return r === T.value;
  2364. }) || null), J = (s) => {
  2365. let r = W.value.findIndex((p) => {
  2366. let {
  2367. key: $
  2368. } = p;
  2369. return $ === T.value;
  2370. });
  2371. r === -1 && s < 0 && (r = W.value.length), r = (r + s + W.value.length) % W.value.length;
  2372. const u = W.value[r];
  2373. if (u) {
  2374. const {
  2375. key: p
  2376. } = u;
  2377. d(p);
  2378. } else
  2379. d(null);
  2380. }, te = E(() => Xe(w(w({}, Ge(T.value, Z.value)), {
  2381. data: R.value.data,
  2382. active: !0
  2383. }))), ne = (s) => {
  2384. const {
  2385. onKeydown: r,
  2386. checkable: u,
  2387. selectable: p
  2388. } = e;
  2389. switch (s.which) {
  2390. case Oe.UP: {
  2391. J(-1), s.preventDefault();
  2392. break;
  2393. }
  2394. case Oe.DOWN: {
  2395. J(1), s.preventDefault();
  2396. break;
  2397. }
  2398. }
  2399. const $ = R.value;
  2400. if ($ && $.data) {
  2401. const k = $.data.isLeaf === !1 || !!($.data.children || []).length, g = te.value;
  2402. switch (s.which) {
  2403. case Oe.LEFT: {
  2404. k && z.value.has(T.value) ? Te({}, g) : $.parent && d($.parent.key), s.preventDefault();
  2405. break;
  2406. }
  2407. case Oe.RIGHT: {
  2408. k && !z.value.has(T.value) ? Te({}, g) : $.children && $.children.length && d($.children[0].key), s.preventDefault();
  2409. break;
  2410. }
  2411. case Oe.ENTER:
  2412. case Oe.SPACE: {
  2413. u && !g.disabled && g.checkable !== !1 && !g.disableCheckbox ? je({}, g, !se.value.has(T.value)) : !u && p && !g.disabled && g.selectable !== !1 && Be({}, g);
  2414. break;
  2415. }
  2416. }
  2417. }
  2418. r && r(s);
  2419. };
  2420. return l({
  2421. onNodeExpand: Te,
  2422. scrollTo: X,
  2423. onKeydown: ne,
  2424. selectedKeys: E(() => S.value),
  2425. checkedKeys: E(() => f.value),
  2426. halfCheckedKeys: E(() => K.value),
  2427. loadedKeys: E(() => x.value),
  2428. loadingKeys: E(() => m.value),
  2429. expandedKeys: E(() => D.value)
  2430. }), Dt(() => {
  2431. window.removeEventListener("dragend", xe), c.value = !0;
  2432. }), zn({
  2433. expandedKeys: D,
  2434. selectedKeys: S,
  2435. loadedKeys: x,
  2436. loadingKeys: m,
  2437. checkedKeys: f,
  2438. halfCheckedKeys: K,
  2439. expandedKeysSet: z,
  2440. selectedKeysSet: U,
  2441. loadedKeysSet: ee,
  2442. loadingKeysSet: le,
  2443. checkedKeysSet: se,
  2444. halfCheckedKeysSet: Se,
  2445. flattenNodes: W
  2446. }), () => {
  2447. const {
  2448. // focused,
  2449. // flattenNodes,
  2450. // keyEntities,
  2451. draggingNodeKey: s,
  2452. // activeKey,
  2453. dropLevelOffset: r,
  2454. dropContainerKey: u,
  2455. dropTargetKey: p,
  2456. dropPosition: $,
  2457. dragOverNodeKey: k
  2458. // indent,
  2459. } = y, {
  2460. prefixCls: g,
  2461. showLine: I,
  2462. focusable: _,
  2463. tabindex: M = 0,
  2464. selectable: P,
  2465. showIcon: F,
  2466. icon: oe = o.icon,
  2467. switcherIcon: fe,
  2468. draggable: ve,
  2469. checkable: ae,
  2470. checkStrictly: ke,
  2471. disabled: Re,
  2472. motion: ot,
  2473. loadData: _t,
  2474. filterTreeNode: Bt,
  2475. height: jt,
  2476. itemHeight: Yt,
  2477. virtual: zt,
  2478. dropIndicatorRender: Vt,
  2479. onContextmenu: Ut,
  2480. onScroll: Wt,
  2481. direction: Gt,
  2482. rootClassName: Xt,
  2483. rootStyle: qt
  2484. } = e, {
  2485. class: Jt,
  2486. style: Qt
  2487. } = n, Zt = Ot(w(w({}, e), n), {
  2488. aria: !0,
  2489. data: !0
  2490. });
  2491. let Fe;
  2492. return ve ? typeof ve == "object" ? Fe = ve : typeof ve == "function" ? Fe = {
  2493. nodeDraggable: ve
  2494. } : Fe = {} : Fe = !1, C(Yn, {
  2495. value: {
  2496. prefixCls: g,
  2497. selectable: P,
  2498. showIcon: F,
  2499. icon: oe,
  2500. switcherIcon: fe,
  2501. draggable: Fe,
  2502. draggingNodeKey: s,
  2503. checkable: ae,
  2504. customCheckable: o.checkable,
  2505. checkStrictly: ke,
  2506. disabled: Re,
  2507. keyEntities: O.value,
  2508. dropLevelOffset: r,
  2509. dropContainerKey: u,
  2510. dropTargetKey: p,
  2511. dropPosition: $,
  2512. dragOverNodeKey: k,
  2513. dragging: s !== null,
  2514. indent: v.value,
  2515. direction: Gt,
  2516. dropIndicatorRender: Vt,
  2517. loadData: _t,
  2518. filterTreeNode: Bt,
  2519. onNodeClick: De,
  2520. onNodeDoubleClick: Qe,
  2521. onNodeExpand: Te,
  2522. onNodeSelect: Be,
  2523. onNodeCheck: je,
  2524. onNodeLoad: Ye,
  2525. onNodeMouseEnter: Ze,
  2526. onNodeMouseLeave: ze,
  2527. onNodeContextMenu: et,
  2528. onNodeDragStart: Me,
  2529. onNodeDragEnter: Ie,
  2530. onNodeDragOver: pe,
  2531. onNodeDragLeave: Le,
  2532. onNodeDragEnd: ye,
  2533. onNodeDrop: He,
  2534. slots: o
  2535. }
  2536. }, {
  2537. default: () => [C("div", {
  2538. role: "tree",
  2539. class: ue(g, Jt, Xt, {
  2540. [`${g}-show-line`]: I,
  2541. [`${g}-focused`]: V.value,
  2542. [`${g}-active-focused`]: T.value !== null
  2543. }),
  2544. style: qt
  2545. }, [C(eo, re({
  2546. ref: Q,
  2547. prefixCls: g,
  2548. style: Qt,
  2549. disabled: Re,
  2550. selectable: P,
  2551. checkable: !!ae,
  2552. motion: ot,
  2553. height: jt,
  2554. itemHeight: Yt,
  2555. virtual: zt,
  2556. focusable: _,
  2557. focused: V.value,
  2558. tabindex: M,
  2559. activeItem: R.value,
  2560. onFocus: tt,
  2561. onBlur: Ve,
  2562. onKeydown: ne,
  2563. onActiveChange: d,
  2564. onListChangeStart: nt,
  2565. onListChangeEnd: a,
  2566. onContextmenu: Ut,
  2567. onScroll: Wt
  2568. }, Zt), null)])]
  2569. });
  2570. };
  2571. }
  2572. });
  2573. function go(e, t, n, o, l) {
  2574. const {
  2575. isLeaf: c,
  2576. expanded: i,
  2577. loading: v
  2578. } = n;
  2579. let S = t;
  2580. if (v)
  2581. return C(an, {
  2582. class: `${e}-switcher-loading-icon`
  2583. }, null);
  2584. let f;
  2585. l && typeof l == "object" && (f = l.showLeafIcon);
  2586. let K = null;
  2587. const x = `${e}-switcher-icon`;
  2588. return c ? l ? f && o ? o(n) : (typeof l == "object" && !f ? K = C("span", {
  2589. class: `${e}-switcher-leaf-line`
  2590. }, null) : K = C(sn, {
  2591. class: `${e}-switcher-line-icon`
  2592. }, null), K) : null : (K = C(rn, {
  2593. class: x
  2594. }, null), l && (K = i ? C(cn, {
  2595. class: `${e}-switcher-line-icon`
  2596. }, null) : C(dn, {
  2597. class: `${e}-switcher-line-icon`
  2598. }, null)), typeof t == "function" ? S = t(w(w({}, n), {
  2599. defaultIcon: K,
  2600. switcherCls: x
  2601. })) : un(S) && (S = Et(S, {
  2602. class: x
  2603. })), S || K);
  2604. }
  2605. const oo = new yn("ant-tree-node-fx-do-not-use", {
  2606. "0%": {
  2607. opacity: 0
  2608. },
  2609. "100%": {
  2610. opacity: 1
  2611. }
  2612. }), lo = (e, t) => ({
  2613. [`.${e}-switcher-icon`]: {
  2614. display: "inline-block",
  2615. fontSize: 10,
  2616. verticalAlign: "baseline",
  2617. svg: {
  2618. transition: `transform ${t.motionDurationSlow}`
  2619. }
  2620. }
  2621. }), ao = (e, t) => ({
  2622. [`.${e}-drop-indicator`]: {
  2623. position: "absolute",
  2624. // it should displayed over the following node
  2625. zIndex: 1,
  2626. height: 2,
  2627. backgroundColor: t.colorPrimary,
  2628. borderRadius: 1,
  2629. pointerEvents: "none",
  2630. "&:after": {
  2631. position: "absolute",
  2632. top: -3,
  2633. insetInlineStart: -6,
  2634. width: 8,
  2635. height: 8,
  2636. backgroundColor: "transparent",
  2637. border: `${t.lineWidthBold}px solid ${t.colorPrimary}`,
  2638. borderRadius: "50%",
  2639. content: '""'
  2640. }
  2641. }
  2642. }), io = (e, t) => {
  2643. const {
  2644. treeCls: n,
  2645. treeNodeCls: o,
  2646. treeNodePadding: l,
  2647. treeTitleHeight: c
  2648. } = t, i = (c - t.fontSizeLG) / 2, v = t.paddingXS;
  2649. return {
  2650. [n]: w(w({}, gn(t)), {
  2651. background: t.colorBgContainer,
  2652. borderRadius: t.borderRadius,
  2653. transition: `background-color ${t.motionDurationSlow}`,
  2654. [`&${n}-rtl`]: {
  2655. // >>> Switcher
  2656. [`${n}-switcher`]: {
  2657. "&_close": {
  2658. [`${n}-switcher-icon`]: {
  2659. svg: {
  2660. transform: "rotate(90deg)"
  2661. }
  2662. }
  2663. }
  2664. }
  2665. },
  2666. [`&-focused:not(:hover):not(${n}-active-focused)`]: w({}, dt(t)),
  2667. // =================== Virtual List ===================
  2668. [`${n}-list-holder-inner`]: {
  2669. alignItems: "flex-start"
  2670. },
  2671. [`&${n}-block-node`]: {
  2672. [`${n}-list-holder-inner`]: {
  2673. alignItems: "stretch",
  2674. // >>> Title
  2675. [`${n}-node-content-wrapper`]: {
  2676. flex: "auto"
  2677. },
  2678. // >>> Drag
  2679. [`${o}.dragging`]: {
  2680. position: "relative",
  2681. "&:after": {
  2682. position: "absolute",
  2683. top: 0,
  2684. insetInlineEnd: 0,
  2685. bottom: l,
  2686. insetInlineStart: 0,
  2687. border: `1px solid ${t.colorPrimary}`,
  2688. opacity: 0,
  2689. animationName: oo,
  2690. animationDuration: t.motionDurationSlow,
  2691. animationPlayState: "running",
  2692. animationFillMode: "forwards",
  2693. content: '""',
  2694. pointerEvents: "none"
  2695. }
  2696. }
  2697. }
  2698. },
  2699. // ===================== TreeNode =====================
  2700. [`${o}`]: {
  2701. display: "flex",
  2702. alignItems: "flex-start",
  2703. padding: `0 0 ${l}px 0`,
  2704. outline: "none",
  2705. "&-rtl": {
  2706. direction: "rtl"
  2707. },
  2708. // Disabled
  2709. "&-disabled": {
  2710. // >>> Title
  2711. [`${n}-node-content-wrapper`]: {
  2712. color: t.colorTextDisabled,
  2713. cursor: "not-allowed",
  2714. "&:hover": {
  2715. background: "transparent"
  2716. }
  2717. }
  2718. },
  2719. [`&-active ${n}-node-content-wrapper`]: w({}, dt(t)),
  2720. [`&:not(${o}-disabled).filter-node ${n}-title`]: {
  2721. color: "inherit",
  2722. fontWeight: 500
  2723. },
  2724. "&-draggable": {
  2725. [`${n}-draggable-icon`]: {
  2726. width: c,
  2727. lineHeight: `${c}px`,
  2728. textAlign: "center",
  2729. visibility: "visible",
  2730. opacity: 0.2,
  2731. transition: `opacity ${t.motionDurationSlow}`,
  2732. [`${o}:hover &`]: {
  2733. opacity: 0.45
  2734. }
  2735. },
  2736. [`&${o}-disabled`]: {
  2737. [`${n}-draggable-icon`]: {
  2738. visibility: "hidden"
  2739. }
  2740. }
  2741. }
  2742. },
  2743. // >>> Indent
  2744. [`${n}-indent`]: {
  2745. alignSelf: "stretch",
  2746. whiteSpace: "nowrap",
  2747. userSelect: "none",
  2748. "&-unit": {
  2749. display: "inline-block",
  2750. width: c
  2751. }
  2752. },
  2753. // >>> Drag Handler
  2754. [`${n}-draggable-icon`]: {
  2755. visibility: "hidden"
  2756. },
  2757. // >>> Switcher
  2758. [`${n}-switcher`]: w(w({}, lo(e, t)), {
  2759. position: "relative",
  2760. flex: "none",
  2761. alignSelf: "stretch",
  2762. width: c,
  2763. margin: 0,
  2764. lineHeight: `${c}px`,
  2765. textAlign: "center",
  2766. cursor: "pointer",
  2767. userSelect: "none",
  2768. "&-noop": {
  2769. cursor: "default"
  2770. },
  2771. "&_close": {
  2772. [`${n}-switcher-icon`]: {
  2773. svg: {
  2774. transform: "rotate(-90deg)"
  2775. }
  2776. }
  2777. },
  2778. "&-loading-icon": {
  2779. color: t.colorPrimary
  2780. },
  2781. "&-leaf-line": {
  2782. position: "relative",
  2783. zIndex: 1,
  2784. display: "inline-block",
  2785. width: "100%",
  2786. height: "100%",
  2787. // https://github.com/ant-design/ant-design/issues/31884
  2788. "&:before": {
  2789. position: "absolute",
  2790. top: 0,
  2791. insetInlineEnd: c / 2,
  2792. bottom: -l,
  2793. marginInlineStart: -1,
  2794. borderInlineEnd: `1px solid ${t.colorBorder}`,
  2795. content: '""'
  2796. },
  2797. "&:after": {
  2798. position: "absolute",
  2799. width: c / 2 * 0.8,
  2800. height: c / 2,
  2801. borderBottom: `1px solid ${t.colorBorder}`,
  2802. content: '""'
  2803. }
  2804. }
  2805. }),
  2806. // >>> Checkbox
  2807. [`${n}-checkbox`]: {
  2808. top: "initial",
  2809. marginInlineEnd: v,
  2810. marginBlockStart: i
  2811. },
  2812. // >>> Title
  2813. // add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
  2814. [`${n}-node-content-wrapper, ${n}-checkbox + span`]: {
  2815. position: "relative",
  2816. zIndex: "auto",
  2817. minHeight: c,
  2818. margin: 0,
  2819. padding: `0 ${t.paddingXS / 2}px`,
  2820. color: "inherit",
  2821. lineHeight: `${c}px`,
  2822. background: "transparent",
  2823. borderRadius: t.borderRadius,
  2824. cursor: "pointer",
  2825. transition: `all ${t.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,
  2826. "&:hover": {
  2827. backgroundColor: t.controlItemBgHover
  2828. },
  2829. [`&${n}-node-selected`]: {
  2830. backgroundColor: t.controlItemBgActive
  2831. },
  2832. // Icon
  2833. [`${n}-iconEle`]: {
  2834. display: "inline-block",
  2835. width: c,
  2836. height: c,
  2837. lineHeight: `${c}px`,
  2838. textAlign: "center",
  2839. verticalAlign: "top",
  2840. "&:empty": {
  2841. display: "none"
  2842. }
  2843. }
  2844. },
  2845. // https://github.com/ant-design/ant-design/issues/28217
  2846. [`${n}-unselectable ${n}-node-content-wrapper:hover`]: {
  2847. backgroundColor: "transparent"
  2848. },
  2849. // ==================== Draggable =====================
  2850. [`${n}-node-content-wrapper`]: w({
  2851. lineHeight: `${c}px`,
  2852. userSelect: "none"
  2853. }, ao(e, t)),
  2854. [`${o}.drop-container`]: {
  2855. "> [draggable]": {
  2856. boxShadow: `0 0 0 2px ${t.colorPrimary}`
  2857. }
  2858. },
  2859. // ==================== Show Line =====================
  2860. "&-show-line": {
  2861. // ================ Indent lines ================
  2862. [`${n}-indent`]: {
  2863. "&-unit": {
  2864. position: "relative",
  2865. height: "100%",
  2866. "&:before": {
  2867. position: "absolute",
  2868. top: 0,
  2869. insetInlineEnd: c / 2,
  2870. bottom: -l,
  2871. borderInlineEnd: `1px solid ${t.colorBorder}`,
  2872. content: '""'
  2873. },
  2874. "&-end": {
  2875. "&:before": {
  2876. display: "none"
  2877. }
  2878. }
  2879. }
  2880. },
  2881. // ============== Cover Background ==============
  2882. [`${n}-switcher`]: {
  2883. background: "transparent",
  2884. "&-line-icon": {
  2885. // https://github.com/ant-design/ant-design/issues/32813
  2886. verticalAlign: "-0.15em"
  2887. }
  2888. }
  2889. },
  2890. [`${o}-leaf-last`]: {
  2891. [`${n}-switcher`]: {
  2892. "&-leaf-line": {
  2893. "&:before": {
  2894. top: "auto !important",
  2895. bottom: "auto !important",
  2896. height: `${c / 2}px !important`
  2897. }
  2898. }
  2899. }
  2900. }
  2901. })
  2902. };
  2903. }, so = (e) => {
  2904. const {
  2905. treeCls: t,
  2906. treeNodeCls: n,
  2907. treeNodePadding: o
  2908. } = e;
  2909. return {
  2910. [`${t}${t}-directory`]: {
  2911. // ================== TreeNode ==================
  2912. [n]: {
  2913. position: "relative",
  2914. // Hover color
  2915. "&:before": {
  2916. position: "absolute",
  2917. top: 0,
  2918. insetInlineEnd: 0,
  2919. bottom: o,
  2920. insetInlineStart: 0,
  2921. transition: `background-color ${e.motionDurationMid}`,
  2922. content: '""',
  2923. pointerEvents: "none"
  2924. },
  2925. "&:hover": {
  2926. "&:before": {
  2927. background: e.controlItemBgHover
  2928. }
  2929. },
  2930. // Elements
  2931. "> *": {
  2932. zIndex: 1
  2933. },
  2934. // >>> Switcher
  2935. [`${t}-switcher`]: {
  2936. transition: `color ${e.motionDurationMid}`
  2937. },
  2938. // >>> Title
  2939. [`${t}-node-content-wrapper`]: {
  2940. borderRadius: 0,
  2941. userSelect: "none",
  2942. "&:hover": {
  2943. background: "transparent"
  2944. },
  2945. [`&${t}-node-selected`]: {
  2946. color: e.colorTextLightSolid,
  2947. background: "transparent"
  2948. }
  2949. },
  2950. // ============= Selected =============
  2951. "&-selected": {
  2952. "\n &:hover::before,\n &::before\n ": {
  2953. background: e.colorPrimary
  2954. },
  2955. // >>> Switcher
  2956. [`${t}-switcher`]: {
  2957. color: e.colorTextLightSolid
  2958. },
  2959. // >>> Title
  2960. [`${t}-node-content-wrapper`]: {
  2961. color: e.colorTextLightSolid,
  2962. background: "transparent"
  2963. }
  2964. }
  2965. }
  2966. }
  2967. };
  2968. }, ro = (e, t) => {
  2969. const n = `.${e}`, o = `${n}-treenode`, l = t.paddingXS / 2, c = t.controlHeightSM, i = hn(t, {
  2970. treeCls: n,
  2971. treeNodeCls: o,
  2972. treeNodePadding: l,
  2973. treeTitleHeight: c
  2974. });
  2975. return [
  2976. // Basic
  2977. io(e, i),
  2978. // Directory
  2979. so(i)
  2980. ];
  2981. }, yo = fn("Tree", (e, t) => {
  2982. let {
  2983. prefixCls: n
  2984. } = t;
  2985. return [{
  2986. [e.componentCls]: $n(`${n}-checkbox`, e)
  2987. }, ro(n, e), vn(e)];
  2988. });
  2989. export {
  2990. ho as T,
  2991. mt as V,
  2992. ro as g,
  2993. go as r,
  2994. Wn as t,
  2995. yo as u
  2996. };