Browse Source

Merge pull request #43 in FUI/fineui from ~GUY/fineui:master to master

* commit '5f552faadc64cf22cd0f9863249497efda03e40a':
  add
  Tree
  update
  add
  textArea 多边框
  bubblecombo 实现setEnable方法
  getMonthDay
es6
guy 8 years ago
parent
commit
743404c20d
  1. 6
      bi/base.css
  2. 15
      bi/base.js
  3. 8
      bi/case.js
  4. 18
      bi/core.js
  5. 93
      bi/polyfill.js
  6. 204
      bi/widget.js
  7. 8
      demo/js/config/widget.js
  8. 66
      demo/js/widget/tree/demo.multilayer_select_tree_combo.js
  9. 6
      docs/base.css
  10. 15
      docs/base.js
  11. 8
      docs/case.js
  12. 18
      docs/core.js
  13. 75
      docs/demo.js
  14. 93
      docs/polyfill.js
  15. 204
      docs/widget.js
  16. 5
      src/base/combination/switcher.js
  17. 2
      src/base/table/table.collection.js
  18. 8
      src/base/table/table.grid.js
  19. 8
      src/case/combo/bubblecombo/combo.bubble.js
  20. 6
      src/component/allvaluechooser/combo.allvaluechooser.js
  21. 21
      src/component/treevaluechooser/combo.treevaluechooser.js
  22. 4
      src/component/valuechooser/combo.valuechooser.js
  23. 5
      src/core/proto/date.js
  24. 13
      src/core/utils/tree.js
  25. 6
      src/css/base/single/editor/editor.textarea.css
  26. 4
      src/less/base/single/editor/editor.textarea.less
  27. 67
      src/widget/multiselect/multiselect.combo.js
  28. 5
      src/widget/multiselect/multiselect.trigger.js
  29. 4
      src/widget/multiselect/trigger/searcher.multiselect.js
  30. 4
      src/widget/multiselect/trigger/switcher.checkselected.js
  31. 89
      src/widget/multitree/multi.tree.combo.js
  32. 4
      src/widget/multitree/trigger/searcher.multi.tree.js

6
bi/base.css

@ -920,12 +920,6 @@ li.CodeMirror-hint-active {
.bi-textarea-editor .textarea-editor-content { .bi-textarea-editor .textarea-editor-content {
border: none; border: none;
} }
.bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #d4dadd;
}
.bi-theme-dark .bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #525466;
}
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/

15
bi/base.js

@ -4642,6 +4642,11 @@ BI.Switcher = BI.inherit(BI.Widget, {
return this.popupView ? this.popupView.getValue() : []; return this.popupView ? this.popupView.getValue() : [];
}, },
setAdapter: function (adapter) {
this.options.adapter = adapter;
BI.Maskers.remove(this.getName());
},
isViewVisible: function () { isViewVisible: function () {
return this.isEnabled() && this.switcher.isEnabled() && return this.isEnabled() && this.switcher.isEnabled() &&
(this.options.adapter ? BI.Maskers.isVisible(this.getName()) : (this.popupView && this.popupView.isVisible())); (this.options.adapter ? BI.Maskers.isVisible(this.getName()) : (this.popupView && this.popupView.isVisible()));
@ -28726,7 +28731,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var o = this.options; var o = this.options;
if (o.items.length > 0 || o.header.length < 0) { if (o.items.length > 0 || o.header.length > 0) {
this._digest(); this._digest();
this._populate(); this._populate();
} }
@ -29508,7 +29513,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var o = this.options; var o = this.options;
if (o.items.length > 0) { if (o.items.length > 0 || o.header.length > 0) {
this._populate(); this._populate();
} }
}, },
@ -29519,7 +29524,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -29604,7 +29610,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {

8
bi/case.js

@ -3596,6 +3596,14 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
hasView: function () { hasView: function () {
return BI.isNotNull(this.combo.getView()); return BI.isNotNull(this.combo.getView());
},
isViewVisible: function () {
return this.combo.isViewVisible();
},
setEnable: function (v) {
this.combo.setEnable(!!v);
} }
}); });

18
bi/core.js

