Browse Source

Merge pull request #83064 in DEC/fineui from final/11.0 to persist/11.0

* commit '13bd30b321df8e81a82932d8c42bd22c8485b518': (232 commits)
  Update src/less/lib/constant.less
  chore: 去掉ie6-8字体支持
  REPORT-73699 fix: 允许编辑时外部传递进来的text可能是一个方法
  无JIRA 修改配置
  auto upgrade version to 2.0.20220617213406
  无JIRA 同步
  无JIRA任务 simple
  auto upgrade version to 2.0.20220617172333
  无JIRA 同步
  auto upgrade version to 2.0.20220617145310
  无JIRA 同步
  无JIRA任务 暗色系popover头背景
  auto upgrade version to 2.0.20220617120359
  auto upgrade version to 2.0.20220617115451
  auto upgrade version to 2.0.20220617114413
  DESIGN-3918 feat: 拓展box-shadow,允许配置常量一样自定义个阴影效果
  无JIRA 同步
  无JIRA任务 同步lessconfig
  auto upgrade version to 2.0.20220616223849
  无JIRA任务 simple
  ...
research/test
superman 2 years ago
parent
commit
1b7c9d8815
  1. 24
      bi.lessconfig.json
  2. 15
      changelog.md
  3. 98
      demo/js/base/button/demo.button.js
  4. 244
      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. 182
      src/base/grid/grid.js
  13. 5
      src/base/list/virtualgrouplist.js
  14. 351
      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. 45
      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. 3
      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. 166
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  43. 81
      src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js
  44. 53
      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. 11
      src/case/editor/editor.sign.js
  49. 7
      src/case/layer/panel.js
  50. 4
      src/case/tree/treeexpander/tree.expander.popup.js
  51. 4
      src/case/trigger/trigger.editor.js
  52. 70
      src/case/trigger/trigger.text.js
  53. 32
      src/case/trigger/trigger.text.select.js
  54. 34
      src/case/ztree/0.treeview.js
  55. 25
      src/case/ztree/1.asynctree.js
  56. 19
      src/core/platform/web/config.js
  57. 11
      src/core/system.js
  58. 71
      src/core/wrapper/layout.js
  59. 8
      src/core/wrapper/layout/adapt/absolute.center.js
  60. 34
      src/core/wrapper/layout/adapt/absolute.leftrightvertical.js
  61. 4
      src/core/wrapper/layout/adapt/adapt.table.js
  62. 8
      src/core/wrapper/layout/fill/auto.vtape.js
  63. 28
      src/core/wrapper/layout/fill/float.fill.horizontal.js
  64. 3
      src/core/wrapper/layout/flex/flex.horizontal.js
  65. 26
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  66. 3
      src/core/wrapper/layout/flex/flex.vertical.js
  67. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  68. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  69. 18
      src/core/wrapper/layout/float/float.absolute.leftrightvertical.js
  70. 36
      src/core/wrapper/layout/layout.flow.js
  71. 8
      src/core/wrapper/layout/layout.inline.js
  72. 24
      src/core/wrapper/layout/layout.tape.js
  73. 4
      src/core/wrapper/layout/layout.td.js
  74. 3
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  75. 3
      src/core/wrapper/layout/sticky/sticky.vertical.js
  76. 4
      src/less/base/colorchooser/colorchooser.trigger.less
  77. 39
      src/less/base/combo/combo.less
  78. 28
      src/less/base/combo/combo.searchtextvalue.less
  79. 14
      src/less/base/combo/combo.textvalue.less
  80. 1
      src/less/base/editor/editor.search.less
  81. 72
      src/less/base/single/button/button.less
  82. 18
      src/less/base/single/tip/tip.toast.less
  83. 48
      src/less/base/tree/tree.expander.less
  84. 15
      src/less/base/trigger/trigger.searchtextvalue.less
  85. 15
      src/less/base/trigger/trigger.text.less
  86. 20
      src/less/core/utils/common.less
  87. 11
      src/less/core/wrapper/flex.horizontal.less
  88. 11
      src/less/core/wrapper/flex.vertical.less
  89. 11
      src/less/core/wrapper/flex.wrapper.horizontal.less
  90. 11
      src/less/core/wrapper/flex.wrapper.vertical.less
  91. 2
      src/less/image.less
  92. 4
      src/less/lib/colors.less
  93. 3
      src/less/lib/constant.less
  94. 1
      src/less/lib/font.less
  95. 23
      src/less/lib/theme.less
  96. 1
      src/less/resource/font.less
  97. 9
      src/less/theme/dark.less
  98. 32
      src/less/visual.less
  99. 30
      src/less/widget/multilayerselecttree/multilayerselecttree.combo.less
  100. 29
      src/less/widget/multilayersingletree/multilayersingletree.combo.less
  101. Some files were not shown because too many files have changed in this diff Show More

