Browse Source

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

* commit '13b0771439627c7a037e95bf9da6f455a9d2ca4a':
  add
  button的doClick
  bug
master
guy 8 years ago
parent
commit
4f99f42a46
  1. 4
      Gruntfile.js
  2. 82
      bi/base.js
  3. 4
      bi/case.js
  4. 4
      bi/polyfill.js
  5. 433
      bi/widget.js
  6. 2
      demo/js/config/base.js
  7. 82
      docs/base.js
  8. 4
      docs/case.js
  9. 2
      docs/demo.js
  10. 4
      docs/polyfill.js
  11. 433
      docs/widget.js
  12. 3
      src/base/collection/collection.js
  13. 3
      src/base/grid/grid.js
  14. 21
      src/base/single/button/button.basic.js
  15. 8
      src/base/table/table.collection.js
  16. 13
      src/base/table/table.grid.js
  17. 20
      src/base/tree/asynctree.js
  18. 8
      src/base/tree/parttree.js
  19. 6
      src/base/tree/treeview.js
  20. 4
      src/case/pager/pager.all.count.js
  21. 4
      src/less/widget/multistringlist/multistringlist.less
  22. 4
      src/polyfill/array.js
  23. 26
      src/widget/multiselectlist/multiselectlist.js
  24. 2
      src/widget/multiselecttree/multiselecttree.js
  25. 4
      src/widget/multiselecttree/multiselecttree.popup.js
  26. 2
      src/widget/multitree/multi.tree.popup.js
  27. 1
      src/widget/sequencetable/listnumber.sequencetable.js

4
Gruntfile.js

@ -49,7 +49,7 @@ module.exports = function (grunt) {
'src/base/combination/tree.button.js', 'src/base/combination/tree.button.js',
'src/base/combination/map.button.js', 'src/base/combination/map.button.js',
'src/base/tree/treeview.js', 'src/base/tree/treeview.js',
'src/base/tree/synctree.js', 'src/base/tree/asynctree.js',
'src/base/tree/parttree.js', 'src/base/tree/parttree.js',
'src/base/**/*.js' 'src/base/**/*.js'
], ],
@ -162,7 +162,7 @@ module.exports = function (grunt) {
'src/base/combination/tree.button.js', 'src/base/combination/tree.button.js',
'src/base/combination/map.button.js', 'src/base/combination/map.button.js',
'src/base/tree/treeview.js', 'src/base/tree/treeview.js',
'src/base/tree/synctree.js', 'src/base/tree/asynctree.js',
'src/base/tree/parttree.js', 'src/base/tree/parttree.js',
'src/base/**/*.js' 'src/base/**/*.js'
], ],

82
bi/base.js

@ -781,7 +781,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
//之后的300ms点击无效 //之后的300ms点击无效
var onClick = BI.debounce(this.doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true);
function ev(e) { function ev(e) {
if (o.stopEvent) { if (o.stopEvent) {
@ -803,6 +803,11 @@ BI.BasicButton = BI.inherit(BI.Single, {
_trigger: function () { _trigger: function () {
var o = this.options; var o = this.options;
if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) :
this.setSelected(!this.isSelected()));
}
if (this.isValid()) { if (this.isValid()) {
o.handler.call(this, this.getValue(), this); o.handler.call(this, this.getValue(), this);
var v = this.getValue(); var v = this.getValue();
@ -811,13 +816,15 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
}, },
doClick: function () { _doClick: function () {
if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) :
this.setSelected(!this.isSelected()));
}
this._trigger(); this._trigger();
if (this.isValid()) {
this.doClick();
}
},
doClick: function () {
}, },
handle: function () { handle: function () {
@ -1956,6 +1963,12 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
}, },
getExpandedValue: function(){
if (!this.nodes) {
return null;
}
},
refresh: function () { refresh: function () {
this.nodes && this.nodes.refresh(); this.nodes && this.nodes.refresh();
}, },
@ -1991,15 +2004,15 @@ BI.TreeView.EVENT_AFTERINIT = BI.Events.AFTERINIT;
BI.shortcut("bi.tree_view", BI.TreeView);/** BI.shortcut("bi.tree_view", BI.TreeView);/**
* guy * guy
* 同步树 * 同步树
* @class BI.SyncTree * @class BI.AsyncTree
* @extends BI.TreeView * @extends BI.TreeView
*/ */
BI.SyncTree = BI.inherit(BI.TreeView, { BI.AsyncTree = BI.inherit(BI.TreeView, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.SyncTree.superclass._defaultConfig.apply(this, arguments), {}) return BI.extend(BI.AsyncTree.superclass._defaultConfig.apply(this, arguments), {})
}, },
_init: function () { _init: function () {
BI.SyncTree.superclass._init.apply(this, arguments); BI.AsyncTree.superclass._init.apply(this, arguments);
}, },
//配置属性 //配置属性
@ -2069,7 +2082,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
function beforeExpand(treeId, treeNode) { function beforeExpand(treeId, treeNode) {
self._expandNode(treeId, treeNode); self._beforeExpandNode(treeId, treeNode);
} }
function onCheck(event, treeId, treeNode) { function onCheck(event, treeId, treeNode) {
@ -2090,7 +2103,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
_selectTreeNode: function (treeId, treeNode) { _selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
} else { } else {
@ -2109,11 +2122,11 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
} }
} }
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}, },
//展开节点 //展开节点
_expandNode: function (treeId, treeNode) { _beforeExpandNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, { var op = BI.extend({}, o.paras, {
@ -2168,7 +2181,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
}, },
hasChecked: function () { hasChecked: function () {
return !BI.isEmpty(this.selectedValues) || BI.SyncTree.superclass.hasChecked.apply(this, arguments); return !BI.isEmpty(this.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments);
}, },
getValue: function () { getValue: function () {
@ -2196,13 +2209,13 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
}); });
BI.shortcut("bi.sync_tree", BI.SyncTree);/** BI.shortcut("bi.async_tree", BI.AsyncTree);/**
* guy * guy
* 局部树两个请求树 第一个请求构造树第二个请求获取节点 * 局部树两个请求树 第一个请求构造树第二个请求获取节点
* @class BI.PartTree * @class BI.PartTree
* @extends BI.SyncTree * @extends BI.AsyncTree
*/ */
BI.PartTree = BI.inherit(BI.SyncTree, { BI.PartTree = BI.inherit(BI.AsyncTree, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {}) return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {})
}, },
@ -2241,7 +2254,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode)
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} else { } else {
o.itemsCreator(BI.extend({}, o.paras, { o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA, type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA,
@ -2266,7 +2279,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
} }
} }
self.selectedValues = new_values; self.selectedValues = new_values;
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}); });
} }
}, },
@ -2777,6 +2790,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
_populate: function (items) { _populate: function (items) {
var o = this.options; var o = this.options;
this._reRange();
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items; this.options.items = items;
this._calculateSizeAndPositionData(); this._calculateSizeAndPositionData();
@ -2850,7 +2864,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}, },
//重新计算children //重新计算children
reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },
@ -14873,6 +14887,7 @@ BI.GridView = BI.inherit(BI.Widget, {
_populate: function (items) { _populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
this._reRange();
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items; this.options.items = items;
} }
@ -14961,7 +14976,7 @@ BI.GridView = BI.inherit(BI.Widget, {
}, },
//重新计算children //重新计算children
reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },
@ -28993,7 +29008,6 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
return; return;
} }
if (this._isNeedDigest === true) { if (this._isNeedDigest === true) {
this._reRange();
this._digest(); this._digest();
} }
this._isNeedDigest = false; this._isNeedDigest = false;
@ -29091,13 +29105,6 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.bottomRightCollection.restore(); this.bottomRightCollection.restore();
}, },
_reRange: function () {
this.topLeftCollection.reRange();
this.topRightCollection.reRange();
this.bottomLeftCollection.reRange();
this.bottomRightCollection.reRange();
},
restore: function () { restore: function () {
this._restore(); this._restore();
} }
@ -29710,10 +29717,6 @@ BI.GridTable = BI.inherit(BI.Widget, {
if (this._width <= 0 || this._height <= 0) { if (this._width <= 0 || this._height <= 0) {
return; return;
} }
if (this._isNeedDigest === true) {
this._reRange();
this._isNeedDigest = false;
}
this._populateTable(); this._populateTable();
this._populateScrollbar(); this._populateScrollbar();
}, },
@ -29789,13 +29792,11 @@ BI.GridTable = BI.inherit(BI.Widget, {
populate: function (items, header) { populate: function (items, header) {
if (items && this.options.items !== items) { if (items && this.options.items !== items) {
this._isNeedDigest = true;
this.options.items = items; this.options.items = items;
this.items = this._getItems(); this.items = this._getItems();
this._restore(); this._restore();
} }
if (header && this.options.header !== header) { if (header && this.options.header !== header) {
this._isNeedDigest = true;
this.options.header = header; this.options.header = header;
this.header = this._getHeader(); this.header = this._getHeader();
this._restore(); this._restore();
@ -29810,13 +29811,6 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid.restore(); this.bottomRightGrid.restore();
}, },
_reRange: function () {
this.topLeftGrid.reRange();
this.topRightGrid.reRange();
this.bottomLeftGrid.reRange();
this.bottomRightGrid.reRange();
},
restore: function () { restore: function () {
this._restore(); this._restore();
} }

4
bi/case.js

@ -7951,6 +7951,10 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
this.pager.setValue(v); this.pager.setValue(v);
}, },
setVPage: function (v) {
this.pager.setValue(v);
},
setCount: function (count) { setCount: function (count) {
this.rowCount.setText(count); this.rowCount.setText(count);
this.rowCount.setTitle(count); this.rowCount.setTitle(count);

4
bi/polyfill.js

@ -4,7 +4,7 @@ if(![].indexOf){
* @param {Object} o 要检查的值 * @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1 * @return {Number} o在数组中的索引如果不在数组中则返回-1
*/ */
[].indexOf = function (o) { Array.prototype.indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) { for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) { if (_.isEqual(o, this[i])) {
return i; return i;
@ -20,7 +20,7 @@ if(![].lastIndexOf){
* @param {Object} o 要检查的值 * @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1 * @return {Number} o在数组中的索引如果不在数组中则返回-1
*/ */
[].lastIndexOf = function (o) { Array.prototype.lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) { for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) { if (_.isEqual(o, this[i])) {
return i; return i;

433
bi/widget.js

@ -10957,17 +10957,17 @@ BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW = "MultiSelectCheckSe
BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);/** BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);/**
* Created by zcf_1 on 2017/5/2. * Created by zcf_1 on 2017/5/2.
*/ */
BI.MultiStringList = BI.inherit(BI.Widget, { BI.MultiSelectList = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiStringList.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiSelectList.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-string-list', baseCls: 'bi-multi-select-list',
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
el: {} el: {}
}) })
}, },
_init: function () { _init: function () {
BI.MultiStringList.superclass._init.apply(this, arguments); BI.MultiSelectList.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = {}; this.storeValue = {};
@ -10978,7 +10978,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
this.adapter = BI.createWidget({ this.adapter = BI.createWidget({
type: "bi.multi_select_loader", type: "bi.multi_select_loader",
cls: "popup-multi-string-list bi-border-left bi-border-right bi-border-bottom", cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom",
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
// onLoaded: o.onLoaded, // onLoaded: o.onLoaded,
@ -10990,7 +10990,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
self.fireEvent(BI.MultiStringList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectList.EVENT_CHANGE);
}); });
}); });
@ -11049,7 +11049,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiStringList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectList.EVENT_CHANGE);
}) })
} else { } else {
self._showAdapter(); self._showAdapter();
@ -11150,7 +11150,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
if (!this._allData) { if (!this._allData) {
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_ALL_DATA type: BI.MultiSelectList.REQ_GET_ALL_DATA
}, function (ob) { }, function (ob) {
self._allData = BI.pluck(ob.items, "value"); self._allData = BI.pluck(ob.items, "value");
digest(self._allData); digest(self._allData);
@ -11174,7 +11174,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_ALL_DATA, type: BI.MultiSelectList.REQ_GET_ALL_DATA,
keyword: self.trigger.getKeyword() keyword: self.trigger.getKeyword()
}, function (ob) { }, function (ob) {
var items = BI.pluck(ob.items, "value"); var items = BI.pluck(ob.items, "value");
@ -11211,7 +11211,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
if (!this._count) { if (!this._count) {
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_DATA_LENGTH type: BI.MultiSelectList.REQ_GET_DATA_LENGTH
}, function (res) { }, function (res) {
self._count = res.count; self._count = res.count;
adjust(); adjust();
@ -11294,13 +11294,214 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
} }
}); });
BI.extend(BI.MultiStringList, { BI.extend(BI.MultiSelectList, {
REQ_GET_DATA_LENGTH: 0, REQ_GET_DATA_LENGTH: 0,
REQ_GET_ALL_DATA: -1 REQ_GET_ALL_DATA: -1
}); });
BI.MultiStringList.EVENT_CHANGE = "BI.MultiStringList.EVENT_CHANGE"; BI.MultiSelectList.EVENT_CHANGE = "BI.MultiSelectList.EVENT_CHANGE";
BI.shortcut("bi.multi_string_list", BI.MultiStringList);/** BI.shortcut("bi.multi_select_list", BI.MultiSelectList);/**
* Created by zcf_1 on 2017/5/11.
*/
BI.MultiSelectTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-select-tree',
itemsCreator: BI.emptyFn,
height: 25
})
},
_init: function () {
BI.MultiSelectTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {value: {}};
this.adapter = BI.createWidget({
type: "bi.multi_select_tree_popup",
itemsCreator: o.itemsCreator
});
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
});
this.searcherPane = BI.createWidget({//搜索中的时候用的是parttree,同adapter中的synctree不一样
type: "bi.multi_tree_search_pane",
cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () {
return self.trigger.getKeyword();
},
itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword();
o.itemsCreator(op, callback);
}
});
this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({
type: "bi.searcher",
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback({
keyword: self.trigger.getKeyword()
});
},
adapter: this.adapter,
popup: this.searcherPane,
height: 200,
masker: false,
listeners: [{
eventName: BI.Searcher.EVENT_START,
action: function () {
self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue);
}
}, {
eventName: BI.Searcher.EVENT_STOP,
action: function () {
self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue);
BI.nextTick(function () {
self.adapter.populate();
});
}
}, {
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}
}, {
eventName: BI.Searcher.EVENT_PAUSE,
action: function () {
self._showAdapter();
}
}]
});
BI.createWidget({
type: "bi.vtape",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.trigger,
height: 30
}, {
el: this.adapter,
height: "fill"
}]
});
BI.createWidget({
type: "bi.absolute",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.searcherPane,
top: 30,
bottom: 0,
left: 0,
right: 0
}]
})
},
_showAdapter: function () {
this.adapter.setVisible(true);
this.searcherPane.setVisible(false);
},
_showSearcherPane: function () {
this.searcherPane.setVisible(true);
this.adapter.setVisible(false);
},
resize: function () {
},
setValue: function (v) {
this.storeValue.value = v || {};
this.adapter.setValue({
value: v || {}
});
this.trigger.setValue({
value: v || {}
});
},
getValue: function () {
return this.storeValue.value;
},
populate: function () {
this.trigger.populate.apply(this.trigger, arguments);
this.adapter.populate.apply(this.adapter, arguments);
}
});
BI.MultiSelectTree.EVENT_CHANGE = "BI.MultiSelectTree.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree", BI.MultiSelectTree);/**
* Created by zcf on 2016/12/21.
*/
BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom",
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.async_tree",
height: 400,
element: this,
itemsCreator: o.itemsCreator
});
this.popup.on(BI.TreeView.EVENT_AFTERINIT, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT)
});
this.popup.on(BI.TreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE)
});
},
hasChecked: function () {
return this.popup.hasChecked();
},
getValue: function () {
return this.popup.getValue();
},
setValue: function (v) {
v || (v = {});
this.popup.setValue(v.value);
},
populate: function (config) {
this.popup.stroke(config);
}
});
BI.MultiSelectTreePopup.EVENT_AFTER_INIT = "BI.MultiSelectTreePopup.EVENT_AFTER_INIT";
BI.MultiSelectTreePopup.EVENT_CHANGE = "BI.MultiSelectTreePopup.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree_popup", BI.MultiSelectTreePopup);/**
* *
* @class BI.MultiTreeCheckPane * @class BI.MultiTreeCheckPane
* @extends BI.Pane * @extends BI.Pane
@ -11695,7 +11896,7 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, {
this.selectedValues = {}; this.selectedValues = {};
this.tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.sync_tree", type: "bi.async_tree",
height: 400, height: 400,
cls:"popup-view-tree", cls:"popup-view-tree",
itemsCreator: opts.itemsCreator, itemsCreator: opts.itemsCreator,
@ -12039,208 +12240,7 @@ BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearcher.EVENT_START = "EVENT_START"; BI.MultiTreeSearcher.EVENT_START = "EVENT_START";
BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP"; BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.shortcut('bi.multi_tree_searcher', BI.MultiTreeSearcher);/** BI.shortcut('bi.multi_tree_searcher', BI.MultiTreeSearcher);//小于号的值为:0,小于等于号的值为:1
* Created by zcf_1 on 2017/5/11.
*/
BI.MultiSelectTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo',
itemsCreator: BI.emptyFn,
height: 25
})
},
_init: function () {
BI.MultiSelectTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {value: {}};
this.adapter = BI.createWidget({
type: "bi.multi_select_tree_popup",
itemsCreator: o.itemsCreator
});
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
});
this.searcherPane = BI.createWidget({//搜索中的时候用的是parttree,同adapter中的synctree不一样
type: "bi.multi_tree_search_pane",
cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () {
return self.trigger.getKeyword();
},
itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword();
o.itemsCreator(op, callback);
}
});
this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({
type: "bi.searcher",
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback({
keyword: self.trigger.getKeyword()
});
},
adapter: this.adapter,
popup: this.searcherPane,
height: 200,
masker: false,
listeners: [{
eventName: BI.Searcher.EVENT_START,
action: function () {
self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue);
}
}, {
eventName: BI.Searcher.EVENT_STOP,
action: function () {
self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue);
BI.nextTick(function () {
self.adapter.populate();
});
}
}, {
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}
}, {
eventName: BI.Searcher.EVENT_PAUSE,
action: function () {
self._showAdapter();
}
}]
});
BI.createWidget({
type: "bi.vtape",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.trigger,
height: 30
}, {
el: this.adapter,
height: "fill"
}]
});
BI.createWidget({
type: "bi.absolute",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.searcherPane,
top: 30,
bottom: 0,
left: 0,
right: 0
}]
})
},
_showAdapter: function () {
this.adapter.setVisible(true);
this.searcherPane.setVisible(false);
},
_showSearcherPane: function () {
this.searcherPane.setVisible(true);
this.adapter.setVisible(false);
},
resize: function () {
},
setValue: function (v) {
this.storeValue.value = v || {};
this.adapter.setValue({
value: v || {}
});
this.trigger.setValue({
value: v || {}
});
},
getValue: function () {
return this.storeValue.value;
},
populate: function () {
this.trigger.populate.apply(this.trigger, arguments);
this.adapter.populate.apply(this.adapter, arguments);
}
});
BI.MultiSelectTree.EVENT_CHANGE = "BI.MultiSelectTree.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree", BI.MultiSelectTree);/**
* Created by zcf on 2016/12/21.
*/
BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tree-list-popup bi-border-left bi-border-right bi-border-bottom",
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.sync_tree",
height: 400,
element: this,
itemsCreator: o.itemsCreator
});
this.popup.on(BI.TreeView.EVENT_AFTERINIT, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT)
});
this.popup.on(BI.TreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE)
});
},
hasChecked: function () {
return this.popup.hasChecked();
},
getValue: function () {
return this.popup.getValue();
},
setValue: function (v) {
v || (v = {});
this.popup.setValue(v.value);
},
populate: function (config) {
this.popup.stroke(config);
}
});
BI.MultiSelectTreePopup.EVENT_AFTER_INIT = "BI.MultiSelectTreePopup.EVENT_AFTER_INIT";
BI.MultiSelectTreePopup.EVENT_CHANGE = "BI.MultiSelectTreePopup.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree_popup", BI.MultiSelectTreePopup);//小于号的值为:0,小于等于号的值为:1
//closeMIn:最小值的符号,closeMax:最大值的符号 //closeMIn:最小值的符号,closeMax:最大值的符号
/** /**
* Created by roy on 15/9/17. * Created by roy on 15/9/17.
@ -15964,6 +15964,7 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
}, },
setVPage: function (v) { setVPage: function (v) {
v = v < 1 ? 1 : v;
var o = this.options; var o = this.options;
this.start = (v - 1) * o.pageSize + 1; this.start = (v - 1) * o.pageSize + 1;
}, },

2
demo/js/config/base.js

@ -76,7 +76,7 @@ Demo.BASE_CONFIG = [{
value: "demo.tree_view" value: "demo.tree_view"
}, { }, {
pId: 203, pId: 203,
text: "bi.sync_tree", text: "bi.async_tree",
value: "demo.sync_tree" value: "demo.sync_tree"
}, { }, {
pId: 203, pId: 203,

82
docs/base.js

@ -781,7 +781,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
//之后的300ms点击无效 //之后的300ms点击无效
var onClick = BI.debounce(this.doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true);
function ev(e) { function ev(e) {
if (o.stopEvent) { if (o.stopEvent) {
@ -803,6 +803,11 @@ BI.BasicButton = BI.inherit(BI.Single, {
_trigger: function () { _trigger: function () {
var o = this.options; var o = this.options;
if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) :
this.setSelected(!this.isSelected()));
}
if (this.isValid()) { if (this.isValid()) {
o.handler.call(this, this.getValue(), this); o.handler.call(this, this.getValue(), this);
var v = this.getValue(); var v = this.getValue();
@ -811,13 +816,15 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
}, },
doClick: function () { _doClick: function () {
if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) :
this.setSelected(!this.isSelected()));
}
this._trigger(); this._trigger();
if (this.isValid()) {
this.doClick();
}
},
doClick: function () {
}, },
handle: function () { handle: function () {
@ -1956,6 +1963,12 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
}, },
getExpandedValue: function(){
if (!this.nodes) {
return null;
}
},
refresh: function () { refresh: function () {
this.nodes && this.nodes.refresh(); this.nodes && this.nodes.refresh();
}, },
@ -1991,15 +2004,15 @@ BI.TreeView.EVENT_AFTERINIT = BI.Events.AFTERINIT;
BI.shortcut("bi.tree_view", BI.TreeView);/** BI.shortcut("bi.tree_view", BI.TreeView);/**
* guy * guy
* 同步树 * 同步树
* @class BI.SyncTree * @class BI.AsyncTree
* @extends BI.TreeView * @extends BI.TreeView
*/ */
BI.SyncTree = BI.inherit(BI.TreeView, { BI.AsyncTree = BI.inherit(BI.TreeView, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.SyncTree.superclass._defaultConfig.apply(this, arguments), {}) return BI.extend(BI.AsyncTree.superclass._defaultConfig.apply(this, arguments), {})
}, },
_init: function () { _init: function () {
BI.SyncTree.superclass._init.apply(this, arguments); BI.AsyncTree.superclass._init.apply(this, arguments);
}, },
//配置属性 //配置属性
@ -2069,7 +2082,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
function beforeExpand(treeId, treeNode) { function beforeExpand(treeId, treeNode) {
self._expandNode(treeId, treeNode); self._beforeExpandNode(treeId, treeNode);
} }
function onCheck(event, treeId, treeNode) { function onCheck(event, treeId, treeNode) {
@ -2090,7 +2103,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
_selectTreeNode: function (treeId, treeNode) { _selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
} else { } else {
@ -2109,11 +2122,11 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
} }
} }
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}, },
//展开节点 //展开节点
_expandNode: function (treeId, treeNode) { _beforeExpandNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, { var op = BI.extend({}, o.paras, {
@ -2168,7 +2181,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
}, },
hasChecked: function () { hasChecked: function () {
return !BI.isEmpty(this.selectedValues) || BI.SyncTree.superclass.hasChecked.apply(this, arguments); return !BI.isEmpty(this.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments);
}, },
getValue: function () { getValue: function () {
@ -2196,13 +2209,13 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
}); });
BI.shortcut("bi.sync_tree", BI.SyncTree);/** BI.shortcut("bi.async_tree", BI.AsyncTree);/**
* guy * guy
* 局部树两个请求树 第一个请求构造树第二个请求获取节点 * 局部树两个请求树 第一个请求构造树第二个请求获取节点
* @class BI.PartTree * @class BI.PartTree
* @extends BI.SyncTree * @extends BI.AsyncTree
*/ */
BI.PartTree = BI.inherit(BI.SyncTree, { BI.PartTree = BI.inherit(BI.AsyncTree, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {}) return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {})
}, },
@ -2241,7 +2254,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode)
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} else { } else {
o.itemsCreator(BI.extend({}, o.paras, { o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA, type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA,
@ -2266,7 +2279,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
} }
} }
self.selectedValues = new_values; self.selectedValues = new_values;
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}); });
} }
}, },
@ -2777,6 +2790,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
_populate: function (items) { _populate: function (items) {
var o = this.options; var o = this.options;
this._reRange();
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items; this.options.items = items;
this._calculateSizeAndPositionData(); this._calculateSizeAndPositionData();
@ -2850,7 +2864,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}, },
//重新计算children //重新计算children
reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },
@ -14873,6 +14887,7 @@ BI.GridView = BI.inherit(BI.Widget, {
_populate: function (items) { _populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
this._reRange();
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items; this.options.items = items;
} }
@ -14961,7 +14976,7 @@ BI.GridView = BI.inherit(BI.Widget, {
}, },
//重新计算children //重新计算children
reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },
@ -28993,7 +29008,6 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
return; return;
} }
if (this._isNeedDigest === true) { if (this._isNeedDigest === true) {
this._reRange();
this._digest(); this._digest();
} }
this._isNeedDigest = false; this._isNeedDigest = false;
@ -29091,13 +29105,6 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.bottomRightCollection.restore(); this.bottomRightCollection.restore();
}, },
_reRange: function () {
this.topLeftCollection.reRange();
this.topRightCollection.reRange();
this.bottomLeftCollection.reRange();
this.bottomRightCollection.reRange();
},
restore: function () { restore: function () {
this._restore(); this._restore();
} }
@ -29710,10 +29717,6 @@ BI.GridTable = BI.inherit(BI.Widget, {
if (this._width <= 0 || this._height <= 0) { if (this._width <= 0 || this._height <= 0) {
return; return;
} }
if (this._isNeedDigest === true) {
this._reRange();
this._isNeedDigest = false;
}
this._populateTable(); this._populateTable();
this._populateScrollbar(); this._populateScrollbar();
}, },
@ -29789,13 +29792,11 @@ BI.GridTable = BI.inherit(BI.Widget, {
populate: function (items, header) { populate: function (items, header) {
if (items && this.options.items !== items) { if (items && this.options.items !== items) {
this._isNeedDigest = true;
this.options.items = items; this.options.items = items;
this.items = this._getItems(); this.items = this._getItems();
this._restore(); this._restore();
} }
if (header && this.options.header !== header) { if (header && this.options.header !== header) {
this._isNeedDigest = true;
this.options.header = header; this.options.header = header;
this.header = this._getHeader(); this.header = this._getHeader();
this._restore(); this._restore();
@ -29810,13 +29811,6 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid.restore(); this.bottomRightGrid.restore();
}, },
_reRange: function () {
this.topLeftGrid.reRange();
this.topRightGrid.reRange();
this.bottomLeftGrid.reRange();
this.bottomRightGrid.reRange();
},
restore: function () { restore: function () {
this._restore(); this._restore();
} }

4
docs/case.js

@ -7951,6 +7951,10 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
this.pager.setValue(v); this.pager.setValue(v);
}, },
setVPage: function (v) {
this.pager.setValue(v);
},
setCount: function (count) { setCount: function (count) {
this.rowCount.setText(count); this.rowCount.setText(count);
this.rowCount.setTitle(count); this.rowCount.setTitle(count);

2
docs/demo.js

@ -2755,7 +2755,7 @@ BI.shortcut("demo.value_chooser_combo", Demo.ValueChooserCombo);Demo.BASE_CONFIG
value: "demo.tree_view" value: "demo.tree_view"
}, { }, {
pId: 203, pId: 203,
text: "bi.sync_tree", text: "bi.async_tree",
value: "demo.sync_tree" value: "demo.sync_tree"
}, { }, {
pId: 203, pId: 203,

4
docs/polyfill.js

@ -4,7 +4,7 @@ if(![].indexOf){
* @param {Object} o 要检查的值 * @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1 * @return {Number} o在数组中的索引如果不在数组中则返回-1
*/ */
[].indexOf = function (o) { Array.prototype.indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) { for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) { if (_.isEqual(o, this[i])) {
return i; return i;
@ -20,7 +20,7 @@ if(![].lastIndexOf){
* @param {Object} o 要检查的值 * @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1 * @return {Number} o在数组中的索引如果不在数组中则返回-1
*/ */
[].lastIndexOf = function (o) { Array.prototype.lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) { for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) { if (_.isEqual(o, this[i])) {
return i; return i;

433
docs/widget.js

@ -10957,17 +10957,17 @@ BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW = "MultiSelectCheckSe
BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);/** BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);/**
* Created by zcf_1 on 2017/5/2. * Created by zcf_1 on 2017/5/2.
*/ */
BI.MultiStringList = BI.inherit(BI.Widget, { BI.MultiSelectList = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiStringList.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiSelectList.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-string-list', baseCls: 'bi-multi-select-list',
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
el: {} el: {}
}) })
}, },
_init: function () { _init: function () {
BI.MultiStringList.superclass._init.apply(this, arguments); BI.MultiSelectList.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = {}; this.storeValue = {};
@ -10978,7 +10978,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
this.adapter = BI.createWidget({ this.adapter = BI.createWidget({
type: "bi.multi_select_loader", type: "bi.multi_select_loader",
cls: "popup-multi-string-list bi-border-left bi-border-right bi-border-bottom", cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom",
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
// onLoaded: o.onLoaded, // onLoaded: o.onLoaded,
@ -10990,7 +10990,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
self.fireEvent(BI.MultiStringList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectList.EVENT_CHANGE);
}); });
}); });
@ -11049,7 +11049,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiStringList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectList.EVENT_CHANGE);
}) })
} else { } else {
self._showAdapter(); self._showAdapter();
@ -11150,7 +11150,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
if (!this._allData) { if (!this._allData) {
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_ALL_DATA type: BI.MultiSelectList.REQ_GET_ALL_DATA
}, function (ob) { }, function (ob) {
self._allData = BI.pluck(ob.items, "value"); self._allData = BI.pluck(ob.items, "value");
digest(self._allData); digest(self._allData);
@ -11174,7 +11174,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_ALL_DATA, type: BI.MultiSelectList.REQ_GET_ALL_DATA,
keyword: self.trigger.getKeyword() keyword: self.trigger.getKeyword()
}, function (ob) { }, function (ob) {
var items = BI.pluck(ob.items, "value"); var items = BI.pluck(ob.items, "value");
@ -11211,7 +11211,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
if (!this._count) { if (!this._count) {
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_DATA_LENGTH type: BI.MultiSelectList.REQ_GET_DATA_LENGTH
}, function (res) { }, function (res) {
self._count = res.count; self._count = res.count;
adjust(); adjust();
@ -11294,13 +11294,214 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
} }
}); });
BI.extend(BI.MultiStringList, { BI.extend(BI.MultiSelectList, {
REQ_GET_DATA_LENGTH: 0, REQ_GET_DATA_LENGTH: 0,
REQ_GET_ALL_DATA: -1 REQ_GET_ALL_DATA: -1
}); });
BI.MultiStringList.EVENT_CHANGE = "BI.MultiStringList.EVENT_CHANGE"; BI.MultiSelectList.EVENT_CHANGE = "BI.MultiSelectList.EVENT_CHANGE";
BI.shortcut("bi.multi_string_list", BI.MultiStringList);/** BI.shortcut("bi.multi_select_list", BI.MultiSelectList);/**
* Created by zcf_1 on 2017/5/11.
*/
BI.MultiSelectTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-select-tree',
itemsCreator: BI.emptyFn,
height: 25
})
},
_init: function () {
BI.MultiSelectTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {value: {}};
this.adapter = BI.createWidget({
type: "bi.multi_select_tree_popup",
itemsCreator: o.itemsCreator
});
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
});
this.searcherPane = BI.createWidget({//搜索中的时候用的是parttree,同adapter中的synctree不一样
type: "bi.multi_tree_search_pane",
cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () {
return self.trigger.getKeyword();
},
itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword();
o.itemsCreator(op, callback);
}
});
this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({
type: "bi.searcher",
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback({
keyword: self.trigger.getKeyword()
});
},
adapter: this.adapter,
popup: this.searcherPane,
height: 200,
masker: false,
listeners: [{
eventName: BI.Searcher.EVENT_START,
action: function () {
self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue);
}
}, {
eventName: BI.Searcher.EVENT_STOP,
action: function () {
self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue);
BI.nextTick(function () {
self.adapter.populate();
});
}
}, {
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}
}, {
eventName: BI.Searcher.EVENT_PAUSE,
action: function () {
self._showAdapter();
}
}]
});
BI.createWidget({
type: "bi.vtape",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.trigger,
height: 30
}, {
el: this.adapter,
height: "fill"
}]
});
BI.createWidget({
type: "bi.absolute",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.searcherPane,
top: 30,
bottom: 0,
left: 0,
right: 0
}]
})
},
_showAdapter: function () {
this.adapter.setVisible(true);
this.searcherPane.setVisible(false);
},
_showSearcherPane: function () {
this.searcherPane.setVisible(true);
this.adapter.setVisible(false);
},
resize: function () {
},
setValue: function (v) {
this.storeValue.value = v || {};
this.adapter.setValue({
value: v || {}
});
this.trigger.setValue({
value: v || {}
});
},
getValue: function () {
return this.storeValue.value;
},
populate: function () {
this.trigger.populate.apply(this.trigger, arguments);
this.adapter.populate.apply(this.adapter, arguments);
}
});
BI.MultiSelectTree.EVENT_CHANGE = "BI.MultiSelectTree.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree", BI.MultiSelectTree);/**
* Created by zcf on 2016/12/21.
*/
BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom",
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.async_tree",
height: 400,
element: this,
itemsCreator: o.itemsCreator
});
this.popup.on(BI.TreeView.EVENT_AFTERINIT, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT)
});
this.popup.on(BI.TreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE)
});
},
hasChecked: function () {
return this.popup.hasChecked();
},
getValue: function () {
return this.popup.getValue();
},
setValue: function (v) {
v || (v = {});
this.popup.setValue(v.value);
},
populate: function (config) {
this.popup.stroke(config);
}
});
BI.MultiSelectTreePopup.EVENT_AFTER_INIT = "BI.MultiSelectTreePopup.EVENT_AFTER_INIT";
BI.MultiSelectTreePopup.EVENT_CHANGE = "BI.MultiSelectTreePopup.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree_popup", BI.MultiSelectTreePopup);/**
* *
* @class BI.MultiTreeCheckPane * @class BI.MultiTreeCheckPane
* @extends BI.Pane * @extends BI.Pane
@ -11695,7 +11896,7 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, {
this.selectedValues = {}; this.selectedValues = {};
this.tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.sync_tree", type: "bi.async_tree",
height: 400, height: 400,
cls:"popup-view-tree", cls:"popup-view-tree",
itemsCreator: opts.itemsCreator, itemsCreator: opts.itemsCreator,
@ -12039,208 +12240,7 @@ BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearcher.EVENT_START = "EVENT_START"; BI.MultiTreeSearcher.EVENT_START = "EVENT_START";
BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP"; BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.shortcut('bi.multi_tree_searcher', BI.MultiTreeSearcher);/** BI.shortcut('bi.multi_tree_searcher', BI.MultiTreeSearcher);//小于号的值为:0,小于等于号的值为:1
* Created by zcf_1 on 2017/5/11.
*/
BI.MultiSelectTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo',
itemsCreator: BI.emptyFn,
height: 25
})
},
_init: function () {
BI.MultiSelectTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.storeValue = {value: {}};
this.adapter = BI.createWidget({
type: "bi.multi_select_tree_popup",
itemsCreator: o.itemsCreator
});
this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
});
this.searcherPane = BI.createWidget({//搜索中的时候用的是parttree,同adapter中的synctree不一样
type: "bi.multi_tree_search_pane",
cls: "bi-border-left bi-border-right bi-border-bottom",
keywordGetter: function () {
return self.trigger.getKeyword();
},
itemsCreator: function (op, callback) {
op.keyword = self.trigger.getKeyword();
o.itemsCreator(op, callback);
}
});
this.searcherPane.setVisible(false);
this.trigger = BI.createWidget({
type: "bi.searcher",
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback({
keyword: self.trigger.getKeyword()
});
},
adapter: this.adapter,
popup: this.searcherPane,
height: 200,
masker: false,
listeners: [{
eventName: BI.Searcher.EVENT_START,
action: function () {
self._showSearcherPane();
self.storeValue = {value: self.adapter.getValue()};
self.searcherPane.setValue(self.storeValue);
}
}, {
eventName: BI.Searcher.EVENT_STOP,
action: function () {
self._showAdapter();
// self.storeValue = {value: self.searcherPane.getValue()};
self.adapter.setValue(self.storeValue);
BI.nextTick(function () {
self.adapter.populate();
});
}
}, {
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
if (self.trigger.isSearching()) {
self.storeValue = {value: self.searcherPane.getValue()};
} else {
self.storeValue = {value: self.adapter.getValue()};
}
self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE);
}
}, {
eventName: BI.Searcher.EVENT_PAUSE,
action: function () {
self._showAdapter();
}
}]
});
BI.createWidget({
type: "bi.vtape",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.trigger,
height: 30
}, {
el: this.adapter,
height: "fill"
}]
});
BI.createWidget({
type: "bi.absolute",
element: this,
height: "100%",
width: "100%",
items: [{
el: this.searcherPane,
top: 30,
bottom: 0,
left: 0,
right: 0
}]
})
},
_showAdapter: function () {
this.adapter.setVisible(true);
this.searcherPane.setVisible(false);
},
_showSearcherPane: function () {
this.searcherPane.setVisible(true);
this.adapter.setVisible(false);
},
resize: function () {
},
setValue: function (v) {
this.storeValue.value = v || {};
this.adapter.setValue({
value: v || {}
});
this.trigger.setValue({
value: v || {}
});
},
getValue: function () {
return this.storeValue.value;
},
populate: function () {
this.trigger.populate.apply(this.trigger, arguments);
this.adapter.populate.apply(this.adapter, arguments);
}
});
BI.MultiSelectTree.EVENT_CHANGE = "BI.MultiSelectTree.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree", BI.MultiSelectTree);/**
* Created by zcf on 2016/12/21.
*/
BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tree-list-popup bi-border-left bi-border-right bi-border-bottom",
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.popup = BI.createWidget({
type: "bi.sync_tree",
height: 400,
element: this,
itemsCreator: o.itemsCreator
});
this.popup.on(BI.TreeView.EVENT_AFTERINIT, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT)
});
this.popup.on(BI.TreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE)
});
},
hasChecked: function () {
return this.popup.hasChecked();
},
getValue: function () {
return this.popup.getValue();
},
setValue: function (v) {
v || (v = {});
this.popup.setValue(v.value);
},
populate: function (config) {
this.popup.stroke(config);
}
});
BI.MultiSelectTreePopup.EVENT_AFTER_INIT = "BI.MultiSelectTreePopup.EVENT_AFTER_INIT";
BI.MultiSelectTreePopup.EVENT_CHANGE = "BI.MultiSelectTreePopup.EVENT_CHANGE";
BI.shortcut("bi.multi_select_tree_popup", BI.MultiSelectTreePopup);//小于号的值为:0,小于等于号的值为:1
//closeMIn:最小值的符号,closeMax:最大值的符号 //closeMIn:最小值的符号,closeMax:最大值的符号
/** /**
* Created by roy on 15/9/17. * Created by roy on 15/9/17.
@ -15964,6 +15964,7 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
}, },
setVPage: function (v) { setVPage: function (v) {
v = v < 1 ? 1 : v;
var o = this.options; var o = this.options;
this.start = (v - 1) * o.pageSize + 1; this.start = (v - 1) * o.pageSize + 1;
}, },

3
src/base/collection/collection.js

@ -267,6 +267,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
_populate: function (items) { _populate: function (items) {
var o = this.options; var o = this.options;
this._reRange();
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items; this.options.items = items;
this._calculateSizeAndPositionData(); this._calculateSizeAndPositionData();
@ -340,7 +341,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}, },
//重新计算children //重新计算children
reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },

3
src/base/grid/grid.js

@ -223,6 +223,7 @@ BI.GridView = BI.inherit(BI.Widget, {
_populate: function (items) { _populate: function (items) {
var self = this, o = this.options; var self = this, o = this.options;
this._reRange();
if (items && items !== this.options.items) { if (items && items !== this.options.items) {
this.options.items = items; this.options.items = items;
} }
@ -311,7 +312,7 @@ BI.GridView = BI.inherit(BI.Widget, {
}, },
//重新计算children //重新计算children
reRange: function () { _reRange: function () {
this.renderRange = {}; this.renderRange = {};
}, },

21
src/base/single/button/button.basic.js

@ -198,7 +198,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
//之后的300ms点击无效 //之后的300ms点击无效
var onClick = BI.debounce(this.doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true);
function ev(e) { function ev(e) {
if (o.stopEvent) { if (o.stopEvent) {
@ -220,6 +220,11 @@ BI.BasicButton = BI.inherit(BI.Single, {
_trigger: function () { _trigger: function () {
var o = this.options; var o = this.options;
if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) :
this.setSelected(!this.isSelected()));
}
if (this.isValid()) { if (this.isValid()) {
o.handler.call(this, this.getValue(), this); o.handler.call(this, this.getValue(), this);
var v = this.getValue(); var v = this.getValue();
@ -228,13 +233,15 @@ BI.BasicButton = BI.inherit(BI.Single, {
} }
}, },
doClick: function () { _doClick: function () {
if (!this.isDisableSelected()) {
this.isForceSelected() ? this.setSelected(true) :
(this.isForceNotSelected() ? this.setSelected(false) :
this.setSelected(!this.isSelected()));
}
this._trigger(); this._trigger();
if (this.isValid()) {
this.doClick();
}
},
doClick: function () {
}, },
handle: function () { handle: function () {

8
src/base/table/table.collection.js

@ -429,7 +429,6 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
return; return;
} }
if (this._isNeedDigest === true) { if (this._isNeedDigest === true) {
this._reRange();
this._digest(); this._digest();
} }
this._isNeedDigest = false; this._isNeedDigest = false;
@ -527,13 +526,6 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
this.bottomRightCollection.restore(); this.bottomRightCollection.restore();
}, },
_reRange: function () {
this.topLeftCollection.reRange();
this.topRightCollection.reRange();
this.bottomLeftCollection.reRange();
this.bottomRightCollection.reRange();
},
restore: function () { restore: function () {
this._restore(); this._restore();
} }

13
src/base/table/table.grid.js

@ -357,10 +357,6 @@ BI.GridTable = BI.inherit(BI.Widget, {
if (this._width <= 0 || this._height <= 0) { if (this._width <= 0 || this._height <= 0) {
return; return;
} }
if (this._isNeedDigest === true) {
this._reRange();
this._isNeedDigest = false;
}
this._populateTable(); this._populateTable();
this._populateScrollbar(); this._populateScrollbar();
}, },
@ -436,13 +432,11 @@ BI.GridTable = BI.inherit(BI.Widget, {
populate: function (items, header) { populate: function (items, header) {
if (items && this.options.items !== items) { if (items && this.options.items !== items) {
this._isNeedDigest = true;
this.options.items = items; this.options.items = items;
this.items = this._getItems(); this.items = this._getItems();
this._restore(); this._restore();
} }
if (header && this.options.header !== header) { if (header && this.options.header !== header) {
this._isNeedDigest = true;
this.options.header = header; this.options.header = header;
this.header = this._getHeader(); this.header = this._getHeader();
this._restore(); this._restore();
@ -457,13 +451,6 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.bottomRightGrid.restore(); this.bottomRightGrid.restore();
}, },
_reRange: function () {
this.topLeftGrid.reRange();
this.topRightGrid.reRange();
this.bottomLeftGrid.reRange();
this.bottomRightGrid.reRange();
},
restore: function () { restore: function () {
this._restore(); this._restore();
} }

20
src/base/tree/synctree.js → src/base/tree/asynctree.js

@ -1,15 +1,15 @@
/** /**
* guy * guy
* 同步树 * 同步树
* @class BI.SyncTree * @class BI.AsyncTree
* @extends BI.TreeView * @extends BI.TreeView
*/ */
BI.SyncTree = BI.inherit(BI.TreeView, { BI.AsyncTree = BI.inherit(BI.TreeView, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.SyncTree.superclass._defaultConfig.apply(this, arguments), {}) return BI.extend(BI.AsyncTree.superclass._defaultConfig.apply(this, arguments), {})
}, },
_init: function () { _init: function () {
BI.SyncTree.superclass._init.apply(this, arguments); BI.AsyncTree.superclass._init.apply(this, arguments);
}, },
//配置属性 //配置属性
@ -79,7 +79,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
function beforeExpand(treeId, treeNode) { function beforeExpand(treeId, treeNode) {
self._expandNode(treeId, treeNode); self._beforeExpandNode(treeId, treeNode);
} }
function onCheck(event, treeId, treeNode) { function onCheck(event, treeId, treeNode) {
@ -100,7 +100,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
_selectTreeNode: function (treeId, treeNode) { _selectTreeNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode)); var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode);
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
} else { } else {
@ -119,11 +119,11 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
} }
} }
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}, },
//展开节点 //展开节点
_expandNode: function (treeId, treeNode) { _beforeExpandNode: function (treeId, treeNode) {
var self = this, o = this.options; var self = this, o = this.options;
var parentValues = treeNode.parentValues || self._getParentValues(treeNode); var parentValues = treeNode.parentValues || self._getParentValues(treeNode);
var op = BI.extend({}, o.paras, { var op = BI.extend({}, o.paras, {
@ -178,7 +178,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
}, },
hasChecked: function () { hasChecked: function () {
return !BI.isEmpty(this.selectedValues) || BI.SyncTree.superclass.hasChecked.apply(this, arguments); return !BI.isEmpty(this.selectedValues) || BI.AsyncTree.superclass.hasChecked.apply(this, arguments);
}, },
getValue: function () { getValue: function () {
@ -206,4 +206,4 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
} }
}); });
BI.shortcut("bi.sync_tree", BI.SyncTree); BI.shortcut("bi.async_tree", BI.AsyncTree);

