Browse Source

Merge pull request #1215 in VISUAL/fineui from ~DAILER/fineui:master to master

* commit 'aa31c801e6c33311806f141c54e30aeb31d5d1d3':
  BI-57759 新增nobar的复选下拉框
es6
parent
commit
49f2e20b8a
  1. 441
      dist/2.0/fineui.ie.js
  2. 2
      dist/2.0/fineui.ie.js.map
  3. 28
      dist/2.0/fineui.ie.min.js
  4. 2
      dist/2.0/fineui.ie.min.js.map
  5. 441
      dist/2.0/fineui.js
  6. 2
      dist/2.0/fineui.js.map
  7. 28
      dist/2.0/fineui.min.js
  8. 2
      dist/2.0/fineui.min.js.map
  9. 441
      dist/bundle.ie.js
  10. 2
      dist/bundle.ie.js.map
  11. 28
      dist/bundle.ie.min.js
  12. 2
      dist/bundle.ie.min.js.map
  13. 441
      dist/bundle.js
  14. 2
      dist/bundle.js.map
  15. 28
      dist/bundle.min.js
  16. 2
      dist/bundle.min.js.map
  17. 441
      dist/fineui.ie.js
  18. 2
      dist/fineui.ie.js.map
  19. 27
      dist/fineui.ie.min.js
  20. 2
      dist/fineui.ie.min.js.map
  21. 441
      dist/fineui.js
  22. 2
      dist/fineui.js.map
  23. 28
      dist/fineui.min.js
  24. 2
      dist/fineui.min.js.map
  25. 441
      dist/fineui_without_jquery_polyfill.js
  26. 2
      dist/fineui_without_jquery_polyfill.js.map
  27. 2
      dist/utils.min.js
  28. 441
      dist/widget.js
  29. 2
      dist/widget.js.map
  30. 438
      src/widget/multiselect/multiselect.combo.nobar.js
  31. 4
      src/widget/multiselect/multiselect.insert.combo.nobar.js

441
dist/2.0/fineui.ie.js vendored

@ -71933,6 +71933,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -72399,7 +72836,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -72650,7 +73087,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/2.0/fineui.ie.js.map vendored

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

441
dist/2.0/fineui.js vendored

@ -72336,6 +72336,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -72802,7 +73239,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -73053,7 +73490,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/2.0/fineui.js.map vendored

File diff suppressed because one or more lines are too long

28
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

441
dist/bundle.ie.js vendored

@ -71933,6 +71933,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -72399,7 +72836,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -72650,7 +73087,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/bundle.ie.js.map vendored

File diff suppressed because one or more lines are too long

28
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

441
dist/bundle.js vendored

@ -72336,6 +72336,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -72802,7 +73239,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -73053,7 +73490,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/bundle.js.map vendored

File diff suppressed because one or more lines are too long

28
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.min.js.map vendored

File diff suppressed because one or more lines are too long

441
dist/fineui.ie.js vendored

@ -72180,6 +72180,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -72646,7 +73083,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -72897,7 +73334,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/fineui.ie.js.map vendored

File diff suppressed because one or more lines are too long

27
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

441
dist/fineui.js vendored

@ -72583,6 +72583,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -73049,7 +73486,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -73300,7 +73737,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/fineui.js.map vendored

File diff suppressed because one or more lines are too long

28
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

441
dist/fineui_without_jquery_polyfill.js vendored

@ -54863,6 +54863,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -55329,7 +55766,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -55580,7 +56017,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/fineui_without_jquery_polyfill.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

441
dist/widget.js vendored

@ -9942,6 +9942,443 @@ BI.MultiSelectCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_combo", BI.MultiSelectCombo);/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);/**
*
* @class BI.MultiSelectInsertCombo
* @extends BI.Single
@ -10408,7 +10845,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -10659,7 +11096,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

2
dist/widget.js.map vendored

File diff suppressed because one or more lines are too long

438
src/widget/multiselect/multiselect.combo.nobar.js

@ -0,0 +1,438 @@
/**
*
* @class BI.MultiSelectNoBarCombo
* @extends BI.Single
*/
BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
attributes: {
tabIndex: 0
}
});
},
_init: function () {
BI.MultiSelectNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, self._startValue) : BI.pushDistinct(self.storeValue.value, self._startValue));
self.trigger.getSearcher().setState(self.storeValue);
self.numberCounter.setButtonChecked(self.storeValue);
};
this.storeValue = {
type: BI.Selection.Multi,
value: o.value || []
};
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
height: o.height,
text: o.text,
// adapter: this.popup,
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_FOCUS);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BLUR, function () {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_BLUR);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_STOP);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
// counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数)
// 只需要更新查看面板的selectedValue用以请求已选数据
self.numberCounter.updateSelectedValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
container: o.container,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.multi_select_no_bar_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
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.numberCounter.adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: {
type: BI.Selection.Multi,
value: o.value
},
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
this.setValue(self.storeValue);
BI.nextTick(function () {
self.populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self._stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher",
masker: {
offset: {
left: 0,
top: 0,
right: 0,
bottom: 25
}
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
value: {
type: BI.Selection.Multi,
value: o.value
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
this.updateSelectedValue(self.storeValue);
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
self.trigger.refreshPlaceHolderWidth((b === true ? self.numberCounter.element.outerWidth() + 8 : 0));
});
});
this.trigger.element.click(function (e) {
if (self.trigger.element.find(e.target).length > 0) {
self.numberCounter.hideView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height
}]
});
},
_itemsCreator4Trigger: function (op, callback) {
var self = this, o = this.options;
o.itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
_stopEditing: function () {
this.trigger.stopEditing();
this.numberCounter.hideView();
},
_defaultState: function () {
this._stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest(items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
o.itemsCreator({
type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
self.storeValue.assist && self.storeValue.assist.push(selectedMap[items[i]]);
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
BI.remove(self.storeValue.assist, item);
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
adjust();
callback();
function adjust() {
if (self.wants2Quit === true) {
self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
BI.remove(self.storeValue.assist, v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
self.storeValue.assist && self.storeValue.assist.push(map[v]);
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
setValue: function (v) {
this.storeValue = {
type: BI.Selection.Multi,
value: v || []
};
this.combo.setValue(this.storeValue);
this.numberCounter.setValue(this.storeValue);
},
getValue: function () {
return BI.deepClone(this.storeValue.value);
},
populate: function () {
this.combo.populate.apply(this.combo, arguments);
}
});
BI.extend(BI.MultiSelectNoBarCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.MultiSelectNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.MultiSelectNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiSelectNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.MultiSelectNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_no_bar_combo", BI.MultiSelectNoBarCombo);

4
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -7,7 +7,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-insert-combo",
baseCls: "bi-multi-select-insert-combo-no-bar",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24,
@ -258,7 +258,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
right: o.height,
top: 0,
height: o.height,
height: o.height
}]
});
},

Loading…
Cancel
Save