24
bi.lessconfig.json

@ -4,21 +4,29 @@
"@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-normal": "#091E40",
"@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)",
"@background-color-normal": "#F8F9FC",
"@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-border-tooltip-success": "#2E3A4D",
"@color-bi-background-toast-success": "#FFFFFF",
"@color-bi-background-toast-warning": "#FFFFFF",
@ -28,5 +36,7 @@
"@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-text-header-background": "rgba(9, 30, 64, 0.9)",
"@color-bi-text-header-background-theme-dark": "rgba(255, 255, 255, 0.9)"
}

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)
- 提供自定义表单

98
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 () {
@ -228,4 +324,4 @@ Demo.Button = BI.inherit(BI.Widget, {
};
}
});
BI.shortcut("demo.button", Demo.Button);
BI.shortcut("demo.button", Demo.Button);

244
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) {
@ -135,8 +96,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
setImmediate(nextTickHandler);
};
} else if (typeof MessageChannel !== 'undefined' && (isNative(MessageChannel) ||
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]')) {
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]')) {
var channel = new MessageChannel();
var port = channel.port2;
channel.port1.onmessage = nextTickHandler;
@ -145,18 +106,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
};
} else
/* istanbul ignore next */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
// use microtask in non-DOM environments, e.g. Weex
var p = Promise.resolve();
timerFunc = function timerFunc() {
p.then(nextTickHandler);
};
} else {
// fallback to setTimeout
timerFunc = function timerFunc() {
setTimeout(nextTickHandler, 0);
};
}
if (typeof Promise !== 'undefined' && isNative(Promise)) {
// use microtask in non-DOM environments, e.g. Weex
var p = Promise.resolve();
timerFunc = function timerFunc() {
p.then(nextTickHandler);
};
} else {
// fallback to setTimeout
timerFunc = function timerFunc() {
setTimeout(nextTickHandler, 0);
};
}
return function queueNextTick(cb, ctx) {
var _resolve = void 0;
@ -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;
@ -538,10 +428,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
if (this.active) {
var value = this.get();
if (value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
_.isObject(value) && options && options.refresh || this.deep) {
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
_.isObject(value) && options && options.refresh || this.deep) {
// set new value
var oldValue = this.value;
this.value = value;
@ -700,11 +590,7 @@ 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);
}
def(this.model, "__ob__", this);
}
Observer.prototype.walk = function walk(obj) {
@ -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.20220617213406",
"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);

182
src/base/grid/grid.js

@ -130,99 +130,99 @@ 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 horizontalOffsetAdjustment = this._columnSizeAndPositionManager.getOffsetAdjustment(width, scrollLeft);
var verticalOffsetAdjustment = this._rowSizeAndPositionManager.getOffsetAdjustment(height, scrollTop);
this._renderedColumnStartIndex = visibleColumnIndices.start;
this._renderedColumnStopIndex = visibleColumnIndices.stop;
this._renderedRowStartIndex = visibleRowIndices.start;
this._renderedRowStopIndex = visibleRowIndices.stop;
var overscanColumnIndices = this._getOverscanIndices(this.columnCount, overscanColumnCount, this._renderedColumnStartIndex, this._renderedColumnStopIndex);
var overscanRowIndices = this._getOverscanIndices(this.rowCount, overscanRowCount, this._renderedRowStartIndex, this._renderedRowStopIndex);
var columnStartIndex = overscanColumnIndices.overscanStartIndex;
var columnStopIndex = overscanColumnIndices.overscanStopIndex;
var rowStartIndex = overscanRowIndices.overscanStartIndex;
var rowStopIndex = overscanRowIndices.overscanStopIndex;
// 算区间size
var minRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStartIndex);
var minColumnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnStartIndex);
var maxRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStopIndex);
var maxColumnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnStopIndex);
var top = minRowDatum.offset + verticalOffsetAdjustment;
var left = minColumnDatum.offset + horizontalOffsetAdjustment;
var bottom = maxRowDatum.offset + verticalOffsetAdjustment + maxRowDatum.size;
var right = maxColumnDatum.offset + horizontalOffsetAdjustment + maxColumnDatum.size;
// 如果滚动的区间并没有超出渲染的范围
if (top >= this.renderRange.minY && bottom <= this.renderRange.maxY && left >= this.renderRange.minX && right <= this.renderRange.maxX) {
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++) {
var rowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex);
for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
var key = rowIndex + "-" + columnIndex;
var columnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex);
var index = this.renderedKeys[key] && this.renderedKeys[key][2];
var child;
if (index >= 0) {
// if (columnDatum.size !== this.renderedCells[index]._width) {
// this.renderedCells[index]._width = columnDatum.size;
this.renderedCells[index].el.setWidth(columnDatum.size);
// }
// if (rowDatum.size !== this.renderedCells[index]._height) {
// this.renderedCells[index]._height = rowDatum.size;
this.renderedCells[index].el.setHeight(rowDatum.size);
// }
// if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) {
this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
// }
// if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) {
this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
// }
child = this.renderedCells[index].el;
renderedCells.push(this.renderedCells[index]);
} else {
var item = o.itemFormatter(o.items[rowIndex][columnIndex], rowIndex, columnIndex);
child = BI._lazyCreateWidget(BI.extend({
type: "bi.label",
width: columnDatum.size,
height: rowDatum.size
}, item, {
cls: (item.cls || "") + " grid-cell" + (rowIndex === 0 ? " first-row" : "") + (columnIndex === 0 ? " first-col" : ""),
_rowIndex: rowIndex,
_columnIndex: columnIndex,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment
}), this);
renderedCells.push({
el: child,
left: columnDatum.offset + horizontalOffsetAdjustment,
top: rowDatum.offset + verticalOffsetAdjustment,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment
// _width: columnDatum.size,
// _height: rowDatum.size
});
// 没有可见的单元格就干掉所有渲染过的
if (!BI.isEmpty(visibleColumnIndices) && !BI.isEmpty(visibleRowIndices)) {
var horizontalOffsetAdjustment = this._columnSizeAndPositionManager.getOffsetAdjustment(width, scrollLeft);
var verticalOffsetAdjustment = this._rowSizeAndPositionManager.getOffsetAdjustment(height, scrollTop);
this._renderedColumnStartIndex = visibleColumnIndices.start;
this._renderedColumnStopIndex = visibleColumnIndices.stop;
this._renderedRowStartIndex = visibleRowIndices.start;
this._renderedRowStopIndex = visibleRowIndices.stop;
var overscanColumnIndices = this._getOverscanIndices(this.columnCount, overscanColumnCount, this._renderedColumnStartIndex, this._renderedColumnStopIndex);
var overscanRowIndices = this._getOverscanIndices(this.rowCount, overscanRowCount, this._renderedRowStartIndex, this._renderedRowStopIndex);
var columnStartIndex = overscanColumnIndices.overscanStartIndex;
var columnStopIndex = overscanColumnIndices.overscanStopIndex;
var rowStartIndex = overscanRowIndices.overscanStartIndex;
var rowStopIndex = overscanRowIndices.overscanStopIndex;
// 算区间size
var minRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStartIndex);
var minColumnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnStartIndex);
var maxRowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowStopIndex);
var maxColumnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnStopIndex);
var top = minRowDatum.offset + verticalOffsetAdjustment;
var left = minColumnDatum.offset + horizontalOffsetAdjustment;
var bottom = maxRowDatum.offset + verticalOffsetAdjustment + maxRowDatum.size;
var right = maxColumnDatum.offset + horizontalOffsetAdjustment + maxColumnDatum.size;
// 如果滚动的区间并没有超出渲染的范围
if (top >= this.renderRange.minY && bottom <= this.renderRange.maxY && left >= this.renderRange.minX && right <= this.renderRange.maxX) {
return;
}
var minX = this._getMaxScrollLeft(), minY = this._getMaxScrollTop(), maxX = 0, maxY = 0;
var count = 0;
for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
var rowDatum = this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex);
for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
var key = rowIndex + "-" + columnIndex;
var columnDatum = this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex);
var index = this.renderedKeys[key] && this.renderedKeys[key][2];
var child;
if (index >= 0) {
// if (columnDatum.size !== this.renderedCells[index]._width) {
// this.renderedCells[index]._width = columnDatum.size;
this.renderedCells[index].el.setWidth(columnDatum.size);
// }
// if (rowDatum.size !== this.renderedCells[index]._height) {
// this.renderedCells[index]._height = rowDatum.size;
this.renderedCells[index].el.setHeight(rowDatum.size);
// }
// if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) {
this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
// }
// if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) {
this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
// }
child = this.renderedCells[index].el;
renderedCells.push(this.renderedCells[index]);
} else {
var item = o.itemFormatter(o.items[rowIndex][columnIndex], rowIndex, columnIndex);
child = BI._lazyCreateWidget(BI.extend({
type: "bi.label",
width: columnDatum.size,
height: rowDatum.size
}, item, {
cls: (item.cls || "") + " grid-cell" + (rowIndex === 0 ? " first-row" : "") + (columnIndex === 0 ? " first-col" : ""),
_rowIndex: rowIndex,
_columnIndex: columnIndex,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment
}), this);
renderedCells.push({
el: child,
left: columnDatum.offset + horizontalOffsetAdjustment,
top: rowDatum.offset + verticalOffsetAdjustment,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment
// _width: columnDatum.size,
// _height: rowDatum.size
});
}
minX = Math.min(minX, columnDatum.offset + horizontalOffsetAdjustment);
maxX = Math.max(maxX, columnDatum.offset + horizontalOffsetAdjustment + columnDatum.size);
minY = Math.min(minY, rowDatum.offset + verticalOffsetAdjustment);
maxY = Math.max(maxY, rowDatum.offset + verticalOffsetAdjustment + rowDatum.size);
renderedKeys[key] = [rowIndex, columnIndex, count];
renderedWidgets[count] = child;
count++;
}
minX = Math.min(minX, columnDatum.offset + horizontalOffsetAdjustment);
maxX = Math.max(maxX, columnDatum.offset + horizontalOffsetAdjustment + columnDatum.size);
minY = Math.min(minY, rowDatum.offset + verticalOffsetAdjustment);
maxY = Math.max(maxY, rowDatum.offset + verticalOffsetAdjustment + rowDatum.size);
renderedKeys[key] = [rowIndex, columnIndex, count];
renderedWidgets[count] = child;
count++;
}
}
// 已存在的, 需要添加的和需要删除的

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 () {

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

@ -1,169 +1,212 @@
/**
* 文字类型的按钮
* @class BI.Button
* @extends BI.BasicButton
*
* @cfg {JSON} options 配置属性
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景
*/
BI.Button = BI.inherit(BI.BasicButton, {
(function () {
function isVertical(position) {
return position === "top" || position === "bottom";
}
/**
* 文字类型的按钮
* @class BI.Button
* @extends BI.BasicButton
*
* @cfg {JSON} options 配置属性
* @cfg {'common'/'success'/'warning'/'ignore'} [options.level='common'] 按钮类型用不同颜色强调不同的场景
*/
BI.Button = BI.inherit(BI.BasicButton, {
_const: {
iconWidth: 18
},
_const: {
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,
shadow: props.clear !== true,
isShadowShowingOnSelected: true,
readonly: true,
iconCls: "",
level: "common",
block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, // 是否去掉边框和背景
ghost: false, // 是否幽灵显示, 即正常状态无背景
textAlign: "center",
whiteSpace: "nowrap",
textWidth: null,
textHeight: null,
hgap: props.clear ? 0 : 10,
vgap: 0,
tgap: 0,
bgap: 0,
lgap: 0,
rgap: 0
});
},
_defaultConfig: function (props) {
var conf = BI.Button.superclass._defaultConfig.apply(this, arguments);
render: function () {
var o = this.options, self = this;
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,
// 44 = 垂直间距 6 + 边框 2 + 图标 16 + 图标和文字间隔 8 + 文字 12
height: isVertical(props.iconPosition) ? 44 + ((props.iconGap || 8) - 8) : 24,
shadow: props.clear !== true,
isShadowShowingOnSelected: true,
readonly: true,
iconCls: "",
level: "common",
block: false, // 是否块状显示,即不显示边框,没有最小宽度的限制
clear: false, // 是否去掉边框和背景
ghost: false, // 是否幽灵显示, 即正常状态无背景
loading: false, // 是否处于加载中
light: false, // 是否使用浅色
textAlign: "center",
whiteSpace: "nowrap",
textWidth: null,
textHeight: null,
hgap: props.clear ? 0 : 10,
vgap: 0,
tgap: 0,
bgap: 0,
lgap: 0,
rgap: 0,
iconGap: 8,
iconPosition: "left"
});
},
// 由于button默认情况下有个边框,所以要主动算行高
var lineHeight, textHeight = o.textHeight;
if (BI.isNumber(o.height)) {
if (o.clear || o.block) {
lineHeight = o.height;
render: function () {
var o = this.options;
// 由于button默认情况下有个边框,所以要主动算行高
var lineHeight, textHeight = o.textHeight;
if (BI.isNumber(o.height)) {
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") {
textHeight = lineHeight;
}
}
if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({
type: "bi.icon_label",
cls: o.iconCls,
width: this._const.iconWidth,
height: lineHeight,
lineHeight: lineHeight
});
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
textWidth: BI.isNotNull(o.textWidth) ? o.textWidth - this._const.iconWidth : null,
textHeight: textHeight,
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: layoutType,
horizontalAlign: "center",
verticalAlign: "middle",
items: items
}]
});
} else {
lineHeight = o.height - 2;
this.text = BI.createWidget({
type: "bi.label",
height: o.height,
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textWidth: o.textWidth,
textHeight: textHeight,
hgap: o.hgap,
vgap: o.vgap,
tgap: o.tgap,
bgap: o.bgap,
lgap: o.lgap,
rgap: o.rgap,
element: this,
text: o.text,
value: o.value
});
}
}
if (!textHeight) {
if (o.whiteSpace === "nowrap") {
textHeight = lineHeight;
if (o.block === true) {
this.element.addClass("block");
}
}
if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({
type: "bi.icon_label",
cls: o.iconCls,
width: this._const.iconWidth,
height: lineHeight,
lineHeight: lineHeight,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight
});
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
textWidth: BI.isNotNull(o.textWidth) ? o.textWidth - this._const.iconWidth : null,
textHeight: textHeight,
height: lineHeight,
value: o.value
});
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]
}]
});
} else {
this.text = BI.createWidget({
type: "bi.label",
height: o.height,
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textWidth: o.textWidth,
textHeight: textHeight,
hgap: o.hgap,
vgap: o.vgap,
tgap: o.tgap,
bgap: o.bgap,
lgap: o.lgap,
rgap: o.rgap,
element: this,
text: o.text,
value: o.value
});
}
if (o.block === true) {
this.element.addClass("block");
}
if (o.clear === true) {
this.element.addClass("clear");
}
if (o.ghost === true) {
this.element.addClass("ghost");
}
if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit});
}
},
if (o.clear === true) {
this.element.addClass("clear");
}
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});
}
},
doClick: function () {
BI.Button.superclass.doClick.apply(this, arguments);
if (this.isValid()) {
this.fireEvent(BI.Button.EVENT_CHANGE, this);
}
},
doClick: function () {
BI.Button.superclass.doClick.apply(this, arguments);
if (this.isValid()) {
this.fireEvent(BI.Button.EVENT_CHANGE, this);
}
},
_setEnable: function (enable) {
BI.Button.superclass._setEnable.apply(this, arguments);
if (enable === true) {
this.element.attr("tabIndex", 1);
} else if (enable === false) {
this.element.removeAttr("tabIndex");
}
},
_setEnable: function (enable) {
BI.Button.superclass._setEnable.apply(this, arguments);
if (enable === true) {
this.element.attr("tabIndex", 1);
} else if (enable === false) {
this.element.removeAttr("tabIndex");
}
},
setText: function (text) {
BI.Button.superclass.setText.apply(this, arguments);
this.text.setText(text);
},
setLoading: function (loading) {
if (loading) {
this.element.addClass("loading");
} else {
this.element.removeClass("loading");
}
},
setValue: function (text) {
BI.Button.superclass.setValue.apply(this, arguments);
if (!this.isReadOnly()) {
this.text.setValue(text);
}
},
setText: function (text) {
BI.Button.superclass.setText.apply(this, arguments);
this.text.setText(text);
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
setValue: function (text) {
BI.Button.superclass.setValue.apply(this, arguments);
if (!this.isReadOnly()) {
this.text.setValue(text);
}
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
}
});
BI.shortcut("bi.button", BI.Button);
BI.Button.EVENT_CHANGE = "EVENT_CHANGE";
doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments);
},
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
}
});
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);
}
}
}

