mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 12:11:07 +01:00
FIX: CONFIG types
This commit is contained in:
parent
88bf26dad0
commit
27777dddba
7 changed files with 77 additions and 30 deletions
|
|
@ -4,13 +4,13 @@ import SheetManagementMixin from './sheetManagementMixin.mjs';
|
|||
/** @extends BasePseudoDocument */
|
||||
export default class PseudoDocument extends SheetManagementMixin(BasePseudoDocument) {
|
||||
static get TYPES() {
|
||||
return (this._TYPES ??= Object.freeze(CONFIG.daggerheart.pseudoDocuments[this.metadata.name]));
|
||||
const { types } = CONFIG.daggerheart.pseudoDocuments[this.metadata.name];
|
||||
const typeEntries = Object.entries(types).map(([key, { documentClass }]) => [key, documentClass]);
|
||||
return (this._TYPES ??= Object.freeze(Object.fromEntries(typeEntries)));
|
||||
}
|
||||
|
||||
static _TYPES;
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* The type of this shape.
|
||||
* @type {string}
|
||||
|
|
@ -19,6 +19,17 @@ export default class PseudoDocument extends SheetManagementMixin(BasePseudoDocum
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static getTypesChoices(validTypes) {
|
||||
const { types } = CONFIG.daggerheart.pseudoDocuments[model.metadata.name];
|
||||
const typeEntries = Object.entries(types)
|
||||
.map(([key, { label }]) => [key, label])
|
||||
.filter(([key]) => !validTypes || validTypes.includes(key));
|
||||
|
||||
return Object.entries(typeEntries);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
static defineSchema() {
|
||||
const { fields } = foundry.data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue