Browse Source

Merging in latest from upstream (VISUAL/fineui:refs/heads/master)

* commit '2c0ce8b026d8d77dcb95b757e7278072338b5e8b': (45 commits)
  auto upgrade version to 2.0.20210329115159
  auto upgrade version to 2.0.20210329113226
  优化布局
  优化布局
  auto upgrade version to 2.0.20210329093227
  auto upgrade version to 2.0.20210328170229
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  优化布局
  ...
es6
Kira 4 years ago
parent
commit
ed47d8bc8f
  1. 3
      changelog.md
  2. 4
      dist/2.0/fineui.css
  3. 4
      dist/2.0/fineui.ie.min.js
  4. 2
      dist/2.0/fineui.ie.min.js.map
  5. 3240
      dist/2.0/fineui.js
  6. 2
      dist/2.0/fineui.js.map
  7. 4
      dist/2.0/fineui.min.css
  8. 4
      dist/2.0/fineui.min.js
  9. 2
      dist/2.0/fineui.min.js.map
  10. 4
      dist/2.0/fineui_without_normalize.css
  11. 4
      dist/2.0/fineui_without_normalize.min.css
  12. 4
      dist/core.css
  13. 3206
      dist/core.js
  14. 2
      dist/core.js.map
  15. 4
      dist/demo.css
  16. 3574
      dist/demo.js
  17. 2
      dist/demo.js.map
  18. 4
      dist/fineui.css
  19. 4
      dist/fineui.ie.min.js
  20. 2
      dist/fineui.ie.min.js.map
  21. 3244
      dist/fineui.js
  22. 2
      dist/fineui.js.map
  23. 4
      dist/fineui.min.css
  24. 4
      dist/fineui.min.js
  25. 2
      dist/fineui.min.js.map
  26. 2223
      dist/fineui_without_jquery_polyfill.js
  27. 2
      dist/fineui_without_jquery_polyfill.js.map
  28. 2
      dist/font.css
  29. 2
      dist/resource.css
  30. 26
      dist/utils.js
  31. 2
      dist/utils.js.map
  32. 4
      dist/utils.min.js
  33. 2
      dist/utils.min.js.map
  34. 2
      package.json
  35. 12
      src/core/base.js
  36. 111
      src/core/platform/web/config.js
  37. 4
      src/core/plugin.js
  38. 34
      src/core/shortcut.js
  39. 2
      src/core/wrapper/layout/adapt/adapt.table.js
  40. 76
      src/core/wrapper/layout/adapt/inline.center.js
  41. 76
      src/core/wrapper/layout/adapt/inline.horizontal.js
  42. 63
      src/core/wrapper/layout/adapt/inline.vertical.js
  43. 17
      src/core/wrapper/layout/flex/flex.horizontal.js
  44. 102
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  45. 17
      src/core/wrapper/layout/flex/flex.vertical.js
  46. 18
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  47. 18
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  48. 46
      src/core/wrapper/layout/layout.flow.js
  49. 2
      src/core/wrapper/layout/layout.horizontal.js
  50. 45
      src/core/wrapper/layout/layout.inline.js
  51. 14
      src/core/wrapper/layout/layout.table.js
  52. 45
      src/core/wrapper/layout/layout.td.js
  53. 51
      src/less/core/wrapper/flex.horizontal.less
  54. 5
      src/less/core/wrapper/flex.leftrightvertical.center.less
  55. 53
      src/less/core/wrapper/flex.vertical.less
  56. 97
      src/less/core/wrapper/flex.wrapper.horizontal.less
  57. 114
      src/less/core/wrapper/flex.wrapper.vertical.less
  58. 24
      src/less/core/wrapper/inline.less
  59. 4
      src/widget/date/calendar/picker.year.js
  60. 8
      src/widget/date/calendar/popup.month.js
  61. 11
      src/widget/date/calendar/popup.year.js
  62. 2
      src/widget/datepane/datepane.js
  63. 2
      src/widget/datetimepane/datetimepane.js
  64. 4
      src/widget/dynamicdate/dynamicdate.card.js
  65. 3
      src/widget/dynamicdate/dynamicdate.combo.js
  66. 2
      src/widget/dynamicdate/dynamicdate.popup.js
  67. 3
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  68. 2
      src/widget/dynamicdatetime/dynamicdatetime.popup.js
  69. 4
      src/widget/singleselect/search/singleselect.search.loader.js
  70. 4
      src/widget/singleselect/singleselect.loader.js
  71. 6
      src/widget/year/card.dynamic.year.js
  72. 2
      src/widget/year/popup.year.js
  73. 76
      src/widget/yearmonth/card.dynamic.yearmonth.js
  74. 18
      src/widget/yearmonth/combo.yearmonth.js
  75. 2
      src/widget/yearmonth/popup.yearmonth.js
  76. 76
      src/widget/yearquarter/card.dynamic.yearquarter.js
  77. 18
      src/widget/yearquarter/combo.yearquarter.js
  78. 2
      src/widget/yearquarter/popup.yearquarter.js

3
changelog.md

@ -1,5 +1,8 @@
# 更新日志
2.0(2021-03)
- 优化left_right_vertical_adapt布局,去掉float属性只使用flex
- inline布局支持用calc计算fill列宽度
- 时间类型控件无翻页限制
- 时间类型控件优化动态时间面板的交互
2.0(2021-02)

4
dist/2.0/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

3240
dist/2.0/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/2.0/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.css vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui_without_normalize.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/core.css vendored

File diff suppressed because one or more lines are too long

3206
dist/core.js vendored

File diff suppressed because it is too large Load Diff

2
dist/core.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/demo.css vendored

File diff suppressed because one or more lines are too long

3574
dist/demo.js vendored

File diff suppressed because it is too large Load Diff

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

3244
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

2223
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui_without_jquery_polyfill.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/font.css vendored

File diff suppressed because one or more lines are too long

2
dist/resource.css vendored

File diff suppressed because one or more lines are too long

26
dist/utils.js vendored

@ -1,4 +1,4 @@
/*! time: 2021-3-19 14:20:27 */
/*! time: 2021-3-29 11:50:22 */
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@ -82,12 +82,12 @@
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1240);
/******/ return __webpack_require__(__webpack_require__.s = 1243);
/******/ })
/************************************************************************/
/******/ ({
/***/ 1101:
/***/ 1104:
/***/ (function(module, exports) {
BI.i18n = {
@ -327,7 +327,7 @@ __webpack_require__(125)(__webpack_require__(126))
/***/ }),
/***/ 1240:
/***/ 1243:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(123);
@ -357,8 +357,8 @@ __webpack_require__(140);
__webpack_require__(141);
__webpack_require__(142);
__webpack_require__(143);
__webpack_require__(1101);
__webpack_require__(1241);
__webpack_require__(1104);
__webpack_require__(1244);
__webpack_require__(153);
__webpack_require__(154);
module.exports = __webpack_require__(155);
@ -366,7 +366,7 @@ module.exports = __webpack_require__(155);
/***/ }),
/***/ 1241:
/***/ 1244:
/***/ (function(module, exports) {
/**
@ -923,14 +923,10 @@ if (!_global.BI) {
});
_.extend(BI, {
inherit: function (sb, sp, overrides) {
if (typeof sp === "object") {
overrides = sp;
sp = sb;
sb = function () {
return sp.apply(this, arguments);
};
}
inherit: function (sp, overrides) {
var sb = function () {
return sp.apply(this, arguments);
};
var F = function () {
}, spp = sp.prototype;
F.prototype = spp;

2
dist/utils.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/utils.min.js.map vendored

File diff suppressed because one or more lines are too long

2
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20210319142224",
"version": "2.0.20210329115159",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",

12
src/core/base.js

@ -437,14 +437,10 @@ if (!_global.BI) {
});
_.extend(BI, {
inherit: function (sb, sp, overrides) {
if (typeof sp === "object") {
overrides = sp;
sp = sb;
sb = function () {
return sp.apply(this, arguments);
};
}
inherit: function (sp, overrides) {
var sb = function () {
return sp.apply(this, arguments);
};
var F = function () {
}, spp = sp.prototype;
F.prototype = spp;

111
src/core/platform/web/config.js

@ -21,40 +21,73 @@ BI.prepares.push(function () {
// 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况)
// 主要出现在center_adapt或者horizontal_adapt的场景,或者主动设置horizontalAlign的场景
if (ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch) {
// 虽然有两个元素以上的时候,有场景是控制一个显示一个隐藏的效果,还无法通过flex来实现
// var justOneItem = (ob.items && ob.items.length <= 1);
// // 在这种情况下,也可以通过flex支持该布局
// if (supportFlex) {
// // IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// // if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) {
// return BI.extend({}, ob, {
// type: "bi.flex_horizontal",
// horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center
// ? BI.HorizontalAlign.Left : ob.horizontalAlign
// });
// // }
// }
// // IE9以上可以使用calc计算布局
// if (!isIE || BI.getIEVersion() > 8) {
// return BI.extend({}, ob, {
// type: "bi.inline",
// horizontalAlign: !justOneItem && ob.horizontalAlign === BI.HorizontalAlign.Center
// ? BI.HorizontalAlign.Left : ob.horizontalAlign
// });
// }
return BI.extend({}, ob, {type: "bi.table_adapt"});
}
if (!isIE && supportFlex) {
if (supportFlex) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_horizontal"});
// }
}
// // 解决使用inline_vertical_adapt的顺序问题
// // 从右往左放置时,为了兼容,我们统一采用从右到左的放置方式
// if (ob.horizontalAlign === BI.HorizontalAlign.Right) {
// return BI.extend({verticalAlign: BI.VerticalAlign.Top}, ob, {
// type: "bi.inline_vertical_adapt",
// items: ob.items && ob.items.reverse()
// // IE9以上采用inline
// if (!isIE || BI.getIEVersion() > 8) {
// return BI.extend({}, ob, {
// type: "bi.inline"
// });
// }
// 否则采用table,不过horizontalAlign的right就不支持了。
return BI.extend({}, ob, {type: "bi.table_adapt"});
});
BI.Plugin.configWidget("bi.center_adapt", function (ob) {
var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var isAdapt = !ob.horizontalAlign || ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
if (!isAdapt || justOneItem) {
if (!isIE && supportFlex) {
if (supportFlex) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!isIE || (ob.scrollable !== true && ob.scrollx !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_center_adapt"});
// }
}
if (!BI.isIE() || BI.getIEVersion() > 8) {
return BI.extend({}, ob, {type: "bi.inline_center_adapt"});
}
return BI.extend({}, ob, {type: "bi.inline_center_adapt"});
}
return ob;
});
BI.Plugin.configWidget("bi.vertical_adapt", function (ob) {
var isIE = BI.isIE(), supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var supportFlex = isSupportFlex(), justOneItem = (ob.items && ob.items.length <= 1);
var isAdapt = ob.horizontalAlign === BI.HorizontalAlign.Center || ob.horizontalAlign === BI.HorizontalAlign.Stretch;
if (!isAdapt || justOneItem) {
if (!isIE && supportFlex) {
return BI.extend({}, ob, {type: "bi.flex_vertical_center_adapt"});
if (supportFlex) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!isIE || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_vertical_adapt"});
// }
}
if (!BI.isIE() || BI.getIEVersion() > 8) {
return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"});
}
return BI.extend({}, ob, {type: "bi.inline_vertical_adapt"});
}
return ob;
});
@ -68,45 +101,35 @@ BI.prepares.push(function () {
return ob;
});
BI.Plugin.configWidget("bi.horizontal_float", function (ob) {
if (!BI.isIE() && isSupportFlex()) {
if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!BI.isIE() || (ob.scrollable !== true && ob.scrollx !== true)) {
return BI.extend({}, ob, {type: "bi.flex_horizontal_adapt"});
// }
}
return BI.extend({}, ob, {type: "bi.inline_horizontal_adapt"});
});
BI.Plugin.configWidget("bi.flex_horizontal", function (ob) {
if (ob.scrollable === true || ob.scrolly === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"});
}
});
BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"});
}
});
BI.Plugin.configWidget("bi.flex_horizontal_adapt", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"});
BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) {
if (isSupportFlex()) {
// IE下其实也是可以使用flex布局的,只要排除掉出现滚动条的情况
// if (!BI.isIE() || (ob.scrollable !== true && ob.scrolly !== true)) {
return BI.extend({}, ob, {type: "bi.flex_left_right_vertical_adapt"});
// }
}
return ob;
});
BI.Plugin.configWidget("bi.flex_vertical_adapt", function (ob) {
if (ob.scrollable === true || ob.scrolly === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"});
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不生效
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal"});
}
}
});
BI.Plugin.configWidget("bi.flex_horizontal_center_adapt", function (ob) {
BI.Plugin.configWidget("bi.flex_vertical", function (ob) {
if (ob.scrollable === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_horizontal_adapt"});
}
});
BI.Plugin.configWidget("bi.flex_vertical_center_adapt", function (ob) {
if (ob.scrollable === true || ob.scrolly === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical_adapt"});
}
});
BI.Plugin.configWidget("bi.flex_center_adapt", function (ob) {
if (ob.scrollable === true || ob.scrolly === true || ob.scrollx === true) {
return BI.extend({}, ob, {type: "bi.flex_scrollable_center_adapt"});
if (ob.hgap > 0 || ob.rgap > 0) {// flex中最后一个margin-right不生效
return BI.extend({}, ob, {type: "bi.flex_scrollable_vertical"});
}
}
});

4
src/core/plugin.js

@ -81,6 +81,10 @@ BI.Plugin = BI.Plugin || {};
return res || object;
},
hasObject: function (type) {
return __GlobalObjectConfigFns.length > 0 || !!_ObjectPlugin[type];
},
registerObject: function (type, fn) {
if (!_ObjectPlugin[type]) {
_ObjectPlugin[type] = [];

34
src/core/shortcut.js

@ -56,24 +56,34 @@
if (item.type || options.type) {
el = BI.extend({}, options, item);
w = BI.Plugin.getWidget(el.type, el);
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
if (w.type === el.type) {
if (BI.Plugin.hasObject(el.type)) {
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
}
}]);
}
}]);
return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy);
return createWidget(w, context, lazy);
}
return BI.createWidget(w, options, context, lazy);
}
if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el);
w = BI.Plugin.getWidget(el.type, el);
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
if (w.type === el.type) {
if (BI.Plugin.hasObject(el.type)) {
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(el.type, this);
}
}]);
}
}]);
return w.type === el.type ? createWidget(w, context, lazy) : BI.createWidget(BI.extend({/**important**/}, el, {type: w.type}), options, context, lazy);
return createWidget(w, context, lazy);
}
return BI.createWidget(w, options, context, lazy);
}
if (BI.isWidget(item.el)) {
return item.el;

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

@ -35,7 +35,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i];
var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]);
if (!this.hasWidget(this._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});

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

@ -25,67 +25,27 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.css({
whiteSpace: "nowrap",
textAlign: o.horizontalAlign
});
this.populate(o.items);
},
_addElement: function (i, item, length) {
var o = this.options;
var w = BI.InlineCenterAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative",
"vertical-align": o.verticalAlign
});
w.element.addClass("i-c-a-item");
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))
});
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
var self = this, o = this.options;
return {
type: "bi.inline",
ref: function (_ref) {
self.layout = _ref;
},
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
},
populate: function (items) {
BI.InlineCenterAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.inline_center_adapt", BI.InlineCenterAdaptLayout);

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

@ -25,67 +25,27 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.InlineHorizontalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.css({
whiteSpace: "nowrap",
textAlign: o.horizontalAlign
});
this.populate(o.items);
},
_addElement: function (i, item, length) {
var o = this.options;
var w = BI.InlineHorizontalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative",
"vertical-align": o.verticalAlign
});
w.element.addClass("i-h-a-item");
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
});
}
return w;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
var self = this, o = this.options;
return {
type: "bi.inline",
ref: function (_ref) {
self.layout = _ref;
},
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
},
populate: function (items) {
BI.InlineHorizontalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.inline_horizontal_adapt", BI.InlineHorizontalAdaptLayout);

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

@ -25,54 +25,27 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.InlineVerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.css({
whiteSpace: "nowrap",
textAlign: o.horizontalAlign
});
this.populate(o.items);
},
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
position: "relative",
"vertical-align": o.verticalAlign
});
w.element.addClass("i-v-a-item");
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
});
}
return w;
},
resize: function () {
this.stroke(this.options.items);
var self = this, o = this.options;
return {
type: "bi.inline",
ref: function (_ref) {
self.layout = _ref;
},
items: o.items,
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
columnSize: o.columnSize,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
},
populate: function (items) {
BI.InlineVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
this.layout.populate.apply(this.layout, arguments);
}
});
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);

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