8
src/base/tree/parttree.js

@ -2,9 +2,9 @@
* guy * guy
* 局部树两个请求树 第一个请求构造树第二个请求获取节点 * 局部树两个请求树 第一个请求构造树第二个请求获取节点
* @class BI.PartTree * @class BI.PartTree
* @extends BI.SyncTree * @extends BI.AsyncTree
*/ */
BI.PartTree = BI.inherit(BI.SyncTree, { BI.PartTree = BI.inherit(BI.AsyncTree, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {}) return BI.extend(BI.PartTree.superclass._defaultConfig.apply(this, arguments), {})
}, },
@ -43,7 +43,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
var name = this._getNodeValue(treeNode) var name = this._getNodeValue(treeNode)
// var values = parentValues.concat([name]); // var values = parentValues.concat([name]);
if (treeNode.checked === true) { if (treeNode.checked === true) {
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
} else { } else {
o.itemsCreator(BI.extend({}, o.paras, { o.itemsCreator(BI.extend({}, o.paras, {
type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA, type: BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA,
@ -68,7 +68,7 @@ BI.PartTree = BI.inherit(BI.SyncTree, {
} }
} }
self.selectedValues = new_values; self.selectedValues = new_values;
BI.SyncTree.superclass._selectTreeNode.apply(self, arguments); BI.AsyncTree.superclass._selectTreeNode.apply(self, arguments);
}); });
} }
}, },

