(tab: IEditorTab, groupId: UniqueId)
| 531 | } |
| 532 | |
| 533 | public closeToLeft(tab: IEditorTab, groupId: UniqueId) { |
| 534 | const groupIndex = this.getGroupIndexById(groupId); |
| 535 | if (groupIndex <= -1) return; |
| 536 | |
| 537 | const { groups = [] } = this.state; |
| 538 | const nextGroups = [...groups]; |
| 539 | const tabId = tab.id; |
| 540 | const nextGroup = nextGroups[groupIndex]; |
| 541 | const nextTabData = nextGroup.data; |
| 542 | |
| 543 | const tabIndex = nextTabData!.findIndex(searchById(tabId)); |
| 544 | if (tabIndex <= -1) return; |
| 545 | |
| 546 | const updateTabs = nextTabData?.slice(tabIndex, nextTabData.length); |
| 547 | const removedTabs = cloneDeep( |
| 548 | nextTabData?.slice(0, tabIndex).filter( |
| 549 | (item) => |
| 550 | !this.isOpened( |
| 551 | item.id!, |
| 552 | nextGroups.filter((g) => g.id !== groupId) |
| 553 | ) |
| 554 | ) |
| 555 | ); |
| 556 | |
| 557 | this.updateGroup(groupId, { |
| 558 | data: updateTabs, |
| 559 | }); |
| 560 | this.setActive(groupId, tabId!); |
| 561 | this.disposeModel(removedTabs || []); |
| 562 | this.explorerService.forceUpdate(); |
| 563 | } |
| 564 | |
| 565 | public getGroupById(groupId: UniqueId): IEditorGroup | undefined { |
| 566 | const { groups } = this.state; |
nothing calls this directly
no test coverage detected