@ -35,17 +35,24 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
position: "relative"
});
if (o.columnSize[i] !== "auto") {
if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] !== "") {
w.element.addClass("fill");
if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] === "fill") {
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.columnSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

102
src/core/wrapper/layout/flex/flex.leftrightvertical.center.js

@ -0,0 +1,102 @@
BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FlexLeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-f-lr-v-c",
items: {},
llgap: 0,
lrgap: 0,
lhgap: 0,
ltgap: 0,
lbgap: 0,
lvgap: 0,
rlgap: 0,
rrgap: 0,
rhgap: 0,
rtgap: 0,
rbgap: 0,
rvgap: 0
});
},
render: function () {
var o = this.options, self = this;
BI.FlexLeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.flex_vertical_adapt",
ref: function (_ref) {
self.layout = _ref;
},
items: this._formatItems(),
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable
};
},
_formatItems: function () {
var o = this.options;
var leftItems = o.items.left || [];
var rightItems = o.items.right || [];
leftItems = BI.map(leftItems, function (i, item) {
var json = {
el: BI.stripEL(item)
};
if (o.lvgap + o.ltgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
json.tgap = o.lvgap + o.ltgap + (item.tgap || 0) + (item.vgap || 0);
}
if (o.lhgap + o.llgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
json.lgap = (i === 0 ? o.lhgap : 0) + o.llgap + (item.lgap || 0) + (item.hgap || 0);
}
if (o.lhgap + o.lrgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
json.rgap = o.lhgap + o.lrgap + (item.rgap || 0) + (item.hgap || 0);
}
if (o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
json.bgap = o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0);
}
return json;
});
rightItems = BI.map(rightItems, function (i, item) {
if (i === 0) {
if (BI.isWidget(item)) {
item.element.addClass("flex-left-auto");
} else {
var t = BI.stripEL(item);
t.cls = (t.cls || "") + " flex-left-auto";
}
}
var json = {
el: BI.stripEL(item)
};
if (o.rvgap + o.rtgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
json.tgap = o.rvgap + o.rtgap + (item.tgap || 0) + (item.vgap || 0);
}
if (o.rhgap + o.rlgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
if (i > 0) {
json.lgap = o.rlgap + (item.lgap || 0) + (item.hgap || 0);
}
}
if (o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
json.rgap = o.rhgap + o.rrgap + (item.rgap || 0) + (item.hgap || 0);
}
if (o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
json.bgap = o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0);
}
return json;
});
return leftItems.concat(rightItems);
},
resize: function () {
// console.log("left_right_vertical_adapt布局不需要resize");
},
addItem: function () {
// do nothing
throw new Error("cannot be added");
},
populate: function (items) {
this.options.items = items;
this.layout.populate(this._formatItems());
}
});
BI.shortcut("bi.flex_left_right_vertical_adapt", BI.FlexLeftRightVerticalAdaptLayout);

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

@ -34,17 +34,24 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
position: "relative"
});
if (o.rowSize[i] !== "auto") {
if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] !== "") {
w.element.addClass("fill");
if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] === "fill") {
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.rowSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

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

@ -8,7 +8,7 @@
BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FlexWrapperHorizontalLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-f-s-h clearfix",
baseCls: "bi-f-s-h",
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: [],
@ -25,6 +25,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
render: function () {
BI.FlexWrapperHorizontalLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.$wrapper = BI.Widget._renderEngine.createElement("<div>").addClass("f-s-h-w v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.populate(this.options.items);
},
@ -37,16 +38,23 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
});
if (o.columnSize[i] !== "auto") {
if (o.horizontalAlign === BI.HorizontalAlign.Stretch && o.columnSize[i] !== "") {
w.element.addClass("fill");
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.columnSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

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

@ -8,7 +8,7 @@
BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FlexWrapperVerticalLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-f-s-v clearfix",
baseCls: "bi-f-s-v",
horizontalAlign: BI.HorizontalAlign.Left,
verticalAlign: BI.VerticalAlign.Top,
rowSize: [],
@ -25,6 +25,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
render: function () {
BI.FlexWrapperVerticalLayout.superclass.render.apply(this, arguments);
var o = this.options;
this.element.addClass("v-" + o.verticalAlign).addClass("h-" + o.horizontalAlign);
this.$wrapper = BI.Widget._renderEngine.createElement("<div>").addClass("f-s-v-w h-" + o.horizontalAlign).addClass("v-" + o.verticalAlign);
this.populate(this.options.items);
},
@ -37,16 +38,23 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
});
if (o.rowSize[i] !== "auto") {
if (o.verticalAlign === BI.VerticalAlign.Stretch && o.rowSize[i] !== "") {
w.element.addClass("fill");
w.element.addClass("f-f");
} else {
w.element.addClass("shrink-none");
w.element.addClass("f-s-n");
}
}
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.rowSize[i] === "fill") {
w.element.addClass("fill");
w.element.addClass("f-f");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");
}
if (i === o.items.length - 1) {
w.element.addClass("l-c");
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

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

@ -10,7 +10,7 @@
BI.FloatLeftLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FloatLeftLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-left clearfix",
baseCls: "bi-left clearfix border-sizing",
hgap: 0,
vgap: 0,
lgap: 0,
@ -21,6 +21,19 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FloatLeftLayout.superclass.render.apply(this, arguments);
var o = this.options;
if (o.hgap > 0) {
this.element.css({
"padding-left": o.hgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-right": o.hgap / 2 / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap > 0) {
this.element.css({
"padding-top": o.vgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.vgap / 2 / BI.pixRatio + BI.pixUnit
});
}
this.populate(this.options.items);
},
@ -42,22 +55,22 @@ BI.FloatLeftLayout = 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": (o.vgap / 2 + 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
"margin-left": (o.hgap / 2 + 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
"margin-right": (o.hgap / 2 + 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
"margin-bottom": (o.vgap / 2 + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
return w;
@ -86,7 +99,7 @@ BI.shortcut("bi.left", BI.FloatLeftLayout);
BI.FloatRightLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FloatRightLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-right clearfix",
baseCls: "bi-right clearfix border-sizing",
hgap: 0,
vgap: 0,
lgap: 0,
@ -97,6 +110,19 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
},
render: function () {
BI.FloatRightLayout.superclass.render.apply(this, arguments);
var o = this.options;
if (o.hgap > 0) {
this.element.css({
"padding-left": o.hgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-right": o.hgap / 2 / BI.pixRatio + BI.pixUnit
});
}
if (o.vgap > 0) {
this.element.css({
"padding-top": o.vgap / 2 / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.vgap / 2 / BI.pixRatio + BI.pixUnit
});
}
this.populate(this.options.items);
},
@ -118,22 +144,22 @@ BI.FloatRightLayout = 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": (o.vgap / 2 + 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": (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-left": (o.hgap / 2 + 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": ((i === 0 ? o.hgap : 0) + o.rgap + (item.rgap || 0) + (item.hgap || 0)) / BI.pixRatio + BI.pixUnit
"margin-right": (o.hgap / 2 + 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
"margin-bottom": (o.vgap / 2 + o.bgap + (item.bgap || 0) + (item.vgap || 0)) / BI.pixRatio + BI.pixUnit
});
}
return w;

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

@ -39,7 +39,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i];
var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]);
if (!this.hasWidget(this._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", margin: "0px auto"});

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

@ -12,6 +12,9 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-i",
horizontalAlign: BI.HorizontalAlign.Left,
verticalAlign: BI.VerticalAlign.Top,
columnSize: [],
hgap: 0,
vgap: 0,
lgap: 0,
@ -23,13 +26,36 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
render: function () {
BI.InlineLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items);
var o = this.options;
this.element.css({
textAlign: o.horizontalAlign
});
this.populate(o.items);
},
_addElement: function (i, item) {
_addElement: function (i, item, length) {
var o = this.options;
var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", display: "inline-block", "*display": "inline", "*zoom": 1});
w.element.css({
width: o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)),
position: "relative",
"vertical-align": o.verticalAlign
});
w.element.addClass("i-item");
if (o.columnSize[i] === "fill") {
var left = o.hgap + (item.lgap || 0) + (item.hgap || 0),
right = o.hgap + (item.rgap || 0) + (item.hgap || 0);
for (var k = 0; k < i; k++) {
left += o.hgap + o.lgap + o.rgap + o.columnSize[k];
}
for (var k = i + 1; k < o.columnSize.length; k++) {
right += o.hgap + o.lgap + o.rgap + o.columnSize[k];
}
w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")");
if (o.horizontalAlign === BI.HorizontalAlign.Stretch) {
w.element.width(0);
}
}
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
@ -57,6 +83,19 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineLayout.superclass.populate.apply(this, arguments);
this._mount();

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