@ -6338,8 +6338,9 @@ Date.checkLegal = function (str) {
if (ar.length <= 2) { if (ar.length <= 2) {
return MM >= 1 && MM <= 12; return MM >= 1 && MM <= 12;
} }
Date._MD[1] = Date.isLeap(YY) ? 29 : 28; var MD = Date._MD.slice(0);
return MM >= 1 && MM <= 12 && DD <= Date._MD[MM - 1]; MD[1] = Date.isLeap(YY) ? 29 : 28;
return MM >= 1 && MM <= 12 && DD <= MD[MM - 1];
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {
@ -10402,6 +10403,19 @@ $.extend(BI, {
} else { } else {
return [sNodes]; return [sNodes];
} }
},
traversal: function (array, callback) {
if (BI.isNull(array)) {
return;
}
var self = this;
BI.any(array, function (i, item) {
if (callback(i, item) === false) {
return true;
}
self.traversal(item.children, callback);
})
} }
}) })
})();//向量操作 })();//向量操作

93
bi/polyfill.js

@ -0,0 +1,93 @@
if(![].indexOf){
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
[].indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}
if(![].lastIndexOf){
/**
* 检查指定的值是否在数组中
* ie67不支持数组的这个方法
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
[].lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}/**
* 特殊情况
* Created by wang on 15/6/23.
*/
//解决console未定义问题 guy
window.console = window.console || (function () {
var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () {
};
return c;
})();
/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {
items: {},
setItem: function (k, v) {
BI.Cache.addCookie(k, v);
},
getItem: function (k) {
return BI.Cache.getCookie(k);
},
removeItem: function (k) {
BI.Cache.deleteCookie(k);
},
key: function () {
},
clear: function () {
this.items = {};
}
});//修复ie9下sort方法的bug
!function (window) {
var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) {
var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') {
if (this.length < 2) {
return this;
}
var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0;
for (; i < l; i++) {
for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t :
!!t ? 1 : 0) > 0;
if (r === true) {
tmp = this[i];
this[i] = this[j];
this[j] = tmp;
}
}
}
return this;
} else {
return _sort.call(this);
}
};
}
}(window);

204
bi/widget.js

