| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100 |
- import { b0 as Xe, bM as ft, w as ge, c as le, K as J, d as T, P as we, H as D, cJ as ht, cK as gt, cL as mt, cM as $t, cN as yt, av as j, cO as he, R as Fe, _ as te, e as me, F as xt, cs as je, g as _t, m as St, r as tt, t as Ct, cP as at, aN as Tt, o as wt, i as nt, E as Pt, bV as Rt, h as De, u as Et, c3 as It, L as Ve, ak as Bt, c2 as Lt, l as At, ay as xe, ax as Dt, aw as kt } 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 Mt, inject as Nt, toRefs as Ot } from "vue";
- import { u as Wt } from "./useRefs.js";
- import { e as ot, t as Ht, a as zt, b as Kt, h as Gt, f as Xt } from "./hasIn.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 = Ht(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]) ? [] : {});
- }
- zt(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 = Kt(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 Gt(e, i);
- });
- }
- var it = Xt(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 Zt = 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) => {
- [J.SPACE, J.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 Jt(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()
- }, Qt = 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) {
- [J.DOWN, J.SPACE, J.ENTER].includes(y) && (l(!0), c.preventDefault());
- return;
- }
- switch (y) {
- case J.UP:
- v(-1), c.preventDefault();
- break;
- case J.DOWN:
- v(1), c.preventDefault();
- break;
- case J.ESC:
- l(!1);
- break;
- case J.SPACE:
- case J.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: I
- } = 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,
- [`${I}`]: !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: (E) => {
- let {
- key: Q,
- domEvent: N
- } = E;
- $(Q, 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((E) => {
- var Q, N;
- const V = r && E.closable !== !1 && !E.disabled;
- return g(yt, {
- key: E.key,
- id: `${p.value}-${E.key}`,
- role: "option",
- "aria-controls": x && `${x}-panel-${E.key}`,
- disabled: E.disabled
- }, {
- default: () => [g("span", null, [typeof E.tab == "function" ? E.tab() : E.tab]), V && g("button", {
- type: "button",
- "aria-label": e.removeAriaLabel || "remove",
- tabindex: 0,
- class: `${R}-menu-item-remove`,
- onClick: (Y) => {
- Y.stopPropagation(), h(Y, E.key);
- }
- }, [((Q = E.closeIcon) === null || Q === void 0 ? void 0 : Q.call(E)) || ((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) => {
- Mt(rt, e);
- }, dt = () => Nt(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(Ot(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, Ze = 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, I = u - a.value.y;
- t($, I), i({
- x: m,
- y: u
- });
- const R = Date.now();
- s(R - o.value), l(R), d({
- x: $,
- y: I
- });
- }
- 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), I = Math.abs(u);
- if (Math.max($, I) < ea) return;
- let R = m, G = u;
- p.value = setInterval(() => {
- if (Math.abs(R) < Ue && Math.abs(G) < Ue) {
- clearInterval(p.value);
- return;
- }
- R *= Ze, G *= Ze, t(R * _e, G * _e);
- }, _e);
- }
- }
- const y = q();
- function x(r) {
- const {
- deltaX: m,
- deltaY: u
- } = r;
- let $ = 0;
- const I = Math.abs(m), R = Math.abs(u);
- I === R ? $ = y.value === "x" ? m : u : I > 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 Je(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];
- }, Qe = 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] = Wt(), h = H(() => e.tabPosition === "top" || e.tabPosition === "bottom"), [c, y] = Je(0, (f, b) => {
- h.value && e.onTabScroll && e.onTabScroll({
- direction: f > b ? "left" : "right"
- });
- }), [x, w] = Je(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), [I, R] = D(0), [G, re] = D(0), [se, ce] = Ut(/* @__PURE__ */ new Map()), E = Jt(o, se), Q = 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 = E.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 = E.value;
- ["top", "bottom"].includes(e.tabPosition) ? (f = "width", P = r.value, L = C.value, B = I.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 Z = F.length;
- let oe = Z;
- for (let X = 0; X < Z; 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 = Z - 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, Z, oe] = na(U, _);
- b.set(L, {
- width: O,
- height: F,
- left: Z,
- top: oe
- });
- }
- }), b;
- });
- };
- ie(() => o.value.map((f) => f.key).join("%%"), () => {
- Ne();
- }, {
- flush: "post"
- });
- const Ee = () => {
- 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, Z = O.offsetHeight || 0;
- m(B), $(U), R(F), re(Z);
- 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) - Z;
- k(oe), M(A), Ne();
- }, Oe = H(() => [...o.value.slice(0, Pe.value), ...o.value.slice(Re.value + 1)]), [ut, vt] = D(), ne = H(() => E.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, E, h], () => {
- de();
- }, {
- flush: "post"
- }), ie([() => e.rtl, () => e.tabBarGutter, () => e.activeKey, () => o.value], () => {
- Ee();
- }, {
- flush: "post"
- });
- const Ie = (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: Z,
- 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(Zt, {
- 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`, Z),
- style: oe,
- onKeydown: () => {
- be();
- }
- }, [g(Ie, {
- position: "left",
- prefixCls: A,
- extra: i.leftExtra
- }, null), g(Fe, {
- onResize: Ee
- }, {
- 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: Ee
- }, {
- 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(Qt, te(te({}, e), {}, {
- removeAriaLabel: B == null ? void 0 : B.removeAriaLabel,
- ref: v,
- prefixCls: A,
- tabs: Oe.value,
- class: !X && Q.value
- }), it(i, ["moreIcon"])), g(Ie, {
- position: "right",
- prefixCls: A,
- extra: i.rightExtra
- }, null), g(Ie, {
- 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: kt([Boolean, Object]),
- renderTabBar: j(),
- tabBarGutter: {
- type: Number
- },
- tabBarStyle: me(),
- tabPosition: xe(),
- destroyInactiveTabPane: Dt(),
- 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: At()
- }),
- 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
- } = Et("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(It());
- });
- 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((I) => I.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 I, R;
- (I = e.onTabClick) === null || I === void 0 || I.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: I,
- tabBarStyle: R,
- locale: G,
- destroyInactiveTabPane: re,
- renderTabBar: se = i.renderTabBar,
- onTabScroll: ce,
- hideAdd: E,
- centered: Q
- } = 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(Lt, null, null),
- addIcon: i.addIcon ? i.addIcon : () => g(Bt, null, null),
- showAdd: E !== !0
- });
- let Y;
- const ue = T(T({}, N), {
- moreTransitionName: `${s.value}-slide-up`,
- editable: V,
- locale: G,
- tabBarGutter: I,
- onTabClick: m,
- onTabScroll: ce,
- style: R,
- getPopupContainer: v.value,
- popupClassName: le(e.popupClassName, p.value)
- });
- se ? Y = se(T(T({}, ue), {
- DefaultTabBar: Qe
- })) : Y = g(Qe, 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`]: Q,
- [`${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 _
- };
|