@ -9,21 +9,11 @@ BI.TableLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.TableLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-t",
scrolly: true,
columnSize: [200, 200, "fill"],
columnSize: [],
rowSize: 30, // or [30,30,30]
hgap: 0,
vgap: 0,
items: [[
{
el: {text: "label1"}
},
{
el: {text: "label2"}
},
{
el: {text: "label3"}
}
]]
items: []
});
},
render: function () {

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

@ -7,20 +7,14 @@ BI.TdLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.TdLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-td",
columnSize: [200, 200, 200],
columnSize: [],
hgap: 0,
vgap: 0,
items: [[
{
el: {text: "label1"}
},
{
el: {text: "label2"}
},
{
el: {text: "label3"}
}
]]
tgap: 0,
bgap: 0,
lgap: 0,
rgap: 0,
items: []
});
},
render: function () {
@ -85,22 +79,31 @@ BI.TdLayout = BI.inherit(BI.Layout, {
for (var i = 0; i < arr.length; i++) {
var w = BI._lazyCreateWidget(arr[i]);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap / BI.pixRatio + BI.pixUnit});
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 (arr[i].rgap) {
w.element.css({"margin-right": arr[i].rgap / 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 (arr[i].tgap) {
w.element.css({"margin-top": arr[i].tgap / 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 (arr[i].bgap) {
w.element.css({"margin-bottom": arr[i].bgap / 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
});
}
first(w, this.rows++, i);
var td = BI._lazyCreateWidget({
type: "bi.default",
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : o.columnSize[i],
width: o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]),
tagName: "td",
items: [w]
});

51
src/less/core/wrapper/flex.horizontal.less

@ -63,15 +63,19 @@
flex-wrap: nowrap;
&.v-middle {
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-ms-flex-align: center;
-o-align-items: center;
align-items: center;
///* 09版 */
//-webkit-box-align: center;
///* 12版 */
//-webkit-align-items: center;
//-moz-align-items: center;
//-ms-align-items: center;
//-ms-flex-align: center;
//-o-align-items: center;
//align-items: center;
> .c-e {
margin-top: auto !important;
margin-bottom: auto !important;
}
}
&.v-bottom {
@ -99,15 +103,22 @@
}
&.h-center {
/* 09版 */
-webkit-box-pack: center;
/* 12版 */
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-ms-flex-pack: center;
-o-justify-content: center;
justify-content: center;
///* 09版 */
//-webkit-box-pack: center;
///* 12版 */
//-webkit-justify-content: center;
//-moz-justify-content: center;
//-ms-justify-content: center;
//-ms-flex-pack: center;
//-o-justify-content: center;
//justify-content: center;
> .f-c {
margin-left: auto !important;
}
> .l-c {
margin-right: auto !important;
}
}
&.h-right {
@ -122,14 +133,14 @@
justify-content: flex-end;
}
> .shrink-none {
> .f-s-n {
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-shrink: 0;
flex-shrink: 0;
}
> .fill {
> .f-f {
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

5
src/less/core/wrapper/flex.leftrightvertical.center.less

@ -0,0 +1,5 @@
.bi-f-lr-v-c {
> .flex-left-auto {
margin-left: auto;
}
}

53
src/less/core/wrapper/flex.vertical.less

@ -28,7 +28,7 @@
flex-direction: row;
}
.bi-f-v, .bi-flex-vertical-layout{
.bi-f-v, .bi-flex-vertical-layout {
.flex();
.vertical();
@ -62,15 +62,19 @@
flex-wrap: nowrap;
&.h-center {
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-ms-flex-align: center;
-o-align-items: center;
align-items: center;
///* 09版 */
//-webkit-box-align: center;
///* 12版 */
//-webkit-align-items: center;
//-moz-align-items: center;
//-ms-align-items: center;
//-ms-flex-align: center;
//-o-align-items: center;
//align-items: center;
> .c-e {
margin-left: auto !important;
margin-right: auto !important;
}
}
&.h-right {
@ -98,15 +102,22 @@
}
&.v-middle {
/* 09版 */
-webkit-box-pack: center;
/* 12版 */
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-ms-flex-pack: center;
-o-justify-content: center;
justify-content: center;
///* 09版 */
//-webkit-box-pack: center;
///* 12版 */
//-webkit-justify-content: center;
//-moz-justify-content: center;
//-ms-justify-content: center;
//-ms-flex-pack: center;
//-o-justify-content: center;
//justify-content: center;
> .f-c {
margin-top: auto !important;
}
> .l-c {
margin-bottom: auto !important;
}
}
&.v-bottom {
@ -121,14 +132,14 @@
justify-content: flex-end;
}
> .shrink-none {
> .f-s-n {
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-shrink: 0;
flex-shrink: 0;
}
> .fill {
> .f-f {
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

97
src/less/core/wrapper/flex.wrapper.horizontal.less

@ -29,6 +29,47 @@
}
.bi-f-s-h, .bi-flex-scrollable-horizontal-layout {
.flex();
&.h-center {
> .f-s-h-w {
margin-left: auto !important;
margin-right: auto !important;
}
}
&.v-middle {
> .f-s-h-w {
margin-top: auto !important;
margin-right: auto !important;
}
}
&.h-right {
/* 09版 */
-webkit-box-pack: flex-end;
/* 12版 */
-webkit-justify-content: flex-end;
-moz-justify-content: flex-end;
-ms-justify-content: flex-end;
-ms-flex-pack: end;
-o-justify-content: flex-end;
justify-content: flex-end;
}
&.v-bottom {
/* 09版 */
-webkit-box-align: flex-end;
/* 12版 */
-webkit-align-items: flex-end;
-moz-align-items: flex-end;
-ms-align-items: flex-end;
-ms-flex-align: end;
-o-align-items: flex-end;
align-items: flex-end;
}
& .f-s-h-w, & .flex-scrollable-horizontal-layout-wrapper {
.flex();
.horizontal();
@ -65,19 +106,22 @@
min-height: 100%;
&.v-middle {
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-ms-flex-align: center;
-o-align-items: center;
align-items: center;
///* 09版 */
//-webkit-box-align: center;
///* 12版 */
//-webkit-align-items: center;
//-moz-align-items: center;
//-ms-align-items: center;
//-ms-flex-align: center;
//-o-align-items: center;
//align-items: center;
> .c-e {
margin-top: auto !important;
margin-bottom: auto !important;
}
&.h-center {
min-width: 100%;
float: left;
}
}
@ -105,16 +149,27 @@
align-items: stretch;
}
&.h-stretch {
min-width: 100%;
}
&.h-center {
/* 09版 */
-webkit-box-pack: center;
/* 12版 */
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-ms-flex-pack: center;
-o-justify-content: center;
justify-content: center;
///* 09版 */
//-webkit-box-pack: center;
///* 12版 */
//-webkit-justify-content: center;
//-moz-justify-content: center;
//-ms-justify-content: center;
//-ms-flex-pack: center;
//-o-justify-content: center;
//justify-content: center;
> .f-c {
margin-left: auto !important;
}
> .l-c {
margin-right: auto !important;
}
}
&.h-right {
@ -129,14 +184,14 @@
justify-content: flex-end;
}
> .shrink-none {
> .f-s-n {
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-shrink: 0;
flex-shrink: 0;
}
> .fill {
> .f-f {
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

114
src/less/core/wrapper/flex.wrapper.vertical.less

@ -29,6 +29,59 @@
}
.bi-f-s-v, .bi-flex-scrollable-vertical-layout {
.flex();
.vertical();
&.h-center {
> .f-s-v-w {
margin-left: auto !important;
margin-right: auto !important;
}
}
&.v-middle {
> .f-s-v-w {
margin-top: auto !important;
margin-bottom: auto !important;
}
}
&.h-right {
/* 09版 */
-webkit-box-align: flex-end;
/* 12版 */
-webkit-align-items: flex-end;
-moz-align-items: flex-end;
-ms-align-items: flex-end;
-ms-flex-align: end;
-o-align-items: flex-end;
align-items: flex-end;
}
&.v-bottom {
/* 09版 */
-webkit-box-pack: flex-end;
/* 12版 */
-webkit-justify-content: flex-end;
-moz-justify-content: flex-end;
-ms-justify-content: flex-end;
-ms-flex-pack: end;
-o-justify-content: flex-end;
justify-content: flex-end;
}
&.h-stretch {
/* 09版 */
-webkit-box-align: stretch;
/* 12版 */
-webkit-align-items: stretch;
-moz-align-items: stretch;
-ms-align-items: stretch;
-ms-flex-align: stretch;
-o-align-items: stretch;
align-items: stretch;
}
& .f-s-v-w, & .flex-scrollable-vertical-layout-wrapper {
.flex();
.vertical();
@ -62,22 +115,22 @@
-o-flex-wrap: nowrap;
flex-wrap: nowrap;
min-width: 100%;
//min-width: 100%;
&.h-center {
/* 09版 */
-webkit-box-align: center;
/* 12版 */
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-ms-flex-align: center;
-o-align-items: center;
align-items: center;
&.v-middle {
min-height: 100%;
float: left;
///* 09版 */
//-webkit-box-align: center;
///* 12版 */
//-webkit-align-items: center;
//-moz-align-items: center;
//-ms-align-items: center;
//-ms-flex-align: center;
//-o-align-items: center;
//align-items: center;
> .c-e {
margin-left: auto !important;
margin-right: auto !important;
}
}
@ -105,16 +158,27 @@
align-items: stretch;
}
&.v-stretch {
min-height: 100%;
}
&.v-middle {
/* 09版 */
-webkit-box-pack: center;
/* 12版 */
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
///* 09版 */
//-webkit-box-pack: center;
///* 12版 */
//-webkit-justify-content: center;
//-moz-justify-content: center;
//-ms-justify-content: center;
//-o-justify-content: center;
//-ms-flex-pack: center;
//justify-content: center;
> .f-c {
margin-top: auto !important;
}
> .l-c {
margin-bottom: auto !important;
}
}
&.v-bottom {
@ -129,14 +193,14 @@
justify-content: flex-end;
}
> .shrink-none {
> .f-s-n {
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-shrink: 0;
flex-shrink: 0;
}
> .fill {
> .f-f {
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;

24
src/less/core/wrapper/inline.less

@ -0,0 +1,24 @@
.bi-i {
white-space: nowrap;
&:after {
display: inline-block;
width: 0;
min-height: 100%;
vertical-align: middle;
content: ' ';
}
& > .i-item {
display: inline-block;
&.x-icon {
display: inline-block !important;
}
}
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
}

4
src/widget/date/calendar/picker.year.js

@ -83,9 +83,7 @@ BI.YearPicker = BI.inherit(BI.Widget, {
width: 25
}]
});
this.setValue({
year: this._year
});
this.setValue(this._year);
},
_checkLeftValid: function () {

8
src/widget/date/calendar/popup.month.js

@ -18,6 +18,8 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
BI.MonthPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.selectedMonth = BI.getDate().getMonth() + 1;
this.month = BI.createWidget({
type: "bi.button_group",
element: this,
@ -38,7 +40,8 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
value: o.value
});
this.month.on(BI.Controller.EVENT_CHANGE, function (type) {
this.month.on(BI.Controller.EVENT_CHANGE, function (type, value) {
self.selectedMonth = value;
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.MonthPopup.EVENT_CHANGE);
@ -82,11 +85,12 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.month.getValue()[0];
return this.selectedMonth;
},
setValue: function (v) {
v = BI.parseInt(v);
this.selectedMonth = v;
this.month.setValue([v]);
}
});

11
src/widget/date/calendar/popup.year.js

@ -119,12 +119,13 @@ BI.YearPopup = BI.inherit(BI.Widget, {
setValue: function (v) {
var o = this.options;
v = BI.parseInt(v);
// 切换年不受范围限制
// 对于年控件来说,只要传入的minDate和maxDate的year区间包含v就是合法的
var startDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var endDate = BI.parseDateTime(o.max, "%Y-%X-%d");
if (BI.checkDateVoid(v, 1, 1, BI.print(BI.getDate(startDate.getFullYear(), 0, 1), "%Y-%X-%d"), BI.print(BI.getDate(endDate.getFullYear(), 0, 1), "%Y-%X-%d"))[0]) {
v = BI.getDate().getFullYear();
}
// var startDate = BI.parseDateTime(o.min, "%Y-%X-%d");
// var endDate = BI.parseDateTime(o.max, "%Y-%X-%d");
// if (BI.checkDateVoid(v, 1, 1, BI.print(BI.getDate(startDate.getFullYear(), 0, 1), "%Y-%X-%d"), BI.print(BI.getDate(endDate.getFullYear(), 0, 1), "%Y-%X-%d"))[0]) {
// v = BI.getDate().getFullYear();
// }
this.selectedYear = v;
this.navigation.setSelect(BI.YearCalendar.getPageByYear(v));

2
src/widget/datepane/datepane.js

@ -123,7 +123,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
action: function () {
var type = self.dateTab.getSelect();
if (type === BI.DynamicDateCombo.Dynamic) {
self.dynamicPane.checkValidation(true) && self.fireEvent(BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE);
self.dynamicPane.checkValidation(true) && self.fireEvent(BI.DynamicDatePopup.EVENT_CHANGE);
} else {
self.fireEvent(BI.DynamicDatePane.EVENT_CHANGE);
}

2
src/widget/datetimepane/datetimepane.js

@ -123,7 +123,7 @@ BI.DynamicDateTimePane = BI.inherit(BI.Widget, {
action: function () {
var type = self.dateTab.getSelect();
if (type === BI.DynamicDateCombo.Dynamic) {
self.dynamicPane.checkValidation(true) && self.fireEvent(BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE);
self.dynamicPane.checkValidation(true) && self.fireEvent(BI.DynamicDatePane.EVENT_CHANGE);
} else {
self.fireEvent(BI.DynamicDatePane.EVENT_CHANGE);
}

4
src/widget/dynamicdate/dynamicdate.card.js

@ -389,6 +389,10 @@ BI.DynamicDateCard = BI.inherit(BI.Widget, {
return this.checkValidation() ? this._getValue() : {};
},
getInputValue: function () {
return this._getValue();
},
checkValidation: function (show) {
var buttons = this.resultPane.getAllButtons();
var errorText;

3
src/widget/dynamicdate/dynamicdate.combo.js

@ -271,10 +271,13 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
},
_checkValue: function (v) {
var o = this.options;
switch (v.type) {
case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0];
default:
return true;
}

2
src/widget/dynamicdate/dynamicdate.popup.js

@ -178,7 +178,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.todayButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue());
date = BI.print(date, "%Y-%X-%d");
this.todayButton.setValue(date);
this.todayButton.setEnable(false);

3
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -279,10 +279,13 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
},
_checkValue: function (v) {
var o = this.options;
switch (v.type) {
case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0];
default:
return true;
}

2
src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -181,7 +181,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.todayButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue());
date = BI.print(date, "%Y-%X-%d");
this.todayButton.setValue(date);
this.todayButton.setEnable(false);

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

@ -90,7 +90,9 @@ BI.SingleSelectSearchLoader = BI.inherit(BI.Widget, {
dynamic: false
},
height: 25,
selected: false
selected: false,
iconWrapperWidth: 26,
hgap: this.options.allowNoSelect ? 10 : 0
});
},

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

@ -109,7 +109,9 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, {
logic: this.options.logic,
cls: "bi-list-item-active",
height: 24,
selected: false
selected: false,
iconWrapperWidth: 26,
hgap: this.options.allowNoSelect ? 10 : 0
});
},

6
src/widget/year/card.dynamic.year.js

@ -93,6 +93,10 @@ BI.DynamicYearCard = BI.inherit(BI.Widget, {
};
},
getInputValue: function () {
return this._getValue();
},
getValue: function () {
return this.checkValidation() ? this._getValue() : {};
},
@ -106,7 +110,7 @@ BI.DynamicYearCard = BI.inherit(BI.Widget, {
invalid = !this._checkDate(this._getValue());
errorText = this._getErrorText();
}
invalid && show && BI.Bubbles.show("dynamic-year-error", errorText, this.wrapper);
invalid && show && BI.Bubbles.show("dynamic-year-error", errorText, this.item);
return !invalid;
},

2
src/widget/year/popup.year.js

@ -87,7 +87,7 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
this.yearButton.setValue(BI.i18nText("BI-Basic_Current_Year"));
this.yearButton.setEnable(!this._checkYearValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue());
date = BI.print(date, "%Y");
this.yearButton.setValue(date);
this.yearButton.setEnable(false);

76
src/widget/yearmonth/card.dynamic.yearmonth.js

@ -15,47 +15,53 @@ BI.DynamicYearMonthCard = BI.inherit(BI.Widget, {
var self = this;
return {
type: "bi.vertical",
ref: function (_ref) {
self.wrapper = _ref;
},
items: [{
type: "bi.label",
text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"),
textAlign: "left",
height: 24
}, {
type: "bi.dynamic_date_param_item",
validationChecker: BI.bind(self._checkDate, self),
ref: function () {
self.year = this;
type: "bi.vertical",
ref: function (_ref) {
self.wrapper = _ref;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
items: [{
el: {
type: "bi.dynamic_date_param_item",
validationChecker: BI.bind(self._checkDate, self),
ref: function () {
self.year = this;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-month-error");
}
}]
},
bgap: 10,
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-month-error");
}
}]
}, {
type: "bi.dynamic_date_param_item",
dateType: BI.DynamicDateCard.TYPE.MONTH,
ref: function () {
self.month = this;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-month-error");
}
type: "bi.dynamic_date_param_item",
dateType: BI.DynamicDateCard.TYPE.MONTH,
ref: function () {
self.month = this;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-month-error");
}
}]
}]
}],
vgap: 10,
@ -132,6 +138,10 @@ BI.DynamicYearMonthCard = BI.inherit(BI.Widget, {
};
},
getInputValue: function () {
return this._getValue();
},
getValue: function () {
return this.checkValidation() ? this._getValue() : {};
},

18
src/widget/yearmonth/combo.yearmonth.js

@ -99,7 +99,10 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
}, {
eventName: BI.DynamicYearMonthPopup.BUTTON_OK_EVENT_CHANGE,
action: function () {
self.setValue(self.popup.getValue());
var value = self.popup.getValue();
if (self._checkValue(value)) {
self.setValue(value);
}
self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
}
@ -159,6 +162,19 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
}
},
_checkValue: function (v) {
var o = this.options;
switch (v.type) {
case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, value.month, 1, o.minDate, o.maxDate)[0];
default:
return true;
}
},
setMinDate: function (minDate) {
var o = this.options;
o.minDate = minDate;

2
src/widget/yearmonth/popup.yearmonth.js

@ -87,7 +87,7 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Month"));
this.textButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue());
date = BI.print(date, "%Y-%x");
this.textButton.setValue(date);
this.textButton.setEnable(false);

76
src/widget/yearquarter/card.dynamic.yearquarter.js

@ -15,47 +15,53 @@ BI.DynamicYearQuarterCard = BI.inherit(BI.Widget, {
var self = this;
return {
type: "bi.vertical",
ref: function (_ref) {
self.wrapper = _ref;
},
items: [{
type: "bi.label",
text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"),
textAlign: "left",
height: 24
}, {
type: "bi.dynamic_date_param_item",
validationChecker: BI.bind(self._checkDate, self),
ref: function () {
self.year = this;
type: "bi.vertical",
ref: function (_ref) {
self.wrapper = _ref;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
items: [{
el: {
type: "bi.dynamic_date_param_item",
validationChecker: BI.bind(self._checkDate, self),
ref: function () {
self.year = this;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-quarter-error");
}
}]
},
bgap: 10
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-quarter-error");
}
}]
}, {
type: "bi.dynamic_date_param_item",
dateType: BI.DynamicDateCard.TYPE.QUARTER,
ref: function () {
self.quarter = this;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-quarter-error");
}
type: "bi.dynamic_date_param_item",
dateType: BI.DynamicDateCard.TYPE.QUARTER,
ref: function () {
self.quarter = this;
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_INPUT_CHANGE",
action: function () {
BI.Bubbles.hide("dynamic-year-quarter-error");
}
}]
}]
}],
vgap: 10,
@ -132,6 +138,10 @@ BI.DynamicYearQuarterCard = BI.inherit(BI.Widget, {
};
},
getInputValue: function () {
return this._getValue();
},
getValue: function () {
return this.checkValidation() ? this._getValue() : {};
},

18
src/widget/yearquarter/combo.yearquarter.js

@ -99,7 +99,10 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
}, {
eventName: BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE,
action: function () {
self.setValue(self.popup.getValue());
var value = self.popup.getValue();
if (self._checkValue(value)) {
self.setValue(value);
}
self.combo.hideView();
self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM);
}
@ -159,6 +162,19 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
}
},
_checkValue: function (v) {
var o = this.options;
switch (v.type) {
case BI.DynamicDateCombo.Dynamic:
return BI.isNotEmptyObject(v.value);
case BI.DynamicDateCombo.Static:
var value = v.value || {};
return !BI.checkDateVoid(value.year, (value.quarter - 1) * 3 + 1, 1, o.minDate, o.maxDate)[0];
default:
return true;
}
},
setMinDate: function (minDate) {
var o = this.options;
o.minDate = minDate;

2
src/widget/yearquarter/popup.yearquarter.js

@ -80,7 +80,7 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Quarter"));
this.textButton.setEnable(!this._checkTodayValid());
} else {
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue());
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue());
date = BI.print(date, "%Y-%Q");
this.textButton.setValue(date);
this.textButton.setEnable(false);

Loading…
Cancel
Save