Browse Source

Merge pull request #72858 in DEC/fineui from feature/x to bugfix/11.0

* commit 'ec833b50f05e3c5ca13f0a8563816dc03d14c752': (203 commits)
  auto upgrade version to 2.0.20220615141348
  feature: 布局优化
  feature: 布局优化
  auto upgrade version to 2.0.20220615120357
  无jira任务 图标
  auto upgrade version to 2.0.20220615095412
  auto upgrade version to 2.0.20220615094402
  Revert "无jira任务 字体更新"
  auto upgrade version to 2.0.20220614222325
  无jira任务 字体更新
  auto upgrade version to 2.0.20220614170402
  DESIGN-3918 feat: BI6.0toast实例
  无JIRA任务 downlist popup的分割线间距
  无jira任务 类型
  auto upgrade version to 2.0.20220614151423
  auto upgrade version to 2.0.20220614150529
  auto upgrade version to 2.0.20220614142259
  KERNEL-10932 feat: editor支持value响应式
  无JIRA editor的watermark可以set为空
  无JIRA editor的watermark可以set为空
  ...
research/test
superman 2 years ago
parent
commit
4bd42e038c
  1. 20
      bi.lessconfig.json
  2. 15
      changelog.md
  3. 96
      demo/js/base/button/demo.button.js
  4. 206
      dist/fix/fix.js
  5. BIN
      dist/font/iconfont.eot
  6. 468
      dist/font/iconfont.svg
  7. BIN
      dist/font/iconfont.ttf
  8. BIN
      dist/font/iconfont.woff
  9. BIN
      dist/font/iconfont.woff2
  10. 2
      package.json
  11. 2
      src/base/combination/searcher.js
  12. 8
      src/base/grid/grid.js
  13. 5
      src/base/list/virtualgrouplist.js
  14. 65
      src/base/single/button/buttons/button.js
  15. 5
      src/base/single/button/listitem/blankiconicontextitem.js
  16. 3
      src/base/single/button/listitem/blankicontexticonitem.js
  17. 3
      src/base/single/button/listitem/blankicontextitem.js
  18. 3
      src/base/single/button/listitem/icontexticonitem.js
  19. 3
      src/base/single/button/listitem/icontextitem.js
  20. 3
      src/base/single/button/listitem/texticonitem.js
  21. 3
      src/base/single/button/node/icontexticonnode.js
  22. 3
      src/base/single/button/node/icontextnode.js
  23. 3
      src/base/single/button/node/texticonnode.js
  24. 4
      src/base/single/editor/editor.js
  25. 3
      src/base/single/editor/editor.multifile.js
  26. 18
      src/base/single/input/file.js
  27. 43
      src/base/single/input/input.js
  28. 10
      src/base/single/tip/tip.toast.js
  29. 3
      src/case/button/item.multiselect.js
  30. 13
      src/case/button/item.singleselect.radio.js
  31. 7
      src/case/button/node/node.arrow.js
  32. 2
      src/case/button/node/node.icon.arrow.js
  33. 4
      src/case/button/node/node.plus.js
  34. 3
      src/case/button/switch.js
  35. 16
      src/case/checkbox/check.arrownode.js
  36. 2
      src/case/colorchooser/colorchooser.js
  37. 1
      src/case/colorchooser/colorchooser.simple.js
  38. 2
      src/case/colorchooser/colorchooser.trigger.js
  39. 2
      src/case/colorchooser/colorchooser.trigger.long.js
  40. 12
      src/case/combo/bubblecombo/popup.bubble.js
  41. 2
      src/case/combo/icontextvaluecombo/combo.icontextvalue.js
  42. 58
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  43. 77
      src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js
  44. 41
      src/case/combo/textvaluecombo/combo.textvalue.js
  45. 5
      src/case/editor/editor.clear.js
  46. 282
      src/case/editor/editor.defaulttext.js
  47. 5
      src/case/editor/editor.shelter.js
  48. 9
      src/case/editor/editor.sign.js
  49. 7
      src/case/layer/panel.js
  50. 4
      src/case/tree/treeexpander/tree.expander.popup.js
  51. 66
      src/case/trigger/trigger.text.js
  52. 28
      src/case/trigger/trigger.text.select.js
  53. 6
      src/case/ztree/0.treeview.js
  54. 9
      src/case/ztree/1.asynctree.js
  55. 19
      src/core/platform/web/config.js
  56. 9
      src/core/system.js
  57. 71
      src/core/wrapper/layout.js
  58. 8
      src/core/wrapper/layout/adapt/absolute.center.js
  59. 34
      src/core/wrapper/layout/adapt/absolute.leftrightvertical.js
  60. 4
      src/core/wrapper/layout/adapt/adapt.table.js
  61. 8
      src/core/wrapper/layout/fill/auto.vtape.js
  62. 28
      src/core/wrapper/layout/fill/float.fill.horizontal.js
  63. 3
      src/core/wrapper/layout/flex/flex.horizontal.js
  64. 26
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  65. 3
      src/core/wrapper/layout/flex/flex.vertical.js
  66. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  67. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  68. 18
      src/core/wrapper/layout/float/float.absolute.leftrightvertical.js
  69. 36
      src/core/wrapper/layout/layout.flow.js
  70. 8
      src/core/wrapper/layout/layout.inline.js
  71. 24
      src/core/wrapper/layout/layout.tape.js
  72. 4
      src/core/wrapper/layout/layout.td.js
  73. 3
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  74. 3
      src/core/wrapper/layout/sticky/sticky.vertical.js
  75. 4
      src/less/base/colorchooser/colorchooser.trigger.less
  76. 35
      src/less/base/combo/combo.less
  77. 22
      src/less/base/combo/combo.searchtextvalue.less
  78. 14
      src/less/base/combo/combo.textvalue.less
  79. 1
      src/less/base/editor/editor.search.less
  80. 72
      src/less/base/single/button/button.less
  81. 8
      src/less/base/single/tip/tip.toast.less
  82. 44
      src/less/base/tree/tree.expander.less
  83. 15
      src/less/base/trigger/trigger.searchtextvalue.less
  84. 15
      src/less/base/trigger/trigger.text.less
  85. 20
      src/less/core/utils/common.less
  86. 11
      src/less/core/wrapper/flex.horizontal.less
  87. 11
      src/less/core/wrapper/flex.vertical.less
  88. 11
      src/less/core/wrapper/flex.wrapper.horizontal.less
  89. 11
      src/less/core/wrapper/flex.wrapper.vertical.less
  90. 4
      src/less/lib/colors.less
  91. 1
      src/less/lib/font.less
  92. 24
      src/less/lib/theme.less
  93. 1
      src/less/resource/font.less
  94. 28
      src/less/widget/multilayerselecttree/multilayerselecttree.combo.less
  95. 27
      src/less/widget/multilayersingletree/multilayersingletree.combo.less
  96. 1
      src/less/widget/numbereditor/number.editor.less
  97. 8
      src/less/widget/numberinterval/numberinterval.less
  98. 2
      src/less/widget/year/trigger.year.less
  99. 4
      src/router/router.js
  100. 60
      src/widget/downlist/combo.downlist.js
  101. Some files were not shown because too many files have changed in this diff Show More

20
bi.lessconfig.json

@ -4,21 +4,28 @@
"@color-light-blue-100": "#19B8EA",
"@color-orange-100": "#FAAA39",
"@color-red-100": "#E65251",
"@color-black": "#000A19",
"@color-black": "#091E40",
"@color-light-gray": "#ECEEF3",
"@color-light-gray-theme-dark": "#292F45",
"@border-color-line": "rgba(9, 30, 64, 0.15)",
"@border-color-light-line": "#E6E9EF",
"@border-color-dark-line": "#2E3A4D",
"@color-sliver-theme-dark": "#363E55",
"@border-color-disabled": "#E7E8EB",
"@border-color-disabled": "rgba(9, 30, 64, 0.07)",
"@font-color-gray": "rgba(9, 30, 64, 0.9)",
"@font-color-light-gray": "rgba(9, 30, 64, 0.66)",
"@font-color-tips": "rgba(9, 30, 64, 0.47)",
"@font-color-disabled": "rgba(9, 30, 64, 0.25)",
"@color-bi-background-active-radio": "transparent",
"@color-bi-border-radio": "rgba(9, 30, 64, 0.37)",
"@color-bi-border-disabled-radio": "rgba(9, 30, 64, 0.19)",
"@color-bi-background-active-radio-content": "#2C60DB",
"@color-bi-background-disabled-active-radio-content": "#D0D4DA",
"@color-bi-background-disabled-active-radio-content": "#FFFFFF",
"@color-bi-background-disabled-active-radio-content-theme-dark": "#606479",
"@color-bi-background-disabled-active-checkbox-content": "#FFFFFF",
"@color-bi-background-disabled-active-checkbox-content-theme-dark": "#606479",
"@color-bi-background-tooltip-success": "#2E3A4D",
"@color-bi-text-header-background": "#647185",
"@color-bi-background-tooltip-success": "#2E3A4D",
"@color-bi-border-tooltip-success": "#2E3A4D",
"@color-bi-background-toast-success": "#FFFFFF",
"@color-bi-background-toast-warning": "#FFFFFF",
@ -28,5 +35,6 @@
"@color-bi-color-toast-warning": "#FAAA39",
"@color-bi-color-toast-error": "#E65251",
"@color-bi-color-toast-normal": "#2C60DB",
"@color-bi-color-toast-text": "#000A19"
"@color-bi-color-toast-text": "#000A19",
"@color-bi-color-toast-shadow": "rgba(9, 30, 64, 0.16)"
}

15
changelog.md

@ -1,4 +1,19 @@
# 更新日志
3.0(2022-05)
- 下拉选择框支持清空
3.0(2022-03)
- 支持响应式
- 全面支持Typescript
- 增加JSX支持
- 布局组件支持更多动态特性
- 底层API支持动画
- 增加WebWorker支持
- 支持路由
- 插件支持版本控制
- Fix数据流支持proxy版本
2.0(2022-01)
- 提供自定义表单

96
demo/js/base/button/demo.button.js

@ -193,6 +193,41 @@ Demo.Button = BI.inherit(BI.Widget, {
ghost: true,
height: 30
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
height: 30
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
level: "warning",
height: 30
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
level: "error",
height: 30
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
level: "success",
height: 30
}
}, {
el: {
type: "bi.button",
@ -213,6 +248,67 @@ Demo.Button = BI.inherit(BI.Widget, {
},
height: 30
}
}, {
el: {
type: "bi.button",
text: "图标在上面的按钮,而且可以自动撑开高度",
iconCls: "close-font",
iconGap: 24,
iconPosition: "top"
}
}, {
el: {
type: "bi.button",
text: "图标在下面的按钮",
iconCls: "close-font",
iconPosition: "bottom"
}
}, {
el: {
type: "bi.button",
text: "图标在左边的按钮",
iconCls: "close-font",
iconPosition: "left"
}
}, {
el: {
type: "bi.button",
text: "图标在右边的按钮",
iconCls: "close-font",
iconPosition: "right"
}
}, {
el: {
type: "bi.button",
text: "浅色的一般按钮",
iconCls: "plus-font",
light: true
}
}, {
el: {
type: "bi.button",
text: "浅色的成功按钮",
level: "success",
iconCls: "plus-font",
light: true
}
}, {
el: {
type: "bi.button",
text: "浅色的警告按钮",
level: "warning",
iconCls: "plus-font",
light: true
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "浅色的失败按钮",
level: "error",
cls: "hover-mask",
light: true
}
}];
// BI.each(items, function (i, item) {
// item.el.handler = function () {

206
dist/fix/fix.js vendored

@ -11,47 +11,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
}
var rhashcode = /\d\.\d{4}/;
//生成UUID http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
function makeHashCode(prefix) {
/* istanbul ignore next*/
prefix = prefix || 'bi';
/* istanbul ignore next*/
return String(Math.random() + Math.random()).replace(rhashcode, prefix);
}
var hasProto = '__proto__' in {};
var isIE = function isIE() {
if (typeof navigator === "undefined") {
return false;
}
return (/(msie|trident)/i.test(navigator.userAgent.toLowerCase())
);
};
var getIEVersion = function getIEVersion() {
var version = 0;
if (typeof navigator === "undefined") {
return false;
}
var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/);
var v2 = agent.match(/(?:trident.*rv:([\w.]+))/);
if (v1 && v2 && v1[1] && v2[1]) {
version = Math.max(v1[1] * 1, v2[1] * 1);
} else if (v1 && v1[1]) {
version = v1[1] * 1;
} else if (v2 && v2[1]) {
version = v2[1] * 1;
} else {
version = 0;
}
return version;
};
var isIE9Below = isIE() && getIEVersion() < 9;
var _toString = Object.prototype.toString;
function isPlainObject(obj) {
@ -266,7 +227,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var createViewModel = Object.defineProperties;
var defineProperty = void 0;
var timeBucket = new Date() - 0;
/* istanbul ignore if*/
if (!canHideProperty) {
if ('__defineGetter__' in {}) {
@ -291,76 +251,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return obj;
};
}
/* istanbul ignore if*/
if (isIE9Below) {
var VBClassPool = {};
window.execScript([// jshint ignore:line
'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码
].join('\n'), 'VBScript');
var VBMediator = function VBMediator(instance, accessors, name, value) {
// jshint ignore:line
var accessor = accessors[name];
if (arguments.length === 4) {
accessor.set.call(instance, value);
} else {
return accessor.get.call(instance);
}
};
createViewModel = function createViewModel(name, accessors, properties) {
// jshint ignore:line
var buffer = [];
buffer.push('\tPrivate [$vbsetter]', '\tPublic [$accessors]', '\tPublic Default Function [$vbthis](ac' + timeBucket + ', s' + timeBucket + ')', '\t\tSet [$accessors] = ac' + timeBucket + ': set [$vbsetter] = s' + timeBucket, '\t\tSet [$vbthis] = Me', //链式调用
'\tEnd Function');
//添加普通属性,因为VBScript对象不能像JS那样随意增删属性,必须在这里预先定义好
var uniq = {
$vbthis: true,
$vbsetter: true,
$accessors: true
};
for (name in $$skipArray) {
if (!uniq[name]) {
buffer.push('\tPublic [' + name + ']');
uniq[name] = true;
}
}
//添加访问器属性
for (name in accessors) {
if (uniq[name]) {
continue;
}
uniq[name] = true;
buffer.push(
//由于不知对方会传入什么,因此set, let都用上
'\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter
'\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回
'\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property');
}
for (name in properties) {
if (!uniq[name]) {
uniq[name] = true;
buffer.push('\tPublic [' + name + ']');
}
}
buffer.push('\tPublic [hasOwnProperty]');
buffer.push('End Class');
var body = buffer.join('\r\n');
var className = VBClassPool[body];
if (!className) {
className = makeHashCode('VBClass');
window.parseVB('Class ' + className + body);
window.parseVB(['Function ' + className + 'Factory(acc, vbm)', //创建实例并传入两个关键的参数
'\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n'));
VBClassPool[body] = className;
}
var ret = window[className + 'Factory'](accessors, VBMediator); //得到其产品
return ret; //得到其产品
};
}
}
var createViewModel$1 = createViewModel;
@ -700,12 +590,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} else {
this.model = this.walk(value);
}
if (isIE9Below) {
this.model['__ob__'] = this;
} else {
def(this.model, "__ob__", this);
}
}
Observer.prototype.walk = function walk(obj) {
return defineReactive(obj, this);
@ -788,53 +674,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function defineReactive(obj, observer, shallow) {
var props = {};
var model = void 0;
// if (typeof Proxy === 'function') {
// const deps = {}, childObs = {}, cache = {}
// _.each(obj, function (val, key) {
// if (key in $$skipArray) {
// return
// }
// cache[key] = val
// const dep = deps[key] = (observer && observer['__dep' + key]) || new Dep()
// observer && (observer['__dep' + key] = dep)
// childObs[key] = !shallow && observe(val, observer, key)
// })
// return model = new Proxy(props, {
// has: function (target, key) {
// return key in obj;
// },
// get: function (target, key) {
// if (key in $$skipArray) {
// return target[key]
// }
// const value = cache[key]
// if (Dep.target) {
// deps[key].depend()
// if (childObs[key]) {
// childObs[key].dep.depend()
// if (_.isArray(value)) {
// dependArray(value)
// }
// }
// }
// return value
// },
// set: function (target, key, newVal) {
// if (key in $$skipArray) {
// return target[key] = newVal
// }
// const value = cache[key], dep = deps[key]
// if (newVal === value || (newVal !== newVal && value !== value)) {
// return newVal
// }
// cache[key] = newVal
// childObs[key] = !shallow && observe(newVal, observer, key)
// obj[key] = childObs[key] ? childObs[key].model : newVal
// notify(model, key, dep)
// return obj[key]
// }
// })
// }
_.each(obj, function (val, key) {
if (key in $$skipArray) {
return;
@ -878,6 +717,50 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return model = createViewModel$1(obj, props);
}
function defineReactiveProperty(obj, key, val, shallow) {
var dep = new Dep();
var configurable = isConfigurable(obj, key);
if (!configurable) {
return;
}
if (arguments.length === 2) {
val = obj[key];
}
var childOb = !shallow && observe(val);
Object.defineProperty(obj, key, {
enumerable: true,
configurable: true,
get: function reactiveGetter() {
var value = childOb ? childOb.model : val;
if (Dep.target) {
dep.depend();
if (childOb) {
childOb.dep.depend();
if (_.isArray(value)) {
dependArray(value);
}
}
}
return value;
},
set: function reactiveSetter(newVal) {
var value = childOb ? childOb.model : val;
if (newVal === value || newVal !== newVal && value !== value) {
return;
}
childOb = configurable && !shallow && observe(newVal);
val = newVal;
obj[key] = childOb ? childOb.model : newVal;
dep.notify();
}
});
}
/**
* Set a property on an object. Adds the new property and
* triggers change notification if the property doesn't
@ -1522,6 +1405,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
exports.observe = observe;
exports.notify = notify;
exports.defineReactive = defineReactive;
exports.defineReactiveProperty = defineReactiveProperty;
exports.set = set;
exports.freeze = freeze;
exports.del = del;

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

468
dist/font/iconfont.svg vendored

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 632 KiB

After

Width:  |  Height:  |  Size: 673 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

2
package.json

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

2
src/base/combination/searcher.js

@ -183,7 +183,7 @@ BI.Searcher = BI.inherit(BI.Widget, {
keyword: keyword,
selectedValues: o.adapter && o.adapter.getValue()
}, function (searchResult, matchResult) {
if (!self._stop) {
if (!self._stop && keyword === self.editor.getValue()) {
var args = [].slice.call(arguments);
if (args.length > 0) {
args.push(keyword);

8
src/base/grid/grid.js

@ -130,9 +130,9 @@ BI.GridView = BI.inherit(BI.Widget, {
var visibleColumnIndices = this._columnSizeAndPositionManager.getVisibleCellRange(width, scrollLeft);
var visibleRowIndices = this._rowSizeAndPositionManager.getVisibleCellRange(height, scrollTop);
if (BI.isEmpty(visibleColumnIndices) || BI.isEmpty(visibleRowIndices)) {
return;
}
var renderedCells = [], renderedKeys = {}, renderedWidgets = {};
// 没有可见的单元格就干掉所有渲染过的
if (!BI.isEmpty(visibleColumnIndices) && !BI.isEmpty(visibleRowIndices)) {
var horizontalOffsetAdjustment = this._columnSizeAndPositionManager.getOffsetAdjustment(width, scrollLeft);
var verticalOffsetAdjustment = this._rowSizeAndPositionManager.getOffsetAdjustment(height, scrollTop);
@ -164,7 +164,6 @@ BI.GridView = BI.inherit(BI.Widget, {
return;
}
var renderedCells = [], renderedKeys = {}, renderedWidgets = {};
var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0;
var count = 0;
for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
@ -225,6 +224,7 @@ BI.GridView = BI.inherit(BI.Widget, {
count++;
}
}
}
// 已存在的, 需要添加的和需要删除的
var existSet = {}, addSet = {}, deleteArray = [];
BI.each(renderedKeys, function (i, key) {

5
src/base/list/virtualgrouplist.js

@ -14,6 +14,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
scrollTop: 0,
rowHeight: "auto",
items: [],
el: {},
itemFormatter: function (item, index) {
return item;
}
@ -39,10 +40,10 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
ref: function () {
self.container = this;
},
layouts: [{
layouts: [BI.extend({
type: "bi.vertical",
scrolly: false
}]
}, o.el)]
}, {
type: "bi.layout",
ref: function () {

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

@ -1,3 +1,8 @@
(function () {
function isVertical(position) {
return position === "top" || position === "bottom";
}
/**
* 文字类型的按钮
* @class BI.Button
@ -9,18 +14,20 @@
BI.Button = BI.inherit(BI.BasicButton, {
_const: {
iconWidth: 18
iconWidth: 16
},
_defaultConfig: function (props) {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-button" + ((BI.isIE() && BI.isIE9Below()) ? " hack" : ""),
attributes: {
tabIndex: 1
},
minWidth: (props.block === true || props.clear === true) ? 0 : 80,
height: 24,
// 44 = 垂直间距 6 + 边框 2 + 图标 16 + 图标和文字间隔 8 + 文字 12
height: isVertical(props.iconPosition) ? 44 + ((props.iconGap || 8) - 8) : 24,
shadow: props.clear !== true,
isShadowShowingOnSelected: true,
readonly: true,
@ -29,6 +36,8 @@ BI.Button = BI.inherit(BI.BasicButton, {
block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, // 是否去掉边框和背景
ghost: false, // 是否幽灵显示, 即正常状态无背景
loading: false, // 是否处于加载中
light: false, // 是否使用浅色
textAlign: "center",
whiteSpace: "nowrap",
textWidth: null,
@ -38,21 +47,27 @@ BI.Button = BI.inherit(BI.BasicButton, {
tgap: 0,
bgap: 0,
lgap: 0,
rgap: 0
rgap: 0,
iconGap: 8,
iconPosition: "left"
});
},
render: function () {
var o = this.options, self = this;
var o = this.options;
// 由于button默认情况下有个边框,所以要主动算行高
var lineHeight, textHeight = o.textHeight;
if (BI.isNumber(o.height)) {
if (o.clear || o.block) {
if (!isVertical(o.iconPosition)) {
if (o.clear || o.block || o.light) {
lineHeight = o.height;
} else {
lineHeight = o.height - 2;
}
} else {
lineHeight = textHeight;
}
}
if (!textHeight) {
if (o.whiteSpace === "nowrap") {
@ -65,9 +80,7 @@ BI.Button = BI.inherit(BI.BasicButton, {
cls: o.iconCls,
width: this._const.iconWidth,
height: lineHeight,
lineHeight: lineHeight,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
lineHeight: lineHeight
});
this.text = BI.createWidget({
type: "bi.label",
@ -77,15 +90,30 @@ BI.Button = BI.inherit(BI.BasicButton, {
height: lineHeight,
value: o.value
});
var layoutType = "bi.horizontal";
var gapContainer = {
lgap: o.iconPosition === "left" && o.text ? o.iconGap : 0,
rgap: o.iconPosition === "right" ? o.iconGap : 0,
tgap: o.iconPosition === "top" ? o.iconGap : 0,
bgap: o.iconPosition === "bottom" ? o.iconGap : 0
};
var items = [this.icon, BI.extend({el: this.text}, gapContainer)];
if (isVertical(o.iconPosition)) {
layoutType = "bi.vertical";
}
if (o.iconPosition === "right" || o.iconPosition === "bottom") {
items = [BI.extend({el: this.text}, gapContainer), this.icon];
}
BI.createWidget({
type: "bi.center_adapt",
element: this,
hgap: o.hgap,
vgap: o.vgap,
items: [{
type: "bi.horizontal",
columnSize: ["", "fill"],
items: [this.icon, this.text]
type: layoutType,
horizontalAlign: "center",
verticalAlign: "middle",
items: items
}]
});
} else {
@ -116,6 +144,12 @@ BI.Button = BI.inherit(BI.BasicButton, {
if (o.ghost === true) {
this.element.addClass("ghost");
}
if (o.loading === true) {
this.element.addClass("loading");
}
if (o.light === true) {
this.element.addClass("light");
}
if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit});
}
@ -137,6 +171,14 @@ BI.Button = BI.inherit(BI.BasicButton, {
}
},
setLoading: function (loading) {
if (loading) {
this.element.addClass("loading");
} else {
this.element.removeClass("loading");
}
},
setText: function (text) {
BI.Button.superclass.setText.apply(this, arguments);
this.text.setText(text);
@ -167,3 +209,4 @@ BI.Button = BI.inherit(BI.BasicButton, {
});
BI.shortcut("bi.button", BI.Button);
BI.Button.EVENT_CHANGE = "EVENT_CHANGE";
}());

5
src/base/single/button/listitem/blankiconicontextitem.js

@ -10,10 +10,7 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
var conf = BI.BlankIconIconTextItem.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-blank-icon-text-item",
logic: {
dynamic: false
},
baseCls: (conf.baseCls || "") + " bi-blank-icon-icon-text-item",
iconCls1: "",
iconCls2: "",
blankWidth: 0,

3
src/base/single/button/listitem/blankicontexticonitem.js

@ -12,9 +12,6 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
var conf = BI.BlankIconTextIconItem.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-blank-icon-text-icon-item",
logic: {
dynamic: false
},
iconCls1: "",
iconCls2: "",
blankWidth: 0,

3
src/base/single/button/listitem/blankicontextitem.js

@ -11,9 +11,6 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
var conf = BI.BlankIconTextItem.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-blank-icon-text-item",
logic: {
dynamic: false
},
blankWidth: 0,
iconHeight: null,
iconWidth: null,

3
src/base/single/button/listitem/icontexticonitem.js

@ -12,9 +12,6 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
var conf = BI.IconTextIconItem.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-icon-item",
logic: {
dynamic: false
},
iconCls1: "",
iconCls2: "",
iconHeight: null,

3
src/base/single/button/listitem/icontextitem.js

@ -12,9 +12,6 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, {
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-item",
direction: BI.Direction.Left,
logic: {
dynamic: false
},
iconWrapperWidth: null,
iconHeight: null,
iconWidth: null,

3
src/base/single/button/listitem/texticonitem.js

@ -12,9 +12,6 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, {
var conf = BI.TextIconItem.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-icon-item",
logic: {
dynamic: false
},
iconWrapperWidth: null,
iconHeight: null,
iconWidth: null,

3
src/base/single/button/node/icontexticonnode.js

@ -10,9 +10,6 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
var conf = BI.IconTextIconNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-icon-node",
logic: {
dynamic: false
},
iconCls1: "close-ha-font",
iconCls2: "close-ha-font",
iconHeight: null,

3
src/base/single/button/node/icontextnode.js

@ -10,9 +10,6 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
var conf = BI.IconTextNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-node",
logic: {
dynamic: false
},
cls: "close-ha-font",
iconHeight: null,
iconWidth: null,

3
src/base/single/button/node/texticonnode.js

@ -9,9 +9,6 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
var conf = BI.TextIconNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-icon-node",
logic: {
dynamic: false
},
cls: "close-ha-font",
iconHeight: null,
iconWidth: null,

4
src/base/single/editor/editor.js

@ -240,9 +240,6 @@ BI.Editor = BI.inherit(BI.Single, {
},
setWaterMark: function (v) {
if (!BI.isKey(v)) {
return;
}
this.options.watermark = v;
@ -261,6 +258,7 @@ BI.Editor = BI.inherit(BI.Single, {
});
}
this.watermark.setText(v);
this._checkWaterMark();
},
_setErrorVisible: function (b) {

3
src/base/single/editor/editor.multifile.js

@ -31,7 +31,8 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
accept: o.accept,
maxSize: o.maxSize,
maxLength: o.maxLength,
title: o.title
title: o.title,
errorText: o.errorText,
});
this.file.on(BI.File.EVENT_CHANGE, function () {
self.fireEvent(BI.MultifileEditor.EVENT_CHANGE, arguments);

18
src/base/single/input/file.js

@ -445,8 +445,9 @@
url: "",
multiple: true,
accept: "", // .png,.pdf,image/jpg,image/* 等
maxSize: -1, // 1024 * 1024
maxLength: -1 // 无限制, 与multiple配合使用
maxSize: -1, // 1024 * 1024 单位b
maxLength: -1, // 无限制, 与multiple配合使用
errorText: BI.emptyFn,
});
},
@ -472,12 +473,10 @@
// handlers
_wrap.onloadstart = function (rpe, xhr) {
// BI.Msg.toast("loadstart");
self.fireEvent(BI.File.EVENT_UPLOADSTART, arguments);
};
_wrap.onprogress = function (rpe, xhr) {
// BI.Msg.toast("onprogress");
// percent for each bar
// fileSize is -1 only if browser does not support file info access
@ -561,21 +560,26 @@
var validateFileType = fileTypeValidate(value, wrap.fileType);
if (!validateFileType) {
// 文件类型不支持
BI.Msg.toast(BI.i18nText("BI-Upload_File_Type_Error"), { level: "error" });
BI.Msg.toast(o.errorText({
errorType: 0,
file: item
}) || BI.i18nText("BI-Upload_File_Type_Error", wrap.fileType), { level: "error" });
self.fireEvent(BI.File.EVENT_ERROR, {
errorType: 0,
file: item
});
} else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) {
// 文件大小不支持
BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error"), { level: "error" });
BI.Msg.toast(o.errorText({
errorType: 1,
file: item
}) || BI.i18nText("BI-Upload_File_Size_Error", Math.ceil(wrap.maxSize / 1024 / 1024)), { level: "error" });
self.fireEvent(BI.File.EVENT_ERROR, {
errorType: 1,
file: item
});
} else {
wrap.files.unshift(item);
// BI.Msg.toast(value);
}
}
}

43
src/base/single/input/input.js

@ -206,14 +206,29 @@ BI.Input = BI.inherit(BI.Single, {
this._lastValue = this.getValue();
},
_checkValidationOnValueChange: function () {
var o = this.options;
_checkValidationOnValueChange: function (callback) {
var self = this, o = this.options;
var v = this.getValue();
this.setValid(
(o.allowBlank === true && BI.trim(v) == "") || (
BI.isNotEmptyString(BI.trim(v)) && o.validationChecker.apply(this, [BI.trim(v)]) !== false
)
);
if (o.allowBlank === true && BI.trim(v) == "") {
this.setValid(true);
callback && callback();
return;
}
if (BI.trim(v) == "") {
this.setValid(false);
callback && callback();
return;
}
var checker = o.validationChecker.apply(this, [BI.trim(v)]);
if (checker instanceof Promise) {
checker.then(function (validate) {
self.setValid(validate !== false);
callback && callback();
})
} else {
this.setValid(checker !== false);
callback && callback();
}
},
focus: function () {
@ -245,14 +260,16 @@ BI.Input = BI.inherit(BI.Single, {
},
setValue: function (textValue) {
var self = this;
this.element.val(textValue);
BI.nextTick(BI.bind(function () {
this._checkValidationOnValueChange();
this._defaultState();
if (this.isValid()) {
this._lastValidValue = this._lastSubmitValue = this.getValue();
BI.nextTick(function () {
self._checkValidationOnValueChange(function () {
self._defaultState();
if (self.isValid()) {
self._lastValidValue = self._lastSubmitValue = self.getValue();
}
}, this));
});
});
},
getValue: function () {

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

@ -8,7 +8,7 @@
BI.Toast = BI.inherit(BI.Tip, {
_const: {
closableMinWidth: 146,
minWidth: 124,
minWidth: 100,
closableMaxWidth: 410,
maxWidth: 400,
hgap: 8
@ -20,7 +20,8 @@ BI.Toast = BI.inherit(BI.Tip, {
text: "",
level: "success", // success或warning
autoClose: true,
closable: null
closable: null,
vgap: 7,
});
},
@ -56,6 +57,9 @@ BI.Toast = BI.inherit(BI.Tip, {
case "warning":
cls = "toast-warning-font";
break;
case "loading":
cls = "toast-loading-font anim-rotate";
break;
case "normal":
default:
cls = "toast-message-font";
@ -99,7 +103,7 @@ BI.Toast = BI.inherit(BI.Tip, {
horizontalAlign: BI.HorizontalAlign.Stretch,
element: this,
items: items,
vgap: 12,
vgap: o.vgap,
columnSize: columnSize
});
},

3
src/case/button/item.multiselect.js

@ -11,9 +11,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
tabIndex: 1
},
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
logic: {
dynamic: false
},
iconWrapperWidth: 26,
});
},

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

@ -10,9 +10,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
attributes: {
tabIndex: 1
},
logic: {
dynamic: false
},
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: 16,
textHgap: 10,
@ -31,6 +28,16 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
ref: function (_ref) {
self.radio = _ref;
},
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
}
}
],
}]
}, {
el: {

7
src/case/button/node/node.arrow.js

@ -6,9 +6,6 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, {
var conf = BI.ArrowNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-arrow-group-node bi-list-item",
logic: {
dynamic: false
},
id: "",
pId: "",
open: false,
@ -20,7 +17,9 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, {
render: function () {
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.arrow_group_node_checkbox"
type: "bi.arrow_group_node_checkbox",
expandIcon: o.expandIcon,
collapseIcon: o.collapseIcon,
});
return {
type: "bi.vertical_adapt",

2
src/case/button/node/node.icon.arrow.js

@ -29,6 +29,8 @@ BI.IconArrowNode = BI.inherit(BI.NodeButton, {
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.arrow_group_node_checkbox",
expandIcon: o.expandIcon,
collapseIcon: o.collapseIcon,
width: 24,
stopPropagation: true
});

4
src/case/button/node/node.plus.js

@ -9,13 +9,9 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
var conf = BI.PlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-plus-group-node bi-list-item",
logic: {
dynamic: false
},
id: "",
pId: "",
open: false,
iconWrapperWidth: null,
height: 24
});
},

3
src/case/button/switch.js

@ -14,9 +14,6 @@ BI.Switch = BI.inherit(BI.BasicButton, {
},
height: 20,
width: 44,
logic: {
dynamic: false
},
showTip: false
},

16
src/case/checkbox/check.arrownode.js

@ -3,18 +3,22 @@
* 右与下箭头切换的树节点
*/
BI.ArrowTreeGroupNodeCheckbox = BI.inherit(BI.IconButton, {
_defaultConfig: function () {
return BI.extend(BI.ArrowTreeGroupNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-arrow-group-node-checkbox expander-right-font"
});
props: function (conf) {
return {
extraCls: "bi-arrow-group-node-checkbox " + (conf.collapseIcon || "expander-right-font"),
expandIcon: "expander-down-font",
collapseIcon: "expander-right-font"
};
},
setSelected: function (v) {
var o = this.options;
BI.ArrowTreeGroupNodeCheckbox.superclass.setSelected.apply(this, arguments);
if(v) {
this.element.removeClass("expander-right-font").addClass("expander-down-font");
this.element.removeClass(o.collapseIcon).addClass(o.expandIcon);
} else {
this.element.removeClass("expander-down-font").addClass("expander-right-font");
this.element.removeClass(o.expandIcon).addClass(o.collapseIcon);
}
}
});

2
src/case/colorchooser/colorchooser.js

@ -13,6 +13,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
value: "",
height: 24,
el: {},
simple: false
});
},
@ -30,6 +31,7 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
isNeedAdjustHeight: false,
el: BI.extend({
type: o.width <= 24 ? "bi.color_chooser_trigger" : "bi.long_color_chooser_trigger",
simple: o.simple,
ref: function (_ref) {
self.trigger = _ref;
},

1
src/case/colorchooser/colorchooser.simple.js

@ -20,6 +20,7 @@ BI.SimpleColorChooser = BI.inherit(BI.Widget, {
this.combo = BI.createWidget({
type: "bi.color_chooser",
simple: o.simple,
element: this,
container: o.container,
value: o.value,

2
src/case/colorchooser/colorchooser.trigger.js

@ -10,7 +10,7 @@ BI.ColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function (config) {
var conf = BI.ColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border bi-border-radius"),
height: 22
});
},

2
src/case/colorchooser/colorchooser.trigger.long.js

@ -10,7 +10,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function (config) {
var conf = BI.LongColorChooserTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border"),
baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger bi-focus-shadow " + (config.simple ? "bi-border-bottom" : "bi-border bi-border-radius"),
height: 24
});
},

12
src/case/combo/bubblecombo/popup.bubble.js

@ -48,8 +48,8 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, {
if (BI.isWidget(buttonOpt)) {
items.push({
el: buttonOpt,
lgap: i === 0 ? 20 : 15,
rgap: i === o.buttons.length - 1 ? 20 : 0
lgap: i === 0 ? 15 : 10,
rgap: i === o.buttons.length - 1 ? 15 : 0
});
} else {
items.push({
@ -60,14 +60,14 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, {
self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v);
}
}, buttonOpt),
lgap: i === 0 ? 20 : 15,
rgap: i === o.buttons.length - 1 ? 20 : 0
lgap: i === 0 ? 15 : 10,
rgap: i === o.buttons.length - 1 ? 15 : 0
});
}
});
return BI.createWidget({
type: "bi.right_vertical_adapt",
height: 54,
height: 44,
items: items
});
},
@ -90,7 +90,7 @@ BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, {
}]
});
button.element.css("min-height", o.minHeight - 54);
button.element.css("min-height", o.minHeight - 44);
return button;
}

