📄 sync.arraycontainer.js
字号:
} this.containerElement.removeChild(childElement); delete this._childIdToElementMap[child.renderId]; }, /** @see Echo.Render.ComponentSync#renderUpdate */ renderUpdate: function(update) { var i, fullRender = false; if (update.hasUpdatedProperties() || update.hasUpdatedLayoutDataChildren()) { // Full render fullRender = true; } else { var removedChildren = update.getRemovedChildren(); if (removedChildren) { // Remove children. for (i = 0; i < removedChildren.length; ++i) { this._renderRemoveChild(update, removedChildren[i]); } } var addedChildren = update.getAddedChildren(); if (addedChildren) { // Add children. for (i = 0; i < addedChildren.length; ++i) { this._renderAddChild(update, addedChildren[i], this.component.indexOf(addedChildren[i])); } } } if (fullRender) { var element = this.element; var containerElement = element.parentNode; Echo.Render.renderComponentDispose(update, update.parent); containerElement.removeChild(element); this.renderAdd(update, containerElement); } return fullRender; }});/** * Component rendering peer: Column */Echo.Sync.Column = Core.extend(Echo.Sync.ArrayContainer, { $load: function() { Echo.Render.registerPeer("Column", this); }, /** @see Echo.Render.ComponentSync#cellElementNodeName */ cellElementNodeName: "div", /** @see Echo.Sync.ArrayContainer#prevFocusKey */ prevFocusKey: 38, /** @see Echo.Sync.ArrayContainer#prevFocusFlag */ prevFocusFlag: Echo.Render.ComponentSync.FOCUS_PERMIT_ARROW_UP, /** @see Echo.Sync.ArrayContainer#nextFocusKey */ nextFocusKey: 40, /** @see Echo.Sync.ArrayContainer#nextFocusFlag */ nextFocusFlag: Echo.Render.ComponentSync.FOCUS_PERMIT_ARROW_DOWN, /** @see Echo.Render.ComponentSync#renderAdd */ renderAdd: function(update, parentElement) { this.element = this.containerElement = document.createElement("div"); this.element.id = this.component.renderId; this.element.style.outlineStyle = "none"; this.element.tabIndex = "-1"; Echo.Sync.renderComponentDefaults(this.component, this.element); Echo.Sync.Border.render(this.component.render("border"), this.element); Echo.Sync.Insets.render(this.component.render("insets"), this.element, "padding"); this.cellSpacing = Echo.Sync.Extent.toPixels(this.component.render("cellSpacing"), false); if (this.cellSpacing) { this.spacingPrototype = document.createElement("div"); this.spacingPrototype.style.height = this.cellSpacing + "px"; this.spacingPrototype.style.fontSize = "1px"; this.spacingPrototype.style.lineHeight = "0"; } this.renderAddChildren(update); parentElement.appendChild(this.element); }, /** @see Echo.Sync.ArrayContainer#renderChildLayoutData */ renderChildLayoutData: function(child, cellElement) { var layoutData = child.render("layoutData"); if (layoutData) { Echo.Sync.Color.render(layoutData.background, cellElement, "backgroundColor"); Echo.Sync.FillImage.render(layoutData.backgroundImage, cellElement); Echo.Sync.Insets.render(layoutData.insets, cellElement, "padding"); Echo.Sync.Alignment.render(layoutData.alignment, cellElement, true, this.component); if (layoutData.height) { cellElement.style.height = Echo.Sync.Extent.toPixels(layoutData.height, false) + "px"; } } }});/** * Component rendering peer: Row */Echo.Sync.Row = Core.extend(Echo.Sync.ArrayContainer, { $static: { /** * Creates a prototype DOM element hierarchy to be cloned when rendering. * * @return the prototype Element * @type Element */ _createRowPrototype: function() { var div = document.createElement("div"); div.style.outlineStyle = "none"; div.style.overflow = "hidden"; div.tabIndex = "-1"; var table = document.createElement("table"); table.style.borderCollapse = "collapse"; div.appendChild(table); var tbody = document.createElement("tbody"); table.appendChild(tbody); tbody.appendChild(document.createElement("tr")); return div; }, /** * The prototype DOM element hierarchy to be cloned when rendering. * @type Element */ _rowPrototype: null }, $load: function() { this._rowPrototype = this._createRowPrototype(); Echo.Render.registerPeer("Row", this); }, /** @see Echo.Render.ComponentSync#cellElementNodeName */ cellElementNodeName: "td", /** @see Echo.Sync.ArrayContainer#prevFocusKey */ prevFocusKey: 37, /** @see Echo.Sync.ArrayContainer#prevFocusFlag */ prevFocusFlag: Echo.Render.ComponentSync.FOCUS_PERMIT_ARROW_LEFT, /** @see Echo.Sync.ArrayContainer#nextFocusKey */ nextFocusKey: 39, /** @see Echo.Sync.ArrayContainer#nextFocusFlag */ nextFocusFlag: Echo.Render.ComponentSync.FOCUS_PERMIT_ARROW_RIGHT, /** @see Echo.Sync.ArrayContainer#invertFocusRtl */ invertFocusRtl: true, /** @see Echo.Render.ComponentSync#renderAdd */ renderAdd: function(update, parentElement) { this.element = Echo.Sync.Row._rowPrototype.cloneNode(true); this.element.id = this.component.renderId; Echo.Sync.renderComponentDefaults(this.component, this.element); Echo.Sync.Border.render(this.component.render("border"), this.element); Echo.Sync.Insets.render(this.component.render("insets"), this.element, "padding"); Echo.Sync.Alignment.render(this.component.render("alignment"), this.element, true, this.component); // div table tbody tr this.containerElement = this.element.firstChild.firstChild.firstChild; this.cellSpacing = Echo.Sync.Extent.toPixels(this.component.render("cellSpacing"), false); if (this.cellSpacing) { this.spacingPrototype = document.createElement("td"); this.spacingPrototype.style.padding = 0; this.spacingPrototype.style.width = this.cellSpacing + "px"; } this.renderAddChildren(update); parentElement.appendChild(this.element); }, /** @see Echo.Sync.ArrayContainer#renderChildLayoutData */ renderChildLayoutData: function(child, cellElement) { var layoutData = child.render("layoutData"); var insets; if (layoutData) { insets = layoutData.insets; Echo.Sync.Color.render(layoutData.background, cellElement, "backgroundColor"); Echo.Sync.FillImage.render(layoutData.backgroundImage, cellElement); Echo.Sync.Alignment.render(layoutData.alignment, cellElement, true, this.component); if (layoutData.width) { if (Echo.Sync.Extent.isPercent(layoutData.width)) { cellElement.style.width = layoutData.width; if (this.element.firstChild.style.width != "100%") { this.element.firstChild.style.width = "100%"; } } else { cellElement.style.width = Echo.Sync.Extent.toPixels(layoutData.width, true) + "px"; } } } if (!insets) { insets = 0; } Echo.Sync.Insets.render(insets, cellElement, "padding"); }});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -