diff --git a/changelog.md b/changelog.md
index 74d3a0360..a00c12798 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,13 @@
# 更新日志
+2.0(2021-12)
+- 支持BI.config(function(){})进行系统配置
+
+2.0(2021-11)
+- 限制了复选下拉框一次粘贴添加值个数最大2000
+
2.0(2021-10)
- combo增加window.blur事件触发隐藏
+
2.0(2021-09)
- 支持自动watch
- 支持h函数传递left、right,优化left_right_vertical_adapt布局的jsx写法
diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js
index a2df708a6..35a642878 100644
--- a/dist/fix/fix.compact.js
+++ b/dist/fix/fix.compact.js
@@ -55,6 +55,8 @@
Fix.Model.target = target = targetStack.pop();
}
+ BI.Model = Fix.Model;
+
var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot
index 9db044108..44a04d8c3 100644
Binary files a/dist/font/iconfont.eot and b/dist/font/iconfont.eot differ
diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg
index 5a40b7253..c642b62c8 100644
--- a/dist/font/iconfont.svg
+++ b/dist/font/iconfont.svg
@@ -14,6 +14,36 @@
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf
index 2200c297f..6b0173372 100644
Binary files a/dist/font/iconfont.ttf and b/dist/font/iconfont.ttf differ
diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff
index dfeba9b00..2a7a2de40 100644
Binary files a/dist/font/iconfont.woff and b/dist/font/iconfont.woff differ
diff --git a/dist/font/iconfont.woff2 b/dist/font/iconfont.woff2
index d85feabbd..8dedba1b2 100644
Binary files a/dist/font/iconfont.woff2 and b/dist/font/iconfont.woff2 differ
diff --git a/examples/config-render.html b/examples/config-render.html
index ed1f38dc6..41545d3b4 100644
--- a/examples/config-render.html
+++ b/examples/config-render.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/dev.html b/examples/dev.html
index 74f0eccdb..17bfd951b 100644
--- a/examples/dev.html
+++ b/examples/dev.html
@@ -1,46 +1,419 @@
-
-
-
-
+
+
+
+
+ PullRequest | Code Review as a Service
+
+
+
-
-
-
-
-
+ element: "#wrapper",
+ });
+
+
diff --git a/examples/effect.html b/examples/effect.html
index 65ebd4530..34bae9199 100644
--- a/examples/effect.html
+++ b/examples/effect.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/hooks.html b/examples/hooks.html
index 66afa9f83..c9302a0d5 100644
--- a/examples/hooks.html
+++ b/examples/hooks.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/loader-context.html b/examples/loader-context.html
index 72695cc9f..a8ba36a96 100644
--- a/examples/loader-context.html
+++ b/examples/loader-context.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/resize.html b/examples/resize.html
index 5bd99a35d..dda9edda3 100644
--- a/examples/resize.html
+++ b/examples/resize.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/style.html b/examples/style.html
index 81063b19c..339f14365 100644
--- a/examples/style.html
+++ b/examples/style.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/tab-context.html b/examples/tab-context.html
index 9e7cf33ea..6a0a2d130 100644
--- a/examples/tab-context.html
+++ b/examples/tab-context.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/test-id.html b/examples/test-id.html
index 351cfec20..7eec9e549 100644
--- a/examples/test-id.html
+++ b/examples/test-id.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/virtual-group.html b/examples/virtual-group.html
index a2e664ea4..a21a37fe6 100644
--- a/examples/virtual-group.html
+++ b/examples/virtual-group.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/visible.html b/examples/visible.html
index e2ef18d34..790d091c1 100644
--- a/examples/visible.html
+++ b/examples/visible.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/worker.html b/examples/worker.html
index e9045ab56..03cdc5be6 100644
--- a/examples/worker.html
+++ b/examples/worker.html
@@ -2,8 +2,10 @@
-
-
+
+
+
diff --git a/examples/响应式布局.html b/examples/响应式布局.html
new file mode 100644
index 000000000..b0148d2b4
--- /dev/null
+++ b/examples/响应式布局.html
@@ -0,0 +1,419 @@
+
+
+
+
+
+ PullRequest | Code Review as a Service
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/插件设计.html b/examples/插件设计.html
index 3c167f45f..91c2b29c8 100644
--- a/examples/插件设计.html
+++ b/examples/插件设计.html
@@ -2,10 +2,10 @@
-
-
-
-
+
+
+
diff --git a/i18n/i18n.cn.js b/i18n/i18n.cn.js
index 77db2c53d..9a43ca507 100644
--- a/i18n/i18n.cn.js
+++ b/i18n/i18n.cn.js
@@ -197,5 +197,6 @@ BI.i18n = {
"BI-Basic_Year_Month_Range_Error": "请选择{R1}年{R2}月-{R3}年{R4}月的日期",
"BI-Basic_Year_Quarter_Range_Error": "请选择{R1}年{R2}季度-{R3}年{R4}季度的日期",
"BI-Basic_Search_And_Patch_Paste": "搜索,支持批量粘贴、粘贴值通过换行识别",
- "BI-Basic_Recommend_Color": "推荐色"
+ "BI-Basic_Recommend_Color": "推荐色",
+ "BI-Basic_Too_Much_Value_Get_Two_Thousand": "粘贴的值过多,只能识别出前2000个值"
};
\ No newline at end of file
diff --git a/package.json b/package.json
index e1322a19e..380687bf8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fineui",
- "version": "2.0.20211124201415",
+ "version": "2.0.20211207104248",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",
diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js
index de0ec5ebe..76ffb77ad 100644
--- a/src/base/single/button/button.basic.js
+++ b/src/base/single/button/button.basic.js
@@ -31,13 +31,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
_init: function () {
BI.BasicButton.superclass._init.apply(this, arguments);
var opts = this.options;
- if (opts.selected === true) {
- BI.nextTick(BI.bind(function () {
- this.setSelected(opts.selected);
- }, this));
- }
- BI.nextTick(BI.bind(this.bindEvent, this));
-
+
if (opts.shadow) {
this._createShadow();
}
@@ -46,6 +40,14 @@ BI.BasicButton = BI.inherit(BI.Single, {
}
},
+ _initRef: function () {
+ if (this.options.selected === true) {
+ this.setSelected(true);
+ }
+ this.bindEvent();
+ BI.BasicButton.superclass._initRef.apply(this, arguments);
+ },
+
// 默认render方法
render: function () {
return this.options.el;
diff --git a/src/base/single/button/button.node.js b/src/base/single/button/button.node.js
index b8fda221f..8e17a4ea5 100644
--- a/src/base/single/button/button.node.js
+++ b/src/base/single/button/button.node.js
@@ -9,18 +9,17 @@
BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
- return BI.extend( conf, {
+ return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-node",
open: false
});
},
- _init: function () {
- BI.NodeButton.superclass._init.apply(this, arguments);
- var self = this;
- BI.nextTick(function () {
- self.setOpened(self.isOpened());
- });
+ _initRef: function () {
+ if (this.isOpened()) {
+ this.setOpened(this.isOpened());
+ }
+ BI.NodeButton.superclass._initRef.apply(this, arguments);
},
doClick: function () {
@@ -41,14 +40,14 @@ BI.NodeButton = BI.inherit(BI.BasicButton, {
},
triggerCollapse: function () {
- if(this.isOpened()) {
+ if (this.isOpened()) {
this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
}
},
triggerExpand: function () {
- if(!this.isOpened()) {
+ if (!this.isOpened()) {
this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
}
diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js
index 44605fc78..837d6d205 100644
--- a/src/base/single/input/input.js
+++ b/src/base/single/input/input.js
@@ -24,7 +24,7 @@ BI.Input = BI.inherit(BI.Single, {
var _keydown = BI.debounce(function (keyCode) {
self.onKeyDown(keyCode, ctrlKey);
self._keydown_ = false;
- }, BI.EVENT_RESPONSE_TIME);
+ }, 300);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
@@ -33,7 +33,10 @@ BI.Input = BI.inherit(BI.Single, {
"leading": true,
"trailing": false
});
- this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME);
+ this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
+ "leading": true,
+ "trailing": false
+ });
this.element
.keydown(function (e) {
inputEventValid = false;
@@ -92,7 +95,11 @@ BI.Input = BI.inherit(BI.Single, {
_blur: function () {
var self = this;
- blur();
+ if (self._keydown_ === true) {
+ BI.delay(blur, 300);
+ } else {
+ blur();
+ }
function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
diff --git a/src/base/single/input/radio/radio.js b/src/base/single/input/radio/radio.js
index 61096af65..f17e79e9e 100644
--- a/src/base/single/input/radio/radio.js
+++ b/src/base/single/input/radio/radio.js
@@ -19,7 +19,6 @@ BI.Radio = BI.inherit(BI.BasicButton, {
var self = this, o = this.options;
return {
type: "bi.center_adapt",
- element: this.element,
items: [{
type: "bi.layout",
cls: "radio-content",
diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js
index 35ed78e4b..78029885e 100644
--- a/src/case/editor/editor.sign.js
+++ b/src/case/editor/editor.sign.js
@@ -176,6 +176,7 @@ BI.SignEditor = BI.inherit(BI.Widget, {
setWaterMark: function (v) {
this.options.watermark = v;
+ this._checkText();
this.editor.setWaterMark(v);
},
diff --git a/src/case/ztree/0.treeview.js b/src/case/ztree/0.treeview.js
index f67c9291b..f9dd56f50 100644
--- a/src/case/ztree/0.treeview.js
+++ b/src/case/ztree/0.treeview.js
@@ -55,7 +55,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
});
BI.createWidget({
type: "bi.default",
- element: this.element,
+ element: this,
items: [this.tree]
});
},
diff --git a/src/core/6.inject.js b/src/core/6.inject.js
index e4ccbf665..e86c925d8 100644
--- a/src/core/6.inject.js
+++ b/src/core/6.inject.js
@@ -150,6 +150,11 @@
}
};
BI.config = BI.config || function (type, configFn, opt) {
+ if (BI.isFunction(type)) {
+ opt = configFn;
+ configFn = type;
+ type = "bi.provider.system";
+ }
opt = opt || {};
// 系统配置直接执行
@@ -171,84 +176,6 @@
fn: configFn,
opt: opt
});
-
- // // 初始化过或者系统配置需要立刻执行
- // if (BI.initialized || "bi.provider.system" === type) {
- // if (constantInjection[type]) {
- // return (constantInjection[type] = configFn(constantInjection[type]));
- // }
- // if (providerInjection[type]) {
- // if (!providers[type]) {
- // providers[type] = new providerInjection[type]();
- // }
- // // 如果config被重新配置的话,需要删除掉之前的实例
- // if (providerInstance[type]) {
- // delete providerInstance[type];
- // }
- // return configFn(providers[type]);
- // }
- // return BI.Plugin.configWidget(type, configFn, opt);
- // }
- // if (!configFunctions[type]) {
- // configFunctions[type] = [];
- // BI.prepares.push(function () {
- // var queue = configFunctions[type];
- // var dependencies = BI.Providers.getProvider("bi.provider.system").getDependencies();
- // var modules = moduleInjectionMap.components[type]
- // || moduleInjectionMap.constants[type]
- // || moduleInjectionMap.services[type]
- // || moduleInjectionMap.stores[type]
- // || moduleInjectionMap.models[type]
- // || moduleInjectionMap.providers[type];
- // for (var i = 0; i < queue.length; i++) {
- // var conf = queue[i];
- // var version = conf.opt.version;
- // var fn = conf.fn;
- // if (modules && version) {
- // var findVersion = false;
- // for (var j = 0; j < modules.length; j++) {
- // var module = modules[i];
- // if (module && dependencies[module.moduleId] && module.version === version) {
- // var minVersion = dependencies[module.moduleId].minVersion,
- // maxVersion = dependencies[module.moduleId].maxVersion;
- // if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion) {
- // findVersion = true;
- // break;
- // }
- // if (maxVersion && (moduleInjection[module.moduleId].version || version) > maxVersion) {
- // findVersion = true;
- // break;
- // }
- // }
- // }
- // if (findVersion === true) {
- // _global.console && console.error("moduleId: [" + module.moduleId + "] 接口: [" + type + "] 接口版本: [" + version + "] 已过期,版本要求为:", dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]);
- // continue;
- // }
- // }
- // if (constantInjection[type]) {
- // constantInjection[type] = fn(constantInjection[type]);
- // continue;
- // }
- // if (providerInjection[type]) {
- // if (!providers[type]) {
- // providers[type] = new providerInjection[type]();
- // }
- // if (providerInstance[type]) {
- // delete providerInstance[type];
- // }
- // fn(providers[type]);
- // continue;
- // }
- // BI.Plugin.configWidget(type, fn);
- // }
- // configFunctions[type] = null;
- // });
- // }
- // configFunctions[type].push({
- // fn: configFn,
- // opt: opt
- // });
};
BI.getReference = BI.getReference || function (type, fn) {
diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js
index e8001d87f..2aedd70c0 100644
--- a/src/core/platform/web/config.js
+++ b/src/core/platform/web/config.js
@@ -162,7 +162,7 @@ BI.prepares.push(function () {
});
BI.Plugin.configWidget("bi.flex_horizontal", function (ob) {
if (ob.scrollable === true || ob.scrollx !== false) {
- if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效
+ if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
if (BI.Providers.getProvider("bi.provider.system").getResponsiveMode()) {
return BI.extend({}, ob, {type: "bi.responsive_flex_scrollable_horizontal"});
}
@@ -175,7 +175,7 @@ BI.prepares.push(function () {
});
BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
- if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效
+ if (ob.hgap > 0 || ob.lgap > 0 || ob.rgap > 0) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"});
}
}
diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js
index 04ffa4fa4..92a836ddf 100644
--- a/src/core/wrapper/layout.js
+++ b/src/core/wrapper/layout.js
@@ -267,26 +267,73 @@ BI.Layout = BI.inherit(BI.Widget, {
this.options.items.splice(index, 1);
},
+ _clearGap: function (w) {
+ w.element.css({
+ "margin-top": "",
+ "margin-bottom": "",
+ "margin-left": "",
+ "margin-right": "",
+ })
+ },
+
+ _optimiseGap: function (gap) {
+ return gap > 0 && gap < 1 ? (gap * 100).toFixed(1) + "%" : gap / BI.pixRatio + BI.pixUnit;
+ },
+
_handleGap: function (w, item, hIndex, vIndex) {
var o = this.options;
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
+ var top = ((BI.isNull(vIndex) || vIndex === 0) ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0);
w.element.css({
- "margin-top": (((BI.isNull(vIndex) || vIndex === 0) ? o.vgap : 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-top": this._optimiseGap(top)
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
+ var left = ((BI.isNull(hIndex) || hIndex === 0) ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0);
w.element.css({
- "margin-left": (((BI.isNull(hIndex) || hIndex === 0) ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-left": this._optimiseGap(left)
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
+ var right = o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0);
w.element.css({
- "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-right": this._optimiseGap(right)
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
+ var bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
+ w.element.css({
+ "margin-bottom": this._optimiseGap(bottom)
+ });
+ }
+ },
+
+ // 横向换纵向
+ _handleReverseGap: function (w, item, index) {
+ var o = this.options;
+ if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
+ var top = (index === 0 ? o.vgap : 0) + (index === 0 ? o.tgap : 0) + (item.tgap || 0) + (item.vgap || 0);
+ w.element.css({
+ "margin-top": this._optimiseGap(top)
+ });
+ }
+ if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
+ var left = o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0);
+ w.element.css({
+ "margin-left": this._optimiseGap(left)
+ });
+ }
+ if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
+ var right = o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0);
+ w.element.css({
+ "margin-right": this._optimiseGap(right)
+ });
+ }
+ // 这里的代码是关键
+ if (o.vgap + o.hgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
+ var bottom = (index === o.items.length - 1 ? o.vgap : o.hgap) + (index === o.items.length - 1 ? o.bgap : 0) + (item.bgap || 0) + (item.vgap || 0);
w.element.css({
- "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-bottom": this._optimiseGap(bottom)
});
}
},
diff --git a/src/core/wrapper/layout/adapt/absolute.center.js b/src/core/wrapper/layout/adapt/absolute.center.js
index f5da01bbc..fd4881975 100644
--- a/src/core/wrapper/layout/adapt/absolute.center.js
+++ b/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);
w.element.css({
position: "absolute",
- 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)) / BI.pixRatio + BI.pixUnit,
- 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)) / BI.pixRatio + BI.pixUnit,
+ left: this._optimiseGap(o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)),
+ right: this._optimiseGap(o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)),
+ top: this._optimiseGap(o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)),
+ bottom: this._optimiseGap(o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)),
margin: "auto"
});
return w;
diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js
index daed0c33d..8c0b82590 100644
--- a/src/core/wrapper/layout/adapt/adapt.table.js
+++ b/src/core/wrapper/layout/adapt/adapt.table.js
@@ -48,9 +48,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
var td, width = "";
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (columnSize > 0) {
- width = columnSize < 1 ?
- ((columnSize * 100).toFixed(1) + "%")
- : (columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap);
+ width = this._optimiseGap(columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap);
}
if ((BI.isNull(columnSize) || columnSize === "") && this._hasFill()) {
width = 2;
@@ -71,17 +69,16 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
if (o.verticalAlign === BI.VerticalAlign.Stretch) {
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
- w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")");
+ w.element.css("height", "calc(100% - " + this._optimiseGap(top + bottom) + ")");
}
// 对于表现为td的元素设置最大宽度,有几点需要注意
// 1、由于直接对td设置最大宽度是在规范中未定义的, 所以要使用类似td:firstChild来迂回实现
// 2、不能给多个td设置最大宽度,这样只会平分宽度
// 3、多百分比宽度就算了
if (columnSize > 0) {
- columnSize = columnSize < 1 ? width : width / BI.pixRatio + BI.pixUnit;
td.element.css({
- "max-width": columnSize,
- "min-width": columnSize
+ "max-width": width,
+ "min-width": width
});
}
if (i === 0) {
diff --git a/src/core/wrapper/layout/fill/float.fill.horizontal.js b/src/core/wrapper/layout/fill/float.fill.horizontal.js
index b9d234660..988b8c061 100644
--- a/src/core/wrapper/layout/fill/float.fill.horizontal.js
+++ b/src/core/wrapper/layout/fill/float.fill.horizontal.js
@@ -43,42 +43,42 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
- "margin-top": (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-top": self._optimiseGap(o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0))
});
}
if (desc) {
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
- "margin-right": ((i === o.items.length - 1 ? o.hgap : 0) + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-right": self._optimiseGap((i === o.items.length - 1 ? o.hgap : 0) + o.rgap + (item.rgap || 0) + (item.hgap || 0))
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
- "margin-left": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-left": self._optimiseGap(o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0))
});
}
} else {
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
- "margin-left": ((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-left": self._optimiseGap((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0))
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({
- "margin-right": (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-right": self._optimiseGap(o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0))
});
}
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
- "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-bottom": self._optimiseGap(o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0))
});
}
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
w.element.css({
- height: "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")"
+ height: "calc(100% - " + self._optimiseGap(top + bottom) + ")"
});
}
w.element.css({
diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js
index c6877c383..f1390b1f0 100644
--- a/src/core/wrapper/layout/flex/flex.horizontal.js
+++ b/src/core/wrapper/layout/flex/flex.horizontal.js
@@ -74,7 +74,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
}
}
if (columnSize > 0) {
- w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit));
+ w.element.width(this._optimiseGap(columnSize));
}
if (columnSize === "fill") {
w.element.addClass("f-f");
diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js
index f5fa620aa..f2b9aa19f 100644
--- a/src/core/wrapper/layout/flex/flex.vertical.js
+++ b/src/core/wrapper/layout/flex/flex.vertical.js
@@ -73,7 +73,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
}
}
if (rowSize > 0) {
- w.element.height(rowSize < 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit));
+ w.element.height(this._optimiseGap(rowSize));
}
if (rowSize === "fill") {
w.element.addClass("f-f");
diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
index f0715b150..2a4c9706f 100644
--- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
+++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
@@ -70,7 +70,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
}
}
if (columnSize > 0) {
- w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit));
+ w.element.width(this._optimiseGap(columnSize));
}
if (columnSize === "fill") {
w.element.addClass("f-f");
diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
index c46f8c222..621dee46d 100644
--- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
+++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
@@ -70,7 +70,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
}
}
if (rowSize > 0) {
- w.element.height(rowSize < 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit));
+ w.element.height(this._optimiseGap(rowSize));
}
if (rowSize === "fill") {
w.element.addClass("f-f");
diff --git a/src/core/wrapper/layout/layout.absolute.js b/src/core/wrapper/layout/layout.absolute.js
index 6a59eb133..fa61028c1 100644
--- a/src/core/wrapper/layout/layout.absolute.js
+++ b/src/core/wrapper/layout/layout.absolute.js
@@ -25,57 +25,57 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments);
var left = 0, right = 0, top = 0, bottom = 0;
if (BI.isNotNull(item.left)) {
- w.element.css({left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left});
+ w.element.css({left: BI.isNumber(item.left) ? this._optimiseGap(item.left) : item.left});
left += item.left;
}
if (BI.isNotNull(item.right)) {
- w.element.css({right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right});
+ w.element.css({right: BI.isNumber(item.right) ? this._optimiseGap(item.right) : item.right});
right += item.right;
}
if (BI.isNotNull(item.top)) {
- w.element.css({top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top});
+ w.element.css({top: BI.isNumber(item.top) ? this._optimiseGap(item.top) : item.top});
top += item.top;
}
if (BI.isNotNull(item.bottom)) {
- w.element.css({bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom});
+ w.element.css({bottom: BI.isNumber(item.bottom) ? this._optimiseGap(item.bottom) : item.bottom});
bottom += item.bottom;
}
if (BI.isNotNull(o.hgap)) {
left += o.hgap;
- w.element.css({left: left / BI.pixRatio + BI.pixUnit});
+ w.element.css({left: this._optimiseGap(left)});
right += o.hgap;
- w.element.css({right: right / BI.pixRatio + BI.pixUnit});
+ w.element.css({right: this._optimiseGap(right)});
}
if (BI.isNotNull(o.vgap)) {
top += o.vgap;
- w.element.css({top: top / BI.pixRatio + BI.pixUnit});
+ w.element.css({top: this._optimiseGap(top)});
bottom += o.vgap;
- w.element.css({bottom: bottom / BI.pixRatio + BI.pixUnit});
+ w.element.css({bottom: this._optimiseGap(bottom)});
}
if (BI.isNotNull(o.lgap)) {
left += o.lgap;
- w.element.css({left: left / BI.pixRatio + BI.pixUnit});
+ w.element.css({left: this._optimiseGap(left)});
}
if (BI.isNotNull(o.rgap)) {
right += o.rgap;
- w.element.css({right: right / BI.pixRatio + BI.pixUnit});
+ w.element.css({right: this._optimiseGap(right)});
}
if (BI.isNotNull(o.tgap)) {
top += o.tgap;
- w.element.css({top: top / BI.pixRatio + BI.pixUnit});
+ w.element.css({top: this._optimiseGap(top)});
}
if (BI.isNotNull(o.bgap)) {
bottom += o.bgap;
- w.element.css({bottom: bottom / BI.pixRatio + BI.pixUnit});
+ w.element.css({bottom: this._optimiseGap(bottom)});
}
if (BI.isNotNull(item.width)) {
- w.element.css({width: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : item.width});
+ w.element.css({width: BI.isNumber(item.width) ? this._optimiseGap(item.width) : item.width});
}
if (BI.isNotNull(item.height)) {
- w.element.css({height: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : item.height});
+ w.element.css({height: BI.isNumber(item.height) ? this._optimiseGap(item.height) : item.height});
}
w.element.css({position: "absolute"});
return w;
diff --git a/src/core/wrapper/layout/layout.adaptive.js b/src/core/wrapper/layout/layout.adaptive.js
index 7c19e1928..3fd67f566 100644
--- a/src/core/wrapper/layout/layout.adaptive.js
+++ b/src/core/wrapper/layout/layout.adaptive.js
@@ -21,32 +21,32 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative"});
if (BI.isNotNull(item.left)) {
w.element.css({
- left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left
+ left: BI.isNumber(item.left) ? this._optimiseGap(item.left) : item.left
});
}
if (BI.isNotNull(item.right)) {
w.element.css({
- right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right
+ right: BI.isNumber(item.right) ? this._optimiseGap(item.right) : item.right
});
}
if (BI.isNotNull(item.top)) {
w.element.css({
- top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top
+ top: BI.isNumber(item.top) ? this._optimiseGap(item.top) : item.top
});
}
if (BI.isNotNull(item.bottom)) {
w.element.css({
- bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom
+ bottom: BI.isNumber(item.bottom) ? this._optimiseGap(item.bottom) : item.bottom
});
}
this._handleGap(w, item);
if (BI.isNotNull(item.width)) {
- w.element.css({width: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : item.width});
+ w.element.css({width: BI.isNumber(item.width) ? this._optimiseGap(item.width) : item.width});
}
if (BI.isNotNull(item.height)) {
- w.element.css({height: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : item.height});
+ w.element.css({height: BI.isNumber(item.height) ? this._optimiseGap(item.height) : item.height});
}
return w;
},
diff --git a/src/core/wrapper/layout/layout.border.js b/src/core/wrapper/layout/layout.border.js
index 212c545d4..eda061892 100644
--- a/src/core/wrapper/layout/layout.border.js
+++ b/src/core/wrapper/layout/layout.border.js
@@ -35,12 +35,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("north"), w);
}
- this.getWidgetByName(this._getChildName("north")).element.height(item.height / BI.pixRatio + BI.pixUnit)
+ this.getWidgetByName(this._getChildName("north")).element.height(this._optimiseGap(item.height))
.css({
position: "absolute",
- top: (item.top || 0) / BI.pixRatio + BI.pixUnit,
- left: (item.left || 0) / BI.pixRatio + BI.pixUnit,
- right: (item.right || 0) / BI.pixRatio + BI.pixUnit,
+ top: this._optimiseGap(item.top || 0),
+ left: this._optimiseGap(item.left || 0),
+ right: this._optimiseGap(item.right || 0),
bottom: "initial"
});
}
@@ -55,12 +55,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("south"), w);
}
- this.getWidgetByName(this._getChildName("south")).element.height(item.height / BI.pixRatio + BI.pixUnit)
+ this.getWidgetByName(this._getChildName("south")).element.height(this._optimiseGap(item.height))
.css({
position: "absolute",
- bottom: (item.bottom || 0) / BI.pixRatio + BI.pixUnit,
- left: (item.left || 0) / BI.pixRatio + BI.pixUnit,
- right: (item.right || 0) / BI.pixRatio + BI.pixUnit,
+ bottom: this._optimiseGap(item.bottom || 0),
+ left: this._optimiseGap(item.left || 0),
+ right: this._optimiseGap(item.right || 0),
top: "initial"
});
}
@@ -75,12 +75,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("west"), w);
}
- this.getWidgetByName(this._getChildName("west")).element.width(item.width / BI.pixRatio + BI.pixUnit)
+ this.getWidgetByName(this._getChildName("west")).element.width(this._optimiseGap(item.width))
.css({
position: "absolute",
- left: (item.left || 0) / BI.pixRatio + BI.pixUnit,
- top: top / BI.pixRatio + BI.pixUnit,
- bottom: bottom / BI.pixRatio + BI.pixUnit,
+ left: this._optimiseGap(item.left || 0),
+ top: this._optimiseGap(top),
+ bottom: this._optimiseGap(bottom),
right: "initial"
});
}
@@ -95,12 +95,12 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
this.addWidget(this._getChildName("east"), w);
}
- this.getWidgetByName(this._getChildName("east")).element.width(item.width / BI.pixRatio + BI.pixUnit)
+ this.getWidgetByName(this._getChildName("east")).element.width(this._optimiseGap(item.width))
.css({
position: "absolute",
- right: (item.right || 0) / BI.pixRatio + BI.pixUnit,
- top: top / BI.pixRatio + BI.pixUnit,
- bottom: bottom / BI.pixRatio + BI.pixUnit,
+ right: this._optimiseGap(item.right || 0),
+ top: this._optimiseGap(top),
+ bottom: this._optimiseGap(bottom),
left: "initial"
});
}
@@ -117,10 +117,10 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
this.getWidgetByName(this._getChildName("center")).element
.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
+ top: this._optimiseGap(top),
+ bottom: this._optimiseGap(bottom),
+ left: this._optimiseGap(left),
+ right: this._optimiseGap(right)
});
}
}
diff --git a/src/core/wrapper/layout/layout.card.js b/src/core/wrapper/layout/layout.card.js
index 5ca2bec63..dd50a7b17 100644
--- a/src/core/wrapper/layout/layout.card.js
+++ b/src/core/wrapper/layout/layout.card.js
@@ -38,7 +38,13 @@ BI.CardLayout = BI.inherit(BI.Layout, {
} else {
var w = self.getWidgetByName(self._getChildName(item.cardName));
}
- w.element.css({position: "absolute", top: "0", right: "0", bottom: "0", left: "0"});
+ w.element.css({
+ position: "relative",
+ top: "0",
+ left: "0",
+ width: "100%",
+ height: "100%"
+ });
w.setVisible(false);
}
});
diff --git a/src/core/wrapper/layout/layout.flow.js b/src/core/wrapper/layout/layout.flow.js
index 2061b4513..47e23bf42 100644
--- a/src/core/wrapper/layout/layout.flow.js
+++ b/src/core/wrapper/layout/layout.flow.js
@@ -30,35 +30,39 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments);
w.element.css({position: "relative", float: "left"});
if (BI.isNotNull(item.left)) {
- w.element.css({left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left});
+ w.element.css({left: BI.isNumber(item.left) ? this._optimiseGap(item.left) : item.left});
}
if (BI.isNotNull(item.right)) {
- w.element.css({right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right});
+ w.element.css({right: BI.isNumber(item.right) ? this._optimiseGap(item.right) : item.right});
}
if (BI.isNotNull(item.top)) {
- w.element.css({top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top});
+ w.element.css({top: BI.isNumber(item.top) ? this._optimiseGap(item.top) : item.top});
}
if (BI.isNotNull(item.bottom)) {
- w.element.css({bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom});
+ w.element.css({bottom: BI.isNumber(item.bottom) ? this._optimiseGap(item.bottom) : item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
+ var top = o.vgap / 2 + o.tgap + (item.tgap || 0) + (item.vgap || 0);
w.element.css({
- "margin-top": (o.vgap / 2 + o.tgap + (item.tgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-top": this._optimiseGap(top)
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
+ var left = o.hgap / 2 + o.lgap + (item.lgap || 0) + (item.hgap || 0);
w.element.css({
- "margin-left": (o.hgap / 2 + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-left": this._optimiseGap(left)
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
+ var right = o.hgap / 2 + o.rgap + (item.rgap || 0) + (item.hgap || 0);
w.element.css({
- "margin-right": (o.hgap / 2 + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-right": this._optimiseGap(right)
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
+ var bottom = o.vgap / 2 + o.bgap + (item.bgap || 0) + (item.vgap || 0);
w.element.css({
- "margin-bottom": (o.vgap / 2 + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
+ "margin-bottom": this._optimiseGap(bottom)
});
}
return w;
diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js
index 9e3b35470..51c2a5e01 100644
--- a/src/core/wrapper/layout/layout.inline.js
+++ b/src/core/wrapper/layout/layout.inline.js
@@ -52,7 +52,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
});
w.element.addClass("i-item");
if (columnSize === "fill" || columnSize === "") {
- var length = o.hgap;
+ var length = 0, gap = o.hgap;
var fillCount = 0, autoCount = 0;
for (var k = 0, len = o.columnSize.length || o.items.length; k < len; k++) {
var cz = o.columnSize.length > 0 ? o.columnSize[k] : o.items[k].width;
@@ -63,16 +63,19 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
autoCount++;
cz = 0;
}
- length += o.hgap + o.lgap + o.rgap + (o.items[k].lgap || 0) + (o.items[k].rgap || 0) + (o.items[k].hgap || 0) + cz;
+ gap += o.hgap + o.lgap + o.rgap + (o.items[k].lgap || 0) + (o.items[k].rgap || 0) + (o.items[k].hgap || 0);
+ length += cz;
}
+ length = length > 0 && length < 1 ? (length * 100).toFixed(1) + "%" : length / BI.pixRatio + BI.pixUnit;
+ gap = gap > 0 && gap < 1 ? (gap * 100).toFixed(1) + "%" : gap / BI.pixRatio + BI.pixUnit;
if (columnSize === "fill") {
- w.element.css("min-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
+ w.element.css("min-width", "calc((100% - " + length + " - " + gap + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
}
if (o.horizontalAlign === BI.HorizontalAlign.Stretch || !(o.scrollable === true || o.scrollx === true)) {
if (columnSize === "fill") {
- w.element.css("max-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
+ w.element.css("max-width", "calc((100% - " + length + " - " + gap + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
} else {
- w.element.css("max-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (autoCount > 1 ? "/" + autoCount : "") + ")");
+ w.element.css("max-width", "calc((100% - " + length + " - " + gap + ")" + (autoCount > 1 ? "/" + autoCount : "") + ")");
}
}
}
@@ -80,7 +83,8 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
- w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")");
+ var gap = (top + bottom) > 0 && (top + bottom) < 1 ? ((top + bottom) * 100).toFixed(1) + "%" : (top + bottom) / BI.pixRatio + BI.pixUnit;
+ w.element.css("height", "calc(100% - " + gap + ")");
}
return w;
},
diff --git a/src/core/wrapper/layout/layout.table.js b/src/core/wrapper/layout/layout.table.js
index 82ffd3973..e577f822d 100644
--- a/src/core/wrapper/layout/layout.table.js
+++ b/src/core/wrapper/layout/layout.table.js
@@ -69,8 +69,8 @@ BI.TableLayout = BI.inherit(BI.Layout, {
abs.push(BI.extend({
top: 0,
bottom: 0,
- left: o.columnSize[i] < 1 ? (left * 100).toFixed(1) + "%" : left,
- width: o.columnSize[i] < 1 ? (o.columnSize[i] * 100).toFixed(1) + "%" : o.columnSize[i]
+ left: this._optimiseGap(left),
+ width: this._optimiseGap(o.columnSize[i])
}, arr[i]));
left += o.columnSize[i] + (o.columnSize[i] < 1 ? 0 : o.hgap);
} else {
@@ -83,8 +83,8 @@ BI.TableLayout = BI.inherit(BI.Layout, {
abs.push(BI.extend({
top: 0,
bottom: 0,
- right: o.columnSize[j] < 1 ? (right * 100).toFixed(1) + "%" : right,
- width: o.columnSize[j] < 1 ? (o.columnSize[j] * 100).toFixed(1) + "%" : o.columnSize[j]
+ right: this._optimiseGap(right),
+ width: this._optimiseGap(o.columnSize[j])
}, arr[j]));
right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap);
} else {
@@ -96,8 +96,8 @@ BI.TableLayout = BI.inherit(BI.Layout, {
abs.push(BI.extend({
top: 0,
bottom: 0,
- left: left < 1 ? (left * 100).toFixed(1) + "%" : left,
- right: right < 1 ? (right * 100).toFixed(1) + "%" : right
+ left: this._optimiseGap(left),
+ right: this._optimiseGap(right)
}, arr[i]));
}
var w = BI._lazyCreateWidget({
@@ -107,7 +107,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
});
if (this.rows > 0) {
this.getWidgetByName(this._getChildName(this.rows - 1)).element.css({
- "margin-bottom": o.vgap / BI.pixRatio + BI.pixUnit
+ "margin-bottom": this._optimiseGap(o.vgap)
});
}
w.element.css({
diff --git a/src/core/wrapper/layout/layout.tape.js b/src/core/wrapper/layout/layout.tape.js
index 5723f3461..4d3cb202f 100644
--- a/src/core/wrapper/layout/layout.tape.js
+++ b/src/core/wrapper/layout/layout.tape.js
@@ -43,8 +43,8 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
}
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
+ top: self._optimiseGap((item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap),
+ bottom: self._optimiseGap((item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap)
});
if (o.verticalAlign === BI.VerticalAlign.Middle) {
w.element.css({
@@ -77,17 +77,11 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
var preColumnSize = o.columnSize.length > 0 ? o.columnSize[i - 1] : items[i - 1].width;
left[i] = left[i - 1] + preColumnSize + (items[i - 1].lgap || 0) + (items[i - 1].rgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
}
- if (columnSize < 1 && columnSize > 0) {
- w.element.css({
- left: (left[i] * 100).toFixed(1) + "%",
- width: (columnSize * 100).toFixed(1) + "%"
- });
- } else {
- w.element.css({
- left: (left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
- width: BI.isNumber(columnSize) ? columnSize / BI.pixRatio + BI.pixUnit : ""
- });
- }
+ w.element.css({
+ left: self._optimiseGap(left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap),
+ width: BI.isNumber(columnSize) ? self._optimiseGap(columnSize) : ""
+ });
+
if (columnSize === "" || columnSize === "fill") {
return true;
}
@@ -102,17 +96,11 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
var nextColumnSize = o.columnSize.length > 0 ? o.columnSize[i + 1] : items[i + 1].width;
right[i] = right[i + 1] + nextColumnSize + (items[i + 1].lgap || 0) + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
}
- if (columnSize < 1 && columnSize > 0) {
- w.element.css({
- right: (right[i] * 100).toFixed(1) + "%",
- width: (columnSize * 100).toFixed(1) + "%"
- });
- } else {
- w.element.css({
- right: (right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
- width: BI.isNumber(columnSize) ? columnSize / BI.pixRatio + BI.pixUnit : ""
- });
- }
+ w.element.css({
+ right: self._optimiseGap(right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap),
+ width: BI.isNumber(columnSize) ? self._optimiseGap(columnSize) : ""
+ });
+
if (columnSize === "" || columnSize === "fill") {
return true;
}
@@ -175,8 +163,8 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
}
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
+ left: self._optimiseGap((item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap),
+ right: self._optimiseGap((item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap)
});
if (o.horizontalAlign === BI.HorizontalAlign.Center) {
w.element.css({
@@ -209,17 +197,11 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
var preRowSize = o.rowSize.length > 0 ? o.rowSize[i - 1] : items[i - 1].height;
top[i] = top[i - 1] + preRowSize + (items[i - 1].tgap || 0) + (items[i - 1].bgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
}
- if (rowSize < 1 && rowSize > 0) {
- w.element.css({
- top: (top[i] * 100).toFixed(1) + "%",
- height: (rowSize * 100).toFixed(1) + "%"
- });
- } else {
- w.element.css({
- top: (top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
- height: BI.isNumber(rowSize) ? rowSize / BI.pixRatio + BI.pixUnit : ""
- });
- }
+ w.element.css({
+ top: self._optimiseGap(top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap),
+ height: BI.isNumber(rowSize) ? self._optimiseGap(rowSize) : ""
+ });
+
if (rowSize === "" || rowSize === "fill") {
return true;
}
@@ -234,17 +216,11 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
var nextRowSize = o.rowSize.length > 0 ? o.rowSize[i + 1] : items[i + 1].height;
bottom[i] = bottom[i + 1] + nextRowSize + (items[i + 1].tgap || 0) + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
}
- if (rowSize < 1 && rowSize > 0) {
- w.element.css({
- bottom: (bottom[i] * 100).toFixed(1) + "%",
- height: (rowSize * 100).toFixed(1) + "%"
- });
- } else {
- w.element.css({
- bottom: (bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
- height: BI.isNumber(rowSize) ? rowSize / BI.pixRatio + BI.pixUnit : ""
- });
- }
+ w.element.css({
+ bottom: self._optimiseGap(bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap),
+ height: BI.isNumber(rowSize) ? self._optimiseGap(rowSize) : ""
+ });
+
if (rowSize === "" || rowSize === "fill") {
return true;
}
diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js
index ba5b2adef..340b347bf 100644
--- a/src/core/wrapper/layout/layout.td.js
+++ b/src/core/wrapper/layout/layout.td.js
@@ -75,15 +75,14 @@ BI.TdLayout = BI.inherit(BI.Layout, {
}
}
- var height = o.rowSize[idx] === "" ? "" : (o.rowSize[idx] < 1 ? ((o.rowSize[idx] * 100).toFixed(1) + "%") : o.rowSize[idx]);
- var rowHeight = BI.isNumber(o.rowSize[idx]) ? (o.rowSize[idx] <= 1 ? height : height / BI.pixRatio + BI.pixUnit) : height;
+ var height = o.rowSize[idx] === "" ? "" : this._optimiseGap(o.rowSize[idx]);
var tr = BI._lazyCreateWidget({
type: "bi.default",
tagName: "tr",
height: height,
css: {
- "max-height": rowHeight,
- "min-height": rowHeight
+ "max-height": height,
+ "min-height": height
}
});
@@ -92,37 +91,16 @@ BI.TdLayout = BI.inherit(BI.Layout, {
if (o.verticalAlign === BI.VerticalAlign.Stretch) {
var top = o.vgap + o.tgap + (arr[i].tgap || 0) + (arr[i].vgap || 0),
bottom = o.vgap + o.bgap + (arr[i].bgap || 0) + (arr[i].vgap || 0);
- w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")");
+ w.element.css("height", "calc(100% - " + this._optimiseGap(top + bottom) + ")");
}
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
var item = arr[i];
- if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
- w.element.css({
- "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) {
- w.element.css({
- "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) {
- w.element.css({
- "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) {
- w.element.css({
- "margin-bottom": (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
- });
- }
+ this._handleGap(w, item, i);
first(w, this.rows++, i);
var width = "";
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (columnSize > 0) {
- width = columnSize < 1 ?
- ((columnSize * 100).toFixed(1) + "%")
- : (columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap);
+ width = this._optimiseGap(columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap);
}
function hasFill() {
if (o.columnSize.length > 0) {
@@ -148,10 +126,9 @@ BI.TdLayout = BI.inherit(BI.Layout, {
// 2、不能给多个td设置最大宽度,这样只会平分宽度
// 3、多百分比宽度就算了
if (columnSize > 0) {
- columnSize = columnSize < 1 ? width : width / BI.pixRatio + BI.pixUnit;
td.element.css({
- "max-width": columnSize,
- "min-width": columnSize
+ "max-width": width,
+ "min-width": width
});
}
td.element.css({
diff --git a/src/core/wrapper/layout/layout.window.js b/src/core/wrapper/layout/layout.window.js
index 7094bb7ee..95a87ba97 100644
--- a/src/core/wrapper/layout/layout.window.js
+++ b/src/core/wrapper/layout/layout.window.js
@@ -100,9 +100,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
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);
}
- var t = top[i] <= 1 ? (top[i] * 100).toFixed(1) + "%" : (top[i] + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit, h = "";
+ var t = this._optimiseGap(top[i] + o.vgap + o.tgap), h = "";
if (BI.isNumber(o.rowSize[i])) {
- h = o.rowSize[i] <= 1 ? (o.rowSize[i] * 100).toFixed(1) + "%" : o.rowSize[i] / BI.pixRatio + BI.pixUnit;
+ h = this._optimiseGap(o.rowSize[i]);
}
wi.element.css({top: t, height: h});
first(wi, i, j);
@@ -118,9 +118,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
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);
}
- var b = bottom[i] <= 1 ? (bottom[i] * 100).toFixed(1) + "%" : (bottom[i] + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit, h = "";
+ var b = this._optimiseGap(bottom[i] + o.vgap + o.bgap), h = "";
if (BI.isNumber(o.rowSize[i])) {
- h = o.rowSize[i] <= 1 ? (o.rowSize[i] * 100).toFixed(1) + "%" : o.rowSize[i] / BI.pixRatio + BI.pixUnit;
+ h = this._optimiseGap(o.rowSize[i]);
}
wi.element.css({bottom: b, height: h});
first(wi, i, j);
@@ -136,9 +136,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
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);
}
- var l = left[j] <= 1 ? (left[j] * 100).toFixed(1) + "%" : (left[j] + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit, w = "";
+ var l = this._optimiseGap(left[j] + o.hgap + o.lgap), w = "";
if (BI.isNumber(o.columnSize[j])) {
- w = o.columnSize[j] <= 1 ? (o.columnSize[j] * 100).toFixed(1) + "%" : o.columnSize[j] / BI.pixRatio + BI.pixUnit;
+ w = this._optimiseGap(o.columnSize[j]);
}
wi.element.css({left: l, width: w});
first(wi, i, j);
@@ -154,9 +154,9 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
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);
}
- var r = right[j] <= 1 ? (right[j] * 100).toFixed(1) + "%" : (right[j] + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit, w = "";
+ var r = this._optimiseGap(right[j] + o.hgap + o.rgap), w = "";
if (BI.isNumber(o.columnSize[j])) {
- w = o.columnSize[j] <= 1 ? (o.columnSize[j] * 100).toFixed(1) + "%" : o.columnSize[j] / BI.pixRatio + BI.pixUnit;
+ w = this._optimiseGap(o.columnSize[j]);
}
wi.element.css({right: r, width: w});
first(wi, i, j);
diff --git a/src/core/wrapper/layout/middle/middle.center.js b/src/core/wrapper/layout/middle/middle.center.js
index a21472d72..9d80a094f 100644
--- a/src/core/wrapper/layout/middle/middle.center.js
+++ b/src/core/wrapper/layout/middle/middle.center.js
@@ -35,10 +35,10 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
- left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
- right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
- top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
- bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
+ left: self._optimiseGap(o.hgap + o.lgap),
+ right: self._optimiseGap(o.hgap + o.rgap),
+ top: self._optimiseGap(o.vgap + o.tgap),
+ bottom: self._optimiseGap(o.vgap + o.bgap),
width: "auto",
height: "auto"
});
diff --git a/src/core/wrapper/layout/middle/middle.float.center.js b/src/core/wrapper/layout/middle/middle.float.center.js
index b5edb61fc..d1e2a4695 100644
--- a/src/core/wrapper/layout/middle/middle.float.center.js
+++ b/src/core/wrapper/layout/middle/middle.float.center.js
@@ -36,10 +36,10 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
- left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
- right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
- top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
- bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
+ left: self._optimiseGap(o.hgap + o.lgap),
+ right: self._optimiseGap(o.hgap + o.rgap),
+ top: self._optimiseGap(o.vgap + o.tgap),
+ bottom: self._optimiseGap(o.vgap + o.bgap),
width: "auto",
height: "auto"
});
diff --git a/src/core/wrapper/layout/middle/middle.horizontal.js b/src/core/wrapper/layout/middle/middle.horizontal.js
index f54f32996..c42fde9c0 100644
--- a/src/core/wrapper/layout/middle/middle.horizontal.js
+++ b/src/core/wrapper/layout/middle/middle.horizontal.js
@@ -34,10 +34,10 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
- left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
- right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
- top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
- bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
+ left: self._optimiseGap(o.hgap + o.lgap),
+ right: self._optimiseGap(o.hgap + o.rgap),
+ top: self._optimiseGap(o.vgap + o.tgap),
+ bottom: self._optimiseGap(o.vgap + o.bgap),
width: "auto"
});
list[i].el.addItem(w);
diff --git a/src/core/wrapper/layout/middle/middle.vertical.js b/src/core/wrapper/layout/middle/middle.vertical.js
index bedb60a22..b835bc4f6 100644
--- a/src/core/wrapper/layout/middle/middle.vertical.js
+++ b/src/core/wrapper/layout/middle/middle.vertical.js
@@ -35,10 +35,10 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
var w = BI._lazyCreateWidget(item);
w.element.css({
position: "absolute",
- left: (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
- right: (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
- top: (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
- bottom: (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
+ left: self._optimiseGap(o.hgap + o.lgap),
+ right: self._optimiseGap(o.hgap + o.rgap),
+ top: self._optimiseGap(o.vgap + o.tgap),
+ bottom: self._optimiseGap(o.vgap + o.bgap),
height: "auto"
});
list[i].el.addItem(w);
diff --git a/src/core/wrapper/layout/responsive/responsive.flex.horizontal.js b/src/core/wrapper/layout/responsive/responsive.flex.horizontal.js
index 4d5fa2b27..70d7ddddb 100644
--- a/src/core/wrapper/layout/responsive/responsive.flex.horizontal.js
+++ b/src/core/wrapper/layout/responsive/responsive.flex.horizontal.js
@@ -6,42 +6,52 @@
* @extends BI.FlexHorizontalLayout
*/
BI.ResponsiveFlexHorizontalLayout = BI.inherit(BI.FlexHorizontalLayout, {
- props: function () {
- return BI.extend(BI.ResponsiveFlexHorizontalLayout.superclass.props.apply(this, arguments), {
- extraCls: "bi-responsive-f-h"
- });
- },
+ // props: function () {
+ // return BI.extend(BI.ResponsiveFlexHorizontalLayout.superclass.props.apply(this, arguments), {
+ // // extraCls: "bi-responsive-f-h"
+ // });
+ // },
- _addElement: function (i, item) {
- var w = BI.ResponsiveFlexHorizontalLayout.superclass._addElement.apply(this, arguments);
- var o = this.options;
- var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width;
- if (o.columnSize.length > 0) {
- if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) {
- columnSize = null;
- }
+ mounted: function () {
+ var self = this, o = this.options;
+ if (o.horizontalAlign !== BI.HorizontalAlign.Center){
+ return;
}
- if (columnSize === "fill") {
- // 给自适应列设置一个min-width
- var length = 0;
- var fillCount = 0, autoCount = 0;
- for (var k = 0, len = o.columnSize.length || o.items.length; k < len; k++) {
- var cz = o.columnSize.length > 0 ? o.columnSize[k] : o.items[k].width;
- if (cz === "fill") {
- fillCount++;
- cz = 0;
- } else if (cz === "" || BI.isNull(cz)) {
- autoCount++;
- cz = 0;
+ var defaultResize = function () {
+ if (o.scrollable !== true && o.scrollx !== true) {
+ var clientWidth = document.body.clientWidth;
+ if(self.element.width() > 2/3 * clientWidth){
+ if (clientWidth <= 768) {
+ BI.each(self._children, function (i, child) {
+ self._clearGap(child);
+ self._handleReverseGap(child, o.items[i], i | 0);
+ });
+ self.element.css("flex-direction", "column");
+ }
}
- length += cz;
}
- var count = (o.columnSize.length || o.items.length) - fillCount - autoCount;
- if (count > 0) {
- w.element.css("min-width", length / count / BI.pixRatio + BI.pixUnit);
+ }
+ var resize = function () {
+ defaultResize();
+ if (o.scrollable !== true && o.scrollx !== true) {
+ var clientWidth = document.body.clientWidth;
+ if(self.element.width() > 2/3 * clientWidth){
+ if (clientWidth > 768) {
+ BI.each(self._children, function (i, child) {
+ self._clearGap(child);
+ })
+ self.resize();
+ self.element.css("flex-direction", "row");
+ }
+ }
}
}
- return w;
+ this.unResize = BI.Resizers.add(this.getName(), resize);
+ defaultResize();
+ },
+
+ destroyed: function () {
+ this.unResize();
}
});
BI.shortcut("bi.responsive_flex_horizontal", BI.ResponsiveFlexHorizontalLayout);
diff --git a/src/core/wrapper/layout/responsive/responsive.flex.wrapper.horizontal.js b/src/core/wrapper/layout/responsive/responsive.flex.wrapper.horizontal.js
index 58869e51d..5e8fcfd95 100644
--- a/src/core/wrapper/layout/responsive/responsive.flex.wrapper.horizontal.js
+++ b/src/core/wrapper/layout/responsive/responsive.flex.wrapper.horizontal.js
@@ -6,42 +6,54 @@
* @extends BI.FlexWrapperHorizontalLayout
*/
BI.ResponsiveFlexWrapperHorizontalLayout = BI.inherit(BI.FlexWrapperHorizontalLayout, {
- props: function () {
- return BI.extend(BI.ResponsiveFlexWrapperHorizontalLayout.superclass.props.apply(this, arguments), {
- extraCls: "bi-responsive-f-h"
- });
- },
+ // props: function () {
+ // return BI.extend(BI.ResponsiveFlexWrapperHorizontalLayout.superclass.props.apply(this, arguments), {
+ // extraCls: "bi-responsive-f-h"
+ // });
+ // },
- _addElement: function (i, item) {
- var w = BI.ResponsiveFlexHorizontalLayout.superclass._addElement.apply(this, arguments);
- var o = this.options;
- var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width;
- if (o.columnSize.length > 0) {
- if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) {
- columnSize = null;
- }
+ mounted: function () {
+ var self = this, o = this.options;
+ if (o.horizontalAlign !== BI.HorizontalAlign.Center){
+ return;
}
- if (columnSize === "fill") {
- // 给自适应列设置一个min-width
- var length = 0;
- var fillCount = 0, autoCount = 0;
- for (var k = 0, len = o.columnSize.length || o.items.length; k < len; k++) {
- var cz = o.columnSize.length > 0 ? o.columnSize[k] : o.items[k].width;
- if (cz === "fill") {
- fillCount++;
- cz = 0;
- } else if (cz === "" || BI.isNull(cz)) {
- autoCount++;
- cz = 0;
+ var defaultResize = function () {
+ if (o.scrollable !== true && o.scrollx !== true) {
+ var clientWidth = document.body.clientWidth;
+ if(self.element.width() > 2/3 * clientWidth){
+ if (clientWidth <= 768) {
+ BI.each(self._children, function (i, child) {
+ self._clearGap(child);
+ self._handleReverseGap(child, o.items[i], i | 0);
+ });
+ self.element.css("flex-direction", "column");
+ self.$wrapper.element.css("flex-direction", "column");
+ }
}
- length += cz;
}
- var count = (o.columnSize.length || o.items.length) - fillCount - autoCount;
- if (count > 0) {
- w.element.css("min-width", length / count / BI.pixRatio + BI.pixUnit);
+ }
+ var resize = function () {
+ defaultResize();
+ if (o.scrollable !== true && o.scrollx !== true) {
+ var clientWidth = document.body.clientWidth;
+ if(self.element.width() > 2/3 * clientWidth){
+ if (clientWidth > 768) {
+ BI.each(self._children, function (i, child) {
+ self._clearGap(child);
+ })
+ self.resize();
+ self.element.css("flex-direction", "row");
+ self.$wrapper.element.css("flex-direction", "row");
+ }
+ }
}
}
- return w;
+ this.unResize = BI.Resizers.add(this.getName(), resize);
+ defaultResize();
+ },
+
+ destroyed: function () {
+ this.unResize();
}
});
BI.shortcut("bi.responsive_flex_scrollable_horizontal", BI.ResponsiveFlexWrapperHorizontalLayout);
diff --git a/src/core/wrapper/layout/responsive/responsive.inline..js b/src/core/wrapper/layout/responsive/responsive.inline..js
index 7b6e97e5b..08f27fcfc 100644
--- a/src/core/wrapper/layout/responsive/responsive.inline..js
+++ b/src/core/wrapper/layout/responsive/responsive.inline..js
@@ -6,60 +6,45 @@
* @extends BI.InlineLayout
*/
BI.ResponsiveInlineLayout = BI.inherit(BI.InlineLayout, {
- _addElement: function (i, item) {
- var o = this.options;
- var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
- var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width;
- if (o.columnSize.length > 0) {
- if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) {
- columnSize = null;
- }
- }
- if (columnSize > 0) {
- w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit));
+ mounted: function () {
+ var self = this, o = this.options;
+ if (o.horizontalAlign !== BI.HorizontalAlign.Center){
+ return;
}
- w.element.css({
- position: "relative",
- "vertical-align": o.verticalAlign
- });
- w.element.addClass("i-item");
- if (columnSize === "fill" || columnSize === "") {
- var length = o.hgap, czs = 0;
- var fillCount = 0, autoCount = 0;
- for (var k = 0, len = o.columnSize.length || o.items.length; k < len; k++) {
- var cz = o.columnSize.length > 0 ? o.columnSize[k] : o.items[k].width;
- if (cz === "fill") {
- fillCount++;
- cz = 0;
- } else if (cz === "" || BI.isNull(cz)) {
- autoCount++;
- cz = 0;
- }
- length += o.hgap + o.lgap + o.rgap + (o.items[k].lgap || 0) + (o.items[k].rgap || 0) + (o.items[k].hgap || 0) + cz;
- czs += cz;
- }
- if (columnSize === "fill") {
- var count = (o.columnSize.length || o.items.length) - fillCount - autoCount;
- if (count > 0) {
- w.element.css("min-width", czs / count / BI.pixRatio + BI.pixUnit);
+ var defaultResize = function () {
+ if (o.scrollable !== true && o.scrollx !== true) {
+ var clientWidth = document.body.clientWidth;
+ if(self.element.width() > 2/3 * clientWidth){
+ if (clientWidth <= 768) {
+ BI.each(self._children, function (i, child) {
+ self._clearGap(child);
+ self._handleReverseGap(child, o.items[i], i | 0);
+ child.elemenet.css("display", "");
+ });
+ }
}
- w.element.css("width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
}
- if (o.horizontalAlign === BI.HorizontalAlign.Stretch || !(o.scrollable === true || o.scrollx === true)) {
- if (columnSize === "fill") {
- w.element.css("max-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
- } else {
- w.element.css("max-width", "calc((100% - " + (length / BI.pixRatio + BI.pixUnit) + ")" + (autoCount > 1 ? "/" + autoCount : "") + ")");
+ }
+ var resize = function () {
+ defaultResize();
+ if (o.scrollable !== true && o.scrollx !== true) {
+ var clientWidth = document.body.clientWidth;
+ if(self.element.width() > 2/3 * clientWidth){
+ if (clientWidth > 768) {
+ BI.each(self._children, function (i, child) {
+ self._clearGap(child);
+ })
+ self.resize();
+ }
}
}
}
- this._handleGap(w, item, i);
- if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
- var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
- bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
- w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")");
- }
- return w;
+ this.unResize = BI.Resizers.add(this.getName(), resize);
+ defaultResize();
+ },
+
+ destroyed: function () {
+ this.unResize();
}
});
BI.shortcut("bi.responsive_inline", BI.ResponsiveInlineLayout);
diff --git a/src/less/base/single/button/switch.less b/src/less/base/single/button/switch.less
index 9093c84d7..7a65f2889 100644
--- a/src/less/base/single/button/switch.less
+++ b/src/less/base/single/button/switch.less
@@ -3,7 +3,7 @@
.bi-switch{
.border-radius(40px 40px 40px 40px);
background-color: @color-bi-background-dark-gray;
- &:active, &.active {
+ &.active {
background-color: @color-bi-background-highlight;
}
& .circle-button{
@@ -11,23 +11,17 @@
}
&.disabled {
background-color: @color-bi-background-disabled;
- &:active {
- background-color: @color-bi-background-disabled;
- }
}
}
.bi-theme-dark {
.bi-switch{
background-color: @color-bi-background-dark-gray-theme-dark;
- &:active, &.active {
+ &.active {
background-color: @color-bi-background-highlight;
}
&.disabled {
background-color: @color-bi-background-disabled-theme-dark;
- &:active {
- background-color: @color-bi-background-disabled-theme-dark;
- }
}
}
}
\ No newline at end of file
diff --git a/src/less/core/wrapper/flex.horizontal.less b/src/less/core/wrapper/flex.horizontal.less
index 933df5b33..b58fe25c4 100644
--- a/src/less/core/wrapper/flex.horizontal.less
+++ b/src/less/core/wrapper/flex.horizontal.less
@@ -62,17 +62,6 @@
-o-flex-wrap: nowrap;
flex-wrap: nowrap;
- &.bi-responsive-f-h {
- /* 09版 */
- /*-webkit-box-lines: multiple;*/
- /* 12版 */
- -webkit-flex-wrap: wrap;
- -moz-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- -o-flex-wrap: wrap;
- flex-wrap: wrap;
- }
-
&.v-middle {
/* 09版 */
-webkit-box-align: center;
diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less
index 420676ea7..a54b68075 100644
--- a/src/less/core/wrapper/flex.wrapper.horizontal.less
+++ b/src/less/core/wrapper/flex.wrapper.horizontal.less
@@ -269,17 +269,4 @@
flex-grow: 1;
}
}
-
- &.bi-responsive-f-h {
- & .f-s-h-w {
- /* 09版 */
- /*-webkit-box-lines: multiple;*/
- /* 12版 */
- -webkit-flex-wrap: wrap;
- -moz-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- -o-flex-wrap: wrap;
- flex-wrap: wrap;
- }
- }
}
diff --git a/src/less/modern.less b/src/less/modern.less
index 7899aad05..9703cc17b 100644
--- a/src/less/modern.less
+++ b/src/less/modern.less
@@ -18,7 +18,6 @@
//base case
@import "base/pane.less";
-@import "base/calendar/calendar.year.less";
@import "base/colorchooser/colorchooser.trigger.less";
@import "base/colorchooser/colorchooser.popup.less";
@import "base/colorchooser/colorpicker/button.colorpicker.less";
diff --git a/src/core/proto/number.js b/src/polyfill/number.js
similarity index 100%
rename from src/core/proto/number.js
rename to src/polyfill/number.js
diff --git a/src/snabbdom/element2Snabbdom.js b/src/snabbdom/element2Snabbdom.js
deleted file mode 100644
index 1a99bdc53..000000000
--- a/src/snabbdom/element2Snabbdom.js
+++ /dev/null
@@ -1,49 +0,0 @@
-!function () {
- var patch = BI.Snabbdom.init([BI.Snabbdom.attributesModule, BI.Snabbdom.classModule, BI.Snabbdom.datasetModule, BI.Snabbdom.propsModule, BI.Snabbdom.styleModule, BI.Snabbdom.eventListenersModule]);
- BI.Element2Vnode = function (parentNode) {
- if (parentNode.nodeType === 3) {
- return BI.Snabbdom.vnode(undefined, undefined, undefined, parentNode.textContent, parentNode);
- }
- var data = BI.jQuery._data(parentNode);
- var on = {};
- BI.each(data && data.events, function (eventName, events) {
- on[eventName] = function () {
- var ob = this, args = arguments;
- BI.each(events, function (i, ev) {
- ev.handler.apply(ob, args);
- });
- };
- });
- var attrs = {};
- var elmAttrs = parentNode.attributes;
- var elmChildren = parentNode.childNodes;
- var key = parentNode.getAttribute("key");
- for (var i = 0, n = elmAttrs.length; i < n; i++) {
- var name = elmAttrs[i].nodeName;
- if (name !== "id" && name !== "class") {
- attrs[name] = elmAttrs[i].nodeValue;
- }
- }
- var vnode = BI.Snabbdom.vnode(parentNode.nodeName, {
- class: BI.makeObject(parentNode.classList),
- attrs: attrs,
- key: key,
- on: on,
- hook: {
- create: function () {
- BI.each(BI.Widget._renderEngine.createElement(parentNode).data("__widgets"), function (i, w) {
- w.element = BI.Widget._renderEngine.createElement(vnode.elm);
- });
- }
- }
- }, BI.map(elmChildren, function (i, childNode) {
- return BI.Element2Vnode(childNode);
- }), undefined, parentNode);
- return vnode;
- };
-
- BI.patchVNode = function (element, node) {
- patch(element, node);
- };
-}();
-
diff --git a/src/snabbdom/snabbdom.js b/src/snabbdom/snabbdom.js
deleted file mode 100644
index 4965fcad5..000000000
--- a/src/snabbdom/snabbdom.js
+++ /dev/null
@@ -1,1052 +0,0 @@
-(function (global, factory) {
- factory(BI.Snabbdom = BI.Snabbdom || {});
-})(this, function (exports) {
- 'use strict';
-
- function createElement(tagName) {
- return document.createElement(tagName);
- }
- function createElementNS(namespaceURI, qualifiedName) {
- return document.createElementNS(namespaceURI, qualifiedName);
- }
- function createTextNode(text) {
- return document.createTextNode(text);
- }
- function createComment(text) {
- return document.createComment(text);
- }
- function insertBefore(parentNode, newNode, referenceNode) {
- parentNode.insertBefore(newNode, referenceNode);
- }
- function removeChild(node, child) {
- node.removeChild(child);
- }
- function appendChild(node, child) {
- node.appendChild(child);
- }
- function parentNode(node) {
- return node.parentNode;
- }
- function nextSibling(node) {
- return node.nextSibling;
- }
- function tagName(elm) {
- return elm.tagName;
- }
- function setTextContent(node, text) {
- node.textContent = text;
- }
- function getTextContent(node) {
- return node.textContent;
- }
- function isElement(node) {
- return node.nodeType === 1;
- }
- function isText(node) {
- return node.nodeType === 3;
- }
- function isComment(node) {
- return node.nodeType === 8;
- }
- var htmlDomApi = {
- createElement: createElement,
- createElementNS: createElementNS,
- createTextNode: createTextNode,
- createComment: createComment,
- insertBefore: insertBefore,
- removeChild: removeChild,
- appendChild: appendChild,
- parentNode: parentNode,
- nextSibling: nextSibling,
- tagName: tagName,
- setTextContent: setTextContent,
- getTextContent: getTextContent,
- isElement: isElement,
- isText: isText,
- isComment: isComment
- };
-
- function vnode(sel, data, children, text, elm) {
- var key = data === undefined ? undefined : data.key;
- return { sel: sel, data: data, children: children, text: text, elm: elm, key: key };
- }
-
- var array = Array.isArray;
- function primitive(s) {
- return typeof s === "string" || typeof s === "number";
- }
-
- function isUndef(s) {
- return s === undefined;
- }
- function isDef(s) {
- return s !== undefined;
- }
- var emptyNode = vnode("", {}, [], undefined, undefined);
- function sameVnode(vnode1, vnode2) {
- return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
- }
- function isVnode(vnode) {
- return vnode.sel !== undefined;
- }
- function createKeyToOldIdx(children, beginIdx, endIdx) {
- var _a;
- var map = {};
- for (var i = beginIdx; i <= endIdx; ++i) {
- var key = (_a = children[i]) === null || _a === void 0 ? void 0 : _a.key;
- if (key !== undefined) {
- map[key] = i;
- }
- }
- return map;
- }
- var hooks = ["create", "update", "remove", "destroy", "pre", "post"];
- function init(modules, domApi) {
- var i = void 0;
- var j = void 0;
- var cbs = {
- create: [],
- update: [],
- remove: [],
- destroy: [],
- pre: [],
- post: []
- };
- var api = domApi !== undefined ? domApi : htmlDomApi;
- for (i = 0; i < hooks.length; ++i) {
- cbs[hooks[i]] = [];
- for (j = 0; j < modules.length; ++j) {
- var hook = modules[j][hooks[i]];
- if (hook !== undefined) {
- cbs[hooks[i]].push(hook);
- }
- }
- }
- function emptyNodeAt(elm) {
- var id = elm.id ? "#" + elm.id : "";
- var c = elm.className ? "." + elm.className.split(" ").join(".") : "";
- return vnode(api.tagName(elm).toLowerCase() + id + c, {}, [], undefined, elm);
- }
- function createRmCb(childElm, listeners) {
- return function rmCb() {
- if (--listeners === 0) {
- var parent = api.parentNode(childElm);
- api.removeChild(parent, childElm);
- }
- };
- }
- function createElm(vnode, insertedVnodeQueue) {
- var _a, _b;
- var i = void 0;
- var data = vnode.data;
- if (data !== undefined) {
- var _init = (_a = data.hook) === null || _a === void 0 ? void 0 : _a.init;
- if (isDef(_init)) {
- _init(vnode);
- data = vnode.data;
- }
- }
- var children = vnode.children;
- var sel = vnode.sel;
- if (sel === "!") {
- if (isUndef(vnode.text)) {
- vnode.text = "";
- }
- vnode.elm = api.createComment(vnode.text);
- } else if (sel !== undefined) {
- // Parse selector
- var hashIdx = sel.indexOf("#");
- var dotIdx = sel.indexOf(".", hashIdx);
- var hash = hashIdx > 0 ? hashIdx : sel.length;
- var dot = dotIdx > 0 ? dotIdx : sel.length;
- var tag = hashIdx !== -1 || dotIdx !== -1 ? sel.slice(0, Math.min(hash, dot)) : sel;
- var elm = vnode.elm = isDef(data) && isDef(i = data.ns) ? api.createElementNS(i, tag) : api.createElement(tag);
- if (hash < dot) elm.setAttribute("id", sel.slice(hash + 1, dot));
- if (dotIdx > 0) elm.setAttribute("class", sel.slice(dot + 1).replace(/\./g, " "));
- for (i = 0; i < cbs.create.length; ++i) {
- cbs.create[i](emptyNode, vnode);
- }if (array(children)) {
- for (i = 0; i < children.length; ++i) {
- var ch = children[i];
- if (ch != null) {
- api.appendChild(elm, createElm(ch, insertedVnodeQueue));
- }
- }
- } else if (primitive(vnode.text)) {
- api.appendChild(elm, api.createTextNode(vnode.text));
- }
- var _hook = vnode.data.hook;
- if (isDef(_hook)) {
- (_b = _hook.create) === null || _b === void 0 ? void 0 : _b.call(_hook, emptyNode, vnode);
- if (_hook.insert) {
- insertedVnodeQueue.push(vnode);
- }
- }
- } else {
- vnode.elm = api.createTextNode(vnode.text);
- }
- return vnode.elm;
- }
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
- for (; startIdx <= endIdx; ++startIdx) {
- var ch = vnodes[startIdx];
- if (ch != null) {
- api.insertBefore(parentElm, createElm(ch, insertedVnodeQueue), before);
- }
- }
- }
- function invokeDestroyHook(vnode) {
- var _a, _b;
- var data = vnode.data;
- if (data !== undefined) {
- (_b = (_a = data === null || data === void 0 ? void 0 : data.hook) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a, vnode);
- for (var _i = 0; _i < cbs.destroy.length; ++_i) {
- cbs.destroy[_i](vnode);
- }if (vnode.children !== undefined) {
- for (var _j = 0; _j < vnode.children.length; ++_j) {
- var child = vnode.children[_j];
- if (child != null && typeof child !== "string") {
- invokeDestroyHook(child);
- }
- }
- }
- }
- }
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
- var _a, _b;
- for (; startIdx <= endIdx; ++startIdx) {
- var listeners = void 0;
- var rm = void 0;
- var ch = vnodes[startIdx];
- if (ch != null) {
- if (isDef(ch.sel)) {
- invokeDestroyHook(ch);
- listeners = cbs.remove.length + 1;
- rm = createRmCb(ch.elm, listeners);
- for (var _i2 = 0; _i2 < cbs.remove.length; ++_i2) {
- cbs.remove[_i2](ch, rm);
- }var removeHook = (_b = (_a = ch === null || ch === void 0 ? void 0 : ch.data) === null || _a === void 0 ? void 0 : _a.hook) === null || _b === void 0 ? void 0 : _b.remove;
- if (isDef(removeHook)) {
- removeHook(ch, rm);
- } else {
- rm();
- }
- } else {
- // Text node
- api.removeChild(parentElm, ch.elm);
- }
- }
- }
- }
- function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) {
- var oldStartIdx = 0;
- var newStartIdx = 0;
- var oldEndIdx = oldCh.length - 1;
- var oldStartVnode = oldCh[0];
- var oldEndVnode = oldCh[oldEndIdx];
- var newEndIdx = newCh.length - 1;
- var newStartVnode = newCh[0];
- var newEndVnode = newCh[newEndIdx];
- var oldKeyToIdx = void 0;
- var idxInOld = void 0;
- var elmToMove = void 0;
- var before = void 0;
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
- if (oldStartVnode == null) {
- oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
- } else if (oldEndVnode == null) {
- oldEndVnode = oldCh[--oldEndIdx];
- } else if (newStartVnode == null) {
- newStartVnode = newCh[++newStartIdx];
- } else if (newEndVnode == null) {
- newEndVnode = newCh[--newEndIdx];
- } else if (sameVnode(oldStartVnode, newStartVnode)) {
- patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
- oldStartVnode = oldCh[++oldStartIdx];
- newStartVnode = newCh[++newStartIdx];
- } else if (sameVnode(oldEndVnode, newEndVnode)) {
- patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
- oldEndVnode = oldCh[--oldEndIdx];
- newEndVnode = newCh[--newEndIdx];
- } else if (sameVnode(oldStartVnode, newEndVnode)) {
- // Vnode moved right
- patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
- api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));
- oldStartVnode = oldCh[++oldStartIdx];
- newEndVnode = newCh[--newEndIdx];
- } else if (sameVnode(oldEndVnode, newStartVnode)) {
- // Vnode moved left
- patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
- api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
- oldEndVnode = oldCh[--oldEndIdx];
- newStartVnode = newCh[++newStartIdx];
- } else {
- if (oldKeyToIdx === undefined) {
- oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
- }
- idxInOld = oldKeyToIdx[newStartVnode.key];
- if (isUndef(idxInOld)) {
- // New element
- api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
- } else {
- elmToMove = oldCh[idxInOld];
- if (elmToMove.sel !== newStartVnode.sel) {
- api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
- } else {
- patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
- oldCh[idxInOld] = undefined;
- api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
- }
- }
- newStartVnode = newCh[++newStartIdx];
- }
- }
- if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
- if (oldStartIdx > oldEndIdx) {
- before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
- } else {
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
- }
- }
- }
- function patchVnode(oldVnode, vnode, insertedVnodeQueue) {
- var _a, _b, _c, _d, _e;
- var hook = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.hook;
- (_b = hook === null || hook === void 0 ? void 0 : hook.prepatch) === null || _b === void 0 ? void 0 : _b.call(hook, oldVnode, vnode);
- var elm = vnode.elm = oldVnode.elm;
- var oldCh = oldVnode.children;
- var ch = vnode.children;
- if (oldVnode === vnode) return;
- if (vnode.data !== undefined) {
- for (var _i3 = 0; _i3 < cbs.update.length; ++_i3) {
- cbs.update[_i3](oldVnode, vnode);
- }(_d = (_c = vnode.data.hook) === null || _c === void 0 ? void 0 : _c.update) === null || _d === void 0 ? void 0 : _d.call(_c, oldVnode, vnode);
- }
- if (isUndef(vnode.text)) {
- if (isDef(oldCh) && isDef(ch)) {
- if (oldCh !== ch) updateChildren(elm, oldCh, ch, insertedVnodeQueue);
- } else if (isDef(ch)) {
- if (isDef(oldVnode.text)) api.setTextContent(elm, "");
- addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
- } else if (isDef(oldCh)) {
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
- } else if (isDef(oldVnode.text)) {
- api.setTextContent(elm, "");
- }
- } else if (oldVnode.text !== vnode.text) {
- if (isDef(oldCh)) {
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
- }
- api.setTextContent(elm, vnode.text);
- }
- (_e = hook === null || hook === void 0 ? void 0 : hook.postpatch) === null || _e === void 0 ? void 0 : _e.call(hook, oldVnode, vnode);
- }
- return function patch(oldVnode, vnode) {
- var i = void 0,
- elm = void 0,
- parent = void 0;
- var insertedVnodeQueue = [];
- for (i = 0; i < cbs.pre.length; ++i) {
- cbs.pre[i]();
- }if (!isVnode(oldVnode)) {
- oldVnode = emptyNodeAt(oldVnode);
- }
- if (sameVnode(oldVnode, vnode)) {
- patchVnode(oldVnode, vnode, insertedVnodeQueue);
- } else {
- elm = oldVnode.elm;
- parent = api.parentNode(elm);
- createElm(vnode, insertedVnodeQueue);
- if (parent !== null) {
- api.insertBefore(parent, vnode.elm, api.nextSibling(elm));
- removeVnodes(parent, [oldVnode], 0, 0);
- }
- }
- for (i = 0; i < insertedVnodeQueue.length; ++i) {
- insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]);
- }
- for (i = 0; i < cbs.post.length; ++i) {
- cbs.post[i]();
- }return vnode;
- };
- }
-
- function addNS(data, children, sel) {
- data.ns = "http://www.w3.org/2000/svg";
- if (sel !== "foreignObject" && children !== undefined) {
- for (var i = 0; i < children.length; ++i) {
- var childData = children[i].data;
- if (childData !== undefined) {
- addNS(childData, children[i].children, children[i].sel);
- }
- }
- }
- }
- function h(sel, b, c) {
- var data = {};
- var children = void 0;
- var text = void 0;
- var i = void 0;
- if (c !== undefined) {
- if (b !== null) {
- data = b;
- }
- if (array(c)) {
- children = c;
- } else if (primitive(c)) {
- text = c;
- } else if (c && c.sel) {
- children = [c];
- }
- } else if (b !== undefined && b !== null) {
- if (array(b)) {
- children = b;
- } else if (primitive(b)) {
- text = b;
- } else if (b && b.sel) {
- children = [b];
- } else {
- data = b;
- }
- }
- if (children !== undefined) {
- for (i = 0; i < children.length; ++i) {
- if (primitive(children[i])) children[i] = vnode(undefined, undefined, undefined, children[i], undefined);
- }
- }
- if (sel[0] === "s" && sel[1] === "v" && sel[2] === "g" && (sel.length === 3 || sel[3] === "." || sel[3] === "#")) {
- addNS(data, children, sel);
- }
- return vnode(sel, data, children, text, undefined);
- }
-
- function copyToThunk(vnode, thunk) {
- vnode.data.fn = thunk.data.fn;
- vnode.data.args = thunk.data.args;
- thunk.data = vnode.data;
- thunk.children = vnode.children;
- thunk.text = vnode.text;
- thunk.elm = vnode.elm;
- }
- function init$1(thunk) {
- var cur = thunk.data;
- var vnode = cur.fn.apply(undefined, cur.args);
- copyToThunk(vnode, thunk);
- }
- function prepatch(oldVnode, thunk) {
- var i = void 0;
- var old = oldVnode.data;
- var cur = thunk.data;
- var oldArgs = old.args;
- var args = cur.args;
- if (old.fn !== cur.fn || oldArgs.length !== args.length) {
- copyToThunk(cur.fn.apply(undefined, args), thunk);
- return;
- }
- for (i = 0; i < args.length; ++i) {
- if (oldArgs[i] !== args[i]) {
- copyToThunk(cur.fn.apply(undefined, args), thunk);
- return;
- }
- }
- copyToThunk(oldVnode, thunk);
- }
- var thunk = function thunk(sel, key, fn, args) {
- if (args === undefined) {
- args = fn;
- fn = key;
- key = undefined;
- }
- return h(sel, {
- key: key,
- hook: { init: init$1, prepatch: prepatch },
- fn: fn,
- args: args
- });
- };
-
- function pre(vnode, newVnode) {
- var attachData = vnode.data.attachData;
- // Copy created placeholder and real element from old vnode
- newVnode.data.attachData.placeholder = attachData.placeholder;
- newVnode.data.attachData.real = attachData.real;
- // Mount real element in vnode so the patch process operates on it
- vnode.elm = vnode.data.attachData.real;
- }
- function post(_, vnode) {
- // Mount dummy placeholder in vnode so potential reorders use it
- vnode.elm = vnode.data.attachData.placeholder;
- }
- function destroy(vnode) {
- // Remove placeholder
- if (vnode.elm !== undefined) {
- vnode.elm.parentNode.removeChild(vnode.elm);
- }
- // Remove real element from where it was inserted
- vnode.elm = vnode.data.attachData.real;
- }
- function create(_, vnode) {
- var real = vnode.elm;
- var attachData = vnode.data.attachData;
- var placeholder = document.createElement("span");
- // Replace actual element with dummy placeholder
- // Snabbdom will then insert placeholder instead
- vnode.elm = placeholder;
- attachData.target.appendChild(real);
- attachData.real = real;
- attachData.placeholder = placeholder;
- }
- function attachTo(target, vnode) {
- if (vnode.data === undefined) vnode.data = {};
- if (vnode.data.hook === undefined) vnode.data.hook = {};
- var data = vnode.data;
- var hook = vnode.data.hook;
- data.attachData = { target: target, placeholder: undefined, real: undefined };
- hook.create = create;
- hook.prepatch = pre;
- hook.postpatch = post;
- hook.destroy = destroy;
- return vnode;
- }
-
- function toVNode(node, domApi) {
- var api = domApi !== undefined ? domApi : htmlDomApi;
- var text = void 0;
- if (api.isElement(node)) {
- var id = node.id ? "#" + node.id : "";
- var cn = node.getAttribute("class");
- var c = cn ? "." + cn.split(" ").join(".") : "";
- var sel = api.tagName(node).toLowerCase() + id + c;
- var attrs = {};
- var children = [];
- var name = void 0;
- var i = void 0,
- n = void 0;
- var elmAttrs = node.attributes;
- var elmChildren = node.childNodes;
- for (i = 0, n = elmAttrs.length; i < n; i++) {
- name = elmAttrs[i].nodeName;
- if (name !== "id" && name !== "class") {
- attrs[name] = elmAttrs[i].nodeValue;
- }
- }
- for (i = 0, n = elmChildren.length; i < n; i++) {
- children.push(toVNode(elmChildren[i], domApi));
- }
- return vnode(sel, { attrs: attrs }, children, undefined, node);
- } else if (api.isText(node)) {
- text = api.getTextContent(node);
- return vnode(undefined, undefined, undefined, text, node);
- } else if (api.isComment(node)) {
- text = api.getTextContent(node);
- return vnode("!", {}, [], text, node);
- } else {
- return vnode("", {}, [], undefined, node);
- }
- }
-
- var xlinkNS = "http://www.w3.org/1999/xlink";
- var xmlNS = "http://www.w3.org/XML/1998/namespace";
- var colonChar = 58;
- var xChar = 120;
- function updateAttrs(oldVnode, vnode) {
- var key = void 0;
- var elm = vnode.elm;
- var oldAttrs = oldVnode.data.attrs;
- var attrs = vnode.data.attrs;
- if (!oldAttrs && !attrs) return;
- if (oldAttrs === attrs) return;
- oldAttrs = oldAttrs || {};
- attrs = attrs || {};
- // update modified attributes, add new attributes
- for (key in attrs) {
- var cur = attrs[key];
- var old = oldAttrs[key];
- if (old !== cur) {
- if (cur === true) {
- elm.setAttribute(key, "");
- } else if (cur === false) {
- elm.removeAttribute(key);
- } else {
- if (key.charCodeAt(0) !== xChar) {
- elm.setAttribute(key, cur);
- } else if (key.charCodeAt(3) === colonChar) {
- // Assume xml namespace
- elm.setAttributeNS(xmlNS, key, cur);
- } else if (key.charCodeAt(5) === colonChar) {
- // Assume xlink namespace
- elm.setAttributeNS(xlinkNS, key, cur);
- } else {
- elm.setAttribute(key, cur);
- }
- }
- }
- }
- // remove removed attributes
- // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)
- // the other option is to remove all attributes with value == undefined
- for (key in oldAttrs) {
- if (!(key in attrs)) {
- elm.removeAttribute(key);
- }
- }
- }
- var attributesModule = { create: updateAttrs, update: updateAttrs };
-
- function updateClass(oldVnode, vnode) {
- var cur = void 0;
- var name = void 0;
- var elm = vnode.elm;
- var oldClass = oldVnode.data["class"];
- var klass = vnode.data["class"];
- if (!oldClass && !klass) return;
- if (oldClass === klass) return;
- oldClass = oldClass || {};
- klass = klass || {};
- for (name in oldClass) {
- if (oldClass[name] && !Object.prototype.hasOwnProperty.call(klass, name)) {
- // was `true` and now not provided
- elm.classList.remove(name);
- }
- }
- for (name in klass) {
- cur = klass[name];
- if (cur !== oldClass[name]) {
- elm.classList[cur ? "add" : "remove"](name);
- }
- }
- }
- var classModule = { create: updateClass, update: updateClass };
-
- var CAPS_REGEX = /[A-Z]/g;
- function updateDataset(oldVnode, vnode) {
- var elm = vnode.elm;
- var oldDataset = oldVnode.data.dataset;
- var dataset = vnode.data.dataset;
- var key = void 0;
- if (!oldDataset && !dataset) return;
- if (oldDataset === dataset) return;
- oldDataset = oldDataset || {};
- dataset = dataset || {};
- var d = elm.dataset;
- for (key in oldDataset) {
- if (!dataset[key]) {
- if (d) {
- if (key in d) {
- delete d[key];
- }
- } else {
- elm.removeAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase());
- }
- }
- }
- for (key in dataset) {
- if (oldDataset[key] !== dataset[key]) {
- if (d) {
- d[key] = dataset[key];
- } else {
- elm.setAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase(), dataset[key]);
- }
- }
- }
- }
- var datasetModule = { create: updateDataset, update: updateDataset };
-
- function invokeHandler(handler, vnode, event) {
- if (typeof handler === "function") {
- // call function handler
- handler.call(vnode, event, vnode);
- } else if (typeof handler === "object") {
- // call multiple handlers
- for (var i = 0; i < handler.length; i++) {
- invokeHandler(handler[i], vnode, event);
- }
- }
- }
- function handleEvent(event, vnode) {
- var name = event.type;
- var on = vnode.data.on;
- // call event handler(s) if exists
- if (on && on[name]) {
- invokeHandler(on[name], vnode, event);
- }
- }
- function createListener() {
- return function handler(event) {
- handleEvent(event, handler.vnode);
- };
- }
- function updateEventListeners(oldVnode, vnode) {
- var oldOn = oldVnode.data.on;
- var oldListener = oldVnode.listener;
- var oldElm = oldVnode.elm;
- var on = vnode && vnode.data.on;
- var elm = vnode && vnode.elm;
- var name = void 0;
- // optimization for reused immutable handlers
- if (oldOn === on) {
- return;
- }
- // remove existing listeners which no longer used
- if (oldOn && oldListener) {
- // if element changed or deleted we remove all existing listeners unconditionally
- if (!on) {
- for (name in oldOn) {
- // remove listener if element was changed or existing listeners removed
- oldElm.removeEventListener(name, oldListener, false);
- }
- } else {
- for (name in oldOn) {
- // remove listener if existing listener removed
- if (!on[name]) {
- oldElm.removeEventListener(name, oldListener, false);
- }
- }
- }
- }
- // add new listeners which has not already attached
- if (on) {
- // reuse existing listener or create new
- var listener = vnode.listener = oldVnode.listener || createListener();
- // update vnode for listener
- listener.vnode = vnode;
- // if element changed or added we add all needed listeners unconditionally
- if (!oldOn) {
- for (name in on) {
- // add listener if element was changed or new listeners added
- elm.addEventListener(name, listener, false);
- }
- } else {
- for (name in on) {
- // add listener if new listener added
- if (!oldOn[name]) {
- elm.addEventListener(name, listener, false);
- }
- }
- }
- }
- }
- var eventListenersModule = {
- create: updateEventListeners,
- update: updateEventListeners,
- destroy: updateEventListeners
- };
-
- var raf = typeof window !== "undefined" && window.requestAnimationFrame || setTimeout;
- var nextFrame = function nextFrame(fn) {
- raf(function () {
- raf(fn);
- });
- };
- function setNextFrame(obj, prop, val) {
- nextFrame(function () {
- obj[prop] = val;
- });
- }
- function getTextNodeRect(textNode) {
- var rect = void 0;
- if (document.createRange) {
- var range = document.createRange();
- range.selectNodeContents(textNode);
- if (range.getBoundingClientRect) {
- rect = range.getBoundingClientRect();
- }
- }
- return rect;
- }
- function calcTransformOrigin(isTextNode, textRect, boundingRect) {
- if (isTextNode) {
- if (textRect) {
- // calculate pixels to center of text from left edge of bounding box
- var relativeCenterX = textRect.left + textRect.width / 2 - boundingRect.left;
- var relativeCenterY = textRect.top + textRect.height / 2 - boundingRect.top;
- return relativeCenterX + "px " + relativeCenterY + "px";
- }
- }
- return "0 0"; // top left
- }
- function getTextDx(oldTextRect, newTextRect) {
- if (oldTextRect && newTextRect) {
- return oldTextRect.left + oldTextRect.width / 2 - (newTextRect.left + newTextRect.width / 2);
- }
- return 0;
- }
- function getTextDy(oldTextRect, newTextRect) {
- if (oldTextRect && newTextRect) {
- return oldTextRect.top + oldTextRect.height / 2 - (newTextRect.top + newTextRect.height / 2);
- }
- return 0;
- }
- function isTextElement(elm) {
- return elm.childNodes.length === 1 && elm.childNodes[0].nodeType === 3;
- }
- var removed = void 0;
- var created = void 0;
- function pre$1() {
- removed = {};
- created = [];
- }
- function create$1(oldVnode, vnode) {
- var hero = vnode.data.hero;
- if (hero && hero.id) {
- created.push(hero.id);
- created.push(vnode);
- }
- }
- function destroy$1(vnode) {
- var hero = vnode.data.hero;
- if (hero && hero.id) {
- var elm = vnode.elm;
- vnode.isTextNode = isTextElement(elm); // is this a text node?
- vnode.boundingRect = elm.getBoundingClientRect(); // save the bounding rectangle to a new property on the vnode
- vnode.textRect = vnode.isTextNode ? getTextNodeRect(elm.childNodes[0]) : null; // save bounding rect of inner text node
- var computedStyle = window.getComputedStyle(elm, undefined); // get current styles (includes inherited properties)
- vnode.savedStyle = JSON.parse(JSON.stringify(computedStyle)); // save a copy of computed style values
- removed[hero.id] = vnode;
- }
- }
- function post$1() {
- var i = void 0,
- id = void 0,
- newElm = void 0,
- oldVnode = void 0,
- oldElm = void 0,
- hRatio = void 0,
- wRatio = void 0,
- oldRect = void 0,
- newRect = void 0,
- dx = void 0,
- dy = void 0,
- origTransform = void 0,
- origTransition = void 0,
- newStyle = void 0,
- oldStyle = void 0,
- newComputedStyle = void 0,
- isTextNode = void 0,
- newTextRect = void 0,
- oldTextRect = void 0;
- for (i = 0; i < created.length; i += 2) {
- id = created[i];
- newElm = created[i + 1].elm;
- oldVnode = removed[id];
- if (oldVnode) {
- isTextNode = oldVnode.isTextNode && isTextElement(newElm); // Are old & new both text?
- newStyle = newElm.style;
- newComputedStyle = window.getComputedStyle(newElm, undefined); // get full computed style for new element
- oldElm = oldVnode.elm;
- oldStyle = oldElm.style;
- // Overall element bounding boxes
- newRect = newElm.getBoundingClientRect();
- oldRect = oldVnode.boundingRect; // previously saved bounding rect
- // Text node bounding boxes & distances
- if (isTextNode) {
- newTextRect = getTextNodeRect(newElm.childNodes[0]);
- oldTextRect = oldVnode.textRect;
- dx = getTextDx(oldTextRect, newTextRect);
- dy = getTextDy(oldTextRect, newTextRect);
- } else {
- // Calculate distances between old & new positions
- dx = oldRect.left - newRect.left;
- dy = oldRect.top - newRect.top;
- }
- hRatio = newRect.height / Math.max(oldRect.height, 1);
- wRatio = isTextNode ? hRatio : newRect.width / Math.max(oldRect.width, 1); // text scales based on hRatio
- // Animate new element
- origTransform = newStyle.transform;
- origTransition = newStyle.transition;
- if (newComputedStyle.display === "inline") {
- // inline elements cannot be transformed
- newStyle.display = "inline-block"; // this does not appear to have any negative side effects
- }
- newStyle.transition = origTransition + "transform 0s";
- newStyle.transformOrigin = calcTransformOrigin(isTextNode, newTextRect, newRect);
- newStyle.opacity = "0";
- newStyle.transform = origTransform + "translate(" + dx + "px, " + dy + "px) " + "scale(" + 1 / wRatio + ", " + 1 / hRatio + ")";
- setNextFrame(newStyle, "transition", origTransition);
- setNextFrame(newStyle, "transform", origTransform);
- setNextFrame(newStyle, "opacity", "1");
- // Animate old element
- for (var key in oldVnode.savedStyle) {
- // re-apply saved inherited properties
- if (String(parseInt(key)) !== key) {
- var ms = key.substring(0, 2) === "ms";
- var moz = key.substring(0, 3) === "moz";
- var webkit = key.substring(0, 6) === "webkit";
- if (!ms && !moz && !webkit) {
- // ignore prefixed style properties
- oldStyle[key] = oldVnode.savedStyle[key];
- }
- }
- }
- oldStyle.position = "absolute";
- oldStyle.top = oldRect.top + "px"; // start at existing position
- oldStyle.left = oldRect.left + "px";
- oldStyle.width = oldRect.width + "px"; // Needed for elements who were sized relative to their parents
- oldStyle.height = oldRect.height + "px"; // Needed for elements who were sized relative to their parents
- oldStyle.margin = "0"; // Margin on hero element leads to incorrect positioning
- oldStyle.transformOrigin = calcTransformOrigin(isTextNode, oldTextRect, oldRect);
- oldStyle.transform = "";
- oldStyle.opacity = "1";
- document.body.appendChild(oldElm);
- setNextFrame(oldStyle, "transform", "translate(" + -dx + "px, " + -dy + "px) scale(" + wRatio + ", " + hRatio + ")"); // scale must be on far right for translate to be correct
- setNextFrame(oldStyle, "opacity", "0");
- oldElm.addEventListener("transitionend", function (ev) {
- if (ev.propertyName === "transform") {
- document.body.removeChild(ev.target);
- }
- });
- }
- }
- removed = created = undefined;
- }
- var heroModule = {
- pre: pre$1,
- create: create$1,
- destroy: destroy$1,
- post: post$1
- };
-
- function updateProps(oldVnode, vnode) {
- var key = void 0;
- var cur = void 0;
- var old = void 0;
- var elm = vnode.elm;
- var oldProps = oldVnode.data.props;
- var props = vnode.data.props;
- if (!oldProps && !props) return;
- if (oldProps === props) return;
- oldProps = oldProps || {};
- props = props || {};
- for (key in props) {
- cur = props[key];
- old = oldProps[key];
- if (old !== cur && (key !== "value" || elm[key] !== cur)) {
- elm[key] = cur;
- }
- }
- }
- var propsModule = { create: updateProps, update: updateProps };
-
- // Bindig `requestAnimationFrame` like this fixes a bug in IE/Edge. See #360 and #409.
- var raf$1 = typeof window !== "undefined" && (window.requestAnimationFrame && window.requestAnimationFrame.bind(window)) || setTimeout;
- var nextFrame$1 = function nextFrame$1(fn) {
- raf$1(function () {
- raf$1(fn);
- });
- };
- var reflowForced = false;
- function setNextFrame$1(obj, prop, val) {
- nextFrame$1(function () {
- obj[prop] = val;
- });
- }
- function updateStyle(oldVnode, vnode) {
- var cur = void 0;
- var name = void 0;
- var elm = vnode.elm;
- var oldStyle = oldVnode.data.style;
- var style = vnode.data.style;
- if (!oldStyle && !style) return;
- if (oldStyle === style) return;
- oldStyle = oldStyle || {};
- style = style || {};
- var oldHasDel = "delayed" in oldStyle;
- for (name in oldStyle) {
- if (!style[name]) {
- if (name[0] === "-" && name[1] === "-") {
- elm.style.removeProperty(name);
- } else {
- elm.style[name] = "";
- }
- }
- }
- for (name in style) {
- cur = style[name];
- if (name === "delayed" && style.delayed) {
- for (var name2 in style.delayed) {
- cur = style.delayed[name2];
- if (!oldHasDel || cur !== oldStyle.delayed[name2]) {
- setNextFrame$1(elm.style, name2, cur);
- }
- }
- } else if (name !== "remove" && cur !== oldStyle[name]) {
- if (name[0] === "-" && name[1] === "-") {
- elm.style.setProperty(name, cur);
- } else {
- elm.style[name] = cur;
- }
- }
- }
- }
- function applyDestroyStyle(vnode) {
- var style = void 0;
- var name = void 0;
- var elm = vnode.elm;
- var s = vnode.data.style;
- if (!s || !(style = s.destroy)) return;
- for (name in style) {
- elm.style[name] = style[name];
- }
- }
- function applyRemoveStyle(vnode, rm) {
- var s = vnode.data.style;
- if (!s || !s.remove) {
- rm();
- return;
- }
- if (!reflowForced) {
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
- vnode.elm.offsetLeft;
- reflowForced = true;
- }
- var name = void 0;
- var elm = vnode.elm;
- var i = 0;
- var style = s.remove;
- var amount = 0;
- var applied = [];
- for (name in style) {
- applied.push(name);
- elm.style[name] = style[name];
- }
- var compStyle = getComputedStyle(elm);
- var props = compStyle["transition-property"].split(", ");
- for (; i < props.length; ++i) {
- if (applied.indexOf(props[i]) !== -1) amount++;
- }
- elm.addEventListener("transitionend", function (ev) {
- if (ev.target === elm) --amount;
- if (amount === 0) rm();
- });
- }
- function forceReflow() {
- reflowForced = false;
- }
- var styleModule = {
- pre: forceReflow,
- create: updateStyle,
- update: updateStyle,
- destroy: applyDestroyStyle,
- remove: applyRemoveStyle
- };
-
- exports.array = array;
- exports.attachTo = attachTo;
- exports.attributesModule = attributesModule;
- exports.classModule = classModule;
- exports.datasetModule = datasetModule;
- exports.eventListenersModule = eventListenersModule;
- exports.h = h;
- exports.heroModule = heroModule;
- exports.htmlDomApi = htmlDomApi;
- exports.init = init;
- exports.primitive = primitive;
- exports.propsModule = propsModule;
- exports.styleModule = styleModule;
- exports.thunk = thunk;
- exports.toVNode = toVNode;
- exports.vnode = vnode;
-
- exports.__esModule = true;
-});
diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js
index 35d005cd6..c77953401 100644
--- a/src/widget/multiselect/multiselect.insert.combo.js
+++ b/src/widget/multiselect/multiselect.insert.combo.js
@@ -81,7 +81,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
- self._joinKeywords(keywords, function () {
+ self._joinKeywords(keywords.slice(0, 2000), function () {
if (BI.endWith(last, BI.BlankSplitChar)) {
self.combo.setValue(self.storeValue);
assertShowValue();
@@ -93,6 +93,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}
self._dataChange = true;
});
+ keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand"));
}
self.fireEvent(BI.MultiSelectInsertCombo.EVENT_SEARCHING);
});
diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js
index fe1293a5c..28065441e 100644
--- a/src/widget/multiselect/multiselect.insert.combo.nobar.js
+++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js
@@ -76,7 +76,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
- self._joinKeywords(keywords, function () {
+ self._joinKeywords(keywords.slice(0, 2000), function () {
if (BI.endWith(last, BI.BlankSplitChar)) {
self.combo.setValue(self.storeValue);
assertShowValue();
@@ -88,6 +88,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}
self._dataChange = true;
});
+ keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand"));
}
});
diff --git a/src/widget/multiselectlist/multiselectlist.insert.js b/src/widget/multiselectlist/multiselectlist.insert.js
index 2fe856a8e..b27d1271b 100644
--- a/src/widget/multiselectlist/multiselectlist.insert.js
+++ b/src/widget/multiselectlist/multiselectlist.insert.js
@@ -126,7 +126,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
- self._joinKeywords(keywords, function () {
+ self._joinKeywords(keywords.slice(0, 2000), function () {
if (BI.endWith(last, BI.BlankSplitChar)) {
self.adapter.setValue(self.storeValue);
assertShowValue();
@@ -138,6 +138,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
}
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
});
+ keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand"));
}
}
}, {
diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js
index e4b74eff3..6e5f1d65b 100644
--- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js
+++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js
@@ -129,7 +129,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
- self._joinKeywords(keywords, function () {
+ self._joinKeywords(keywords.slice(0, 2000), function () {
if (BI.endWith(last, BI.BlankSplitChar)) {
self.adapter.setValue(self.storeValue);
assertShowValue();
@@ -141,6 +141,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
}
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
});
+ keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand"));
}
}
}, {
diff --git a/src/widget/numberinterval/numberinterval.js b/src/widget/numberinterval/numberinterval.js
index b0b5579b5..9e2df9825 100644
--- a/src/widget/numberinterval/numberinterval.js
+++ b/src/widget/numberinterval/numberinterval.js
@@ -66,7 +66,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
});
BI.createWidget({
type: "bi.absolute",
- element: this.smallEditor.element,
+ element: this.smallEditor,
items: [{
el: this.smallTip,
top: 0,
@@ -104,7 +104,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
});
BI.createWidget({
type: "bi.absolute",
- element: this.bigEditor.element,
+ element: this.bigEditor,
items: [{
el: this.bigTip,
top: 0,
@@ -548,4 +548,4 @@ BI.NumberInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.NumberInterval.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.NumberInterval.EVENT_VALID = "EVENT_VALID";
BI.NumberInterval.EVENT_ERROR = "EVENT_ERROR";
-BI.shortcut("bi.number_interval", BI.NumberInterval);
\ No newline at end of file
+BI.shortcut("bi.number_interval", BI.NumberInterval);