index11.js 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256
  1. import { P as me, n as Ae, bg as de, d as k, a0 as pt, _ as ee, c as he, aa as Vt, bE as zt, o as Gt, i as Wt, K as Ce, N as Xt, bB as Ut, bF as Yt, bG as qt, bH as Jt, p as Qt, g as Zt, C as en, aj as tn, m as nn, r as on, b9 as nt, ah as an } from "./index2.js";
  2. import { defineComponent as Ne, provide as bt, computed as b, inject as mt, shallowRef as O, createVNode as K, getCurrentInstance as ln, reactive as Kt, onMounted as xt, onUpdated as rn, watch as Ke, nextTick as kt, onBeforeUnmount as sn, Transition as dn, withDirectives as cn, vShow as un, ref as Je, Fragment as vn, toRaw as ot, watchEffect as $e, onUnmounted as fn, cloneVNode as yn } from "vue";
  3. import { h as Fe, i as _e, j as St, e as gn, f as hn, c as pn, g as at, k as bn, l as lt, u as mn, p as Qe, a as Ze, b as ve, m as Kn, n as it, d as ge, o as xn } from "./useMaxLevel.js";
  4. const Ct = Symbol("TreeContextKey"), kn = Ne({
  5. compatConfig: {
  6. MODE: 3
  7. },
  8. name: "TreeContext",
  9. props: {
  10. value: {
  11. type: Object
  12. }
  13. },
  14. setup(e, a) {
  15. let {
  16. slots: l
  17. } = a;
  18. return bt(Ct, b(() => e.value)), () => {
  19. var s;
  20. return (s = l.default) === null || s === void 0 ? void 0 : s.call(l);
  21. };
  22. }
  23. }), tt = () => mt(Ct, b(() => ({}))), wt = Symbol("KeysStateKey"), Sn = (e) => {
  24. bt(wt, e);
  25. }, Et = () => mt(wt, {
  26. expandedKeys: O([]),
  27. selectedKeys: O([]),
  28. loadedKeys: O([]),
  29. loadingKeys: O([]),
  30. checkedKeys: O([]),
  31. halfCheckedKeys: O([]),
  32. expandedKeysSet: b(() => /* @__PURE__ */ new Set()),
  33. selectedKeysSet: b(() => /* @__PURE__ */ new Set()),
  34. loadedKeysSet: b(() => /* @__PURE__ */ new Set()),
  35. loadingKeysSet: b(() => /* @__PURE__ */ new Set()),
  36. checkedKeysSet: b(() => /* @__PURE__ */ new Set()),
  37. halfCheckedKeysSet: b(() => /* @__PURE__ */ new Set()),
  38. flattenNodes: O([])
  39. }), Cn = (e) => {
  40. let {
  41. prefixCls: a,
  42. level: l,
  43. isStart: s,
  44. isEnd: c
  45. } = e;
  46. const g = `${a}-indent-unit`, d = [];
  47. for (let E = 0; E < l; E += 1)
  48. d.push(K("span", {
  49. key: E,
  50. class: {
  51. [g]: !0,
  52. [`${g}-start`]: s[E],
  53. [`${g}-end`]: c[E]
  54. }
  55. }, null));
  56. return K("span", {
  57. "aria-hidden": "true",
  58. class: `${a}-indent`
  59. }, [d]);
  60. }, Dt = {
  61. eventKey: [String, Number],
  62. prefixCls: String,
  63. // By parent
  64. // expanded: { type: Boolean, default: undefined },
  65. // selected: { type: Boolean, default: undefined },
  66. // checked: { type: Boolean, default: undefined },
  67. // loaded: { type: Boolean, default: undefined },
  68. // loading: { type: Boolean, default: undefined },
  69. // halfChecked: { type: Boolean, default: undefined },
  70. // dragOver: { type: Boolean, default: undefined },
  71. // dragOverGapTop: { type: Boolean, default: undefined },
  72. // dragOverGapBottom: { type: Boolean, default: undefined },
  73. // pos: String,
  74. title: me.any,
  75. /** New added in Tree for easy data access */
  76. data: {
  77. type: Object,
  78. default: void 0
  79. },
  80. parent: {
  81. type: Object,
  82. default: void 0
  83. },
  84. isStart: {
  85. type: Array
  86. },
  87. isEnd: {
  88. type: Array
  89. },
  90. active: {
  91. type: Boolean,
  92. default: void 0
  93. },
  94. onMousemove: {
  95. type: Function
  96. },
  97. // By user
  98. isLeaf: {
  99. type: Boolean,
  100. default: void 0
  101. },
  102. checkable: {
  103. type: Boolean,
  104. default: void 0
  105. },
  106. selectable: {
  107. type: Boolean,
  108. default: void 0
  109. },
  110. disabled: {
  111. type: Boolean,
  112. default: void 0
  113. },
  114. disableCheckbox: {
  115. type: Boolean,
  116. default: void 0
  117. },
  118. icon: me.any,
  119. switcherIcon: me.any,
  120. domRef: {
  121. type: Function
  122. }
  123. }, wn = {
  124. prefixCls: {
  125. type: String
  126. },
  127. // data: { type: Array as PropType<FlattenNode[]> },
  128. motion: {
  129. type: Object
  130. },
  131. focusable: {
  132. type: Boolean
  133. },
  134. activeItem: {
  135. type: Object
  136. },
  137. focused: {
  138. type: Boolean
  139. },
  140. tabindex: {
  141. type: Number
  142. },
  143. checkable: {
  144. type: Boolean
  145. },
  146. selectable: {
  147. type: Boolean
  148. },
  149. disabled: {
  150. type: Boolean
  151. },
  152. // expandedKeys: { type: Array as PropType<Key[]> },
  153. // selectedKeys: { type: Array as PropType<Key[]> },
  154. // checkedKeys: { type: Array as PropType<Key[]> },
  155. // loadedKeys: { type: Array as PropType<Key[]> },
  156. // loadingKeys: { type: Array as PropType<Key[]> },
  157. // halfCheckedKeys: { type: Array as PropType<Key[]> },
  158. // keyEntities: { type: Object as PropType<Record<Key, DataEntity<DataNode>>> },
  159. // dragging: { type: Boolean as PropType<boolean> },
  160. // dragOverNodeKey: { type: [String, Number] as PropType<Key> },
  161. // dropPosition: { type: Number as PropType<number> },
  162. // Virtual list
  163. height: {
  164. type: Number
  165. },
  166. itemHeight: {
  167. type: Number
  168. },
  169. virtual: {
  170. type: Boolean
  171. },
  172. onScroll: {
  173. type: Function
  174. },
  175. onKeydown: {
  176. type: Function
  177. },
  178. onFocus: {
  179. type: Function
  180. },
  181. onBlur: {
  182. type: Function
  183. },
  184. onActiveChange: {
  185. type: Function
  186. },
  187. onContextmenu: {
  188. type: Function
  189. },
  190. onListChangeStart: {
  191. type: Function
  192. },
  193. onListChangeEnd: {
  194. type: Function
  195. }
  196. }, En = () => ({
  197. prefixCls: String,
  198. focusable: {
  199. type: Boolean,
  200. default: void 0
  201. },
  202. activeKey: [Number, String],
  203. tabindex: Number,
  204. children: me.any,
  205. treeData: {
  206. type: Array
  207. },
  208. fieldNames: {
  209. type: Object
  210. },
  211. showLine: {
  212. type: [Boolean, Object],
  213. default: void 0
  214. },
  215. showIcon: {
  216. type: Boolean,
  217. default: void 0
  218. },
  219. icon: me.any,
  220. selectable: {
  221. type: Boolean,
  222. default: void 0
  223. },
  224. expandAction: [String, Boolean],
  225. disabled: {
  226. type: Boolean,
  227. default: void 0
  228. },
  229. multiple: {
  230. type: Boolean,
  231. default: void 0
  232. },
  233. checkable: {
  234. type: Boolean,
  235. default: void 0
  236. },
  237. checkStrictly: {
  238. type: Boolean,
  239. default: void 0
  240. },
  241. draggable: {
  242. type: [Function, Boolean]
  243. },
  244. defaultExpandParent: {
  245. type: Boolean,
  246. default: void 0
  247. },
  248. autoExpandParent: {
  249. type: Boolean,
  250. default: void 0
  251. },
  252. defaultExpandAll: {
  253. type: Boolean,
  254. default: void 0
  255. },
  256. defaultExpandedKeys: {
  257. type: Array
  258. },
  259. expandedKeys: {
  260. type: Array
  261. },
  262. defaultCheckedKeys: {
  263. type: Array
  264. },
  265. checkedKeys: {
  266. type: [Object, Array]
  267. },
  268. defaultSelectedKeys: {
  269. type: Array
  270. },
  271. selectedKeys: {
  272. type: Array
  273. },
  274. allowDrop: {
  275. type: Function
  276. },
  277. dropIndicatorRender: {
  278. type: Function
  279. },
  280. onFocus: {
  281. type: Function
  282. },
  283. onBlur: {
  284. type: Function
  285. },
  286. onKeydown: {
  287. type: Function
  288. },
  289. onContextmenu: {
  290. type: Function
  291. },
  292. onClick: {
  293. type: Function
  294. },
  295. onDblclick: {
  296. type: Function
  297. },
  298. onScroll: {
  299. type: Function
  300. },
  301. onExpand: {
  302. type: Function
  303. },
  304. onCheck: {
  305. type: Function
  306. },
  307. onSelect: {
  308. type: Function
  309. },
  310. onLoad: {
  311. type: Function
  312. },
  313. loadData: {
  314. type: Function
  315. },
  316. loadedKeys: {
  317. type: Array
  318. },
  319. onMouseenter: {
  320. type: Function
  321. },
  322. onMouseleave: {
  323. type: Function
  324. },
  325. onRightClick: {
  326. type: Function
  327. },
  328. onDragstart: {
  329. type: Function
  330. },
  331. onDragenter: {
  332. type: Function
  333. },
  334. onDragover: {
  335. type: Function
  336. },
  337. onDragleave: {
  338. type: Function
  339. },
  340. onDragend: {
  341. type: Function
  342. },
  343. onDrop: {
  344. type: Function
  345. },
  346. /**
  347. * Used for `rc-tree-select` only.
  348. * Do not use in your production code directly since this will be refactor.
  349. */
  350. onActiveChange: {
  351. type: Function
  352. },
  353. filterTreeNode: {
  354. type: Function
  355. },
  356. motion: me.any,
  357. switcherIcon: me.any,
  358. // Virtual List
  359. height: Number,
  360. itemHeight: Number,
  361. virtual: {
  362. type: Boolean,
  363. default: void 0
  364. },
  365. // direction for drag logic
  366. direction: {
  367. type: String
  368. },
  369. rootClassName: String,
  370. rootStyle: Object
  371. });
  372. var Dn = function(e, a) {
  373. var l = {};
  374. for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && a.indexOf(s) < 0 && (l[s] = e[s]);
  375. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var c = 0, s = Object.getOwnPropertySymbols(e); c < s.length; c++)
  376. a.indexOf(s[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, s[c]) && (l[s[c]] = e[s[c]]);
  377. return l;
  378. };
  379. const rt = "open", st = "close", $n = "---", dt = Ne({
  380. compatConfig: {
  381. MODE: 3
  382. },
  383. name: "ATreeNode",
  384. inheritAttrs: !1,
  385. props: Dt,
  386. isTreeNode: 1,
  387. setup(e, a) {
  388. let {
  389. attrs: l,
  390. slots: s,
  391. expose: c
  392. } = a;
  393. Ae(!("slots" in e.data), `treeData slots is deprecated, please use ${Object.keys(e.data.slots || {}).map((t) => "`v-slot:" + t + "` ")}instead`);
  394. const g = O(!1), d = tt(), {
  395. expandedKeysSet: E,
  396. selectedKeysSet: $,
  397. loadedKeysSet: D,
  398. loadingKeysSet: N,
  399. checkedKeysSet: L,
  400. halfCheckedKeysSet: j
  401. } = Et(), {
  402. dragOverNodeKey: I,
  403. dropPosition: Q,
  404. keyEntities: f
  405. } = d.value, P = b(() => Fe(e.eventKey, {
  406. expandedKeysSet: E.value,
  407. selectedKeysSet: $.value,
  408. loadedKeysSet: D.value,
  409. loadingKeysSet: N.value,
  410. checkedKeysSet: L.value,
  411. halfCheckedKeysSet: j.value,
  412. dragOverNodeKey: I,
  413. dropPosition: Q,
  414. keyEntities: f
  415. })), T = de(() => P.value.expanded), H = de(() => P.value.selected), M = de(() => P.value.checked), W = de(() => P.value.loaded), A = de(() => P.value.loading), te = de(() => P.value.halfChecked), ne = de(() => P.value.dragOver), _ = de(() => P.value.dragOverGapTop), X = de(() => P.value.dragOverGapBottom), oe = de(() => P.value.pos), V = O(), ae = b(() => {
  416. const {
  417. eventKey: t
  418. } = e, {
  419. keyEntities: i
  420. } = d.value, {
  421. children: S
  422. } = i[t] || {};
  423. return !!(S || []).length;
  424. }), J = b(() => {
  425. const {
  426. isLeaf: t
  427. } = e, {
  428. loadData: i
  429. } = d.value, S = ae.value;
  430. return t === !1 ? !1 : t || !i && !S || i && W.value && !S;
  431. }), fe = b(() => J.value ? null : T.value ? rt : st), le = b(() => {
  432. const {
  433. disabled: t
  434. } = e, {
  435. disabled: i
  436. } = d.value;
  437. return !!(i || t);
  438. }), ke = b(() => {
  439. const {
  440. checkable: t
  441. } = e, {
  442. checkable: i
  443. } = d.value;
  444. return !i || t === !1 ? !1 : i;
  445. }), ie = b(() => {
  446. const {
  447. selectable: t
  448. } = e, {
  449. selectable: i
  450. } = d.value;
  451. return typeof t == "boolean" ? t : i;
  452. }), F = b(() => {
  453. const {
  454. data: t,
  455. active: i,
  456. checkable: S,
  457. disableCheckbox: R,
  458. disabled: z,
  459. selectable: G
  460. } = e;
  461. return k(k({
  462. active: i,
  463. checkable: S,
  464. disableCheckbox: R,
  465. disabled: z,
  466. selectable: G
  467. }, t), {
  468. dataRef: t,
  469. data: t,
  470. isLeaf: J.value,
  471. checked: M.value,
  472. expanded: T.value,
  473. loading: A.value,
  474. selected: H.value,
  475. halfChecked: te.value
  476. });
  477. }), ce = ln(), B = b(() => {
  478. const {
  479. eventKey: t
  480. } = e, {
  481. keyEntities: i
  482. } = d.value, {
  483. parent: S
  484. } = i[t] || {};
  485. return k(k({}, _e(k({}, e, P.value))), {
  486. parent: S
  487. });
  488. }), U = Kt({
  489. eventData: B,
  490. eventKey: b(() => e.eventKey),
  491. selectHandle: V,
  492. pos: oe,
  493. key: ce.vnode.key
  494. });
  495. c(U);
  496. const Z = (t) => {
  497. const {
  498. onNodeDoubleClick: i
  499. } = d.value;
  500. i(t, B.value);
  501. }, ue = (t) => {
  502. if (le.value) return;
  503. const {
  504. onNodeSelect: i
  505. } = d.value;
  506. t.preventDefault(), i(t, B.value);
  507. }, pe = (t) => {
  508. if (le.value) return;
  509. const {
  510. disableCheckbox: i
  511. } = e, {
  512. onNodeCheck: S
  513. } = d.value;
  514. if (!ke.value || i) return;
  515. t.preventDefault();
  516. const R = !M.value;
  517. S(t, B.value, R);
  518. }, Se = (t) => {
  519. const {
  520. onNodeClick: i
  521. } = d.value;
  522. i(t, B.value), ie.value ? ue(t) : pe(t);
  523. }, we = (t) => {
  524. const {
  525. onNodeMouseEnter: i
  526. } = d.value;
  527. i(t, B.value);
  528. }, Be = (t) => {
  529. const {
  530. onNodeMouseLeave: i
  531. } = d.value;
  532. i(t, B.value);
  533. }, Re = (t) => {
  534. const {
  535. onNodeContextMenu: i
  536. } = d.value;
  537. i(t, B.value);
  538. }, je = (t) => {
  539. const {
  540. onNodeDragStart: i
  541. } = d.value;
  542. t.stopPropagation(), g.value = !0, i(t, U);
  543. try {
  544. t.dataTransfer.setData("text/plain", "");
  545. } catch (S) {
  546. }
  547. }, He = (t) => {
  548. const {
  549. onNodeDragEnter: i
  550. } = d.value;
  551. t.preventDefault(), t.stopPropagation(), i(t, U);
  552. }, Ve = (t) => {
  553. const {
  554. onNodeDragOver: i
  555. } = d.value;
  556. t.preventDefault(), t.stopPropagation(), i(t, U);
  557. }, Oe = (t) => {
  558. const {
  559. onNodeDragLeave: i
  560. } = d.value;
  561. t.stopPropagation(), i(t, U);
  562. }, ze = (t) => {
  563. const {
  564. onNodeDragEnd: i
  565. } = d.value;
  566. t.stopPropagation(), g.value = !1, i(t, U);
  567. }, Ge = (t) => {
  568. const {
  569. onNodeDrop: i
  570. } = d.value;
  571. t.preventDefault(), t.stopPropagation(), g.value = !1, i(t, U);
  572. }, Pe = (t) => {
  573. const {
  574. onNodeExpand: i
  575. } = d.value;
  576. A.value || i(t, B.value);
  577. }, Te = () => {
  578. const {
  579. data: t
  580. } = e, {
  581. draggable: i
  582. } = d.value;
  583. return !!(i && (!i.nodeDraggable || i.nodeDraggable(t)));
  584. }, Ie = () => {
  585. const {
  586. draggable: t,
  587. prefixCls: i
  588. } = d.value;
  589. return t && (t != null && t.icon) ? K("span", {
  590. class: `${i}-draggable-icon`
  591. }, [t.icon]) : null;
  592. }, We = () => {
  593. var t, i, S;
  594. const {
  595. switcherIcon: R = s.switcherIcon || ((t = d.value.slots) === null || t === void 0 ? void 0 : t[(S = (i = e.data) === null || i === void 0 ? void 0 : i.slots) === null || S === void 0 ? void 0 : S.switcherIcon])
  596. } = e, {
  597. switcherIcon: z
  598. } = d.value, G = R || z;
  599. return typeof G == "function" ? G(F.value) : G;
  600. }, Le = () => {
  601. const {
  602. loadData: t,
  603. onNodeLoad: i
  604. } = d.value;
  605. A.value || t && T.value && !J.value && !ae.value && !W.value && i(B.value);
  606. };
  607. xt(() => {
  608. Le();
  609. }), rn(() => {
  610. Le();
  611. });
  612. const Xe = () => {
  613. const {
  614. prefixCls: t
  615. } = d.value, i = We();
  616. if (J.value)
  617. return i !== !1 ? K("span", {
  618. class: he(`${t}-switcher`, `${t}-switcher-noop`)
  619. }, [i]) : null;
  620. const S = he(`${t}-switcher`, `${t}-switcher_${T.value ? rt : st}`);
  621. return i !== !1 ? K("span", {
  622. onClick: Pe,
  623. class: S
  624. }, [i]) : null;
  625. }, Ue = () => {
  626. var t, i;
  627. const {
  628. disableCheckbox: S
  629. } = e, {
  630. prefixCls: R
  631. } = d.value, z = le.value;
  632. return ke.value ? K("span", {
  633. class: he(`${R}-checkbox`, M.value && `${R}-checkbox-checked`, !M.value && te.value && `${R}-checkbox-indeterminate`, (z || S) && `${R}-checkbox-disabled`),
  634. onClick: pe
  635. }, [(i = (t = d.value).customCheckable) === null || i === void 0 ? void 0 : i.call(t)]) : null;
  636. }, Me = () => {
  637. const {
  638. prefixCls: t
  639. } = d.value;
  640. return K("span", {
  641. class: he(`${t}-iconEle`, `${t}-icon__${fe.value || "docu"}`, A.value && `${t}-icon_loading`)
  642. }, null);
  643. }, be = () => {
  644. const {
  645. disabled: t,
  646. eventKey: i
  647. } = e, {
  648. draggable: S,
  649. dropLevelOffset: R,
  650. dropPosition: z,
  651. prefixCls: G,
  652. indent: n,
  653. dropIndicatorRender: o,
  654. dragOverNodeKey: r,
  655. direction: v
  656. } = d.value;
  657. return !t && S !== !1 && r === i ? o({
  658. dropPosition: z,
  659. dropLevelOffset: R,
  660. indent: n,
  661. prefixCls: G,
  662. direction: v
  663. }) : null;
  664. }, Ye = () => {
  665. var t, i, S, R, z, G;
  666. const {
  667. // title = slots.title ||
  668. // context.value.slots?.[props.data?.slots?.title] ||
  669. // context.value.slots?.title,
  670. // selected,
  671. icon: n = s.icon,
  672. // loading,
  673. data: o
  674. } = e, r = s.title || ((t = d.value.slots) === null || t === void 0 ? void 0 : t[(S = (i = e.data) === null || i === void 0 ? void 0 : i.slots) === null || S === void 0 ? void 0 : S.title]) || ((R = d.value.slots) === null || R === void 0 ? void 0 : R.title) || e.title, {
  675. prefixCls: v,
  676. showIcon: h,
  677. icon: y,
  678. loadData: u
  679. // slots: contextSlots,
  680. } = d.value, x = le.value, w = `${v}-node-content-wrapper`;
  681. let p;
  682. if (h) {
  683. const Y = n || ((z = d.value.slots) === null || z === void 0 ? void 0 : z[(G = o == null ? void 0 : o.slots) === null || G === void 0 ? void 0 : G.icon]) || y;
  684. p = Y ? K("span", {
  685. class: he(`${v}-iconEle`, `${v}-icon__customize`)
  686. }, [typeof Y == "function" ? Y(F.value) : Y]) : Me();
  687. } else u && A.value && (p = Me());
  688. let m;
  689. typeof r == "function" ? m = r(F.value) : m = r, m = m === void 0 ? $n : m;
  690. const C = K("span", {
  691. class: `${v}-title`
  692. }, [m]);
  693. return K("span", {
  694. ref: V,
  695. title: typeof r == "string" ? r : "",
  696. class: he(`${w}`, `${w}-${fe.value || "normal"}`, !x && (H.value || g.value) && `${v}-node-selected`),
  697. onMouseenter: we,
  698. onMouseleave: Be,
  699. onContextmenu: Re,
  700. onClick: Se,
  701. onDblclick: Z
  702. }, [p, C, be()]);
  703. };
  704. return () => {
  705. const t = k(k({}, e), l), {
  706. eventKey: i,
  707. isLeaf: S,
  708. isStart: R,
  709. isEnd: z,
  710. domRef: G,
  711. active: n,
  712. data: o,
  713. onMousemove: r,
  714. selectable: v
  715. } = t, h = Dn(t, ["eventKey", "isLeaf", "isStart", "isEnd", "domRef", "active", "data", "onMousemove", "selectable"]), {
  716. prefixCls: y,
  717. filterTreeNode: u,
  718. keyEntities: x,
  719. dropContainerKey: w,
  720. dropTargetKey: p,
  721. draggingNodeKey: m
  722. } = d.value, C = le.value, Y = pt(h, {
  723. aria: !0,
  724. data: !0
  725. }), {
  726. level: re
  727. } = x[i] || {}, se = z[z.length - 1], q = Te(), ye = !C && q, Ee = m === i, qe = v !== void 0 ? {
  728. "aria-selected": !!v
  729. } : void 0;
  730. return K("div", ee(ee({
  731. ref: G,
  732. class: he(l.class, `${y}-treenode`, {
  733. [`${y}-treenode-disabled`]: C,
  734. [`${y}-treenode-switcher-${T.value ? "open" : "close"}`]: !S,
  735. [`${y}-treenode-checkbox-checked`]: M.value,
  736. [`${y}-treenode-checkbox-indeterminate`]: te.value,
  737. [`${y}-treenode-selected`]: H.value,
  738. [`${y}-treenode-loading`]: A.value,
  739. [`${y}-treenode-active`]: n,
  740. [`${y}-treenode-leaf-last`]: se,
  741. [`${y}-treenode-draggable`]: ye,
  742. dragging: Ee,
  743. "drop-target": p === i,
  744. "drop-container": w === i,
  745. "drag-over": !C && ne.value,
  746. "drag-over-gap-top": !C && _.value,
  747. "drag-over-gap-bottom": !C && X.value,
  748. "filter-node": u && u(B.value)
  749. }),
  750. style: l.style,
  751. draggable: ye,
  752. "aria-grabbed": Ee,
  753. onDragstart: ye ? je : void 0,
  754. onDragenter: q ? He : void 0,
  755. onDragover: q ? Ve : void 0,
  756. onDragleave: q ? Oe : void 0,
  757. onDrop: q ? Ge : void 0,
  758. onDragend: q ? ze : void 0,
  759. onMousemove: r
  760. }, qe), Y), [K(Cn, {
  761. prefixCls: y,
  762. level: re,
  763. isStart: R,
  764. isEnd: z
  765. }, null), Ie(), Xe(), Ue(), Ye()]);
  766. };
  767. }
  768. });
  769. var ct = function(e, a) {
  770. var l = {};
  771. for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && a.indexOf(s) < 0 && (l[s] = e[s]);
  772. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var c = 0, s = Object.getOwnPropertySymbols(e); c < s.length; c++)
  773. a.indexOf(s[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, s[c]) && (l[s[c]] = e[s[c]]);
  774. return l;
  775. };
  776. const Nn = Ne({
  777. compatConfig: {
  778. MODE: 3
  779. },
  780. name: "MotionTreeNode",
  781. inheritAttrs: !1,
  782. props: k(k({}, Dt), {
  783. active: Boolean,
  784. motion: Object,
  785. motionNodes: {
  786. type: Array
  787. },
  788. onMotionStart: Function,
  789. onMotionEnd: Function,
  790. motionType: String
  791. }),
  792. setup(e, a) {
  793. let {
  794. attrs: l,
  795. slots: s
  796. } = a;
  797. const c = O(!0), g = tt(), d = O(!1), E = b(() => e.motion ? e.motion : Vt()), $ = (D, N) => {
  798. var L, j, I, Q;
  799. N === "appear" ? (j = (L = E.value) === null || L === void 0 ? void 0 : L.onAfterEnter) === null || j === void 0 || j.call(L, D) : N === "leave" && ((Q = (I = E.value) === null || I === void 0 ? void 0 : I.onAfterLeave) === null || Q === void 0 || Q.call(I, D)), d.value || e.onMotionEnd(), d.value = !0;
  800. };
  801. return Ke(() => e.motionNodes, () => {
  802. e.motionNodes && e.motionType === "hide" && c.value && kt(() => {
  803. c.value = !1;
  804. });
  805. }, {
  806. immediate: !0,
  807. flush: "post"
  808. }), xt(() => {
  809. e.motionNodes && e.onMotionStart();
  810. }), sn(() => {
  811. e.motionNodes && $();
  812. }), () => {
  813. const {
  814. motion: D,
  815. motionNodes: N,
  816. motionType: L,
  817. active: j,
  818. eventKey: I
  819. } = e, Q = ct(e, ["motion", "motionNodes", "motionType", "active", "eventKey"]);
  820. return N ? K(dn, ee(ee({}, E.value), {}, {
  821. appear: L === "show",
  822. onAfterAppear: (f) => $(f, "appear"),
  823. onAfterLeave: (f) => $(f, "leave")
  824. }), {
  825. default: () => [cn(K("div", {
  826. class: `${g.value.prefixCls}-treenode-motion`
  827. }, [N.map((f) => {
  828. const P = ct(f.data, []), {
  829. title: T,
  830. key: H,
  831. isStart: M,
  832. isEnd: W
  833. } = f;
  834. return delete P.children, K(dt, ee(ee({}, P), {}, {
  835. title: T,
  836. active: j,
  837. data: f.data,
  838. key: H,
  839. eventKey: H,
  840. isStart: M,
  841. isEnd: W
  842. }), s);
  843. })]), [[un, c.value]])]
  844. }) : K(dt, ee(ee({
  845. class: l.class,
  846. style: l.style
  847. }, Q), {}, {
  848. active: j,
  849. eventKey: I
  850. }), s);
  851. };
  852. }
  853. });
  854. function On() {
  855. let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  856. const l = e.length, s = a.length;
  857. if (Math.abs(l - s) !== 1)
  858. return {
  859. add: !1,
  860. key: null
  861. };
  862. function c(g, d) {
  863. const E = /* @__PURE__ */ new Map();
  864. g.forEach((D) => {
  865. E.set(D, !0);
  866. });
  867. const $ = d.filter((D) => !E.has(D));
  868. return $.length === 1 ? $[0] : null;
  869. }
  870. return l < s ? {
  871. add: !0,
  872. key: c(e, a)
  873. } : {
  874. add: !1,
  875. key: c(a, e)
  876. };
  877. }
  878. function ut(e, a, l) {
  879. const s = e.findIndex((d) => d.key === l), c = e[s + 1], g = a.findIndex((d) => d.key === l);
  880. if (c) {
  881. const d = a.findIndex((E) => E.key === c.key);
  882. return a.slice(g + 1, d);
  883. }
  884. return a.slice(g + 1);
  885. }
  886. var vt = function(e, a) {
  887. var l = {};
  888. for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && a.indexOf(s) < 0 && (l[s] = e[s]);
  889. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var c = 0, s = Object.getOwnPropertySymbols(e); c < s.length; c++)
  890. a.indexOf(s[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, s[c]) && (l[s[c]] = e[s[c]]);
  891. return l;
  892. };
  893. const ft = {
  894. width: 0,
  895. height: 0,
  896. display: "flex",
  897. overflow: "hidden",
  898. opacity: 0,
  899. border: 0,
  900. padding: 0,
  901. margin: 0
  902. }, Pn = () => {
  903. }, xe = `RC_TREE_MOTION_${Math.random()}`, et = {
  904. key: xe
  905. }, $t = {
  906. key: xe,
  907. level: 0,
  908. index: 0,
  909. pos: "0",
  910. node: et,
  911. nodes: [et]
  912. }, yt = {
  913. parent: null,
  914. children: [],
  915. pos: $t.pos,
  916. data: et,
  917. title: null,
  918. key: xe,
  919. /** Hold empty list here since we do not use it */
  920. isStart: [],
  921. isEnd: []
  922. };
  923. function gt(e, a, l, s) {
  924. return a === !1 || !l ? e : e.slice(0, Math.ceil(l / s) + 1);
  925. }
  926. function ht(e) {
  927. const {
  928. key: a,
  929. pos: l
  930. } = e;
  931. return St(a, l);
  932. }
  933. function Tn(e) {
  934. let a = String(e.key), l = e;
  935. for (; l.parent; )
  936. l = l.parent, a = `${l.key} > ${a}`;
  937. return a;
  938. }
  939. const In = Ne({
  940. compatConfig: {
  941. MODE: 3
  942. },
  943. name: "NodeList",
  944. inheritAttrs: !1,
  945. props: wn,
  946. setup(e, a) {
  947. let {
  948. expose: l,
  949. attrs: s
  950. } = a;
  951. const c = Je(), g = Je(), {
  952. expandedKeys: d,
  953. flattenNodes: E
  954. } = Et();
  955. l({
  956. scrollTo: (f) => {
  957. c.value.scrollTo(f);
  958. },
  959. getIndentWidth: () => g.value.offsetWidth
  960. });
  961. const $ = O(E.value), D = O([]), N = Je(null);
  962. function L() {
  963. $.value = E.value, D.value = [], N.value = null, e.onListChangeEnd();
  964. }
  965. const j = tt();
  966. Ke([() => d.value.slice(), E], (f, P) => {
  967. let [T, H] = f, [M, W] = P;
  968. const A = On(M, T);
  969. if (A.key !== null) {
  970. const {
  971. virtual: te,
  972. height: ne,
  973. itemHeight: _
  974. } = e;
  975. if (A.add) {
  976. const X = W.findIndex((ae) => {
  977. let {
  978. key: J
  979. } = ae;
  980. return J === A.key;
  981. }), oe = gt(ut(W, H, A.key), te, ne, _), V = W.slice();
  982. V.splice(X + 1, 0, yt), $.value = V, D.value = oe, N.value = "show";
  983. } else {
  984. const X = H.findIndex((ae) => {
  985. let {
  986. key: J
  987. } = ae;
  988. return J === A.key;
  989. }), oe = gt(ut(H, W, A.key), te, ne, _), V = H.slice();
  990. V.splice(X + 1, 0, yt), $.value = V, D.value = oe, N.value = "hide";
  991. }
  992. } else W !== H && ($.value = H);
  993. }), Ke(() => j.value.dragging, (f) => {
  994. f || L();
  995. });
  996. const I = b(() => e.motion === void 0 ? $.value : E.value), Q = () => {
  997. e.onActiveChange(null);
  998. };
  999. return () => {
  1000. const f = k(k({}, e), s), {
  1001. prefixCls: P,
  1002. selectable: T,
  1003. checkable: H,
  1004. disabled: M,
  1005. motion: W,
  1006. height: A,
  1007. itemHeight: te,
  1008. virtual: ne,
  1009. focusable: _,
  1010. activeItem: X,
  1011. focused: oe,
  1012. tabindex: V,
  1013. onKeydown: ae,
  1014. onFocus: J,
  1015. onBlur: fe,
  1016. onListChangeStart: le,
  1017. onListChangeEnd: ke
  1018. } = f, ie = vt(f, ["prefixCls", "selectable", "checkable", "disabled", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabindex", "onKeydown", "onFocus", "onBlur", "onListChangeStart", "onListChangeEnd"]);
  1019. return K(vn, null, [oe && X && K("span", {
  1020. style: ft,
  1021. "aria-live": "assertive"
  1022. }, [Tn(X)]), K("div", null, [K("input", {
  1023. style: ft,
  1024. disabled: _ === !1 || M,
  1025. tabindex: _ !== !1 ? V : null,
  1026. onKeydown: ae,
  1027. onFocus: J,
  1028. onBlur: fe,
  1029. value: "",
  1030. onChange: Pn,
  1031. "aria-label": "for screen reader"
  1032. }, null)]), K("div", {
  1033. class: `${P}-treenode`,
  1034. "aria-hidden": !0,
  1035. style: {
  1036. position: "absolute",
  1037. pointerEvents: "none",
  1038. visibility: "hidden",
  1039. height: 0,
  1040. overflow: "hidden"
  1041. }
  1042. }, [K("div", {
  1043. class: `${P}-indent`
  1044. }, [K("div", {
  1045. ref: g,
  1046. class: `${P}-indent-unit`
  1047. }, null)])]), K(zt, ee(ee({}, Gt(ie, ["onActiveChange"])), {}, {
  1048. data: I.value,
  1049. itemKey: ht,
  1050. height: A,
  1051. fullHeight: !1,
  1052. virtual: ne,
  1053. itemHeight: te,
  1054. prefixCls: `${P}-list`,
  1055. ref: c,
  1056. onVisibleChange: (F, ce) => {
  1057. const B = new Set(F);
  1058. ce.filter((Z) => !B.has(Z)).some((Z) => ht(Z) === xe) && L();
  1059. }
  1060. }), {
  1061. default: (F) => {
  1062. const {
  1063. pos: ce
  1064. } = F, B = vt(F.data, []), {
  1065. title: U,
  1066. key: Z,
  1067. isStart: ue,
  1068. isEnd: pe
  1069. } = F, Se = St(Z, ce);
  1070. return delete B.key, delete B.children, K(Nn, ee(ee({}, B), {}, {
  1071. eventKey: Se,
  1072. title: U,
  1073. active: !!X && Z === X.key,
  1074. data: F.data,
  1075. isStart: ue,
  1076. isEnd: pe,
  1077. motion: W,
  1078. motionNodes: Z === xe ? D.value : null,
  1079. motionType: N.value,
  1080. onMotionStart: le,
  1081. onMotionEnd: L,
  1082. onMousemove: Q
  1083. }), null);
  1084. }
  1085. })]);
  1086. };
  1087. }
  1088. });
  1089. function Ln(e) {
  1090. let {
  1091. dropPosition: a,
  1092. dropLevelOffset: l,
  1093. indent: s
  1094. } = e;
  1095. const c = {
  1096. pointerEvents: "none",
  1097. position: "absolute",
  1098. right: 0,
  1099. backgroundColor: "red",
  1100. height: "2px"
  1101. };
  1102. switch (a) {
  1103. case -1:
  1104. c.top = 0, c.left = `${-l * s}px`;
  1105. break;
  1106. case 1:
  1107. c.bottom = 0, c.left = `${-l * s}px`;
  1108. break;
  1109. case 0:
  1110. c.bottom = 0, c.left = `${s}`;
  1111. break;
  1112. }
  1113. return K("div", {
  1114. style: c
  1115. }, null);
  1116. }
  1117. const Mn = 10, Gn = Ne({
  1118. compatConfig: {
  1119. MODE: 3
  1120. },
  1121. name: "Tree",
  1122. inheritAttrs: !1,
  1123. props: Wt(En(), {
  1124. prefixCls: "vc-tree",
  1125. showLine: !1,
  1126. showIcon: !0,
  1127. selectable: !0,
  1128. multiple: !1,
  1129. checkable: !1,
  1130. disabled: !1,
  1131. checkStrictly: !1,
  1132. draggable: !1,
  1133. expandAction: !1,
  1134. defaultExpandParent: !0,
  1135. autoExpandParent: !1,
  1136. defaultExpandAll: !1,
  1137. defaultExpandedKeys: [],
  1138. defaultCheckedKeys: [],
  1139. defaultSelectedKeys: [],
  1140. dropIndicatorRender: Ln,
  1141. allowDrop: () => !0
  1142. }),
  1143. setup(e, a) {
  1144. let {
  1145. attrs: l,
  1146. slots: s,
  1147. expose: c
  1148. } = a;
  1149. const g = O(!1);
  1150. let d = {};
  1151. const E = O(), $ = O([]), D = O([]), N = O([]), L = O([]), j = O([]), I = O([]), Q = {}, f = Kt({
  1152. draggingNodeKey: null,
  1153. dragChildrenKeys: [],
  1154. // dropTargetKey is the key of abstract-drop-node
  1155. // the abstract-drop-node is the real drop node when drag and drop
  1156. // not the DOM drag over node
  1157. dropTargetKey: null,
  1158. dropPosition: null,
  1159. dropContainerKey: null,
  1160. dropLevelOffset: null,
  1161. dropTargetPos: null,
  1162. dropAllowed: !0,
  1163. // the abstract-drag-over-node
  1164. // if mouse is on the bottom of top dom node or no the top of the bottom dom node
  1165. // abstract-drag-over-node is the top node
  1166. dragOverNodeKey: null
  1167. }), P = O([]);
  1168. Ke([() => e.treeData, () => e.children], () => {
  1169. P.value = e.treeData !== void 0 ? e.treeData.slice() : gn(ot(e.children));
  1170. }, {
  1171. immediate: !0,
  1172. deep: !0
  1173. });
  1174. const T = O({}), H = O(!1), M = O(null), W = O(!1), A = b(() => hn(e.fieldNames)), te = O();
  1175. let ne = null, _ = null, X = null;
  1176. const oe = b(() => ({
  1177. expandedKeysSet: V.value,
  1178. selectedKeysSet: ae.value,
  1179. loadedKeysSet: J.value,
  1180. loadingKeysSet: fe.value,
  1181. checkedKeysSet: le.value,
  1182. halfCheckedKeysSet: ke.value,
  1183. dragOverNodeKey: f.dragOverNodeKey,
  1184. dropPosition: f.dropPosition,
  1185. keyEntities: T.value
  1186. })), V = b(() => new Set(I.value)), ae = b(() => new Set($.value)), J = b(() => new Set(L.value)), fe = b(() => new Set(j.value)), le = b(() => new Set(D.value)), ke = b(() => new Set(N.value));
  1187. $e(() => {
  1188. if (P.value) {
  1189. const n = pn(P.value, {
  1190. fieldNames: A.value
  1191. });
  1192. T.value = k({
  1193. [xe]: $t
  1194. }, n.keyEntities);
  1195. }
  1196. });
  1197. let ie = !1;
  1198. Ke(
  1199. [() => e.expandedKeys, () => e.autoExpandParent, T],
  1200. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  1201. (n, o) => {
  1202. let [r, v] = n, [h, y] = o, u = I.value;
  1203. if (e.expandedKeys !== void 0 || ie && v !== y)
  1204. u = e.autoExpandParent || !ie && e.defaultExpandParent ? at(e.expandedKeys, T.value) : e.expandedKeys;
  1205. else if (!ie && e.defaultExpandAll) {
  1206. const x = k({}, T.value);
  1207. delete x[xe], u = Object.keys(x).map((w) => x[w].key);
  1208. } else !ie && e.defaultExpandedKeys && (u = e.autoExpandParent || e.defaultExpandParent ? at(e.defaultExpandedKeys, T.value) : e.defaultExpandedKeys);
  1209. u && (I.value = u), ie = !0;
  1210. },
  1211. {
  1212. immediate: !0
  1213. }
  1214. );
  1215. const F = O([]);
  1216. $e(() => {
  1217. F.value = bn(P.value, I.value, A.value);
  1218. }), $e(() => {
  1219. e.selectable && (e.selectedKeys !== void 0 ? $.value = lt(e.selectedKeys, e) : !ie && e.defaultSelectedKeys && ($.value = lt(e.defaultSelectedKeys, e)));
  1220. });
  1221. const {
  1222. maxLevel: ce,
  1223. levelEntities: B
  1224. } = mn(T);
  1225. $e(() => {
  1226. if (e.checkable) {
  1227. let n;
  1228. if (e.checkedKeys !== void 0 ? n = Qe(e.checkedKeys) || {} : !ie && e.defaultCheckedKeys ? n = Qe(e.defaultCheckedKeys) || {} : P.value && (n = Qe(e.checkedKeys) || {
  1229. checkedKeys: D.value,
  1230. halfCheckedKeys: N.value
  1231. }), n) {
  1232. let {
  1233. checkedKeys: o = [],
  1234. halfCheckedKeys: r = []
  1235. } = n;
  1236. e.checkStrictly || ({
  1237. checkedKeys: o,
  1238. halfCheckedKeys: r
  1239. } = Ze(o, !0, T.value, ce.value, B.value)), D.value = o, N.value = r;
  1240. }
  1241. }
  1242. }), $e(() => {
  1243. e.loadedKeys && (L.value = e.loadedKeys);
  1244. });
  1245. const U = () => {
  1246. k(f, {
  1247. dragOverNodeKey: null,
  1248. dropPosition: null,
  1249. dropLevelOffset: null,
  1250. dropTargetKey: null,
  1251. dropContainerKey: null,
  1252. dropTargetPos: null,
  1253. dropAllowed: !1
  1254. });
  1255. }, Z = (n) => {
  1256. te.value.scrollTo(n);
  1257. };
  1258. Ke(() => e.activeKey, () => {
  1259. e.activeKey !== void 0 && (M.value = e.activeKey);
  1260. }, {
  1261. immediate: !0
  1262. }), Ke(M, (n) => {
  1263. kt(() => {
  1264. n !== null && Z({
  1265. key: n
  1266. });
  1267. });
  1268. }, {
  1269. immediate: !0,
  1270. flush: "post"
  1271. });
  1272. const ue = (n) => {
  1273. e.expandedKeys === void 0 && (I.value = n);
  1274. }, pe = () => {
  1275. f.draggingNodeKey !== null && k(f, {
  1276. draggingNodeKey: null,
  1277. dropPosition: null,
  1278. dropContainerKey: null,
  1279. dropTargetKey: null,
  1280. dropLevelOffset: null,
  1281. dropAllowed: !0,
  1282. dragOverNodeKey: null
  1283. }), ne = null, X = null;
  1284. }, Se = (n, o) => {
  1285. const {
  1286. onDragend: r
  1287. } = e;
  1288. f.dragOverNodeKey = null, pe(), r == null || r({
  1289. event: n,
  1290. node: o.eventData
  1291. }), _ = null;
  1292. }, we = (n) => {
  1293. Se(n, null), window.removeEventListener("dragend", we);
  1294. }, Be = (n, o) => {
  1295. const {
  1296. onDragstart: r
  1297. } = e, {
  1298. eventKey: v,
  1299. eventData: h
  1300. } = o;
  1301. _ = o, ne = {
  1302. x: n.clientX,
  1303. y: n.clientY
  1304. };
  1305. const y = ve(I.value, v);
  1306. f.draggingNodeKey = v, f.dragChildrenKeys = Kn(v, T.value), E.value = te.value.getIndentWidth(), ue(y), window.addEventListener("dragend", we), r && r({
  1307. event: n,
  1308. node: h
  1309. });
  1310. }, Re = (n, o) => {
  1311. const {
  1312. onDragenter: r,
  1313. onExpand: v,
  1314. allowDrop: h,
  1315. direction: y
  1316. } = e, {
  1317. pos: u,
  1318. eventKey: x
  1319. } = o;
  1320. if (X !== x && (X = x), !_) {
  1321. U();
  1322. return;
  1323. }
  1324. const {
  1325. dropPosition: w,
  1326. dropLevelOffset: p,
  1327. dropTargetKey: m,
  1328. dropContainerKey: C,
  1329. dropTargetPos: Y,
  1330. dropAllowed: re,
  1331. dragOverNodeKey: se
  1332. } = it(n, _, o, E.value, ne, h, F.value, T.value, V.value, y);
  1333. if (
  1334. // don't allow drop inside its children
  1335. f.dragChildrenKeys.indexOf(m) !== -1 || // don't allow drop when drop is not allowed caculated by calcDropPosition
  1336. !re
  1337. ) {
  1338. U();
  1339. return;
  1340. }
  1341. if (d || (d = {}), Object.keys(d).forEach((q) => {
  1342. clearTimeout(d[q]);
  1343. }), _.eventKey !== o.eventKey && (d[u] = window.setTimeout(() => {
  1344. if (f.draggingNodeKey === null) return;
  1345. let q = I.value.slice();
  1346. const ye = T.value[o.eventKey];
  1347. ye && (ye.children || []).length && (q = ge(I.value, o.eventKey)), ue(q), v && v(q, {
  1348. node: o.eventData,
  1349. expanded: !0,
  1350. nativeEvent: n
  1351. });
  1352. }, 800)), _.eventKey === m && p === 0) {
  1353. U();
  1354. return;
  1355. }
  1356. k(f, {
  1357. dragOverNodeKey: se,
  1358. dropPosition: w,
  1359. dropLevelOffset: p,
  1360. dropTargetKey: m,
  1361. dropContainerKey: C,
  1362. dropTargetPos: Y,
  1363. dropAllowed: re
  1364. }), r && r({
  1365. event: n,
  1366. node: o.eventData,
  1367. expandedKeys: I.value
  1368. });
  1369. }, je = (n, o) => {
  1370. const {
  1371. onDragover: r,
  1372. allowDrop: v,
  1373. direction: h
  1374. } = e;
  1375. if (!_)
  1376. return;
  1377. const {
  1378. dropPosition: y,
  1379. dropLevelOffset: u,
  1380. dropTargetKey: x,
  1381. dropContainerKey: w,
  1382. dropAllowed: p,
  1383. dropTargetPos: m,
  1384. dragOverNodeKey: C
  1385. } = it(n, _, o, E.value, ne, v, F.value, T.value, V.value, h);
  1386. f.dragChildrenKeys.indexOf(x) !== -1 || !p || (_.eventKey === x && u === 0 ? f.dropPosition === null && f.dropLevelOffset === null && f.dropTargetKey === null && f.dropContainerKey === null && f.dropTargetPos === null && f.dropAllowed === !1 && f.dragOverNodeKey === null || U() : y === f.dropPosition && u === f.dropLevelOffset && x === f.dropTargetKey && w === f.dropContainerKey && m === f.dropTargetPos && p === f.dropAllowed && C === f.dragOverNodeKey || k(f, {
  1387. dropPosition: y,
  1388. dropLevelOffset: u,
  1389. dropTargetKey: x,
  1390. dropContainerKey: w,
  1391. dropTargetPos: m,
  1392. dropAllowed: p,
  1393. dragOverNodeKey: C
  1394. }), r && r({
  1395. event: n,
  1396. node: o.eventData
  1397. }));
  1398. }, He = (n, o) => {
  1399. X === o.eventKey && !n.currentTarget.contains(n.relatedTarget) && (U(), X = null);
  1400. const {
  1401. onDragleave: r
  1402. } = e;
  1403. r && r({
  1404. event: n,
  1405. node: o.eventData
  1406. });
  1407. }, Ve = function(n, o) {
  1408. let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
  1409. var v;
  1410. const {
  1411. dragChildrenKeys: h,
  1412. dropPosition: y,
  1413. dropTargetKey: u,
  1414. dropTargetPos: x,
  1415. dropAllowed: w
  1416. } = f;
  1417. if (!w) return;
  1418. const {
  1419. onDrop: p
  1420. } = e;
  1421. if (f.dragOverNodeKey = null, pe(), u === null) return;
  1422. const m = k(k({}, Fe(u, ot(oe.value))), {
  1423. active: ((v = S.value) === null || v === void 0 ? void 0 : v.key) === u,
  1424. data: T.value[u].node
  1425. }), C = h.indexOf(u) !== -1;
  1426. Ae(!C, "Can not drop to dragNode's children node. Maybe this is a bug of ant-design-vue. Please report an issue.");
  1427. const Y = xn(x), re = {
  1428. event: n,
  1429. node: _e(m),
  1430. dragNode: _ ? _.eventData : null,
  1431. dragNodesKeys: [_.eventKey].concat(h),
  1432. dropToGap: y !== 0,
  1433. dropPosition: y + Number(Y[Y.length - 1])
  1434. };
  1435. r || p == null || p(re), _ = null;
  1436. }, Oe = (n, o) => {
  1437. const {
  1438. expanded: r,
  1439. key: v
  1440. } = o, h = F.value.filter((u) => u.key === v)[0], y = _e(k(k({}, Fe(v, oe.value)), {
  1441. data: h.data
  1442. }));
  1443. ue(r ? ve(I.value, v) : ge(I.value, v)), be(n, y);
  1444. }, ze = (n, o) => {
  1445. const {
  1446. onClick: r,
  1447. expandAction: v
  1448. } = e;
  1449. v === "click" && Oe(n, o), r && r(n, o);
  1450. }, Ge = (n, o) => {
  1451. const {
  1452. onDblclick: r,
  1453. expandAction: v
  1454. } = e;
  1455. (v === "doubleclick" || v === "dblclick") && Oe(n, o), r && r(n, o);
  1456. }, Pe = (n, o) => {
  1457. let r = $.value;
  1458. const {
  1459. onSelect: v,
  1460. multiple: h
  1461. } = e, {
  1462. selected: y
  1463. } = o, u = o[A.value.key], x = !y;
  1464. x ? h ? r = ge(r, u) : r = [u] : r = ve(r, u);
  1465. const w = T.value, p = r.map((m) => {
  1466. const C = w[m];
  1467. return C ? C.node : null;
  1468. }).filter((m) => m);
  1469. e.selectedKeys === void 0 && ($.value = r), v && v(r, {
  1470. event: "select",
  1471. selected: x,
  1472. node: o,
  1473. selectedNodes: p,
  1474. nativeEvent: n
  1475. });
  1476. }, Te = (n, o, r) => {
  1477. const {
  1478. checkStrictly: v,
  1479. onCheck: h
  1480. } = e, y = o[A.value.key];
  1481. let u;
  1482. const x = {
  1483. event: "check",
  1484. node: o,
  1485. checked: r,
  1486. nativeEvent: n
  1487. }, w = T.value;
  1488. if (v) {
  1489. const p = r ? ge(D.value, y) : ve(D.value, y), m = ve(N.value, y);
  1490. u = {
  1491. checked: p,
  1492. halfChecked: m
  1493. }, x.checkedNodes = p.map((C) => w[C]).filter((C) => C).map((C) => C.node), e.checkedKeys === void 0 && (D.value = p);
  1494. } else {
  1495. let {
  1496. checkedKeys: p,
  1497. halfCheckedKeys: m
  1498. } = Ze([...D.value, y], !0, w, ce.value, B.value);
  1499. if (!r) {
  1500. const C = new Set(p);
  1501. C.delete(y), {
  1502. checkedKeys: p,
  1503. halfCheckedKeys: m
  1504. } = Ze(Array.from(C), {
  1505. checked: !1,
  1506. halfCheckedKeys: m
  1507. }, w, ce.value, B.value);
  1508. }
  1509. u = p, x.checkedNodes = [], x.checkedNodesPositions = [], x.halfCheckedKeys = m, p.forEach((C) => {
  1510. const Y = w[C];
  1511. if (!Y) return;
  1512. const {
  1513. node: re,
  1514. pos: se
  1515. } = Y;
  1516. x.checkedNodes.push(re), x.checkedNodesPositions.push({
  1517. node: re,
  1518. pos: se
  1519. });
  1520. }), e.checkedKeys === void 0 && (D.value = p, N.value = m);
  1521. }
  1522. h && h(u, x);
  1523. }, Ie = (n) => {
  1524. const o = n[A.value.key], r = new Promise((v, h) => {
  1525. const {
  1526. loadData: y,
  1527. onLoad: u
  1528. } = e;
  1529. if (!y || J.value.has(o) || fe.value.has(o))
  1530. return null;
  1531. y(n).then(() => {
  1532. const w = ge(L.value, o), p = ve(j.value, o);
  1533. u && u(w, {
  1534. event: "load",
  1535. node: n
  1536. }), e.loadedKeys === void 0 && (L.value = w), j.value = p, v();
  1537. }).catch((w) => {
  1538. const p = ve(j.value, o);
  1539. if (j.value = p, Q[o] = (Q[o] || 0) + 1, Q[o] >= Mn) {
  1540. Ae(!1, "Retry for `loadData` many times but still failed. No more retry.");
  1541. const m = ge(L.value, o);
  1542. e.loadedKeys === void 0 && (L.value = m), v();
  1543. }
  1544. h(w);
  1545. }), j.value = ge(j.value, o);
  1546. });
  1547. return r.catch(() => {
  1548. }), r;
  1549. }, We = (n, o) => {
  1550. const {
  1551. onMouseenter: r
  1552. } = e;
  1553. r && r({
  1554. event: n,
  1555. node: o
  1556. });
  1557. }, Le = (n, o) => {
  1558. const {
  1559. onMouseleave: r
  1560. } = e;
  1561. r && r({
  1562. event: n,
  1563. node: o
  1564. });
  1565. }, Xe = (n, o) => {
  1566. const {
  1567. onRightClick: r
  1568. } = e;
  1569. r && (n.preventDefault(), r({
  1570. event: n,
  1571. node: o
  1572. }));
  1573. }, Ue = (n) => {
  1574. const {
  1575. onFocus: o
  1576. } = e;
  1577. H.value = !0, o && o(n);
  1578. }, Me = (n) => {
  1579. const {
  1580. onBlur: o
  1581. } = e;
  1582. H.value = !1, i(null), o && o(n);
  1583. }, be = (n, o) => {
  1584. let r = I.value;
  1585. const {
  1586. onExpand: v,
  1587. loadData: h
  1588. } = e, {
  1589. expanded: y
  1590. } = o, u = o[A.value.key];
  1591. if (W.value)
  1592. return;
  1593. const x = r.indexOf(u), w = !y;
  1594. if (Ae(y && x !== -1 || !y && x === -1, "Expand state not sync with index check"), w ? r = ge(r, u) : r = ve(r, u), ue(r), v && v(r, {
  1595. node: o,
  1596. expanded: w,
  1597. nativeEvent: n
  1598. }), w && h) {
  1599. const p = Ie(o);
  1600. p && p.then(() => {
  1601. }).catch((m) => {
  1602. const C = ve(I.value, u);
  1603. ue(C), Promise.reject(m);
  1604. });
  1605. }
  1606. }, Ye = () => {
  1607. W.value = !0;
  1608. }, t = () => {
  1609. setTimeout(() => {
  1610. W.value = !1;
  1611. });
  1612. }, i = (n) => {
  1613. const {
  1614. onActiveChange: o
  1615. } = e;
  1616. M.value !== n && (e.activeKey !== void 0 && (M.value = n), n !== null && Z({
  1617. key: n
  1618. }), o && o(n));
  1619. }, S = b(() => M.value === null ? null : F.value.find((n) => {
  1620. let {
  1621. key: o
  1622. } = n;
  1623. return o === M.value;
  1624. }) || null), R = (n) => {
  1625. let o = F.value.findIndex((v) => {
  1626. let {
  1627. key: h
  1628. } = v;
  1629. return h === M.value;
  1630. });
  1631. o === -1 && n < 0 && (o = F.value.length), o = (o + n + F.value.length) % F.value.length;
  1632. const r = F.value[o];
  1633. if (r) {
  1634. const {
  1635. key: v
  1636. } = r;
  1637. i(v);
  1638. } else
  1639. i(null);
  1640. }, z = b(() => _e(k(k({}, Fe(M.value, oe.value)), {
  1641. data: S.value.data,
  1642. active: !0
  1643. }))), G = (n) => {
  1644. const {
  1645. onKeydown: o,
  1646. checkable: r,
  1647. selectable: v
  1648. } = e;
  1649. switch (n.which) {
  1650. case Ce.UP: {
  1651. R(-1), n.preventDefault();
  1652. break;
  1653. }
  1654. case Ce.DOWN: {
  1655. R(1), n.preventDefault();
  1656. break;
  1657. }
  1658. }
  1659. const h = S.value;
  1660. if (h && h.data) {
  1661. const y = h.data.isLeaf === !1 || !!(h.data.children || []).length, u = z.value;
  1662. switch (n.which) {
  1663. case Ce.LEFT: {
  1664. y && V.value.has(M.value) ? be({}, u) : h.parent && i(h.parent.key), n.preventDefault();
  1665. break;
  1666. }
  1667. case Ce.RIGHT: {
  1668. y && !V.value.has(M.value) ? be({}, u) : h.children && h.children.length && i(h.children[0].key), n.preventDefault();
  1669. break;
  1670. }
  1671. case Ce.ENTER:
  1672. case Ce.SPACE: {
  1673. r && !u.disabled && u.checkable !== !1 && !u.disableCheckbox ? Te({}, u, !le.value.has(M.value)) : !r && v && !u.disabled && u.selectable !== !1 && Pe({}, u);
  1674. break;
  1675. }
  1676. }
  1677. }
  1678. o && o(n);
  1679. };
  1680. return c({
  1681. onNodeExpand: be,
  1682. scrollTo: Z,
  1683. onKeydown: G,
  1684. selectedKeys: b(() => $.value),
  1685. checkedKeys: b(() => D.value),
  1686. halfCheckedKeys: b(() => N.value),
  1687. loadedKeys: b(() => L.value),
  1688. loadingKeys: b(() => j.value),
  1689. expandedKeys: b(() => I.value)
  1690. }), fn(() => {
  1691. window.removeEventListener("dragend", we), g.value = !0;
  1692. }), Sn({
  1693. expandedKeys: I,
  1694. selectedKeys: $,
  1695. loadedKeys: L,
  1696. loadingKeys: j,
  1697. checkedKeys: D,
  1698. halfCheckedKeys: N,
  1699. expandedKeysSet: V,
  1700. selectedKeysSet: ae,
  1701. loadedKeysSet: J,
  1702. loadingKeysSet: fe,
  1703. checkedKeysSet: le,
  1704. halfCheckedKeysSet: ke,
  1705. flattenNodes: F
  1706. }), () => {
  1707. const {
  1708. // focused,
  1709. // flattenNodes,
  1710. // keyEntities,
  1711. draggingNodeKey: n,
  1712. // activeKey,
  1713. dropLevelOffset: o,
  1714. dropContainerKey: r,
  1715. dropTargetKey: v,
  1716. dropPosition: h,
  1717. dragOverNodeKey: y
  1718. // indent,
  1719. } = f, {
  1720. prefixCls: u,
  1721. showLine: x,
  1722. focusable: w,
  1723. tabindex: p = 0,
  1724. selectable: m,
  1725. showIcon: C,
  1726. icon: Y = s.icon,
  1727. switcherIcon: re,
  1728. draggable: se,
  1729. checkable: q,
  1730. checkStrictly: ye,
  1731. disabled: Ee,
  1732. motion: qe,
  1733. loadData: Nt,
  1734. filterTreeNode: Ot,
  1735. height: Pt,
  1736. itemHeight: Tt,
  1737. virtual: It,
  1738. dropIndicatorRender: Lt,
  1739. onContextmenu: Mt,
  1740. onScroll: At,
  1741. direction: Ft,
  1742. rootClassName: _t,
  1743. rootStyle: Bt
  1744. } = e, {
  1745. class: Rt,
  1746. style: jt
  1747. } = l, Ht = pt(k(k({}, e), l), {
  1748. aria: !0,
  1749. data: !0
  1750. });
  1751. let De;
  1752. return se ? typeof se == "object" ? De = se : typeof se == "function" ? De = {
  1753. nodeDraggable: se
  1754. } : De = {} : De = !1, K(kn, {
  1755. value: {
  1756. prefixCls: u,
  1757. selectable: m,
  1758. showIcon: C,
  1759. icon: Y,
  1760. switcherIcon: re,
  1761. draggable: De,
  1762. draggingNodeKey: n,
  1763. checkable: q,
  1764. customCheckable: s.checkable,
  1765. checkStrictly: ye,
  1766. disabled: Ee,
  1767. keyEntities: T.value,
  1768. dropLevelOffset: o,
  1769. dropContainerKey: r,
  1770. dropTargetKey: v,
  1771. dropPosition: h,
  1772. dragOverNodeKey: y,
  1773. dragging: n !== null,
  1774. indent: E.value,
  1775. direction: Ft,
  1776. dropIndicatorRender: Lt,
  1777. loadData: Nt,
  1778. filterTreeNode: Ot,
  1779. onNodeClick: ze,
  1780. onNodeDoubleClick: Ge,
  1781. onNodeExpand: be,
  1782. onNodeSelect: Pe,
  1783. onNodeCheck: Te,
  1784. onNodeLoad: Ie,
  1785. onNodeMouseEnter: We,
  1786. onNodeMouseLeave: Le,
  1787. onNodeContextMenu: Xe,
  1788. onNodeDragStart: Be,
  1789. onNodeDragEnter: Re,
  1790. onNodeDragOver: je,
  1791. onNodeDragLeave: He,
  1792. onNodeDragEnd: Se,
  1793. onNodeDrop: Ve,
  1794. slots: s
  1795. }
  1796. }, {
  1797. default: () => [K("div", {
  1798. role: "tree",
  1799. class: he(u, Rt, _t, {
  1800. [`${u}-show-line`]: x,
  1801. [`${u}-focused`]: H.value,
  1802. [`${u}-active-focused`]: M.value !== null
  1803. }),
  1804. style: Bt
  1805. }, [K(In, ee({
  1806. ref: te,
  1807. prefixCls: u,
  1808. style: jt,
  1809. disabled: Ee,
  1810. selectable: m,
  1811. checkable: !!q,
  1812. motion: qe,
  1813. height: Pt,
  1814. itemHeight: Tt,
  1815. virtual: It,
  1816. focusable: w,
  1817. focused: H.value,
  1818. tabindex: p,
  1819. activeItem: S.value,
  1820. onFocus: Ue,
  1821. onBlur: Me,
  1822. onKeydown: G,
  1823. onActiveChange: i,
  1824. onListChangeStart: Ye,
  1825. onListChangeEnd: t,
  1826. onContextmenu: Mt,
  1827. onScroll: At
  1828. }, Ht), null)])]
  1829. });
  1830. };
  1831. }
  1832. });
  1833. function Wn(e, a, l, s, c) {
  1834. const {
  1835. isLeaf: g,
  1836. expanded: d,
  1837. loading: E
  1838. } = l;
  1839. let $ = a;
  1840. if (E)
  1841. return K(Xt, {
  1842. class: `${e}-switcher-loading-icon`
  1843. }, null);
  1844. let D;
  1845. c && typeof c == "object" && (D = c.showLeafIcon);
  1846. let N = null;
  1847. const L = `${e}-switcher-icon`;
  1848. return g ? c ? D && s ? s(l) : (typeof c == "object" && !D ? N = K("span", {
  1849. class: `${e}-switcher-leaf-line`
  1850. }, null) : N = K(Ut, {
  1851. class: `${e}-switcher-line-icon`
  1852. }, null), N) : null : (N = K(Yt, {
  1853. class: L
  1854. }, null), c && (N = d ? K(qt, {
  1855. class: `${e}-switcher-line-icon`
  1856. }, null) : K(Jt, {
  1857. class: `${e}-switcher-line-icon`
  1858. }, null)), typeof a == "function" ? $ = a(k(k({}, l), {
  1859. defaultIcon: N,
  1860. switcherCls: L
  1861. })) : Qt($) && ($ = yn($, {
  1862. class: L
  1863. })), $ || N);
  1864. }
  1865. const An = new an("ant-tree-node-fx-do-not-use", {
  1866. "0%": {
  1867. opacity: 0
  1868. },
  1869. "100%": {
  1870. opacity: 1
  1871. }
  1872. }), Fn = (e, a) => ({
  1873. [`.${e}-switcher-icon`]: {
  1874. display: "inline-block",
  1875. fontSize: 10,
  1876. verticalAlign: "baseline",
  1877. svg: {
  1878. transition: `transform ${a.motionDurationSlow}`
  1879. }
  1880. }
  1881. }), _n = (e, a) => ({
  1882. [`.${e}-drop-indicator`]: {
  1883. position: "absolute",
  1884. // it should displayed over the following node
  1885. zIndex: 1,
  1886. height: 2,
  1887. backgroundColor: a.colorPrimary,
  1888. borderRadius: 1,
  1889. pointerEvents: "none",
  1890. "&:after": {
  1891. position: "absolute",
  1892. top: -3,
  1893. insetInlineStart: -6,
  1894. width: 8,
  1895. height: 8,
  1896. backgroundColor: "transparent",
  1897. border: `${a.lineWidthBold}px solid ${a.colorPrimary}`,
  1898. borderRadius: "50%",
  1899. content: '""'
  1900. }
  1901. }
  1902. }), Bn = (e, a) => {
  1903. const {
  1904. treeCls: l,
  1905. treeNodeCls: s,
  1906. treeNodePadding: c,
  1907. treeTitleHeight: g
  1908. } = a, d = (g - a.fontSizeLG) / 2, E = a.paddingXS;
  1909. return {
  1910. [l]: k(k({}, on(a)), {
  1911. background: a.colorBgContainer,
  1912. borderRadius: a.borderRadius,
  1913. transition: `background-color ${a.motionDurationSlow}`,
  1914. [`&${l}-rtl`]: {
  1915. // >>> Switcher
  1916. [`${l}-switcher`]: {
  1917. "&_close": {
  1918. [`${l}-switcher-icon`]: {
  1919. svg: {
  1920. transform: "rotate(90deg)"
  1921. }
  1922. }
  1923. }
  1924. }
  1925. },
  1926. [`&-focused:not(:hover):not(${l}-active-focused)`]: k({}, nt(a)),
  1927. // =================== Virtual List ===================
  1928. [`${l}-list-holder-inner`]: {
  1929. alignItems: "flex-start"
  1930. },
  1931. [`&${l}-block-node`]: {
  1932. [`${l}-list-holder-inner`]: {
  1933. alignItems: "stretch",
  1934. // >>> Title
  1935. [`${l}-node-content-wrapper`]: {
  1936. flex: "auto"
  1937. },
  1938. // >>> Drag
  1939. [`${s}.dragging`]: {
  1940. position: "relative",
  1941. "&:after": {
  1942. position: "absolute",
  1943. top: 0,
  1944. insetInlineEnd: 0,
  1945. bottom: c,
  1946. insetInlineStart: 0,
  1947. border: `1px solid ${a.colorPrimary}`,
  1948. opacity: 0,
  1949. animationName: An,
  1950. animationDuration: a.motionDurationSlow,
  1951. animationPlayState: "running",
  1952. animationFillMode: "forwards",
  1953. content: '""',
  1954. pointerEvents: "none"
  1955. }
  1956. }
  1957. }
  1958. },
  1959. // ===================== TreeNode =====================
  1960. [`${s}`]: {
  1961. display: "flex",
  1962. alignItems: "flex-start",
  1963. padding: `0 0 ${c}px 0`,
  1964. outline: "none",
  1965. "&-rtl": {
  1966. direction: "rtl"
  1967. },
  1968. // Disabled
  1969. "&-disabled": {
  1970. // >>> Title
  1971. [`${l}-node-content-wrapper`]: {
  1972. color: a.colorTextDisabled,
  1973. cursor: "not-allowed",
  1974. "&:hover": {
  1975. background: "transparent"
  1976. }
  1977. }
  1978. },
  1979. [`&-active ${l}-node-content-wrapper`]: k({}, nt(a)),
  1980. [`&:not(${s}-disabled).filter-node ${l}-title`]: {
  1981. color: "inherit",
  1982. fontWeight: 500
  1983. },
  1984. "&-draggable": {
  1985. [`${l}-draggable-icon`]: {
  1986. width: g,
  1987. lineHeight: `${g}px`,
  1988. textAlign: "center",
  1989. visibility: "visible",
  1990. opacity: 0.2,
  1991. transition: `opacity ${a.motionDurationSlow}`,
  1992. [`${s}:hover &`]: {
  1993. opacity: 0.45
  1994. }
  1995. },
  1996. [`&${s}-disabled`]: {
  1997. [`${l}-draggable-icon`]: {
  1998. visibility: "hidden"
  1999. }
  2000. }
  2001. }
  2002. },
  2003. // >>> Indent
  2004. [`${l}-indent`]: {
  2005. alignSelf: "stretch",
  2006. whiteSpace: "nowrap",
  2007. userSelect: "none",
  2008. "&-unit": {
  2009. display: "inline-block",
  2010. width: g
  2011. }
  2012. },
  2013. // >>> Drag Handler
  2014. [`${l}-draggable-icon`]: {
  2015. visibility: "hidden"
  2016. },
  2017. // >>> Switcher
  2018. [`${l}-switcher`]: k(k({}, Fn(e, a)), {
  2019. position: "relative",
  2020. flex: "none",
  2021. alignSelf: "stretch",
  2022. width: g,
  2023. margin: 0,
  2024. lineHeight: `${g}px`,
  2025. textAlign: "center",
  2026. cursor: "pointer",
  2027. userSelect: "none",
  2028. "&-noop": {
  2029. cursor: "default"
  2030. },
  2031. "&_close": {
  2032. [`${l}-switcher-icon`]: {
  2033. svg: {
  2034. transform: "rotate(-90deg)"
  2035. }
  2036. }
  2037. },
  2038. "&-loading-icon": {
  2039. color: a.colorPrimary
  2040. },
  2041. "&-leaf-line": {
  2042. position: "relative",
  2043. zIndex: 1,
  2044. display: "inline-block",
  2045. width: "100%",
  2046. height: "100%",
  2047. // https://github.com/ant-design/ant-design/issues/31884
  2048. "&:before": {
  2049. position: "absolute",
  2050. top: 0,
  2051. insetInlineEnd: g / 2,
  2052. bottom: -c,
  2053. marginInlineStart: -1,
  2054. borderInlineEnd: `1px solid ${a.colorBorder}`,
  2055. content: '""'
  2056. },
  2057. "&:after": {
  2058. position: "absolute",
  2059. width: g / 2 * 0.8,
  2060. height: g / 2,
  2061. borderBottom: `1px solid ${a.colorBorder}`,
  2062. content: '""'
  2063. }
  2064. }
  2065. }),
  2066. // >>> Checkbox
  2067. [`${l}-checkbox`]: {
  2068. top: "initial",
  2069. marginInlineEnd: E,
  2070. marginBlockStart: d
  2071. },
  2072. // >>> Title
  2073. // add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
  2074. [`${l}-node-content-wrapper, ${l}-checkbox + span`]: {
  2075. position: "relative",
  2076. zIndex: "auto",
  2077. minHeight: g,
  2078. margin: 0,
  2079. padding: `0 ${a.paddingXS / 2}px`,
  2080. color: "inherit",
  2081. lineHeight: `${g}px`,
  2082. background: "transparent",
  2083. borderRadius: a.borderRadius,
  2084. cursor: "pointer",
  2085. transition: `all ${a.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,
  2086. "&:hover": {
  2087. backgroundColor: a.controlItemBgHover
  2088. },
  2089. [`&${l}-node-selected`]: {
  2090. backgroundColor: a.controlItemBgActive
  2091. },
  2092. // Icon
  2093. [`${l}-iconEle`]: {
  2094. display: "inline-block",
  2095. width: g,
  2096. height: g,
  2097. lineHeight: `${g}px`,
  2098. textAlign: "center",
  2099. verticalAlign: "top",
  2100. "&:empty": {
  2101. display: "none"
  2102. }
  2103. }
  2104. },
  2105. // https://github.com/ant-design/ant-design/issues/28217
  2106. [`${l}-unselectable ${l}-node-content-wrapper:hover`]: {
  2107. backgroundColor: "transparent"
  2108. },
  2109. // ==================== Draggable =====================
  2110. [`${l}-node-content-wrapper`]: k({
  2111. lineHeight: `${g}px`,
  2112. userSelect: "none"
  2113. }, _n(e, a)),
  2114. [`${s}.drop-container`]: {
  2115. "> [draggable]": {
  2116. boxShadow: `0 0 0 2px ${a.colorPrimary}`
  2117. }
  2118. },
  2119. // ==================== Show Line =====================
  2120. "&-show-line": {
  2121. // ================ Indent lines ================
  2122. [`${l}-indent`]: {
  2123. "&-unit": {
  2124. position: "relative",
  2125. height: "100%",
  2126. "&:before": {
  2127. position: "absolute",
  2128. top: 0,
  2129. insetInlineEnd: g / 2,
  2130. bottom: -c,
  2131. borderInlineEnd: `1px solid ${a.colorBorder}`,
  2132. content: '""'
  2133. },
  2134. "&-end": {
  2135. "&:before": {
  2136. display: "none"
  2137. }
  2138. }
  2139. }
  2140. },
  2141. // ============== Cover Background ==============
  2142. [`${l}-switcher`]: {
  2143. background: "transparent",
  2144. "&-line-icon": {
  2145. // https://github.com/ant-design/ant-design/issues/32813
  2146. verticalAlign: "-0.15em"
  2147. }
  2148. }
  2149. },
  2150. [`${s}-leaf-last`]: {
  2151. [`${l}-switcher`]: {
  2152. "&-leaf-line": {
  2153. "&:before": {
  2154. top: "auto !important",
  2155. bottom: "auto !important",
  2156. height: `${g / 2}px !important`
  2157. }
  2158. }
  2159. }
  2160. }
  2161. })
  2162. };
  2163. }, Rn = (e) => {
  2164. const {
  2165. treeCls: a,
  2166. treeNodeCls: l,
  2167. treeNodePadding: s
  2168. } = e;
  2169. return {
  2170. [`${a}${a}-directory`]: {
  2171. // ================== TreeNode ==================
  2172. [l]: {
  2173. position: "relative",
  2174. // Hover color
  2175. "&:before": {
  2176. position: "absolute",
  2177. top: 0,
  2178. insetInlineEnd: 0,
  2179. bottom: s,
  2180. insetInlineStart: 0,
  2181. transition: `background-color ${e.motionDurationMid}`,
  2182. content: '""',
  2183. pointerEvents: "none"
  2184. },
  2185. "&:hover": {
  2186. "&:before": {
  2187. background: e.controlItemBgHover
  2188. }
  2189. },
  2190. // Elements
  2191. "> *": {
  2192. zIndex: 1
  2193. },
  2194. // >>> Switcher
  2195. [`${a}-switcher`]: {
  2196. transition: `color ${e.motionDurationMid}`
  2197. },
  2198. // >>> Title
  2199. [`${a}-node-content-wrapper`]: {
  2200. borderRadius: 0,
  2201. userSelect: "none",
  2202. "&:hover": {
  2203. background: "transparent"
  2204. },
  2205. [`&${a}-node-selected`]: {
  2206. color: e.colorTextLightSolid,
  2207. background: "transparent"
  2208. }
  2209. },
  2210. // ============= Selected =============
  2211. "&-selected": {
  2212. "\n &:hover::before,\n &::before\n ": {
  2213. background: e.colorPrimary
  2214. },
  2215. // >>> Switcher
  2216. [`${a}-switcher`]: {
  2217. color: e.colorTextLightSolid
  2218. },
  2219. // >>> Title
  2220. [`${a}-node-content-wrapper`]: {
  2221. color: e.colorTextLightSolid,
  2222. background: "transparent"
  2223. }
  2224. }
  2225. }
  2226. }
  2227. };
  2228. }, jn = (e, a) => {
  2229. const l = `.${e}`, s = `${l}-treenode`, c = a.paddingXS / 2, g = a.controlHeightSM, d = nn(a, {
  2230. treeCls: l,
  2231. treeNodeCls: s,
  2232. treeNodePadding: c,
  2233. treeTitleHeight: g
  2234. });
  2235. return [
  2236. // Basic
  2237. Bn(e, d),
  2238. // Directory
  2239. Rn(d)
  2240. ];
  2241. }, Xn = Zt("Tree", (e, a) => {
  2242. let {
  2243. prefixCls: l
  2244. } = a;
  2245. return [{
  2246. [e.componentCls]: en(`${l}-checkbox`, e)
  2247. }, jn(l, e), tn(e)];
  2248. });
  2249. export {
  2250. Gn as T,
  2251. dt as V,
  2252. jn as g,
  2253. Wn as r,
  2254. En as t,
  2255. Xn as u
  2256. };