2
src/case/combo/icontextvaluecombo/combo.icontextvalue.js

@ -5,7 +5,7 @@
BI.IconTextValueCombo = BI.inherit(BI.Widget, {
_defaultConfig: function (config) {
return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-icon-text-value-combo bi-border-radius " + (config.simple ? "bi-border-bottom" : "bi-border"),
baseCls: "bi-icon-text-value-combo " + (config.simple ? "bi-border-bottom" : "bi-border bi-border-radius"),
height: 24,
iconHeight: null,
iconWidth: null,

58
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -11,6 +11,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
items: [],
tipType: "",
warningTitle: "",
allowClear: false,
},
render: function () {
@ -21,14 +22,17 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) {
self.populate(newValue);
}) : o.items;
var height = BI.isNumeric(o.height) ? (o.height - (o.simple ? 1 : 2)) : o.height;
var width = BI.isNumeric(o.width) ? (o.width - 2) : o.width;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-focus-shadow",
cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
container: o.container,
adjustLength: 2,
height: height,
width: width,
toggle: false,
ref: function () {
self.combo = this;
@ -41,20 +45,27 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
self.trigger = this;
},
items: o.items,
height: o.height - (o.simple ? 1 : 2),
height: height,
text: o.text,
defaultText: o.defaultText,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
allowClear: o.allowClear,
listeners: [{
eventName: BI.SearchTextValueTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.setValue(this.getValue()[0]);
self.combo.hideView();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
}, {
eventName: BI.SearchTextValueTrigger.EVENT_CLEAR,
action: function () {
self._clear();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
}]
},
popup: {
@ -70,7 +81,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
listeners: [{
eventName: BI.TextValueComboPopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.setValue(this.getValue()[0]);
self.combo.hideView();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
@ -91,35 +102,6 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
self.fireEvent(BI.SearchTextValueCombo.EVENT_BEFORE_POPUPVIEW);
}
}],
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
}
},
left: 0,
right: 0,
bottom: 0,
top: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function () {
self.triggerBtn = this;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
@ -130,6 +112,10 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
}
},
_clear: function () {
this.setValue();
},
_checkError: function (v) {
if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) {
this.trigger.options.tipType = "success";

77
src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js

@ -5,16 +5,33 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, {
props: function () {
return {
extraCls: "bi-search-text-value-trigger",
baseCls: "bi-search-text-value-trigger",
height: 24,
watermark: BI.i18nText("BI-Basic_Search")
watermark: BI.i18nText("BI-Basic_Search"),
allowClear: false,
title: () => this.editor.getText(),
};
},
render: function () {
var self = this, o = this.options;
var triggerButton = {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function () {
self.triggerBtn = this;
},
width: o.height,
height: o.height,
width: 24,
};
var stateText = this._digest(o.value, o.items) || o.text;
return {
type: "bi.htape",
type: "bi.horizontal_fill",
columnSize: ["fill", 24],
items: [
{
el: {
@ -24,16 +41,15 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, {
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
type: "bi.default_text_editor",
ref: function () {
self.editor = this;
},
watermark: o.watermark,
defaultText: o.defaultText,
text: this._digest(o.value, o.items),
text: stateText,
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.search_text_value_combo_popup",
@ -55,10 +71,31 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, {
}]
}
}, {
el: o.allowClear ? {
type: "bi.vertical_adapt",
horizontalAlign: "left",
scrollable: false,
items: [
{
el: {
type: "bi.layout",
width: 24
type: "bi.icon_button",
ref: function (_ref) {
self.clearBtn = _ref;
},
cls: "close-h-font " + (o.allowClear ? "clear-button" : ""),
stopPropagation: true,
invisible: !BI.isNotEmptyString(stateText),
width: o.height,
height: o.height,
handler: function () {
self.fireEvent(BI.SearchTextValueTrigger.EVENT_CLEAR);
},
},
}, {
el: triggerButton,
}
]
} : triggerButton,
width: 24
}
]
@ -69,22 +106,11 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, {
this.editor.setState(v);
},
_digest: function (vals, items) {
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !BI.contains(result, item.text || item.value)) {
result.push(item.text || item.value);
}
_digest: function (value, items) {
var result = BI.find(items, function (i, item) {
return item.value === value;
});
if (result.length > 0) {
return result.join(",");
} else {
return BI.isFunction(o.text) ? o.text() : o.text;
}
return result?.text;
},
stopEditing: function () {
@ -100,7 +126,9 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, {
},
setValue: function (vals) {
this._setState(this._digest(vals, this.options.items));
var digestText = this._digest(vals, this.options.items);
this._setState(digestText);
this.options.allowClear && this.clearBtn.setVisible(BI.isNotEmptyString(digestText));
},
getValue: function () {
@ -111,4 +139,5 @@ BI.SearchTextValueTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.SearchTextValueTrigger.EVENT_STOP = "EVENT_STOP";
BI.SearchTextValueTrigger.EVENT_START = "EVENT_START";
BI.SearchTextValueTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchTextValueTrigger.EVENT_CLEAR = "EVENT_CLEAR";
BI.shortcut("bi.search_text_value_trigger", BI.SearchTextValueTrigger);

41
src/case/combo/textvaluecombo/combo.textvalue.js

@ -7,11 +7,12 @@
BI.TextValueCombo = BI.inherit(BI.Widget, {
_defaultConfig: function (config) {
return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-value-combo " + (config.simple ? "bi-border-bottom" : "bi-border"),
baseCls: "bi-text-value-combo " + (config.simple ? "bi-border-bottom" : "bi-border bi-border-radius"),
height: 24,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
text: "",
value: "",
allowClear: false,
});
},
@ -33,7 +34,17 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
height: o.height,
text: o.text,
value: o.value,
warningTitle: o.warningTitle
warningTitle: o.warningTitle,
allowClear: o.allowClear,
listeners: [
{
eventName: BI.SelectTextTrigger.EVENT_CLEAR,
action: function () {
self._clear();
self.fireEvent(BI.TextValueCombo.EVENT_CHANGE);
}
}
],
});
this.popup = BI.createWidget({
type: "bi.text_value_combo_popup",
@ -67,23 +78,27 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
}
},
_clear: function () {
this.setValue();
},
_checkError: function (v) {
if(BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) {
this.trigger.options.tipType = "success";
this.element.removeClass("combo-error");
} else {
v = BI.isArray(v) ? v : [v];
v = BI.isArray(v) ? v[0] : v;
var tipType = null;
var result = BI.find(this.options.items, function (idx, item) {
return BI.contains(v, item.value);
return v === item.value;
});
if (BI.isNull(result)) {
this.trigger.setTipType("warning");
this.element.removeClass("combo-error").addClass("combo-error");
} else {
this.trigger.setTipType("success");
this.element.removeClass("combo-error");
if (this.isEnabled()) {
tipType = "warning";
}
this.element.addClass("error");
this.trigger.element.addClass("error");
} else {
this.element.removeClass("error");
this.trigger.element.removeClass("error");
}
this.trigger.setTipType(tipType);
},
setValue: function (v) {

5
src/case/editor/editor.clear.js

@ -17,8 +17,11 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
});
},
_init: function () {
BI.ClearEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
BI.ClearEditor.superclass._init.apply(this, arguments);
this.editor = BI.createWidget({
type: "bi.editor",
simple: o.simple,

282
src/case/editor/editor.defaulttext.js

@ -0,0 +1,282 @@
/**
* dailer
* 有默认提示文字的输入框
* @class BI.DefaultTextEditor
* @extends BI.Widget
*/
BI.DefaultTextEditor = BI.inherit(BI.Widget, {
props: function () {
return {
baseCls: "bi-default-text-editor",
hgap: 4,
vgap: 2,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: true,
watermark: "",
errorText: "",
height: 24,
defaultText: "", // 默认显示值,默认显示值与显示值的区别是默认显示值标记灰色
text: "", // 显示值
el: {}
};
},
render: function () {
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.editor",
simple: o.simple,
height: o.height,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText,
invisible: true,
});
this.text = BI.createWidget({
type: "bi.text_button",
cls: BI.isKey(o.text) ? "tip-text-style" : "bi-water-mark tip-text-style",
textAlign: "left",
height: o.height,
text: BI.isKey(o.text) ? o.text : o.defaultText,
hgap: o.hgap + 2,
handler: function () {
self._showInput();
self.editor.focus();
self.editor.setValue("");
},
title: o.title,
warningTitle: o.warningTitle,
tipType: o.tipType
});
this.text.on(BI.TextButton.EVENT_CHANGE, function () {
BI.nextTick(function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_CLICK_LABEL);
});
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_FOCUS, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_FOCUS, arguments);
});
this.editor.on(BI.Editor.EVENT_BLUR, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_BLUR, arguments);
});
this.editor.on(BI.Editor.EVENT_CLICK, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_CLICK, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_CHANGE, arguments);
});
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.DefaultTextEditor.EVENT_KEY_DOWN, arguments);
});
this.editor.on(BI.Editor.EVENT_VALID, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_VALID, arguments);
});
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.DefaultTextEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.DefaultTextEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_START, arguments);
});
this.editor.on(BI.Editor.EVENT_PAUSE, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_PAUSE, arguments);
});
this.editor.on(BI.Editor.EVENT_STOP, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_STOP, arguments);
});
this.editor.on(BI.Editor.EVENT_SPACE, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_SPACE, arguments);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_ERROR, arguments);
});
this.editor.on(BI.Editor.EVENT_ENTER, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_ENTER, arguments);
});
this.editor.on(BI.Editor.EVENT_RESTRICT, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_RESTRICT, arguments);
});
this.editor.on(BI.Editor.EVENT_EMPTY, function () {
self.fireEvent(BI.DefaultTextEditor.EVENT_EMPTY, arguments);
});
return {
type: "bi.absolute",
items: [
{
el: this.editor,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: this.text,
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
};
},
setWaterMark: function (v) {
this.options.watermark = v;
this.editor.setWaterMark(v);
},
setTitle: function (title) {
this.text.setTitle(title);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},
doRedMark: function () {
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) {
return;
}
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doHighLight: function () {
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) {
return;
}
this.text.doHighLight.apply(this.text, arguments);
},
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
},
focus: function () {
if (this.options.disabled === false) {
this._showInput();
this.editor.focus();
}
},
blur: function () {
this.editor.blur();
this._showHint();
},
_showInput: function () {
this.editor.visible();
this.text.invisible();
},
_showHint: function () {
this.editor.invisible();
this.text.visible();
},
_setText: function (v) {
this.text.setText(v);
this.text.setTitle(v);
},
isValid: function () {
return this.editor.isValid();
},
setErrorText: function (text) {
this.editor.setErrorText(text);
},
getErrorText: function () {
return this.editor.getErrorText();
},
isEditing: function () {
return this.editor.isEditing();
},
getLastValidValue: function () {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (k) {
this.editor.setValue(k);
},
getValue: function () {
return this.editor.getValue();
},
getState: function () {
return this.text.getValue();
},
setState: function (v) {
var o = this.options;
if (BI.isKey(v)) {
this.text.setText(v);
this.text.element.removeClass("bi-water-mark");
return;
}
this.text.setText(o.defaultText);
this.text.element.addClass("bi-water-mark");
},
setTipType: function (v) {
this.text.options.tipType = v;
},
getText: function () {
return this.text.getText();
}
});
BI.DefaultTextEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.DefaultTextEditor.EVENT_FOCUS = "EVENT_FOCUS";
BI.DefaultTextEditor.EVENT_BLUR = "EVENT_BLUR";
BI.DefaultTextEditor.EVENT_CLICK = "EVENT_CLICK";
BI.DefaultTextEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
BI.DefaultTextEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.DefaultTextEditor.EVENT_START = "EVENT_START";
BI.DefaultTextEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.DefaultTextEditor.EVENT_STOP = "EVENT_STOP";
BI.DefaultTextEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.DefaultTextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.DefaultTextEditor.EVENT_VALID = "EVENT_VALID";
BI.DefaultTextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.DefaultTextEditor.EVENT_ENTER = "EVENT_ENTER";
BI.DefaultTextEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.DefaultTextEditor.EVENT_SPACE = "EVENT_SPACE";
BI.DefaultTextEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.default_text_editor", BI.DefaultTextEditor);

5
src/case/editor/editor.shelter.js

@ -26,8 +26,11 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
},
_init: function () {
BI.ShelterEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
BI.ShelterEditor.superclass._init.apply(this, arguments);
this.editor = BI.createWidget({
type: "bi.editor",
simple: o.simple,

9
src/case/editor/editor.sign.js

@ -26,8 +26,11 @@ BI.SignEditor = BI.inherit(BI.Widget, {
},
_init: function () {
BI.SignEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
BI.SignEditor.superclass._init.apply(this, arguments);
this.editor = BI.createWidget({
type: "bi.editor",
simple: o.simple,
@ -171,6 +174,10 @@ BI.SignEditor = BI.inherit(BI.Widget, {
this.text.setTitle(title);
},
setTipType: function (v) {
this.text.setTipType(v);
},
setWarningTitle: function (title) {
this.text.setWarningTitle(title);
},

7
src/case/layer/panel.js

@ -8,6 +8,7 @@ BI.Panel = BI.inherit(BI.Widget, {
return BI.extend(BI.Panel.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-panel bi-border",
title: "",
titleHeight: 30,
titleButtons: [],
el: {},
logic: {
@ -34,7 +35,7 @@ BI.Panel = BI.inherit(BI.Widget, {
type: "bi.label",
cls: "panel-title-text",
text: o.title,
height: 30
height: o.titleHeight
});
this.button_group = BI.createWidget({
@ -58,7 +59,7 @@ BI.Panel = BI.inherit(BI.Widget, {
el: {
type: "bi.left_right_vertical_adapt",
cls: "panel-title bi-header-background bi-border-bottom",
height: 29,
height: o.titleHeight - 1,
items: {
left: [this.text],
right: [this.button_group]
@ -66,7 +67,7 @@ BI.Panel = BI.inherit(BI.Widget, {
lhgap: 10,
rhgap: 10
},
height: 29
height: o.titleHeight - 1
};
},

4
src/case/tree/treeexpander/tree.expander.popup.js

@ -22,8 +22,8 @@
this.popupView.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.popupView.element.css("margin-left", -offset * o.layer);
this.element.css("margin-left", offset * o.layer);
this.popupView.element.css("margin-left", -offset * (o.layer + 1));
this.element.css("margin-left", offset * (o.layer + 1));
return {
type: "bi.vertical",

66
src/case/trigger/trigger.text.js

@ -7,25 +7,27 @@
*/
BI.TextTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
props: function () {
var self = this;
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger",
return {
baseCls: "bi-text-trigger",
height: 24,
textHgap: 6,
textCls: "",
allowClear: false,
title: function () {
return self.text.getText();
}
});
};
},
_init: function () {
BI.TextTrigger.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({
var text = {
type: "bi.label",
ref: function (_ref) {
self.text = _ref;
},
cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left",
height: o.height,
@ -39,22 +41,49 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
tgap: o.textTgap,
bgap: o.textBgap,
readonly: o.readonly
});
this.trigerButton = BI.createWidget({
};
var triggerButton = {
type: "bi.trigger_icon_button",
ref: function (_ref) {
self.triggerButton = _ref;
},
width: o.triggerWidth || o.height
});
};
BI.createWidget({
element: this,
return ({
type: "bi.horizontal_fill",
columnSize: ["fill", o.triggerWidth || o.height],
items: [
{
el: this.text,
el: text,
width: "fill"
}, {
el: this.trigerButton,
width: o.triggerWidth || o.height
el: o.allowClear ? {
type: "bi.vertical_adapt",
horizontalAlign: "left",
scrollable: false,
items: [
{
el: {
type: "bi.icon_button",
ref: function (_ref) {
self.clearBtn = _ref;
},
cls: "close-h-font " + (o.allowClear ? "clear-button" : ""),
stopPropagation: true,
width: o.triggerWidth || o.height,
height: o.height,
invisible: !BI.isNotEmptyString(o.text),
handler: function () {
self.fireEvent(BI.TextTrigger.EVENT_CLEAR);
},
},
}, {
el: triggerButton,
}
]
} : triggerButton,
}
]
});
@ -73,6 +102,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
setText: function (text) {
this.text.setText(text);
if (this.options.allowClear) {
this.clearBtn.setVisible(BI.isNotEmptyString(text));
}
},
setTipType: function (v) {
@ -80,4 +112,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
this.options.tipType = v;
}
});
BI.TextTrigger.EVENT_CLEAR = "EVENT_CLEAR";
BI.shortcut("bi.text_trigger", BI.TextTrigger);

28
src/case/trigger/trigger.text.select.js

@ -11,6 +11,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
return BI.extend(BI.SelectTextTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-text-trigger",
height: 24,
allowClear: false,
valueFormatter: BI.emptyFn,
});
},
@ -32,7 +34,17 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
textTgap: o.textTgap,
textBgap: o.textBgap,
tipType: o.tipType,
warningTitle: o.warningTitle
warningTitle: o.warningTitle,
allowClear: o.allowClear,
listeners: [
{
eventName: BI.TextTrigger.EVENT_CLEAR,
action: function () {
self.setText("");
self.fireEvent(BI.SelectTextTrigger.EVENT_CLEAR);
}
}
]
});
},
@ -50,16 +62,21 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
if (result.length > 0) {
return {
textCls: "",
text: result.join(",")
}
text: o.valueFormatter(vals[0]) || result.join(","), // 只保留单个value的场景,后续会把BI.isArray(vals) ? vals : [vals];这种都去掉
};
} else {
return {
textCls: "bi-water-mark",
text: BI.isFunction(o.text) ? o.text() : o.text
}
};
}
},
setText: function (text) {
this.options.text = text;
this.trigger.setText(text);
},
setValue: function (vals) {
var formatValue = this._digest(vals, this.options.items);
this.trigger.setTextCls(formatValue.textCls);
@ -67,6 +84,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
},
setTipType: function (v) {
this.options.tipType = v;
this.trigger.setTipType(v);
},
@ -78,4 +96,6 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.items = items;
}
});
BI.SelectTextTrigger.EVENT_CLEAR = "EVENT_CLEAR";
BI.shortcut("bi.select_text_trigger", BI.SelectTextTrigger);

6
src/case/ztree/0.treeview.js

@ -225,16 +225,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
function onExpand(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
treeNode.halfCheck = false;
}
function onCollapse(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
}
return setting;

9
src/case/ztree/1.asynctree.js

@ -104,9 +104,6 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}
function beforeExpand(treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
self._beforeExpandNode(treeId, treeNode);
}
@ -118,16 +115,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}
function onExpand(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
treeNode.halfCheck = false;
}
function onCollapse(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
treeNode.halfCheck = false;
}

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

@ -45,6 +45,25 @@ BI.prepares.push(function () {
scrollx: true
}, ob, {type: "bi.inline"});
});
BI.Plugin.configWidget("bi.vertical", function (ob) {
if (ob.horizontalAlign === BI.HorizontalAlign.Left || ob.horizontalAlign === BI.HorizontalAlign.Right) {
if (isSupportFlex()) {
return BI.extend({}, ob, {type: "bi.flex_vertical"});
}
return BI.extend({}, ob, {
horizontalAlign: BI.HorizontalAlign.Stretch,
type: "bi.vertical",
items: BI.map(ob.items, function (i, item) {
return {
type: "bi.inline",
horizontalAlign: ob.horizontalAlign,
items: [item]
};
})
});
}
return ob;
});
BI.Plugin.configWidget("bi.inline", function (ob) {
// 当列宽既需要自动列宽又需要自适应列宽时,inline布局也处理不了了,降级table处理吧
var hasAutoAndFillColumnSize = false;

9
src/core/system.js

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

71
src/core/wrapper/layout.js

@ -16,7 +16,7 @@ BI.Layout = BI.inherit(BI.Widget, {
scrolly: false, // true, false
items: [],
innerHgap: 0,
innerVgap: 0,
innerVgap: 0
};
},
@ -292,6 +292,43 @@ BI.Layout = BI.inherit(BI.Widget, {
return (gap > 0 && gap < 1) ? (gap * 100).toFixed(1) + "%" : gap / BI.pixRatio + BI.pixUnit;
},
_optimiseItemLgap: function (item) {
if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? ((item._lgap || 0) + (item.lgap || 0)) : item._lgap) || 0;
}
return (item._lgap || 0) + (item.lgap || 0);
},
_optimiseItemRgap: function (item) {
if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? ((item._rgap || 0) + (item.rgap || 0)) : item._rgap) || 0;
}
return (item._rgap || 0) + (item.rgap || 0);
},
_optimiseItemTgap: function (item) {
if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? ((item._tgap || 0) + (item.tgap || 0)) : item._tgap) || 0;
}
return (item._tgap || 0) + (item.tgap || 0);
},
_optimiseItemBgap: function (item) {
if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? ((item._bgap || 0) + (item.bgap || 0)) : item._bgap) || 0;
}
return (item._bgap || 0) + (item.bgap || 0);
},
_optimiseItemHgap: function (item) {
if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? ((item._hgap || 0) + (item.hgap || 0)) : item._hgap) || 0;
}
return (item._hgap || 0) + (item.hgap || 0);
},
_optimiseItemVgap: function (item) {
if (BI.Providers.getProvider("bi.provider.system").getLayoutOptimize()) {
return ((!item.type && item.el) ? ((item._vgap || 0) + (item.vgap || 0)) : item._vgap) || 0;
}
return (item._vgap || 0) + (item.vgap || 0);
},
_handleGap: function (w, item, hIndex, vIndex) {
var o = this.options;
var innerLgap, innerRgap, innerTgap, innerBgap;
@ -304,26 +341,26 @@ BI.Layout = BI.inherit(BI.Widget, {
innerTgap = vIndex === 0 ? o.innerVgap : 0;
innerBgap = vIndex === o.items.length - 1 ? o.innerVgap : 0;
}
if (o.vgap + o.tgap + innerTgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
var top = ((BI.isNull(vIndex) || vIndex === 0) ? o.vgap : 0) + o.tgap + innerTgap + (item.tgap || 0) + (item.vgap || 0);
if (o.vgap + o.tgap + innerTgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) {
var top = ((BI.isNull(vIndex) || vIndex === 0) ? o.vgap : 0) + o.tgap + innerTgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item);
w.element.css({
"margin-top": this._optimiseGap(top)
});
}
if (o.hgap + o.lgap + innerLgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
var left = ((BI.isNull(hIndex) || hIndex === 0) ? o.hgap : 0) + o.lgap + innerLgap + (item.lgap || 0) + (item.hgap || 0);
if (o.hgap + o.lgap + innerLgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) {
var left = ((BI.isNull(hIndex) || hIndex === 0) ? o.hgap : 0) + o.lgap + innerLgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item);
w.element.css({
"margin-left": this._optimiseGap(left)
});
}
if (o.hgap + o.rgap + innerRgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
var right = o.hgap + o.rgap + innerRgap + (item.rgap || 0) + (item.hgap || 0);
if (o.hgap + o.rgap + innerRgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) {
var right = o.hgap + o.rgap + innerRgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item);
w.element.css({
"margin-right": this._optimiseGap(right)
});
}
if (o.vgap + o.bgap + innerBgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
var bottom = o.vgap + o.bgap + innerBgap + (item.bgap || 0) + (item.vgap || 0);
if (o.vgap + o.bgap + innerBgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) {
var bottom = o.vgap + o.bgap + innerBgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item);
w.element.css({
"margin-bottom": this._optimiseGap(bottom)
});
@ -337,27 +374,27 @@ BI.Layout = BI.inherit(BI.Widget, {
innerLgap = innerRgap = o.innerHgap;
innerTgap = index === 0 ? o.innerVgap : 0;
innerBgap = index === o.items.length - 1 ? o.innerVgap : 0;
if (o.vgap + o.tgap + innerTgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
var top = (index === 0 ? o.vgap : 0) + (index === 0 ? o.tgap : 0) + innerTgap + (item.tgap || 0) + (item.vgap || 0);
if (o.vgap + o.tgap + innerTgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) {
var top = (index === 0 ? o.vgap : 0) + (index === 0 ? o.tgap : 0) + innerTgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item);
w.element.css({
"margin-top": this._optimiseGap(top)
});
}
if (o.hgap + o.lgap + innerLgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
var left = o.hgap + o.lgap + innerLgap + (item.lgap || 0) + (item.hgap || 0);
if (o.hgap + o.lgap + innerLgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) {
var left = o.hgap + o.lgap + innerLgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item);
w.element.css({
"margin-left": this._optimiseGap(left)
});
}
if (o.hgap + o.rgap + innerRgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
var right = o.hgap + o.rgap + innerRgap + (item.rgap || 0) + (item.hgap || 0);
if (o.hgap + o.rgap + innerRgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) {
var right = o.hgap + o.rgap + innerRgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item);
w.element.css({
"margin-right": this._optimiseGap(right)
});
}
// 这里的代码是关键
if (o.vgap + o.hgap + o.bgap + innerBgap + (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) + innerBgap + (item.bgap || 0) + (item.vgap || 0);
if (o.vgap + o.hgap + o.bgap + innerBgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) {
var bottom = (index === o.items.length - 1 ? o.vgap : o.hgap) + (index === o.items.length - 1 ? o.bgap : 0) + innerBgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item);
w.element.css({
"margin-bottom": this._optimiseGap(bottom)
});

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

@ -30,10 +30,10 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, {
var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments);
w.element.css({
position: "absolute",
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)),
left: this._optimiseGap(o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item)),
right: this._optimiseGap(o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item)),
top: this._optimiseGap(o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item)),
bottom: this._optimiseGap(o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item)),
margin: "auto"
});
return w;