@ -9559,38 +9559,11 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = {}; this.storeValue = {};
this.popup = BI.createWidget({
type: 'bi.multi_select_popup_view',
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CHANGE, function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, function () {
self.setValue();
self._defaultState();
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: { offset: {
left: 1, left: 1,
@ -9675,7 +9648,43 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup, popup: {
type: 'bi.multi_select_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
action: function () {
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0;
} }
@ -10272,6 +10281,11 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) { setValue: function (ob) {
this.searcher.setValue(ob); this.searcher.setValue(ob);
this.numberCounter.setValue(ob); this.numberCounter.setValue(ob);
@ -10816,6 +10830,10 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
return this.searcher.getView() && this.searcher.getView().hasChecked(); return this.searcher.getView() && this.searcher.getView().hasChecked();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) { setState: function (ob) {
var o = this.options; var o = this.options;
ob || (ob = {}); ob || (ob = {});
@ -10937,6 +10955,10 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, {
this.switcher.hideView(); this.switcher.hideView();
}, },
setAdapter: function (adapter) {
this.switcher.setAdapter(adapter);
},
setValue: function (v) { setValue: function (v) {
this.switcher.setValue(v); this.switcher.setValue(v);
}, },
@ -11406,7 +11428,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}, },
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo', baseCls: 'bi-multi-tree-combo',
@ -11420,31 +11441,13 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this.popup = BI.createWidget({
type: 'bi.multi_tree_popup_view',
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
var isInit = false; var isInit = false;
var want2showCounter = false; var want2showCounter = false;
this.popup.on(BI.MultiTreePopup.EVENT_AFTERINIT, function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: this.constants.offset offset: this.constants.offset
}, },
@ -11469,7 +11472,53 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup popup: {
type: 'bi.multi_tree_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
}
}); });
this.storeValue = {value: {}}; this.storeValue = {value: {}};
@ -11532,24 +11581,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.getSearcher().setState(val); this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
this.popup.on(BI.MultiTreePopup.EVENT_CHANGE, function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CLEAR, function () {
clear = true;
self.setValue();
self._defaultState();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (isSearching()) { if (isSearching()) {
@ -11618,7 +11649,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
setEnable: function(v){ setEnable: function (v) {
this.combo.setEnable(v); this.combo.setEnable(v);
}, },
@ -11956,6 +11987,10 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
this.searcher.adjustView(); this.searcher.adjustView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
isSearching: function () { isSearching: function () {
return this.searcher.isSearching(); return this.searcher.isSearching();
}, },
@ -16974,7 +17009,7 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
}); });
BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/** BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/**
* 简单的复选下拉框控件, 适用于数据量少的情况 * 简单的复选下拉框控件, 适用于数据量少的情况 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值
* 封装了字段处理逻辑 * 封装了字段处理逻辑
* *
* Created by GUY on 2015/10/29. * Created by GUY on 2015/10/29.
@ -17053,13 +17088,13 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, {
return !filter[ob.value]; return !filter[ob.value];
}); });
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({
items: items items: items
}); });
return; return;
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length}); callback({count: items.length});
return; return;
} }
@ -17198,24 +17233,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return; return;
} }
doCheck(0, [], selectedValues); doCheck(0, [], this.tree.getRoot(), selectedValues);
callback({ callback({
items: result items: result
}); });
function doCheck(floor, parentValues, selected) { function doCheck(floor, parentValues, node, selected) {
if (floor >= self.floors) { if (floor >= self.floors) {
return; return;
} }
if (selected == null || BI.isEmpty(selected)) { if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parentValues); BI.each(node.getChildren(), function (i, child) {
BI.each(children, function (i, child) {
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(child.value); newParents.push(child.value);
var llen = self._getChildCount(newParents); var llen = self._getChildCount(newParents);
createOneJson(child, llen); createOneJson(child, node.id, llen);
doCheck(floor + 1, newParents, {}); doCheck(floor + 1, newParents, child, {});
}); });
return; return;
} }
@ -17223,8 +17257,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var node = self._getNode(k); var node = self._getNode(k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents)); createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]); doCheck(floor + 1, newParents, node, selected[k]);
}) })
} }
@ -17239,10 +17273,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return BI.size(jo); return BI.size(jo);
} }
function createOneJson(node, llen) { function createOneJson(node, pId, llen) {
result.push({ result.push({
id: node.id, id: node.id,
pId: node.pId, pId: pId,
text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""),
value: node.value, value: node.value,
open: true open: true
@ -17624,7 +17658,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
if (valueMap[current][0] === 1) { if (valueMap[current][0] === 1) {
var values = BI.clone(parentValues); var values = BI.clone(parentValues);
values.push(current); values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) { if (hasChild && self._getChildCount(values) !== valueMap[current][1]) {
halfCheck = true; halfCheck = true;
} }
} else if (valueMap[current][0] === 2) { } else if (valueMap[current][0] === 2) {
@ -17780,13 +17814,13 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, {
return !filter[ob.value]; return !filter[ob.value];
}); });
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({
items: items items: items
}); });
return; return;
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length}); callback({count: items.length});
return; return;
} }

8
demo/js/config/widget.js

@ -21,6 +21,14 @@ Demo.WIDGET_CONFIG = [{
pId: 401, pId: 401,
text: "bi.page_table", text: "bi.page_table",
value: "demo.page_table" value: "demo.page_table"
}, {
id: 402,
pId: 4,
text: "tree"
}, {
pId: 402,
text: "bi.multilayer_select_tree_combo",
value: "demo.multilayer_select_tree_combo"
}, { }, {
pId: 4, pId: 4,
text: "bi.multi_select_combo", text: "bi.multi_select_combo",

66
demo/js/widget/tree/demo.multilayer_select_tree_combo.js

@ -0,0 +1,66 @@
/**
* Created by User on 2017/3/22.
*/
Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
props: {},
render: function (vessel) {
var TREEWITHCHILDREN = [{
id: -1, value: "根目录", text: "根目录", children: [
{
id: 1, value: "第一级目录1", text: "第一级目录1", children: [
{id: 11, value: "第二级文件1", text: "第二级文件1"},
{
id: 12, value: "第二级目录2", text: "第二级目录2", children: [
{
id: 121, value: "第三级目录1", text: "第三级目录1", children: [
{
id: 1211, value: "第四级目录1", text: "第四级目录1", children: [
{id: 12111, value: "第五级文件1", text: "第五级文件1"}
]
}
]
},
{id: 122, value: "第三级文件1", text: "第三级文件1"}
]
}
]
},
{
id: 2, value: "第一级目录2", text: "第一级目录2", children: [
{
id: 21, value: "第二级目录3", text: "第二级目录3", children: [
{
id: 211, value: "第三级目录2", text: "第三级目录2", children: [
{id: 2111, value: "第四级文件1", text: "第四级文件1"}
]
},
{id: 212, value: "第三级文件2", text: "第三级文件2"}
]
},
{id: 22, value: "第二级文件2", text: "第二级文件2"}
]
}
]
}];
var items = BI.deepClone(TREEWITHCHILDREN);
var combo = BI.createWidget({
type: "bi.multilayer_select_tree_combo",
});
combo.populate(items);
return {
type: "bi.vertical",
items: [combo, {
type: "bi.button",
width: 100,
text: "getValue",
handler: function () {
BI.Msg.alert("", JSON.stringify(combo.getValue()));
}
}],
vgap: 100
}
}
});
BI.shortcut("demo.multilayer_select_tree_combo", Demo.MultiSelectCombo);

