REFACTOR: remove unused methods

REFACTOR: create method on BaseActorSheet
REFACTOR: make Datamodel metadata getter
This commit is contained in:
Joaquin Pereyra 2025-07-07 01:41:05 -03:00
parent 72e6bf055c
commit 79a4c13a1b
12 changed files with 103 additions and 75 deletions

View file

@ -2,6 +2,8 @@ import DHApplicationMixin from './application-mixin.mjs';
const { ActorSheetV2 } = foundry.applications.sheets;
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
/**
* A base actor sheet extending {@link ActorSheetV2} via {@link DHApplicationMixin}
* @extends ActorSheetV2
@ -17,14 +19,36 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
form: {
submitOnChange: true
},
actions: {},
dragDrop: []
actions: {
openSettings: DHBaseActorSheet.#openSettings
},
dragDrop: [],
};
/**
*
*/
#settingSheet;
get settingSheet() {
const SheetClass = this.document.system.metadata.settingSheet;
return this.#settingSheet ??= SheetClass ? new SheetClass(this.document): null;
}
/**@inheritdoc */
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.isNPC = this.document.isNPC;
return context;
}
/**
*
* @type {ApplicationClickAction}
*/
static async #openSettings() {
await this.settingSheet.render({ force: true });
}
}