mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-24 16:04:44 +08:00
Circular dependecy break
This commit is contained in:
97
dist/ueblueprint.js
vendored
97
dist/ueblueprint.js
vendored
File diff suppressed because one or more lines are too long
@@ -6,9 +6,7 @@ import Select from "./input/Select"
|
|||||||
import Utility from "./Utility"
|
import Utility from "./Utility"
|
||||||
import Zoom from "./input/Zoom"
|
import Zoom from "./input/Zoom"
|
||||||
|
|
||||||
/**
|
/** @typedef {import("./graph/GraphNode").default} GraphNode */
|
||||||
* @typedef {import("./graph/GraphNode").default} GraphNode
|
|
||||||
*/
|
|
||||||
export default class Blueprint extends GraphEntity {
|
export default class Blueprint extends GraphEntity {
|
||||||
|
|
||||||
insertChildren() {
|
insertChildren() {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import Integer from "./entity/primitive/Integer"
|
|
||||||
import TypeInitialization from "./entity/TypeInitialization"
|
import TypeInitialization from "./entity/TypeInitialization"
|
||||||
|
|
||||||
export default class Utility {
|
export default class Utility {
|
||||||
@@ -55,23 +54,9 @@ export default class Utility {
|
|||||||
return Utility.objectGet(source[keys[0]], keys.slice(1), defaultValue)
|
return Utility.objectGet(source[keys[0]], keys.slice(1), defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static sanitize(value) {
|
|
||||||
if (!(value instanceof Object)) {
|
|
||||||
return value // Is already primitive
|
|
||||||
}
|
|
||||||
if (value instanceof Boolean || value instanceof Integer || value instanceof Number) {
|
|
||||||
return value.valueOf()
|
|
||||||
}
|
|
||||||
if (value instanceof String) {
|
|
||||||
return value.toString()
|
|
||||||
}
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
static equals(a, b) {
|
static equals(a, b) {
|
||||||
a = Utility.sanitize(a)
|
a = TypeInitialization.sanitize(a)
|
||||||
b = Utility.sanitize(b)
|
b = TypeInitialization.sanitize(b)
|
||||||
return a === b
|
return a === b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default class Entity {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (defaultValue instanceof Function) {
|
if (defaultValue instanceof Function) {
|
||||||
defaultValue = Utility.sanitize(new defaultValue())
|
defaultValue = TypeInitialization.sanitize(new defaultValue())
|
||||||
}
|
}
|
||||||
target[property] = defaultValue
|
target[property] = defaultValue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,20 @@
|
|||||||
import Utility from "../Utility"
|
import Integer from "./primitive/Integer"
|
||||||
|
|
||||||
export default class TypeInitialization {
|
export default class TypeInitialization {
|
||||||
|
|
||||||
|
static sanitize(value) {
|
||||||
|
if (!(value instanceof Object)) {
|
||||||
|
return value // Is already primitive
|
||||||
|
}
|
||||||
|
if (value instanceof Boolean || value instanceof Integer || value instanceof Number) {
|
||||||
|
return value.valueOf()
|
||||||
|
}
|
||||||
|
if (value instanceof String) {
|
||||||
|
return value.toString()
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {typeof Object} type
|
* @param {typeof Object} type
|
||||||
@@ -10,7 +23,7 @@ export default class TypeInitialization {
|
|||||||
*/
|
*/
|
||||||
constructor(type, showDefault = true, value = undefined) {
|
constructor(type, showDefault = true, value = undefined) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
value = Utility.sanitize(new type())
|
value = TypeInitialization.sanitize(new type())
|
||||||
}
|
}
|
||||||
this.value = value
|
this.value = value
|
||||||
this.showDefault = showDefault
|
this.showDefault = showDefault
|
||||||
|
|||||||
Reference in New Issue
Block a user