6
docs/base.css

@ -920,12 +920,6 @@ li.CodeMirror-hint-active {
.bi-textarea-editor .textarea-editor-content { .bi-textarea-editor .textarea-editor-content {
border: none; border: none;
} }
.bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #d4dadd;
}
.bi-theme-dark .bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #525466;
}
/****添加计算宽度的--运算符直接需要space****/ /****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/ /****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/ /**** custom color(自定义颜色,用于特定场景) ****/

15
docs/base.js

@ -4642,6 +4642,11 @@ BI.Switcher = BI.inherit(BI.Widget, {
return this.popupView ? this.popupView.getValue() : []; return this.popupView ? this.popupView.getValue() : [];
}, },
setAdapter: function (adapter) {
this.options.adapter = adapter;
BI.Maskers.remove(this.getName());
},
isViewVisible: function () { isViewVisible: function () {
return this.isEnabled() && this.switcher.isEnabled() && return this.isEnabled() && this.switcher.isEnabled() &&
(this.options.adapter ? BI.Maskers.isVisible(this.getName()) : (this.popupView && this.popupView.isVisible())); (this.options.adapter ? BI.Maskers.isVisible(this.getName()) : (this.popupView && this.popupView.isVisible()));
@ -28726,7 +28731,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var o = this.options; var o = this.options;
if (o.items.length > 0 || o.header.length < 0) { if (o.items.length > 0 || o.header.length > 0) {
this._digest(); this._digest();
this._populate(); this._populate();
} }
@ -29508,7 +29513,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var o = this.options; var o = this.options;
if (o.items.length > 0) { if (o.items.length > 0 || o.header.length > 0) {
this._populate(); this._populate();
} }
}, },
@ -29519,7 +29524,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -29604,7 +29610,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {

8
docs/case.js

@ -3596,6 +3596,14 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
hasView: function () { hasView: function () {
return BI.isNotNull(this.combo.getView()); return BI.isNotNull(this.combo.getView());
},
isViewVisible: function () {
return this.combo.isViewVisible();
},
setEnable: function (v) {
this.combo.setEnable(!!v);
} }
}); });

18
docs/core.js

@ -18862,6 +18862,19 @@ $.extend(BI, {
} else { } else {
return [sNodes]; return [sNodes];
} }
},
traversal: function (array, callback) {
if (BI.isNull(array)) {
return;
}
var self = this;
BI.any(array, function (i, item) {
if (callback(i, item) === false) {
return true;
}
self.traversal(item.children, callback);
})
} }
}) })
})();//向量操作 })();//向量操作
@ -23821,8 +23834,9 @@ Date.checkLegal = function (str) {
if (ar.length <= 2) { if (ar.length <= 2) {
return MM >= 1 && MM <= 12; return MM >= 1 && MM <= 12;
} }
Date._MD[1] = Date.isLeap(YY) ? 29 : 28; var MD = Date._MD.slice(0);
return MM >= 1 && MM <= 12 && DD <= Date._MD[MM - 1]; MD[1] = Date.isLeap(YY) ? 29 : 28;
return MM >= 1 && MM <= 12 && DD <= MD[MM - 1];
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {

75
docs/demo.js

@ -3112,6 +3112,14 @@ Demo.COMPONENT_CONFIG = [{
pId: 401, pId: 401,
text: "bi.page_table", text: "bi.page_table",
value: "demo.page_table" value: "demo.page_table"
}, {
id: 402,
pId: 4,
text: "tree"
}, {
pId: 402,
text: "bi.multilayer_select_tree_combo",
value: "demo.multilayer_select_tree_combo"
}, { }, {
pId: 4, pId: 4,
text: "bi.multi_select_combo", text: "bi.multi_select_combo",
@ -6725,7 +6733,72 @@ BI.shortcut("demo.responsive_table", Demo.Func);Demo.Func = BI.inherit(BI.Widget
}) })
} }
}); });
BI.shortcut("demo.sequence_table", Demo.Func);Demo.CONFIG = Demo.CORE_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG).concat(Demo.COMPONENT_CONFIG).concat(Demo.CHART_CONFIG); BI.shortcut("demo.sequence_table", Demo.Func);/**
* Created by User on 2017/3/22.
*/
Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
props: {},
render: function (vessel) {
var TREEWITHCHILDREN = [{
id: -1, value: "根目录", text: "根目录", children: [
{
id: 1, value: "第一级目录1", text: "第一级目录1", children: [
{id: 11, value: "第二级文件1", text: "第二级文件1"},
{
id: 12, value: "第二级目录2", text: "第二级目录2", children: [
{
id: 121, value: "第三级目录1", text: "第三级目录1", children: [
{
id: 1211, value: "第四级目录1", text: "第四级目录1", children: [
{id: 12111, value: "第五级文件1", text: "第五级文件1"}
]
}
]
},
{id: 122, value: "第三级文件1", text: "第三级文件1"}
]
}
]
},
{
id: 2, value: "第一级目录2", text: "第一级目录2", children: [
{
id: 21, value: "第二级目录3", text: "第二级目录3", children: [
{
id: 211, value: "第三级目录2", text: "第三级目录2", children: [
{id: 2111, value: "第四级文件1", text: "第四级文件1"}
]
},
{id: 212, value: "第三级文件2", text: "第三级文件2"}
]
},
{id: 22, value: "第二级文件2", text: "第二级文件2"}
]
}
]
}];
var items = BI.deepClone(TREEWITHCHILDREN);
var combo = BI.createWidget({
type: "bi.multilayer_select_tree_combo",
});
combo.populate(items);
return {
type: "bi.vertical",
items: [combo, {
type: "bi.button",
width: 100,
text: "getValue",
handler: function () {
BI.Msg.alert("", JSON.stringify(combo.getValue()));
}
}],
vgap: 100
}
}
});
BI.shortcut("demo.multilayer_select_tree_combo", Demo.MultiSelectCombo);Demo.CONFIG = Demo.CORE_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG).concat(Demo.COMPONENT_CONFIG).concat(Demo.CHART_CONFIG);
Demo.CONSTANTS = { Demo.CONSTANTS = {

93
docs/polyfill.js

@ -0,0 +1,93 @@
if(![].indexOf){
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
[].indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}
if(![].lastIndexOf){
/**
* 检查指定的值是否在数组中
* ie67不支持数组的这个方法
* @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1
*/
[].lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) {
return i;
}
}
return -1;
}
}/**
* 特殊情况
* Created by wang on 15/6/23.
*/
//解决console未定义问题 guy
window.console = window.console || (function () {
var c = {};
c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
= c.clear = c.exception = c.trace = c.assert = function () {
};
return c;
})();
/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {
items: {},
setItem: function (k, v) {
BI.Cache.addCookie(k, v);
},
getItem: function (k) {
return BI.Cache.getCookie(k);
},
removeItem: function (k) {
BI.Cache.deleteCookie(k);
},
key: function () {
},
clear: function () {
this.items = {};
}
});//修复ie9下sort方法的bug
!function (window) {
var ua = window.navigator.userAgent.toLowerCase(),
reg = /msie|applewebkit.+safari/;
if (reg.test(ua)) {
var _sort = Array.prototype.sort;
Array.prototype.sort = function (fn) {
if (!!fn && typeof fn === 'function') {
if (this.length < 2) {
return this;
}
var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0;
for (; i < l; i++) {
for (j = i + 1; j < l; j++) {
t = fn.call(this, this[i], this[j]);
r = (typeof t === 'number' ? t :
!!t ? 1 : 0) > 0;
if (r === true) {
tmp = this[i];
this[i] = this[j];
this[j] = tmp;
}
}
}
return this;
} else {
return _sort.call(this);
}
};
}
}(window);

204
docs/widget.js

@ -9559,38 +9559,11 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = {}; this.storeValue = {};
this.popup = BI.createWidget({
type: 'bi.multi_select_popup_view',
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CHANGE, function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, function () {
self.setValue();
self._defaultState();
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: { offset: {
left: 1, left: 1,
@ -9675,7 +9648,43 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup, popup: {
type: 'bi.multi_select_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
action: function () {
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0;
} }
@ -10272,6 +10281,11 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) { setValue: function (ob) {
this.searcher.setValue(ob); this.searcher.setValue(ob);
this.numberCounter.setValue(ob); this.numberCounter.setValue(ob);
@ -10816,6 +10830,10 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
return this.searcher.getView() && this.searcher.getView().hasChecked(); return this.searcher.getView() && this.searcher.getView().hasChecked();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) { setState: function (ob) {
var o = this.options; var o = this.options;
ob || (ob = {}); ob || (ob = {});
@ -10937,6 +10955,10 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, {
this.switcher.hideView(); this.switcher.hideView();
}, },
setAdapter: function (adapter) {
this.switcher.setAdapter(adapter);
},
setValue: function (v) { setValue: function (v) {
this.switcher.setValue(v); this.switcher.setValue(v);
}, },
@ -11406,7 +11428,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}, },
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo', baseCls: 'bi-multi-tree-combo',
@ -11420,31 +11441,13 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this.popup = BI.createWidget({
type: 'bi.multi_tree_popup_view',
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
var isInit = false; var isInit = false;
var want2showCounter = false; var want2showCounter = false;
this.popup.on(BI.MultiTreePopup.EVENT_AFTERINIT, function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: this.constants.offset offset: this.constants.offset
}, },
@ -11469,7 +11472,53 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup popup: {
type: 'bi.multi_tree_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
}
}); });
this.storeValue = {value: {}}; this.storeValue = {value: {}};
@ -11532,24 +11581,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.getSearcher().setState(val); this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
this.popup.on(BI.MultiTreePopup.EVENT_CHANGE, function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CLEAR, function () {
clear = true;
self.setValue();
self._defaultState();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (isSearching()) { if (isSearching()) {
@ -11618,7 +11649,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
setEnable: function(v){ setEnable: function (v) {
this.combo.setEnable(v); this.combo.setEnable(v);
}, },
@ -11956,6 +11987,10 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
this.searcher.adjustView(); this.searcher.adjustView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
isSearching: function () { isSearching: function () {
return this.searcher.isSearching(); return this.searcher.isSearching();
}, },
@ -16974,7 +17009,7 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
}); });
BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/** BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/**
* 简单的复选下拉框控件, 适用于数据量少的情况 * 简单的复选下拉框控件, 适用于数据量少的情况 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值
* 封装了字段处理逻辑 * 封装了字段处理逻辑
* *
* Created by GUY on 2015/10/29. * Created by GUY on 2015/10/29.
@ -17053,13 +17088,13 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, {
return !filter[ob.value]; return !filter[ob.value];
}); });
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({
items: items items: items
}); });
return; return;
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length}); callback({count: items.length});
return; return;
} }
@ -17198,24 +17233,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return; return;
} }
doCheck(0, [], selectedValues); doCheck(0, [], this.tree.getRoot(), selectedValues);
callback({ callback({
items: result items: result
}); });
function doCheck(floor, parentValues, selected) { function doCheck(floor, parentValues, node, selected) {
if (floor >= self.floors) { if (floor >= self.floors) {
return; return;
} }
if (selected == null || BI.isEmpty(selected)) { if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parentValues); BI.each(node.getChildren(), function (i, child) {
BI.each(children, function (i, child) {
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(child.value); newParents.push(child.value);
var llen = self._getChildCount(newParents); var llen = self._getChildCount(newParents);
createOneJson(child, llen); createOneJson(child, node.id, llen);
doCheck(floor + 1, newParents, {}); doCheck(floor + 1, newParents, child, {});
}); });
return; return;
} }
@ -17223,8 +17257,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var node = self._getNode(k); var node = self._getNode(k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents)); createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]); doCheck(floor + 1, newParents, node, selected[k]);
}) })
} }
@ -17239,10 +17273,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return BI.size(jo); return BI.size(jo);
} }
function createOneJson(node, llen) { function createOneJson(node, pId, llen) {
result.push({ result.push({
id: node.id, id: node.id,
pId: node.pId, pId: pId,
text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""),
value: node.value, value: node.value,
open: true open: true
@ -17624,7 +17658,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
if (valueMap[current][0] === 1) { if (valueMap[current][0] === 1) {
var values = BI.clone(parentValues); var values = BI.clone(parentValues);
values.push(current); values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) { if (hasChild && self._getChildCount(values) !== valueMap[current][1]) {
halfCheck = true; halfCheck = true;
} }
} else if (valueMap[current][0] === 2) { } else if (valueMap[current][0] === 2) {
@ -17780,13 +17814,13 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, {
return !filter[ob.value]; return !filter[ob.value];
}); });
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({
items: items items: items
}); });
return; return;
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length}); callback({count: items.length});
return; return;
} }

5
src/base/combination/switcher.js

@ -204,6 +204,11 @@ BI.Switcher = BI.inherit(BI.Widget, {
return this.popupView ? this.popupView.getValue() : []; return this.popupView ? this.popupView.getValue() : [];
}, },
setAdapter: function (adapter) {
this.options.adapter = adapter;
BI.Maskers.remove(this.getName());
},
isViewVisible: function () { isViewVisible: function () {
return this.isEnabled() && this.switcher.isEnabled() && return this.isEnabled() && this.switcher.isEnabled() &&
(this.options.adapter ? BI.Maskers.isVisible(this.getName()) : (this.popupView && this.popupView.isVisible())); (this.options.adapter ? BI.Maskers.isVisible(this.getName()) : (this.popupView && this.popupView.isVisible()));

2
src/base/table/table.collection.js

@ -163,7 +163,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var o = this.options; var o = this.options;
if (o.items.length > 0 || o.header.length < 0) { if (o.items.length > 0 || o.header.length > 0) {
this._digest(); this._digest();
this._populate(); this._populate();
} }

8
src/base/table/table.grid.js

@ -167,7 +167,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var o = this.options; var o = this.options;
if (o.items.length > 0) { if (o.items.length > 0 || o.header.length > 0) {
this._populate(); this._populate();
} }
}, },
@ -178,7 +178,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateScrollbar: function () { _populateScrollbar: function () {
var o = this.options; var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -263,7 +264,8 @@ BI.GridTable = BI.inherit(BI.Widget, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize;
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {

8
src/case/combo/bubblecombo/combo.bubble.js

@ -197,6 +197,14 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
hasView: function () { hasView: function () {
return BI.isNotNull(this.combo.getView()); return BI.isNotNull(this.combo.getView());
},
isViewVisible: function () {
return this.combo.isViewVisible();
},
setEnable: function (v) {
this.combo.setEnable(!!v);
} }
}); });

6
src/component/allvaluechooser/combo.allvaluechooser.js

@ -1,5 +1,5 @@
/** /**
* 简单的复选下拉框控件, 适用于数据量少的情况 * 简单的复选下拉框控件, 适用于数据量少的情况 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值
* 封装了字段处理逻辑 * 封装了字段处理逻辑
* *
* Created by GUY on 2015/10/29. * Created by GUY on 2015/10/29.
@ -78,13 +78,13 @@ BI.AllValueChooserCombo = BI.inherit(BI.Widget, {
return !filter[ob.value]; return !filter[ob.value];
}); });
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({
items: items items: items
}); });
return; return;
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length}); callback({count: items.length});
return; return;
} }

21
src/component/treevaluechooser/combo.treevaluechooser.js

@ -106,24 +106,23 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return; return;
} }
doCheck(0, [], selectedValues); doCheck(0, [], this.tree.getRoot(), selectedValues);
callback({ callback({
items: result items: result
}); });
function doCheck(floor, parentValues, selected) { function doCheck(floor, parentValues, node, selected) {
if (floor >= self.floors) { if (floor >= self.floors) {
return; return;
} }
if (selected == null || BI.isEmpty(selected)) { if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parentValues); BI.each(node.getChildren(), function (i, child) {
BI.each(children, function (i, child) {
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(child.value); newParents.push(child.value);
var llen = self._getChildCount(newParents); var llen = self._getChildCount(newParents);
createOneJson(child, llen); createOneJson(child, node.id, llen);
doCheck(floor + 1, newParents, {}); doCheck(floor + 1, newParents, child, {});
}); });
return; return;
} }
@ -131,8 +130,8 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
var node = self._getNode(k); var node = self._getNode(k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents)); createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]); doCheck(floor + 1, newParents, node, selected[k]);
}) })
} }
@ -147,10 +146,10 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
return BI.size(jo); return BI.size(jo);
} }
function createOneJson(node, llen) { function createOneJson(node, pId, llen) {
result.push({ result.push({
id: node.id, id: node.id,
pId: node.pId, pId: pId,
text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""),
value: node.value, value: node.value,
open: true open: true
@ -532,7 +531,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
if (valueMap[current][0] === 1) { if (valueMap[current][0] === 1) {
var values = BI.clone(parentValues); var values = BI.clone(parentValues);
values.push(current); values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) { if (hasChild && self._getChildCount(values) !== valueMap[current][1]) {
halfCheck = true; halfCheck = true;
} }
} else if (valueMap[current][0] === 2) { } else if (valueMap[current][0] === 2) {

4
src/component/valuechooser/combo.valuechooser.js

@ -90,13 +90,13 @@ BI.ValueChooserCombo = BI.inherit(BI.Widget, {
return !filter[ob.value]; return !filter[ob.value];
}); });
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) { if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({
items: items items: items
}); });
return; return;
} }
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length}); callback({count: items.length});
return; return;
} }

5
src/core/proto/date.js

@ -386,8 +386,9 @@ Date.checkLegal = function (str) {
if (ar.length <= 2) { if (ar.length <= 2) {
return MM >= 1 && MM <= 12; return MM >= 1 && MM <= 12;
} }
Date._MD[1] = Date.isLeap(YY) ? 29 : 28; var MD = Date._MD.slice(0);
return MM >= 1 && MM <= 12 && DD <= Date._MD[MM - 1]; MD[1] = Date.isLeap(YY) ? 29 : 28;
return MM >= 1 && MM <= 12 && DD <= MD[MM - 1];
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {

13
src/core/utils/tree.js

@ -464,6 +464,19 @@
} else { } else {
return [sNodes]; return [sNodes];
} }
},
traversal: function (array, callback) {
if (BI.isNull(array)) {
return;
}
var self = this;
BI.any(array, function (i, item) {
if (callback(i, item) === false) {
return true;
}
self.traversal(item.children, callback);
})
} }
}) })
})(); })();

6
src/css/base/single/editor/editor.textarea.css

@ -12,9 +12,3 @@
.bi-textarea-editor .textarea-editor-content { .bi-textarea-editor .textarea-editor-content {
border: none; border: none;
} }
.bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #d4dadd;
}
.bi-theme-dark .bi-textarea-editor .textarea-editor-content.textarea-editor-focus {
border: 1px solid #525466;
}

4
src/less/base/single/editor/editor.textarea.less

@ -8,7 +8,7 @@
border: none; border: none;
} }
&.textarea-editor-focus{ &.textarea-editor-focus{
border: 1px solid @color-bi-border-line;
} }
} }
} }
@ -17,7 +17,7 @@
.bi-textarea-editor { .bi-textarea-editor {
& .textarea-editor-content { & .textarea-editor-content {
&.textarea-editor-focus{ &.textarea-editor-focus{
border: 1px solid @color-bi-border-line-theme-dark;
} }
} }
} }

67
src/widget/multiselect/multiselect.combo.js

@ -24,38 +24,11 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = {}; this.storeValue = {};
this.popup = BI.createWidget({
type: 'bi.multi_select_popup_view',
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CHANGE, function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, function () {
self.setValue();
self._defaultState();
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: { offset: {
left: 1, left: 1,
@ -140,7 +113,43 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup, popup: {
type: 'bi.multi_select_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
action: function () {
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0;
} }

5
src/widget/multiselect/multiselect.trigger.js

@ -123,6 +123,11 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) { setValue: function (ob) {
this.searcher.setValue(ob); this.searcher.setValue(ob);
this.numberCounter.setValue(ob); this.numberCounter.setValue(ob);

4
src/widget/multiselect/trigger/searcher.multiselect.js

@ -98,6 +98,10 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
return this.searcher.getView() && this.searcher.getView().hasChecked(); return this.searcher.getView() && this.searcher.getView().hasChecked();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) { setState: function (ob) {
var o = this.options; var o = this.options;
ob || (ob = {}); ob || (ob = {});

4
src/widget/multiselect/trigger/switcher.checkselected.js

@ -72,6 +72,10 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, {
this.switcher.hideView(); this.switcher.hideView();
}, },
setAdapter: function (adapter) {
this.switcher.setAdapter(adapter);
},
setValue: function (v) { setValue: function (v) {
this.switcher.setValue(v); this.switcher.setValue(v);
}, },

89
src/widget/multitree/multi.tree.combo.js

@ -15,7 +15,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}, },
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo', baseCls: 'bi-multi-tree-combo',
@ -29,31 +28,13 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this.popup = BI.createWidget({
type: 'bi.multi_tree_popup_view',
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
var isInit = false; var isInit = false;
var want2showCounter = false; var want2showCounter = false;
this.popup.on(BI.MultiTreePopup.EVENT_AFTERINIT, function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: this.constants.offset offset: this.constants.offset
}, },
@ -78,7 +59,53 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup popup: {
type: 'bi.multi_tree_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
}
}); });
this.storeValue = {value: {}}; this.storeValue = {value: {}};
@ -141,24 +168,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.getSearcher().setState(val); this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
this.popup.on(BI.MultiTreePopup.EVENT_CHANGE, function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CLEAR, function () {
clear = true;
self.setValue();
self._defaultState();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (isSearching()) { if (isSearching()) {
@ -227,7 +236,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
setEnable: function(v){ setEnable: function (v) {
this.combo.setEnable(v); this.combo.setEnable(v);
}, },

4
src/widget/multitree/trigger/searcher.multi.tree.js

@ -76,6 +76,10 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
this.searcher.adjustView(); this.searcher.adjustView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
isSearching: function () { isSearching: function () {
return this.searcher.isSearching(); return this.searcher.isSearching();
}, },

Loading…
Cancel
Save