Browse Source

Pull request #1764: 无JIRA任务 移动端适配

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '8c1bff398b5e0170d685ce1c343587cf29a1b8c8': (25 commits)
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  移动端适配
  针对移动端rem进行适配
  针对移动端rem进行适配
  针对移动端rem进行适配
  针对移动端rem进行适配
  针对移动端rem进行适配
  ...
es6
guy 4 years ago
parent
commit
ad6c618409
  1. 4
      src/base/collection/collection.js
  2. 4
      src/base/grid/grid.js
  3. 24
      src/base/layer/layer.popup.js
  4. 4
      src/base/single/button/buttons/button.icon.js
  5. 8
      src/base/single/button/buttons/button.js
  6. 14
      src/base/single/html/html.js
  7. 8
      src/base/single/label/abstract.label.js
  8. 4
      src/base/single/label/icon.label.js
  9. 3
      src/base/single/single.js
  10. 17
      src/base/single/text.js
  11. 4
      src/base/single/tip/tip.toast.js
  12. 8
      src/case/button/item.singleselect.radio.js
  13. 4
      src/case/list/list.select.js
  14. 6
      src/core/controller/controller.popover.js
  15. 6
      src/core/controller/controller.resizer.js
  16. 6
      src/core/controller/controller.tooltips.js
  17. 1
      src/core/shortcut.js
  18. 4
      src/core/var.js
  19. 31
      src/core/widget.js
  20. 8
      src/core/wrapper/layout.js
  21. 10
      src/core/wrapper/layout/adapt/absolute.center.js
  22. 10
      src/core/wrapper/layout/adapt/absolute.horizontal.js
  23. 14
      src/core/wrapper/layout/adapt/absolute.vertical.js
  24. 10
      src/core/wrapper/layout/adapt/adapt.table.js
  25. 10
      src/core/wrapper/layout/adapt/auto.horizontal.js
  26. 70
      src/core/wrapper/layout/adapt/float.horizontal.js
  27. 10
      src/core/wrapper/layout/adapt/inline.center.js
  28. 10
      src/core/wrapper/layout/adapt/inline.horizontal.js
  29. 10
      src/core/wrapper/layout/adapt/inline.vertical.js
  30. 10
      src/core/wrapper/layout/flex/flex.horizontal.js
  31. 10
      src/core/wrapper/layout/flex/flex.vertical.js
  32. 10
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  33. 10
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  34. 31
      src/core/wrapper/layout/layout.absolute.js
  35. 30
      src/core/wrapper/layout/layout.adaptive.js
  36. 40
      src/core/wrapper/layout/layout.border.js
  37. 10
      src/core/wrapper/layout/layout.default.js
  38. 34
      src/core/wrapper/layout/layout.flow.js
  39. 18
      src/core/wrapper/layout/layout.horizontal.js
  40. 10
      src/core/wrapper/layout/layout.inline.js
  41. 2
      src/core/wrapper/layout/layout.table.js
  42. 28
      src/core/wrapper/layout/layout.tape.js
  43. 12
      src/core/wrapper/layout/layout.td.js
  44. 10
      src/core/wrapper/layout/layout.vertical.js
  45. 16
      src/core/wrapper/layout/layout.window.js
  46. 8
      src/core/wrapper/layout/middle/middle.center.js
  47. 8
      src/core/wrapper/layout/middle/middle.float.center.js
  48. 8
      src/core/wrapper/layout/middle/middle.horizontal.js
  49. 8
      src/core/wrapper/layout/middle/middle.vertical.js
  50. 12
      src/less/base/segment/button.segment.less
  51. 790
      src/less/core/utils/common.less
  52. 732
      src/less/core/utils/list-item.less
  53. 13
      src/less/core/utils/position.less
  54. 18
      src/less/core/utils/typographic.less
  55. 37
      src/less/lib/colors.less
  56. 6
      src/widget/datepane/datepane.js
  57. 2
      src/widget/datetimepane/datetimepane.js
  58. 4
      src/widget/multiselect/multiselect.loader.nobar.js
  59. 4
      src/widget/singleselect/search/singleselect.search.loader.js
  60. 65
      src/widget/singleselect/singleselect.item.js
  61. 4
      src/widget/singleselect/singleselect.list.js
  62. 2
      src/widget/singleselect/singleselect.loader.js
  63. 3
      src/widget/year/combo.year.js
  64. 3
      src/widget/yearmonth/combo.yearmonth.js
  65. 3
      src/widget/yearquarter/combo.yearquarter.js
  66. 5
      template/index.html

4
src/base/collection/collection.js

@ -169,10 +169,10 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.renderedCells[index].el.setHeight(datum.height); this.renderedCells[index].el.setHeight(datum.height);
} }
if (this.renderedCells[index]._left !== datum.x) { if (this.renderedCells[index]._left !== datum.x) {
this.renderedCells[index].el.element.css("left", datum.x + "px"); this.renderedCells[index].el.element.css("left", datum.x / BI.pixRatio + BI.pixUnit);
} }
if (this.renderedCells[index]._top !== datum.y) { if (this.renderedCells[index]._top !== datum.y) {
this.renderedCells[index].el.element.css("top", datum.y + "px"); this.renderedCells[index].el.element.css("top", datum.y / BI.pixRatio + BI.pixUnit);
} }
renderedCells.push(child = this.renderedCells[index]); renderedCells.push(child = this.renderedCells[index]);
} else { } else {

4
src/base/grid/grid.js

@ -145,10 +145,10 @@ BI.GridView = BI.inherit(BI.Widget, {
this.renderedCells[index].el.setHeight(rowDatum.size); this.renderedCells[index].el.setHeight(rowDatum.size);
} }
if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) { if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) {
this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
} }
if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) { if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) {
this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
} }
child = this.renderedCells[index].el; child = this.renderedCells[index].el;
renderedCells.push(this.renderedCells[index]); renderedCells.push(this.renderedCells[index]);

24
src/base/layer/layer.popup.js

@ -45,15 +45,15 @@ BI.PopupView = BI.inherit(BI.Widget, {
BI.PopupView.superclass._init.apply(this, arguments); BI.PopupView.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var fn = function (e) { var fn = function (e) {
e.stopPropagation(); e.stopPropagation();
}, stop = function (e) { }, stop = function (e) {
e.stopEvent(); e.stopEvent();
return false; return false;
}; };
this.element.css({ this.element.css({
"z-index": BI.zIndex_popup, "z-index": BI.zIndex_popup,
"min-width": o.minWidth + "px", "min-width": o.minWidth / BI.pixRatio + BI.pixUnit,
"max-width": o.maxWidth + "px" "max-width": o.maxWidth / BI.pixRatio + BI.pixUnit
}).bind({click: fn}); }).bind({click: fn});
this.element.bind("mousewheel", fn); this.element.bind("mousewheel", fn);
@ -95,7 +95,11 @@ BI.PopupView = BI.inherit(BI.Widget, {
_createView: function () { _createView: function () {
var o = this.options; var o = this.options;
this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value}); this.button_group = BI.createWidget(o.el, {type: "bi.button_group", value: o.value});
this.button_group.element.css({"min-height": o.minHeight + "px", "padding-top": o.innerVGap + "px", "padding-bottom": o.innerVGap + "px"}); this.button_group.element.css({
"min-height": o.minHeight / BI.pixRatio + BI.pixUnit,
"padding-top": o.innerVGap / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.innerVGap / BI.pixRatio + BI.pixUnit
});
return this.button_group; return this.button_group;
}, },
@ -158,7 +162,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0); toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0);
var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVGap; var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVGap;
this.view.resetHeight ? this.view.resetHeight(resetHeight) : this.view.resetHeight ? this.view.resetHeight(resetHeight) :
this.view.element.css({"max-height": resetHeight + "px"}); this.view.element.css({"max-height": resetHeight / BI.pixRatio + BI.pixUnit});
}, },
setValue: function (selectedValues) { setValue: function (selectedValues) {
@ -171,4 +175,4 @@ BI.PopupView = BI.inherit(BI.Widget, {
} }
}); });
BI.PopupView.EVENT_CHANGE = "EVENT_CHANGE"; BI.PopupView.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.popup_view", BI.PopupView); BI.shortcut("bi.popup_view", BI.PopupView);

4
src/base/single/button/buttons/button.icon.js

@ -25,7 +25,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
height: o.iconHeight height: o.iconHeight
}); });
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) { if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", o.height + "px"); this.element.css("lineHeight", o.height / BI.pixRatio + BI.pixUnit);
BI.createWidget({ BI.createWidget({
type: "bi.default", type: "bi.default",
element: this, element: this,
@ -49,4 +49,4 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
} }
}); });
BI.IconButton.EVENT_CHANGE = "EVENT_CHANGE"; BI.IconButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_button", BI.IconButton); BI.shortcut("bi.icon_button", BI.IconButton);

8
src/base/single/button/buttons/button.js

@ -44,11 +44,11 @@ BI.Button = BI.inherit(BI.BasicButton, {
BI.Button.superclass._init.apply(this, arguments); BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) { if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"}); this.element.css({height: o.height / BI.pixRatio + BI.pixUnit, lineHeight: (o.height - 2) / BI.pixRatio + BI.pixUnit});
} else if (o.clear || o.block) { } else if (o.clear || o.block) {
this.element.css({lineHeight: o.height + "px"}); this.element.css({lineHeight: o.height / BI.pixRatio + BI.pixUnit});
} else { } else {
this.element.css({lineHeight: (o.height - 2) + "px"}); this.element.css({lineHeight: (o.height - 2) / BI.pixRatio + BI.pixUnit});
} }
if (BI.isKey(o.iconCls)) { if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({ this.icon = BI.createWidget({
@ -106,7 +106,7 @@ BI.Button = BI.inherit(BI.BasicButton, {
this.element.addClass("ghost"); this.element.addClass("ghost");
} }
if (o.minWidth > 0) { if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth + "px"}); this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit});
} }
}, },

14
src/base/single/html/html.js

@ -25,29 +25,29 @@ BI.Html = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
if (o.hgap + o.lgap > 0) { if (o.hgap + o.lgap > 0) {
this.element.css({ this.element.css({
"padding-left": o.hgap + o.lgap + "px" "padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap > 0) { if (o.hgap + o.rgap > 0) {
this.element.css({ this.element.css({
"padding-right": o.hgap + o.rgap + "px" "padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.tgap > 0) { if (o.vgap + o.tgap > 0) {
this.element.css({ this.element.css({
"padding-top": o.vgap + o.tgap + "px" "padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap > 0) { if (o.vgap + o.bgap > 0) {
this.element.css({ this.element.css({
"padding-bottom": o.vgap + o.bgap + "px" "padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (BI.isNumber(o.height)) { if (BI.isNumber(o.height)) {
this.element.css({lineHeight: o.height + "px"}); this.element.css({lineHeight: o.height / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNumber(o.lineHeight)) { if (BI.isNumber(o.lineHeight)) {
this.element.css({lineHeight: o.lineHeight + "px"}); this.element.css({lineHeight: o.lineHeight / BI.pixRatio + BI.pixUnit});
} }
if (BI.isWidthOrHeight(o.maxWidth)) { if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({maxWidth: o.maxWidth}); this.element.css({maxWidth: o.maxWidth});
@ -111,4 +111,4 @@ BI.Html = BI.inherit(BI.Single, {
} }
}); });
BI.shortcut("bi.html", BI.Html); BI.shortcut("bi.html", BI.Html);

8
src/base/single/label/abstract.label.js

@ -101,7 +101,7 @@
} }
if (BI.isNumber(o.height) && o.height > 0) { // 1.4 if (BI.isNumber(o.height) && o.height > 0) { // 1.4
this.element.css({ this.element.css({
"line-height": o.height + "px" "line-height": o.height / BI.pixRatio + BI.pixUnit
}); });
json.textAlign = o.textAlign; json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, { this.text = BI.createWidget(BI.extend(json, {
@ -167,7 +167,7 @@
} }
if (BI.isNumber(o.height) && o.height > 0) { // 1.8 if (BI.isNumber(o.height) && o.height > 0) { // 1.8
this.element.css({ this.element.css({
"line-height": o.height + "px" "line-height": o.height / BI.pixRatio + BI.pixUnit
}); });
json.textAlign = o.textAlign; json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, { this.text = BI.createWidget(BI.extend(json, {
@ -253,7 +253,7 @@
})); }));
if (o.whiteSpace !== "normal") { if (o.whiteSpace !== "normal") {
this.element.css({ this.element.css({
"line-height": o.height - (o.vgap * 2) + "px" "line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
}); });
} }
return; return;
@ -300,7 +300,7 @@
if (BI.isNumber(o.height) && o.height > 0) { if (BI.isNumber(o.height) && o.height > 0) {
if (o.whiteSpace !== "normal") { if (o.whiteSpace !== "normal") {
this.element.css({ this.element.css({
"line-height": o.height - (o.vgap * 2) + "px" "line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
}); });
} }
this.text = BI.createWidget(BI.extend(json, { // 2.6 this.text = BI.createWidget(BI.extend(json, { // 2.6

4
src/base/single/label/icon.label.js

@ -23,7 +23,7 @@ BI.IconLabel = BI.inherit(BI.Single, {
height: o.iconHeight height: o.iconHeight
}); });
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) { if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", o.height + "px"); this.element.css("lineHeight", o.height / BI.pixRatio + BI.pixUnit);
BI.createWidget({ BI.createWidget({
type: "bi.default", type: "bi.default",
element: this, element: this,
@ -39,4 +39,4 @@ BI.IconLabel = BI.inherit(BI.Single, {
} }
} }
}); });
BI.shortcut("bi.icon_label", BI.IconLabel); BI.shortcut("bi.icon_label", BI.IconLabel);

3
src/base/single/single.js

@ -13,7 +13,6 @@ BI.Single = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); var conf = BI.Single.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-single",
readonly: false, readonly: false,
title: null, title: null,
warningTitle: null, warningTitle: null,
@ -207,4 +206,4 @@ BI.Single = BI.inherit(BI.Widget, {
} }
BI.Tooltips.remove(this.getName()); BI.Tooltips.remove(this.getName());
}, },
}); });

17
src/base/single/text.js

@ -26,32 +26,32 @@
var self = this, o = this.options; var self = this, o = this.options;
if (o.hgap + o.lgap > 0) { if (o.hgap + o.lgap > 0) {
this.element.css({ this.element.css({
"padding-left": o.hgap + o.lgap + "px" "padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap > 0) { if (o.hgap + o.rgap > 0) {
this.element.css({ this.element.css({
"padding-right": o.hgap + o.rgap + "px" "padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.tgap > 0) { if (o.vgap + o.tgap > 0) {
this.element.css({ this.element.css({
"padding-top": o.vgap + o.tgap + "px" "padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap > 0) { if (o.vgap + o.bgap > 0) {
this.element.css({ this.element.css({
"padding-bottom": o.vgap + o.bgap + "px" "padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (BI.isNumber(o.height)) { if (BI.isNumber(o.height)) {
this.element.css({lineHeight: o.height + "px"}); this.element.css({lineHeight: o.height / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNumber(o.lineHeight)) { if (BI.isNumber(o.lineHeight)) {
this.element.css({lineHeight: o.lineHeight + "px"}); this.element.css({lineHeight: o.lineHeight / BI.pixRatio + BI.pixUnit});
} }
if (BI.isWidthOrHeight(o.maxWidth)) { if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({maxWidth: o.maxWidth}); this.element.css({maxWidth: o.maxWidth / BI.pixRatio + BI.pixUnit});
} }
this.element.css({ this.element.css({
textAlign: o.textAlign, textAlign: o.textAlign,
@ -96,8 +96,9 @@
case "nowrap": case "nowrap":
return "pre"; return "pre";
case "normal": case "normal":
default:
return "pre-wrap"; return "pre-wrap";
default:
return o.whiteSpace;
} }
}, },

4
src/base/single/tip/tip.toast.js

@ -22,7 +22,7 @@ BI.Toast = BI.inherit(BI.Tip, {
BI.Toast.superclass._init.apply(this, arguments); BI.Toast.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.element.css({ this.element.css({
minWidth: this._const.minWidth + "px" minWidth: this._const.minWidth / BI.pixRatio + BI.pixUnit
}); });
this.element.addClass("toast-" + o.level); this.element.addClass("toast-" + o.level);
var fn = function (e) { var fn = function (e) {
@ -95,4 +95,4 @@ BI.Toast = BI.inherit(BI.Tip, {
} }
}); });
BI.Toast.EVENT_DESTORY = "EVENT_DESTORY"; BI.Toast.EVENT_DESTORY = "EVENT_DESTORY";
BI.shortcut("bi.toast", BI.Toast); BI.shortcut("bi.toast", BI.Toast);

8
src/case/button/item.singleselect.radio.js

@ -10,7 +10,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
logic: { logic: {
dynamic: false dynamic: false
}, },
hgap: 10,
height: 24 height: 24
}); });
}, },
@ -18,8 +17,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
BI.SingleSelectRadioItem.superclass._init.apply(this, arguments); BI.SingleSelectRadioItem.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.radio = BI.createWidget({ this.radio = BI.createWidget({
type: "bi.radio", type: "bi.radio"
once: o.once
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
@ -41,7 +39,7 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
items: BI.LogicFactory.createLogicItemsByDirection("left", { items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.radio], items: [this.radio],
width: 16 width: 26
}, this.text) }, this.text)
})))); }))));
}, },
@ -70,4 +68,4 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
}); });
BI.SingleSelectRadioItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectRadioItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_radio_item", BI.SingleSelectRadioItem); BI.shortcut("bi.single_select_radio_item", BI.SingleSelectRadioItem);

4
src/case/list/list.select.js

@ -173,7 +173,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
resetHeight: function (h) { resetHeight: function (h) {
var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0);
this.list.resetHeight ? this.list.resetHeight(h - toolHeight) : this.list.resetHeight ? this.list.resetHeight(h - toolHeight) :
this.list.element.css({"max-height": h - toolHeight + "px"}); this.list.element.css({"max-height": (h - toolHeight) / BI.pixRatio + BI.pixUnit});
}, },
setNotSelectedValue: function () { setNotSelectedValue: function () {
@ -214,4 +214,4 @@ BI.SelectList = BI.inherit(BI.Widget, {
} }
}); });
BI.SelectList.EVENT_CHANGE = "EVENT_CHANGE"; BI.SelectList.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.select_list", BI.SelectList); BI.shortcut("bi.select_list", BI.SelectList);

6
src/core/controller/controller.popover.js

@ -103,8 +103,8 @@ BI.PopoverController = BI.inherit(BI.Controller, {
top = 0; top = 0;
} }
popover.element.css({ popover.element.css({
left: left + "px", left: left / BI.pixRatio + BI.pixUnit,
top: top + "px" top: top / BI.pixRatio + BI.pixUnit
}); });
} }
return this; return this;
@ -153,4 +153,4 @@ BI.PopoverController = BI.inherit(BI.Controller, {
this.zindexMap = {}; this.zindexMap = {};
return this; return this;
} }
}); });

6
src/core/controller/controller.resizer.js

@ -18,7 +18,11 @@ BI.ResizeController = BI.inherit(BI.Controller, {
self._resize(ev); self._resize(ev);
// } // }
}, 30); }, 30);
BI.Widget._renderEngine.createElement(_global).resize(fn); if ("onorientationchange" in _global) {
_global.onorientationchange = fn;
} else {
BI.Widget._renderEngine.createElement(_global).resize(fn);
}
}, },
_resize: function (ev) { _resize: function (ev) {

6
src/core/controller/controller.tooltips.js

@ -99,8 +99,8 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
!opt.belowMouse && (y = Math.max(y, top)); !opt.belowMouse && (y = Math.max(y, top));
} }
tooltip.element.css({ tooltip.element.css({
left: x < 0 ? 0 : x + "px", left: x < 0 ? 0 : x / BI.pixRatio + BI.pixUnit,
top: y < 0 ? 0 : y + "px" top: y < 0 ? 0 : y / BI.pixRatio + BI.pixUnit
}); });
tooltip.element.hover(function () { tooltip.element.hover(function () {
self.remove(name); self.remove(name);
@ -137,4 +137,4 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
delete this.tooltipsManager[name]; delete this.tooltipsManager[name];
return this; return this;
} }
}); });

1
src/core/shortcut.js

@ -24,6 +24,7 @@
} }
var widget = new cls(); var widget = new cls();
widget._initProps(config); widget._initProps(config);
widget._constructed();
widget._initRoot(); widget._initRoot();
// if (!lazy || config.element || config.root) { // if (!lazy || config.element || config.root) {
widget._lazyConstructor(); widget._lazyConstructor();

4
src/core/var.js

@ -12,6 +12,8 @@ _.extend(BI, {
zIndex_masker: 1e8, zIndex_masker: 1e8,
zIndex_tip: 1e9, zIndex_tip: 1e9,
emptyStr: "", emptyStr: "",
pixUnit: "px",
pixRatio: 1,
emptyFn: function () { emptyFn: function () {
}, },
empty: null, empty: null,
@ -134,4 +136,4 @@ _.extend(BI, {
Stretch: "stretch" Stretch: "stretch"
}, },
StartOfWeek: 1 StartOfWeek: 1
}); });

