diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-05-19 22:54:10 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-19 22:54:10 -0300 |
commit | 83911a3abab88aef7548d95c769eced5d2af821a (patch) | |
tree | 50c63e8e86e20cacc60b1113bb34573ed14e5815 /src/data/composite/wiki-properties | |
parent | 0f12714a6d4e89c3665093ba6be2676ef122a06c (diff) |
data: referenceList: 'referenceType' input
Diffstat (limited to 'src/data/composite/wiki-properties')
-rw-r--r-- | src/data/composite/wiki-properties/referenceList.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/data/composite/wiki-properties/referenceList.js b/src/data/composite/wiki-properties/referenceList.js index af634a68..ebd5947c 100644 --- a/src/data/composite/wiki-properties/referenceList.js +++ b/src/data/composite/wiki-properties/referenceList.js @@ -1,5 +1,6 @@ // Stores and exposes a list of references to other data objects; all items -// must be references to the same type, which is specified on the class input. +// must be references to the same type, which is either implied from the class +// input, or explicitly set on the referenceType input. // // See also: // - singleReference @@ -18,7 +19,17 @@ export default templateCompositeFrom({ compose: false, inputs: { - class: input.staticValue({validate: isThingClass}), + class: input.staticValue({ + validate: isThingClass, + acceptsNull: true, + defaultValue: null, + }), + + referenceType: input.staticValue({ + type: 'string', + acceptsNull: true, + defaultValue: null, + }), data: inputWikiData({allowMixedTypes: false}), @@ -27,10 +38,13 @@ export default templateCompositeFrom({ update: ({ [input.staticValue('class')]: thingClass, + [input.staticValue('referenceType')]: referenceType, }) => ({ validate: validateReferenceList( - thingClass[Symbol.for('Thing.referenceType')]), + (thingClass + ? thingClass[Symbol.for('Thing.referenceType')] + : referenceType)), }), steps: () => [ |