34
src/core/wrapper/layout/adapt/absolute.leftrightvertical.js

@ -37,7 +37,7 @@ BI.AbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
_formatItems: function (items) {
var o = this.options;
var self = this, o = this.options;
var left, right;
if (BI.isArray(items)) {
BI.each(items, function (i, item) {
@ -56,17 +56,17 @@ BI.AbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
el: BI.stripEL(item),
width: item.width
};
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.lvgap + o.ltgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) !== 0) {
json.tgap = o.lvgap + o.ltgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item);
}
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.llgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) !== 0) {
json.lgap = (i === 0 ? o.lhgap : 0) + o.llgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item);
}
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.lhgap + o.lrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) !== 0) {
json.rgap = o.lhgap + o.lrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item);
}
if (o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
json.bgap = o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0);
if (o.lvgap + o.lbgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) !== 0) {
json.bgap = o.lvgap + o.lbgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item);
}
return json;
});
@ -75,17 +75,17 @@ BI.AbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
el: BI.stripEL(item),
width: item.width
};
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.rvgap + o.rtgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) !== 0) {
json.tgap = o.rvgap + o.rtgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item);
}
if (o.rhgap + o.rlgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
json.lgap = (i === 0 ? o.rhgap : 0) + o.rlgap + (item.lgap || 0) + (item.hgap || 0);
if (o.rhgap + o.rlgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) !== 0) {
json.lgap = (i === 0 ? o.rhgap : 0) + o.rlgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item);
}
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.rhgap + o.rrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) !== 0) {
json.rgap = o.rhgap + o.rrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item);
}
if (o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
json.bgap = o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0);
if (o.rvgap + o.rbgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) !== 0) {
json.bgap = o.rvgap + o.rbgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item);
}
return json;
});

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