31
src/core/widget.js

@ -7,7 +7,7 @@
*/ */
!(function () { !(function () {
function callLifeHook (self, life) { function callLifeHook(self, life) {
var hook = self.options[life] || self[life]; var hook = self.options[life] || self[life];
if (hook) { if (hook) {
var hooks = BI.isArray(hook) ? hook : [hook]; var hooks = BI.isArray(hook) ? hook : [hook];
@ -36,18 +36,23 @@
}); });
}, },
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructor: function () { _constructor: function () {
},
// 覆盖父类的_constructor方法,widget不走ob的生命周期
_constructed: function () {
if (this.setup) { if (this.setup) {
pushTarget(this); pushTarget(this);
this.render = this.setup(); this.service = this.setup(this.options);
this.render = BI.isPlainObject(this.service) ? this.service.render : this.service;
popTarget(); popTarget();
} }
}, },
_lazyConstructor: function () { _lazyConstructor: function () {
if (!this._constructed) { if (!this.__constructed) {
this._constructed = true; this.__constructed = true;
this._init(); this._init();
this._initRef(); this._initRef();
} }
@ -148,14 +153,14 @@
_initElementWidth: function () { _initElementWidth: function () {
var o = this.options; var o = this.options;
if (BI.isWidthOrHeight(o.width)) { if (BI.isWidthOrHeight(o.width)) {
this.element.css("width", o.width); this.element.css("width", BI.isNumber(o.width) ? o.width / BI.pixRatio + BI.pixUnit : o.width);
} }
}, },
_initElementHeight: function () { _initElementHeight: function () {
var o = this.options; var o = this.options;
if (BI.isWidthOrHeight(o.height)) { if (BI.isWidthOrHeight(o.height)) {
this.element.css("height", o.height); this.element.css("height", BI.isNumber(o.height) ? o.height / BI.pixRatio + BI.pixUnit : o.height);
} }
}, },
@ -192,9 +197,11 @@
} }
if (BI.isArray(els)) { if (BI.isArray(els)) {
BI.each(els, function (i, el) { BI.each(els, function (i, el) {
BI._lazyCreateWidget(el, { if (el) {
element: self BI._lazyCreateWidget(el, {
}); element: self
});
}
}); });
} }
// if (this._isRoot === true || !(this instanceof BI.Layout)) { // if (this._isRoot === true || !(this instanceof BI.Layout)) {
@ -527,12 +534,12 @@
BI.Widget.context = context = contextStack.pop(); BI.Widget.context = context = contextStack.pop();
}; };
function pushTarget (_current) { function pushTarget(_current) {
if (current) currentStack.push(current); if (current) currentStack.push(current);
BI.Widget.current = current = _current; BI.Widget.current = current = _current;
} }
function popTarget () { function popTarget() {
BI.Widget.current = current = currentStack.pop(); BI.Widget.current = current = currentStack.pop();
} }

8
src/core/wrapper/layout.js

@ -25,16 +25,16 @@ BI.Layout = BI.inherit(BI.Widget, {
_init4Margin: function () { _init4Margin: function () {
if (this.options.top) { if (this.options.top) {
this.element.css("top", this.options.top); this.element.css("top", BI.isNumber(this.options.top) ? this.options.top / BI.pixRatio + BI.pixUnit : this.options.top);
} }
if (this.options.left) { if (this.options.left) {
this.element.css("left", this.options.left); this.element.css("left", BI.isNumber(this.options.left) ? this.options.left / BI.pixRatio + BI.pixUnit : this.options.left);
} }
if (this.options.bottom) { if (this.options.bottom) {
this.element.css("bottom", this.options.bottom); this.element.css("bottom", BI.isNumber(this.options.bottom) ? this.options.bottom / BI.pixRatio + BI.pixUnit : this.options.bottom);
} }
if (this.options.right) { if (this.options.right) {
this.element.css("right", this.options.right); this.element.css("right", BI.isNumber(this.options.right) ? this.options.right / BI.pixRatio + BI.pixUnit : this.options.right);
} }
}, },

10
src/core/wrapper/layout/adapt/absolute.center.js

@ -26,10 +26,10 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, {
var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0), left: (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit,
right: o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0), right: (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit,
top: o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0), top: (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit,
bottom: o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0), bottom: (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit,
margin: "auto" margin: "auto"
}); });
return w; return w;
@ -44,4 +44,4 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.absolute_center_adapt", BI.AbsoluteCenterLayout); BI.shortcut("bi.absolute_center_adapt", BI.AbsoluteCenterLayout);

10
src/core/wrapper/layout/adapt/absolute.horizontal.js

@ -26,15 +26,15 @@ BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
var w = BI.AbsoluteHorizontalLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteHorizontalLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0), left: (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit,
right: o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0), right: (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit,
margin: "auto" margin: "auto"
}); });
if (o.vgap + o.tgap + (item.vgap || 0) + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.vgap || 0) + (item.tgap || 0) !== 0) {
w.element.css("top", o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)); w.element.css("top", (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit);
} }
if (o.vgap + o.bgap + (item.vgap || 0) + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.vgap || 0) + (item.bgap || 0) !== 0) {
w.element.css("bottom", o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)); w.element.css("bottom", (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit);
} }
return w; return w;
}, },
@ -48,4 +48,4 @@ BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.absolute_horizontal_adapt", BI.AbsoluteHorizontalLayout); BI.shortcut("bi.absolute_horizontal_adapt", BI.AbsoluteHorizontalLayout);

14
src/core/wrapper/layout/adapt/absolute.vertical.js

@ -26,17 +26,17 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
var w = BI.AbsoluteVerticalLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteVerticalLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: item.lgap, left: item.lgap / BI.pixRatio + BI.pixUnit,
right: item.rgap, right: item.rgap / BI.pixRatio + BI.pixUnit,
top: o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0), top: (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit,
bottom: o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0), bottom: (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit,
margin: "auto" margin: "auto"
}); });
if (o.hgap + o.lgap + (item.hgap || 0) + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.hgap || 0) + (item.lgap || 0) !== 0) {
w.element.css("left", o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)); w.element.css("left", (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit);
} }
if (o.hgap + o.rgap + (item.hgap || 0) + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.hgap || 0) + (item.rgap || 0) !== 0) {
w.element.css("right", o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)); w.element.css("right", (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit);
} }
return w; return w;
}, },
@ -50,4 +50,4 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.absolute_vertical_adapt", BI.AbsoluteVerticalLayout); BI.shortcut("bi.absolute_vertical_adapt", BI.AbsoluteVerticalLayout);

10
src/core/wrapper/layout/adapt/adapt.table.js

@ -53,7 +53,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
// 1、由于直接对td设置最大宽度是在规范中未定义的, 所以要使用类似td:firstChild来迂回实现 // 1、由于直接对td设置最大宽度是在规范中未定义的, 所以要使用类似td:firstChild来迂回实现
// 2、不能给多个td设置最大宽度,这样只会平分宽度 // 2、不能给多个td设置最大宽度,这样只会平分宽度
// 3、多百分比宽度就算了 // 3、多百分比宽度就算了
td.element.css({"max-width": o.columnSize[i] <= 1 ? width : width + "px"}); td.element.css({"max-width": o.columnSize[i] <= 1 ? width : width / BI.pixRatio + BI.pixUnit});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
@ -67,22 +67,22 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return td; return td;

10
src/core/wrapper/layout/adapt/auto.horizontal.js

@ -30,22 +30,22 @@ BI.HorizontalAutoLayout = BI.inherit(BI.Layout, {
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": (i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": ((i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "margin-left": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;
@ -60,4 +60,4 @@ BI.HorizontalAutoLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.horizontal_auto", BI.HorizontalAutoLayout); BI.shortcut("bi.horizontal_auto", BI.HorizontalAutoLayout);

70
src/core/wrapper/layout/adapt/float.horizontal.js

@ -1,70 +0,0 @@
/**
* 浮动的水平居中布局
*/
BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FloatHorizontalLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-float-horizontal-adapt-layout",
items: [],
hgap: 0,
vgap: 0,
tgap: 0,
bgap: 0,
lgap: 0,
rgap: 0
});
},
render: function () {
BI.FloatHorizontalLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items);
},
resize: function () {
// console.log("float_horizontal_adapt布局不需要resize");
},
mounted: function () {
var self = this;
var width = this.left.element.width(),
height = this.left.element.height();
this.left.element.width(width).height(height).css("float", "none");
BI.remove(this._children, function (i, wi) {
if (wi === self.container) {
delete self._children[i];
}
});
BI._lazyCreateWidget({
type: "bi.horizontal_auto",
element: this,
items: [this.left]
});
},
_addElement: function (i, item) {
var self = this, o = this.options;
this.left = BI._lazyCreateWidget({
type: "bi.vertical",
items: [item],
hgap: o.hgap,
vgap: o.vgap,
tgap: o.tgap,
bgap: o.bgap,
lgap: o.lgap,
rgap: o.rgap
});
this.container = BI._lazyCreateWidget({
type: "bi.left",
element: this,
items: [this.left]
});
return this.left;
},
populate: function (items) {
BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout);

10
src/core/wrapper/layout/adapt/inline.center.js

@ -38,29 +38,29 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.InlineCenterAdaptLayout.superclass._addElement.apply(this, arguments); var w = BI.InlineCenterAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i], width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative", position: "relative",
"vertical-align": o.verticalAlign "vertical-align": o.verticalAlign
}); });
w.element.addClass("inline-center-adapt-item"); w.element.addClass("inline-center-adapt-item");
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0))
}); });
} }
return w; return w;

10
src/core/wrapper/layout/adapt/inline.horizontal.js

@ -38,29 +38,29 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.InlineHorizontalAdaptLayout.superclass._addElement.apply(this, arguments); var w = BI.InlineHorizontalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i], width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative", position: "relative",
"vertical-align": o.verticalAlign "vertical-align": o.verticalAlign
}); });
w.element.addClass("inline-horizontal-adapt-item"); w.element.addClass("inline-horizontal-adapt-item");
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;

10
src/core/wrapper/layout/adapt/inline.vertical.js

@ -38,29 +38,29 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments); var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i], width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative", position: "relative",
"vertical-align": o.verticalAlign "vertical-align": o.verticalAlign
}); });
w.element.addClass("inline-vertical-adapt-item"); w.element.addClass("inline-vertical-adapt-item");
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;

10
src/core/wrapper/layout/flex/flex.horizontal.js

@ -40,29 +40,29 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
}); });
} }
if (o.columnSize[i] > 0) { if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]); w.element.width(o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
} }
if (o.columnSize[i] === "fill") { if (o.columnSize[i] === "fill") {
w.element.css("flex", "1"); w.element.css("flex", "1");
} }
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;

10
src/core/wrapper/layout/flex/flex.vertical.js

@ -39,29 +39,29 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
}); });
} }
if (o.rowSize[i] > 0) { if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? (o.rowSize[i] * 100 + "%") : o.rowSize[i]); w.element.height(o.rowSize[i] <= 1 ? (o.rowSize[i] * 100 + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
} }
if (o.rowSize[i] === "fill") { if (o.rowSize[i] === "fill") {
w.element.css("flex", "1"); w.element.css("flex", "1");
} }
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": (i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": ((i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;

10
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js

@ -41,29 +41,29 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
}); });
} }
if (o.columnSize[i] > 0) { if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]); w.element.width(o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
} }
if (o.columnSize[i] === "fill") { if (o.columnSize[i] === "fill") {
w.element.css("flex", "1"); w.element.css("flex", "1");
} }
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;

10
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

@ -41,29 +41,29 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
}); });
} }
if (o.rowSize[i] > 0) { if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? (o.rowSize[i] * 100 + "%") : o.rowSize[i]); w.element.height(o.rowSize[i] <= 1 ? (o.rowSize[i] * 100 + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
} }
if (o.rowSize[i] === "fill") { if (o.rowSize[i] === "fill") {
w.element.css("flex", "1"); w.element.css("flex", "1");
} }
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": (i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": ((i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;

31
src/core/wrapper/layout/layout.absolute.js

@ -25,58 +25,57 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments);
var left = 0, right = 0, top = 0, bottom = 0; var left = 0, right = 0, top = 0, bottom = 0;
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({left: item.left}); w.element.css({left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left});
left += item.left; left += item.left;
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({right: item.right}); w.element.css({right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right});
right += item.right; right += item.right;
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top});
top += item.top; top += item.top;
} }
if (BI.isNotNull(item.bottom)) { if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom}); w.element.css({bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom});
bottom += item.bottom; bottom += item.bottom;
} }
if (BI.isNotNull(o.hgap)) { if (BI.isNotNull(o.hgap)) {
left += o.hgap; left += o.hgap;
w.element.css({left: left}); w.element.css({left: left / BI.pixRatio + BI.pixUnit});
right += o.hgap; right += o.hgap;
w.element.css({right: right}); w.element.css({right: right / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.vgap)) { if (BI.isNotNull(o.vgap)) {
top += o.vgap; top += o.vgap;
w.element.css({top: top}); w.element.css({top: top / BI.pixRatio + BI.pixUnit});
bottom += o.vgap; bottom += o.vgap;
w.element.css({bottom: bottom}); w.element.css({bottom: bottom / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.lgap)) { if (BI.isNotNull(o.lgap)) {
left += o.lgap; left += o.lgap;
w.element.css({left: left}); w.element.css({left: left / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.rgap)) { if (BI.isNotNull(o.rgap)) {
right += o.rgap; right += o.rgap;
w.element.css({right: right}); w.element.css({right: right / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.tgap)) { if (BI.isNotNull(o.tgap)) {
top += o.tgap; top += o.tgap;
w.element.css({top: top}); w.element.css({top: top / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.bgap)) { if (BI.isNotNull(o.bgap)) {
bottom += o.bgap; bottom += o.bgap;
w.element.css({bottom: bottom}); w.element.css({bottom: bottom / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(item.width)) { if (BI.isNotNull(item.width)) {
w.element.css({width: item.width}); w.element.css({width: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : item.width});
} }
if (BI.isNotNull(item.height)) { if (BI.isNotNull(item.height)) {
w.element.css({height: item.height}); w.element.css({height: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : item.height});
} }
w.element.css({position: "absolute"}); w.element.css({position: "absolute"});
return w; return w;
@ -104,4 +103,4 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.absolute", BI.AbsoluteLayout); BI.shortcut("bi.absolute", BI.AbsoluteLayout);

30
src/core/wrapper/layout/layout.adaptive.js

@ -22,60 +22,60 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, {
var left = 0, right = 0, top = 0, bottom = 0; var left = 0, right = 0, top = 0, bottom = 0;
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({ w.element.css({
left: item.left left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left
}); });
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({ w.element.css({
right: item.right right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right
}); });
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({ w.element.css({
top: item.top top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top
}); });
} }
if (BI.isNotNull(item.bottom)) { if (BI.isNotNull(item.bottom)) {
w.element.css({ w.element.css({
bottom: item.bottom bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom
}); });
} }
if (BI.isNotNull(o.hgap)) { if (BI.isNotNull(o.hgap)) {
left += o.hgap; left += o.hgap;
w.element.css({"margin-left": left}); w.element.css({"margin-left": left / BI.pixRatio + BI.pixUnit});
right += o.hgap; right += o.hgap;
w.element.css({"margin-right": right}); w.element.css({"margin-right": right / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.vgap)) { if (BI.isNotNull(o.vgap)) {
top += o.vgap; top += o.vgap;
w.element.css({"margin-top": top}); w.element.css({"margin-top": top / BI.pixRatio + BI.pixUnit});
bottom += o.vgap; bottom += o.vgap;
w.element.css({"margin-bottom": bottom}); w.element.css({"margin-bottom": bottom / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.lgap)) { if (BI.isNotNull(o.lgap)) {
left += o.lgap; left += o.lgap;
w.element.css({"margin-left": left}); w.element.css({"margin-left": left / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.rgap)) { if (BI.isNotNull(o.rgap)) {
right += o.rgap; right += o.rgap;
w.element.css({"margin-right": right}); w.element.css({"margin-right": right / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.tgap)) { if (BI.isNotNull(o.tgap)) {
top += o.tgap; top += o.tgap;
w.element.css({"margin-top": top}); w.element.css({"margin-top": top / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(o.bgap)) { if (BI.isNotNull(o.bgap)) {
bottom += o.bgap; bottom += o.bgap;
w.element.css({"margin-bottom": bottom}); w.element.css({"margin-bottom": bottom / BI.pixRatio + BI.pixUnit});
} }
if (BI.isNotNull(item.width)) { if (BI.isNotNull(item.width)) {
w.element.css({width: item.width}); w.element.css({width: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : item.width});
} }
if (BI.isNotNull(item.height)) { if (BI.isNotNull(item.height)) {
w.element.css({height: item.height}); w.element.css({height: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : item.height});
} }
return w; return w;
}, },
@ -89,4 +89,4 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.adaptive", BI.AdaptiveLayout); BI.shortcut("bi.adaptive", BI.AdaptiveLayout);

40
src/core/wrapper/layout/layout.border.js

@ -39,12 +39,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("north"), w); this.addWidget(this._getChildName("north"), w);
} }
this.getWidgetByName(this._getChildName("north")).element.height(item.height) this.getWidgetByName(this._getChildName("north")).element.height(item.height / BI.pixRatio + BI.pixUnit)
.css({ .css({
position: "absolute", position: "absolute",
top: (item.top || 0), top: (item.top || 0) / BI.pixRatio + BI.pixUnit,
left: (item.left || 0), left: (item.left || 0) / BI.pixRatio + BI.pixUnit,
right: (item.right || 0), right: (item.right || 0) / BI.pixRatio + BI.pixUnit,
bottom: "initial" bottom: "initial"
}); });
} }
@ -59,12 +59,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("south"), w); this.addWidget(this._getChildName("south"), w);
} }
this.getWidgetByName(this._getChildName("south")).element.height(item.height) this.getWidgetByName(this._getChildName("south")).element.height(item.height / BI.pixRatio + BI.pixUnit)
.css({ .css({
position: "absolute", position: "absolute",
bottom: (item.bottom || 0), bottom: (item.bottom || 0) / BI.pixRatio + BI.pixUnit,
left: (item.left || 0), left: (item.left || 0) / BI.pixRatio + BI.pixUnit,
right: (item.right || 0), right: (item.right || 0) / BI.pixRatio + BI.pixUnit,
top: "initial" top: "initial"
}); });
} }
@ -79,12 +79,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("west"), w); this.addWidget(this._getChildName("west"), w);
} }
this.getWidgetByName(this._getChildName("west")).element.width(item.width) this.getWidgetByName(this._getChildName("west")).element.width(item.width / BI.pixRatio + BI.pixUnit)
.css({ .css({
position: "absolute", position: "absolute",
left: (item.left || 0), left: (item.left || 0) / BI.pixRatio + BI.pixUnit,
top: top, top: top / BI.pixRatio + BI.pixUnit,
bottom: bottom, bottom: bottom / BI.pixRatio + BI.pixUnit,
right: "initial" right: "initial"
}); });
} }
@ -99,12 +99,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("east"), w); this.addWidget(this._getChildName("east"), w);
} }
this.getWidgetByName(this._getChildName("east")).element.width(item.width) this.getWidgetByName(this._getChildName("east")).element.width(item.width / BI.pixRatio + BI.pixUnit)
.css({ .css({
position: "absolute", position: "absolute",
right: (item.right || 0), right: (item.right || 0) / BI.pixRatio + BI.pixUnit,
top: top, top: top / BI.pixRatio + BI.pixUnit,
bottom: bottom, bottom: bottom / BI.pixRatio + BI.pixUnit,
left: "initial" left: "initial"
}); });
} }
@ -119,7 +119,13 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
this.addWidget(this._getChildName("center"), w); this.addWidget(this._getChildName("center"), w);
} }
this.getWidgetByName(this._getChildName("center")).element this.getWidgetByName(this._getChildName("center")).element
.css({position: "absolute", top: top, bottom: bottom, left: left, right: right}); .css({
position: "absolute",
top: top / BI.pixRatio + BI.pixUnit,
bottom: bottom / BI.pixRatio + BI.pixUnit,
left: left / BI.pixRatio + BI.pixUnit,
right: right / BI.pixRatio + BI.pixUnit
});
} }
} }
}, },

10
src/core/wrapper/layout/layout.default.js

@ -26,22 +26,22 @@ BI.DefaultLayout = BI.inherit(BI.Layout, {
var w = BI.DefaultLayout.superclass._addElement.apply(this, arguments); var w = BI.DefaultLayout.superclass._addElement.apply(this, arguments);
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": (o.hgap + o.lgap + (item.lgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;
@ -56,4 +56,4 @@ BI.DefaultLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.default", BI.DefaultLayout); BI.shortcut("bi.default", BI.DefaultLayout);

34
src/core/wrapper/layout/layout.flow.js

@ -29,35 +29,35 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments); var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments);
w.element.css({position: "relative", float: "left"}); w.element.css({position: "relative", float: "left"});
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({left: item.left}); w.element.css({left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left});
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({right: item.right}); w.element.css({right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right});
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top});
} }
if (BI.isNotNull(item.bottom)) { if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom}); w.element.css({bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom});
} }
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;
@ -105,35 +105,35 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments); var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments);
w.element.css({position: "relative", float: "right"}); w.element.css({position: "relative", float: "right"});
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({left: item.left}); w.element.css({left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left});
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({right: item.right}); w.element.css({right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right});
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({top: item.top}); w.element.css({top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top});
} }
if (BI.isNotNull(item.bottom)) { if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: item.bottom}); w.element.css({bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom});
} }
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "margin-left": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": (i === 0 ? o.hgap : 0) + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": ((i === 0 ? o.hgap : 0) + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;
@ -148,4 +148,4 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.right", BI.FloatRightLayout); BI.shortcut("bi.right", BI.FloatRightLayout);

18
src/core/wrapper/layout/layout.horizontal.js

@ -60,7 +60,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
// 1、由于直接对td设置最大宽度是在规范中未定义的, 所以要使用类似td:firstChild来迂回实现 // 1、由于直接对td设置最大宽度是在规范中未定义的, 所以要使用类似td:firstChild来迂回实现
// 2、不能给多个td设置最大宽度,这样只会平分宽度 // 2、不能给多个td设置最大宽度,这样只会平分宽度
// 3、多百分比宽度就算了 // 3、多百分比宽度就算了
td.element.css({"max-width": o.columnSize[i] <= 1 ? width : width + "px"}); td.element.css({"max-width": o.columnSize[i] <= 1 ? width : width / BI.pixRatio + BI.pixUnit});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
@ -74,22 +74,22 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return td; return td;
@ -145,22 +145,22 @@ BI.HorizontalCellLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative", display: "table-cell", "vertical-align": "middle"}); w.element.css({position: "relative", display: "table-cell", "vertical-align": "middle"});
if (o.hgap + o.lgap > 0) { if (o.hgap + o.lgap > 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + "px" "margin-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap > 0) { if (o.hgap + o.rgap > 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + "px" "margin-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.tgap > 0) { if (o.vgap + o.tgap > 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + "px" "margin-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap > 0) { if (o.vgap + o.bgap > 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + "px" "margin-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;

10
src/core/wrapper/layout/layout.inline.js

@ -32,22 +32,22 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
w.element.css({"position": "relative", display: "inline-block", "*display": "inline", "*zoom": 1}); w.element.css({"position": "relative", display: "inline-block", "*display": "inline", "*zoom": 1});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;
@ -62,4 +62,4 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.inline", BI.InlineLayout); BI.shortcut("bi.inline", BI.InlineLayout);

2
src/core/wrapper/layout/layout.table.js

@ -117,7 +117,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
}); });
if (this.rows > 0) { if (this.rows > 0) {
this.getWidgetByName(this._getChildName(this.rows - 1)).element.css({ this.getWidgetByName(this._getChildName(this.rows - 1)).element.css({
"margin-bottom": o.vgap "margin-bottom": o.vgap / BI.pixRatio + BI.pixUnit
}); });
} }
w.element.css({ w.element.css({

28
src/core/wrapper/layout/layout.tape.js

@ -52,7 +52,11 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
} else { } else {
w = self.getWidgetByName(self._getChildName(i)); w = self.getWidgetByName(self._getChildName(i));
} }
w.element.css({position: "absolute", top: (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap + "px", bottom: (item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap + "px"}); w.element.css({
position: "absolute",
top: ((item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
bottom: ((item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
});
}); });
var left = {}, right = {}; var left = {}, right = {};
@ -68,8 +72,8 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
w.element.css({left: left[i] * 100 + "%", width: item.width * 100 + "%"}); w.element.css({left: left[i] * 100 + "%", width: item.width * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
left: left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap + "px", left: (left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
width: BI.isNumber(item.width) ? item.width : "" width: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.width)) { if (!BI.isNumber(item.width)) {
@ -85,8 +89,8 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
w.element.css({right: right[i] * 100 + "%", width: item.width * 100 + "%"}); w.element.css({right: right[i] * 100 + "%", width: item.width * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
right: right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap + "px", right: (right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
width: BI.isNumber(item.width) ? item.width : "" width: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.width)) { if (!BI.isNumber(item.width)) {
@ -165,7 +169,11 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
} else { } else {
w = self.getWidgetByName(self._getChildName(i)); w = self.getWidgetByName(self._getChildName(i));
} }
w.element.css({position: "absolute", left: (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap + "px", right: + (item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap + "px"}); w.element.css({
position: "absolute",
left: ((item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
right: +((item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
});
}); });
var top = {}, bottom = {}; var top = {}, bottom = {};
@ -181,8 +189,8 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
w.element.css({top: top[i] * 100 + "%", height: item.height * 100 + "%"}); w.element.css({top: top[i] * 100 + "%", height: item.height * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
top: top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap + "px", top: (top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
height: BI.isNumber(item.height) ? item.height : "" height: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.height)) { if (!BI.isNumber(item.height)) {
@ -198,8 +206,8 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
w.element.css({bottom: bottom[i] * 100 + "%", height: item.height * 100 + "%"}); w.element.css({bottom: bottom[i] * 100 + "%", height: item.height * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
bottom: bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap + "px", bottom: (bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
height: BI.isNumber(item.height) ? item.height : "" height: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.height)) { if (!BI.isNumber(item.height)) {

12
src/core/wrapper/layout/layout.td.js

@ -86,23 +86,21 @@ BI.TdLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(arr[i]); var w = BI._lazyCreateWidget(arr[i]);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) { if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap + "px"}); w.element.css({"margin-left": arr[i].lgap / BI.pixRatio + BI.pixUnit});
} }
if (arr[i].rgap) { if (arr[i].rgap) {
w.element.css({"margin-right": arr[i].rgap + "px"}); w.element.css({"margin-right": arr[i].rgap / BI.pixRatio + BI.pixUnit});
} }
if (arr[i].tgap) { if (arr[i].tgap) {
w.element.css({"margin-top": arr[i].tgap + "px"}); w.element.css({"margin-top": arr[i].tgap / BI.pixRatio + BI.pixUnit});
} }
if (arr[i].bgap) { if (arr[i].bgap) {
w.element.css({"margin-bottom": arr[i].bgap + "px"}); w.element.css({"margin-bottom": arr[i].bgap / BI.pixRatio + BI.pixUnit});
} }
first(w, this.rows++, i); first(w, this.rows++, i);
var td = BI._lazyCreateWidget({ var td = BI._lazyCreateWidget({
type: "bi.default", type: "bi.default",
attributes: { width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i],
width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]
},
tagName: "td", tagName: "td",
items: [w] items: [w]
}); });

10
src/core/wrapper/layout/layout.vertical.js

@ -29,22 +29,22 @@ BI.VerticalLayout = BI.inherit(BI.Layout, {
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": (i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" "margin-top": ((i === 0 ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "margin-left": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px" "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
}); });
} }
return w; return w;
@ -59,4 +59,4 @@ BI.VerticalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut("bi.vertical", BI.VerticalLayout); BI.shortcut("bi.vertical", BI.VerticalLayout);

16
src/core/wrapper/layout/layout.window.js

@ -114,9 +114,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNull(top[i])) { if (BI.isNull(top[i])) {
top[i] = top[i - 1] + (o.rowSize[i - 1] < 1 ? o.rowSize[i - 1] : o.rowSize[i - 1] + o.vgap + o.bgap); top[i] = top[i - 1] + (o.rowSize[i - 1] < 1 ? o.rowSize[i - 1] : o.rowSize[i - 1] + o.vgap + o.bgap);
} }
var t = top[i] <= 1 ? top[i] * 100 + "%" : top[i] + o.vgap + o.tgap + "px", h = ""; var t = top[i] <= 1 ? top[i] * 100 + "%" : (top[i] + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit, h = "";
if (BI.isNumber(o.rowSize[i])) { if (BI.isNumber(o.rowSize[i])) {
h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] / BI.pixRatio + BI.pixUnit;
} }
wi.element.css({top: t, height: h}); wi.element.css({top: t, height: h});
first(wi, i, j); first(wi, i, j);
@ -132,9 +132,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNull(bottom[i])) { if (BI.isNull(bottom[i])) {
bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] < 1 ? o.rowSize[i + 1] : o.rowSize[i + 1] + o.vgap + o.tgap); bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] < 1 ? o.rowSize[i + 1] : o.rowSize[i + 1] + o.vgap + o.tgap);
} }
var b = bottom[i] <= 1 ? bottom[i] * 100 + "%" : bottom[i] + o.vgap + o.bgap + "px", h = ""; var b = bottom[i] <= 1 ? bottom[i] * 100 + "%" : (bottom[i] + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit, h = "";
if (BI.isNumber(o.rowSize[i])) { if (BI.isNumber(o.rowSize[i])) {
h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] / BI.pixRatio + BI.pixUnit;
} }
wi.element.css({bottom: b, height: h}); wi.element.css({bottom: b, height: h});
first(wi, i, j); first(wi, i, j);
@ -150,9 +150,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNull(left[j])) { if (BI.isNull(left[j])) {
left[j] = left[j - 1] + (o.columnSize[j - 1] < 1 ? o.columnSize[j - 1] : o.columnSize[j - 1] + o.hgap + o.rgap); left[j] = left[j - 1] + (o.columnSize[j - 1] < 1 ? o.columnSize[j - 1] : o.columnSize[j - 1] + o.hgap + o.rgap);
} }
var l = left[j] <= 1 ? left[j] * 100 + "%" : left[j] + o.hgap + o.lgap + "px", w = ""; var l = left[j] <= 1 ? left[j] * 100 + "%" : (left[j] + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit, w = "";
if (BI.isNumber(o.columnSize[j])) { if (BI.isNumber(o.columnSize[j])) {
w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] / BI.pixRatio + BI.pixUnit;
} }
wi.element.css({left: l, width: w}); wi.element.css({left: l, width: w});
first(wi, i, j); first(wi, i, j);
@ -168,9 +168,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNull(right[j])) { if (BI.isNull(right[j])) {
right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap); right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap);
} }
var r = right[j] <= 1 ? right[j] * 100 + "%" : right[j] + o.hgap + o.rgap + "px", w = ""; var r = right[j] <= 1 ? right[j] * 100 + "%" : (right[j] + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit, w = "";
if (BI.isNumber(o.columnSize[j])) { if (BI.isNumber(o.columnSize[j])) {
w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] / BI.pixRatio + BI.pixUnit;
} }
wi.element.css({right: r, width: w}); wi.element.css({right: r, width: w});
first(wi, i, j); first(wi, i, j);

8
src/core/wrapper/layout/middle/middle.center.js

@ -35,10 +35,10 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
right: o.hgap + o.rgap, right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
top: o.vgap + o.tgap, top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
bottom: o.vgap + o.bgap, bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
width: "auto", width: "auto",
height: "auto" height: "auto"
}); });

