Browse Source

Merge pull request #955 in VISUAL/fineui from ~TELLER/fineui:master to master

* commit 'b1825480379eda87bf094766d136dff173b10a36':
  chore: update dist
es6
Teller 6 years ago
parent
commit
6435cace0d
  1. 666
      dist/2.0/fineui.ie.js
  2. 76
      dist/2.0/fineui.ie.min.js
  3. 666
      dist/2.0/fineui.js
  4. 76
      dist/2.0/fineui.min.js
  5. 3
      dist/base.js
  6. 666
      dist/bundle.ie.js
  7. 76
      dist/bundle.ie.min.js
  8. 666
      dist/bundle.js
  9. 76
      dist/bundle.min.js
  10. 19
      dist/case.js
  11. 666
      dist/fineui.ie.js
  12. 74
      dist/fineui.ie.min.js
  13. 666
      dist/fineui.js
  14. 74
      dist/fineui.min.js
  15. 666
      dist/fineui_without_jquery_polyfill.js
  16. 4
      dist/utils.min.js
  17. 644
      dist/widget.js

666
dist/2.0/fineui.ie.js vendored

@ -39965,7 +39965,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -50948,6 +50949,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -54553,6 +54555,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -54790,6 +54794,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -56539,7 +56547,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -56566,8 +56575,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -56736,6 +56745,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -56745,7 +56755,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -56755,7 +56765,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -56952,6 +56962,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},
@ -66508,73 +66520,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -66589,6 +66685,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -66601,13 +66698,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -66646,6 +66745,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -66661,15 +66761,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -66688,7 +66801,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -66742,8 +66855,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -66767,6 +66892,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -66777,13 +66906,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -67207,60 +67458,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -67282,6 +67614,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -67294,13 +67627,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -67319,7 +67654,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -67339,6 +67674,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67355,17 +67691,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -67384,7 +67729,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67441,7 +67786,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -67466,6 +67823,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67476,13 +67837,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -73082,6 +73565,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -73361,6 +73845,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -74161,6 +74646,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

76
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

666
dist/2.0/fineui.js vendored

@ -40369,7 +40369,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -51352,6 +51353,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -54957,6 +54959,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -55194,6 +55198,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -56943,7 +56951,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -56970,8 +56979,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -57140,6 +57149,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -57149,7 +57159,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -57159,7 +57169,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -57356,6 +57366,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},
@ -66912,73 +66924,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -66993,6 +67089,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -67005,13 +67102,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -67050,6 +67149,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67065,15 +67165,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -67092,7 +67205,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67146,8 +67259,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -67171,6 +67296,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67181,13 +67310,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -67611,60 +67862,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -67686,6 +68018,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -67698,13 +68031,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -67723,7 +68058,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -67743,6 +68078,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67759,17 +68095,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -67788,7 +68133,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67845,7 +68190,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -67870,6 +68227,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67880,13 +68241,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -73486,6 +73969,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -73765,6 +74249,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -74565,6 +75050,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

76
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

3
dist/base.js vendored

@ -4408,7 +4408,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

666
dist/bundle.ie.js vendored

@ -39965,7 +39965,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -50948,6 +50949,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -54553,6 +54555,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -54790,6 +54794,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -56539,7 +56547,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -56566,8 +56575,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -56736,6 +56745,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -56745,7 +56755,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -56755,7 +56765,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -56952,6 +56962,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},
@ -66508,73 +66520,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -66589,6 +66685,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -66601,13 +66698,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -66646,6 +66745,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -66661,15 +66761,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -66688,7 +66801,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -66742,8 +66855,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -66767,6 +66892,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -66777,13 +66906,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -67207,60 +67458,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -67282,6 +67614,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -67294,13 +67627,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -67319,7 +67654,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -67339,6 +67674,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67355,17 +67691,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -67384,7 +67729,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67441,7 +67786,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -67466,6 +67823,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67476,13 +67837,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -73082,6 +73565,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -73361,6 +73845,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -74161,6 +74646,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

76
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

666
dist/bundle.js vendored

