guy 8 years ago
parent
commit
2eb467d396
  1. 5
      bi/base.js
  2. 173
      bi/widget.js
  3. 5
      demo/js/widget/tree/demo.multilayer_select_tree_combo.js
  4. 5
      docs/base.js
  5. 5
      docs/demo.js
  6. 173
      docs/widget.js
  7. 5
      src/base/combination/switcher.js
  8. 67
      src/widget/multiselect/multiselect.combo.js
  9. 5
      src/widget/multiselect/multiselect.trigger.js
  10. 4
      src/widget/multiselect/trigger/searcher.multiselect.js
  11. 4
      src/widget/multiselect/trigger/switcher.checkselected.js
  12. 89
      src/widget/multitree/multi.tree.combo.js
  13. 4
      src/widget/multitree/trigger/searcher.multi.tree.js

5
bi/base.js

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

173
bi/widget.js

@ -9559,38 +9559,11 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = {}; this.storeValue = {};
this.popup = BI.createWidget({
type: 'bi.multi_select_popup_view',
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CHANGE, function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, function () {
self.setValue();
self._defaultState();
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: { offset: {
left: 1, left: 1,
@ -9675,7 +9648,43 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup, popup: {
type: 'bi.multi_select_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
action: function () {
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0;
} }
@ -10272,6 +10281,11 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) { setValue: function (ob) {
this.searcher.setValue(ob); this.searcher.setValue(ob);
this.numberCounter.setValue(ob); this.numberCounter.setValue(ob);
@ -10816,6 +10830,10 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
return this.searcher.getView() && this.searcher.getView().hasChecked(); return this.searcher.getView() && this.searcher.getView().hasChecked();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) { setState: function (ob) {
var o = this.options; var o = this.options;
ob || (ob = {}); ob || (ob = {});
@ -10937,6 +10955,10 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, {
this.switcher.hideView(); this.switcher.hideView();
}, },
setAdapter: function (adapter) {
this.switcher.setAdapter(adapter);
},
setValue: function (v) { setValue: function (v) {
this.switcher.setValue(v); this.switcher.setValue(v);
}, },
@ -11406,7 +11428,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}, },
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo', baseCls: 'bi-multi-tree-combo',
@ -11420,31 +11441,13 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this.popup = BI.createWidget({
type: 'bi.multi_tree_popup_view',
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
var isInit = false; var isInit = false;
var want2showCounter = false; var want2showCounter = false;
this.popup.on(BI.MultiTreePopup.EVENT_AFTERINIT, function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: this.constants.offset offset: this.constants.offset
}, },
@ -11469,7 +11472,53 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup popup: {
type: 'bi.multi_tree_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
}
}); });
this.storeValue = {value: {}}; this.storeValue = {value: {}};
@ -11532,24 +11581,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.getSearcher().setState(val); this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
this.popup.on(BI.MultiTreePopup.EVENT_CHANGE, function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CLEAR, function () {
clear = true;
self.setValue();
self._defaultState();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (isSearching()) { if (isSearching()) {
@ -11618,7 +11649,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
setEnable: function(v){ setEnable: function (v) {
this.combo.setEnable(v); this.combo.setEnable(v);
}, },
@ -11956,6 +11987,10 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
this.searcher.adjustView(); this.searcher.adjustView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
isSearching: function () { isSearching: function () {
return this.searcher.isSearching(); return this.searcher.isSearching();
}, },

5
demo/js/widget/tree/demo.multilayer_select_tree_combo.js

@ -46,12 +46,9 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var items = BI.deepClone(TREEWITHCHILDREN); var items = BI.deepClone(TREEWITHCHILDREN);
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.multilayer_select_tree_combo", type: "bi.multilayer_select_tree_combo",
itemsCreator: function (op, callback) {
debugger;
}
}); });
combo.populate(); combo.populate(items);
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [combo, { items: [combo, {

5
docs/base.js

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

5
docs/demo.js

@ -6781,12 +6781,9 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var items = BI.deepClone(TREEWITHCHILDREN); var items = BI.deepClone(TREEWITHCHILDREN);
var combo = BI.createWidget({ var combo = BI.createWidget({
type: "bi.multilayer_select_tree_combo", type: "bi.multilayer_select_tree_combo",
itemsCreator: function (op, callback) {
debugger;
}
}); });
combo.populate(); combo.populate(items);
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [combo, { items: [combo, {

173
docs/widget.js

@ -9559,38 +9559,11 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = {}; this.storeValue = {};
this.popup = BI.createWidget({
type: 'bi.multi_select_popup_view',
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CHANGE, function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, function () {
self.setValue();
self._defaultState();
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: { offset: {
left: 1, left: 1,
@ -9675,7 +9648,43 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup, popup: {
type: 'bi.multi_select_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
action: function () {
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0;
} }
@ -10272,6 +10281,11 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) { setValue: function (ob) {
this.searcher.setValue(ob); this.searcher.setValue(ob);
this.numberCounter.setValue(ob); this.numberCounter.setValue(ob);
@ -10816,6 +10830,10 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
return this.searcher.getView() && this.searcher.getView().hasChecked(); return this.searcher.getView() && this.searcher.getView().hasChecked();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) { setState: function (ob) {
var o = this.options; var o = this.options;
ob || (ob = {}); ob || (ob = {});
@ -10937,6 +10955,10 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, {
this.switcher.hideView(); this.switcher.hideView();
}, },
setAdapter: function (adapter) {
this.switcher.setAdapter(adapter);
},
setValue: function (v) { setValue: function (v) {
this.switcher.setValue(v); this.switcher.setValue(v);
}, },
@ -11406,7 +11428,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} }
}, },
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multi-tree-combo', baseCls: 'bi-multi-tree-combo',
@ -11420,31 +11441,13 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
var self = this, o = this.options; var self = this, o = this.options;
this.popup = BI.createWidget({
type: 'bi.multi_tree_popup_view',
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
});
var isInit = false; var isInit = false;
var want2showCounter = false; var want2showCounter = false;
this.popup.on(BI.MultiTreePopup.EVENT_AFTERINIT, function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
});
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
height: o.height, height: o.height,
adapter: this.popup, // adapter: this.popup,
masker: { masker: {
offset: this.constants.offset offset: this.constants.offset
}, },
@ -11469,7 +11472,53 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
toggle: false, toggle: false,
el: this.trigger, el: this.trigger,
adjustLength: 1, adjustLength: 1,
popup: this.popup popup: {
type: 'bi.multi_tree_popup_view',
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.trigger.getCounter().adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self.setValue();
self._defaultState();
}
}],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
}
}); });
this.storeValue = {value: {}}; this.storeValue = {value: {}};
@ -11532,24 +11581,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.getSearcher().setState(val); this.getSearcher().setState(val);
this.getCounter().setButtonChecked(val); this.getCounter().setButtonChecked(val);
}); });
this.popup.on(BI.MultiTreePopup.EVENT_CHANGE, function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? {1: 1} : {}
};
self.trigger.getSearcher().setState(val);
self.trigger.getCounter().setButtonChecked(val);
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CONFIRM, function () {
self._defaultState();
});
this.popup.on(BI.MultiTreePopup.EVENT_CLICK_CLEAR, function () {
clear = true;
self.setValue();
self._defaultState();
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
if (isSearching()) { if (isSearching()) {
@ -11618,7 +11649,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
this.combo.hideView(); this.combo.hideView();
}, },
setEnable: function(v){ setEnable: function (v) {
this.combo.setEnable(v); this.combo.setEnable(v);
}, },
@ -11956,6 +11987,10 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
this.searcher.adjustView(); this.searcher.adjustView();
}, },
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
isSearching: function () { isSearching: function () {
return this.searcher.isSearching(); return this.searcher.isSearching();
}, },

5
src/base/combination/switcher.js

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save