6
src/base/tree/treeview.js

@ -469,6 +469,12 @@ BI.TreeView = BI.inherit(BI.Pane, {
}); });
}, },
getExpandedValue: function(){
if (!this.nodes) {
return null;
}
},
refresh: function () { refresh: function () {
this.nodes && this.nodes.refresh(); this.nodes && this.nodes.refresh();
}, },

4
src/case/pager/pager.all.count.js

@ -132,6 +132,10 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
this.pager.setValue(v); this.pager.setValue(v);
}, },
setVPage: function (v) {
this.pager.setValue(v);
},
setCount: function (count) { setCount: function (count) {
this.rowCount.setText(count); this.rowCount.setText(count);
this.rowCount.setTitle(count); this.rowCount.setTitle(count);

4
src/less/widget/multistringlist/multistringlist.less

@ -1,5 +1,5 @@
@import "../../bibase"; @import "../../bibase";
.bi-multi-string-list{ .bi-multi-select-list{
& .popup-multi-string-list{ & .popup-multi-select-list{
} }
} }

4
src/polyfill/array.js

@ -4,7 +4,7 @@ if(![].indexOf){
* @param {Object} o 要检查的值 * @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1 * @return {Number} o在数组中的索引如果不在数组中则返回-1
*/ */
[].indexOf = function (o) { Array.prototype.indexOf = function (o) {
for (var i = 0, len = this.length; i < len; i++) { for (var i = 0, len = this.length; i < len; i++) {
if (_.isEqual(o, this[i])) { if (_.isEqual(o, this[i])) {
return i; return i;
@ -20,7 +20,7 @@ if(![].lastIndexOf){
* @param {Object} o 要检查的值 * @param {Object} o 要检查的值
* @return {Number} o在数组中的索引如果不在数组中则返回-1 * @return {Number} o在数组中的索引如果不在数组中则返回-1
*/ */
[].lastIndexOf = function (o) { Array.prototype.lastIndexOf = function (o) {
for (var len = this.length, i = len - 1; i >= 0; i--) { for (var len = this.length, i = len - 1; i >= 0; i--) {
if (_.isEqual(o, this[i])) { if (_.isEqual(o, this[i])) {
return i; return i;

26
src/widget/multistringlist/multistringlist.js → src/widget/multiselectlist/multiselectlist.js

@ -1,17 +1,17 @@
/** /**
* Created by zcf_1 on 2017/5/2. * Created by zcf_1 on 2017/5/2.
*/ */
BI.MultiStringList = BI.inherit(BI.Widget, { BI.MultiSelectList = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiStringList.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiSelectList.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-string-list', baseCls: 'bi-multi-select-list',
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
el: {} el: {}
}) })
}, },
_init: function () { _init: function () {
BI.MultiStringList.superclass._init.apply(this, arguments); BI.MultiSelectList.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = {}; this.storeValue = {};
@ -22,7 +22,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
this.adapter = BI.createWidget({ this.adapter = BI.createWidget({
type: "bi.multi_select_loader", type: "bi.multi_select_loader",
cls: "popup-multi-string-list bi-border-left bi-border-right bi-border-bottom", cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom",
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
// onLoaded: o.onLoaded, // onLoaded: o.onLoaded,
@ -34,7 +34,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
self.storeValue = this.getValue(); self.storeValue = this.getValue();
self._adjust(function () { self._adjust(function () {
assertShowValue(); assertShowValue();
self.fireEvent(BI.MultiStringList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectList.EVENT_CHANGE);
}); });
}); });
@ -93,7 +93,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiStringList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectList.EVENT_CHANGE);
}) })
} else { } else {
self._showAdapter(); self._showAdapter();
@ -194,7 +194,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
if (!this._allData) { if (!this._allData) {
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_ALL_DATA type: BI.MultiSelectList.REQ_GET_ALL_DATA
}, function (ob) { }, function (ob) {
self._allData = BI.pluck(ob.items, "value"); self._allData = BI.pluck(ob.items, "value");
digest(self._allData); digest(self._allData);
@ -218,7 +218,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
this._assertValue(res); this._assertValue(res);
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_ALL_DATA, type: BI.MultiSelectList.REQ_GET_ALL_DATA,
keyword: self.trigger.getKeyword() keyword: self.trigger.getKeyword()
}, function (ob) { }, function (ob) {
var items = BI.pluck(ob.items, "value"); var items = BI.pluck(ob.items, "value");
@ -255,7 +255,7 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
if (!this._count) { if (!this._count) {
o.itemsCreator({ o.itemsCreator({
type: BI.MultiStringList.REQ_GET_DATA_LENGTH type: BI.MultiSelectList.REQ_GET_DATA_LENGTH
}, function (res) { }, function (res) {
self._count = res.count; self._count = res.count;
adjust(); adjust();
@ -338,10 +338,10 @@ BI.MultiStringList = BI.inherit(BI.Widget, {
} }
}); });
BI.extend(BI.MultiStringList, { BI.extend(BI.MultiSelectList, {
REQ_GET_DATA_LENGTH: 0, REQ_GET_DATA_LENGTH: 0,
REQ_GET_ALL_DATA: -1 REQ_GET_ALL_DATA: -1
}); });
BI.MultiStringList.EVENT_CHANGE = "BI.MultiStringList.EVENT_CHANGE"; BI.MultiSelectList.EVENT_CHANGE = "BI.MultiSelectList.EVENT_CHANGE";
BI.shortcut("bi.multi_string_list", BI.MultiStringList); BI.shortcut("bi.multi_select_list", BI.MultiSelectList);

2
src/widget/multitreelist/multitreelist.js → src/widget/multiselecttree/multiselecttree.js

@ -4,7 +4,7 @@
BI.MultiSelectTree = BI.inherit(BI.Widget, { BI.MultiSelectTree = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo', baseCls: 'bi-multi-select-tree',
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
height: 25 height: 25
}) })

4
src/widget/multitreelist/multitreelist.popup.js → src/widget/multiselecttree/multiselecttree.popup.js

@ -4,7 +4,7 @@
BI.MultiSelectTreePopup = BI.inherit(BI.Widget, { BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tree-list-popup bi-border-left bi-border-right bi-border-bottom", baseCls: "bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom",
itemsCreator: BI.emptyFn itemsCreator: BI.emptyFn
}); });
}, },
@ -12,7 +12,7 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
BI.MultiSelectTreePopup.superclass._init.apply(this, arguments); BI.MultiSelectTreePopup.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.popup = BI.createWidget({ this.popup = BI.createWidget({
type: "bi.sync_tree", type: "bi.async_tree",
height: 400, height: 400,
element: this, element: this,
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator

2
src/widget/multitree/multi.tree.popup.js

@ -23,7 +23,7 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, {
this.selectedValues = {}; this.selectedValues = {};
this.tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.sync_tree", type: "bi.async_tree",
height: 400, height: 400,
cls:"popup-view-tree", cls:"popup-view-tree",
itemsCreator: opts.itemsCreator, itemsCreator: opts.itemsCreator,

1
src/widget/sequencetable/listnumber.sequencetable.js

@ -211,6 +211,7 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
}, },
setVPage: function (v) { setVPage: function (v) {
v = v < 1 ? 1 : v;
var o = this.options; var o = this.options;
this.start = (v - 1) * o.pageSize + 1; this.start = (v - 1) * o.pageSize + 1;
}, },

Loading…
Cancel
Save