8
src/core/wrapper/layout/middle/middle.float.center.js

@ -36,10 +36,10 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
right: o.hgap + o.rgap, right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
top: o.vgap + o.tgap, top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
bottom: o.vgap + o.bgap, bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
width: "auto", width: "auto",
height: "auto" height: "auto"
}); });

8
src/core/wrapper/layout/middle/middle.horizontal.js

@ -34,10 +34,10 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
right: o.hgap + o.rgap, right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
top: o.vgap + o.tgap, top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
bottom: o.vgap + o.bgap, bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
width: "auto" width: "auto"
}); });
list[i].el.addItem(w); list[i].el.addItem(w);

8
src/core/wrapper/layout/middle/middle.vertical.js

@ -35,10 +35,10 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: o.hgap + o.lgap, left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
right: o.hgap + o.rgap, right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
top: o.vgap + o.tgap, top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
bottom: o.vgap + o.bgap, bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
height: "auto" height: "auto"
}); });
list[i].el.addItem(w); list[i].el.addItem(w);

12
src/less/base/segment/button.segment.less

@ -1,5 +1,15 @@
@import "../../index"; @import "../../index";
.bi-segment-button{ .bi-segment-button {
color: @color-bi-text-highlight; color: @color-bi-text-highlight;
&.active {
&:active {
color: @color-bi-text;
background-color: @color-bi-background-highlight;
}
}
&:active {
color: @color-bi-text-highlight;
.background-color(@color-bi-background-highlight, 10%);
}
} }

790
src/less/core/utils/common.less

