guy 8 years ago
parent
commit
aa133f3f06
  1. 4
      Gruntfile.js
  2. 34
      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. 34
      docs/base.js
  8. 4
      docs/case.js
  9. 2
      docs/demo.js
  10. 4
      docs/polyfill.js
  11. 433
      docs/widget.js
  12. 20
      src/base/tree/asynctree.js
  13. 8
      src/base/tree/parttree.js
  14. 6
      src/base/tree/treeview.js
  15. 4
      src/case/pager/pager.all.count.js
  16. 4
      src/less/widget/multistringlist/multistringlist.less
  17. 4
      src/polyfill/array.js
  18. 26
      src/widget/multiselectlist/multiselectlist.js
  19. 2
      src/widget/multiselecttree/multiselecttree.js
  20. 4
      src/widget/multiselecttree/multiselecttree.popup.js
  21. 2
      src/widget/multitree/multi.tree.popup.js
  22. 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'
], ],

34
bi/base.js

@ -1956,6 +1956,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 +1997,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 +2075,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 +2096,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 +2115,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 +2174,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 +2202,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 +2247,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 +2272,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);
}); });
} }
}, },

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,

34
docs/base.js

@ -1956,6 +1956,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 +1997,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 +2075,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 +2096,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 +2115,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 +2174,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 +2202,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 +2247,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 +2272,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);
}); });
} }
}, },

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

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