@ -40369,7 +40369,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -51352,6 +51353,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -54957,6 +54959,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -55194,6 +55198,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -56943,7 +56951,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -56970,8 +56979,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -57140,6 +57149,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -57149,7 +57159,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -57159,7 +57169,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -57356,6 +57366,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},
@ -66912,73 +66924,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -66993,6 +67089,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -67005,13 +67102,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -67050,6 +67149,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67065,15 +67165,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -67092,7 +67205,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67146,8 +67259,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -67171,6 +67296,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67181,13 +67310,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -67611,60 +67862,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -67686,6 +68018,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -67698,13 +68031,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -67723,7 +68058,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -67743,6 +68078,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67759,17 +68095,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -67788,7 +68133,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67845,7 +68190,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -67870,6 +68227,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67880,13 +68241,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -73486,6 +73969,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -73765,6 +74249,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -74565,6 +75050,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

76
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

19
dist/case.js vendored

@ -973,6 +973,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -4578,6 +4579,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -4815,6 +4818,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -6564,7 +6571,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -6591,8 +6599,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -6761,6 +6769,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -6770,7 +6779,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -6780,7 +6789,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -6977,6 +6986,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},

666
dist/fineui.ie.js vendored

@ -40210,7 +40210,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -51193,6 +51194,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -54798,6 +54800,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -55035,6 +55039,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -56784,7 +56792,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -56811,8 +56820,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -56981,6 +56990,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -56990,7 +57000,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -57000,7 +57010,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -57197,6 +57207,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},
@ -66753,73 +66765,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -66834,6 +66930,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -66846,13 +66943,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -66891,6 +66990,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -66906,15 +67006,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -66933,7 +67046,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -66987,8 +67100,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -67012,6 +67137,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67022,13 +67151,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -67452,60 +67703,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -67527,6 +67859,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -67539,13 +67872,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -67564,7 +67899,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -67584,6 +67919,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67600,17 +67936,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -67629,7 +67974,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67686,7 +68031,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -67711,6 +68068,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67721,13 +68082,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -73327,6 +73810,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -73606,6 +74090,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -74406,6 +74891,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

74
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

666
dist/fineui.js vendored

@ -40614,7 +40614,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -51597,6 +51598,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -55202,6 +55204,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -55439,6 +55443,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -57188,7 +57196,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -57215,8 +57224,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -57385,6 +57394,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -57394,7 +57404,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -57404,7 +57414,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -57601,6 +57611,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},
@ -67157,73 +67169,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -67238,6 +67334,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -67250,13 +67347,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -67295,6 +67394,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -67310,15 +67410,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -67337,7 +67450,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -67391,8 +67504,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -67416,6 +67541,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -67426,13 +67555,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -67856,60 +68107,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -67931,6 +68263,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -67943,13 +68276,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -67968,7 +68303,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -67988,6 +68323,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -68004,17 +68340,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -68033,7 +68378,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -68090,7 +68435,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -68115,6 +68472,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -68125,13 +68486,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -73731,6 +74214,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -74010,6 +74494,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -74810,6 +75295,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

74
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

666
dist/fineui_without_jquery_polyfill.js vendored

@ -27740,7 +27740,8 @@ BI.Loader = BI.inherit(BI.Widget, {
behaviors: {},
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -35755,6 +35756,7 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -37817,6 +37819,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
}
});
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
@ -38054,6 +38058,10 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
mounted: function() {
this.check();
},
populate: function (find, match, keyword) {
var items = BI.concat(find, match);
BI.SearchTextValueComboPopup.superclass.populate.apply(this, items);
@ -39803,7 +39811,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -39830,8 +39839,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "state-editor-infinite-text",
textAlign: "left",
text: o.text,
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
hgap: 4,
handler: function () {
self._showInput();
@ -40000,6 +40009,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -40009,7 +40019,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
}
return;
@ -40019,7 +40029,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this.text.setTitle(v);
this.text.element.removeClass("state-editor-infinite-text");
} else if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Already_Selected"));
@ -40216,6 +40226,8 @@ BI.ListPane = BI.inherit(BI.Pane, {
calback.apply(self, arguments);
op.times === 1 && BI.nextTick(function () {
self.loaded();
// callback可能在loading之前执行, check保证显示正确
self.check();
});
});
},
@ -49496,73 +49508,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -49577,6 +49673,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -49589,13 +49686,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -49634,6 +49733,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -49649,15 +49749,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -49676,7 +49789,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -49730,8 +49843,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -49755,6 +49880,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -49765,13 +49894,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -50195,60 +50446,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -50270,6 +50602,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -50282,13 +50615,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -50307,7 +50642,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -50327,6 +50662,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -50343,17 +50679,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -50372,7 +50717,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -50429,7 +50774,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -50454,6 +50811,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -50464,13 +50825,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -56070,6 +56553,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -56349,6 +56833,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -57149,6 +57634,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

644
dist/widget.js vendored

@ -6612,73 +6612,157 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multilayer_select_tree-combo",
baseCls: "bi-multilayer-select-tree-combo",
isDefaultInit: false,
height: 24,
text: "",
itemsCreator: BI.emptyFn,
items: [],
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_select_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSelectTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_select_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-select-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
this.combo.populate(items);
}
});
BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/**
* guy
@ -6693,6 +6777,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
value: "",
scrollable: true
});
@ -6705,13 +6790,15 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
@ -6750,6 +6837,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -6765,15 +6853,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
value: o.value,
el: {
type: "bi.button_tree",
chooseType: BI.Selection.Single,
layouts: [{
type: "bi.vertical"
}]
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
@ -6792,7 +6893,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -6846,8 +6947,20 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_select_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
itemsCreator: o.itemsCreator,
scrollable: null
});
@ -6871,6 +6984,10 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -6881,13 +6998,135 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_select_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -7311,60 +7550,141 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, {
value: "",
attributes: {
tabIndex: 0
}
},
allowEdit: false
});
},
_init: function () {
BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
});
var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig();
this.popup = BI.createWidget({
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
value: o.value
});
return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : {
type: "bi.absolute",
items: [{
el: combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.trigger_icon_button",
cls: "trigger-icon-button",
ref: function (_ref) {
self.triggerBtn = _ref;
},
width: o.height,
height: o.height,
handler: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
}
},
right: 0,
bottom: 0,
top: 0
}]
};
},
this.combo = BI.createWidget({
_getBaseConfig: function () {
var self = this, o = this.options;
return {
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
ref: function (_ref) {
self.combo = _ref;
},
popup: {
el: this.popup
el: {
type: "bi.multilayer_single_tree_popup",
isDefaultInit: o.isDefaultInit,
itemsCreator: o.itemsCreator,
items: o.items,
ref: function (_ref) {
self.trigger && self.trigger.getSearcher().setAdapter(_ref);
},
listeners: [{
eventName: BI.MultiLayerSingleTreePopup.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
value: o.value,
minHeight: 400
}
});
};
},
this.combo.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
_getSyncConfig: function () {
var o = this.options;
var baseConfig = this._getBaseConfig();
baseConfig.el = {
type: "bi.single_tree_trigger",
text: o.text,
height: o.height,
items: o.items,
value: o.value
};
return baseConfig;
},
this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
_getAsyncConfig: function () {
var self = this, o = this.options;
var config = this._getBaseConfig();
return BI.extend(config, {
el: {
type: "bi.multilayer_single_tree_trigger",
allowEdit: o.allowEdit,
cls: "multilayer-single-tree-trigger",
ref: function (_ref) {
self.trigger = _ref;
},
items: o.items,
itemsCreator: o.itemsCreator,
height: o.height - 2,
text: o.text,
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
title: o.title,
listeners: [{
eventName: BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE,
action: function () {
self.setValue(this.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE);
}
}]
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
}
}]
});
},
setValue: function (v) {
v = BI.isArray(v) ? v : [v];
this.trigger.setValue(v);
this.popup.setValue(v);
this.combo.setValue(v);
},
getValue: function () {
return this.popup.getValue();
return this.combo.getValue();
},
populate: function (items) {
@ -7386,6 +7706,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
isDefaultInit: false,
items: [],
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
chooseType: BI.Selection.Single,
scrollable: true
});
@ -7398,13 +7719,15 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
_formatItems: function (nodes, layer, pNode) {
var self = this;
var self = this, o = this.options;
var keyword = o.keywordGetter();
BI.each(nodes, function (i, node) {
var extend = {};
node.layer = layer;
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
node.keyword = keyword;
extend.pNode = pNode;
if (node.isParent === true || node.parent === true || BI.isNotEmptyArray(node.children)) {
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
@ -7423,7 +7746,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
} else {
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item";
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
@ -7443,6 +7766,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
var hasNext = false;
this.empty();
this._assertId(nodes);
this.tree = BI.createWidget({
@ -7459,17 +7783,26 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0),
value: o.value,
itemsCreator: function (op, callback) {
o.itemsCreator(op, function (items) {
callback(BI.Tree.transformToTreeFormat(items), 0);
o.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node));
});
},
el: {
type: "bi.button_tree",
type: "bi.loader",
isDefaultInit: true,
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}]
el: {
type: "bi.button_tree",
behaviors: o.behaviors,
layouts: [{
type: "bi.vertical"
}]
},
hasNext: function () {
return hasNext;
}
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) {
@ -7488,7 +7821,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
populate: function (nodes) {
this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0));
},
setValue: function (v) {
@ -7545,7 +7878,19 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
type: "bi.multilayer_single_level_tree",
isDefaultInit: o.isDefaultInit,
items: o.items,
itemsCreator: o.itemsCreator,
itemsCreator: function (op, callback) {
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loading();
});
o.itemsCreator(op, function (ob) {
self._populate(ob.items);
callback(ob);
(op.times === 1 && !op.node) && BI.nextTick(function () {
self.loaded();
});
});
},
keywordGetter: o.keywordGetter,
value: o.value,
scrollable: null
});
@ -7570,6 +7915,10 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
this.check();
},
_populate: function() {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
},
getValue: function () {
return this.tree.getValue();
},
@ -7580,13 +7929,135 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
},
populate: function (items) {
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
this._populate(items);
this.tree.populate(items);
}
});
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/**
* Created by Windy on 2018/2/2.
*/
BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
props: {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow",
height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn
},
render: function () {
var self = this, o = this.options;
var content = {
type: "bi.htape",
items: [
{
el: {
type: "bi.searcher",
ref: function () {
self.searcher = this;
},
isAutoSearch: false,
el: {
type: "bi.state_editor",
ref: function () {
self.editor = this;
},
text: this._digest(o.value),
value: o.value,
height: o.height,
tipText: ""
},
popup: {
type: "bi.multilayer_single_tree_popup",
itemsCreator: function (op, callback) {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
keywordGetter: function () {
return self.editor.getValue();
},
cls: "bi-card"
},
onSearch: function (obj, callback) {
var keyword = obj.keyword;
if(o.itemsCreator === BI.emptyFn) {
var finding = BI.Func.getSearchResult(o.items, keyword);
var matched = finding.match, find = finding.find;
callback(find.concat(matched));
} else {
callback();
}
},
listeners: [{
eventName: BI.Searcher.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE);
}
}]
}
}, {
el: {
type: "bi.layout",
width: 24
},
width: 24
}
]
};
return o.allowEdit ? content : {
type: "bi.absolute",
items: [{
el: content,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
};
},
_digest: function (v) {
return this.options.valueFormatter(v);
},
stopEditing: function () {
this.searcher.stopSearch();
},
getSearcher: function () {
return this.searcher;
},
populate: function (items) {
this.options.items = items;
},
setValue: function (v) {
this.editor.setState(this._digest(v[0]));
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiLayerSingleTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START";
BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
@ -13186,6 +13657,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
text: o.text,
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
@ -13465,6 +13937,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
text: o.text,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,
@ -14265,6 +14738,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
height: o.height,
el: {
type: "bi.simple_state_editor",
text: o.text,
height: o.height
}
});

Loading…
Cancel
Save