Enable the item tab hiding on the Attribute-only actor sheet

This commit is contained in:
Oliver 2026-04-12 18:07:46 -06:00
parent 76f5a4f27a
commit e128f2a828

View file

@ -1,5 +1,7 @@
import { PlayerSheet } from "./PlayerSheet.mjs";
const { deepClone } = foundry.utils;
const removedParts = new Set([`content`, `tabs`]);
export class AttributeOnlyPlayerSheet extends PlayerSheet {
@ -16,8 +18,32 @@ export class AttributeOnlyPlayerSheet extends PlayerSheet {
delete parts.content;
return parts;
};
static get TABS() {
const tabs = deepClone(super.TABS);
tabs.primary.tabs = tabs.primary.tabs
.filter(tab => tab.id !== `content`);
tabs.primary.initial = tabs.primary.tabs.at(0).id;
return tabs;
};
// #endregion Options
// #region Instance Data
/**
* This method is used in order to ensure that when we hide specific
* tabs due to programmatic logic (e.g. having no items), that the tab
* doesn't stay selected in the app if the logic for it being visible
* no longer holds true.
*/
_assertSelectedTabs() {
// Intention No-Op Function
};
get hasContentTab() {
return false;
};
// #endregion Instance Data
// #region Lifecycle
_configureRenderOptions(options) {
super._configureRenderOptions(options);
@ -30,7 +56,7 @@ export class AttributeOnlyPlayerSheet extends PlayerSheet {
// #region Data Prep
async _prepareItems(ctx) {
await super._prepareItems(ctx);
ctx.tabActive = true;
ctx.tabActive &&= this.hasItemsTab;
};
// #endregion Data Prep
};