index20.js 59 KB

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