@ -70,8 +70,8 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
td.element.width(width);
}
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);
var top = o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item),
bottom = o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item);
w.element.css("height", "calc(100% - " + this._optimiseGap(top + bottom) + ")");
}
// 对于表现为td的元素设置最大宽度,有几点需要注意

8
src/core/wrapper/layout/fill/auto.vtape.js

@ -60,10 +60,10 @@ BI.AutoVerticalTapeLayout = BI.inherit(BI.Layout, {
if (preRowSize === "") {
preRowSize = self.layout.getWidgetByName(self._getChildName(i - 1)).element.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;
top[i] = top[i - 1] + preRowSize + self._optimiseItemTgap(items[i - 1]) + self._optimiseItemBgap(items[i - 1]) + 2 * self._optimiseItemVgap(items[i - 1]) + o.vgap + o.tgap + o.bgap;
}
w.element.css({
top: self._optimiseGap(top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap)
top: self._optimiseGap(top[i] + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) + o.vgap + o.tgap)
});
if (rowSize === "fill") {
@ -81,10 +81,10 @@ BI.AutoVerticalTapeLayout = BI.inherit(BI.Layout, {
if (nextRowSize === "") {
nextRowSize = self.layout.getWidgetByName(self._getChildName(i + 1)).element.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;
bottom[i] = bottom[i + 1] + nextRowSize + self._optimiseItemTgap(items[i + 1]) + self._optimiseItemBgap(items[i + 1]) + 2 * self._optimiseItemVgap(items[i + 1]) + o.vgap + o.tgap + o.bgap;
}
w.element.css({
bottom: self._optimiseGap(bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap),
bottom: self._optimiseGap(bottom[i] + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) + o.vgap + o.bgap),
});
if (rowSize === "fill") {

28
src/core/wrapper/layout/fill/float.fill.horizontal.js

@ -45,41 +45,41 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
} else {
var w = BI._lazyCreateWidget(item);
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
if (o.vgap + o.tgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) !== 0) {
w.element.css({
"margin-top": self._optimiseGap(o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0))
"margin-top": self._optimiseGap(o.vgap + o.tgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item))
});
}
if (desc) {
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
if (o.hgap + o.rgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) !== 0) {
w.element.css({
"margin-right": self._optimiseGap((i === o.items.length - 1 ? o.hgap : 0) + o.rgap + (item.rgap || 0) + (item.hgap || 0))
"margin-right": self._optimiseGap((i === o.items.length - 1 ? o.hgap : 0) + o.rgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item))
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
if (o.hgap + o.lgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) !== 0) {
w.element.css({
"margin-left": self._optimiseGap(o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0))
"margin-left": self._optimiseGap(o.hgap + o.lgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item))
});
}
} else {
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
if (o.hgap + o.lgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) !== 0) {
w.element.css({
"margin-left": self._optimiseGap((i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0))
"margin-left": self._optimiseGap((i === 0 ? o.hgap : 0) + o.lgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item))
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
if (o.hgap + o.rgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) !== 0) {
w.element.css({
"margin-right": self._optimiseGap(o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0))
"margin-right": self._optimiseGap(o.hgap + o.rgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item))
});
}
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
if (o.vgap + o.bgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) !== 0) {
w.element.css({
"margin-bottom": self._optimiseGap(o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0))
"margin-bottom": self._optimiseGap(o.vgap + o.bgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item))
});
}
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
var top = o.vgap + o.tgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item),
bottom = o.vgap + o.bgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item);
if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
w.element.css({
height: "calc(100% - " + self._optimiseGap(top + bottom) + ")"

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

@ -82,6 +82,9 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
if (columnSize === "fill") {
w.element.addClass("f-f");
}
if (columnSize === "" || columnSize === "auto") {
w.element.addClass("f-auto");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");

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

@ -2,6 +2,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FlexLeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-f-lr-v-c",
columnSize: [],
items: {},
llgap: 0,
lrgap: 0,
@ -20,22 +21,24 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
render: function () {
var o = this.options, self = this;
BI.FlexLeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
var items = this._formatItems(o.items);
return {
type: "bi.flex_vertical_adapt",
ref: function (_ref) {
self.layout = _ref;
},
items: this._formatItems(o.items),
columnSize: o.columnSize.slice(0, (o.items.left || []).length).concat((o.items.right || []).length > 0 ? [""] : []),
items: items,
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable,
innerHgap: o.innerHgap,
innerVgap: o.innerVgap,
innerVgap: o.innerVgap
};
},
_formatItems: function (items) {
var o = this.options;
var self = this, o = this.options;
var left, right;
if (BI.isArray(items)) {
BI.each(items, function (i, item) {
@ -53,23 +56,24 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
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.lvgap + o.ltgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) !== 0) {
json.tgap = o.lvgap + o.ltgap + self._optimiseItemTgap(item) + self._optimiseItemVgap(item);
}
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.llgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) !== 0) {
json.lgap = (i === 0 ? o.lhgap : 0) + o.llgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item);
}
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.lhgap + o.lrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) !== 0) {
json.rgap = o.lhgap + o.lrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item);
}
if (o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
json.bgap = o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0);
if (o.lvgap + o.lbgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) !== 0) {
json.bgap = o.lvgap + o.lbgap + self._optimiseItemBgap(item) + self._optimiseItemVgap(item);
}
return json;
});
return leftItems.concat({
el: {
type: "bi.flex_vertical_adapt",
columnSize: o.columnSize.slice(leftItems.length),
css: {
"margin-left": "auto"
},

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

@ -81,6 +81,9 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
if (rowSize === "fill") {
w.element.addClass("f-f");
}
if (rowSize === "" || rowSize === "auto") {
w.element.addClass("f-auto");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");

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

@ -79,6 +79,10 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
w.element.addClass("f-f");
this.element.addClass("f-f");
}
if (columnSize === "" || columnSize === "auto") {
w.element.addClass("f-auto");
this.element.addClass("f-auto");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");

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

@ -79,6 +79,10 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
w.element.addClass("f-f");
this.element.addClass("f-f");
}
if (rowSize === "" || rowSize === "auto") {
w.element.addClass("f-auto");
this.element.addClass("f-auto");
}
w.element.addClass("c-e");
if (i === 0) {
w.element.addClass("f-c");

18
src/core/wrapper/layout/float/float.absolute.leftrightvertical.js

@ -38,7 +38,7 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
_formatItems: function (items) {
var o = this.options;
var self = this, o = this.options;
var left, right;
if (BI.isArray(items)) {
BI.each(items, function (i, item) {
@ -68,11 +68,11 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
// 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.llgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) !== 0) {
json.lgap = (i === 0 ? o.lhgap : 0) + o.llgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item);
}
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.lhgap + o.lrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) !== 0) {
json.rgap = o.lhgap + o.lrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item);
}
// if (o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
// json.bgap = o.lvgap + o.lbgap + (item.bgap || 0) + (item.vgap || 0);
@ -95,11 +95,11 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
// 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) {
json.lgap = (i === 0 ? o.rhgap : 0) + o.rlgap + (item.lgap || 0) + (item.hgap || 0);
if (o.rhgap + o.rlgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) !== 0) {
json.lgap = (i === 0 ? o.rhgap : 0) + o.rlgap + self._optimiseItemLgap(item) + self._optimiseItemHgap(item);
}
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.rhgap + o.rrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) !== 0) {
json.rgap = o.rhgap + o.rrgap + self._optimiseItemRgap(item) + self._optimiseItemHgap(item);
}
// if (o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
// json.bgap = o.rvgap + o.rbgap + (item.bgap || 0) + (item.vgap || 0);

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

@ -56,26 +56,26 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(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);
if (o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) {
var top = o.vgap / 2 + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item);
w.element.css({
"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);
if (o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) {
var left = o.hgap / 2 + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item);
w.element.css({
"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);
if (o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) {
var right = o.hgap / 2 + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item);
w.element.css({
"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);
if (o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) {
var bottom = o.vgap / 2 + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item);
w.element.css({
"margin-bottom": this._optimiseGap(bottom)
});
@ -148,24 +148,28 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom});
}
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
if (o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) {
var top = o.vgap / 2 + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item);
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) {
if (o.hgap + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item) !== 0) {
var left = o.hgap / 2 + o.lgap + this._optimiseItemLgap(item) + this._optimiseItemHgap(item);
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) {
if (o.hgap + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item) !== 0) {
var right = o.hgap / 2 + o.rgap + this._optimiseItemRgap(item) + this._optimiseItemHgap(item);
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) {
if (o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item) !== 0) {
var bottom = o.vgap / 2 + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item);
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;

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

@ -40,7 +40,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
_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;
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (o.columnSize.length > 0) {
if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) {
columnSize = null;
@ -66,7 +66,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
autoCount++;
cz = 0;
}
gap += o.hgap + o.lgap + o.rgap + (o.items[k].lgap || 0) + (o.items[k].rgap || 0) + (o.items[k].hgap || 0);
gap += o.hgap + o.lgap + o.rgap + this._optimiseItemLgap(o.items[k]) + this._optimiseItemRgap(o.items[k]) + this._optimiseItemHgap(o.items[k]);
length += cz;
}
length = length > 0 && length < 1 ? (length * 100).toFixed(1) + "%" : length / BI.pixRatio + BI.pixUnit;
@ -84,8 +84,8 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
}
this._handleGap(w, item, i);
if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
var top = o.innerVgap + o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.innerVgap + o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
var top = o.innerVgap + o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item),
bottom = o.innerVgap + o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item);
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 + ")");
}

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

