feat(tabs): add close tabs to the left action
This commit is contained in:
1 parent
40a806a24a
commit
662037295c
11 files changed
+67
No files matched your search
@@ -2858,6 +2858,22 @@ export const useQueryStore = defineStore("query", () => {
|
||||
);
|
||||
}
|
||||
|
||||
function closeLeftTabs(id: string, onComplete?: () => void) {
|
||||
const target = tabs.value.find((tab) => tab.id === id);
|
||||
if (!target) return;
|
||||
|
||||
const groupedTabs = tabs.value.filter((tab) => Boolean(tab.pinned) === Boolean(target.pinned));
|
||||
const targetIndex = groupedTabs.findIndex((tab) => tab.id === id);
|
||||
const ids = groupedTabs.slice(0, targetIndex).map((tab) => tab.id);
|
||||
if (ids.length === 0) {
|
||||
onComplete?.();
|
||||
return;
|
||||
}
|
||||
|
||||
const finalActiveTabId = activeTabId.value && !ids.includes(activeTabId.value) ? activeTabId.value : id;
|
||||
beginBatchClose(ids, finalActiveTabId, onComplete);
|
||||
}
|
||||
|
||||
function closeRightTabs(id: string, onComplete?: () => void) {
|
||||
const target = tabs.value.find((tab) => tab.id === id);
|
||||
if (!target) return;
|
||||
@@ -6813,6 +6829,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
discardTabChanges,
|
||||
requestAppCloseConfirmation,
|
||||
closeOtherTabs,
|
||||
closeLeftTabs,
|
||||
closeRightTabs,
|
||||
closeOtherRegularTabs,
|
||||
closeRegularTabs,
|
||||
|
||||
Reference in new issue
Block a user