Item Support #69
1 changed files with 27 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
import { PlayerSheet } from "./PlayerSheet.mjs";
|
import { PlayerSheet } from "./PlayerSheet.mjs";
|
||||||
|
|
||||||
|
const { deepClone } = foundry.utils;
|
||||||
|
|
||||||
const removedParts = new Set([`content`, `tabs`]);
|
const removedParts = new Set([`content`, `tabs`]);
|
||||||
|
|
||||||
export class AttributeOnlyPlayerSheet extends PlayerSheet {
|
export class AttributeOnlyPlayerSheet extends PlayerSheet {
|
||||||
|
|
@ -16,8 +18,32 @@ export class AttributeOnlyPlayerSheet extends PlayerSheet {
|
||||||
delete parts.content;
|
delete parts.content;
|
||||||
return parts;
|
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
|
// #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
|
// #region Lifecycle
|
||||||
_configureRenderOptions(options) {
|
_configureRenderOptions(options) {
|
||||||
super._configureRenderOptions(options);
|
super._configureRenderOptions(options);
|
||||||
|
|
@ -30,7 +56,7 @@ export class AttributeOnlyPlayerSheet extends PlayerSheet {
|
||||||
// #region Data Prep
|
// #region Data Prep
|
||||||
async _prepareItems(ctx) {
|
async _prepareItems(ctx) {
|
||||||
await super._prepareItems(ctx);
|
await super._prepareItems(ctx);
|
||||||
ctx.tabActive = true;
|
ctx.tabActive &&= this.hasItemsTab;
|
||||||
};
|
};
|
||||||
// #endregion Data Prep
|
// #endregion Data Prep
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue