Item Support #69

Merged
Oliver merged 50 commits from feature/item-support into main 2026-04-15 02:42:54 +00:00
Showing only changes of commit e128f2a828 - Show all commits

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
};