forked from fanruan/fineui
Browse Source
Merge in VISUAL/fineui from ~ZHENFEI.LI/fineui:es6 to es6 * commit '0743286aeab2f97eaa800902a1661e74b761ab60': KERNEL-14035 refactor: layout相关es6es6
Zhenfei.Li-李振飞
2 years ago
34 changed files with 1901 additions and 1603 deletions
@ -0,0 +1,2 @@ |
|||||||
|
export { Layout } from "./layout"; |
||||||
|
export * from "./layout/index"; |
@ -1,47 +1,54 @@ |
|||||||
|
import { shortcut } from "../../../decorator"; |
||||||
|
import { Layout } from "../../layout"; |
||||||
|
import { extend, isFunction } from "../../../2.base"; |
||||||
|
|
||||||
/** |
/** |
||||||
* absolute实现的居中布局 |
* absolute实现的居中布局 |
||||||
* @class BI.AbsoluteCenterLayout |
* @class AbsoluteCenterLayout |
||||||
* @extends BI.Layout |
* @extends Layout |
||||||
*/ |
*/ |
||||||
BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class AbsoluteCenterLayout extends Layout { |
||||||
return BI.extend(BI.AbsoluteCenterLayout.superclass.props.apply(this, arguments), { |
static xtype ="bi.absolute_center_adapt"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
baseCls: "bi-abs-c-a", |
baseCls: "bi-abs-c-a", |
||||||
hgap: 0, |
hgap: 0, |
||||||
lgap: 0, |
lgap: 0, |
||||||
rgap: 0, |
rgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
tgap: 0, |
tgap: 0, |
||||||
bgap: 0 |
bgap: 0, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
|
|
||||||
render: function () { |
render() { |
||||||
BI.AbsoluteCenterLayout.superclass.render.apply(this, arguments); |
super.render(...arguments); |
||||||
var self = this, o = this.options; |
const o = this.options; |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
self.populate(newValue); |
this.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments); |
const w = super._addElement(...arguments); |
||||||
w.element.css({ |
w.element.css({ |
||||||
position: "absolute", |
position: "absolute", |
||||||
left: this._optimiseGap(o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item)), |
left: this._optimiseGap(o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item)), |
||||||
right: this._optimiseGap(o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item)), |
right: this._optimiseGap(o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item)), |
||||||
top: this._optimiseGap(o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item)), |
top: this._optimiseGap(o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item)), |
||||||
bottom: this._optimiseGap(o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item)), |
bottom: this._optimiseGap(o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item)), |
||||||
margin: "auto" |
margin: "auto", |
||||||
}); |
}); |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.AbsoluteCenterLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.absolute_center_adapt", BI.AbsoluteCenterLayout); |
|
||||||
|
@ -1,8 +1,9 @@ |
|||||||
|
import { shortcut } from "../../../decorator"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 水平方向居中容器 |
* 水平方向居中容器 |
||||||
* @class BI.HorizontalAdaptLayout |
|
||||||
* @extends BI.Layout |
|
||||||
*/ |
*/ |
||||||
BI.HorizontalAdaptLayout = function () { |
@shortcut() |
||||||
}; |
export class HorizontalAdaptLayout { |
||||||
BI.shortcut("bi.horizontal_adapt", BI.HorizontalAdaptLayout); |
static xtype = "bi.horizontal_adapt"; |
||||||
|
} |
||||||
|
@ -1,44 +1,50 @@ |
|||||||
|
import { shortcut } from "../../../decorator"; |
||||||
|
import { Layout } from "../../layout"; |
||||||
|
import { extend, isFunction } from "../../../2.base"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 水平方向居中自适应容器 |
* 水平方向居中自适应容器 |
||||||
* @class BI.HorizontalAutoLayout |
* @class HorizontalAutoLayout |
||||||
* @extends BI.Layout |
* @extends Layout |
||||||
*/ |
*/ |
||||||
BI.HorizontalAutoLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class HorizontalAutoLayout extends Layout { |
||||||
return BI.extend(BI.HorizontalAutoLayout.superclass.props.apply(this, arguments), { |
static xtype = "bi.horizontal_auto"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
baseCls: "bi-h-o", |
baseCls: "bi-h-o", |
||||||
hgap: 0, |
hgap: 0, |
||||||
lgap: 0, |
lgap: 0, |
||||||
rgap: 0, |
rgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
tgap: 0, |
tgap: 0, |
||||||
bgap: 0 |
bgap: 0, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
|
|
||||||
render: function () { |
render() { |
||||||
BI.HorizontalAutoLayout.superclass.render.apply(this, arguments); |
super.render(...arguments); |
||||||
var self = this, o = this.options; |
const o = this.options; |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
self.populate(newValue); |
this.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const w = super._addElement(...arguments); |
||||||
var w = BI.HorizontalAutoLayout.superclass._addElement.apply(this, arguments); |
|
||||||
w.element.css({ |
w.element.css({ |
||||||
position: "relative", |
position: "relative", |
||||||
margin: "0px auto" |
margin: "0px auto", |
||||||
}); |
}); |
||||||
this._handleGap(w, item, null, i); |
this._handleGap(w, item, null, i); |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.horizontal_auto", BI.HorizontalAutoLayout); |
|
||||||
|
@ -0,0 +1,13 @@ |
|||||||
|
export { AbsoluteCenterLayout } from "./absolute.center"; |
||||||
|
export { AbsoluteHorizontalLayout } from "./absolute.horizontal"; |
||||||
|
export { AbsoluteLeftRightVerticalAdaptLayout, AbsoluteRightVerticalAdaptLayout } from "./absolute.leftrightvertical"; |
||||||
|
export { AbsoluteVerticalLayout } from "./absolute.vertical"; |
||||||
|
export { CenterAdaptLayout } from "./adapt.center"; |
||||||
|
export { HorizontalAdaptLayout } from "./adapt.horizontal"; |
||||||
|
export { LeftRightVerticalAdaptLayout, LeftVerticalAdaptLayout, RightVerticalAdaptLayout } from "./adapt.leftrightvertical"; |
||||||
|
export { TableAdaptLayout } from "./adapt.table"; |
||||||
|
export { VerticalAdaptLayout } from "./adapt.vertical"; |
||||||
|
export { HorizontalAutoLayout } from "./auto.horizontal"; |
||||||
|
export { InlineCenterAdaptLayout } from "./inline.center"; |
||||||
|
export { InlineHorizontalAdaptLayout } from "./inline.horizontal"; |
||||||
|
export { InlineVerticalAdaptLayout } from "./inline.vertical"; |
@ -0,0 +1,17 @@ |
|||||||
|
export { AbsoluteLayout } from "./layout.absolute"; |
||||||
|
export { AdaptiveLayout } from "./layout.adaptive"; |
||||||
|
export { BorderLayout } from "./layout.border"; |
||||||
|
export { CardLayout } from "./layout.card"; |
||||||
|
export { DefaultLayout } from "./layout.default"; |
||||||
|
export { DivisionLayout } from "./layout.division"; |
||||||
|
export { FloatLeftLayout, FloatRightLayout } from "./layout.flow"; |
||||||
|
export { GridLayout } from "./layout.grid"; |
||||||
|
export { HorizontalLayout } from "./layout.horizontal"; |
||||||
|
export { InlineLayout } from "./layout.inline"; |
||||||
|
export { LatticeLayout } from "./layout.lattice"; |
||||||
|
export { TableLayout } from "./layout.table"; |
||||||
|
export { HTapeLayout, VTapeLayout } from "./layout.tape"; |
||||||
|
export { TdLayout } from "./layout.td"; |
||||||
|
export { VerticalLayout } from "./layout.vertical"; |
||||||
|
export { WindowLayout } from "./layout.window"; |
||||||
|
export * from "./adapt"; |
@ -1,115 +1,119 @@ |
|||||||
|
import { shortcut } from "../../decorator"; |
||||||
|
import { Layout } from "../layout"; |
||||||
|
import { extend, isFunction, map, parseFloat, isKey, pick, isNotNull, isNumber } from "../../2.base"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 固定子组件上下左右的布局容器 |
* 固定子组件上下左右的布局容器 |
||||||
* @class BI.AbsoluteLayout |
|
||||||
* @extends BI.Layout |
|
||||||
*/ |
*/ |
||||||
BI.AbsoluteLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class AbsoluteLayout extends Layout { |
||||||
return BI.extend(BI.AbsoluteLayout.superclass.props.apply(this, arguments), { |
static xtype = "bi.absolute"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
baseCls: "bi-abs", |
baseCls: "bi-abs", |
||||||
hgap: null, |
hgap: null, |
||||||
vgap: null, |
vgap: null, |
||||||
lgap: null, |
lgap: null, |
||||||
rgap: null, |
rgap: null, |
||||||
tgap: null, |
tgap: null, |
||||||
bgap: null |
bgap: null, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
render: function () { |
|
||||||
BI.AbsoluteLayout.superclass.render.apply(this, arguments); |
render() { |
||||||
var self = this, o = this.options; |
super.render(...arguments); |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const o = this.options; |
||||||
self.populate(newValue); |
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
|
this.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments); |
const w = super._addElement(...arguments); |
||||||
var left = 0, right = 0, top = 0, bottom = 0; |
let left = 0, right = 0, top = 0, bottom = 0; |
||||||
var offsets = BI.pick(item, ["top", "right", "bottom", "left"]); |
let offsets = pick(item, ["top", "right", "bottom", "left"]); |
||||||
|
|
||||||
if (BI.isKey(item.inset)) { |
if (isKey(item.inset)) { |
||||||
var insets = BI.map((item.inset + "").split(" "), function (i, str) { |
const insets = map((`${item.inset}`).split(" "), (i, str) => parseFloat(str)); |
||||||
return BI.parseFloat(str); |
|
||||||
}); |
|
||||||
switch (insets.length) { |
switch (insets.length) { |
||||||
case 1: |
case 1: |
||||||
offsets = {top: insets[0], bottom: insets[0], left: insets[0], right: insets[0]} |
offsets = { top: insets[0], bottom: insets[0], left: insets[0], right: insets[0] }; |
||||||
break; |
break; |
||||||
case 2: |
case 2: |
||||||
offsets = {top: insets[0], bottom: insets[0], left: insets[1], right: insets[1]} |
offsets = { top: insets[0], bottom: insets[0], left: insets[1], right: insets[1] }; |
||||||
break; |
break; |
||||||
case 3: |
case 3: |
||||||
offsets = {top: insets[0], left: insets[1], right: insets[1], bottom: insets[2]} |
offsets = { top: insets[0], left: insets[1], right: insets[1], bottom: insets[2] }; |
||||||
break |
break; |
||||||
case 4: |
case 4: |
||||||
default: |
default: |
||||||
offsets = {top: insets[0], right: insets[1], bottom: insets[2], left: insets[3]} |
offsets = { top: insets[0], right: insets[1], bottom: insets[2], left: insets[3] }; |
||||||
break; |
break; |
||||||
} |
} |
||||||
} |
} |
||||||
if (BI.isNotNull(offsets.left)) { |
if (isNotNull(offsets.left)) { |
||||||
w.element.css({left: BI.isNumber(offsets.left) ? this._optimiseGap(offsets.left) : offsets.left}); |
w.element.css({ left: isNumber(offsets.left) ? this._optimiseGap(offsets.left) : offsets.left }); |
||||||
left += offsets.left; |
left += offsets.left; |
||||||
} |
} |
||||||
if (BI.isNotNull(offsets.right)) { |
if (isNotNull(offsets.right)) { |
||||||
w.element.css({right: BI.isNumber(offsets.right) ? this._optimiseGap(offsets.right) : offsets.right}); |
w.element.css({ right: isNumber(offsets.right) ? this._optimiseGap(offsets.right) : offsets.right }); |
||||||
right += offsets.right; |
right += offsets.right; |
||||||
} |
} |
||||||
if (BI.isNotNull(offsets.top)) { |
if (isNotNull(offsets.top)) { |
||||||
w.element.css({top: BI.isNumber(offsets.top) ? this._optimiseGap(offsets.top) : offsets.top}); |
w.element.css({ top: isNumber(offsets.top) ? this._optimiseGap(offsets.top) : offsets.top }); |
||||||
top += offsets.top; |
top += offsets.top; |
||||||
} |
} |
||||||
if (BI.isNotNull(offsets.bottom)) { |
if (isNotNull(offsets.bottom)) { |
||||||
w.element.css({bottom: BI.isNumber(offsets.bottom) ? this._optimiseGap(offsets.bottom) : offsets.bottom}); |
w.element.css({ bottom: isNumber(offsets.bottom) ? this._optimiseGap(offsets.bottom) : offsets.bottom }); |
||||||
bottom += offsets.bottom; |
bottom += offsets.bottom; |
||||||
} |
} |
||||||
|
|
||||||
if (BI.isNotNull(o.hgap)) { |
if (isNotNull(o.hgap)) { |
||||||
left += o.hgap; |
left += o.hgap; |
||||||
w.element.css({left: this._optimiseGap(left)}); |
w.element.css({ left: this._optimiseGap(left) }); |
||||||
right += o.hgap; |
right += o.hgap; |
||||||
w.element.css({right: this._optimiseGap(right)}); |
w.element.css({ right: this._optimiseGap(right) }); |
||||||
} |
} |
||||||
if (BI.isNotNull(o.vgap)) { |
if (isNotNull(o.vgap)) { |
||||||
top += o.vgap; |
top += o.vgap; |
||||||
w.element.css({top: this._optimiseGap(top)}); |
w.element.css({ top: this._optimiseGap(top) }); |
||||||
bottom += o.vgap; |
bottom += o.vgap; |
||||||
w.element.css({bottom: this._optimiseGap(bottom)}); |
w.element.css({ bottom: this._optimiseGap(bottom) }); |
||||||
} |
} |
||||||
|
|
||||||
if (BI.isNotNull(o.lgap)) { |
if (isNotNull(o.lgap)) { |
||||||
left += o.lgap; |
left += o.lgap; |
||||||
w.element.css({left: this._optimiseGap(left)}); |
w.element.css({ left: this._optimiseGap(left) }); |
||||||
} |
} |
||||||
if (BI.isNotNull(o.rgap)) { |
if (isNotNull(o.rgap)) { |
||||||
right += o.rgap; |
right += o.rgap; |
||||||
w.element.css({right: this._optimiseGap(right)}); |
w.element.css({ right: this._optimiseGap(right) }); |
||||||
} |
} |
||||||
if (BI.isNotNull(o.tgap)) { |
if (isNotNull(o.tgap)) { |
||||||
top += o.tgap; |
top += o.tgap; |
||||||
w.element.css({top: this._optimiseGap(top)}); |
w.element.css({ top: this._optimiseGap(top) }); |
||||||
} |
} |
||||||
if (BI.isNotNull(o.bgap)) { |
if (isNotNull(o.bgap)) { |
||||||
bottom += o.bgap; |
bottom += o.bgap; |
||||||
w.element.css({bottom: this._optimiseGap(bottom)}); |
w.element.css({ bottom: this._optimiseGap(bottom) }); |
||||||
} |
} |
||||||
|
|
||||||
if (BI.isNotNull(item.width)) { |
if (isNotNull(item.width)) { |
||||||
w.element.css({width: BI.isNumber(item.width) ? this._optimiseGap(item.width) : item.width}); |
w.element.css({ width: isNumber(item.width) ? this._optimiseGap(item.width) : item.width }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.height)) { |
if (isNotNull(item.height)) { |
||||||
w.element.css({height: BI.isNumber(item.height) ? this._optimiseGap(item.height) : item.height}); |
w.element.css({ height: isNumber(item.height) ? this._optimiseGap(item.height) : item.height }); |
||||||
} |
} |
||||||
w.element.css({position: "absolute"}); |
w.element.css({ position: "absolute" }); |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.AbsoluteLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.absolute", BI.AbsoluteLayout); |
|
||||||
|
@ -1,63 +1,70 @@ |
|||||||
BI.AdaptiveLayout = BI.inherit(BI.Layout, { |
import { shortcut } from "../../decorator"; |
||||||
props: function () { |
import { Layout } from "../layout"; |
||||||
return BI.extend(BI.AdaptiveLayout.superclass.props.apply(this, arguments), { |
import { extend, isNumber, isNotNull, isFunction } from "../../2.base"; |
||||||
|
|
||||||
|
@shortcut() |
||||||
|
export class AdaptiveLayout extends Layout { |
||||||
|
static xtype = "bi.adaptive"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
baseCls: "bi-adaptive", |
baseCls: "bi-adaptive", |
||||||
hgap: 0, |
hgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
lgap: 0, |
lgap: 0, |
||||||
rgap: 0, |
rgap: 0, |
||||||
tgap: 0, |
tgap: 0, |
||||||
bgap: 0 |
bgap: 0, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
render: function () { |
|
||||||
BI.AdaptiveLayout.superclass.render.apply(this, arguments); |
render() { |
||||||
var self = this, o = this.options; |
super.render(...arguments); |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const self = this, o = this.options; |
||||||
|
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
self.populate(newValue); |
self.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const w = super._addElement(...arguments); |
||||||
var w = BI.AdaptiveLayout.superclass._addElement.apply(this, arguments); |
w.element.css({ position: "relative" }); |
||||||
w.element.css({position: "relative"}); |
if (isNotNull(item.left)) { |
||||||
if (BI.isNotNull(item.left)) { |
|
||||||
w.element.css({ |
w.element.css({ |
||||||
left: BI.isNumber(item.left) ? this._optimiseGap(item.left) : item.left |
left: isNumber(item.left) ? this._optimiseGap(item.left) : item.left, |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.right)) { |
if (isNotNull(item.right)) { |
||||||
w.element.css({ |
w.element.css({ |
||||||
right: BI.isNumber(item.right) ? this._optimiseGap(item.right) : item.right |
right: isNumber(item.right) ? this._optimiseGap(item.right) : item.right, |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.top)) { |
if (isNotNull(item.top)) { |
||||||
w.element.css({ |
w.element.css({ |
||||||
top: BI.isNumber(item.top) ? this._optimiseGap(item.top) : item.top |
top: isNumber(item.top) ? this._optimiseGap(item.top) : item.top, |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.bottom)) { |
if (isNotNull(item.bottom)) { |
||||||
w.element.css({ |
w.element.css({ |
||||||
bottom: BI.isNumber(item.bottom) ? this._optimiseGap(item.bottom) : item.bottom |
bottom: isNumber(item.bottom) ? this._optimiseGap(item.bottom) : item.bottom, |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
this._handleGap(w, item); |
this._handleGap(w, item); |
||||||
|
|
||||||
if (BI.isNotNull(item.width)) { |
if (isNotNull(item.width)) { |
||||||
w.element.css({width: BI.isNumber(item.width) ? this._optimiseGap(item.width) : item.width}); |
w.element.css({ width: isNumber(item.width) ? this._optimiseGap(item.width) : item.width }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.height)) { |
if (isNotNull(item.height)) { |
||||||
w.element.css({height: BI.isNumber(item.height) ? this._optimiseGap(item.height) : item.height}); |
w.element.css({ height: isNumber(item.height) ? this._optimiseGap(item.height) : item.height }); |
||||||
} |
} |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.AbsoluteLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.adaptive", BI.AdaptiveLayout); |
|
||||||
|
@ -1,39 +1,47 @@ |
|||||||
|
import { shortcut } from "../../decorator"; |
||||||
|
import { Layout } from "../layout"; |
||||||
|
import { extend, isFunction } from "../../2.base"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 默认的布局方式 |
* 默认的布局方式 |
||||||
* |
* |
||||||
* @class BI.DefaultLayout |
* @class DefaultLayout |
||||||
* @extends BI.Layout |
* @extends Layout |
||||||
*/ |
*/ |
||||||
BI.DefaultLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class DefaultLayout extends Layout { |
||||||
return BI.extend(BI.DefaultLayout.superclass.props.apply(this, arguments), { |
static xtype = "bi.default"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
hgap: 0, |
hgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
lgap: 0, |
lgap: 0, |
||||||
rgap: 0, |
rgap: 0, |
||||||
tgap: 0, |
tgap: 0, |
||||||
bgap: 0, |
bgap: 0, |
||||||
items: [] |
items: [], |
||||||
}); |
}); |
||||||
}, |
} |
||||||
render: function () { |
|
||||||
BI.DefaultLayout.superclass.render.apply(this, arguments); |
render() { |
||||||
var self = this, o = this.options; |
super.render(...arguments); |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const o = this.options; |
||||||
self.populate(newValue); |
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
|
this.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var w = BI.DefaultLayout.superclass._addElement.apply(this, arguments); |
const w = super._addElement(...arguments); |
||||||
this._handleGap(w, item); |
this._handleGap(w, item); |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.DefaultLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.default", BI.DefaultLayout); |
|
||||||
|
@ -1,183 +1,196 @@ |
|||||||
|
import { shortcut } from "../../decorator"; |
||||||
|
import { Layout } from "../layout"; |
||||||
|
import { extend, isFunction, isNotNull, isNumber } from "../../2.base"; |
||||||
|
import { pixFormat } from "../../constant"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 靠左对齐的自由浮动布局 |
* 靠左对齐的自由浮动布局 |
||||||
* @class BI.FloatLeftLayout |
* @class FloatLeftLayout |
||||||
* @extends BI.Layout |
* @extends Layout |
||||||
* |
* |
||||||
* @cfg {JSON} options 配置属性 |
* @cfg {JSON} options 配置属性 |
||||||
* @cfg {Number} [hgap=0] 水平间隙 |
* @cfg {Number} [hgap=0] 水平间隙 |
||||||
* @cfg {Number} [vgap=0] 垂直间隙 |
* @cfg {Number} [vgap=0] 垂直间隙 |
||||||
*/ |
*/ |
||||||
BI.FloatLeftLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class FloatLeftLayout extends Layout { |
||||||
return BI.extend(BI.FloatLeftLayout.superclass.props.apply(this, arguments), { |
static xtype = "bi.left"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
baseCls: "bi-left clearfix", |
baseCls: "bi-left clearfix", |
||||||
hgap: 0, |
hgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
lgap: 0, |
lgap: 0, |
||||||
rgap: 0, |
rgap: 0, |
||||||
tgap: 0, |
tgap: 0, |
||||||
bgap: 0 |
bgap: 0, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
render: function () { |
|
||||||
BI.FloatLeftLayout.superclass.render.apply(this, arguments); |
render() { |
||||||
var self = this, o = this.options; |
super.render(...arguments); |
||||||
|
const o = this.options; |
||||||
if (o.innerHgap !== 0) { |
if (o.innerHgap !== 0) { |
||||||
this.element.css({ |
this.element.css({ |
||||||
paddingLeft: this._optimiseGap(o.innerHgap), |
paddingLeft: this._optimiseGap(o.innerHgap), |
||||||
paddingRight: this._optimiseGap(o.innerHgap) |
paddingRight: this._optimiseGap(o.innerHgap), |
||||||
}) |
}); |
||||||
} |
} |
||||||
if (o.innerVgap !== 0) { |
if (o.innerVgap !== 0) { |
||||||
this.element.css({ |
this.element.css({ |
||||||
paddingTop: this._optimiseGap(o.innerVgap), |
paddingTop: this._optimiseGap(o.innerVgap), |
||||||
paddingBottom: this._optimiseGap(o.innerVgap) |
paddingBottom: this._optimiseGap(o.innerVgap), |
||||||
}) |
}); |
||||||
} |
} |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
self.populate(newValue); |
this.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments); |
const w = super._addElement(...arguments); |
||||||
w.element.css({position: "relative", float: "left"}); |
w.element.css({ position: "relative", "float": "left" }); |
||||||
if (BI.isNotNull(item.left)) { |
if (isNotNull(item.left)) { |
||||||
w.element.css({left: BI.isNumber(item.left) ? this._optimiseGap(item.left) : item.left}); |
w.element.css({ left: isNumber(item.left) ? this._optimiseGap(item.left) : item.left }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.right)) { |
if (isNotNull(item.right)) { |
||||||
w.element.css({right: BI.isNumber(item.right) ? this._optimiseGap(item.right) : item.right}); |
w.element.css({ right: isNumber(item.right) ? this._optimiseGap(item.right) : item.right }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.top)) { |
if (isNotNull(item.top)) { |
||||||
w.element.css({top: BI.isNumber(item.top) ? this._optimiseGap(item.top) : item.top}); |
w.element.css({ top: isNumber(item.top) ? this._optimiseGap(item.top) : item.top }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.bottom)) { |
if (isNotNull(item.bottom)) { |
||||||
w.element.css({bottom: BI.isNumber(item.bottom) ? this._optimiseGap(item.bottom) : item.bottom}); |
w.element.css({ bottom: isNumber(item.bottom) ? this._optimiseGap(item.bottom) : item.bottom }); |
||||||
} |
} |
||||||
if (o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) { |
if (o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) { |
||||||
var top = o.vgap / 2 + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item); |
const top = o.vgap / 2 + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-top": this._optimiseGap(top) |
"margin-top": this._optimiseGap(top), |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) { |
if (o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) { |
||||||
var left = o.hgap / 2 + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item); |
const left = o.hgap / 2 + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-left": this._optimiseGap(left) |
"margin-left": this._optimiseGap(left), |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) { |
if (o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) { |
||||||
var right = o.hgap / 2 + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item); |
const right = o.hgap / 2 + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-right": this._optimiseGap(right) |
"margin-right": this._optimiseGap(right), |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) { |
if (o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) { |
||||||
var bottom = o.vgap / 2 + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item); |
const bottom = o.vgap / 2 + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-bottom": this._optimiseGap(bottom) |
"margin-bottom": this._optimiseGap(bottom), |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.FloatLeftLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.left", BI.FloatLeftLayout); |
|
||||||
|
|
||||||
/** |
/** |
||||||
* 靠右对齐的自由浮动布局 |
* 靠右对齐的自由浮动布局 |
||||||
* @class BI.FloatRightLayout |
* @class FloatRightLayout |
||||||
* @extends BI.Layout |
* @extends Layout |
||||||
* |
* |
||||||
* @cfg {JSON} options 配置属性 |
* @cfg {JSON} options 配置属性 |
||||||
* @cfg {Number} [hgap=0] 水平间隙 |
* @cfg {Number} [hgap=0] 水平间隙 |
||||||
* @cfg {Number} [vgap=0] 垂直间隙 |
* @cfg {Number} [vgap=0] 垂直间隙 |
||||||
*/ |
*/ |
||||||
BI.FloatRightLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class FloatRightLayout extends Layout { |
||||||
return BI.extend(BI.FloatRightLayout.superclass.props.apply(this, arguments), { |
static xtype = "bi.right"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
baseCls: "bi-right clearfix", |
baseCls: "bi-right clearfix", |
||||||
hgap: 0, |
hgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
lgap: 0, |
lgap: 0, |
||||||
rgap: 0, |
rgap: 0, |
||||||
tgap: 0, |
tgap: 0, |
||||||
bgap: 0 |
bgap: 0, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
render: function () { |
|
||||||
BI.FloatRightLayout.superclass.render.apply(this, arguments); |
render() { |
||||||
var self = this, o = this.options; |
super.render(...arguments); |
||||||
|
const o = this.options; |
||||||
if (o.innerHgap !== 0) { |
if (o.innerHgap !== 0) { |
||||||
this.element.css({ |
this.element.css({ |
||||||
paddingLeft: this._optimiseGap(o.innerHgap), |
paddingLeft: this._optimiseGap(o.innerHgap), |
||||||
paddingRight: this._optimiseGap(o.innerHgap) |
paddingRight: this._optimiseGap(o.innerHgap), |
||||||
}) |
}); |
||||||
} |
} |
||||||
if (o.innerVgap !== 0) { |
if (o.innerVgap !== 0) { |
||||||
this.element.css({ |
this.element.css({ |
||||||
paddingTop: this._optimiseGap(o.innerVgap), |
paddingTop: this._optimiseGap(o.innerVgap), |
||||||
paddingBottom: this._optimiseGap(o.innerVgap) |
paddingBottom: this._optimiseGap(o.innerVgap), |
||||||
}) |
}); |
||||||
} |
} |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
self.populate(newValue); |
this.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments); |
const w = super._addElement(...arguments); |
||||||
w.element.css({position: "relative", float: "right"}); |
w.element.css({ position: "relative", "float": "right" }); |
||||||
if (BI.isNotNull(item.left)) { |
if (isNotNull(item.left)) { |
||||||
w.element.css({left: BI.pixFormat(item.left)}); |
w.element.css({ left: pixFormat(item.left) }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.right)) { |
if (isNotNull(item.right)) { |
||||||
w.element.css({right: BI.pixFormat(item.right)}); |
w.element.css({ right: pixFormat(item.right) }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.top)) { |
if (isNotNull(item.top)) { |
||||||
w.element.css({top: BI.pixFormat(item.top)}); |
w.element.css({ top: pixFormat(item.top) }); |
||||||
} |
} |
||||||
if (BI.isNotNull(item.bottom)) { |
if (isNotNull(item.bottom)) { |
||||||
w.element.css({bottom: BI.pixFormat(item.bottom)}); |
w.element.css({ bottom: pixFormat(item.bottom) }); |
||||||
} |
} |
||||||
if (o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) { |
if (o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) { |
||||||
var top = o.vgap / 2 + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item); |
const top = o.vgap / 2 + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-top": this._optimiseGap(top) |
"margin-top": this._optimiseGap(top), |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) { |
if (o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) { |
||||||
var left = o.hgap / 2 + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item); |
const left = o.hgap / 2 + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-left": this._optimiseGap(left) |
"margin-left": this._optimiseGap(left), |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) { |
if (o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) { |
||||||
var right = o.hgap / 2 + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item); |
const right = o.hgap / 2 + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-right": this._optimiseGap(right) |
"margin-right": this._optimiseGap(right), |
||||||
}); |
}); |
||||||
} |
} |
||||||
if (o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) { |
if (o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) { |
||||||
var bottom = o.vgap / 2 + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item); |
const bottom = o.vgap / 2 + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item); |
||||||
w.element.css({ |
w.element.css({ |
||||||
"margin-bottom": this._optimiseGap(bottom) |
"margin-bottom": this._optimiseGap(bottom), |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.FloatRightLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.right", BI.FloatRightLayout); |
|
||||||
|
@ -1,8 +1,6 @@ |
|||||||
/** |
import { shortcut } from "../../decorator"; |
||||||
* 水平布局 |
|
||||||
* @class BI.HorizontalLayout |
@shortcut() |
||||||
* @extends BI.Layout |
export class HorizontalLayout { |
||||||
*/ |
static xtype = "bi.horizontal"; |
||||||
BI.HorizontalLayout = function () { |
} |
||||||
}; |
|
||||||
BI.shortcut("bi.horizontal", BI.HorizontalLayout); |
|
||||||
|
@ -1,43 +1,52 @@ |
|||||||
|
import { shortcut } from "../../decorator"; |
||||||
|
import { Layout } from "../layout"; |
||||||
|
import { extend, isFunction, sum } from "../../2.base"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 靠左对齐的自由浮动布局 |
* 靠左对齐的自由浮动布局 |
||||||
* @class BI.LatticeLayout |
* @class LatticeLayout |
||||||
* @extends BI.Layout |
* @extends Layout |
||||||
* |
* |
||||||
* @cfg {JSON} options 配置属性 |
* @cfg {JSON} options 配置属性 |
||||||
* @cfg {Number} [hgap=0] 水平间隙 |
* @cfg {Number} [hgap=0] 水平间隙 |
||||||
* @cfg {Number} [vgap=0] 垂直间隙 |
* @cfg {Number} [vgap=0] 垂直间隙 |
||||||
*/ |
*/ |
||||||
BI.LatticeLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class LatticeLayout extends Layout { |
||||||
return BI.extend(BI.LatticeLayout.superclass.props.apply(this, arguments), { |
static xtype = "bi.lattice"; |
||||||
baseCls: "bi-lattice clearfix" |
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
|
baseCls: "bi-lattice clearfix", |
||||||
// columnSize: [0.2, 0.2, 0.6],
|
// columnSize: [0.2, 0.2, 0.6],
|
||||||
}); |
}); |
||||||
}, |
} |
||||||
render: function () { |
|
||||||
BI.LatticeLayout.superclass.render.apply(this, arguments); |
render() { |
||||||
var self = this, o = this.options; |
super.render(...arguments); |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const self = this, o = this.options; |
||||||
|
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
self.populate(newValue); |
self.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var w = BI.LatticeLayout.superclass._addElement.apply(this, arguments); |
const w = super._addElement(...arguments); |
||||||
|
let width; |
||||||
if (o.columnSize && o.columnSize[i]) { |
if (o.columnSize && o.columnSize[i]) { |
||||||
var width = o.columnSize[i] / BI.sum(o.columnSize) * 100 + "%"; |
width = `${o.columnSize[i] / sum(o.columnSize) * 100}%`; |
||||||
} else { |
} else { |
||||||
var width = 1 / this.options.items.length * 100 + "%"; |
width = `${1 / this.options.items.length * 100}%`; |
||||||
} |
} |
||||||
w.element.css({position: "relative", float: "left", width: width}); |
w.element.css({ position: "relative", "float": "left", width }); |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.LatticeLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.lattice", BI.LatticeLayout); |
|
||||||
|
@ -1,54 +1,63 @@ |
|||||||
|
import { shortcut } from "../../decorator"; |
||||||
|
import { Layout } from "../layout"; |
||||||
|
import { extend, isFunction } from "../../2.base"; |
||||||
|
import { HorizontalAlign } from "../../constant"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 垂直布局 |
* 垂直布局 |
||||||
* @class BI.VerticalLayout |
* @class VerticalLayout |
||||||
* @extends BI.Layout |
* @extends Layout |
||||||
*/ |
*/ |
||||||
BI.VerticalLayout = BI.inherit(BI.Layout, { |
@shortcut() |
||||||
props: function () { |
export class VerticalLayout extends Layout { |
||||||
return BI.extend(BI.VerticalLayout.superclass.props.apply(this, arguments), { |
static xtype = "bi.vertical"; |
||||||
|
|
||||||
|
props() { |
||||||
|
return extend(super.props(...arguments), { |
||||||
baseCls: "bi-v", |
baseCls: "bi-v", |
||||||
horizontalAlign: BI.HorizontalAlign.Stretch, |
horizontalAlign: HorizontalAlign.Stretch, |
||||||
hgap: 0, |
hgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
lgap: 0, |
lgap: 0, |
||||||
rgap: 0, |
rgap: 0, |
||||||
tgap: 0, |
tgap: 0, |
||||||
bgap: 0, |
bgap: 0, |
||||||
scrolly: true |
scrolly: true, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
render: function () { |
|
||||||
BI.VerticalLayout.superclass.render.apply(this, arguments); |
render() { |
||||||
var self = this, o = this.options; |
super.render(...arguments); |
||||||
var items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
const o = this.options; |
||||||
self.populate(newValue); |
const items = isFunction(o.items) ? this.__watch(o.items, (context, newValue) => { |
||||||
|
this.populate(newValue); |
||||||
}) : o.items; |
}) : o.items; |
||||||
this.populate(items); |
this.populate(items); |
||||||
}, |
} |
||||||
|
|
||||||
_addElement: function (i, item) { |
_addElement(i, item) { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var w = BI.VerticalLayout.superclass._addElement.apply(this, arguments); |
const w = super._addElement(...arguments); |
||||||
w.element.css({ |
w.element.css({ |
||||||
position: "relative" |
position: "relative", |
||||||
}); |
}); |
||||||
this._handleGap(w, item, null, i); |
this._handleGap(w, item, null, i); |
||||||
if (o.horizontalAlign === BI.HorizontalAlign.Center) { |
if (o.horizontalAlign === HorizontalAlign.Center) { |
||||||
w.element.css({ |
w.element.css({ |
||||||
marginLeft: "auto", |
marginLeft: "auto", |
||||||
marginRight: "auto" |
marginRight: "auto", |
||||||
}); |
}); |
||||||
} else if (o.horizontalAlign === BI.HorizontalAlign.Right) { |
} else if (o.horizontalAlign === HorizontalAlign.Right) { |
||||||
w.element.css({ |
w.element.css({ |
||||||
marginLeft: "auto" |
marginLeft: "auto", |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
return w; |
return w; |
||||||
}, |
} |
||||||
|
|
||||||
populate: function (items) { |
populate(...args) { |
||||||
BI.VerticalLayout.superclass.populate.apply(this, arguments); |
super.populate(...args); |
||||||
this._mount(); |
this._mount(); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.vertical", BI.VerticalLayout); |
|
||||||
|
Loading…
Reference in new issue