Indexed array entity, user defined pins

This commit is contained in:
barsdeveloper
2023-04-04 22:52:42 +02:00
parent 3e2a20302f
commit 7d84062ff6
8 changed files with 151 additions and 45 deletions

17
js/entity/IndexedArray.js Normal file
View File

@@ -0,0 +1,17 @@
/** @typedef {import("./IEntity").AnyValueConstructor<*>} AnyValueConstructor */
export default class IndexedArray {
#type
get type() {
return this.#type
}
value = []
/** @param {AnyValueConstructor} type */
constructor(type, value = []) {
this.#type = type
this.value = value
}
}

View File

@@ -10,6 +10,8 @@ import ObjectReferenceEntity from "./ObjectReferenceEntity.js"
import PinEntity from "./PinEntity.js"
import SVGIcon from "../SVGIcon.js"
import SymbolEntity from "./SymbolEntity.js"
import UnionType from "./UnionType.js"
import UserDefinedPinEntity from "./UserDefinedPinEntity.js"
import Utility from "../Utility.js"
import VariableReferenceEntity from "./VariableReferenceEntity.js"
@@ -196,7 +198,7 @@ export default class ObjectEntity extends IEntity {
showDefault: false,
},
CustomProperties: {
type: [PinEntity]
type: [new UnionType(PinEntity, UserDefinedPinEntity)]
},
}

View File

@@ -0,0 +1,9 @@
import IEntity from "./IEntity.js"
import PinEntity from "./PinEntity.js"
/** @typedef {import("./IEntity.js").AnyValue} AnyValue */
export default class UserDefinedPinEntity extends IEntity {
static lookbehind = "UserDefinedPin"
}