forked from fanruan/fineui
Browse Source
* commit '3621aa034c314fc9cd484e73d7b431a741298053': 无JIRA任务 更新图标 BI-138908 fix:nextTick 无jira chore: console.log BI-137647 fix:单选颜色 无jira fix:bind BI-139664 fix:滑块组件 BI-139664 fix:滑块组件 BI-139664 fix:滑块组件research/test
superman
1 year ago
13 changed files with 146 additions and 143 deletions
Binary file not shown.
Before Width: | Height: | Size: 996 KiB After Width: | Height: | Size: 1001 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,76 +1,78 @@
|
||||
import { registFunction } from "./plugins"; |
||||
import { isWidget, isString } from "../2.base"; |
||||
|
||||
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; |
||||
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; |
||||
} |
||||
} |
||||
} |
||||
|
||||
initElement(Element); |
||||
registFunction(Element); |
||||
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; |
||||
} |
||||
} |
||||
|
||||
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(); |
||||
|
||||
return parent ? parent.getChildren() : [this]; |
||||
}, |
||||
getChildren() { |
||||
return this.children; |
||||
}, |
||||
getParent() { |
||||
return this.parent; |
||||
} |
||||
|
||||
getBounds() { |
||||
return {}; |
||||
}, |
||||
getSiblings() { |
||||
const parent = this.getParent(); |
||||
|
||||
width() { |
||||
return parent ? parent.getChildren() : [this]; |
||||
} |
||||
|
||||
}, |
||||
height() { |
||||
getChildren() { |
||||
return this.children; |
||||
} |
||||
|
||||
getBounds() { |
||||
return {}; |
||||
} |
||||
|
||||
width() {} |
||||
|
||||
height() {} |
||||
} |
||||
|
||||
registFunction(Element); |
||||
|
||||
}, |
||||
}; |
||||
export function setElement(element) { |
||||
Element = element; |
||||
} |
||||
|
Loading…
Reference in new issue