mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-23 06:37:29 +08:00
Various fixes
This commit is contained in:
@@ -5,9 +5,6 @@ export default class FunctionReferenceEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
MemberParent: ObjectReferenceEntity,
|
||||
MemberName: ""
|
||||
MemberName: "",
|
||||
}
|
||||
|
||||
/** @type {ObjectReferenceEntity} */ MemberParent
|
||||
/** @type {String} */ MemberName
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import IEntity from "./IEntity"
|
||||
export default class GuidEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
value: String
|
||||
value: String,
|
||||
}
|
||||
|
||||
static generateGuid(random = true) {
|
||||
@@ -19,6 +19,10 @@ export default class GuidEntity extends IEntity {
|
||||
return new GuidEntity({ value: guid })
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class IEntity {
|
||||
const defineAllAttributes = (prefix, target, properties) => {
|
||||
let fullKey = prefix.concat("")
|
||||
const last = fullKey.length - 1
|
||||
for (let property in properties) {
|
||||
for (let property of Object.getOwnPropertyNames(properties)) {
|
||||
fullKey[last] = property
|
||||
// Not instanceof because all objects are instenceof Object, exact match needed
|
||||
if (properties[property]?.constructor === Object) {
|
||||
@@ -22,7 +22,7 @@ export default class IEntity {
|
||||
}
|
||||
/*
|
||||
* The value can either be:
|
||||
* - Array: can contain multiple values, its property is assigned multiple times like (X=1, X=4, X="Hello World")
|
||||
* - Array: can contain multiple values, its property is assigned multiple times like (X=1, X=4, X="Hello World").
|
||||
* - TypeInitialization: contains the maximum amount of information about the attribute.
|
||||
* - A type: the default value will be default constructed object without arguments.
|
||||
* - A proper value.
|
||||
@@ -35,6 +35,7 @@ export default class IEntity {
|
||||
let defaultValue = properties[property]
|
||||
if (defaultValue instanceof TypeInitialization) {
|
||||
if (!defaultValue.showDefault) {
|
||||
target[property] = undefined // to preserve the order
|
||||
continue
|
||||
}
|
||||
defaultValue = defaultValue.value
|
||||
|
||||
@@ -3,13 +3,13 @@ import IEntity from "./IEntity"
|
||||
export default class IntegerEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
value: Number
|
||||
value: Number,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
if (options.constructor === Number || options.constructor === String) {
|
||||
if (options.constructor == Number || options.constructor == String) {
|
||||
options = {
|
||||
value: options
|
||||
value: options,
|
||||
}
|
||||
}
|
||||
super(options)
|
||||
|
||||
@@ -6,6 +6,6 @@ export default class LocalizedTextEntity extends IEntity {
|
||||
static attributes = {
|
||||
namespace: String,
|
||||
key: String,
|
||||
value: String
|
||||
value: String,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ export default class ObjectEntity extends IEntity {
|
||||
NodeGuid: GuidEntity,
|
||||
ErrorType: new TypeInitialization(IntegerEntity, false),
|
||||
ErrorMsg: new TypeInitialization(String, false, ""),
|
||||
CustomProperties: [PinEntity]
|
||||
CustomProperties: [PinEntity],
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {String} The name of the node
|
||||
* @returns {String}
|
||||
*/
|
||||
getName() {
|
||||
return this.Name
|
||||
|
||||
@@ -4,6 +4,6 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
type: String,
|
||||
path: String
|
||||
path: String,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import IEntity from "./IEntity"
|
||||
export default class PathSymbolEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
value: String
|
||||
value: String,
|
||||
}
|
||||
|
||||
toString() {
|
||||
|
||||
@@ -71,13 +71,13 @@ export default class PinEntity extends IEntity {
|
||||
linkTo(targetObjectName, targetPinEntity) {
|
||||
/** @type {PinReferenceEntity[]} */
|
||||
this.LinkedTo
|
||||
const linkExists = this.LinkedTo.find(
|
||||
const linkFound = this.LinkedTo.find(
|
||||
/** @type {PinReferenceEntity} */
|
||||
pinReferenceEntity => {
|
||||
return pinReferenceEntity.objectName == targetObjectName
|
||||
&& pinReferenceEntity.pinGuid == targetPinEntity.PinId
|
||||
&& pinReferenceEntity.pinGuid.valueOf() == targetPinEntity.PinId.valueOf()
|
||||
})
|
||||
if (!linkExists) {
|
||||
if (!linkFound) {
|
||||
this.LinkedTo.push(new PinReferenceEntity({
|
||||
objectName: targetObjectName,
|
||||
pinGuid: targetPinEntity.PinId
|
||||
|
||||
@@ -6,6 +6,6 @@ export default class PinReferenceEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
objectName: PathSymbolEntity,
|
||||
pinGuid: GuidEntity
|
||||
pinGuid: GuidEntity,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ export default class VariableReferenceEntity extends IEntity {
|
||||
static attributes = {
|
||||
MemberName: String,
|
||||
MemberGuid: GuidEntity,
|
||||
bSelfContext: false
|
||||
bSelfContext: false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user