mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
FIX: ForeignDocumentUUIDField initialize like a getter
FEAT: ForeignDocumentUUIDArrayField created and used
This commit is contained in:
parent
5463f71526
commit
d18141bb65
7 changed files with 32 additions and 20 deletions
21
module/data/fields/foreignDocumentUUIDArrayField.mjs
Normal file
21
module/data/fields/foreignDocumentUUIDArrayField.mjs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import ForeignDocumentUUIDField from "./foreignDocumentUUIDField.mjs";
|
||||
/**
|
||||
* A subclass of {@link foundry.data.fields.ArrayField} that defines an array of foreign document UUID references.
|
||||
*/
|
||||
export default class ForeignDocumentUUIDArrayField extends foundry.data.fields.ArrayField {
|
||||
/**
|
||||
* @param {foundry.data.types.DocumentUUIDFieldOptions} [fieldOption] - Options to configure each individual ForeignDocumentUUIDField.
|
||||
* @param {foundry.data.types.ArrayFieldOptions} [options] - Options to configure the array behavior
|
||||
* @param {foundry.data.types.DataFieldContext} [context] - Optional context for schema processing
|
||||
*/
|
||||
constructor(fieldOption = {}, options = {}, context = {}) {
|
||||
super(new ForeignDocumentUUIDField(fieldOption), options, context);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
initialize(value, model, options = {}) {
|
||||
const v = super.initialize(value, model, options);
|
||||
return () => v.map(entry => typeof entry === 'function' ? entry() : entry);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue