From 841c0804b692a61b669089d25dd5c0e68541c3a8 Mon Sep 17 00:00:00 2001 From: Joaquin Pereyra Date: Sat, 31 May 2025 18:30:50 -0300 Subject: [PATCH] FIX: minor fixes --- module/data/fields/_module.mjs | 3 ++- module/data/fields/foreignDocumentUUIDField.mjs | 6 ++++-- system.json | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/data/fields/_module.mjs b/module/data/fields/_module.mjs index 4621ae2b..42c901fc 100644 --- a/module/data/fields/_module.mjs +++ b/module/data/fields/_module.mjs @@ -1 +1,2 @@ -export { default as FormulaField } from "./formulaField.mjs" \ No newline at end of file +export { default as FormulaField } from "./formulaField.mjs"; +export {default as ForeignDocumentUUIDField} from "./foreignDocumentUUIDField.mjs"; \ No newline at end of file diff --git a/module/data/fields/foreignDocumentUUIDField.mjs b/module/data/fields/foreignDocumentUUIDField.mjs index 69331d36..dc34769e 100644 --- a/module/data/fields/foreignDocumentUUIDField.mjs +++ b/module/data/fields/foreignDocumentUUIDField.mjs @@ -1,8 +1,9 @@ /** - * A class extending DocumentUUIDField to allow selecting a foreign document reference + * A subclass of {@link foundry.data.fields.DocumentUUIDField} to allow selecting a foreign document reference * that resolves to either the document, the index(for items in compenidums) or the UUID string. */ export default class ForeignDocumentUUIDField extends foundry.data.fields.DocumentUUIDField { + /** @inheritdoc */ static get _defaults() { return foundry.utils.mergeObject(super._defaults, { nullable: true, @@ -11,6 +12,7 @@ export default class ForeignDocumentUUIDField extends foundry.data.fields.Docume }); } + /**@override */ initialize(value, _model, _options = {}) { if (this.idOnly) return value; return () => { @@ -23,7 +25,7 @@ export default class ForeignDocumentUUIDField extends foundry.data.fields.Docume } }; } - + /**@override */ toObject(value) { return value?.uuid ?? value; } diff --git a/system.json b/system.json index caf87c5c..6a440c1e 100644 --- a/system.json +++ b/system.json @@ -438,7 +438,6 @@ "documentTypes": { "Actor": { "pc": {}, - "npc": {}, "adversary": {}, "environment": {} },