Files
aiot-platform-ui/apps/web-antd/dist/js/tabbar-B8FD2KS1.js

2 lines
7.3 KiB
JavaScript
Raw Normal View History

2026-03-09 13:05:46 +08:00
var C=Object.defineProperty,I=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var u=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var y=(e,t,s)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,d=(e,t)=>{for(var s in t||(t={}))x.call(t,s)&&y(e,s,t[s]);if(u)for(var s of u(t))w.call(t,s)&&y(e,s,t[s]);return e},m=(e,t)=>I(e,k(t));var g=(e,t)=>{var s={};for(var a in e)x.call(e,a)&&t.indexOf(a)<0&&(s[a]=e[a]);if(e!=null&&u)for(var a of u(e))t.indexOf(a)<0&&w.call(e,a)&&(s[a]=e[a]);return s};var f=(e,t,s)=>new Promise((a,i)=>{var n=h=>{try{o(s.next(h))}catch(p){i(p)}},c=h=>{try{o(s.throw(h))}catch(p){i(p)}},o=h=>h.done?a(h.value):Promise.resolve(h.value).then(n,c);o((s=s.apply(e,t)).next())});import{cI as K,cJ as _,d5 as R,bX as B,R as S}from"../jse/index-index-CMeVxoEG.js";import{b_ as v}from"./bootstrap-CRjSNGHY.js";const q=v("core-tabbar",{actions:{_bulkCloseByKeys(e){return f(this,null,function*(){const t=new Set(e);this.tabs=this.tabs.filter(s=>!t.has(r(s))),yield this.updateCacheTabs()})},_close(e){if(b(e))return;const t=this.tabs.findIndex(s=>T(s,e));t!==-1&&this.tabs.splice(t,1)},_goToDefaultTab(e){return f(this,null,function*(){if(this.getTabs.length<=0)return;const t=this.getTabs[0];t&&(yield this._goToTab(t,e))})},_goToTab(e,t){return f(this,null,function*(){const{params:s,path:a,query:i}=e,n={params:s||{},path:a,query:i||{}};yield t.replace(n)})},addTab(e){var a,i;let t=A(e);if(t.key||(t.key=l(e)),!O(t))return t;const s=this.tabs.findIndex(n=>T(n,t));if(s===-1){const n=B.tabbar.maxCount,c=(i=(a=e==null?void 0:e.meta)==null?void 0:a.maxNumOfOpenTab)!=null?i:-1;if(c>0&&this.tabs.filter(o=>o.name===e.name).length>=c){const o=this.tabs.findIndex(h=>h.name===e.name);o!==-1&&this.tabs.splice(o,1)}else if(n>0&&this.tabs.length>=n){const o=this.tabs.findIndex(h=>!Reflect.has(h.meta,"affixTab")||!h.meta.affixTab);o!==-1&&this.tabs.splice(o,1)}this.tabs.push(t)}else{const n=S(this.tabs)[s],c=m(d(d({},n),t),{meta:d(d({},n==null?void 0:n.meta),t.meta)});if(n){const o=n.meta;Reflect.has(o,"affixTab")&&(c.meta.affixTab=o.affixTab),Reflect.has(o,"newTabTitle")&&(c.meta.newTabTitle=o.newTabTitle)}t=c,this.tabs.splice(s,1,c)}return this.updateCacheTabs(),t},closeAllTabs(e){return f(this,null,function*(){const t=this.tabs.filter(s=>b(s));this.tabs=t.length>0?t:[...this.tabs].splice(0,1),yield this._goToDefaultTab(e),this.updateCacheTabs()})},closeLeftTabs(e){return f(this,null,function*(){const t=this.tabs.findIndex(i=>T(i,e));if(t<1)return;const s=this.tabs.slice(0,t),a=[];for(const i of s)b(i)||a.push(i.key);yield this._bulkCloseByKeys(a)})},closeOtherTabs(e){return f(this,null,function*(){const t=this.tabs.map(a=>r(a)),s=[];for(const a of t)if(a!==r(e)){const i=this.tabs.find(n=>r(n)===a);if(!i)continue;b(i)||s.push(i.key)}yield this._bulkCloseByKeys(s)})},closeRightTabs(e){return f(this,null,function*(){const t=this.tabs.findIndex(s=>T(s,e));if(t!==-1&&t<this.tabs.length-1){const s=this.tabs.slice(t+1),a=[];for(const i of s)b(i)||a.push(i.key);yield this._bulkCloseByKeys(a)}})},closeTab(e,t){return f(this,null,function*(){const{currentRoute:s}=t;if(l(s.value)!==r(e)){this._close(e),this.updateCacheTabs();return}const a=this.getTabs.findIndex(c=>r(c)===l(s.value)),i=this.getTabs[a-1],n=this.getTabs[a+1];n?(this._close(e),yield this._goToTab(n,t)):i?(this._close(e),yield this._goToTab(i,t)):console.error("Failed to close the tab; only one tab remains open.")})},closeTabByKey(e,t){return f(this,null,function*(){const s=decodeURIComponent(e),a=this.tabs.findIndex(n=>r(n)===s);if(a===-1)return;const i=this.tabs[a];i&&(yield this.closeTab(i,t))})},getTabByKey(e){return this.getTabs.find(t=>r(t)===e)},openTabInNewWindow(e){return f(this,null,function*(){R(e.fullPath||e.path)})},pinTab(e){return f(this,null,function*(){var n;const t=this.tabs.findIndex(c=>T(c,e));if(t===-1)return;const s=this.tabs[t];e.meta.affixTab=!0,e.meta.title=(n=s==null?void 0:s.meta)==null?void 0:n.title,this.tabs.splice(t,1,e);const i=this.tabs.filter(c=>b(c)).fi