45
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();
}
}, this));
BI.nextTick(function () {
self._checkValidationOnValueChange(function () {
self._defaultState();
if (self.isValid()) {
self._lastValidValue = self._lastSubmitValue = self.getValue();
}
});
});
},
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;
},

3
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,
@ -61,4 +62,4 @@ BI.SimpleColorChooser = BI.inherit(BI.Widget, {
});
BI.SimpleColorChooser.EVENT_CHANGE = "EVENT_CHANGE";
BI.SimpleColorChooser.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW";
BI.shortcut("bi.simple_color_chooser", BI.SimpleColorChooser);
BI.shortcut("bi.simple_color_chooser", BI.SimpleColorChooser);

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,

166
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,105 +22,86 @@ 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: [{
type: "bi.combo",
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;
},
el: {
type: "bi.search_text_value_trigger",
cls: "search-text-value-trigger",
watermark: o.watermark,
ref: function () {
self.trigger = this;
},
items: o.items,
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()[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: {
el: {
type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-focus-shadow",
container: o.container,
adjustLength: 2,
toggle: false,
type: "bi.text_value_combo_popup",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
value: o.value,
items: o.items,
ref: function () {
self.combo = this;
},
el: {
type: "bi.search_text_value_trigger",
cls: "search-text-value-trigger",
watermark: o.watermark,
ref: function () {
self.trigger = this;
},
items: o.items,
height: o.height - (o.simple ? 1 : 2),
text: o.text,
defaultText: o.defaultText,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.SearchTextValueTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
}]
},
popup: {
el: {
type: "bi.text_value_combo_popup",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
value: o.value,
items: o.items,
ref: function () {
self.popup = this;
self.trigger.getSearcher().setAdapter(self.popup);
},
listeners: [{
eventName: BI.TextValueComboPopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
maxHeight: 252,
minHeight: 25
self.popup = this;
self.trigger.getSearcher().setAdapter(self.popup);
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
eventName: BI.TextValueComboPopup.EVENT_CHANGE,
action: function () {
self.trigger.stopEditing();
}
}, {
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: function () {
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.setValue(this.getValue()[0]);
self.combo.hideView();
} else {
self.combo.showView();
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE);
}
}
}]
},
right: 0,
bottom: 0,
top: 0
}]
value: o.value,
maxHeight: 252,
minHeight: 25
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}, {
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: function () {
self.fireEvent(BI.SearchTextValueCombo.EVENT_BEFORE_POPUPVIEW);
}
}],
};
},
@ -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";