@ -1,17 +1,5 @@
@import "../../index"; @import "../../index";
input,
textarea {
border: 1px solid @color-bi-border-line;
}
.bi-theme-dark {
input,
textarea {
border: 1px solid @color-bi-border-line-theme-dark;
}
}
.base-disabled { .base-disabled {
cursor: not-allowed !important; cursor: not-allowed !important;
color: @color-bi-text-disabled !important; color: @color-bi-text-disabled !important;
@ -41,6 +29,11 @@ textarea {
} }
} }
.base-invalid {
cursor: default !important;
}
//focus时边框高亮
.bi-focus-shadow { .bi-focus-shadow {
&:focus, &:hover { &:focus, &:hover {
border-color: @color-bi-border-highlight; border-color: @color-bi-border-highlight;
@ -66,15 +59,11 @@ textarea {
} }
} }
.base-invalid {
cursor: default !important;
}
.clearfix { .clearfix {
.clearfix(); .clearfix();
} }
//基本背景 //基本背景
.bi-background { .bi-background {
background-color: @color-bi-background-normal; background-color: @color-bi-background-normal;
color: @color-bi-text-normal; color: @color-bi-text-normal;
@ -148,6 +137,7 @@ textarea {
} }
} }
//灰化
.bi-disabled { .bi-disabled {
color: @color-bi-text-disabled; color: @color-bi-text-disabled;
& .bi-input { & .bi-input {
@ -170,7 +160,7 @@ textarea {
} }
} }
//提示区域, 灰色字体 // 提示区域, 灰色字体
.bi-tips { .bi-tips {
color: @color-bi-text-tips; color: @color-bi-text-tips;
& .bi-input { & .bi-input {
@ -181,7 +171,7 @@ textarea {
} }
} }
//边框 // 边框
.bi-border { .bi-border {
border: 1px solid @color-bi-border-line; border: 1px solid @color-bi-border-line;
&.disabled { &.disabled {
@ -254,7 +244,7 @@ textarea {
} }
} }
//分割线 // 分割线
.bi-split { .bi-split {
border: 1px solid @border-color-light-line; border: 1px solid @border-color-light-line;
} }
@ -334,7 +324,7 @@ textarea {
font-weight: 700; font-weight: 700;
} }
//标红 // 标红
.bi-keyword-red-mark { .bi-keyword-red-mark {
color: @color-bi-text-redmark; color: @color-bi-text-redmark;
& .bi-input { & .bi-input {
@ -345,7 +335,7 @@ textarea {
} }
} }
//高亮 // 高亮
.bi-high-light { .bi-high-light {
color: @color-bi-text-highlight; color: @color-bi-text-highlight;
& .bi-input { & .bi-input {
@ -423,7 +413,7 @@ textarea {
} }
} }
//水印 // 水印
.bi-water-mark { .bi-water-mark {
color: @font-color-tips; color: @font-color-tips;
cursor: text; cursor: text;
@ -448,7 +438,7 @@ textarea {
} }
} }
//resize // resizer
.bi-resizer { .bi-resizer {
background: @color-bi-background-black; background: @color-bi-background-black;
.opacity(0.2); .opacity(0.2);
@ -461,38 +451,33 @@ textarea {
} }
} }
// 蒙板
.bi-mask { .bi-mask {
color: @color-bi-background-default; color: @color-bi-text;
& .bi-input { & .bi-input {
color: @color-bi-background-default; color: @color-bi-text;
} }
& .bi-textarea { & .bi-textarea {
color: @color-bi-background-default; color: @color-bi-text;
} }
.background-color(@color-bi-background-black, 20%); .background-color(@color-bi-background-black, 20%);
} }
.bi-theme-dark { .bi-theme-dark {
.bi-mask { .bi-mask {
color: @color-bi-background-default-theme-dark; color: @color-bi-text-white-theme-dark;
& .bi-input { & .bi-input {
color: @color-bi-background-default-theme-dark; color: @color-bi-text-white-theme-dark;
} }
& .bi-textarea { & .bi-textarea {
color: @color-bi-background-default-theme-dark; color: @color-bi-text-white-theme-dark;
} }
.background-color(@color-bi-background-default, 20%); .background-color(@color-bi-background-default, 20%);
} }
} }
// 遮罩
.bi-z-index-mask { .bi-z-index-mask {
//color: @color-bi-background-default;
//& .bi-input {
// color: @color-bi-background-default;
//}
//& .bi-textarea {
// color: @color-bi-background-default;
//}
.background-color(@color-bi-background-black, 50%); .background-color(@color-bi-background-black, 50%);
} }
@ -508,734 +493,3 @@ textarea {
.background-color(@color-bi-background-black-theme-dark, 50%); .background-color(@color-bi-background-black-theme-dark, 50%);
} }
} }
//只有背景变化
.bi-list-item {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
.background-color(@color-bi-background-highlight, 10%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-highlight, 10%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
.bi-list-item-border {
&:active, &.active {
border: 1px solid @color-bi-border-highlight;
}
}
//极简,hover文字高亮一下
.bi-list-item-simple {
&:hover, &.hover {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
// 只有文字在hover和active时变化
.bi-list-item-effect {
&:hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
}
&.active, &:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-effect {
&:hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
}
&.active, &:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
//文字和背景hover和active时变化, hover和点击时文本和背景变化,active后文本变化,背景不变化
.bi-list-item-active {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
.background-color(@color-bi-background-highlight, 10%);
}
&:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-highlight, 15%);
}
&.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-active {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-default, 5%);
}
&.active, &:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-default, 5%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
//文字和背景hover和active时变化 hover
.bi-list-item-active2 {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
.background-color(@color-bi-background-highlight, 10%);
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-highlight, 15%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-active2 {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-highlight, 10%);
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-highlight, 15%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
// 激活和选中时背景高亮
.bi-list-item-select {
&:hover, &.hover {
.background-color(@color-bi-background-highlight, 10%);
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-highlight;
& .bi-high-light {
color: @color-bi-text;
}
}
&.button-success {
&:active, &.active {
color: @color-bi-text;
background-color: @color-bi-background-success;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
& .bi-high-light {
color: @color-bi-text;
}
&.bi-high-light-border {
border-color: @color-bi-border-success;
}
}
}
&.button-warning {
& {
color: @color-bi-text-failure;
& .bi-input {
color: @color-bi-text-failure;
}
& .bi-textarea {
color: @color-bi-text-failure;
}
& .bi-high-light {
color: @color-bi-text-failure;
}
&.bi-high-light-border {
border-color: @color-bi-border-failure;
}
}
&:hover, &.hover {
color: @color-bi-text-failure;
& .bi-input {
color: @color-bi-text-failure;
}
& .bi-textarea {
color: @color-bi-text-failure;
}
background-color: @color-bi-background-light-failure;
& .bi-high-light {
color: @color-bi-text-failure;
}
&.bi-high-light-border {
border-color: @color-bi-border-failure;
}
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-failure;
& .bi-high-light {
color: @color-bi-text;
}
&.bi-high-light-border {
border-color: @color-bi-border-failure;
}
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
background-color: transparent !important;
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
&.bi-high-light-border {
border-color: @color-bi-border-disabled;
}
&.hover, &.active {
color: @color-bi-text !important;
& .bi-input {
color: @color-bi-text !important;
}
& .bi-textarea {
color: @color-bi-text !important;
}
background-color: @color-bi-background-dark-gray !important;
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
&.bi-high-light-border {
border-color: @color-bi-border-disabled;
}
}
}
}
}
.bi-theme-dark {
.bi-list-item-select {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-default, 5%);
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-highlight;
& .bi-high-light {
color: @color-bi-text;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
&.hover, &.active {
background-color: @background-color-black-theme-dark !important;
}
}
}
}
//文字和背景hover和active时变化 hover和点击时边框变化,active后背景和边框变化
.bi-list-item-select2 {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
&.bi-border {
border-color: @color-bi-border-highlight;
}
}
&:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
&.bi-border {
border-color: @color-bi-border-highlight;
}
}
&.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
&.bi-border {
border-color: @color-bi-border-highlight;
}
background-color: @color-bi-background-highlight;
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-select2 {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
}
&.active {
background-color: @color-bi-background-default-theme-dark;
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
&.active {
background-color: @background-color-black-theme-dark !important;
}
}
}
}
//与bi-list-item-select的区别是背景是灰的
.bi-list-item-select3 {
&:hover, &.hover {
background-color: @color-bi-background-normal;
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
background-color: @color-bi-background-normal;
}
&.disabled {
&:hover, &.hover, &:active, &.active {
background-color: @color-bi-background-default !important;
}
}
}
.bi-theme-dark {
.bi-list-item-select3 {
&:hover, &.hover {
background-color: @color-bi-background-normal-theme-dark;
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
background-color: @color-bi-background-normal-theme-dark;
}
&.disabled {
&:hover, &.hover, &:active, &.active {
background-color: @color-bi-background-default-theme-dark !important;
}
}
}
}
//去掉list-item效果
.bi-list-item-none {
&:hover, &.hover {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
}
&:active, &.active {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
& .bi-high-light {
color: inherit;
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
background-color: transparent !important;
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-none {
&:hover, &.hover {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
}
&:active, &.active {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
& .bi-high-light {
color: inherit;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
.bi-user-select-enable {
.user-select-enable();
}
.bi-user-select-disable {
.user-select-disable();
}

732
src/less/core/utils/list-item.less

@ -0,0 +1,732 @@
@import "../../index";
// hover的时候背景变化,文字变黑
.bi-list-item {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
.background-color(@color-bi-background-highlight, 10%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-highlight, 10%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
// active的时候边框高亮
.bi-list-item-border {
&:active, &.active {
border: 1px solid @color-bi-border-highlight;
}
}
// 极简,hover的时候文字高亮
.bi-list-item-simple {
&:hover, &.hover {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
// hover的时候文字变黑
// active的时候文字高亮
.bi-list-item-effect {
&:hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
}
&.active, &:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-effect {
&:hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
}
&.active, &:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
// hover的时候背景变化,文字变黑
// :active的时候文字高亮,背景变化
.bi-list-item-active {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
.background-color(@color-bi-background-highlight, 10%);
}
&:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-highlight, 15%);
}
&.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-active {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-default, 5%);
}
&.active, &:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-default, 5%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
// hover的时候背景变化,文字变黑
// active的时候文字高亮,背景变化
.bi-list-item-active2 {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
.background-color(@color-bi-background-highlight, 10%);
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-highlight, 15%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-active2 {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-highlight, 10%);
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
.background-color(@color-bi-background-highlight, 15%);
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}
// hover的时候背景变化
// active的时候背景高亮
.bi-list-item-select {
&:hover, &.hover {
.background-color(@color-bi-background-highlight, 10%);
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-highlight;
& .bi-high-light {
color: @color-bi-text;
}
}
&.button-success {
&:active, &.active {
color: @color-bi-text;
background-color: @color-bi-background-success;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
& .bi-high-light {
color: @color-bi-text;
}
&.bi-high-light-border {
border-color: @color-bi-border-success;
}
}
}
&.button-warning {
& {
color: @color-bi-text-failure;
& .bi-input {
color: @color-bi-text-failure;
}
& .bi-textarea {
color: @color-bi-text-failure;
}
& .bi-high-light {
color: @color-bi-text-failure;
}
&.bi-high-light-border {
border-color: @color-bi-border-failure;
}
}
&:hover, &.hover {
color: @color-bi-text-failure;
& .bi-input {
color: @color-bi-text-failure;
}
& .bi-textarea {
color: @color-bi-text-failure;
}
background-color: @color-bi-background-light-failure;
& .bi-high-light {
color: @color-bi-text-failure;
}
&.bi-high-light-border {
border-color: @color-bi-border-failure;
}
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-failure;
& .bi-high-light {
color: @color-bi-text;
}
&.bi-high-light-border {
border-color: @color-bi-border-failure;
}
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
background-color: transparent !important;
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
&.bi-high-light-border {
border-color: @color-bi-border-disabled;
}
&.hover, &.active {
color: @color-bi-text !important;
& .bi-input {
color: @color-bi-text !important;
}
& .bi-textarea {
color: @color-bi-text !important;
}
background-color: @color-bi-background-dark-gray !important;
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
&.bi-high-light-border {
border-color: @color-bi-border-disabled;
}
}
}
}
}
.bi-theme-dark {
.bi-list-item-select {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
.background-color(@color-bi-background-default, 5%);
}
&:active, &.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
background-color: @color-bi-background-highlight;
& .bi-high-light {
color: @color-bi-text;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
&.hover, &.active {
background-color: @background-color-black-theme-dark !important;
}
}
}
}
// hover的时候边框高亮,文字变黑
// :active的时候文字高亮,边框高亮
// .active的时候背景高亮,边框高亮
.bi-list-item-select2 {
&:hover, &.hover {
color: @color-bi-text-black;
& .bi-input {
color: @color-bi-text-black;
}
& .bi-textarea {
color: @color-bi-text-black;
}
&.bi-border {
border-color: @color-bi-border-highlight;
}
}
&:active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
&.bi-border {
border-color: @color-bi-border-highlight;
}
}
&.active {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
&.bi-border {
border-color: @color-bi-border-highlight;
}
background-color: @color-bi-background-highlight;
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-select2 {
&:hover, &.hover {
color: @color-bi-text;
& .bi-input {
color: @color-bi-text;
}
& .bi-textarea {
color: @color-bi-text;
}
}
&.active {
background-color: @color-bi-background-default-theme-dark;
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
&.active {
background-color: @background-color-black-theme-dark !important;
}
}
}
}
// hover的时候背景变化 -- 变灰
// active的时候文字高亮背景变化 -- 变灰
.bi-list-item-select3 {
&:hover, &.hover {
background-color: @color-bi-background-normal;
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
background-color: @color-bi-background-normal;
}
&.disabled {
&:hover, &.hover, &:active, &.active {
background-color: @color-bi-background-default !important;
}
}
}
.bi-theme-dark {
.bi-list-item-select3 {
&:hover, &.hover {
background-color: @color-bi-background-normal-theme-dark;
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
background-color: @color-bi-background-normal-theme-dark;
}
&.disabled {
&:hover, &.hover, &:active, &.active {
background-color: @color-bi-background-default-theme-dark !important;
}
}
}
}
// 去掉list-item效果
.bi-list-item-none {
&:hover, &.hover {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
}
&:active, &.active {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
& .bi-high-light {
color: inherit;
}
}
&.disabled {
&, &:hover, &:active {
color: @color-bi-text-disabled !important;
& .bi-input {
color: @color-bi-text-disabled !important;
}
& .bi-textarea {
color: @color-bi-text-disabled !important;
}
background-color: transparent !important;
& .bi-high-light {
color: @color-bi-text-disabled !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-none {
&:hover, &.hover {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
}
&:active, &.active {
color: inherit;
& .bi-input {
color: inherit;
}
& .bi-textarea {
color: inherit;
}
background-color: transparent;
& .bi-high-light {
color: inherit;
}
}
&.disabled {
&, &:hover, &:active {
background-color: transparent !important;
color: @color-bi-text-disabled-theme-dark !important;
& .bi-input {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-textarea {
color: @color-bi-text-disabled-theme-dark !important;
}
& .bi-high-light {
color: @color-bi-text-disabled-theme-dark !important;
}
}
}
}
}

13
src/less/core/utils/pos.less → src/less/core/utils/position.less

@ -1,8 +1,10 @@
@import "../../index"; @import "../../index";
.display-block{
.display-block {
display: block; display: block;
} }
.display-inline{
.display-inline {
.inline-block(); .inline-block();
} }
@ -11,10 +13,11 @@
} }
/**常用于span元素在与combo并列时**/ /**常用于span元素在与combo并列时**/
.vertical-super{ .vertical-super {
vertical-align: super; vertical-align: super;
} }
.vertical-top{
.vertical-top {
vertical-align: top; vertical-align: top;
} }
@ -22,6 +25,6 @@
text-align: center; text-align: center;
} }
.horizon-left{ .horizon-left {
text-align: left; text-align: left;
} }

18
src/less/core/utils/overflow.less → src/less/core/utils/typographic.less

@ -1,4 +1,5 @@
@import "../../index"; @import "../../index";
.y-overflow-auto { .y-overflow-auto {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
@ -19,17 +20,17 @@
overflow-x: scroll; overflow-x: scroll;
} }
.overflow-auto{ .overflow-auto {
overflow-x: auto; overflow-x: auto;
overflow-y: auto; overflow-y: auto;
} }
.overflow-scroll{ .overflow-scroll {
overflow-x: scroll; overflow-x: scroll;
overflow-y: scroll; overflow-y: scroll;
} }
.overflow-hidden{ .overflow-hidden {
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; overflow-y: hidden;
} }
@ -39,7 +40,14 @@
word-break: break-all; word-break: break-all;
} }
.overflow-dot {
.overflow-dot{
.overflow-dot(); .overflow-dot();
}
.bi-user-select-enable {
.user-select-enable();
}
.bi-user-select-disable {
.user-select-disable();
} }

37
src/less/lib/colors.less

@ -4,20 +4,24 @@
//默认字体颜色 //默认字体颜色
@color-bi-text-normal: @font-color-normal; @color-bi-text-normal: @font-color-normal;
//默认字体颜色深色系 //深色主题默认字体颜色
@color-bi-text-theme-dark: @font-color-normal-theme-dark;
@color-bi-text-normal-theme-dark: @font-color-normal-theme-dark; @color-bi-text-normal-theme-dark: @font-color-normal-theme-dark;
//黑色字体颜色 //黑色字体颜色
@color-bi-text-black: @font-color-black; @color-bi-text-black: @font-color-black;
//深色主题默认字体颜色 //深色主题黑色字体颜色
@color-bi-text-theme-dark: @font-color-normal-theme-dark; @color-bi-text-black-theme-dark: @font-color-normal-theme-dark;
//灰色字体颜色 //灰色字体颜色
@color-bi-text-gray: @font-color-gray; @color-bi-text-gray: @font-color-gray;
//浅灰色字体 //浅灰色字体
@color-bi-text-light-gray: @font-color-light-gray; @color-bi-text-light-gray: @font-color-light-gray;
//深色浅灰色字体 //深色主题浅灰色字体
@color-bi-text-light-gray-theme-dark: @font-color-light-gray-theme-dark; @color-bi-text-light-gray-theme-dark: @font-color-light-gray-theme-dark;
//白色字体颜色 //白色字体颜色
@color-bi-text: @font-color-white; @color-bi-text: @font-color-white;
@color-bi-text-white: @font-color-white;
//深色主题白色字体颜色
@color-bi-text-white-theme-dark: @font-color-white-theme-dark;
//灰化字体颜色 //灰化字体颜色
@color-bi-text-disabled: @font-color-disabled; @color-bi-text-disabled: @font-color-disabled;
//深色主题灰化字体颜色 //深色主题灰化字体颜色
@ -39,6 +43,7 @@
//普通背景 //普通背景
@color-bi-background-normal: @background-color-normal; @color-bi-background-normal: @background-color-normal;
//深色主题普通背景
@color-bi-background-normal-theme-dark: @background-color-normal-theme-dark; @color-bi-background-normal-theme-dark: @background-color-normal-theme-dark;
//默认背景 //默认背景
@color-bi-background-default: @background-color-default; @color-bi-background-default: @background-color-default;
@ -46,19 +51,19 @@
@color-bi-background-default-theme-dark: @background-color-default-theme-dark; @color-bi-background-default-theme-dark: @background-color-default-theme-dark;
//黑色背景 //黑色背景
@color-bi-background-black: @background-color-black; @color-bi-background-black: @background-color-black;
//深色黑色背景 //深色主题黑色背景
@color-bi-background-black-theme-dark: @background-color-black-theme-dark; @color-bi-background-black-theme-dark: @background-color-black-theme-dark;
//浅黑色背景 //浅黑色背景
@color-bi-background-light-black: @background-color-light-black; @color-bi-background-light-black: @background-color-light-black;
//深色浅黑色背景 //深色主题浅黑色背景
@color-bi-background-light-black-theme-dark: @background-color-light-black-theme-dark; @color-bi-background-light-black-theme-dark: @background-color-light-black-theme-dark;
//深灰色背景 //深灰色背景
@color-bi-background-dark-gray: @background-color-dark-gray; @color-bi-background-dark-gray: @background-color-dark-gray;
//深色深灰色背景 //深色主题深灰色背景
@color-bi-background-dark-gray-theme-dark: @background-color-dark-gray-theme-dark; @color-bi-background-dark-gray-theme-dark: @background-color-dark-gray-theme-dark;
//灰色背景(浅) //灰色背景(浅)
@color-bi-background-light-gray: @background-color-light-gray; @color-bi-background-light-gray: @background-color-light-gray;
//深色主题灰色背景 //深色主题灰色背景(浅)
@color-bi-background-light-gray-theme-dark: @background-color-light-gray-theme-dark; @color-bi-background-light-gray-theme-dark: @background-color-light-gray-theme-dark;
//灰色背景(中) //灰色背景(中)
@color-bi-background-medium-gray: @background-color-medium-gray; @color-bi-background-medium-gray: @background-color-medium-gray;
@ -95,17 +100,17 @@
@color-bi-border-black: @border-color-black; @color-bi-border-black: @border-color-black;
//默认边框色 //默认边框色
@color-bi-border-default: @border-color-default; @color-bi-border-default: @border-color-default;
//边框线 //边框线色
@color-bi-border-line: @border-color-line; @color-bi-border-line: @border-color-line;
//深色边框线色 //深色主题边框线色
@color-bi-border-line-theme-dark: @border-color-line-theme-dark; @color-bi-border-line-theme-dark: @border-color-line-theme-dark;
//深色边框线 //深色边框线
@color-bi-border-dark-line: @border-color-dark-line; @color-bi-border-dark-line: @border-color-dark-line;
//深色深色边框线 //深色主题深色边框线
@color-bi-border-dark-line-theme-dark: @border-color-dark-line-theme-dark; @color-bi-border-dark-line-theme-dark: @border-color-dark-line-theme-dark;
//灰化边框 //灰化边框
@color-bi-border-disabled: @border-color-disabled; @color-bi-border-disabled: @border-color-disabled;
//深色灰化边框 //深色主题灰化边框
@color-bi-border-disabled-theme-dark: @border-color-disabled-theme-dark; @color-bi-border-disabled-theme-dark: @border-color-disabled-theme-dark;
//成功边框色 //成功边框色
@color-bi-border-success: @border-color-success; @color-bi-border-success: @border-color-success;
@ -179,11 +184,3 @@
@color-bi-yellow-40: fade(@font-color-yellow, 40); @color-bi-yellow-40: fade(@font-color-yellow, 40);
@color-bi-yellow-20: fade(@font-color-yellow, 20); @color-bi-yellow-20: fade(@font-color-yellow, 20);
@color-bi-yellow-5: fade(@font-color-yellow, 5); @color-bi-yellow-5: fade(@font-color-yellow, 5);

6
src/widget/datepane/datepane.js

@ -4,7 +4,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
baseCls: "bi-dynamic-date-pane", baseCls: "bi-dynamic-date-pane",
minDate: "1900-01-01", minDate: "1900-01-01",
maxDate: "2099-12-31", maxDate: "2099-12-31",
supportDynamic: true, supportDynamic: true
}, },
render: function () { render: function () {
@ -55,7 +55,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
self.switcher = this; self.switcher = this;
} }
}, },
height: 30 height: o.supportDynamic ? 30 : 0
}, { }, {
type: "bi.tab", type: "bi.tab",
ref: function () { ref: function () {
@ -94,7 +94,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
listeners: [{ listeners: [{
eventName: "EVENT_CHANGE", eventName: "EVENT_CHANGE",
action: function () { action: function () {
if(self._checkValue(self.getValue())) { if (self._checkValue(self.getValue())) {
self.fireEvent(BI.DynamicDatePane.EVENT_CHANGE); self.fireEvent(BI.DynamicDatePane.EVENT_CHANGE);
} }
} }

2
src/widget/datetimepane/datetimepane.js

@ -55,7 +55,7 @@ BI.DynamicDateTimePane = BI.inherit(BI.Widget, {
self.switcher = this; self.switcher = this;
} }
}, },
height: 30 height: o.supportDynamic ? 30 : 0
}, { }, {
type: "bi.tab", type: "bi.tab",
ref: function () { ref: function () {

4
src/widget/multiselect/multiselect.loader.nobar.js

@ -166,7 +166,7 @@ BI.MultiSelectNoBarLoader = BI.inherit(BI.Widget, {
}, },
resetHeight: function (h) { resetHeight: function (h) {
this.button_group.element.css({"max-height": h + "px"}); this.button_group.element.css({"max-height": h / BI.pixRatio + BI.pixUnit});
}, },
resetWidth: function () { resetWidth: function () {
@ -175,4 +175,4 @@ BI.MultiSelectNoBarLoader = BI.inherit(BI.Widget, {
}); });
BI.MultiSelectNoBarLoader.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiSelectNoBarLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multi_select_no_bar_loader", BI.MultiSelectNoBarLoader); BI.shortcut("bi.multi_select_no_bar_loader", BI.MultiSelectNoBarLoader);

4
src/widget/singleselect/search/singleselect.search.loader.js

@ -84,7 +84,7 @@ BI.SingleSelectSearchLoader = BI.inherit(BI.Widget, {
_createItems: function (items) { _createItems: function (items) {
return BI.createItems(items, { return BI.createItems(items, {
type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_combo_item", type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item",
cls: "bi-list-item-active", cls: "bi-list-item-active",
logic: { logic: {
dynamic: false dynamic: false
@ -150,4 +150,4 @@ BI.SingleSelectSearchLoader = BI.inherit(BI.Widget, {
}); });
BI.SingleSelectSearchLoader.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectSearchLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_search_loader", BI.SingleSelectSearchLoader); BI.shortcut("bi.single_select_search_loader", BI.SingleSelectSearchLoader);

65
src/widget/singleselect/singleselect.item.js

@ -1,65 +0,0 @@
BI.SingleSelectComboItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.SingleSelectComboItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-single-select-radio-item",
logic: {
dynamic: false
},
height: 24
});
},
_init: function () {
BI.SingleSelectComboItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.radio = BI.createWidget({
type: "bi.radio"
});
this.text = BI.createWidget({
type: "bi.label",
cls: "list-item-text",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
keyword: o.keyword,
value: o.value,
py: o.py
});
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("left", {
type: "bi.center_adapt",
items: [this.radio],
width: 26
}, this.text)
}))));
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.SingleSelectComboItem.superclass.doClick.apply(this, arguments);
this.radio.setSelected(this.isSelected());
if (this.isValid()) {
this.fireEvent(BI.SingleSelectComboItem.EVENT_CHANGE, this.isSelected(), this);
}
},
setSelected: function (v) {
BI.SingleSelectComboItem.superclass.setSelected.apply(this, arguments);
this.radio.setSelected(v);
}
});
BI.SingleSelectComboItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_combo_item", BI.SingleSelectComboItem);

4
src/widget/singleselect/singleselect.list.js

@ -116,7 +116,7 @@ BI.SingleSelectList = BI.inherit(BI.Widget, {
resetHeight: function (h) { resetHeight: function (h) {
this.list.resetHeight ? this.list.resetHeight(h) : this.list.resetHeight ? this.list.resetHeight(h) :
this.list.element.css({"max-height": h + "px"}); this.list.element.css({"max-height": h / BI.pixRatio + BI.pixUnit});
}, },
setNotSelectedValue: function () { setNotSelectedValue: function () {
@ -156,4 +156,4 @@ BI.SingleSelectList = BI.inherit(BI.Widget, {
} }
}); });
BI.SingleSelectList.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleSelectList.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_list", BI.SingleSelectList); BI.shortcut("bi.single_select_list", BI.SingleSelectList);

2
src/widget/singleselect/singleselect.loader.js

@ -105,7 +105,7 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
_createItems: function (items) { _createItems: function (items) {
return BI.createItems(items, { return BI.createItems(items, {
type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_combo_item", type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item",
logic: this.options.logic, logic: this.options.logic,
cls: "bi-list-item-active", cls: "bi-list-item-active",
height: 24, height: 24,

3
src/widget/year/combo.year.js

@ -64,6 +64,7 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
destroyWhenHide: true, destroyWhenHide: true,
adjustLength: 1,
popup: { popup: {
minWidth: 85, minWidth: 85,
stopPropagation: false, stopPropagation: false,
@ -205,4 +206,4 @@ BI.shortcut("bi.dynamic_year_combo", BI.DynamicYearCombo);
BI.extend(BI.DynamicYearCombo, { BI.extend(BI.DynamicYearCombo, {
Static: 1, Static: 1,
Dynamic: 2 Dynamic: 2
}); });

3
src/widget/yearmonth/combo.yearmonth.js

@ -62,6 +62,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
destroyWhenHide: true, destroyWhenHide: true,
adjustLength: 1,
popup: { popup: {
minWidth: 100, minWidth: 100,
stopPropagation: false, stopPropagation: false,
@ -203,4 +204,4 @@ BI.shortcut("bi.dynamic_year_month_combo", BI.DynamicYearMonthCombo);
BI.extend(BI.DynamicYearMonthCombo, { BI.extend(BI.DynamicYearMonthCombo, {
Static: 1, Static: 1,
Dynamic: 2 Dynamic: 2
}); });

3
src/widget/yearquarter/combo.yearquarter.js

@ -62,6 +62,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
destroyWhenHide: true, destroyWhenHide: true,
adjustLength: 1,
popup: { popup: {
minWidth: 85, minWidth: 85,
stopPropagation: false, stopPropagation: false,
@ -203,4 +204,4 @@ BI.shortcut("bi.dynamic_year_quarter_combo", BI.DynamicYearQuarterCombo);
BI.extend(BI.DynamicYearQuarterCombo, { BI.extend(BI.DynamicYearQuarterCombo, {
Static: 1, Static: 1,
Dynamic: 2 Dynamic: 2
}); });

5
template/index.html

@ -3,10 +3,13 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Demo</title> <title>Demo</title>
</head> </head>
<body> <body>
<div id="wrapper"></div> <div id="wrapper"></div>
</body> </body>
</html> </html>

Loading…
Cancel
Save