Browse Source

Pull request #2695: 无JIRA任务 feature: 布局优化写法,提供系统配置

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

* commit '0cb5d35b243edbeb5b1cc8371787aed7a66fdf78':
  feature: 布局优化写法,提供系统配置
  feature: 布局优化写法,提供系统配置
es6
guy 3 years ago
parent
commit
2c3bf54dd6
  1. 9
      src/core/system.js
  2. 32
      src/core/wrapper/layout.js

9
src/core/system.js

@ -7,6 +7,7 @@
!(function () { !(function () {
var system = { var system = {
dependencies: {}, dependencies: {},
layoutOptimize: false,
responsiveMode: false, responsiveMode: false,
workerMode: false, workerMode: false,
size: { size: {
@ -44,6 +45,10 @@
system.workerMode = !!mode; system.workerMode = !!mode;
}; };
this.setLayoutOptimize = function (layoutOptimize) {
system.layoutOptimize = layoutOptimize;
};
this.addDependency = function (moduleId, minVersion, maxVersion) { this.addDependency = function (moduleId, minVersion, maxVersion) {
system.dependencies[moduleId] = { system.dependencies[moduleId] = {
min: minVersion, min: minVersion,
@ -77,6 +82,10 @@
return system.workerMode; return system.workerMode;
}, },
getLayoutOptimize: function () {
return system.layoutOptimize;
},
getDependencies: function () { getDependencies: function () {
return system.dependencies; return system.dependencies;
} }

32
src/core/wrapper/layout.js

@ -16,7 +16,7 @@ BI.Layout = BI.inherit(BI.Widget, {
scrolly: false, // true, false scrolly: false, // true, false
items: [], items: [],
innerHgap: 0, innerHgap: 0,
innerVgap: 0, innerVgap: 0
}; };
}, },
@ -293,22 +293,40 @@ BI.Layout = BI.inherit(BI.Widget, {
}, },
_optimiseItemLgap: function (item) { _optimiseItemLgap: function (item) {
return item.lgap || 0; if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? item.lgap : item._lgap) || 0;
}
return (item._lgap || 0) + (item.lgap || 0);
}, },
_optimiseItemRgap: function (item) { _optimiseItemRgap: function (item) {
return item.rgap || 0; if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? item.rgap : item._rgap) || 0;
}
return (item._rgap || 0) + (item.rgap || 0);
}, },
_optimiseItemTgap: function (item) { _optimiseItemTgap: function (item) {
return item.tgap || 0; if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? item.tgap : item._tgap) || 0;
}
return (item._tgap || 0) + (item.tgap || 0);
}, },
_optimiseItemBgap: function (item) { _optimiseItemBgap: function (item) {
return item.bgap || 0; if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? item.bgap : item._bgap) || 0;
}
return (item._bgap || 0) + (item.bgap || 0);
}, },
_optimiseItemHgap: function (item) { _optimiseItemHgap: function (item) {
return item.hgap || 0; if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? item.hgap : item._hgap) || 0;
}
return (item._hgap || 0) + (item.hgap || 0);
}, },
_optimiseItemVgap: function (item) { _optimiseItemVgap: function (item) {
return item.vgap || 0; if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? item.vgap : item._vgap) || 0;
}
return (item._vgap || 0) + (item.vgap || 0);
}, },
_handleGap: function (w, item, hIndex, vIndex) { _handleGap: function (w, item, hIndex, vIndex) {

Loading…
Cancel
Save