81
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: {
type: "bi.layout",
width: 24
},
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,
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);

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

@ -7,18 +7,19 @@
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,
});
},
_init: function () {
var self = this, o = this.options;
BI.isNumeric(o.width) && (o.width -= 2);
BI.isNumeric(o.height) && (o.height -= 2);
BI.isNumeric(o.width) && (o.width -= (o.simple ? 0 : 2));
BI.isNumeric(o.height) && (o.height -= (o.simple ? 1 : 2));
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
@ -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",
@ -62,28 +73,32 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
minHeight: 25
}
});
if(BI.isKey(o.value)) {
if (BI.isKey(o.value)) {
this._checkError(o.value);
}
},
_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];
var result = BI.find(this.options.items, function (idx, item) {
return BI.contains(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");
v = BI.isArray(v) ? v[0] : v;
var tipType = null;
var result = BI.find(this.options.items, function (idx, item) {
return v === item.value;
});
if (BI.isNull(result)) {
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,

11
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);
},
@ -275,4 +282,4 @@ BI.SignEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.SignEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SignEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.sign_editor", BI.SignEditor);
BI.shortcut("bi.sign_editor", BI.SignEditor);

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",

4
src/case/trigger/trigger.editor.js

@ -6,10 +6,10 @@
* @extends BI.Trigger
*/
BI.EditorTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
_defaultConfig: function (config) {
var conf = BI.EditorTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-editor-trigger bi-border bi-border-radius",
baseCls: (conf.baseCls || "") + " bi-editor-trigger bi-border-radius " + (config.simple ? "bi-border-bottom" : "bi-border"),
height: 24,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,

70
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,32 +41,59 @@ 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,
}
]
});
},
getTextor: function() {
getTextor: function () {
return this.text;
},
setTextCls: function(cls) {
setTextCls: function (cls) {
var o = this.options;
var oldCls = o.textCls;
o.textCls = cls;
@ -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);

32
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,11 +34,21 @@ 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);
}
}
]
});
},
_digest: function(vals, items){
_digest: function (vals, items) {
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
@ -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,10 +84,11 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
},
setTipType: function (v) {
this.options.tipType = v;
this.trigger.setTipType(v);
},
getTextor: function() {
getTextor: function () {
return this.trigger.getTextor();
},
@ -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);

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

@ -110,7 +110,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
};
var className = "dark", perTime = 100;
function onClick (event, treeId, treeNode) {
function onClick(event, treeId, treeNode) {
// 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选
var checked = treeNode.checked;
var status = treeNode.getCheckStatus();
@ -121,7 +121,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
self.nodes.checkNode(treeNode, !checked, true, true);
}
function getUrl (treeId, treeNode) {
function getUrl(treeId, treeNode) {
var parentNode = self._getParentValues(treeNode);
treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id
@ -132,7 +132,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
return "&" + param;
}
function beforeExpand (treeId, treeNode) {
function beforeExpand(treeId, treeNode) {
if (!treeNode.isAjaxing) {
if (!treeNode.children) {
treeNode.times = 1;
@ -147,7 +147,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
function onAsyncSuccess (event, treeId, treeNode, msg) {
function onAsyncSuccess(event, treeId, treeNode, msg) {
treeNode.halfCheck = false;
if (!msg || msg.length === 0 || /^<html>[\s,\S]*<\/html>$/gi.test(msg) || self._stop) {
return;
@ -170,14 +170,14 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
}
function onAsyncError (event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
function onAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
var zTree = self.nodes;
BI.Msg.toast("Error!", "warning");
// treeNode.icon = "";
// zTree.updateNode(treeNode);
}
function ajaxGetNodes (treeNode, reloadType) {
function ajaxGetNodes(treeNode, reloadType) {
var zTree = self.nodes;
if (reloadType == "refresh") {
zTree.updateNode(treeNode); // 刷新一下当前节点,如果treeNode.xxx被改了的话
@ -185,7 +185,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
zTree.reAsyncChildNodes(treeNode, reloadType, true); // 强制加载子节点,reloadType === refresh为先清空再加载,否则为追加到现有子节点之后
}
function beforeCheck (treeId, treeNode) {
function beforeCheck(treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
@ -195,7 +195,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
if (treeNode.checked === true) {
// 将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy
// 所有的半选状态都需要取消halfCheck=true的情况
function track (children) {
function track(children) {
BI.each(children, function (i, ch) {
if (ch.halfCheck === true) {
ch.halfCheck = false;
@ -217,24 +217,18 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
}
function onCheck (event, treeId, treeNode) {
function onCheck(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
self._selectTreeNode(treeId, treeNode);
}
function onExpand (event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
function onExpand(event, treeId, treeNode) {
treeNode.halfCheck = false;
}
function onCollapse (event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
function onCollapse(event, treeId, treeNode) {
}
return setting;
@ -325,7 +319,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
var hashMap = {};
var rootNoots = this.nodes.getNodes();
track(rootNoots); // 可以看到这个方法没有递归调用,所以在_getHalfSelectedValues中需要关心全选的节点
function track (nodes) {
function track(nodes) {
BI.each(nodes, function (i, node) {
var checkState = node.getCheckStatus();
if (checkState.checked === true || checkState.half === true) {
@ -503,7 +497,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
checkAll: function (checked) {
function setNode (children) {
function setNode(children) {
BI.each(children, function (i, child) {
child.halfCheck = false;
setNode(child.children);
@ -545,7 +539,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
BI.each(values, function (v, op) {
var nodes = treeObj.getNodesByParam(param, v, null);
BI.each(nodes, function (j, node) {
BI.extend(node, {checked: true}, op);
BI.extend(node, { checked: true }, op);
treeObj.updateNode(node);
});
});

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

@ -58,7 +58,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}
};
function onClick (event, treeId, treeNode) {
function onClick(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
@ -72,7 +72,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
zTree.checkNode(treeNode, !checked, true, true);
}
function beforeCheck (treeId, treeNode) {
function beforeCheck(treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
@ -82,7 +82,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
if (treeNode.checked === true) {
// 将展开的节点halfCheck设为false,解决展开节点存在halfCheck=true的情况 guy
// 所有的半选状态都需要取消halfCheck=true的情况
function track (children) {
function track(children) {
BI.each(children, function (i, ch) {
ch.halfCheck = false;
track(ch.children);
@ -103,31 +103,22 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
}
}
function beforeExpand (treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
function beforeExpand(treeId, treeNode) {
self._beforeExpandNode(treeId, treeNode);
}
function onCheck (event, treeId, treeNode) {
function onCheck(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
self._selectTreeNode(treeId, treeNode);
}
function onExpand (event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
function onExpand(event, treeId, treeNode) {
treeNode.halfCheck = false;
}
function onCollapse (event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
function onCollapse(event, treeId, treeNode) {
treeNode.halfCheck = false;
}
@ -216,7 +207,7 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
track([], valueA, valueB);
track([], valueB, valueA);
function track (parent, node, compare) {
function track(parent, node, compare) {
BI.each(node, function (n, item) {
if (BI.isNull(compare[n])) {
self._addTreeNode(map, parent, n, item);

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;

11
src/core/system.js

@ -7,6 +7,7 @@
!(function () {
var system = {
dependencies: {},
layoutOptimize: false,
responsiveMode: false,
workerMode: false,
size: {
@ -24,7 +25,7 @@
// 具体尺寸还没定,先写着
var sizeMap = {
"S": 10,
"M" : 20,
"M": 20,
"L": 24
};
@ -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;

39
src/less/base/combo/combo.less

@ -1,19 +1,22 @@
@import "../../index.less";
@val: transform .3s ease;
.bi-combo {
& > .bi-trigger {
& .bi-trigger-icon-button{
& .bi-trigger-icon-button {
& .x-icon {
.rotate(0deg);
.transition(@val);
}
}
}
&.bi-combo-popup {
display: block !important;
visibility: visible !important;
& > .bi-trigger {
& .bi-trigger-icon-button{
& .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
@ -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 {

28
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{
.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-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;
}

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

@ -1,22 +1,28 @@
@import "../../../index.less";
.bi-toast{
.bi-toast {
color: @color-bi-color-toast-text;
line-height: @font-size-16;
.border-radius(2px);
&.toast-success{
.box-shadow(@box-shadow-toast) ;
&.toast-success {
background: @color-bi-background-toast-success;
}
&.toast-warning{
&.toast-warning {
background: @color-bi-background-toast-warning;
}
&.toast-error{
&.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{
& .toast-icon {
font-size: @font-size-16;
}
}

48
src/less/base/tree/tree.expander.less

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

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;
}
}
}
}

2
src/less/image.less

@ -333,7 +333,7 @@
@font-face {
font-family: "@{name}";
src: url('@{fontUrl}iconfont.eot');
src: url('@{fontUrl}iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('@{fontUrl}iconfont.woff') format('woff'), /* chrome、firefox */ url('@{fontUrl}iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{fontUrl}iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
src: url('@{fontUrl}iconfont.woff') format('woff'), /* chrome、firefox */ url('@{fontUrl}iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{fontUrl}iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
}
}

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;

3
src/less/lib/constant.less

@ -244,3 +244,6 @@
@scroll-color-theme-dark: @color-white;
@scroll-thumb-color: @color-black;
@scroll-thumb-color-theme-dark: @color-black;
//box-shadow效果
@box-shadow-toast: 0 6px 20px -2px rgba(9, 30, 64, 0.16);

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";

23
src/less/lib/theme.less

@ -72,6 +72,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 +86,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 +201,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);

9
src/less/theme/dark.less

@ -2,7 +2,14 @@
.bi-theme-dark {
color: @color-bi-text-theme-dark;
& .bi-input {
color: @color-bi-text;
}
}
& .bi-textarea {
color: @color-bi-text;
}
}

32
src/less/visual.less

@ -16,6 +16,12 @@
box-shadow: none;
}
.box-shadow(@shadow) {
-webkit-box-shadow: @shadow;
-moz-box-shadow: @shadow;
box-shadow: @shadow;
}
.box-shadow(@style, @c) when (iscolor(@c)) {
-webkit-box-shadow: @style @c;
-moz-box-shadow: @style @c;
@ -219,7 +225,7 @@
margin-top: 5px;
content: "";
transform: rotate(-135deg);
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.06));
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.06));
}
}
@ -238,7 +244,7 @@
margin-top: -5px;
content: "";
transform: rotate(45deg);
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.07));
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.07));
}
}
@ -258,7 +264,7 @@
margin-top: 4px;
content: "";
transform: rotate(135deg);
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.06));
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.06));
}
}
@ -277,26 +283,26 @@
margin-top: 4px;
content: "";
transform: rotate(-45deg);
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.07));
.box-shadow(3px 3px 10px 0, rgba(0, 0, 0, 0.07));
}
}
// css3 animation
.keyframes(@name, @frames) {
@-webkit-keyframes @name {
@frames();
@frames();
}
@-moz-keyframes @name {
@frames();
@frames();
}
@-ms-keyframes @name {
@frames();
@frames();
}
@-o-keyframes @name {
@frames();
@frames();
}
@keyframes @name {
@frames();
@frames();
}
}
@ -326,10 +332,10 @@
.transform-origin (@x:center, @y:center) {
-webkit-transform-origin: @x @y;
-moz-transform-origin: @x @y;
-ms-transform-origin: @x @y;
-o-transform-origin: @x @y;
transform-origin: @x @y;
-moz-transform-origin: @x @y;
-ms-transform-origin: @x @y;
-o-transform-origin: @x @y;
transform-origin: @x @y;
}
.hover-visible(@cls) {

30
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;
}
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
&.status-error {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
.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;
}
}
}

29
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;
}
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon {
.rotate(180deg);
.transition(@val);
&.status-error {
&.bi-border, &.bi-border-bottom {
border-color: @border-color-negative;
}
.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;
}
}
}

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

Loading…
Cancel
Save