@ -53,8 +53,8 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
}
w.element.css({
position: "absolute",
top: self._optimiseGap((item.vgap || 0) + (item.tgap || 0) + o.innerVgap + o.vgap + o.tgap),
bottom: self._optimiseGap((item.bgap || 0) + (item.vgap || 0) + o.innerVgap + o.vgap + o.bgap),
top: self._optimiseGap(self._optimiseItemTgap(item) + self._optimiseItemVgap(item) + o.innerVgap + o.vgap + o.tgap),
bottom: self._optimiseGap(self._optimiseItemBgap(item) + self._optimiseItemVgap(item) + o.innerVgap + o.vgap + o.bgap),
width: BI.isNumber(columnSize) ? self._optimiseGap(columnSize) : ""
});
if (o.verticalAlign === BI.VerticalAlign.Middle) {
@ -86,10 +86,10 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
}
if (BI.isNull(left[i])) {
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;
left[i] = left[i - 1] + preColumnSize + self._optimiseItemLgap(items[i - 1]) + self._optimiseItemRgap(items[i - 1]) + 2 * self._optimiseItemHgap(items[i - 1]) + o.hgap + o.lgap + o.rgap;
}
w.element.css({
left: self._optimiseGap(left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap)
left: self._optimiseGap(left[i] + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) + o.hgap + o.lgap)
});
if (columnSize === "" || columnSize === "fill") {
@ -104,10 +104,10 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (BI.isNull(right[i])) {
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;
right[i] = right[i + 1] + nextColumnSize + self._optimiseItemLgap(items[i + 1]) + self._optimiseItemRgap(items[i + 1]) + 2 * self._optimiseItemHgap(items[i + 1]) + o.hgap + o.lgap + o.rgap;
}
w.element.css({
right: self._optimiseGap(right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap)
right: self._optimiseGap(right[i] + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) + o.hgap + o.rgap)
});
if (columnSize === "" || columnSize === "fill") {
@ -178,8 +178,8 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
}
w.element.css({
position: "absolute",
left: self._optimiseGap((item.lgap || 0) + (item.hgap || 0) + o.innerHgap + o.hgap + o.lgap),
right: self._optimiseGap((item.hgap || 0) + (item.rgap || 0) + o.innerHgap + o.hgap + o.rgap),
left: self._optimiseGap(self._optimiseItemLgap(item) + self._optimiseItemHgap(item) + o.innerHgap + o.hgap + o.lgap),
right: self._optimiseGap(self._optimiseItemRgap(item) + self._optimiseItemHgap(item) + o.innerHgap + o.hgap + o.rgap),
height: BI.isNumber(rowSize) ? self._optimiseGap(rowSize) : ""
});
if (o.horizontalAlign === BI.HorizontalAlign.Center) {
@ -211,10 +211,10 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
}
if (BI.isNull(top[i])) {
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;
top[i] = top[i - 1] + preRowSize + self._optimiseItemTgap(items[i - 1]) + self._optimiseItemBgap(items[i - 1]) + 2 * self._optimiseItemVgap(items[i - 1]) + o.vgap + o.tgap + o.bgap;
}
w.element.css({
top: self._optimiseGap(top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap)
top: self._optimiseGap(top[i] + self._optimiseItemTgap(item) + self._optimiseItemVgap(item) + o.vgap + o.tgap)
});
if (rowSize === "" || rowSize === "fill") {
@ -229,10 +229,10 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height;
if (BI.isNull(bottom[i])) {
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;
bottom[i] = bottom[i + 1] + nextRowSize + self._optimiseItemTgap(items[i + 1]) + self._optimiseItemBgap(items[i + 1]) + 2 * self._optimiseItemVgap(items[i + 1]) + o.vgap + o.tgap + o.bgap;
}
w.element.css({
bottom: self._optimiseGap(bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap)
bottom: self._optimiseGap(bottom[i] + self._optimiseItemBgap(item) + self._optimiseItemVgap(item) + o.vgap + o.bgap)
});
if (rowSize === "" || rowSize === "fill") {

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

@ -92,8 +92,8 @@ BI.TdLayout = BI.inherit(BI.Layout, {
for (var i = 0; i < arr.length; i++) {
var w = BI._lazyCreateWidget(arr[i]);
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);
var top = o.vgap + o.tgap + this._optimiseItemTgap(arr[i]) + this._optimiseItemVgap(arr[i]),
bottom = o.vgap + o.bgap + this._optimiseItemBgap(arr[i]) + this._optimiseItemVgap(arr[i]);
w.element.css("height", "calc(100% - " + this._optimiseGap(top + bottom) + ")");
}
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});

3
src/core/wrapper/layout/sticky/sticky.horizontal.js

@ -5,7 +5,8 @@ BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, {
props: function () {
return BI.extend(BI.HorizontalStickyLayout.superclass.props.apply(this, arguments), {
extraCls: "bi-h-sticky",
horizontalAlign: BI.HorizontalAlign.Stretch,
scrollx: true,
// horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch
});
},

3
src/core/wrapper/layout/sticky/sticky.vertical.js

@ -5,8 +5,9 @@ BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, {
props: function () {
return BI.extend(BI.VerticalStickyLayout.superclass.props.apply(this, arguments), {
extraCls: "bi-v-sticky",
scrolly: true,
horizontalAlign: BI.HorizontalAlign.Stretch,
verticalAlign: BI.VerticalAlign.Stretch
// verticalAlign: BI.VerticalAlign.Stretch
});
},

4
src/less/base/colorchooser/colorchooser.trigger.less

@ -1,9 +1,5 @@
@import "../../index.less";
.bi-color-chooser-trigger {
.border-radius(2px);
}
.bi-combo-popup {
&>.bi-color-chooser-trigger {
border-color: @color-bi-border-hover-combo;

35
src/less/base/combo/combo.less

@ -1,4 +1,5 @@
@import "../../index.less";
@val: transform .3s ease;
.bi-combo {
& > .bi-trigger {
@ -9,9 +10,11 @@
}
}
}
&.bi-combo-popup {
display: block !important;
visibility: visible !important;
& > .bi-trigger {
& .bi-trigger-icon-button {
& .x-icon {
@ -21,11 +24,13 @@
}
}
}
&.bi-combo-popup, &.bi-combo-hover, &:hover {
&.bi-border, &.bi-border-bottom {
border-color: @color-bi-border-hover-combo;
}
}
&.disabled {
&.bi-combo-hover, &:hover {
&.bi-border, &.bi-border-bottom {
@ -33,6 +38,36 @@
}
}
}
&.error {
&.bi-combo-hover, &:hover {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
}
}
// 将来统一变成combo的特性
//&.status-error {
// &.bi-border, &.bi-border-bottom {
// border-color: @border-color-negative;
// }
//
// .bi-trigger .select-text-label {
// color: @color-bi-text-error-text-trigger;
// }
//}
//
//&.status-warning {
// &.bi-border, &.bi-border-bottom {
// border-color: @border-color-warning;
// }
//
// .bi-trigger .select-text-label {
// color: @font-color-warning;
// }
//}
}
.bi-theme-dark {

22
src/less/base/combo/combo.searchtextvalue.less

@ -1,33 +1,19 @@
@import "../../index.less";
@val: transform .3s ease;
.bi-search-text-value-combo {
& .trigger-icon-button {
font-size: 16px;
}
& .search-text-value-trigger{
.border-radius(2px);
}
&.combo-error {
& .bi-search-text-value-trigger {
& .bi-text-button {
color: @color-bi-text-error-hover-search-text-value-combo;
}
}
&>.bi-border, &>.bi-border-bottom {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
}
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
}
}
& .bi-combo + .bi-trigger-icon-button {
& .x-icon {
.rotate(0deg);
.transition(@val);
}
}
}

14
src/less/base/combo/combo.textvalue.less

@ -1,14 +0,0 @@
@import "../../index.less";
.bi-text-value-combo {
&.combo-error {
& .bi-select-text-trigger {
& .select-text-label {
color: @color-bi-text-error-hover-text-value-combo;
}
}
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
}
}

1
src/less/base/editor/editor.search.less

@ -1,7 +1,6 @@
@import "../../index.less";
/*************BI.SearchEditor******************/
.bi-search-editor {
.border-radius(2px);
& .circle-close-font{
font-size: @font-size-18;
}

72
src/less/base/single/button/button.less

@ -41,6 +41,22 @@ body .bi-button, #body .bi-button {
&, & .b-font:before {
color: @color-bi-text-common-button;
}
&.light {
border-width: 0;
background-color: @color-bi-background-common-light-button;
&, & .b-font:before {
color: @color-bi-text-common-light-button;
}
&:hover, &:focus {
background-color: @color-bi-background-hover-common-light-button;
}
&.active {
background-color: @color-bi-background-active-common-light-button;
}
}
&.clear, &.clear .b-font:before {
color: @color-bi-text-common-clear-button;
}
@ -48,7 +64,7 @@ body .bi-button, #body .bi-button {
&, & .b-font:before {
color: @color-bi-text-common-ghost-button;
}
&:hover, &:focus {
&:hover, &:focus, &:hover .b-font:before, &:focus .b-font:before {
color: @color-bi-text;
background-color: @color-bi-background-hover-common-ghost-button;
}
@ -92,6 +108,22 @@ body .bi-button, #body .bi-button {
background-color: @color-bi-background-success-button;
border-color: @color-bi-border-success-button;
}
&.light {
border-width: 0;
background-color: @color-bi-background-success-light-button;
&, & .b-font:before {
color: @color-bi-text-success-light-button;
}
&:hover, &:focus {
background-color: @color-bi-background-hover-success-light-button;
}
&.active {
background-color: @color-bi-background-active-success-light-button;
}
}
&.clear {
&, & .b-font:before {
color: @color-bi-text-success-clear-button;
@ -104,7 +136,7 @@ body .bi-button, #body .bi-button {
color: @color-bi-text-success-ghost-button;
}
background-color: transparent;
&:hover, &:focus {
&:hover, &:focus, &:hover .b-font:before, &:focus .b-font:before {
color: @color-bi-text;
background-color: @color-bi-background-success-button;
}
@ -121,6 +153,22 @@ body .bi-button, #body .bi-button {
background-color: @color-bi-background-warning-button;
border-color: @color-bi-border-warning-button;
}
&.light {
border-width: 0;
background-color: @color-bi-background-warning-light-button;
&, & .b-font:before {
color: @color-bi-text-warning-light-button;
}
&:hover, &:focus {
background-color: @color-bi-background-hover-warning-light-button;
}
&.active {
background-color: @color-bi-background-active-warning-light-button;
}
}
&.clear {
&, & .b-font:before {
color: @color-bi-text-warning-clear-button;
@ -133,7 +181,7 @@ body .bi-button, #body .bi-button {
color: @color-bi-text-warning-ghost-button;
}
background-color: transparent;
&:hover, &:focus {
&:hover, &:focus, &:hover .b-font:before, &:focus .b-font:before {
color: @color-bi-text;
background-color: @color-bi-background-warning-button;
}
@ -150,6 +198,22 @@ body .bi-button, #body .bi-button {
background-color: @color-bi-background-error-button;
border-color: @color-bi-border-error-button;
}
&.light {
border-width: 0;
background-color: @color-bi-background-error-light-button;
&, & .b-font:before {
color: @color-bi-text-error-light-button;
}
&:hover, &:focus {
background-color: @color-bi-background-hover-error-light-button;
}
&.active {
background-color: @color-bi-background-active-error-light-button;
}
}
&.clear {
&, & .b-font:before {
color: @color-bi-text-error-clear-button;
@ -162,7 +226,7 @@ body .bi-button, #body .bi-button {
color: @color-bi-text-error-ghost-button;
}
background-color: transparent;
&:hover, &:focus {
&:hover, &:focus, &:hover .b-font:before, &:focus .b-font:before {
color: @color-bi-text;
background-color: @color-bi-background-error-button;
}

8
src/less/base/single/tip/tip.toast.less

@ -4,18 +4,24 @@
color: @color-bi-color-toast-text;
line-height: @font-size-16;
.border-radius(2px);
.box-shadow(0 6px 20px -2px, @color-bi-color-toast-shadow);
&.toast-success {
background: @color-bi-background-toast-success;
}
&.toast-warning {
background: @color-bi-background-toast-warning;
}
&.toast-error {
background: @color-bi-background-toast-error;
}
&.toast-normal, &.toast-common{
&.toast-normal, &.toast-common, &.toast-loading {
background: @color-bi-background-toast-normal;
}
& .toast-icon {
font-size: @font-size-16;
}

44
src/less/base/tree/tree.expander.less

@ -1,28 +1,42 @@
@import "../../index.less";
@import "../../image.less";
@import "../../lib/icon.less";
.bi-tree-expander-popup.line:before {
.bi-tree-expander-popup.line {
&:before {
border-left: 1px dashed @border-color-dark-gray-line;
position: absolute;
content: "";
height: 100%;
width: 24px;
.imagePath(@icon-tree-vertical-line-1, 0, 0, repeat-y);
left: -1px;
}
.bi-tree-expander-popup.line.solid:before {
.imagePath(@icon-tree-solid-vertical-line-1, 0, 0, repeat-y);
width: 24px;
left: 8px;
&.solid:before {
border-left: 1px solid @border-color-dark-gray-line;
position: absolute;
content: "";
height: 100%;
left: -1px;
}
}
.bi-theme-dark {
.bi-tree-expander-popup.line:before {
width: 24px;
.imagePath(@icon-tree-vertical-line-1-theme-dark, 0, 0, repeat-y);
.bi-tree-expander-popup.line {
&:before {
border-left: 1px dashed @border-color-dark-gray-line-theme-dark;
position: absolute;
content: "";
height: 100%;
left: -1px;
}
&.solid:before {
border-left: 1px solid @border-color-dark-gray-line-theme-dark;
position: absolute;
content: "";
height: 100%;
left: -1px;
}
.bi-tree-expander-popup.line.solid:before {
.imagePath(@icon-tree-solid-vertical-line-1-theme-dark, 0, 0, repeat-y);
width: 24px;
left: 8px;
}
}

15
src/less/base/trigger/trigger.searchtextvalue.less

@ -0,0 +1,15 @@
@import "../../index.less";
.bi-search-text-value-trigger {
&.error .select-text-label {
color: @color-bi-text-error-text-trigger;
}
.clear-button {
display: none;
}
&:hover .clear-button {
display: block;
}
}

15
src/less/base/trigger/trigger.text.less

@ -0,0 +1,15 @@
@import "../../index.less";
.bi-text-trigger {
&.error .select-text-label {
color: @color-bi-text-error-text-trigger;
}
.clear-button {
display: none;
}
&:hover .clear-button {
display: block;
}
}

20
src/less/core/utils/common.less

@ -175,6 +175,18 @@
}
}
.bi-theme-dark {
.bi-tips {
color: @color-bi-text-tips-theme-dark;
& .bi-input {
color: @color-bi-text-tips-theme-dark;;
}
& .bi-textarea {
color: @color-bi-text-tips-theme-dark;
}
}
}
// 边框
.bi-border {
border: 1px solid @color-bi-border-line;
@ -339,6 +351,14 @@
.border-radius(2px);
}
.bi-border-corner-left-radius {
.border-corner-left-radius(2px, 2px);
}
.bi-border-corner-right-radius {
.border-corner-right-radius(2px, 2px);
}
.bi-font-bold {
font-weight: 700;
}

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

@ -169,7 +169,10 @@
}
> .f-f {
min-width: 0;
&:not(.f-s-n) {
min-width: 1px;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;
@ -180,4 +183,10 @@
-ms-flex-shrink: 1;
flex-shrink: 1;
}
> .f-auto {
&:not(.f-s-n) {
min-width: 1px;
}
}
}

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

@ -168,7 +168,10 @@
}
> .f-f {
min-height: 0;
&:not(.f-s-n) {
min-height: 1px;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;
@ -179,4 +182,10 @@
-ms-flex-shrink: 1;
flex-shrink: 1;
}
> .f-auto {
&:not(.f-s-n) {
min-width: 1px;
}
}
}

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

@ -265,7 +265,10 @@
}
> .f-f {
min-width: 0;
&:not(.f-s-n) {
min-width: 1px;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;
@ -276,5 +279,11 @@
-ms-flex-shrink: 1;
flex-shrink: 1;
}
> .f-auto {
&:not(.f-s-n) {
min-width: 1px;
}
}
}
}

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

@ -259,7 +259,10 @@
}
> .f-f {
min-height: 0;
&:not(.f-s-n) {
min-height: 1px;
}
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-grow: 1;
@ -270,5 +273,11 @@
-ms-flex-shrink: 1;
flex-shrink: 1;
}
> .f-auto {
&:not(.f-s-n) {
min-width: 1px;
}
}
}
}

4
src/less/lib/colors.less

@ -34,6 +34,7 @@
@color-bi-text-success: @font-color-success;
//失败字体颜色
@color-bi-text-failure: @font-color-negative;
//基本提亮颜色
@color-bi-text-highlight: @font-color-highlight;
//标红色
@ -98,6 +99,9 @@
@color-bi-background-highlight: @background-color-highlight;
//背景提亮色(浅)
@color-bi-background-light-highlight: @background-color-light-highlight;
// 浅蓝色的背景
@color-bi-background-light-blue: @color-blue-10;
//黑色边框色
@color-bi-border-black: @border-color-black;

1
src/less/lib/font.less

@ -51,6 +51,7 @@
@font-tip-success: "e1db";
@font-tip-warning: "e1d7";
@font-tip-message: "e1d9";
@font-tip-loading: "e7cd";
@font-key: "e1d0";

24
src/less/lib/theme.less

@ -32,6 +32,7 @@
@color-bi-color-toast-error: @color-bi-text;
@color-bi-color-toast-normal: @color-bi-text;
@color-bi-color-toast-text: @color-bi-text;
@color-bi-color-toast-shadow: @color-bi-background-black;
//bubble
@color-bi-background-bubble-success: @color-bi-background-light-success;
@ -72,6 +73,12 @@
@color-bi-background-hover-common-ghost-button: @color-bi-background-highlight;
@color-bi-text-hover-common-ghost-button-theme-dark: @color-bi-text-normal;
@color-bi-background-hover-common-ghost-button-theme-dark: @color-bi-background-default;
@color-bi-text-common-light-button: @color-bi-text-highlight;
@color-bi-background-common-light-button: @color-bi-background-light-blue;
@color-bi-background-hover-common-light-button: @color-bi-background-light-blue;
@color-bi-background-active-common-light-button: @color-bi-background-light-blue;
@color-bi-background-active-common-ghost-button: @color-bi-background-highlight;
@color-bi-background-active-common-ghost-button-theme-dark: @color-bi-background-default;
@color-bi-text-ignore-button: @color-bi-text-highlight;
@ -80,18 +87,34 @@
@color-bi-background-ignore-button-theme-dark: @color-bi-background-default-theme-dark;
@color-bi-background-hover-ignore-button-theme-dark: @color-blue-10;
@color-bi-background-active-ignore-button-theme-dark: @color-blue-10;
@color-bi-text-success-button: @color-bi-text;
@color-bi-background-success-button: @color-bi-background-success;
@color-bi-border-success-button: @color-bi-border-success;
@color-bi-text-success-clear-button: @color-bi-text-success;
@color-bi-text-success-ghost-button: @color-bi-text-success;
@color-bi-text-success-light-button: @color-bi-text-success;
@color-bi-background-success-light-button: @color-bi-background-light-success;
@color-bi-background-hover-success-light-button: @color-bi-background-light-success;
@color-bi-background-active-success-light-button: @color-bi-background-light-success;
@color-bi-text-warning-button: @color-bi-text;
@color-bi-text-warning-light-button: @color-bi-text-redmark;
@color-bi-background-warning-light-button: @color-bi-background-light-warning;
@color-bi-background-hover-warning-light-button: @color-bi-background-light-warning;
@color-bi-background-active-warning-light-button: @color-bi-background-light-warning;
@color-bi-background-warning-button: @color-bi-background-warning;
@color-bi-border-warning-button: @color-bi-border-warning;
@color-bi-text-warning-clear-button: @color-bi-text-redmark;
@color-bi-text-warning-ghost-button: @color-bi-text-redmark;
@color-bi-text-error-button: @color-bi-text;
@color-bi-background-error-light-button: @color-bi-background-light-failure;
@color-bi-background-error-button: @color-bi-background-failure;
@color-bi-text-error-light-button: @color-bi-text-failure;
@color-bi-background-hover-error-light-button: @color-bi-background-light-failure;
@color-bi-background-active-error-light-button: @color-bi-background-light-failure;
@color-bi-border-error-button: @color-bi-border-failure;
@color-bi-text-error-clear-button: @color-bi-text-failure;
@color-bi-text-error-ghost-button: @color-bi-text-failure;
@ -179,6 +202,7 @@
@color-bi-border-hover-text-value-down-list-combo: @color-bi-border-highlight;
@color-bi-border-hover-text-value-check-combo: @color-bi-border-highlight;
@color-bi-text-error-hover-text-value-combo: @color-bi-text-failure;
@color-bi-text-error-text-trigger: @color-bi-text-failure;
@color-bi-text-error-hover-text-value-icon-combo: @color-bi-text-failure;
@color-bi-text-error-hover-search-text-value-combo: @color-bi-text-failure;
@color-bi-background-bubble-combo-triangle: @color-bi-background-default;

1
src/less/resource/font.less

@ -86,6 +86,7 @@
.font(toast-success-font, @font-tip-success, @color-bi-color-toast-success);
.font(toast-warning-font, @font-tip-warning, @color-bi-color-toast-warning);
.font(toast-message-font, @font-tip-message, @color-bi-color-toast-normal);
.font(toast-loading-font, @font-tip-loading, @color-bi-color-toast-normal);
//数值区间
.font(less-font, @font-less);

28
src/less/widget/multilayerselecttree/multilayerselecttree.combo.less

@ -1,20 +1,24 @@
@import "../../index.less";
@val: transform .3s ease;
.bi-multilayer-select-tree-combo {
& .trigger-icon-button{
font-size: @font-size-16;
&.status-error {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
.bi-trigger .select-text-label, .tip-text-style {
color: @color-bi-text-error-text-trigger;
}
}
& .bi-combo + .bi-trigger-icon-button {
& .x-icon {
.rotate(0deg);
.transition(@val);
&.status-warning {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-warning;
}
.bi-trigger .select-text-label {
color: @font-color-warning;
}
}
}

27
src/less/widget/multilayersingletree/multilayersingletree.combo.less

@ -1,20 +1,23 @@
@import "../../index.less";
@val: transform .3s ease;
.bi-multilayer-single-tree-combo {
& .trigger-icon-button{
font-size: @font-size-16;
&.status-error {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
.bi-trigger .select-text-label, .tip-text-style {
color: @color-bi-text-error-text-trigger;
}
}
& .bi-combo + .bi-trigger-icon-button {
& .x-icon {
.rotate(0deg);
.transition(@val);
&.status-warning {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-warning;
}
.bi-trigger .select-text-label {
color: @font-color-warning;
}
}
}

1
src/less/widget/numbereditor/number.editor.less

@ -1,7 +1,6 @@
@import "../../index.less";
.bi-number-editor {
.border-radius(2px);
& .pull-down-font {
font-size: @font-size-12;
}

8
src/less/widget/numberinterval/numberinterval.less

@ -4,14 +4,7 @@
&.hack {
.border-radius(0px);
}
& .number-interval-small-editor {
.border-corner-left-radius(2px, 2px);
}
& .number-interval-big-editor {
.border-corner-right-radius(2px, 2px);
}
& .number-interval-big-combo {
.border-corner-left-radius(2px, 2px);
& .bi-icon-combo-trigger {
& .icon-combo-trigger-icon {
font-size: @font-size-14;
@ -20,7 +13,6 @@
}
& .number-interval-small-combo {
.border-corner-right-radius(2px, 2px);
& .bi-icon-combo-trigger {
& .icon-combo-trigger-icon {
font-size: @font-size-14;

2
src/less/widget/year/trigger.year.less

@ -1,4 +1,4 @@
@import "../../index.less";
.bi-year-trigger{
.border-radius(2px);
}

4
src/router/router.js

@ -3130,6 +3130,7 @@
routes: this.options.routes,
base: this.options.base,
});
Fix.defineReactiveProperty(BI.Router.$router.history, "current");
this.$router.beforeEach(function (to, from, next) {
if (to.matched.length === 0) {
//如果上级也未匹配到路由则跳转主页面,如果上级能匹配到则转上级路由
@ -3193,7 +3194,8 @@
};
},
destroyed: function () {
BI.remove(cbs, this._callbackListener);
// BI.remove方法会把第二个参数当迭代器执行导致方法多执行一遍
cbs.splice(cbs.indexOf(this._callbackListener), 1);
}
});
BI.shortcut("bi.router_view", BI.RouterView);

60
src/widget/downlist/combo.downlist.js

@ -14,41 +14,27 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
stopPropagation: false,
el: {},
minWidth: 140,
maxHeight: 1000
maxHeight: 1000,
destroyWhenHide: false
});
},
_init: function () {
BI.DownListCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popupview = BI.createWidget({
type: "bi.down_list_popup",
items: o.items,
chooseType: o.chooseType,
value: o.value
});
this.popupview.on(BI.DownListPopup.EVENT_CHANGE, function (value) {
self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value);
self.downlistcombo.hideView();
});
this.popupview.on(BI.DownListPopup.EVENT_SON_VALUE_CHANGE, function (value, fatherValue) {
self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue);
self.downlistcombo.hideView();
});
this.downlistcombo = BI.createWidget({
element: this,
type: "bi.combo",
trigger: o.trigger,
isNeedAdjustWidth: false,
isDefaultInit: true,
container: o.container,
adjustLength: o.adjustLength,
direction: o.direction,
belowMouse: o.belowMouse,
stopPropagation: o.stopPropagation,
destroyWhenHide: o.destroyWhenHide,
el: BI.createWidget(o.el, {
type: "bi.icon_trigger",
extraCls: o.iconCls,
@ -56,7 +42,28 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
height: o.height
}),
popup: {
el: this.popupview,
el: {
type: "bi.down_list_popup",
ref: function (ref) {
self.popupView = ref;
},
items: o.items,
chooseType: o.chooseType,
value: o.value,
listeners: [{
eventName: BI.DownListPopup.EVENT_CHANGE,
action: function (value) {
self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value);
self.downlistcombo.hideView();
}
}, {
eventName: BI.DownListPopup.EVENT_SON_VALUE_CHANGE,
action: function (value, fatherValue) {
self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue);
self.downlistcombo.hideView();
}
}]
},
stopPropagation: o.stopPropagation,
maxHeight: o.maxHeight,
minWidth: o.minWidth
@ -77,14 +84,23 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
},
populate: function (items) {
this.popupview.populate(items);
this.popupView.populate(items);
},
setValue: function (v) {
this.popupview.setValue(v);
this.popupView.setValue(v);
},
getValue: function () {
return this.popupview.getValue();
return this.popupView.getValue();
},
adjustWidth: function () {
this.downlistcombo.adjustWidth();
},
adjustHeight: function () {
this.downlistcombo.adjustHeight();
}
});
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save