| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996 |
- import { _ as w, b5 as en, m as ue, a8 as tn, b6 as be, b7 as Ce, P as Ee, a as re, w as Ue, b8 as he, Y as nn, o as on, b as ln, K as Oe, n as an, aQ as sn, b9 as rn, ba as cn, bb as dn, i as un, g as fn, a5 as vn, I as hn, J as gn, bc as dt, M as yn } from "./index2.js";
- import { createVNode as C, cloneVNode as Et, defineComponent as Ne, reactive as _e, ref as We, watch as ie, onUnmounted as Dt, onMounted as qe, onBeforeUnmount as rt, computed as E, shallowRef as L, toRaw as it, nextTick as Ae, onUpdated as Tt, watchEffect as Pe, provide as $t, inject as Nt, getCurrentInstance as pn, Transition as mn, withDirectives as bn, vShow as Sn, Fragment as xn } from "vue";
- import { e as ut, h as Ge, i as Xe, j as Mt, b as Kn, f as kn, c as wn, d as ft, k as Cn, l as vt, u as En, p as lt, a as at, m as me, n as Dn, o as ht, q as we, r as Tn, g as $n } from "./index4.js";
- import { p as Ot } from "./pickAttrs.js";
- const Je = (e, t) => {
- let {
- height: n,
- offset: o,
- prefixCls: l,
- onInnerResize: c
- } = e, {
- slots: i
- } = t;
- var v;
- let S = {}, f = {
- display: "flex",
- flexDirection: "column"
- };
- return o !== void 0 && (S = {
- height: `${n}px`,
- position: "relative",
- overflow: "hidden"
- }, f = w(w({}, f), {
- transform: `translateY(${o}px)`,
- position: "absolute",
- left: 0,
- right: 0,
- top: 0
- })), C("div", {
- style: S
- }, [C(en, {
- onResize: (K) => {
- let {
- offsetHeight: x
- } = K;
- x && c && c();
- }
- }, {
- default: () => [C("div", {
- style: f,
- class: ue({
- [`${l}-holder-inner`]: l
- })
- }, [(v = i.default) === null || v === void 0 ? void 0 : v.call(i)])]
- })]);
- };
- Je.displayName = "Filter";
- Je.inheritAttrs = !1;
- Je.props = {
- prefixCls: String,
- /** Virtual filler height. Should be `count * itemMinHeight` */
- height: Number,
- /** Set offset of visible items. Should be the top of start item position */
- offset: Number,
- onInnerResize: Function
- };
- const Pt = (e, t) => {
- let {
- setRef: n
- } = e, {
- slots: o
- } = t;
- var l;
- const c = tn((l = o.default) === null || l === void 0 ? void 0 : l.call(o));
- return c && c.length ? Et(c[0], {
- ref: n
- }) : c;
- };
- Pt.props = {
- setRef: {
- type: Function,
- default: () => {
- }
- }
- };
- const Nn = 20;
- function gt(e) {
- return "touches" in e ? e.touches[0].pageY : e.pageY;
- }
- const Mn = Ne({
- compatConfig: {
- MODE: 3
- },
- name: "ScrollBar",
- inheritAttrs: !1,
- props: {
- prefixCls: String,
- scrollTop: Number,
- scrollHeight: Number,
- height: Number,
- count: Number,
- onScroll: {
- type: Function
- },
- onStartMove: {
- type: Function
- },
- onStopMove: {
- type: Function
- }
- },
- setup() {
- return {
- moveRaf: null,
- scrollbarRef: ut(),
- thumbRef: ut(),
- visibleTimeout: null,
- state: _e({
- dragging: !1,
- pageY: null,
- startTop: null,
- visible: !1
- })
- };
- },
- watch: {
- scrollTop: {
- handler() {
- this.delayHidden();
- },
- flush: "post"
- }
- },
- mounted() {
- var e, t;
- (e = this.scrollbarRef.current) === null || e === void 0 || e.addEventListener("touchstart", this.onScrollbarTouchStart, Ce ? {
- passive: !1
- } : !1), (t = this.thumbRef.current) === null || t === void 0 || t.addEventListener("touchstart", this.onMouseDown, Ce ? {
- passive: !1
- } : !1);
- },
- beforeUnmount() {
- this.removeEvents(), clearTimeout(this.visibleTimeout);
- },
- methods: {
- delayHidden() {
- clearTimeout(this.visibleTimeout), this.state.visible = !0, this.visibleTimeout = setTimeout(() => {
- this.state.visible = !1;
- }, 2e3);
- },
- onScrollbarTouchStart(e) {
- e.preventDefault();
- },
- onContainerMouseDown(e) {
- e.stopPropagation(), e.preventDefault();
- },
- // ======================= Clean =======================
- patchEvents() {
- window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("mouseup", this.onMouseUp), this.thumbRef.current.addEventListener("touchmove", this.onMouseMove, Ce ? {
- passive: !1
- } : !1), this.thumbRef.current.addEventListener("touchend", this.onMouseUp);
- },
- removeEvents() {
- window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onMouseUp), this.scrollbarRef.current.removeEventListener("touchstart", this.onScrollbarTouchStart, Ce ? {
- passive: !1
- } : !1), this.thumbRef.current && (this.thumbRef.current.removeEventListener("touchstart", this.onMouseDown, Ce ? {
- passive: !1
- } : !1), this.thumbRef.current.removeEventListener("touchmove", this.onMouseMove, Ce ? {
- passive: !1
- } : !1), this.thumbRef.current.removeEventListener("touchend", this.onMouseUp)), be.cancel(this.moveRaf);
- },
- // ======================= Thumb =======================
- onMouseDown(e) {
- const {
- onStartMove: t
- } = this.$props;
- w(this.state, {
- dragging: !0,
- pageY: gt(e),
- startTop: this.getTop()
- }), t(), this.patchEvents(), e.stopPropagation(), e.preventDefault();
- },
- onMouseMove(e) {
- const {
- dragging: t,
- pageY: n,
- startTop: o
- } = this.state, {
- onScroll: l
- } = this.$props;
- if (be.cancel(this.moveRaf), t) {
- const c = gt(e) - n, i = o + c, v = this.getEnableScrollRange(), S = this.getEnableHeightRange(), f = S ? i / S : 0, K = Math.ceil(f * v);
- this.moveRaf = be(() => {
- l(K);
- });
- }
- },
- onMouseUp() {
- const {
- onStopMove: e
- } = this.$props;
- this.state.dragging = !1, e(), this.removeEvents();
- },
- // ===================== Calculate =====================
- getSpinHeight() {
- const {
- height: e,
- scrollHeight: t
- } = this.$props;
- let n = e / t * 100;
- return n = Math.max(n, Nn), n = Math.min(n, e / 2), Math.floor(n);
- },
- getEnableScrollRange() {
- const {
- scrollHeight: e,
- height: t
- } = this.$props;
- return e - t || 0;
- },
- getEnableHeightRange() {
- const {
- height: e
- } = this.$props, t = this.getSpinHeight();
- return e - t || 0;
- },
- getTop() {
- const {
- scrollTop: e
- } = this.$props, t = this.getEnableScrollRange(), n = this.getEnableHeightRange();
- return e === 0 || t === 0 ? 0 : e / t * n;
- },
- // Not show scrollbar when height is large than scrollHeight
- showScroll() {
- const {
- height: e,
- scrollHeight: t
- } = this.$props;
- return t > e;
- }
- },
- render() {
- const {
- dragging: e,
- visible: t
- } = this.state, {
- prefixCls: n
- } = this.$props, o = this.getSpinHeight() + "px", l = this.getTop() + "px", c = this.showScroll(), i = c && t;
- return C("div", {
- ref: this.scrollbarRef,
- class: ue(`${n}-scrollbar`, {
- [`${n}-scrollbar-show`]: c
- }),
- style: {
- width: "8px",
- top: 0,
- bottom: 0,
- right: 0,
- position: "absolute",
- display: i ? void 0 : "none"
- },
- onMousedown: this.onContainerMouseDown,
- onMousemove: this.delayHidden
- }, [C("div", {
- ref: this.thumbRef,
- class: ue(`${n}-scrollbar-thumb`, {
- [`${n}-scrollbar-thumb-moving`]: e
- }),
- style: {
- width: "100%",
- height: o,
- top: l,
- left: 0,
- position: "absolute",
- background: "rgba(0, 0, 0, 0.5)",
- borderRadius: "99px",
- cursor: "pointer",
- userSelect: "none"
- },
- onMousedown: this.onMouseDown
- }, null)]);
- }
- });
- function On(e, t, n, o) {
- const l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), i = We(Symbol("update"));
- ie(e, () => {
- i.value = Symbol("update");
- });
- let v;
- function S() {
- be.cancel(v);
- }
- function f() {
- S(), v = be(() => {
- l.forEach((x, m) => {
- if (x && x.offsetParent) {
- const {
- offsetHeight: D
- } = x;
- c.get(m) !== D && (i.value = Symbol("update"), c.set(m, x.offsetHeight));
- }
- });
- });
- }
- function K(x, m) {
- const D = t(x);
- l.get(D), m ? (l.set(D, m.$el || m), f()) : l.delete(D);
- }
- return Dt(() => {
- S();
- }), [K, f, c, i];
- }
- function Pn(e, t, n, o, l, c, i, v) {
- let S;
- return (f) => {
- if (f == null) {
- v();
- return;
- }
- be.cancel(S);
- const K = t.value, x = o.itemHeight;
- if (typeof f == "number")
- i(f);
- else if (f && typeof f == "object") {
- let m;
- const {
- align: D
- } = f;
- "index" in f ? {
- index: m
- } = f : m = K.findIndex((N) => l(N) === f.key);
- const {
- offset: j = 0
- } = f, y = (N, O) => {
- if (N < 0 || !e.value) return;
- const V = e.value.clientHeight;
- let T = !1, Y = O;
- if (V) {
- const B = O || D;
- let Q = 0, q = 0, A = 0;
- const G = Math.min(K.length, m);
- for (let U = 0; U <= G; U += 1) {
- const ee = l(K[U]);
- q = Q;
- const le = n.get(ee);
- A = q + (le === void 0 ? x : le), Q = A, U === m && le === void 0 && (T = !0);
- }
- const Z = e.value.scrollTop;
- let z = null;
- switch (B) {
- case "top":
- z = q - j;
- break;
- case "bottom":
- z = A - V + j;
- break;
- default: {
- const U = Z + V;
- q < Z ? Y = "top" : A > U && (Y = "bottom");
- }
- }
- z !== null && z !== Z && i(z);
- }
- S = be(() => {
- T && c(), y(N - 1, Y);
- }, 2);
- };
- y(5);
- }
- };
- }
- const In = typeof navigator == "object" && /Firefox/i.test(navigator.userAgent), It = (e, t) => {
- let n = !1, o = null;
- function l() {
- clearTimeout(o), n = !0, o = setTimeout(() => {
- n = !1;
- }, 50);
- }
- return function(c) {
- let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
- const v = (
- // Pass origin wheel when on the top
- c < 0 && e.value || // Pass origin wheel when on the bottom
- c > 0 && t.value
- );
- return i && v ? (clearTimeout(o), n = !1) : (!v || n) && l(), !n && v;
- };
- };
- function Ln(e, t, n, o) {
- let l = 0, c = null, i = null, v = !1;
- const S = It(t, n);
- function f(x) {
- if (!e.value) return;
- be.cancel(c);
- const {
- deltaY: m
- } = x;
- l += m, i = m, !S(m) && (In || x.preventDefault(), c = be(() => {
- o(l * (v ? 10 : 1)), l = 0;
- }));
- }
- function K(x) {
- e.value && (v = x.detail === i);
- }
- return [f, K];
- }
- const Hn = 14 / 15;
- function Rn(e, t, n) {
- let o = !1, l = 0, c = null, i = null;
- const v = () => {
- c && (c.removeEventListener("touchmove", S), c.removeEventListener("touchend", f));
- }, S = (m) => {
- if (o) {
- const D = Math.ceil(m.touches[0].pageY);
- let j = l - D;
- l = D, n(j) && m.preventDefault(), clearInterval(i), i = setInterval(() => {
- j *= Hn, (!n(j, !0) || Math.abs(j) <= 0.1) && clearInterval(i);
- }, 16);
- }
- }, f = () => {
- o = !1, v();
- }, K = (m) => {
- v(), m.touches.length === 1 && !o && (o = !0, l = Math.ceil(m.touches[0].pageY), c = m.target, c.addEventListener("touchmove", S, {
- passive: !1
- }), c.addEventListener("touchend", f));
- }, x = () => {
- };
- qe(() => {
- document.addEventListener("touchmove", x, {
- passive: !1
- }), ie(e, (m) => {
- t.value.removeEventListener("touchstart", K), v(), clearInterval(i), m && t.value.addEventListener("touchstart", K, {
- passive: !1
- });
- }, {
- immediate: !0
- });
- }), rt(() => {
- document.removeEventListener("touchmove", x);
- });
- }
- var Fn = function(e, t) {
- var n = {};
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
- t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
- return n;
- };
- const An = [], _n = {
- overflowY: "auto",
- overflowAnchor: "none"
- };
- function Bn(e, t, n, o, l, c) {
- let {
- getKey: i
- } = c;
- return e.slice(t, n + 1).map((v, S) => {
- const f = t + S, K = l(v, f, {
- // style: status === 'MEASURE_START' ? { visibility: 'hidden' } : {},
- }), x = i(v);
- return C(Pt, {
- key: x,
- setRef: (m) => o(v, m)
- }, {
- default: () => [K]
- });
- });
- }
- const jn = Ne({
- compatConfig: {
- MODE: 3
- },
- name: "List",
- inheritAttrs: !1,
- props: {
- prefixCls: String,
- data: Ee.array,
- height: Number,
- itemHeight: Number,
- /** If not match virtual scroll condition, Set List still use height of container. */
- fullHeight: {
- type: Boolean,
- default: void 0
- },
- itemKey: {
- type: [String, Number, Function],
- required: !0
- },
- component: {
- type: [String, Object]
- },
- /** Set `false` will always use real scroll instead of virtual one */
- virtual: {
- type: Boolean,
- default: void 0
- },
- children: Function,
- onScroll: Function,
- onMousedown: Function,
- onMouseenter: Function,
- onVisibleChange: Function
- },
- setup(e, t) {
- let {
- expose: n
- } = t;
- const o = E(() => {
- const {
- height: h,
- itemHeight: b,
- virtual: H
- } = e;
- return !!(H !== !1 && h && b);
- }), l = E(() => {
- const {
- height: h,
- itemHeight: b,
- data: H
- } = e;
- return o.value && H && b * H.length > h;
- }), c = _e({
- scrollTop: 0,
- scrollMoving: !1
- }), i = E(() => e.data || An), v = L([]);
- ie(i, () => {
- v.value = it(i.value).slice();
- }, {
- immediate: !0
- });
- const S = L((h) => {
- });
- ie(() => e.itemKey, (h) => {
- typeof h == "function" ? S.value = h : S.value = (b) => b == null ? void 0 : b[h];
- }, {
- immediate: !0
- });
- const f = L(), K = L(), x = L(), m = (h) => S.value(h), D = {
- getKey: m
- };
- function j(h) {
- let b;
- typeof h == "function" ? b = h(c.scrollTop) : b = h;
- const H = Q(b);
- f.value && (f.value.scrollTop = H), c.scrollTop = H;
- }
- const [y, N, O, V] = On(v, m), T = _e({
- scrollHeight: void 0,
- start: 0,
- end: 0,
- offset: void 0
- }), Y = L(0);
- qe(() => {
- Ae(() => {
- var h;
- Y.value = ((h = K.value) === null || h === void 0 ? void 0 : h.offsetHeight) || 0;
- });
- }), Tt(() => {
- Ae(() => {
- var h;
- Y.value = ((h = K.value) === null || h === void 0 ? void 0 : h.offsetHeight) || 0;
- });
- }), ie([o, v], () => {
- o.value || w(T, {
- scrollHeight: void 0,
- start: 0,
- end: v.value.length - 1,
- offset: void 0
- });
- }, {
- immediate: !0
- }), ie([o, v, Y, l], () => {
- o.value && !l.value && w(T, {
- scrollHeight: Y.value,
- start: 0,
- end: v.value.length - 1,
- offset: void 0
- }), f.value && (c.scrollTop = f.value.scrollTop);
- }, {
- immediate: !0
- }), ie([l, o, () => c.scrollTop, v, V, () => e.height, Y], () => {
- if (!o.value || !l.value)
- return;
- let h = 0, b, H, X;
- const de = v.value.length, ge = v.value, ye = c.scrollTop, {
- itemHeight: xe,
- height: Me
- } = e, Ie = ye + Me;
- for (let pe = 0; pe < de; pe += 1) {
- const Le = ge[pe], He = m(Le);
- let Ke = O.get(He);
- Ke === void 0 && (Ke = xe);
- const De = h + Ke;
- b === void 0 && De >= ye && (b = pe, H = h), X === void 0 && De > Ie && (X = pe), h = De;
- }
- b === void 0 && (b = 0, H = 0, X = Math.ceil(Me / xe)), X === void 0 && (X = de - 1), X = Math.min(X + 1, de), w(T, {
- scrollHeight: h,
- start: b,
- end: X,
- offset: H
- });
- }, {
- immediate: !0
- });
- const B = E(() => T.scrollHeight - e.height);
- function Q(h) {
- let b = h;
- return Number.isNaN(B.value) || (b = Math.min(b, B.value)), b = Math.max(b, 0), b;
- }
- const q = E(() => c.scrollTop <= 0), A = E(() => c.scrollTop >= B.value), G = It(q, A);
- function Z(h) {
- j(h);
- }
- function z(h) {
- var b;
- const {
- scrollTop: H
- } = h.currentTarget;
- H !== c.scrollTop && j(H), (b = e.onScroll) === null || b === void 0 || b.call(e, h);
- }
- const [U, ee] = Ln(o, q, A, (h) => {
- j((b) => b + h);
- });
- Rn(o, f, (h, b) => G(h, b) ? !1 : (U({
- preventDefault() {
- },
- deltaY: h
- }), !0));
- function le(h) {
- o.value && h.preventDefault();
- }
- const se = () => {
- f.value && (f.value.removeEventListener("wheel", U, Ce ? {
- passive: !1
- } : !1), f.value.removeEventListener("DOMMouseScroll", ee), f.value.removeEventListener("MozMousePixelScroll", le));
- };
- Pe(() => {
- Ae(() => {
- f.value && (se(), f.value.addEventListener("wheel", U, Ce ? {
- passive: !1
- } : !1), f.value.addEventListener("DOMMouseScroll", ee), f.value.addEventListener("MozMousePixelScroll", le));
- });
- }), rt(() => {
- se();
- });
- const Se = Pn(f, v, O, e, m, N, j, () => {
- var h;
- (h = x.value) === null || h === void 0 || h.delayHidden();
- });
- n({
- scrollTo: Se
- });
- const ce = E(() => {
- let h = null;
- return e.height && (h = w({
- [e.fullHeight ? "height" : "maxHeight"]: e.height + "px"
- }, _n), o.value && (h.overflowY = "hidden", c.scrollMoving && (h.pointerEvents = "none"))), h;
- });
- return ie([() => T.start, () => T.end, v], () => {
- if (e.onVisibleChange) {
- const h = v.value.slice(T.start, T.end + 1);
- e.onVisibleChange(h, v.value);
- }
- }, {
- flush: "post"
- }), {
- state: c,
- mergedData: v,
- componentStyle: ce,
- onFallbackScroll: z,
- onScrollBar: Z,
- componentRef: f,
- useVirtual: o,
- calRes: T,
- collectHeight: N,
- setInstance: y,
- sharedConfig: D,
- scrollBarRef: x,
- fillerInnerRef: K,
- delayHideScrollBar: () => {
- var h;
- (h = x.value) === null || h === void 0 || h.delayHidden();
- }
- };
- },
- render() {
- const e = w(w({}, this.$props), this.$attrs), {
- prefixCls: t = "rc-virtual-list",
- height: n,
- itemHeight: o,
- // eslint-disable-next-line no-unused-vars
- fullHeight: l,
- data: c,
- itemKey: i,
- virtual: v,
- component: S = "div",
- onScroll: f,
- children: K = this.$slots.default,
- style: x,
- class: m
- } = e, D = Fn(e, ["prefixCls", "height", "itemHeight", "fullHeight", "data", "itemKey", "virtual", "component", "onScroll", "children", "style", "class"]), j = ue(t, m), {
- scrollTop: y
- } = this.state, {
- scrollHeight: N,
- offset: O,
- start: V,
- end: T
- } = this.calRes, {
- componentStyle: Y,
- onFallbackScroll: B,
- onScrollBar: Q,
- useVirtual: q,
- collectHeight: A,
- sharedConfig: G,
- setInstance: Z,
- mergedData: z,
- delayHideScrollBar: U
- } = this;
- return C("div", re({
- style: w(w({}, x), {
- position: "relative"
- }),
- class: j
- }, D), [C(S, {
- class: `${t}-holder`,
- style: Y,
- ref: "componentRef",
- onScroll: B,
- onMouseenter: U
- }, {
- default: () => [C(Je, {
- prefixCls: t,
- height: N,
- offset: O,
- onInnerResize: A,
- ref: "fillerInnerRef"
- }, {
- default: () => Bn(z, V, T, Z, K, G)
- })]
- }), q && C(Mn, {
- ref: "scrollBarRef",
- prefixCls: t,
- scrollTop: y,
- height: n,
- scrollHeight: N,
- count: z.length,
- onScroll: Q,
- onStartMove: () => {
- this.state.scrollMoving = !0;
- },
- onStopMove: () => {
- this.state.scrollMoving = !1;
- }
- }, null)]);
- }
- }), Lt = Symbol("TreeContextKey"), Yn = Ne({
- compatConfig: {
- MODE: 3
- },
- name: "TreeContext",
- props: {
- value: {
- type: Object
- }
- },
- setup(e, t) {
- let {
- slots: n
- } = t;
- return $t(Lt, E(() => e.value)), () => {
- var o;
- return (o = n.default) === null || o === void 0 ? void 0 : o.call(n);
- };
- }
- }), ct = () => Nt(Lt, E(() => ({}))), Ht = Symbol("KeysStateKey"), zn = (e) => {
- $t(Ht, e);
- }, Rt = () => Nt(Ht, {
- expandedKeys: L([]),
- selectedKeys: L([]),
- loadedKeys: L([]),
- loadingKeys: L([]),
- checkedKeys: L([]),
- halfCheckedKeys: L([]),
- expandedKeysSet: E(() => /* @__PURE__ */ new Set()),
- selectedKeysSet: E(() => /* @__PURE__ */ new Set()),
- loadedKeysSet: E(() => /* @__PURE__ */ new Set()),
- loadingKeysSet: E(() => /* @__PURE__ */ new Set()),
- checkedKeysSet: E(() => /* @__PURE__ */ new Set()),
- halfCheckedKeysSet: E(() => /* @__PURE__ */ new Set()),
- flattenNodes: L([])
- }), Vn = (e) => {
- let {
- prefixCls: t,
- level: n,
- isStart: o,
- isEnd: l
- } = e;
- const c = `${t}-indent-unit`, i = [];
- for (let v = 0; v < n; v += 1)
- i.push(C("span", {
- key: v,
- class: {
- [c]: !0,
- [`${c}-start`]: o[v],
- [`${c}-end`]: l[v]
- }
- }, null));
- return C("span", {
- "aria-hidden": "true",
- class: `${t}-indent`
- }, [i]);
- }, Ft = {
- eventKey: [String, Number],
- prefixCls: String,
- // By parent
- // expanded: { type: Boolean, default: undefined },
- // selected: { type: Boolean, default: undefined },
- // checked: { type: Boolean, default: undefined },
- // loaded: { type: Boolean, default: undefined },
- // loading: { type: Boolean, default: undefined },
- // halfChecked: { type: Boolean, default: undefined },
- // dragOver: { type: Boolean, default: undefined },
- // dragOverGapTop: { type: Boolean, default: undefined },
- // dragOverGapBottom: { type: Boolean, default: undefined },
- // pos: String,
- title: Ee.any,
- /** New added in Tree for easy data access */
- data: {
- type: Object,
- default: void 0
- },
- parent: {
- type: Object,
- default: void 0
- },
- isStart: {
- type: Array
- },
- isEnd: {
- type: Array
- },
- active: {
- type: Boolean,
- default: void 0
- },
- onMousemove: {
- type: Function
- },
- // By user
- isLeaf: {
- type: Boolean,
- default: void 0
- },
- checkable: {
- type: Boolean,
- default: void 0
- },
- selectable: {
- type: Boolean,
- default: void 0
- },
- disabled: {
- type: Boolean,
- default: void 0
- },
- disableCheckbox: {
- type: Boolean,
- default: void 0
- },
- icon: Ee.any,
- switcherIcon: Ee.any,
- domRef: {
- type: Function
- }
- }, Un = {
- prefixCls: {
- type: String
- },
- // data: { type: Array as PropType<FlattenNode[]> },
- motion: {
- type: Object
- },
- focusable: {
- type: Boolean
- },
- activeItem: {
- type: Object
- },
- focused: {
- type: Boolean
- },
- tabindex: {
- type: Number
- },
- checkable: {
- type: Boolean
- },
- selectable: {
- type: Boolean
- },
- disabled: {
- type: Boolean
- },
- // expandedKeys: { type: Array as PropType<Key[]> },
- // selectedKeys: { type: Array as PropType<Key[]> },
- // checkedKeys: { type: Array as PropType<Key[]> },
- // loadedKeys: { type: Array as PropType<Key[]> },
- // loadingKeys: { type: Array as PropType<Key[]> },
- // halfCheckedKeys: { type: Array as PropType<Key[]> },
- // keyEntities: { type: Object as PropType<Record<Key, DataEntity<DataNode>>> },
- // dragging: { type: Boolean as PropType<boolean> },
- // dragOverNodeKey: { type: [String, Number] as PropType<Key> },
- // dropPosition: { type: Number as PropType<number> },
- // Virtual list
- height: {
- type: Number
- },
- itemHeight: {
- type: Number
- },
- virtual: {
- type: Boolean
- },
- onScroll: {
- type: Function
- },
- onKeydown: {
- type: Function
- },
- onFocus: {
- type: Function
- },
- onBlur: {
- type: Function
- },
- onActiveChange: {
- type: Function
- },
- onContextmenu: {
- type: Function
- },
- onListChangeStart: {
- type: Function
- },
- onListChangeEnd: {
- type: Function
- }
- }, Wn = () => ({
- prefixCls: String,
- focusable: {
- type: Boolean,
- default: void 0
- },
- activeKey: [Number, String],
- tabindex: Number,
- children: Ee.any,
- treeData: {
- type: Array
- },
- fieldNames: {
- type: Object
- },
- showLine: {
- type: [Boolean, Object],
- default: void 0
- },
- showIcon: {
- type: Boolean,
- default: void 0
- },
- icon: Ee.any,
- selectable: {
- type: Boolean,
- default: void 0
- },
- expandAction: [String, Boolean],
- disabled: {
- type: Boolean,
- default: void 0
- },
- multiple: {
- type: Boolean,
- default: void 0
- },
- checkable: {
- type: Boolean,
- default: void 0
- },
- checkStrictly: {
- type: Boolean,
- default: void 0
- },
- draggable: {
- type: [Function, Boolean]
- },
- defaultExpandParent: {
- type: Boolean,
- default: void 0
- },
- autoExpandParent: {
- type: Boolean,
- default: void 0
- },
- defaultExpandAll: {
- type: Boolean,
- default: void 0
- },
- defaultExpandedKeys: {
- type: Array
- },
- expandedKeys: {
- type: Array
- },
- defaultCheckedKeys: {
- type: Array
- },
- checkedKeys: {
- type: [Object, Array]
- },
- defaultSelectedKeys: {
- type: Array
- },
- selectedKeys: {
- type: Array
- },
- allowDrop: {
- type: Function
- },
- dropIndicatorRender: {
- type: Function
- },
- onFocus: {
- type: Function
- },
- onBlur: {
- type: Function
- },
- onKeydown: {
- type: Function
- },
- onContextmenu: {
- type: Function
- },
- onClick: {
- type: Function
- },
- onDblclick: {
- type: Function
- },
- onScroll: {
- type: Function
- },
- onExpand: {
- type: Function
- },
- onCheck: {
- type: Function
- },
- onSelect: {
- type: Function
- },
- onLoad: {
- type: Function
- },
- loadData: {
- type: Function
- },
- loadedKeys: {
- type: Array
- },
- onMouseenter: {
- type: Function
- },
- onMouseleave: {
- type: Function
- },
- onRightClick: {
- type: Function
- },
- onDragstart: {
- type: Function
- },
- onDragenter: {
- type: Function
- },
- onDragover: {
- type: Function
- },
- onDragleave: {
- type: Function
- },
- onDragend: {
- type: Function
- },
- onDrop: {
- type: Function
- },
- /**
- * Used for `rc-tree-select` only.
- * Do not use in your production code directly since this will be refactor.
- */
- onActiveChange: {
- type: Function
- },
- filterTreeNode: {
- type: Function
- },
- motion: Ee.any,
- switcherIcon: Ee.any,
- // Virtual List
- height: Number,
- itemHeight: Number,
- virtual: {
- type: Boolean,
- default: void 0
- },
- // direction for drag logic
- direction: {
- type: String
- },
- rootClassName: String,
- rootStyle: Object
- });
- var Gn = function(e, t) {
- var n = {};
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
- t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
- return n;
- };
- const yt = "open", pt = "close", Xn = "---", mt = Ne({
- compatConfig: {
- MODE: 3
- },
- name: "ATreeNode",
- inheritAttrs: !1,
- props: Ft,
- isTreeNode: 1,
- setup(e, t) {
- let {
- attrs: n,
- slots: o,
- expose: l
- } = t;
- Ue(!("slots" in e.data), `treeData slots is deprecated, please use ${Object.keys(e.data.slots || {}).map((a) => "`v-slot:" + a + "` ")}instead`);
- const c = L(!1), i = ct(), {
- expandedKeysSet: v,
- selectedKeysSet: S,
- loadedKeysSet: f,
- loadingKeysSet: K,
- checkedKeysSet: x,
- halfCheckedKeysSet: m
- } = Rt(), {
- dragOverNodeKey: D,
- dropPosition: j,
- keyEntities: y
- } = i.value, N = E(() => Ge(e.eventKey, {
- expandedKeysSet: v.value,
- selectedKeysSet: S.value,
- loadedKeysSet: f.value,
- loadingKeysSet: K.value,
- checkedKeysSet: x.value,
- halfCheckedKeysSet: m.value,
- dragOverNodeKey: D,
- dropPosition: j,
- keyEntities: y
- })), O = he(() => N.value.expanded), V = he(() => N.value.selected), T = he(() => N.value.checked), Y = he(() => N.value.loaded), B = he(() => N.value.loading), Q = he(() => N.value.halfChecked), q = he(() => N.value.dragOver), A = he(() => N.value.dragOverGapTop), G = he(() => N.value.dragOverGapBottom), Z = he(() => N.value.pos), z = L(), U = E(() => {
- const {
- eventKey: a
- } = e, {
- keyEntities: d
- } = i.value, {
- children: R
- } = d[a] || {};
- return !!(R || []).length;
- }), ee = E(() => {
- const {
- isLeaf: a
- } = e, {
- loadData: d
- } = i.value, R = U.value;
- return a === !1 ? !1 : a || !d && !R || d && Y.value && !R;
- }), le = E(() => ee.value ? null : O.value ? yt : pt), se = E(() => {
- const {
- disabled: a
- } = e, {
- disabled: d
- } = i.value;
- return !!(d || a);
- }), Se = E(() => {
- const {
- checkable: a
- } = e, {
- checkable: d
- } = i.value;
- return !d || a === !1 ? !1 : d;
- }), ce = E(() => {
- const {
- selectable: a
- } = e, {
- selectable: d
- } = i.value;
- return typeof a == "boolean" ? a : d;
- }), W = E(() => {
- const {
- data: a,
- active: d,
- checkable: R,
- disableCheckbox: J,
- disabled: te,
- selectable: ne
- } = e;
- return w(w({
- active: d,
- checkable: R,
- disableCheckbox: J,
- disabled: te,
- selectable: ne
- }, a), {
- dataRef: a,
- data: a,
- isLeaf: ee.value,
- checked: T.value,
- expanded: O.value,
- loading: B.value,
- selected: V.value,
- halfChecked: Q.value
- });
- }), h = pn(), b = E(() => {
- const {
- eventKey: a
- } = e, {
- keyEntities: d
- } = i.value, {
- parent: R
- } = d[a] || {};
- return w(w({}, Xe(w({}, e, N.value))), {
- parent: R
- });
- }), H = _e({
- eventData: b,
- eventKey: E(() => e.eventKey),
- selectHandle: z,
- pos: Z,
- key: h.vnode.key
- });
- l(H);
- const X = (a) => {
- const {
- onNodeDoubleClick: d
- } = i.value;
- d(a, b.value);
- }, de = (a) => {
- if (se.value) return;
- const {
- onNodeSelect: d
- } = i.value;
- a.preventDefault(), d(a, b.value);
- }, ge = (a) => {
- if (se.value) return;
- const {
- disableCheckbox: d
- } = e, {
- onNodeCheck: R
- } = i.value;
- if (!Se.value || d) return;
- a.preventDefault();
- const J = !T.value;
- R(a, b.value, J);
- }, ye = (a) => {
- const {
- onNodeClick: d
- } = i.value;
- d(a, b.value), ce.value ? de(a) : ge(a);
- }, xe = (a) => {
- const {
- onNodeMouseEnter: d
- } = i.value;
- d(a, b.value);
- }, Me = (a) => {
- const {
- onNodeMouseLeave: d
- } = i.value;
- d(a, b.value);
- }, Ie = (a) => {
- const {
- onNodeContextMenu: d
- } = i.value;
- d(a, b.value);
- }, pe = (a) => {
- const {
- onNodeDragStart: d
- } = i.value;
- a.stopPropagation(), c.value = !0, d(a, H);
- try {
- a.dataTransfer.setData("text/plain", "");
- } catch (R) {
- }
- }, Le = (a) => {
- const {
- onNodeDragEnter: d
- } = i.value;
- a.preventDefault(), a.stopPropagation(), d(a, H);
- }, He = (a) => {
- const {
- onNodeDragOver: d
- } = i.value;
- a.preventDefault(), a.stopPropagation(), d(a, H);
- }, Ke = (a) => {
- const {
- onNodeDragLeave: d
- } = i.value;
- a.stopPropagation(), d(a, H);
- }, De = (a) => {
- const {
- onNodeDragEnd: d
- } = i.value;
- a.stopPropagation(), c.value = !1, d(a, H);
- }, Qe = (a) => {
- const {
- onNodeDrop: d
- } = i.value;
- a.preventDefault(), a.stopPropagation(), c.value = !1, d(a, H);
- }, Be = (a) => {
- const {
- onNodeExpand: d
- } = i.value;
- B.value || d(a, b.value);
- }, je = () => {
- const {
- data: a
- } = e, {
- draggable: d
- } = i.value;
- return !!(d && (!d.nodeDraggable || d.nodeDraggable(a)));
- }, Ye = () => {
- const {
- draggable: a,
- prefixCls: d
- } = i.value;
- return a && (a != null && a.icon) ? C("span", {
- class: `${d}-draggable-icon`
- }, [a.icon]) : null;
- }, Ze = () => {
- var a, d, R;
- const {
- switcherIcon: J = o.switcherIcon || ((a = i.value.slots) === null || a === void 0 ? void 0 : a[(R = (d = e.data) === null || d === void 0 ? void 0 : d.slots) === null || R === void 0 ? void 0 : R.switcherIcon])
- } = e, {
- switcherIcon: te
- } = i.value, ne = J || te;
- return typeof ne == "function" ? ne(W.value) : ne;
- }, ze = () => {
- const {
- loadData: a,
- onNodeLoad: d
- } = i.value;
- B.value || a && O.value && !ee.value && !U.value && !Y.value && d(b.value);
- };
- qe(() => {
- ze();
- }), Tt(() => {
- ze();
- });
- const et = () => {
- const {
- prefixCls: a
- } = i.value, d = Ze();
- if (ee.value)
- return d !== !1 ? C("span", {
- class: ue(`${a}-switcher`, `${a}-switcher-noop`)
- }, [d]) : null;
- const R = ue(`${a}-switcher`, `${a}-switcher_${O.value ? yt : pt}`);
- return d !== !1 ? C("span", {
- onClick: Be,
- class: R
- }, [d]) : null;
- }, tt = () => {
- var a, d;
- const {
- disableCheckbox: R
- } = e, {
- prefixCls: J
- } = i.value, te = se.value;
- return Se.value ? C("span", {
- class: ue(`${J}-checkbox`, T.value && `${J}-checkbox-checked`, !T.value && Q.value && `${J}-checkbox-indeterminate`, (te || R) && `${J}-checkbox-disabled`),
- onClick: ge
- }, [(d = (a = i.value).customCheckable) === null || d === void 0 ? void 0 : d.call(a)]) : null;
- }, Ve = () => {
- const {
- prefixCls: a
- } = i.value;
- return C("span", {
- class: ue(`${a}-iconEle`, `${a}-icon__${le.value || "docu"}`, B.value && `${a}-icon_loading`)
- }, null);
- }, Te = () => {
- const {
- disabled: a,
- eventKey: d
- } = e, {
- draggable: R,
- dropLevelOffset: J,
- dropPosition: te,
- prefixCls: ne,
- indent: s,
- dropIndicatorRender: r,
- dragOverNodeKey: u,
- direction: p
- } = i.value;
- return !a && R !== !1 && u === d ? r({
- dropPosition: te,
- dropLevelOffset: J,
- indent: s,
- prefixCls: ne,
- direction: p
- }) : null;
- }, nt = () => {
- var a, d, R, J, te, ne;
- const {
- // title = slots.title ||
- // context.value.slots?.[props.data?.slots?.title] ||
- // context.value.slots?.title,
- // selected,
- icon: s = o.icon,
- // loading,
- data: r
- } = e, u = o.title || ((a = i.value.slots) === null || a === void 0 ? void 0 : a[(R = (d = e.data) === null || d === void 0 ? void 0 : d.slots) === null || R === void 0 ? void 0 : R.title]) || ((J = i.value.slots) === null || J === void 0 ? void 0 : J.title) || e.title, {
- prefixCls: p,
- showIcon: $,
- icon: k,
- loadData: g
- // slots: contextSlots,
- } = i.value, I = se.value, _ = `${p}-node-content-wrapper`;
- let M;
- if ($) {
- const oe = s || ((te = i.value.slots) === null || te === void 0 ? void 0 : te[(ne = r == null ? void 0 : r.slots) === null || ne === void 0 ? void 0 : ne.icon]) || k;
- M = oe ? C("span", {
- class: ue(`${p}-iconEle`, `${p}-icon__customize`)
- }, [typeof oe == "function" ? oe(W.value) : oe]) : Ve();
- } else g && B.value && (M = Ve());
- let P;
- typeof u == "function" ? P = u(W.value) : P = u, P = P === void 0 ? Xn : P;
- const F = C("span", {
- class: `${p}-title`
- }, [P]);
- return C("span", {
- ref: z,
- title: typeof u == "string" ? u : "",
- class: ue(`${_}`, `${_}-${le.value || "normal"}`, !I && (V.value || c.value) && `${p}-node-selected`),
- onMouseenter: xe,
- onMouseleave: Me,
- onContextmenu: Ie,
- onClick: ye,
- onDblclick: X
- }, [M, F, Te()]);
- };
- return () => {
- const a = w(w({}, e), n), {
- eventKey: d,
- isLeaf: R,
- isStart: J,
- isEnd: te,
- domRef: ne,
- active: s,
- data: r,
- onMousemove: u,
- selectable: p
- } = a, $ = Gn(a, ["eventKey", "isLeaf", "isStart", "isEnd", "domRef", "active", "data", "onMousemove", "selectable"]), {
- prefixCls: k,
- filterTreeNode: g,
- keyEntities: I,
- dropContainerKey: _,
- dropTargetKey: M,
- draggingNodeKey: P
- } = i.value, F = se.value, oe = Ot($, {
- aria: !0,
- data: !0
- }), {
- level: fe
- } = I[d] || {}, ve = te[te.length - 1], ae = je(), ke = !F && ae, Re = P === d, ot = p !== void 0 ? {
- "aria-selected": !!p
- } : void 0;
- return C("div", re(re({
- ref: ne,
- class: ue(n.class, `${k}-treenode`, {
- [`${k}-treenode-disabled`]: F,
- [`${k}-treenode-switcher-${O.value ? "open" : "close"}`]: !R,
- [`${k}-treenode-checkbox-checked`]: T.value,
- [`${k}-treenode-checkbox-indeterminate`]: Q.value,
- [`${k}-treenode-selected`]: V.value,
- [`${k}-treenode-loading`]: B.value,
- [`${k}-treenode-active`]: s,
- [`${k}-treenode-leaf-last`]: ve,
- [`${k}-treenode-draggable`]: ke,
- dragging: Re,
- "drop-target": M === d,
- "drop-container": _ === d,
- "drag-over": !F && q.value,
- "drag-over-gap-top": !F && A.value,
- "drag-over-gap-bottom": !F && G.value,
- "filter-node": g && g(b.value)
- }),
- style: n.style,
- draggable: ke,
- "aria-grabbed": Re,
- onDragstart: ke ? pe : void 0,
- onDragenter: ae ? Le : void 0,
- onDragover: ae ? He : void 0,
- onDragleave: ae ? Ke : void 0,
- onDrop: ae ? Qe : void 0,
- onDragend: ae ? De : void 0,
- onMousemove: u
- }, ot), oe), [C(Vn, {
- prefixCls: k,
- level: fe,
- isStart: J,
- isEnd: te
- }, null), Ye(), et(), tt(), nt()]);
- };
- }
- });
- var bt = function(e, t) {
- var n = {};
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
- t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
- return n;
- };
- const qn = Ne({
- compatConfig: {
- MODE: 3
- },
- name: "MotionTreeNode",
- inheritAttrs: !1,
- props: w(w({}, Ft), {
- active: Boolean,
- motion: Object,
- motionNodes: {
- type: Array
- },
- onMotionStart: Function,
- onMotionEnd: Function,
- motionType: String
- }),
- setup(e, t) {
- let {
- attrs: n,
- slots: o
- } = t;
- const l = L(!0), c = ct(), i = L(!1), v = E(() => e.motion ? e.motion : nn()), S = (f, K) => {
- var x, m, D, j;
- K === "appear" ? (m = (x = v.value) === null || x === void 0 ? void 0 : x.onAfterEnter) === null || m === void 0 || m.call(x, f) : K === "leave" && ((j = (D = v.value) === null || D === void 0 ? void 0 : D.onAfterLeave) === null || j === void 0 || j.call(D, f)), i.value || e.onMotionEnd(), i.value = !0;
- };
- return ie(() => e.motionNodes, () => {
- e.motionNodes && e.motionType === "hide" && l.value && Ae(() => {
- l.value = !1;
- });
- }, {
- immediate: !0,
- flush: "post"
- }), qe(() => {
- e.motionNodes && e.onMotionStart();
- }), rt(() => {
- e.motionNodes && S();
- }), () => {
- const {
- motion: f,
- motionNodes: K,
- motionType: x,
- active: m,
- eventKey: D
- } = e, j = bt(e, ["motion", "motionNodes", "motionType", "active", "eventKey"]);
- return K ? C(mn, re(re({}, v.value), {}, {
- appear: x === "show",
- onAfterAppear: (y) => S(y, "appear"),
- onAfterLeave: (y) => S(y, "leave")
- }), {
- default: () => [bn(C("div", {
- class: `${c.value.prefixCls}-treenode-motion`
- }, [K.map((y) => {
- const N = bt(y.data, []), {
- title: O,
- key: V,
- isStart: T,
- isEnd: Y
- } = y;
- return delete N.children, C(mt, re(re({}, N), {}, {
- title: O,
- active: m,
- data: y.data,
- key: V,
- eventKey: V,
- isStart: T,
- isEnd: Y
- }), o);
- })]), [[Sn, l.value]])]
- }) : C(mt, re(re({
- class: n.class,
- style: n.style
- }, j), {}, {
- active: m,
- eventKey: D
- }), o);
- };
- }
- });
- function Jn() {
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
- const n = e.length, o = t.length;
- if (Math.abs(n - o) !== 1)
- return {
- add: !1,
- key: null
- };
- function l(c, i) {
- const v = /* @__PURE__ */ new Map();
- c.forEach((f) => {
- v.set(f, !0);
- });
- const S = i.filter((f) => !v.has(f));
- return S.length === 1 ? S[0] : null;
- }
- return n < o ? {
- add: !0,
- key: l(e, t)
- } : {
- add: !1,
- key: l(t, e)
- };
- }
- function St(e, t, n) {
- const o = e.findIndex((i) => i.key === n), l = e[o + 1], c = t.findIndex((i) => i.key === n);
- if (l) {
- const i = t.findIndex((v) => v.key === l.key);
- return t.slice(c + 1, i);
- }
- return t.slice(c + 1);
- }
- var xt = function(e, t) {
- var n = {};
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, o = Object.getOwnPropertySymbols(e); l < o.length; l++)
- t.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[l]) && (n[o[l]] = e[o[l]]);
- return n;
- };
- const Kt = {
- width: 0,
- height: 0,
- display: "flex",
- overflow: "hidden",
- opacity: 0,
- border: 0,
- padding: 0,
- margin: 0
- }, Qn = () => {
- }, $e = `RC_TREE_MOTION_${Math.random()}`, st = {
- key: $e
- }, At = {
- key: $e,
- level: 0,
- index: 0,
- pos: "0",
- node: st,
- nodes: [st]
- }, kt = {
- parent: null,
- children: [],
- pos: At.pos,
- data: st,
- title: null,
- key: $e,
- /** Hold empty list here since we do not use it */
- isStart: [],
- isEnd: []
- };
- function wt(e, t, n, o) {
- return t === !1 || !n ? e : e.slice(0, Math.ceil(n / o) + 1);
- }
- function Ct(e) {
- const {
- key: t,
- pos: n
- } = e;
- return Mt(t, n);
- }
- function Zn(e) {
- let t = String(e.key), n = e;
- for (; n.parent; )
- n = n.parent, t = `${n.key} > ${t}`;
- return t;
- }
- const eo = Ne({
- compatConfig: {
- MODE: 3
- },
- name: "NodeList",
- inheritAttrs: !1,
- props: Un,
- setup(e, t) {
- let {
- expose: n,
- attrs: o
- } = t;
- const l = We(), c = We(), {
- expandedKeys: i,
- flattenNodes: v
- } = Rt();
- n({
- scrollTo: (y) => {
- l.value.scrollTo(y);
- },
- getIndentWidth: () => c.value.offsetWidth
- });
- const S = L(v.value), f = L([]), K = We(null);
- function x() {
- S.value = v.value, f.value = [], K.value = null, e.onListChangeEnd();
- }
- const m = ct();
- ie([() => i.value.slice(), v], (y, N) => {
- let [O, V] = y, [T, Y] = N;
- const B = Jn(T, O);
- if (B.key !== null) {
- const {
- virtual: Q,
- height: q,
- itemHeight: A
- } = e;
- if (B.add) {
- const G = Y.findIndex((U) => {
- let {
- key: ee
- } = U;
- return ee === B.key;
- }), Z = wt(St(Y, V, B.key), Q, q, A), z = Y.slice();
- z.splice(G + 1, 0, kt), S.value = z, f.value = Z, K.value = "show";
- } else {
- const G = V.findIndex((U) => {
- let {
- key: ee
- } = U;
- return ee === B.key;
- }), Z = wt(St(V, Y, B.key), Q, q, A), z = V.slice();
- z.splice(G + 1, 0, kt), S.value = z, f.value = Z, K.value = "hide";
- }
- } else Y !== V && (S.value = V);
- }), ie(() => m.value.dragging, (y) => {
- y || x();
- });
- const D = E(() => e.motion === void 0 ? S.value : v.value), j = () => {
- e.onActiveChange(null);
- };
- return () => {
- const y = w(w({}, e), o), {
- prefixCls: N,
- selectable: O,
- checkable: V,
- disabled: T,
- motion: Y,
- height: B,
- itemHeight: Q,
- virtual: q,
- focusable: A,
- activeItem: G,
- focused: Z,
- tabindex: z,
- onKeydown: U,
- onFocus: ee,
- onBlur: le,
- onListChangeStart: se,
- onListChangeEnd: Se
- } = y, ce = xt(y, ["prefixCls", "selectable", "checkable", "disabled", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabindex", "onKeydown", "onFocus", "onBlur", "onListChangeStart", "onListChangeEnd"]);
- return C(xn, null, [Z && G && C("span", {
- style: Kt,
- "aria-live": "assertive"
- }, [Zn(G)]), C("div", null, [C("input", {
- style: Kt,
- disabled: A === !1 || T,
- tabindex: A !== !1 ? z : null,
- onKeydown: U,
- onFocus: ee,
- onBlur: le,
- value: "",
- onChange: Qn,
- "aria-label": "for screen reader"
- }, null)]), C("div", {
- class: `${N}-treenode`,
- "aria-hidden": !0,
- style: {
- position: "absolute",
- pointerEvents: "none",
- visibility: "hidden",
- height: 0,
- overflow: "hidden"
- }
- }, [C("div", {
- class: `${N}-indent`
- }, [C("div", {
- ref: c,
- class: `${N}-indent-unit`
- }, null)])]), C(jn, re(re({}, on(ce, ["onActiveChange"])), {}, {
- data: D.value,
- itemKey: Ct,
- height: B,
- fullHeight: !1,
- virtual: q,
- itemHeight: Q,
- prefixCls: `${N}-list`,
- ref: l,
- onVisibleChange: (W, h) => {
- const b = new Set(W);
- h.filter((X) => !b.has(X)).some((X) => Ct(X) === $e) && x();
- }
- }), {
- default: (W) => {
- const {
- pos: h
- } = W, b = xt(W.data, []), {
- title: H,
- key: X,
- isStart: de,
- isEnd: ge
- } = W, ye = Mt(X, h);
- return delete b.key, delete b.children, C(qn, re(re({}, b), {}, {
- eventKey: ye,
- title: H,
- active: !!G && X === G.key,
- data: W.data,
- isStart: de,
- isEnd: ge,
- motion: Y,
- motionNodes: X === $e ? f.value : null,
- motionType: K.value,
- onMotionStart: se,
- onMotionEnd: x,
- onMousemove: j
- }), null);
- }
- })]);
- };
- }
- });
- function to(e) {
- let {
- dropPosition: t,
- dropLevelOffset: n,
- indent: o
- } = e;
- const l = {
- pointerEvents: "none",
- position: "absolute",
- right: 0,
- backgroundColor: "red",
- height: "2px"
- };
- switch (t) {
- case -1:
- l.top = 0, l.left = `${-n * o}px`;
- break;
- case 1:
- l.bottom = 0, l.left = `${-n * o}px`;
- break;
- case 0:
- l.bottom = 0, l.left = `${o}`;
- break;
- }
- return C("div", {
- style: l
- }, null);
- }
- const no = 10, ho = Ne({
- compatConfig: {
- MODE: 3
- },
- name: "Tree",
- inheritAttrs: !1,
- props: ln(Wn(), {
- prefixCls: "vc-tree",
- showLine: !1,
- showIcon: !0,
- selectable: !0,
- multiple: !1,
- checkable: !1,
- disabled: !1,
- checkStrictly: !1,
- draggable: !1,
- expandAction: !1,
- defaultExpandParent: !0,
- autoExpandParent: !1,
- defaultExpandAll: !1,
- defaultExpandedKeys: [],
- defaultCheckedKeys: [],
- defaultSelectedKeys: [],
- dropIndicatorRender: to,
- allowDrop: () => !0
- }),
- setup(e, t) {
- let {
- attrs: n,
- slots: o,
- expose: l
- } = t;
- const c = L(!1);
- let i = {};
- const v = L(), S = L([]), f = L([]), K = L([]), x = L([]), m = L([]), D = L([]), j = {}, y = _e({
- draggingNodeKey: null,
- dragChildrenKeys: [],
- // dropTargetKey is the key of abstract-drop-node
- // the abstract-drop-node is the real drop node when drag and drop
- // not the DOM drag over node
- dropTargetKey: null,
- dropPosition: null,
- dropContainerKey: null,
- dropLevelOffset: null,
- dropTargetPos: null,
- dropAllowed: !0,
- // the abstract-drag-over-node
- // if mouse is on the bottom of top dom node or no the top of the bottom dom node
- // abstract-drag-over-node is the top node
- dragOverNodeKey: null
- }), N = L([]);
- ie([() => e.treeData, () => e.children], () => {
- N.value = e.treeData !== void 0 ? e.treeData.slice() : Kn(it(e.children));
- }, {
- immediate: !0,
- deep: !0
- });
- const O = L({}), V = L(!1), T = L(null), Y = L(!1), B = E(() => kn(e.fieldNames)), Q = L();
- let q = null, A = null, G = null;
- const Z = E(() => ({
- expandedKeysSet: z.value,
- selectedKeysSet: U.value,
- loadedKeysSet: ee.value,
- loadingKeysSet: le.value,
- checkedKeysSet: se.value,
- halfCheckedKeysSet: Se.value,
- dragOverNodeKey: y.dragOverNodeKey,
- dropPosition: y.dropPosition,
- keyEntities: O.value
- })), z = E(() => new Set(D.value)), U = E(() => new Set(S.value)), ee = E(() => new Set(x.value)), le = E(() => new Set(m.value)), se = E(() => new Set(f.value)), Se = E(() => new Set(K.value));
- Pe(() => {
- if (N.value) {
- const s = wn(N.value, {
- fieldNames: B.value
- });
- O.value = w({
- [$e]: At
- }, s.keyEntities);
- }
- });
- let ce = !1;
- ie(
- [() => e.expandedKeys, () => e.autoExpandParent, O],
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- (s, r) => {
- let [u, p] = s, [$, k] = r, g = D.value;
- if (e.expandedKeys !== void 0 || ce && p !== k)
- g = e.autoExpandParent || !ce && e.defaultExpandParent ? ft(e.expandedKeys, O.value) : e.expandedKeys;
- else if (!ce && e.defaultExpandAll) {
- const I = w({}, O.value);
- delete I[$e], g = Object.keys(I).map((_) => I[_].key);
- } else !ce && e.defaultExpandedKeys && (g = e.autoExpandParent || e.defaultExpandParent ? ft(e.defaultExpandedKeys, O.value) : e.defaultExpandedKeys);
- g && (D.value = g), ce = !0;
- },
- {
- immediate: !0
- }
- );
- const W = L([]);
- Pe(() => {
- W.value = Cn(N.value, D.value, B.value);
- }), Pe(() => {
- e.selectable && (e.selectedKeys !== void 0 ? S.value = vt(e.selectedKeys, e) : !ce && e.defaultSelectedKeys && (S.value = vt(e.defaultSelectedKeys, e)));
- });
- const {
- maxLevel: h,
- levelEntities: b
- } = En(O);
- Pe(() => {
- if (e.checkable) {
- let s;
- if (e.checkedKeys !== void 0 ? s = lt(e.checkedKeys) || {} : !ce && e.defaultCheckedKeys ? s = lt(e.defaultCheckedKeys) || {} : N.value && (s = lt(e.checkedKeys) || {
- checkedKeys: f.value,
- halfCheckedKeys: K.value
- }), s) {
- let {
- checkedKeys: r = [],
- halfCheckedKeys: u = []
- } = s;
- e.checkStrictly || ({
- checkedKeys: r,
- halfCheckedKeys: u
- } = at(r, !0, O.value, h.value, b.value)), f.value = r, K.value = u;
- }
- }
- }), Pe(() => {
- e.loadedKeys && (x.value = e.loadedKeys);
- });
- const H = () => {
- w(y, {
- dragOverNodeKey: null,
- dropPosition: null,
- dropLevelOffset: null,
- dropTargetKey: null,
- dropContainerKey: null,
- dropTargetPos: null,
- dropAllowed: !1
- });
- }, X = (s) => {
- Q.value.scrollTo(s);
- };
- ie(() => e.activeKey, () => {
- e.activeKey !== void 0 && (T.value = e.activeKey);
- }, {
- immediate: !0
- }), ie(T, (s) => {
- Ae(() => {
- s !== null && X({
- key: s
- });
- });
- }, {
- immediate: !0,
- flush: "post"
- });
- const de = (s) => {
- e.expandedKeys === void 0 && (D.value = s);
- }, ge = () => {
- y.draggingNodeKey !== null && w(y, {
- draggingNodeKey: null,
- dropPosition: null,
- dropContainerKey: null,
- dropTargetKey: null,
- dropLevelOffset: null,
- dropAllowed: !0,
- dragOverNodeKey: null
- }), q = null, G = null;
- }, ye = (s, r) => {
- const {
- onDragend: u
- } = e;
- y.dragOverNodeKey = null, ge(), u == null || u({
- event: s,
- node: r.eventData
- }), A = null;
- }, xe = (s) => {
- ye(s, null), window.removeEventListener("dragend", xe);
- }, Me = (s, r) => {
- const {
- onDragstart: u
- } = e, {
- eventKey: p,
- eventData: $
- } = r;
- A = r, q = {
- x: s.clientX,
- y: s.clientY
- };
- const k = me(D.value, p);
- y.draggingNodeKey = p, y.dragChildrenKeys = Dn(p, O.value), v.value = Q.value.getIndentWidth(), de(k), window.addEventListener("dragend", xe), u && u({
- event: s,
- node: $
- });
- }, Ie = (s, r) => {
- const {
- onDragenter: u,
- onExpand: p,
- allowDrop: $,
- direction: k
- } = e, {
- pos: g,
- eventKey: I
- } = r;
- if (G !== I && (G = I), !A) {
- H();
- return;
- }
- const {
- dropPosition: _,
- dropLevelOffset: M,
- dropTargetKey: P,
- dropContainerKey: F,
- dropTargetPos: oe,
- dropAllowed: fe,
- dragOverNodeKey: ve
- } = ht(s, A, r, v.value, q, $, W.value, O.value, z.value, k);
- if (
- // don't allow drop inside its children
- y.dragChildrenKeys.indexOf(P) !== -1 || // don't allow drop when drop is not allowed caculated by calcDropPosition
- !fe
- ) {
- H();
- return;
- }
- if (i || (i = {}), Object.keys(i).forEach((ae) => {
- clearTimeout(i[ae]);
- }), A.eventKey !== r.eventKey && (i[g] = window.setTimeout(() => {
- if (y.draggingNodeKey === null) return;
- let ae = D.value.slice();
- const ke = O.value[r.eventKey];
- ke && (ke.children || []).length && (ae = we(D.value, r.eventKey)), de(ae), p && p(ae, {
- node: r.eventData,
- expanded: !0,
- nativeEvent: s
- });
- }, 800)), A.eventKey === P && M === 0) {
- H();
- return;
- }
- w(y, {
- dragOverNodeKey: ve,
- dropPosition: _,
- dropLevelOffset: M,
- dropTargetKey: P,
- dropContainerKey: F,
- dropTargetPos: oe,
- dropAllowed: fe
- }), u && u({
- event: s,
- node: r.eventData,
- expandedKeys: D.value
- });
- }, pe = (s, r) => {
- const {
- onDragover: u,
- allowDrop: p,
- direction: $
- } = e;
- if (!A)
- return;
- const {
- dropPosition: k,
- dropLevelOffset: g,
- dropTargetKey: I,
- dropContainerKey: _,
- dropAllowed: M,
- dropTargetPos: P,
- dragOverNodeKey: F
- } = ht(s, A, r, v.value, q, p, W.value, O.value, z.value, $);
- y.dragChildrenKeys.indexOf(I) !== -1 || !M || (A.eventKey === I && g === 0 ? y.dropPosition === null && y.dropLevelOffset === null && y.dropTargetKey === null && y.dropContainerKey === null && y.dropTargetPos === null && y.dropAllowed === !1 && y.dragOverNodeKey === null || H() : k === y.dropPosition && g === y.dropLevelOffset && I === y.dropTargetKey && _ === y.dropContainerKey && P === y.dropTargetPos && M === y.dropAllowed && F === y.dragOverNodeKey || w(y, {
- dropPosition: k,
- dropLevelOffset: g,
- dropTargetKey: I,
- dropContainerKey: _,
- dropTargetPos: P,
- dropAllowed: M,
- dragOverNodeKey: F
- }), u && u({
- event: s,
- node: r.eventData
- }));
- }, Le = (s, r) => {
- G === r.eventKey && !s.currentTarget.contains(s.relatedTarget) && (H(), G = null);
- const {
- onDragleave: u
- } = e;
- u && u({
- event: s,
- node: r.eventData
- });
- }, He = function(s, r) {
- let u = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
- var p;
- const {
- dragChildrenKeys: $,
- dropPosition: k,
- dropTargetKey: g,
- dropTargetPos: I,
- dropAllowed: _
- } = y;
- if (!_) return;
- const {
- onDrop: M
- } = e;
- if (y.dragOverNodeKey = null, ge(), g === null) return;
- const P = w(w({}, Ge(g, it(Z.value))), {
- active: ((p = R.value) === null || p === void 0 ? void 0 : p.key) === g,
- data: O.value[g].node
- }), F = $.indexOf(g) !== -1;
- Ue(!F, "Can not drop to dragNode's children node. Maybe this is a bug of ant-design-vue. Please report an issue.");
- const oe = Tn(I), fe = {
- event: s,
- node: Xe(P),
- dragNode: A ? A.eventData : null,
- dragNodesKeys: [A.eventKey].concat($),
- dropToGap: k !== 0,
- dropPosition: k + Number(oe[oe.length - 1])
- };
- u || M == null || M(fe), A = null;
- }, Ke = (s, r) => {
- const {
- expanded: u,
- key: p
- } = r, $ = W.value.filter((g) => g.key === p)[0], k = Xe(w(w({}, Ge(p, Z.value)), {
- data: $.data
- }));
- de(u ? me(D.value, p) : we(D.value, p)), Te(s, k);
- }, De = (s, r) => {
- const {
- onClick: u,
- expandAction: p
- } = e;
- p === "click" && Ke(s, r), u && u(s, r);
- }, Qe = (s, r) => {
- const {
- onDblclick: u,
- expandAction: p
- } = e;
- (p === "doubleclick" || p === "dblclick") && Ke(s, r), u && u(s, r);
- }, Be = (s, r) => {
- let u = S.value;
- const {
- onSelect: p,
- multiple: $
- } = e, {
- selected: k
- } = r, g = r[B.value.key], I = !k;
- I ? $ ? u = we(u, g) : u = [g] : u = me(u, g);
- const _ = O.value, M = u.map((P) => {
- const F = _[P];
- return F ? F.node : null;
- }).filter((P) => P);
- e.selectedKeys === void 0 && (S.value = u), p && p(u, {
- event: "select",
- selected: I,
- node: r,
- selectedNodes: M,
- nativeEvent: s
- });
- }, je = (s, r, u) => {
- const {
- checkStrictly: p,
- onCheck: $
- } = e, k = r[B.value.key];
- let g;
- const I = {
- event: "check",
- node: r,
- checked: u,
- nativeEvent: s
- }, _ = O.value;
- if (p) {
- const M = u ? we(f.value, k) : me(f.value, k), P = me(K.value, k);
- g = {
- checked: M,
- halfChecked: P
- }, I.checkedNodes = M.map((F) => _[F]).filter((F) => F).map((F) => F.node), e.checkedKeys === void 0 && (f.value = M);
- } else {
- let {
- checkedKeys: M,
- halfCheckedKeys: P
- } = at([...f.value, k], !0, _, h.value, b.value);
- if (!u) {
- const F = new Set(M);
- F.delete(k), {
- checkedKeys: M,
- halfCheckedKeys: P
- } = at(Array.from(F), {
- checked: !1,
- halfCheckedKeys: P
- }, _, h.value, b.value);
- }
- g = M, I.checkedNodes = [], I.checkedNodesPositions = [], I.halfCheckedKeys = P, M.forEach((F) => {
- const oe = _[F];
- if (!oe) return;
- const {
- node: fe,
- pos: ve
- } = oe;
- I.checkedNodes.push(fe), I.checkedNodesPositions.push({
- node: fe,
- pos: ve
- });
- }), e.checkedKeys === void 0 && (f.value = M, K.value = P);
- }
- $ && $(g, I);
- }, Ye = (s) => {
- const r = s[B.value.key], u = new Promise((p, $) => {
- const {
- loadData: k,
- onLoad: g
- } = e;
- if (!k || ee.value.has(r) || le.value.has(r))
- return null;
- k(s).then(() => {
- const _ = we(x.value, r), M = me(m.value, r);
- g && g(_, {
- event: "load",
- node: s
- }), e.loadedKeys === void 0 && (x.value = _), m.value = M, p();
- }).catch((_) => {
- const M = me(m.value, r);
- if (m.value = M, j[r] = (j[r] || 0) + 1, j[r] >= no) {
- Ue(!1, "Retry for `loadData` many times but still failed. No more retry.");
- const P = we(x.value, r);
- e.loadedKeys === void 0 && (x.value = P), p();
- }
- $(_);
- }), m.value = we(m.value, r);
- });
- return u.catch(() => {
- }), u;
- }, Ze = (s, r) => {
- const {
- onMouseenter: u
- } = e;
- u && u({
- event: s,
- node: r
- });
- }, ze = (s, r) => {
- const {
- onMouseleave: u
- } = e;
- u && u({
- event: s,
- node: r
- });
- }, et = (s, r) => {
- const {
- onRightClick: u
- } = e;
- u && (s.preventDefault(), u({
- event: s,
- node: r
- }));
- }, tt = (s) => {
- const {
- onFocus: r
- } = e;
- V.value = !0, r && r(s);
- }, Ve = (s) => {
- const {
- onBlur: r
- } = e;
- V.value = !1, d(null), r && r(s);
- }, Te = (s, r) => {
- let u = D.value;
- const {
- onExpand: p,
- loadData: $
- } = e, {
- expanded: k
- } = r, g = r[B.value.key];
- if (Y.value)
- return;
- const I = u.indexOf(g), _ = !k;
- if (Ue(k && I !== -1 || !k && I === -1, "Expand state not sync with index check"), _ ? u = we(u, g) : u = me(u, g), de(u), p && p(u, {
- node: r,
- expanded: _,
- nativeEvent: s
- }), _ && $) {
- const M = Ye(r);
- M && M.then(() => {
- }).catch((P) => {
- const F = me(D.value, g);
- de(F), Promise.reject(P);
- });
- }
- }, nt = () => {
- Y.value = !0;
- }, a = () => {
- setTimeout(() => {
- Y.value = !1;
- });
- }, d = (s) => {
- const {
- onActiveChange: r
- } = e;
- T.value !== s && (e.activeKey !== void 0 && (T.value = s), s !== null && X({
- key: s
- }), r && r(s));
- }, R = E(() => T.value === null ? null : W.value.find((s) => {
- let {
- key: r
- } = s;
- return r === T.value;
- }) || null), J = (s) => {
- let r = W.value.findIndex((p) => {
- let {
- key: $
- } = p;
- return $ === T.value;
- });
- r === -1 && s < 0 && (r = W.value.length), r = (r + s + W.value.length) % W.value.length;
- const u = W.value[r];
- if (u) {
- const {
- key: p
- } = u;
- d(p);
- } else
- d(null);
- }, te = E(() => Xe(w(w({}, Ge(T.value, Z.value)), {
- data: R.value.data,
- active: !0
- }))), ne = (s) => {
- const {
- onKeydown: r,
- checkable: u,
- selectable: p
- } = e;
- switch (s.which) {
- case Oe.UP: {
- J(-1), s.preventDefault();
- break;
- }
- case Oe.DOWN: {
- J(1), s.preventDefault();
- break;
- }
- }
- const $ = R.value;
- if ($ && $.data) {
- const k = $.data.isLeaf === !1 || !!($.data.children || []).length, g = te.value;
- switch (s.which) {
- case Oe.LEFT: {
- k && z.value.has(T.value) ? Te({}, g) : $.parent && d($.parent.key), s.preventDefault();
- break;
- }
- case Oe.RIGHT: {
- k && !z.value.has(T.value) ? Te({}, g) : $.children && $.children.length && d($.children[0].key), s.preventDefault();
- break;
- }
- case Oe.ENTER:
- case Oe.SPACE: {
- u && !g.disabled && g.checkable !== !1 && !g.disableCheckbox ? je({}, g, !se.value.has(T.value)) : !u && p && !g.disabled && g.selectable !== !1 && Be({}, g);
- break;
- }
- }
- }
- r && r(s);
- };
- return l({
- onNodeExpand: Te,
- scrollTo: X,
- onKeydown: ne,
- selectedKeys: E(() => S.value),
- checkedKeys: E(() => f.value),
- halfCheckedKeys: E(() => K.value),
- loadedKeys: E(() => x.value),
- loadingKeys: E(() => m.value),
- expandedKeys: E(() => D.value)
- }), Dt(() => {
- window.removeEventListener("dragend", xe), c.value = !0;
- }), zn({
- expandedKeys: D,
- selectedKeys: S,
- loadedKeys: x,
- loadingKeys: m,
- checkedKeys: f,
- halfCheckedKeys: K,
- expandedKeysSet: z,
- selectedKeysSet: U,
- loadedKeysSet: ee,
- loadingKeysSet: le,
- checkedKeysSet: se,
- halfCheckedKeysSet: Se,
- flattenNodes: W
- }), () => {
- const {
- // focused,
- // flattenNodes,
- // keyEntities,
- draggingNodeKey: s,
- // activeKey,
- dropLevelOffset: r,
- dropContainerKey: u,
- dropTargetKey: p,
- dropPosition: $,
- dragOverNodeKey: k
- // indent,
- } = y, {
- prefixCls: g,
- showLine: I,
- focusable: _,
- tabindex: M = 0,
- selectable: P,
- showIcon: F,
- icon: oe = o.icon,
- switcherIcon: fe,
- draggable: ve,
- checkable: ae,
- checkStrictly: ke,
- disabled: Re,
- motion: ot,
- loadData: _t,
- filterTreeNode: Bt,
- height: jt,
- itemHeight: Yt,
- virtual: zt,
- dropIndicatorRender: Vt,
- onContextmenu: Ut,
- onScroll: Wt,
- direction: Gt,
- rootClassName: Xt,
- rootStyle: qt
- } = e, {
- class: Jt,
- style: Qt
- } = n, Zt = Ot(w(w({}, e), n), {
- aria: !0,
- data: !0
- });
- let Fe;
- return ve ? typeof ve == "object" ? Fe = ve : typeof ve == "function" ? Fe = {
- nodeDraggable: ve
- } : Fe = {} : Fe = !1, C(Yn, {
- value: {
- prefixCls: g,
- selectable: P,
- showIcon: F,
- icon: oe,
- switcherIcon: fe,
- draggable: Fe,
- draggingNodeKey: s,
- checkable: ae,
- customCheckable: o.checkable,
- checkStrictly: ke,
- disabled: Re,
- keyEntities: O.value,
- dropLevelOffset: r,
- dropContainerKey: u,
- dropTargetKey: p,
- dropPosition: $,
- dragOverNodeKey: k,
- dragging: s !== null,
- indent: v.value,
- direction: Gt,
- dropIndicatorRender: Vt,
- loadData: _t,
- filterTreeNode: Bt,
- onNodeClick: De,
- onNodeDoubleClick: Qe,
- onNodeExpand: Te,
- onNodeSelect: Be,
- onNodeCheck: je,
- onNodeLoad: Ye,
- onNodeMouseEnter: Ze,
- onNodeMouseLeave: ze,
- onNodeContextMenu: et,
- onNodeDragStart: Me,
- onNodeDragEnter: Ie,
- onNodeDragOver: pe,
- onNodeDragLeave: Le,
- onNodeDragEnd: ye,
- onNodeDrop: He,
- slots: o
- }
- }, {
- default: () => [C("div", {
- role: "tree",
- class: ue(g, Jt, Xt, {
- [`${g}-show-line`]: I,
- [`${g}-focused`]: V.value,
- [`${g}-active-focused`]: T.value !== null
- }),
- style: qt
- }, [C(eo, re({
- ref: Q,
- prefixCls: g,
- style: Qt,
- disabled: Re,
- selectable: P,
- checkable: !!ae,
- motion: ot,
- height: jt,
- itemHeight: Yt,
- virtual: zt,
- focusable: _,
- focused: V.value,
- tabindex: M,
- activeItem: R.value,
- onFocus: tt,
- onBlur: Ve,
- onKeydown: ne,
- onActiveChange: d,
- onListChangeStart: nt,
- onListChangeEnd: a,
- onContextmenu: Ut,
- onScroll: Wt
- }, Zt), null)])]
- });
- };
- }
- });
- function go(e, t, n, o, l) {
- const {
- isLeaf: c,
- expanded: i,
- loading: v
- } = n;
- let S = t;
- if (v)
- return C(an, {
- class: `${e}-switcher-loading-icon`
- }, null);
- let f;
- l && typeof l == "object" && (f = l.showLeafIcon);
- let K = null;
- const x = `${e}-switcher-icon`;
- return c ? l ? f && o ? o(n) : (typeof l == "object" && !f ? K = C("span", {
- class: `${e}-switcher-leaf-line`
- }, null) : K = C(sn, {
- class: `${e}-switcher-line-icon`
- }, null), K) : null : (K = C(rn, {
- class: x
- }, null), l && (K = i ? C(cn, {
- class: `${e}-switcher-line-icon`
- }, null) : C(dn, {
- class: `${e}-switcher-line-icon`
- }, null)), typeof t == "function" ? S = t(w(w({}, n), {
- defaultIcon: K,
- switcherCls: x
- })) : un(S) && (S = Et(S, {
- class: x
- })), S || K);
- }
- const oo = new yn("ant-tree-node-fx-do-not-use", {
- "0%": {
- opacity: 0
- },
- "100%": {
- opacity: 1
- }
- }), lo = (e, t) => ({
- [`.${e}-switcher-icon`]: {
- display: "inline-block",
- fontSize: 10,
- verticalAlign: "baseline",
- svg: {
- transition: `transform ${t.motionDurationSlow}`
- }
- }
- }), ao = (e, t) => ({
- [`.${e}-drop-indicator`]: {
- position: "absolute",
- // it should displayed over the following node
- zIndex: 1,
- height: 2,
- backgroundColor: t.colorPrimary,
- borderRadius: 1,
- pointerEvents: "none",
- "&:after": {
- position: "absolute",
- top: -3,
- insetInlineStart: -6,
- width: 8,
- height: 8,
- backgroundColor: "transparent",
- border: `${t.lineWidthBold}px solid ${t.colorPrimary}`,
- borderRadius: "50%",
- content: '""'
- }
- }
- }), io = (e, t) => {
- const {
- treeCls: n,
- treeNodeCls: o,
- treeNodePadding: l,
- treeTitleHeight: c
- } = t, i = (c - t.fontSizeLG) / 2, v = t.paddingXS;
- return {
- [n]: w(w({}, gn(t)), {
- background: t.colorBgContainer,
- borderRadius: t.borderRadius,
- transition: `background-color ${t.motionDurationSlow}`,
- [`&${n}-rtl`]: {
- // >>> Switcher
- [`${n}-switcher`]: {
- "&_close": {
- [`${n}-switcher-icon`]: {
- svg: {
- transform: "rotate(90deg)"
- }
- }
- }
- }
- },
- [`&-focused:not(:hover):not(${n}-active-focused)`]: w({}, dt(t)),
- // =================== Virtual List ===================
- [`${n}-list-holder-inner`]: {
- alignItems: "flex-start"
- },
- [`&${n}-block-node`]: {
- [`${n}-list-holder-inner`]: {
- alignItems: "stretch",
- // >>> Title
- [`${n}-node-content-wrapper`]: {
- flex: "auto"
- },
- // >>> Drag
- [`${o}.dragging`]: {
- position: "relative",
- "&:after": {
- position: "absolute",
- top: 0,
- insetInlineEnd: 0,
- bottom: l,
- insetInlineStart: 0,
- border: `1px solid ${t.colorPrimary}`,
- opacity: 0,
- animationName: oo,
- animationDuration: t.motionDurationSlow,
- animationPlayState: "running",
- animationFillMode: "forwards",
- content: '""',
- pointerEvents: "none"
- }
- }
- }
- },
- // ===================== TreeNode =====================
- [`${o}`]: {
- display: "flex",
- alignItems: "flex-start",
- padding: `0 0 ${l}px 0`,
- outline: "none",
- "&-rtl": {
- direction: "rtl"
- },
- // Disabled
- "&-disabled": {
- // >>> Title
- [`${n}-node-content-wrapper`]: {
- color: t.colorTextDisabled,
- cursor: "not-allowed",
- "&:hover": {
- background: "transparent"
- }
- }
- },
- [`&-active ${n}-node-content-wrapper`]: w({}, dt(t)),
- [`&:not(${o}-disabled).filter-node ${n}-title`]: {
- color: "inherit",
- fontWeight: 500
- },
- "&-draggable": {
- [`${n}-draggable-icon`]: {
- width: c,
- lineHeight: `${c}px`,
- textAlign: "center",
- visibility: "visible",
- opacity: 0.2,
- transition: `opacity ${t.motionDurationSlow}`,
- [`${o}:hover &`]: {
- opacity: 0.45
- }
- },
- [`&${o}-disabled`]: {
- [`${n}-draggable-icon`]: {
- visibility: "hidden"
- }
- }
- }
- },
- // >>> Indent
- [`${n}-indent`]: {
- alignSelf: "stretch",
- whiteSpace: "nowrap",
- userSelect: "none",
- "&-unit": {
- display: "inline-block",
- width: c
- }
- },
- // >>> Drag Handler
- [`${n}-draggable-icon`]: {
- visibility: "hidden"
- },
- // >>> Switcher
- [`${n}-switcher`]: w(w({}, lo(e, t)), {
- position: "relative",
- flex: "none",
- alignSelf: "stretch",
- width: c,
- margin: 0,
- lineHeight: `${c}px`,
- textAlign: "center",
- cursor: "pointer",
- userSelect: "none",
- "&-noop": {
- cursor: "default"
- },
- "&_close": {
- [`${n}-switcher-icon`]: {
- svg: {
- transform: "rotate(-90deg)"
- }
- }
- },
- "&-loading-icon": {
- color: t.colorPrimary
- },
- "&-leaf-line": {
- position: "relative",
- zIndex: 1,
- display: "inline-block",
- width: "100%",
- height: "100%",
- // https://github.com/ant-design/ant-design/issues/31884
- "&:before": {
- position: "absolute",
- top: 0,
- insetInlineEnd: c / 2,
- bottom: -l,
- marginInlineStart: -1,
- borderInlineEnd: `1px solid ${t.colorBorder}`,
- content: '""'
- },
- "&:after": {
- position: "absolute",
- width: c / 2 * 0.8,
- height: c / 2,
- borderBottom: `1px solid ${t.colorBorder}`,
- content: '""'
- }
- }
- }),
- // >>> Checkbox
- [`${n}-checkbox`]: {
- top: "initial",
- marginInlineEnd: v,
- marginBlockStart: i
- },
- // >>> Title
- // add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
- [`${n}-node-content-wrapper, ${n}-checkbox + span`]: {
- position: "relative",
- zIndex: "auto",
- minHeight: c,
- margin: 0,
- padding: `0 ${t.paddingXS / 2}px`,
- color: "inherit",
- lineHeight: `${c}px`,
- background: "transparent",
- borderRadius: t.borderRadius,
- cursor: "pointer",
- transition: `all ${t.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,
- "&:hover": {
- backgroundColor: t.controlItemBgHover
- },
- [`&${n}-node-selected`]: {
- backgroundColor: t.controlItemBgActive
- },
- // Icon
- [`${n}-iconEle`]: {
- display: "inline-block",
- width: c,
- height: c,
- lineHeight: `${c}px`,
- textAlign: "center",
- verticalAlign: "top",
- "&:empty": {
- display: "none"
- }
- }
- },
- // https://github.com/ant-design/ant-design/issues/28217
- [`${n}-unselectable ${n}-node-content-wrapper:hover`]: {
- backgroundColor: "transparent"
- },
- // ==================== Draggable =====================
- [`${n}-node-content-wrapper`]: w({
- lineHeight: `${c}px`,
- userSelect: "none"
- }, ao(e, t)),
- [`${o}.drop-container`]: {
- "> [draggable]": {
- boxShadow: `0 0 0 2px ${t.colorPrimary}`
- }
- },
- // ==================== Show Line =====================
- "&-show-line": {
- // ================ Indent lines ================
- [`${n}-indent`]: {
- "&-unit": {
- position: "relative",
- height: "100%",
- "&:before": {
- position: "absolute",
- top: 0,
- insetInlineEnd: c / 2,
- bottom: -l,
- borderInlineEnd: `1px solid ${t.colorBorder}`,
- content: '""'
- },
- "&-end": {
- "&:before": {
- display: "none"
- }
- }
- }
- },
- // ============== Cover Background ==============
- [`${n}-switcher`]: {
- background: "transparent",
- "&-line-icon": {
- // https://github.com/ant-design/ant-design/issues/32813
- verticalAlign: "-0.15em"
- }
- }
- },
- [`${o}-leaf-last`]: {
- [`${n}-switcher`]: {
- "&-leaf-line": {
- "&:before": {
- top: "auto !important",
- bottom: "auto !important",
- height: `${c / 2}px !important`
- }
- }
- }
- }
- })
- };
- }, so = (e) => {
- const {
- treeCls: t,
- treeNodeCls: n,
- treeNodePadding: o
- } = e;
- return {
- [`${t}${t}-directory`]: {
- // ================== TreeNode ==================
- [n]: {
- position: "relative",
- // Hover color
- "&:before": {
- position: "absolute",
- top: 0,
- insetInlineEnd: 0,
- bottom: o,
- insetInlineStart: 0,
- transition: `background-color ${e.motionDurationMid}`,
- content: '""',
- pointerEvents: "none"
- },
- "&:hover": {
- "&:before": {
- background: e.controlItemBgHover
- }
- },
- // Elements
- "> *": {
- zIndex: 1
- },
- // >>> Switcher
- [`${t}-switcher`]: {
- transition: `color ${e.motionDurationMid}`
- },
- // >>> Title
- [`${t}-node-content-wrapper`]: {
- borderRadius: 0,
- userSelect: "none",
- "&:hover": {
- background: "transparent"
- },
- [`&${t}-node-selected`]: {
- color: e.colorTextLightSolid,
- background: "transparent"
- }
- },
- // ============= Selected =============
- "&-selected": {
- "\n &:hover::before,\n &::before\n ": {
- background: e.colorPrimary
- },
- // >>> Switcher
- [`${t}-switcher`]: {
- color: e.colorTextLightSolid
- },
- // >>> Title
- [`${t}-node-content-wrapper`]: {
- color: e.colorTextLightSolid,
- background: "transparent"
- }
- }
- }
- }
- };
- }, ro = (e, t) => {
- const n = `.${e}`, o = `${n}-treenode`, l = t.paddingXS / 2, c = t.controlHeightSM, i = hn(t, {
- treeCls: n,
- treeNodeCls: o,
- treeNodePadding: l,
- treeTitleHeight: c
- });
- return [
- // Basic
- io(e, i),
- // Directory
- so(i)
- ];
- }, yo = fn("Tree", (e, t) => {
- let {
- prefixCls: n
- } = t;
- return [{
- [e.componentCls]: $n(`${n}-checkbox`, e)
- }, ro(n, e), vn(e)];
- });
- export {
- ho as T,
- mt as V,
- ro as g,
- go as r,
- Wn as t,
- yo as u
- };
|