forked from fanruan/fineui
Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
treecat-罗群 | 0ed3e845b1 | 1 year ago |
Treecat | 3995479d53 | 1 year ago |
Treecat | f85867bb66 | 1 year ago |
Jimmy.Chai-柴嘉明 | f4f58e24e0 | 1 year ago |
jimmychai | 6c62a7c695 | 1 year ago |
Jimmy.Chai-柴嘉明 | c057e5cd2c | 1 year ago |
jimmychai | c5dfb11f1f | 1 year ago |
Kobi-蒋科斌 | 0143741ef5 | 1 year ago |
Kobi | 2b50b02d79 | 1 year ago |
Kobi | 3b4ffbbe45 | 1 year ago |
Treecat | ba1e19280c | 2 years ago |
195 changed files with 1820 additions and 5130 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 898 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,78 +1,76 @@
|
||||
import { registFunction } from "./plugins"; |
||||
import { isWidget, isString } from "../2.base"; |
||||
|
||||
export let Element = class { |
||||
constructor(widget, attribs) { |
||||
this.l = this.r = this.t = this.b = 0; // 边框
|
||||
this.marginLeft = this.marginRight = this.marginTop = this.marginBottom = 0; // 间距
|
||||
this.position = {}; |
||||
this.classMap = {}; |
||||
this.classList = []; |
||||
this.children = []; |
||||
this.attribs = attribs || {}; |
||||
this.styles = {}; |
||||
// 兼容处理
|
||||
this["0"] = this; |
||||
this.style = {}; |
||||
if (!widget) { |
||||
this.nodeName = "body"; |
||||
this.position.x = 0; |
||||
this.position.y = 0; |
||||
this.attribs.id = "body"; |
||||
} else if (isWidget(widget)) { |
||||
this.widget = widget; |
||||
this.nodeName = widget.options.tagName; |
||||
this.textBaseLine = widget.options.textBaseLine; |
||||
} else if (isString(widget)) { |
||||
this.nodeName = widget; |
||||
} |
||||
export function Element(widget, attribs) { |
||||
this.l = this.r = this.t = this.b = 0; // 边框
|
||||
this.marginLeft = this.marginRight = this.marginTop = this.marginBottom = 0; // 间距
|
||||
this.position = {}; |
||||
this.classMap = {}; |
||||
this.classList = []; |
||||
this.children = []; |
||||
this.attribs = attribs || {}; |
||||
this.styles = {}; |
||||
// 兼容处理
|
||||
this["0"] = this; |
||||
this.style = {}; |
||||
if (!widget) { |
||||
this.nodeName = "body"; |
||||
this.position.x = 0; |
||||
this.position.y = 0; |
||||
this.attribs.id = "body"; |
||||
} else if (isWidget(widget)) { |
||||
this.widget = widget; |
||||
this.nodeName = widget.options.tagName; |
||||
this.textBaseLine = widget.options.textBaseLine; |
||||
} else if (isString(widget)) { |
||||
this.nodeName = widget; |
||||
} |
||||
} |
||||
|
||||
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]; |
||||
} |
||||
initElement(Element); |
||||
registFunction(Element); |
||||
|
||||
getChildren() { |
||||
return this.children; |
||||
} |
||||
function initElement(element) { |
||||
element.prototype = { |
||||
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(); |
||||
|
||||
getBounds() { |
||||
return {}; |
||||
} |
||||
return parent ? parent.getChildren() : [this]; |
||||
}, |
||||
getChildren() { |
||||
return this.children; |
||||
}, |
||||
|
||||
width() {} |
||||
getBounds() { |
||||
return {}; |
||||
}, |
||||
|
||||
height() {} |
||||
} |
||||
width() { |
||||
|
||||
registFunction(Element); |
||||
}, |
||||
height() { |
||||
|
||||
export function setElement(element) { |
||||
Element = element; |
||||
}, |
||||
}; |
||||
} |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue