| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102 |
- import { aC as Xe, bg as ft, w as ge, c as le, K as Z, d as T, P as we, q as D, bo as ht, bp as gt, bq as mt, ak as $t, ap as yt, M as j, br as he, R as Fe, _ as te, e as me, p as xt, az as je, g as _t, m as St, r as tt, t as Ct, bs as at, a8 as Tt, o as wt, i as nt, n as Pt, b6 as Rt, h as De, u as It, bt as Et, ac as Bt, j as Lt, Q as xe, O as At, N as Dt } from "./index2.js";
- import { shallowRef as W, onBeforeUnmount as Me, defineComponent as ae, ref as Q, computed as H, createVNode as g, watchEffect as Ce, onMounted as Te, watch as ie, provide as kt, inject as Mt, toRefs as Nt } from "vue";
- import { u as Ot } from "./useRefs.js";
- import { e as ot, t as Wt, a as Ht, b as zt, h as Kt, f as Gt } from "./hasIn.js";
- import { i as Xt } from "./isMobile.js";
- import { u as Ve } from "./useMergedState.js";
- function Ft(e, t, a, i) {
- if (!Xe(e))
- return e;
- t = ot(t, e);
- for (var o = -1, l = t.length, n = l - 1, s = e; s != null && ++o < l; ) {
- var v = Wt(t[o]), d = a;
- if (v === "__proto__" || v === "constructor" || v === "prototype")
- return e;
- if (o != n) {
- var p = s[v];
- d = void 0, d === void 0 && (d = Xe(p) ? p : ft(t[o + 1]) ? [] : {});
- }
- Ht(s, v, d), s = s[v];
- }
- return e;
- }
- function jt(e, t, a) {
- for (var i = -1, o = t.length, l = {}; ++i < o; ) {
- var n = t[i], s = zt(e, n);
- a(s, n) && Ft(l, ot(n, e), s);
- }
- return l;
- }
- function Vt(e, t) {
- return jt(e, t, function(a, i) {
- return Kt(e, i);
- });
- }
- var it = Gt(function(e, t) {
- return e == null ? {} : Vt(e, t);
- });
- function Yt(e) {
- const t = W(), a = W(!1);
- function i() {
- for (var o = arguments.length, l = new Array(o), n = 0; n < o; n++)
- l[n] = arguments[n];
- a.value || (ge.cancel(t.value), t.value = ge(() => {
- e(...l);
- }));
- }
- return Me(() => {
- a.value = !0, ge.cancel(t.value);
- }), i;
- }
- function Ut(e) {
- const t = W([]), a = W(typeof e == "function" ? e() : e), i = Yt(() => {
- let l = a.value;
- t.value.forEach((n) => {
- l = n(l);
- }), t.value = [], a.value = l;
- });
- function o(l) {
- t.value.push(l), i();
- }
- return [a, o];
- }
- const qt = ae({
- compatConfig: {
- MODE: 3
- },
- name: "TabNode",
- props: {
- id: {
- type: String
- },
- prefixCls: {
- type: String
- },
- tab: {
- type: Object
- },
- active: {
- type: Boolean
- },
- closable: {
- type: Boolean
- },
- editable: {
- type: Object
- },
- onClick: {
- type: Function
- },
- onResize: {
- type: Function
- },
- renderWrapper: {
- type: Function
- },
- removeAriaLabel: {
- type: String
- },
- // onRemove: { type: Function as PropType<() => void> },
- onFocus: {
- type: Function
- }
- },
- emits: ["click", "resize", "remove", "focus"],
- setup(e, t) {
- let {
- expose: a,
- attrs: i
- } = t;
- const o = Q();
- function l(v) {
- var d;
- !((d = e.tab) === null || d === void 0) && d.disabled || e.onClick(v);
- }
- a({
- domRef: o
- });
- function n(v) {
- var d;
- v.preventDefault(), v.stopPropagation(), e.editable.onEdit("remove", {
- key: (d = e.tab) === null || d === void 0 ? void 0 : d.key,
- event: v
- });
- }
- const s = H(() => {
- var v;
- return e.editable && e.closable !== !1 && !(!((v = e.tab) === null || v === void 0) && v.disabled);
- });
- return () => {
- var v;
- const {
- prefixCls: d,
- id: p,
- active: S,
- tab: {
- key: h,
- tab: c,
- disabled: y,
- closeIcon: x
- },
- renderWrapper: w,
- removeAriaLabel: C,
- editable: k,
- onFocus: K
- } = e, M = `${d}-tab`, r = g("div", {
- key: h,
- ref: o,
- class: le(M, {
- [`${M}-with-remove`]: s.value,
- [`${M}-active`]: S,
- [`${M}-disabled`]: y
- }),
- style: i.style,
- onClick: l
- }, [g("div", {
- role: "tab",
- "aria-selected": S,
- id: p && `${p}-tab-${h}`,
- class: `${M}-btn`,
- "aria-controls": p && `${p}-panel-${h}`,
- "aria-disabled": y,
- tabindex: y ? null : 0,
- onClick: (m) => {
- m.stopPropagation(), l(m);
- },
- onKeydown: (m) => {
- [Z.SPACE, Z.ENTER].includes(m.which) && (m.preventDefault(), l(m));
- },
- onFocus: K
- }, [typeof c == "function" ? c() : c]), s.value && g("button", {
- type: "button",
- "aria-label": C || "remove",
- tabindex: 0,
- class: `${M}-remove`,
- onClick: (m) => {
- m.stopPropagation(), n(m);
- }
- }, [(x == null ? void 0 : x()) || ((v = k.removeIcon) === null || v === void 0 ? void 0 : v.call(k)) || "×"])]);
- return w ? w(r) : r;
- };
- }
- }), Ye = {
- width: 0,
- height: 0,
- left: 0,
- top: 0
- };
- function Zt(e, t) {
- const a = Q(/* @__PURE__ */ new Map());
- return Ce(() => {
- var i, o;
- const l = /* @__PURE__ */ new Map(), n = e.value, s = t.value.get((i = n[0]) === null || i === void 0 ? void 0 : i.key) || Ye, v = s.left + s.width;
- for (let d = 0; d < n.length; d += 1) {
- const {
- key: p
- } = n[d];
- let S = t.value.get(p);
- S || (S = t.value.get((o = n[d - 1]) === null || o === void 0 ? void 0 : o.key) || Ye);
- const h = l.get(p) || T({}, S);
- h.right = v - h.left - h.width, l.set(p, h);
- }
- a.value = new Map(l);
- }), a;
- }
- const lt = ae({
- compatConfig: {
- MODE: 3
- },
- name: "AddButton",
- inheritAttrs: !1,
- props: {
- prefixCls: String,
- editable: {
- type: Object
- },
- locale: {
- type: Object,
- default: void 0
- }
- },
- setup(e, t) {
- let {
- expose: a,
- attrs: i
- } = t;
- const o = Q();
- return a({
- domRef: o
- }), () => {
- const {
- prefixCls: l,
- editable: n,
- locale: s
- } = e;
- return !n || n.showAdd === !1 ? null : g("button", {
- ref: o,
- type: "button",
- class: `${l}-nav-add`,
- style: i.style,
- "aria-label": (s == null ? void 0 : s.addAriaLabel) || "Add tab",
- onClick: (v) => {
- n.onEdit("add", {
- event: v
- });
- }
- }, [n.addIcon ? n.addIcon() : "+"]);
- };
- }
- }), Qt = {
- prefixCls: {
- type: String
- },
- id: {
- type: String
- },
- tabs: {
- type: Object
- },
- rtl: {
- type: Boolean
- },
- tabBarGutter: {
- type: Number
- },
- activeKey: {
- type: [String, Number]
- },
- mobile: {
- type: Boolean
- },
- moreIcon: we.any,
- moreTransitionName: {
- type: String
- },
- editable: {
- type: Object
- },
- locale: {
- type: Object,
- default: void 0
- },
- removeAriaLabel: String,
- onTabClick: {
- type: Function
- },
- popupClassName: String,
- getPopupContainer: j()
- }, Jt = ae({
- compatConfig: {
- MODE: 3
- },
- name: "OperationNode",
- inheritAttrs: !1,
- props: Qt,
- emits: ["tabClick"],
- slots: Object,
- setup(e, t) {
- let {
- attrs: a,
- slots: i
- } = t;
- const [o, l] = D(!1), [n, s] = D(null), v = (c) => {
- const y = e.tabs.filter((C) => !C.disabled);
- let x = y.findIndex((C) => C.key === n.value) || 0;
- const w = y.length;
- for (let C = 0; C < w; C += 1) {
- x = (x + c + w) % w;
- const k = y[x];
- if (!k.disabled) {
- s(k.key);
- return;
- }
- }
- }, d = (c) => {
- const {
- which: y
- } = c;
- if (!o.value) {
- [Z.DOWN, Z.SPACE, Z.ENTER].includes(y) && (l(!0), c.preventDefault());
- return;
- }
- switch (y) {
- case Z.UP:
- v(-1), c.preventDefault();
- break;
- case Z.DOWN:
- v(1), c.preventDefault();
- break;
- case Z.ESC:
- l(!1);
- break;
- case Z.SPACE:
- case Z.ENTER:
- n.value !== null && e.onTabClick(n.value, c);
- break;
- }
- }, p = H(() => `${e.id}-more-popup`), S = H(() => n.value !== null ? `${p.value}-${n.value}` : null), h = (c, y) => {
- c.preventDefault(), c.stopPropagation(), e.editable.onEdit("remove", {
- key: y,
- event: c
- });
- };
- return Te(() => {
- ie(n, () => {
- const c = document.getElementById(S.value);
- c && c.scrollIntoView && c.scrollIntoView(!1);
- }, {
- flush: "post",
- immediate: !0
- });
- }), ie(o, () => {
- o.value || s(null);
- }), ht({}), () => {
- var c;
- const {
- prefixCls: y,
- id: x,
- tabs: w,
- locale: C,
- mobile: k,
- moreIcon: K = ((c = i.moreIcon) === null || c === void 0 ? void 0 : c.call(i)) || g(gt, null, null),
- moreTransitionName: M,
- editable: r,
- tabBarGutter: m,
- rtl: u,
- onTabClick: $,
- popupClassName: E
- } = e;
- if (!w.length) return null;
- const R = `${y}-dropdown`, G = C == null ? void 0 : C.dropdownAriaLabel, re = {
- [u ? "marginRight" : "marginLeft"]: m
- };
- w.length || (re.visibility = "hidden", re.order = 1);
- const se = le({
- [`${R}-rtl`]: u,
- [`${E}`]: !0
- }), ce = k ? null : g(mt, {
- prefixCls: R,
- trigger: ["hover"],
- visible: o.value,
- transitionName: M,
- onVisibleChange: l,
- overlayClassName: se,
- mouseEnterDelay: 0.1,
- mouseLeaveDelay: 0.1,
- getPopupContainer: e.getPopupContainer
- }, {
- overlay: () => g($t, {
- onClick: (I) => {
- let {
- key: J,
- domEvent: N
- } = I;
- $(J, N), l(!1);
- },
- id: p.value,
- tabindex: -1,
- role: "listbox",
- "aria-activedescendant": S.value,
- selectedKeys: [n.value],
- "aria-label": G !== void 0 ? G : "expanded dropdown"
- }, {
- default: () => [w.map((I) => {
- var J, N;
- const V = r && I.closable !== !1 && !I.disabled;
- return g(yt, {
- key: I.key,
- id: `${p.value}-${I.key}`,
- role: "option",
- "aria-controls": x && `${x}-panel-${I.key}`,
- disabled: I.disabled
- }, {
- default: () => [g("span", null, [typeof I.tab == "function" ? I.tab() : I.tab]), V && g("button", {
- type: "button",
- "aria-label": e.removeAriaLabel || "remove",
- tabindex: 0,
- class: `${R}-menu-item-remove`,
- onClick: (Y) => {
- Y.stopPropagation(), h(Y, I.key);
- }
- }, [((J = I.closeIcon) === null || J === void 0 ? void 0 : J.call(I)) || ((N = r.removeIcon) === null || N === void 0 ? void 0 : N.call(r)) || "×"])]
- });
- })]
- }),
- default: () => g("button", {
- type: "button",
- class: `${y}-nav-more`,
- style: re,
- tabindex: -1,
- "aria-hidden": "true",
- "aria-haspopup": "listbox",
- "aria-controls": p.value,
- id: `${x}-more`,
- "aria-expanded": o.value,
- onKeydown: d
- }, [K])
- });
- return g("div", {
- class: le(`${y}-nav-operations`, a.class),
- style: a.style
- }, [ce, g(lt, {
- prefixCls: y,
- locale: C,
- editable: r
- }, null)]);
- };
- }
- }), rt = Symbol("tabsContextKey"), st = (e) => {
- kt(rt, e);
- }, dt = () => Mt(rt, {
- tabs: Q([]),
- prefixCls: Q()
- });
- ae({
- compatConfig: {
- MODE: 3
- },
- name: "TabsContextProvider",
- inheritAttrs: !1,
- props: {
- tabs: {
- type: Object,
- default: void 0
- },
- prefixCls: {
- type: String,
- default: void 0
- }
- },
- setup(e, t) {
- let {
- slots: a
- } = t;
- return st(Nt(e)), () => {
- var i;
- return (i = a.default) === null || i === void 0 ? void 0 : i.call(a);
- };
- }
- });
- const ea = 0.1, Ue = 0.01, _e = 20, qe = Math.pow(0.995, _e);
- function ta(e, t) {
- const [a, i] = D(), [o, l] = D(0), [n, s] = D(0), [v, d] = D(), p = Q();
- function S(r) {
- const {
- screenX: m,
- screenY: u
- } = r.touches[0];
- i({
- x: m,
- y: u
- }), clearInterval(p.value);
- }
- function h(r) {
- if (!a.value) return;
- r.preventDefault();
- const {
- screenX: m,
- screenY: u
- } = r.touches[0], $ = m - a.value.x, E = u - a.value.y;
- t($, E), i({
- x: m,
- y: u
- });
- const R = Date.now();
- s(R - o.value), l(R), d({
- x: $,
- y: E
- });
- }
- function c() {
- if (!a.value) return;
- const r = v.value;
- if (i(null), d(null), r) {
- const m = r.x / n.value, u = r.y / n.value, $ = Math.abs(m), E = Math.abs(u);
- if (Math.max($, E) < ea) return;
- let R = m, G = u;
- p.value = setInterval(() => {
- if (Math.abs(R) < Ue && Math.abs(G) < Ue) {
- clearInterval(p.value);
- return;
- }
- R *= qe, G *= qe, t(R * _e, G * _e);
- }, _e);
- }
- }
- const y = Q();
- function x(r) {
- const {
- deltaX: m,
- deltaY: u
- } = r;
- let $ = 0;
- const E = Math.abs(m), R = Math.abs(u);
- E === R ? $ = y.value === "x" ? m : u : E > R ? ($ = m, y.value = "x") : ($ = u, y.value = "y"), t(-$, -$) && r.preventDefault();
- }
- const w = Q({
- onTouchStart: S,
- onTouchMove: h,
- onTouchEnd: c,
- onWheel: x
- });
- function C(r) {
- w.value.onTouchStart(r);
- }
- function k(r) {
- w.value.onTouchMove(r);
- }
- function K(r) {
- w.value.onTouchEnd(r);
- }
- function M(r) {
- w.value.onWheel(r);
- }
- Te(() => {
- var r, m;
- document.addEventListener("touchmove", k, {
- passive: !1
- }), document.addEventListener("touchend", K, {
- passive: !1
- }), (r = e.value) === null || r === void 0 || r.addEventListener("touchstart", C, {
- passive: !1
- }), (m = e.value) === null || m === void 0 || m.addEventListener("wheel", M, {
- passive: !1
- });
- }), Me(() => {
- document.removeEventListener("touchmove", k), document.removeEventListener("touchend", K);
- });
- }
- function Ze(e, t) {
- const a = Q(e);
- function i(o) {
- const l = typeof o == "function" ? o(a.value) : o;
- l !== a.value && t(l, a.value), a.value = l;
- }
- return [a, i];
- }
- const Qe = {
- width: 0,
- height: 0,
- left: 0,
- top: 0,
- right: 0
- }, aa = () => ({
- id: {
- type: String
- },
- tabPosition: {
- type: String
- },
- activeKey: {
- type: [String, Number]
- },
- rtl: {
- type: Boolean
- },
- animated: me(),
- editable: me(),
- moreIcon: we.any,
- moreTransitionName: {
- type: String
- },
- mobile: {
- type: Boolean
- },
- tabBarGutter: {
- type: Number
- },
- renderTabBar: {
- type: Function
- },
- locale: me(),
- popupClassName: String,
- getPopupContainer: j(),
- onTabClick: {
- type: Function
- },
- onTabScroll: {
- type: Function
- }
- }), na = (e, t) => {
- const {
- offsetWidth: a,
- offsetHeight: i,
- offsetTop: o,
- offsetLeft: l
- } = e, {
- width: n,
- height: s,
- x: v,
- y: d
- } = e.getBoundingClientRect();
- return Math.abs(n - a) < 1 ? [n, s, v - t.x, d - t.y] : [a, i, l, o];
- }, Je = ae({
- compatConfig: {
- MODE: 3
- },
- name: "TabNavList",
- inheritAttrs: !1,
- props: aa(),
- slots: Object,
- emits: ["tabClick", "tabScroll"],
- setup(e, t) {
- let {
- attrs: a,
- slots: i
- } = t;
- const {
- tabs: o,
- prefixCls: l
- } = dt(), n = W(), s = W(), v = W(), d = W(), [p, S] = Ot(), h = H(() => e.tabPosition === "top" || e.tabPosition === "bottom"), [c, y] = Ze(0, (f, b) => {
- h.value && e.onTabScroll && e.onTabScroll({
- direction: f > b ? "left" : "right"
- });
- }), [x, w] = Ze(0, (f, b) => {
- !h.value && e.onTabScroll && e.onTabScroll({
- direction: f > b ? "top" : "bottom"
- });
- }), [C, k] = D(0), [K, M] = D(0), [r, m] = D(null), [u, $] = D(null), [E, R] = D(0), [G, re] = D(0), [se, ce] = Ut(/* @__PURE__ */ new Map()), I = Zt(o, se), J = H(() => `${l.value}-nav-operations-hidden`), N = W(0), V = W(0);
- Ce(() => {
- h.value ? e.rtl ? (N.value = 0, V.value = Math.max(0, C.value - r.value)) : (N.value = Math.min(0, r.value - C.value), V.value = 0) : (N.value = Math.min(0, u.value - K.value), V.value = 0);
- });
- const Y = (f) => f < N.value ? N.value : f > V.value ? V.value : f, ue = W(), [z, ve] = D(), be = () => {
- ve(Date.now());
- }, pe = () => {
- clearTimeout(ue.value);
- }, $e = (f, b) => {
- f((_) => Y(_ + b));
- };
- ta(n, (f, b) => {
- if (h.value) {
- if (r.value >= C.value)
- return !1;
- $e(y, f);
- } else {
- if (u.value >= K.value)
- return !1;
- $e(w, b);
- }
- return pe(), be(), !0;
- }), ie(z, () => {
- pe(), z.value && (ue.value = setTimeout(() => {
- ve(0);
- }, 100));
- });
- const de = function() {
- let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : e.activeKey;
- const b = I.value.get(f) || {
- width: 0,
- height: 0,
- left: 0,
- right: 0,
- top: 0
- };
- if (h.value) {
- let _ = c.value;
- e.rtl ? b.right < c.value ? _ = b.right : b.right + b.width > c.value + r.value && (_ = b.right + b.width - r.value) : b.left < -c.value ? _ = -b.left : b.left + b.width > -c.value + r.value && (_ = -(b.left + b.width - r.value)), w(0), y(Y(_));
- } else {
- let _ = x.value;
- b.top < -x.value ? _ = -b.top : b.top + b.height > -x.value + u.value && (_ = -(b.top + b.height - u.value)), y(0), w(Y(_));
- }
- }, Pe = W(0), Re = W(0);
- Ce(() => {
- let f, b, _, P, L, B;
- const U = I.value;
- ["top", "bottom"].includes(e.tabPosition) ? (f = "width", P = r.value, L = C.value, B = E.value, b = e.rtl ? "right" : "left", _ = Math.abs(c.value)) : (f = "height", P = u.value, L = C.value, B = G.value, b = "top", _ = -x.value);
- let O = P;
- L + B > P && L < P && (O = P - B);
- const F = o.value;
- if (!F.length)
- return [Pe.value, Re.value] = [0, 0];
- const q = F.length;
- let oe = q;
- for (let X = 0; X < q; X += 1) {
- const ee = U.get(F[X].key) || Qe;
- if (ee[b] + ee[f] > _ + O) {
- oe = X - 1;
- break;
- }
- }
- let A = 0;
- for (let X = q - 1; X >= 0; X -= 1)
- if ((U.get(F[X].key) || Qe)[b] < _) {
- A = X + 1;
- break;
- }
- return [Pe.value, Re.value] = [A, oe];
- });
- const Ne = () => {
- ce(() => {
- var f;
- const b = /* @__PURE__ */ new Map(), _ = (f = s.value) === null || f === void 0 ? void 0 : f.getBoundingClientRect();
- return o.value.forEach((P) => {
- let {
- key: L
- } = P;
- const B = S.value.get(L), U = (B == null ? void 0 : B.$el) || B;
- if (U) {
- const [O, F, q, oe] = na(U, _);
- b.set(L, {
- width: O,
- height: F,
- left: q,
- top: oe
- });
- }
- }), b;
- });
- };
- ie(() => o.value.map((f) => f.key).join("%%"), () => {
- Ne();
- }, {
- flush: "post"
- });
- const Ie = () => {
- var f, b, _, P, L;
- const B = ((f = n.value) === null || f === void 0 ? void 0 : f.offsetWidth) || 0, U = ((b = n.value) === null || b === void 0 ? void 0 : b.offsetHeight) || 0, O = ((_ = d.value) === null || _ === void 0 ? void 0 : _.$el) || {}, F = O.offsetWidth || 0, q = O.offsetHeight || 0;
- m(B), $(U), R(F), re(q);
- const oe = (((P = s.value) === null || P === void 0 ? void 0 : P.offsetWidth) || 0) - F, A = (((L = s.value) === null || L === void 0 ? void 0 : L.offsetHeight) || 0) - q;
- k(oe), M(A), Ne();
- }, Oe = H(() => [...o.value.slice(0, Pe.value), ...o.value.slice(Re.value + 1)]), [ut, vt] = D(), ne = H(() => I.value.get(e.activeKey)), We = W(), He = () => {
- ge.cancel(We.value);
- };
- ie([ne, h, () => e.rtl], () => {
- const f = {};
- ne.value && (h.value ? (e.rtl ? f.right = he(ne.value.right) : f.left = he(ne.value.left), f.width = he(ne.value.width)) : (f.top = he(ne.value.top), f.height = he(ne.value.height))), He(), We.value = ge(() => {
- vt(f);
- });
- }), ie([() => e.activeKey, ne, I, h], () => {
- de();
- }, {
- flush: "post"
- }), ie([() => e.rtl, () => e.tabBarGutter, () => e.activeKey, () => o.value], () => {
- Ie();
- }, {
- flush: "post"
- });
- const Ee = (f) => {
- let {
- position: b,
- prefixCls: _,
- extra: P
- } = f;
- if (!P) return null;
- const L = P == null ? void 0 : P({
- position: b
- });
- return L ? g("div", {
- class: `${_}-extra-content`
- }, [L]) : null;
- };
- return Me(() => {
- pe(), He();
- }), () => {
- const {
- id: f,
- animated: b,
- activeKey: _,
- rtl: P,
- editable: L,
- locale: B,
- tabPosition: U,
- tabBarGutter: O,
- onTabClick: F
- } = e, {
- class: q,
- style: oe
- } = a, A = l.value, X = !!Oe.value.length, ee = `${A}-nav-wrap`;
- let Be, Le, ze, Ke;
- h.value ? P ? (Le = c.value > 0, Be = c.value + r.value < C.value) : (Be = c.value < 0, Le = -c.value + r.value < C.value) : (ze = x.value < 0, Ke = -x.value + u.value < K.value);
- const ye = {};
- U === "top" || U === "bottom" ? ye[P ? "marginRight" : "marginLeft"] = typeof O == "number" ? `${O}px` : O : ye.marginTop = typeof O == "number" ? `${O}px` : O;
- const Ge = o.value.map((Ae, bt) => {
- const {
- key: fe
- } = Ae;
- return g(qt, {
- id: f,
- prefixCls: A,
- key: fe,
- tab: Ae,
- style: bt === 0 ? void 0 : ye,
- closable: Ae.closable,
- editable: L,
- active: fe === _,
- removeAriaLabel: B == null ? void 0 : B.removeAriaLabel,
- ref: p(fe),
- onClick: (pt) => {
- F(fe, pt);
- },
- onFocus: () => {
- de(fe), be(), n.value && (P || (n.value.scrollLeft = 0), n.value.scrollTop = 0);
- }
- }, i);
- });
- return g("div", {
- role: "tablist",
- class: le(`${A}-nav`, q),
- style: oe,
- onKeydown: () => {
- be();
- }
- }, [g(Ee, {
- position: "left",
- prefixCls: A,
- extra: i.leftExtra
- }, null), g(Fe, {
- onResize: Ie
- }, {
- default: () => [g("div", {
- class: le(ee, {
- [`${ee}-ping-left`]: Be,
- [`${ee}-ping-right`]: Le,
- [`${ee}-ping-top`]: ze,
- [`${ee}-ping-bottom`]: Ke
- }),
- ref: n
- }, [g(Fe, {
- onResize: Ie
- }, {
- default: () => [g("div", {
- ref: s,
- class: `${A}-nav-list`,
- style: {
- transform: `translate(${c.value}px, ${x.value}px)`,
- transition: z.value ? "none" : void 0
- }
- }, [Ge, g(lt, {
- ref: d,
- prefixCls: A,
- locale: B,
- editable: L,
- style: T(T({}, Ge.length === 0 ? void 0 : ye), {
- visibility: X ? "hidden" : null
- })
- }, null), g("div", {
- class: le(`${A}-ink-bar`, {
- [`${A}-ink-bar-animated`]: b.inkBar
- }),
- style: ut.value
- }, null)])]
- })])]
- }), g(Jt, te(te({}, e), {}, {
- removeAriaLabel: B == null ? void 0 : B.removeAriaLabel,
- ref: v,
- prefixCls: A,
- tabs: Oe.value,
- class: !X && J.value
- }), it(i, ["moreIcon"])), g(Ee, {
- position: "right",
- prefixCls: A,
- extra: i.rightExtra
- }, null), g(Ee, {
- position: "right",
- prefixCls: A,
- extra: i.tabBarExtraContent
- }, null)]);
- };
- }
- }), oa = ae({
- compatConfig: {
- MODE: 3
- },
- name: "TabPanelList",
- inheritAttrs: !1,
- props: {
- activeKey: {
- type: [String, Number]
- },
- id: {
- type: String
- },
- rtl: {
- type: Boolean
- },
- animated: {
- type: Object,
- default: void 0
- },
- tabPosition: {
- type: String
- },
- destroyInactiveTabPane: {
- type: Boolean
- }
- },
- setup(e) {
- const {
- tabs: t,
- prefixCls: a
- } = dt();
- return () => {
- const {
- id: i,
- activeKey: o,
- animated: l,
- tabPosition: n,
- rtl: s,
- destroyInactiveTabPane: v
- } = e, d = l.tabPane, p = a.value, S = t.value.findIndex((h) => h.key === o);
- return g("div", {
- class: `${p}-content-holder`
- }, [g("div", {
- class: [`${p}-content`, `${p}-content-${n}`, {
- [`${p}-content-animated`]: d
- }],
- style: S && d ? {
- [s ? "marginRight" : "marginLeft"]: `-${S}00%`
- } : null
- }, [t.value.map((h) => xt(h.node, {
- key: h.key,
- prefixCls: p,
- tabKey: h.key,
- id: i,
- animated: d,
- active: h.key === o,
- destroyInactiveTabPane: v
- }))])]);
- };
- }
- }), ia = (e) => {
- const {
- componentCls: t,
- motionDurationSlow: a
- } = e;
- return [
- {
- [t]: {
- [`${t}-switch`]: {
- "&-appear, &-enter": {
- transition: "none",
- "&-start": {
- opacity: 0
- },
- "&-active": {
- opacity: 1,
- transition: `opacity ${a}`
- }
- },
- "&-leave": {
- position: "absolute",
- transition: "none",
- inset: 0,
- "&-start": {
- opacity: 1
- },
- "&-active": {
- opacity: 0,
- transition: `opacity ${a}`
- }
- }
- }
- }
- },
- // Follow code may reuse in other components
- [je(e, "slide-up"), je(e, "slide-down")]
- ];
- }, la = (e) => {
- const {
- componentCls: t,
- tabsCardHorizontalPadding: a,
- tabsCardHeadBackground: i,
- tabsCardGutter: o,
- colorSplit: l
- } = e;
- return {
- [`${t}-card`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab`]: {
- margin: 0,
- padding: a,
- background: i,
- border: `${e.lineWidth}px ${e.lineType} ${l}`,
- transition: `all ${e.motionDurationSlow} ${e.motionEaseInOut}`
- },
- [`${t}-tab-active`]: {
- color: e.colorPrimary,
- background: e.colorBgContainer
- },
- [`${t}-ink-bar`]: {
- visibility: "hidden"
- }
- },
- // ========================== Top & Bottom ==========================
- [`&${t}-top, &${t}-bottom`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab + ${t}-tab`]: {
- marginLeft: {
- _skip_check_: !0,
- value: `${o}px`
- }
- }
- }
- },
- [`&${t}-top`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab`]: {
- borderRadius: `${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`
- },
- [`${t}-tab-active`]: {
- borderBottomColor: e.colorBgContainer
- }
- }
- },
- [`&${t}-bottom`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab`]: {
- borderRadius: `0 0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px`
- },
- [`${t}-tab-active`]: {
- borderTopColor: e.colorBgContainer
- }
- }
- },
- // ========================== Left & Right ==========================
- [`&${t}-left, &${t}-right`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab + ${t}-tab`]: {
- marginTop: `${o}px`
- }
- }
- },
- [`&${t}-left`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab`]: {
- borderRadius: {
- _skip_check_: !0,
- value: `${e.borderRadiusLG}px 0 0 ${e.borderRadiusLG}px`
- }
- },
- [`${t}-tab-active`]: {
- borderRightColor: {
- _skip_check_: !0,
- value: e.colorBgContainer
- }
- }
- }
- },
- [`&${t}-right`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab`]: {
- borderRadius: {
- _skip_check_: !0,
- value: `0 ${e.borderRadiusLG}px ${e.borderRadiusLG}px 0`
- }
- },
- [`${t}-tab-active`]: {
- borderLeftColor: {
- _skip_check_: !0,
- value: e.colorBgContainer
- }
- }
- }
- }
- }
- };
- }, ra = (e) => {
- const {
- componentCls: t,
- tabsHoverColor: a,
- dropdownEdgeChildVerticalPadding: i
- } = e;
- return {
- [`${t}-dropdown`]: T(T({}, tt(e)), {
- position: "absolute",
- top: -9999,
- left: {
- _skip_check_: !0,
- value: -9999
- },
- zIndex: e.zIndexPopup,
- display: "block",
- "&-hidden": {
- display: "none"
- },
- [`${t}-dropdown-menu`]: {
- maxHeight: e.tabsDropdownHeight,
- margin: 0,
- padding: `${i}px 0`,
- overflowX: "hidden",
- overflowY: "auto",
- textAlign: {
- _skip_check_: !0,
- value: "left"
- },
- listStyleType: "none",
- backgroundColor: e.colorBgContainer,
- backgroundClip: "padding-box",
- borderRadius: e.borderRadiusLG,
- outline: "none",
- boxShadow: e.boxShadowSecondary,
- "&-item": T(T({}, Ct), {
- display: "flex",
- alignItems: "center",
- minWidth: e.tabsDropdownWidth,
- margin: 0,
- padding: `${e.paddingXXS}px ${e.paddingSM}px`,
- color: e.colorText,
- fontWeight: "normal",
- fontSize: e.fontSize,
- lineHeight: e.lineHeight,
- cursor: "pointer",
- transition: `all ${e.motionDurationSlow}`,
- "> span": {
- flex: 1,
- whiteSpace: "nowrap"
- },
- "&-remove": {
- flex: "none",
- marginLeft: {
- _skip_check_: !0,
- value: e.marginSM
- },
- color: e.colorTextDescription,
- fontSize: e.fontSizeSM,
- background: "transparent",
- border: 0,
- cursor: "pointer",
- "&:hover": {
- color: a
- }
- },
- "&:hover": {
- background: e.controlItemBgHover
- },
- "&-disabled": {
- "&, &:hover": {
- color: e.colorTextDisabled,
- background: "transparent",
- cursor: "not-allowed"
- }
- }
- })
- }
- })
- };
- }, sa = (e) => {
- const {
- componentCls: t,
- margin: a,
- colorSplit: i
- } = e;
- return {
- // ========================== Top & Bottom ==========================
- [`${t}-top, ${t}-bottom`]: {
- flexDirection: "column",
- [`> ${t}-nav, > div > ${t}-nav`]: {
- margin: `0 0 ${a}px 0`,
- "&::before": {
- position: "absolute",
- right: {
- _skip_check_: !0,
- value: 0
- },
- left: {
- _skip_check_: !0,
- value: 0
- },
- borderBottom: `${e.lineWidth}px ${e.lineType} ${i}`,
- content: "''"
- },
- [`${t}-ink-bar`]: {
- height: e.lineWidthBold,
- "&-animated": {
- transition: `width ${e.motionDurationSlow}, left ${e.motionDurationSlow},
- right ${e.motionDurationSlow}`
- }
- },
- [`${t}-nav-wrap`]: {
- "&::before, &::after": {
- top: 0,
- bottom: 0,
- width: e.controlHeight
- },
- "&::before": {
- left: {
- _skip_check_: !0,
- value: 0
- },
- boxShadow: e.boxShadowTabsOverflowLeft
- },
- "&::after": {
- right: {
- _skip_check_: !0,
- value: 0
- },
- boxShadow: e.boxShadowTabsOverflowRight
- },
- [`&${t}-nav-wrap-ping-left::before`]: {
- opacity: 1
- },
- [`&${t}-nav-wrap-ping-right::after`]: {
- opacity: 1
- }
- }
- }
- },
- [`${t}-top`]: {
- [`> ${t}-nav,
- > div > ${t}-nav`]: {
- "&::before": {
- bottom: 0
- },
- [`${t}-ink-bar`]: {
- bottom: 0
- }
- }
- },
- [`${t}-bottom`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- order: 1,
- marginTop: `${a}px`,
- marginBottom: 0,
- "&::before": {
- top: 0
- },
- [`${t}-ink-bar`]: {
- top: 0
- }
- },
- [`> ${t}-content-holder, > div > ${t}-content-holder`]: {
- order: 0
- }
- },
- // ========================== Left & Right ==========================
- [`${t}-left, ${t}-right`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- flexDirection: "column",
- minWidth: e.controlHeight * 1.25,
- // >>>>>>>>>>> Tab
- [`${t}-tab`]: {
- padding: `${e.paddingXS}px ${e.paddingLG}px`,
- textAlign: "center"
- },
- [`${t}-tab + ${t}-tab`]: {
- margin: `${e.margin}px 0 0 0`
- },
- // >>>>>>>>>>> Nav
- [`${t}-nav-wrap`]: {
- flexDirection: "column",
- "&::before, &::after": {
- right: {
- _skip_check_: !0,
- value: 0
- },
- left: {
- _skip_check_: !0,
- value: 0
- },
- height: e.controlHeight
- },
- "&::before": {
- top: 0,
- boxShadow: e.boxShadowTabsOverflowTop
- },
- "&::after": {
- bottom: 0,
- boxShadow: e.boxShadowTabsOverflowBottom
- },
- [`&${t}-nav-wrap-ping-top::before`]: {
- opacity: 1
- },
- [`&${t}-nav-wrap-ping-bottom::after`]: {
- opacity: 1
- }
- },
- // >>>>>>>>>>> Ink Bar
- [`${t}-ink-bar`]: {
- width: e.lineWidthBold,
- "&-animated": {
- transition: `height ${e.motionDurationSlow}, top ${e.motionDurationSlow}`
- }
- },
- [`${t}-nav-list, ${t}-nav-operations`]: {
- flex: "1 0 auto",
- flexDirection: "column"
- }
- }
- },
- [`${t}-left`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-ink-bar`]: {
- right: {
- _skip_check_: !0,
- value: 0
- }
- }
- },
- [`> ${t}-content-holder, > div > ${t}-content-holder`]: {
- marginLeft: {
- _skip_check_: !0,
- value: `-${e.lineWidth}px`
- },
- borderLeft: {
- _skip_check_: !0,
- value: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`
- },
- [`> ${t}-content > ${t}-tabpane`]: {
- paddingLeft: {
- _skip_check_: !0,
- value: e.paddingLG
- }
- }
- }
- },
- [`${t}-right`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- order: 1,
- [`${t}-ink-bar`]: {
- left: {
- _skip_check_: !0,
- value: 0
- }
- }
- },
- [`> ${t}-content-holder, > div > ${t}-content-holder`]: {
- order: 0,
- marginRight: {
- _skip_check_: !0,
- value: -e.lineWidth
- },
- borderRight: {
- _skip_check_: !0,
- value: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`
- },
- [`> ${t}-content > ${t}-tabpane`]: {
- paddingRight: {
- _skip_check_: !0,
- value: e.paddingLG
- }
- }
- }
- }
- };
- }, da = (e) => {
- const {
- componentCls: t,
- padding: a
- } = e;
- return {
- [t]: {
- "&-small": {
- [`> ${t}-nav`]: {
- [`${t}-tab`]: {
- padding: `${e.paddingXS}px 0`,
- fontSize: e.fontSize
- }
- }
- },
- "&-large": {
- [`> ${t}-nav`]: {
- [`${t}-tab`]: {
- padding: `${a}px 0`,
- fontSize: e.fontSizeLG
- }
- }
- }
- },
- [`${t}-card`]: {
- [`&${t}-small`]: {
- [`> ${t}-nav`]: {
- [`${t}-tab`]: {
- padding: `${e.paddingXXS * 1.5}px ${a}px`
- }
- },
- [`&${t}-bottom`]: {
- [`> ${t}-nav ${t}-tab`]: {
- borderRadius: `0 0 ${e.borderRadius}px ${e.borderRadius}px`
- }
- },
- [`&${t}-top`]: {
- [`> ${t}-nav ${t}-tab`]: {
- borderRadius: `${e.borderRadius}px ${e.borderRadius}px 0 0`
- }
- },
- [`&${t}-right`]: {
- [`> ${t}-nav ${t}-tab`]: {
- borderRadius: {
- _skip_check_: !0,
- value: `0 ${e.borderRadius}px ${e.borderRadius}px 0`
- }
- }
- },
- [`&${t}-left`]: {
- [`> ${t}-nav ${t}-tab`]: {
- borderRadius: {
- _skip_check_: !0,
- value: `${e.borderRadius}px 0 0 ${e.borderRadius}px`
- }
- }
- }
- },
- [`&${t}-large`]: {
- [`> ${t}-nav`]: {
- [`${t}-tab`]: {
- padding: `${e.paddingXS}px ${a}px ${e.paddingXXS * 1.5}px`
- }
- }
- }
- }
- };
- }, ca = (e) => {
- const {
- componentCls: t,
- tabsActiveColor: a,
- tabsHoverColor: i,
- iconCls: o,
- tabsHorizontalGutter: l
- } = e, n = `${t}-tab`;
- return {
- [n]: {
- position: "relative",
- display: "inline-flex",
- alignItems: "center",
- padding: `${e.paddingSM}px 0`,
- fontSize: `${e.fontSize}px`,
- background: "transparent",
- border: 0,
- outline: "none",
- cursor: "pointer",
- "&-btn, &-remove": T({
- "&:focus:not(:focus-visible), &:active": {
- color: a
- }
- }, at(e)),
- "&-btn": {
- outline: "none",
- transition: "all 0.3s"
- },
- "&-remove": {
- flex: "none",
- marginRight: {
- _skip_check_: !0,
- value: -e.marginXXS
- },
- marginLeft: {
- _skip_check_: !0,
- value: e.marginXS
- },
- color: e.colorTextDescription,
- fontSize: e.fontSizeSM,
- background: "transparent",
- border: "none",
- outline: "none",
- cursor: "pointer",
- transition: `all ${e.motionDurationSlow}`,
- "&:hover": {
- color: e.colorTextHeading
- }
- },
- "&:hover": {
- color: i
- },
- [`&${n}-active ${n}-btn`]: {
- color: e.colorPrimary,
- textShadow: e.tabsActiveTextShadow
- },
- [`&${n}-disabled`]: {
- color: e.colorTextDisabled,
- cursor: "not-allowed"
- },
- [`&${n}-disabled ${n}-btn, &${n}-disabled ${t}-remove`]: {
- "&:focus, &:active": {
- color: e.colorTextDisabled
- }
- },
- [`& ${n}-remove ${o}`]: {
- margin: 0
- },
- [o]: {
- marginRight: {
- _skip_check_: !0,
- value: e.marginSM
- }
- }
- },
- [`${n} + ${n}`]: {
- margin: {
- _skip_check_: !0,
- value: `0 0 0 ${l}px`
- }
- }
- };
- }, ua = (e) => {
- const {
- componentCls: t,
- tabsHorizontalGutter: a,
- iconCls: i,
- tabsCardGutter: o
- } = e;
- return {
- [`${t}-rtl`]: {
- direction: "rtl",
- [`${t}-nav`]: {
- [`${t}-tab`]: {
- margin: {
- _skip_check_: !0,
- value: `0 0 0 ${a}px`
- },
- [`${t}-tab:last-of-type`]: {
- marginLeft: {
- _skip_check_: !0,
- value: 0
- }
- },
- [i]: {
- marginRight: {
- _skip_check_: !0,
- value: 0
- },
- marginLeft: {
- _skip_check_: !0,
- value: `${e.marginSM}px`
- }
- },
- [`${t}-tab-remove`]: {
- marginRight: {
- _skip_check_: !0,
- value: `${e.marginXS}px`
- },
- marginLeft: {
- _skip_check_: !0,
- value: `-${e.marginXXS}px`
- },
- [i]: {
- margin: 0
- }
- }
- }
- },
- [`&${t}-left`]: {
- [`> ${t}-nav`]: {
- order: 1
- },
- [`> ${t}-content-holder`]: {
- order: 0
- }
- },
- [`&${t}-right`]: {
- [`> ${t}-nav`]: {
- order: 0
- },
- [`> ${t}-content-holder`]: {
- order: 1
- }
- },
- // ====================== Card ======================
- [`&${t}-card${t}-top, &${t}-card${t}-bottom`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-tab + ${t}-tab`]: {
- marginRight: {
- _skip_check_: !0,
- value: `${o}px`
- },
- marginLeft: {
- _skip_check_: !0,
- value: 0
- }
- }
- }
- }
- },
- [`${t}-dropdown-rtl`]: {
- direction: "rtl"
- },
- [`${t}-menu-item`]: {
- [`${t}-dropdown-rtl`]: {
- textAlign: {
- _skip_check_: !0,
- value: "right"
- }
- }
- }
- };
- }, va = (e) => {
- const {
- componentCls: t,
- tabsCardHorizontalPadding: a,
- tabsCardHeight: i,
- tabsCardGutter: o,
- tabsHoverColor: l,
- tabsActiveColor: n,
- colorSplit: s
- } = e;
- return {
- [t]: T(T(T(T({}, tt(e)), {
- display: "flex",
- // ========================== Navigation ==========================
- [`> ${t}-nav, > div > ${t}-nav`]: {
- position: "relative",
- display: "flex",
- flex: "none",
- alignItems: "center",
- [`${t}-nav-wrap`]: {
- position: "relative",
- display: "flex",
- flex: "auto",
- alignSelf: "stretch",
- overflow: "hidden",
- whiteSpace: "nowrap",
- transform: "translate(0)",
- // >>>>> Ping shadow
- "&::before, &::after": {
- position: "absolute",
- zIndex: 1,
- opacity: 0,
- transition: `opacity ${e.motionDurationSlow}`,
- content: "''",
- pointerEvents: "none"
- }
- },
- [`${t}-nav-list`]: {
- position: "relative",
- display: "flex",
- transition: `opacity ${e.motionDurationSlow}`
- },
- // >>>>>>>> Operations
- [`${t}-nav-operations`]: {
- display: "flex",
- alignSelf: "stretch"
- },
- [`${t}-nav-operations-hidden`]: {
- position: "absolute",
- visibility: "hidden",
- pointerEvents: "none"
- },
- [`${t}-nav-more`]: {
- position: "relative",
- padding: a,
- background: "transparent",
- border: 0,
- "&::after": {
- position: "absolute",
- right: {
- _skip_check_: !0,
- value: 0
- },
- bottom: 0,
- left: {
- _skip_check_: !0,
- value: 0
- },
- height: e.controlHeightLG / 8,
- transform: "translateY(100%)",
- content: "''"
- }
- },
- [`${t}-nav-add`]: T({
- minWidth: `${i}px`,
- marginLeft: {
- _skip_check_: !0,
- value: `${o}px`
- },
- padding: `0 ${e.paddingXS}px`,
- background: "transparent",
- border: `${e.lineWidth}px ${e.lineType} ${s}`,
- borderRadius: `${e.borderRadiusLG}px ${e.borderRadiusLG}px 0 0`,
- outline: "none",
- cursor: "pointer",
- color: e.colorText,
- transition: `all ${e.motionDurationSlow} ${e.motionEaseInOut}`,
- "&:hover": {
- color: l
- },
- "&:active, &:focus:not(:focus-visible)": {
- color: n
- }
- }, at(e))
- },
- [`${t}-extra-content`]: {
- flex: "none"
- },
- // ============================ InkBar ============================
- [`${t}-ink-bar`]: {
- position: "absolute",
- background: e.colorPrimary,
- pointerEvents: "none"
- }
- }), ca(e)), {
- // =========================== TabPanes ===========================
- [`${t}-content`]: {
- position: "relative",
- display: "flex",
- width: "100%",
- "&-animated": {
- transition: "margin 0.3s"
- }
- },
- [`${t}-content-holder`]: {
- flex: "auto",
- minWidth: 0,
- minHeight: 0
- },
- [`${t}-tabpane`]: {
- outline: "none",
- flex: "none",
- width: "100%"
- }
- }),
- [`${t}-centered`]: {
- [`> ${t}-nav, > div > ${t}-nav`]: {
- [`${t}-nav-wrap`]: {
- [`&:not([class*='${t}-nav-wrap-ping'])`]: {
- justifyContent: "center"
- }
- }
- }
- }
- };
- }, ba = _t("Tabs", (e) => {
- const t = e.controlHeightLG, a = St(e, {
- tabsHoverColor: e.colorPrimaryHover,
- tabsActiveColor: e.colorPrimaryActive,
- tabsCardHorizontalPadding: `${(t - Math.round(e.fontSize * e.lineHeight)) / 2 - e.lineWidth}px ${e.padding}px`,
- tabsCardHeight: t,
- tabsCardGutter: e.marginXXS / 2,
- tabsHorizontalGutter: 32,
- tabsCardHeadBackground: e.colorFillAlter,
- dropdownEdgeChildVerticalPadding: e.paddingXXS,
- tabsActiveTextShadow: "0 0 0.25px currentcolor",
- tabsDropdownHeight: 200,
- tabsDropdownWidth: 120
- });
- return [da(a), ua(a), sa(a), ra(a), la(a), va(a), ia(a)];
- }, (e) => ({
- zIndexPopup: e.zIndexPopupBase + 50
- }));
- let et = 0;
- const ct = () => ({
- prefixCls: {
- type: String
- },
- id: {
- type: String
- },
- popupClassName: String,
- getPopupContainer: j(),
- activeKey: {
- type: [String, Number]
- },
- defaultActiveKey: {
- type: [String, Number]
- },
- direction: xe(),
- animated: Dt([Boolean, Object]),
- renderTabBar: j(),
- tabBarGutter: {
- type: Number
- },
- tabBarStyle: me(),
- tabPosition: xe(),
- destroyInactiveTabPane: At(),
- hideAdd: Boolean,
- type: xe(),
- size: xe(),
- centered: Boolean,
- onEdit: j(),
- onChange: j(),
- onTabClick: j(),
- onTabScroll: j(),
- "onUpdate:activeKey": j(),
- // Accessibility
- locale: me(),
- onPrevClick: j(),
- onNextClick: j(),
- tabBarExtraContent: we.any
- });
- function pa(e) {
- return e.map((t) => {
- if (Pt(t)) {
- const a = T({}, t.props || {});
- for (const [h, c] of Object.entries(a))
- delete a[h], a[Rt(h)] = c;
- const i = t.children || {}, o = t.key !== void 0 ? t.key : void 0, {
- tab: l = i.tab,
- disabled: n,
- forceRender: s,
- closable: v,
- animated: d,
- active: p,
- destroyInactiveTabPane: S
- } = a;
- return T(T({
- key: o
- }, a), {
- node: t,
- closeIcon: i.closeIcon,
- tab: l,
- disabled: n === "" || n,
- forceRender: s === "" || s,
- closable: v === "" || v,
- animated: d === "" || d,
- active: p === "" || p,
- destroyInactiveTabPane: S === "" || S
- });
- }
- return null;
- }).filter((t) => t);
- }
- const fa = ae({
- compatConfig: {
- MODE: 3
- },
- name: "InternalTabs",
- inheritAttrs: !1,
- props: T(T({}, nt(ct(), {
- tabPosition: "top",
- animated: {
- inkBar: !0,
- tabPane: !1
- }
- })), {
- tabs: Lt()
- }),
- slots: Object,
- // emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
- setup(e, t) {
- let {
- attrs: a,
- slots: i
- } = t;
- De(e.onPrevClick === void 0 && e.onNextClick === void 0, "Tabs", "`onPrevClick / @prevClick` and `onNextClick / @nextClick` has been removed. Please use `onTabScroll / @tabScroll` instead."), De(e.tabBarExtraContent === void 0, "Tabs", "`tabBarExtraContent` prop has been removed. Please use `rightExtra` slot instead."), De(i.tabBarExtraContent === void 0, "Tabs", "`tabBarExtraContent` slot is deprecated. Please use `rightExtra` slot instead.");
- const {
- prefixCls: o,
- direction: l,
- size: n,
- rootPrefixCls: s,
- getPopupContainer: v
- } = It("tabs", e), [d, p] = ba(o), S = H(() => l.value === "rtl"), h = H(() => {
- const {
- animated: u,
- tabPosition: $
- } = e;
- return u === !1 || ["left", "right"].includes($) ? {
- inkBar: !1,
- tabPane: !1
- } : u === !0 ? {
- inkBar: !0,
- tabPane: !0
- } : T({
- inkBar: !0,
- tabPane: !1
- }, typeof u == "object" ? u : {});
- }), [c, y] = D(!1);
- Te(() => {
- y(Xt());
- });
- const [x, w] = Ve(() => {
- var u;
- return (u = e.tabs[0]) === null || u === void 0 ? void 0 : u.key;
- }, {
- value: H(() => e.activeKey),
- defaultValue: e.defaultActiveKey
- }), [C, k] = D(() => e.tabs.findIndex((u) => u.key === x.value));
- Ce(() => {
- var u;
- let $ = e.tabs.findIndex((E) => E.key === x.value);
- $ === -1 && ($ = Math.max(0, Math.min(C.value, e.tabs.length - 1)), w((u = e.tabs[$]) === null || u === void 0 ? void 0 : u.key)), k($);
- });
- const [K, M] = Ve(null, {
- value: H(() => e.id)
- }), r = H(() => c.value && !["left", "right"].includes(e.tabPosition) ? "top" : e.tabPosition);
- Te(() => {
- e.id || (M(`rc-tabs-${process.env.NODE_ENV === "test" ? "test" : et}`), et += 1);
- });
- const m = (u, $) => {
- var E, R;
- (E = e.onTabClick) === null || E === void 0 || E.call(e, u, $);
- const G = u !== x.value;
- w(u), G && ((R = e.onChange) === null || R === void 0 || R.call(e, u));
- };
- return st({
- tabs: H(() => e.tabs),
- prefixCls: o
- }), () => {
- const {
- id: u,
- type: $,
- tabBarGutter: E,
- tabBarStyle: R,
- locale: G,
- destroyInactiveTabPane: re,
- renderTabBar: se = i.renderTabBar,
- onTabScroll: ce,
- hideAdd: I,
- centered: J
- } = e, N = {
- id: K.value,
- activeKey: x.value,
- animated: h.value,
- tabPosition: r.value,
- rtl: S.value,
- mobile: c.value
- };
- let V;
- $ === "editable-card" && (V = {
- onEdit: (ve, be) => {
- let {
- key: pe,
- event: $e
- } = be;
- var de;
- (de = e.onEdit) === null || de === void 0 || de.call(e, ve === "add" ? $e : pe, ve);
- },
- removeIcon: () => g(Bt, null, null),
- addIcon: i.addIcon ? i.addIcon : () => g(Et, null, null),
- showAdd: I !== !0
- });
- let Y;
- const ue = T(T({}, N), {
- moreTransitionName: `${s.value}-slide-up`,
- editable: V,
- locale: G,
- tabBarGutter: E,
- onTabClick: m,
- onTabScroll: ce,
- style: R,
- getPopupContainer: v.value,
- popupClassName: le(e.popupClassName, p.value)
- });
- se ? Y = se(T(T({}, ue), {
- DefaultTabBar: Je
- })) : Y = g(Je, ue, it(i, ["moreIcon", "leftExtra", "rightExtra", "tabBarExtraContent"]));
- const z = o.value;
- return d(g("div", te(te({}, a), {}, {
- id: u,
- class: le(z, `${z}-${r.value}`, {
- [p.value]: !0,
- [`${z}-${n.value}`]: n.value,
- [`${z}-card`]: ["card", "editable-card"].includes($),
- [`${z}-editable-card`]: $ === "editable-card",
- [`${z}-centered`]: J,
- [`${z}-mobile`]: c.value,
- [`${z}-editable`]: $ === "editable-card",
- [`${z}-rtl`]: S.value
- }, a.class)
- }), [Y, g(oa, te(te({
- destroyInactiveTabPane: re
- }, N), {}, {
- animated: h.value
- }), null)]));
- };
- }
- }), Se = ae({
- compatConfig: {
- MODE: 3
- },
- name: "ATabs",
- inheritAttrs: !1,
- props: nt(ct(), {
- tabPosition: "top",
- animated: {
- inkBar: !0,
- tabPane: !1
- }
- }),
- slots: Object,
- // emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
- setup(e, t) {
- let {
- attrs: a,
- slots: i,
- emit: o
- } = t;
- const l = (n) => {
- o("update:activeKey", n), o("change", n);
- };
- return () => {
- var n;
- const s = pa(Tt((n = i.default) === null || n === void 0 ? void 0 : n.call(i)));
- return g(fa, te(te(te({}, wt(e, ["onUpdate:activeKey"])), a), {}, {
- onChange: l,
- tabs: s
- }), i);
- };
- }
- }), ha = () => ({
- tab: we.any,
- disabled: {
- type: Boolean
- },
- forceRender: {
- type: Boolean
- },
- closable: {
- type: Boolean
- },
- animated: {
- type: Boolean
- },
- active: {
- type: Boolean
- },
- destroyInactiveTabPane: {
- type: Boolean
- },
- // Pass by TabPaneList
- prefixCls: {
- type: String
- },
- tabKey: {
- type: [String, Number]
- },
- id: {
- type: String
- }
- // closeIcon: PropTypes.any,
- }), ke = ae({
- compatConfig: {
- MODE: 3
- },
- name: "ATabPane",
- inheritAttrs: !1,
- __ANT_TAB_PANE: !0,
- props: ha(),
- slots: Object,
- setup(e, t) {
- let {
- attrs: a,
- slots: i
- } = t;
- const o = Q(e.forceRender);
- ie([() => e.active, () => e.destroyInactiveTabPane], () => {
- e.active ? o.value = !0 : e.destroyInactiveTabPane && (o.value = !1);
- }, {
- immediate: !0
- });
- const l = H(() => e.active ? {} : e.animated ? {
- visibility: "hidden",
- height: 0,
- overflowY: "hidden"
- } : {
- display: "none"
- });
- return () => {
- var n;
- const {
- prefixCls: s,
- forceRender: v,
- id: d,
- active: p,
- tabKey: S
- } = e;
- return g("div", {
- id: d && `${d}-panel-${S}`,
- role: "tabpanel",
- tabindex: p ? 0 : -1,
- "aria-labelledby": d && `${d}-tab-${S}`,
- "aria-hidden": !p,
- style: [l.value, a.style],
- class: [`${s}-tabpane`, p && `${s}-tabpane-active`, a.class]
- }, [(p || o.value || v) && ((n = i.default) === null || n === void 0 ? void 0 : n.call(i))]);
- };
- }
- });
- Se.TabPane = ke;
- Se.install = function(e) {
- return e.component(Se.name, Se), e.component(ke.name, ke), e;
- };
- export {
- Se as T,
- ke as _
- };
|