forked from fanruan/fineui
Browse Source
Merge in VISUAL/fineui from ~TREECAT/fineui:master to master * commit '7bbc4297604cb50d0ebf860693ff4bfd0e165c62': BI-138908 fix:nextTickresearch/test
treecat-罗群
12 months ago
5 changed files with 124 additions and 136 deletions
@ -1,76 +1,78 @@ |
|||||||
import { registFunction } from "./plugins"; |
import { registFunction } from "./plugins"; |
||||||
import { isWidget, isString } from "../2.base"; |
import { isWidget, isString } from "../2.base"; |
||||||
|
|
||||||
export function Element(widget, attribs) { |
export let Element = class { |
||||||
this.l = this.r = this.t = this.b = 0; // 边框
|
constructor(widget, attribs) { |
||||||
this.marginLeft = this.marginRight = this.marginTop = this.marginBottom = 0; // 间距
|
this.l = this.r = this.t = this.b = 0; // 边框
|
||||||
this.position = {}; |
this.marginLeft = this.marginRight = this.marginTop = this.marginBottom = 0; // 间距
|
||||||
this.classMap = {}; |
this.position = {}; |
||||||
this.classList = []; |
this.classMap = {}; |
||||||
this.children = []; |
this.classList = []; |
||||||
this.attribs = attribs || {}; |
this.children = []; |
||||||
this.styles = {}; |
this.attribs = attribs || {}; |
||||||
// 兼容处理
|
this.styles = {}; |
||||||
this["0"] = this; |
// 兼容处理
|
||||||
this.style = {}; |
this["0"] = this; |
||||||
if (!widget) { |
this.style = {}; |
||||||
this.nodeName = "body"; |
if (!widget) { |
||||||
this.position.x = 0; |
this.nodeName = "body"; |
||||||
this.position.y = 0; |
this.position.x = 0; |
||||||
this.attribs.id = "body"; |
this.position.y = 0; |
||||||
} else if (isWidget(widget)) { |
this.attribs.id = "body"; |
||||||
this.widget = widget; |
} else if (isWidget(widget)) { |
||||||
this.nodeName = widget.options.tagName; |
this.widget = widget; |
||||||
this.textBaseLine = widget.options.textBaseLine; |
this.nodeName = widget.options.tagName; |
||||||
} else if (isString(widget)) { |
this.textBaseLine = widget.options.textBaseLine; |
||||||
this.nodeName = widget; |
} else if (isString(widget)) { |
||||||
|
this.nodeName = widget; |
||||||
|
} |
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
initElement(Element); |
appendChild(child) { |
||||||
registFunction(Element); |
child.parent = this; |
||||||
|
if (this.children.push(child) !== 1) { |
||||||
|
const sibling = this.children[this.children.length - 2]; |
||||||
|
sibling.next = child; |
||||||
|
child.prev = sibling; |
||||||
|
child.next = null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
append(child) { |
||||||
|
child.parent = this; |
||||||
|
if (this.children.push(child) !== 1) { |
||||||
|
const sibling = this.children[this.children.length - 2]; |
||||||
|
sibling.next = child; |
||||||
|
child.prev = sibling; |
||||||
|
child.next = null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
getParent() { |
||||||
|
return this.parent; |
||||||
|
} |
||||||
|
|
||||||
function initElement(element) { |
getSiblings() { |
||||||
element.prototype = { |
const parent = this.getParent(); |
||||||
appendChild(child) { |
|
||||||
child.parent = this; |
|
||||||
if (this.children.push(child) !== 1) { |
|
||||||
const sibling = this.children[this.children.length - 2]; |
|
||||||
sibling.next = child; |
|
||||||
child.prev = sibling; |
|
||||||
child.next = null; |
|
||||||
} |
|
||||||
}, |
|
||||||
append(child) { |
|
||||||
child.parent = this; |
|
||||||
if (this.children.push(child) !== 1) { |
|
||||||
const sibling = this.children[this.children.length - 2]; |
|
||||||
sibling.next = child; |
|
||||||
child.prev = sibling; |
|
||||||
child.next = null; |
|
||||||
} |
|
||||||
}, |
|
||||||
getParent() { |
|
||||||
return this.parent; |
|
||||||
}, |
|
||||||
getSiblings() { |
|
||||||
const parent = this.getParent(); |
|
||||||
|
|
||||||
return parent ? parent.getChildren() : [this]; |
return parent ? parent.getChildren() : [this]; |
||||||
}, |
} |
||||||
getChildren() { |
|
||||||
return this.children; |
getChildren() { |
||||||
}, |
return this.children; |
||||||
|
} |
||||||
|
|
||||||
getBounds() { |
getBounds() { |
||||||
return {}; |
return {}; |
||||||
}, |
} |
||||||
|
|
||||||
width() { |
width() {} |
||||||
|
|
||||||
}, |
height() {} |
||||||
height() { |
} |
||||||
|
|
||||||
|
registFunction(Element); |
||||||
|
|
||||||
}, |
export function setElement(element) { |
||||||
}; |
Element = element; |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue