Browse Source

BI-17527

es6
windy 7 years ago
parent
commit
4a84f1421c
  1. 2
      demo/js/case/combo/demo.search_text_value_combo.js
  2. 6
      demo/js/widget/multiselect/demo.multi_select_combo.js
  3. 5
      demo/js/widget/multiselect/demo.multi_select_tree.js
  4. 33
      dist/_fineui.min.js
  5. 4
      dist/base.css
  6. 13
      dist/base.js
  7. 8
      dist/bundle.css
  8. 648
      dist/bundle.js
  9. 2
      dist/bundle.min.css
  10. 29
      dist/bundle.min.js
  11. 13
      dist/demo.js
  12. 8
      dist/fineui.css
  13. 648
      dist/fineui.js
  14. 2
      dist/fineui.min.css
  15. 35
      dist/fineui.min.js
  16. 4
      dist/widget.css
  17. 687
      dist/widget.js
  18. 2
      src/base/formula/formulaeditor.js
  19. 4
      src/css/widget/multiselect/trigger/button.css
  20. 4
      src/less/widget/multiselect/trigger/button.checkselected.less
  21. 57
      src/widget/multiselect/multiselect.insert.combo.js
  22. 57
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  23. 161
      src/widget/multiselect/multiselect.insert.trigger.js
  24. 116
      src/widget/multiselect/search/multiselect.search.insert.pane.js
  25. 182
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  26. 2
      src/widget/multiselect/trigger/searcher.multiselect.js
  27. 29
      src/widget/multiselectlist/multiselectlist.insert.js
  28. 29
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  29. 4
      src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js
  30. 1
      src/widget/searchmultitextvaluecombo/trigger/searcher.multitextvalue.js

2
demo/js/case/combo/demo.search_text_value_combo.js

@ -65,7 +65,7 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, {
width: 200, width: 200,
value: { value: {
type: 1, type: 1,
value: ["1", "2", "3"] value: ["1", "2", "柳州市城贸金属材料有限责任公司", "3"]
} }
}, { }, {
type: "bi.button", type: "bi.button",

6
demo/js/widget/multiselect/demo.multi_select_combo.js

@ -9,7 +9,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () { _createMultiSelectCombo: function () {
var self = this; var self = this;
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_no_bar_combo",
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
width: 200, width: 200,
value: { value: {
@ -27,14 +27,14 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_getItemsByTimes: function (items, times) { _getItemsByTimes: function (items, times) {
var res = []; var res = [];
for (var i = (times - 1) * 10; items[i] && i < times * 10; i++) { for (var i = (times - 1) * 100; items[i] && i < times * 100; i++) {
res.push(items[i]); res.push(items[i]);
} }
return res; return res;
}, },
_hasNextByTimes: function (items, times) { _hasNextByTimes: function (items, times) {
return times * 10 < items.length; return times * 100 < items.length;
}, },
_itemsCreator: function (options, callback) { _itemsCreator: function (options, callback) {

5
demo/js/widget/multiselect/demo.multi_select_tree.js

@ -13,15 +13,12 @@ Demo.MultiSelectList = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () { _createMultiSelectCombo: function () {
var self = this; var self = this;
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.multi_select_insert_list", type: "bi.multi_select_insert_no_bar_list",
ref: function (ref) { ref: function (ref) {
self.list = ref; self.list = ref;
}, },
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
value: {
type: 1,
value: ["柳州市城贸金属材料有限责任公司", "柳州市建福房屋租赁有限公司", "柳州市迅昌数码办公设备有限责任公司"] value: ["柳州市城贸金属材料有限责任公司", "柳州市建福房屋租赁有限公司", "柳州市迅昌数码办公设备有限责任公司"]
}
}); });
widget.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { widget.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () {

33
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

4
dist/base.css vendored

@ -702,7 +702,7 @@ li.CodeMirror-hint-active {
color: white; color: white;
} }
.bi-message-title { .bi-message-title {
font-size: 16px; font-size: 14px;
cursor: pointer; cursor: pointer;
} }
.bi-message-text { .bi-message-text {
@ -718,7 +718,7 @@ li.CodeMirror-hint-active {
font-size: 16px; font-size: 16px;
} }
.bi-message-close { .bi-message-close {
font-size: 25px; font-size: 16px;
} }
.bi-message-animate { .bi-message-animate {
-webkit-transition: opacity 0.3s, transform 0.4s, -webkit-transform 0.4s; -webkit-transition: opacity 0.3s, transform 0.4s, -webkit-transform 0.4s;

13
dist/base.js vendored

@ -14740,8 +14740,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break; break;
} }
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}, },
setValue: function (value) { setValue: function (value) {
@ -14843,7 +14843,6 @@ $.extend(BI, {
el: { el: {
type: "bi.button", type: "bi.button",
text: BI.i18nText("BI-Basic_Cancel"), text: BI.i18nText("BI-Basic_Cancel"),
height: 30,
level: "ignore", level: "ignore",
handler: function () { handler: function () {
close(); close();
@ -14858,7 +14857,6 @@ $.extend(BI, {
el: { el: {
type: "bi.button", type: "bi.button",
text: BI.i18nText("BI-Basic_OK"), text: BI.i18nText("BI-Basic_OK"),
height: 30,
handler: function () { handler: function () {
close(); close();
if (BI.isFunction(callback)) { if (BI.isFunction(callback)) {
@ -15331,7 +15329,8 @@ BI.Popover = BI.inherit(BI.Widget, {
SMALL: "small", SMALL: "small",
NORMAL: "normal", NORMAL: "normal",
BIG: "big" BIG: "big"
} },
HEADER_HEIGHT: 40
}, },
_defaultConfig: function () { _defaultConfig: function () {
@ -15378,7 +15377,7 @@ BI.Popover = BI.inherit(BI.Widget, {
items: [{ items: [{
el: BI.isPlainObject(o.header) ? BI.createWidget(o.header) : { el: BI.isPlainObject(o.header) ? BI.createWidget(o.header) : {
type: "bi.label", type: "bi.label",
height: 36, height: this._constant.HEADER_HEIGHT,
text: o.header, text: o.header,
title: o.header, title: o.header,
textAlign: "left" textAlign: "left"
@ -15394,7 +15393,7 @@ BI.Popover = BI.inherit(BI.Widget, {
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-message-close close-font", cls: "bi-message-close close-font",
height: 36, height: this._constant.HEADER_HEIGHT,
handler: function () { handler: function () {
self.close(); self.close();
} }
@ -15403,7 +15402,7 @@ BI.Popover = BI.inherit(BI.Widget, {
} }
} }
}, },
height: 36 height: this._constant.HEADER_HEIGHT
}, },
center: { center: {
el: { el: {

8
dist/bundle.css vendored

@ -2399,7 +2399,7 @@ li.CodeMirror-hint-active {
color: white; color: white;
} }
.bi-message-title { .bi-message-title {
font-size: 16px; font-size: 14px;
cursor: pointer; cursor: pointer;
} }
.bi-message-text { .bi-message-text {
@ -2415,7 +2415,7 @@ li.CodeMirror-hint-active {
font-size: 16px; font-size: 16px;
} }
.bi-message-close { .bi-message-close {
font-size: 25px; font-size: 16px;
} }
.bi-message-animate { .bi-message-animate {
-webkit-transition: opacity 0.3s, transform 0.4s, -webkit-transform 0.4s; -webkit-transition: opacity 0.3s, transform 0.4s, -webkit-transform 0.4s;
@ -3823,13 +3823,11 @@ ul.ztree.zTreeDragUL {
} }
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
min-width: 16px;
-webkit-border-radius: 8px; -webkit-border-radius: 8px;
-moz-border-radius: 8px; -moz-border-radius: 8px;
border-radius: 8px; border-radius: 8px;
} }
.bi-multi-select-check-selected-button .count-tip {
min-width: 16px;
}
.bi-multi-tree-check-pane .multi-tree-check-selected { .bi-multi-tree-check-pane .multi-tree-check-selected {
color: #3685f2; color: #3685f2;
} }

648
dist/bundle.js vendored

@ -50510,8 +50510,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break; break;
} }
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}, },
setValue: function (value) { setValue: function (value) {
@ -50613,7 +50613,6 @@ $.extend(BI, {
el: { el: {
type: "bi.button", type: "bi.button",
text: BI.i18nText("BI-Basic_Cancel"), text: BI.i18nText("BI-Basic_Cancel"),
height: 30,
level: "ignore", level: "ignore",
handler: function () { handler: function () {
close(); close();
@ -50628,7 +50627,6 @@ $.extend(BI, {
el: { el: {
type: "bi.button", type: "bi.button",
text: BI.i18nText("BI-Basic_OK"), text: BI.i18nText("BI-Basic_OK"),
height: 30,
handler: function () { handler: function () {
close(); close();
if (BI.isFunction(callback)) { if (BI.isFunction(callback)) {
@ -51101,7 +51099,8 @@ BI.Popover = BI.inherit(BI.Widget, {
SMALL: "small", SMALL: "small",
NORMAL: "normal", NORMAL: "normal",
BIG: "big" BIG: "big"
} },
HEADER_HEIGHT: 40
}, },
_defaultConfig: function () { _defaultConfig: function () {
@ -51148,7 +51147,7 @@ BI.Popover = BI.inherit(BI.Widget, {
items: [{ items: [{
el: BI.isPlainObject(o.header) ? BI.createWidget(o.header) : { el: BI.isPlainObject(o.header) ? BI.createWidget(o.header) : {
type: "bi.label", type: "bi.label",
height: 36, height: this._constant.HEADER_HEIGHT,
text: o.header, text: o.header,
title: o.header, title: o.header,
textAlign: "left" textAlign: "left"
@ -51164,7 +51163,7 @@ BI.Popover = BI.inherit(BI.Widget, {
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-message-close close-font", cls: "bi-message-close close-font",
height: 36, height: this._constant.HEADER_HEIGHT,
handler: function () { handler: function () {
self.close(); self.close();
} }
@ -51173,7 +51172,7 @@ BI.Popover = BI.inherit(BI.Widget, {
} }
} }
}, },
height: 36 height: this._constant.HEADER_HEIGHT
}, },
center: { center: {
el: { el: {
@ -97894,7 +97893,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -97919,33 +97918,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
value: o.value value: o.value
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -97963,7 +97954,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -97974,10 +97965,10 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -98086,6 +98077,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();
@ -98261,7 +98271,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -98292,33 +98302,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -98336,7 +98338,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -98347,10 +98349,10 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -98462,6 +98464,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();
@ -98607,6 +98628,166 @@ BI.extend(BI.MultiSelectInsertNoBarCombo, {
BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_insert_no_bar_combo", BI.MultiSelectInsertNoBarCombo);/** BI.shortcut("bi.multi_select_insert_no_bar_combo", BI.MultiSelectInsertNoBarCombo);/**
*
* 复选下拉框
* @class BI.MultiSelectInsertTrigger
* @extends BI.Trigger
*/
BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
constants: {
height: 14,
rgap: 4,
lgap: 4
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-trigger bi-border",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
searcher: {},
switcher: {},
adapter: null,
masker: {}
});
},
_init: function () {
BI.MultiSelectInsertTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.height) {
this.setHeight(o.height - 2);
}
this.searcher = BI.createWidget(o.searcher, {
type: "bi.multi_select_insert_searcher",
height: o.height,
text: o.text,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
popup: {},
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_START);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_PAUSE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_PAUSE);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, arguments);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_STOP);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_CHANGE, arguments);
});
this.numberCounter = BI.createWidget(o.switcher, {
type: "bi.multi_select_check_selected_switcher",
valueFormatter: o.valueFormatter,
itemsCreator: o.itemsCreator,
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK);
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW);
});
var wrapNumberCounter = BI.createWidget({
type: "bi.right_vertical_adapt",
hgap: 4,
items: [{
el: this.numberCounter
}]
});
var wrapper = BI.createWidget({
type: "bi.htape",
element: this,
items: [
{
el: this.searcher,
width: "fill"
}, {
el: wrapNumberCounter,
width: 0
}, {
el: BI.createWidget(),
width: 24
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);
wrapper.resize();
});
});
this.element.click(function (e) {
if (self.element.__isMouseInBounds__(e) && !self.numberCounter.element.__isMouseInBounds__(e)) {
self.numberCounter.hideView();
}
});
},
getCounter: function () {
return this.numberCounter;
},
getSearcher: function () {
return this.searcher;
},
stopEditing: function () {
this.searcher.stopSearch();
this.numberCounter.hideView();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) {
this.searcher.setValue(ob);
this.numberCounter.setValue(ob);
},
getKey: function () {
return this.searcher.getKey();
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiSelectInsertTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertTrigger.EVENT_START = "EVENT_START";
BI.MultiSelectInsertTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertTrigger.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_trigger", BI.MultiSelectInsertTrigger);/**
* 多选加载数据面板 * 多选加载数据面板
* Created by guy on 15/11/2. * Created by guy on 15/11/2.
* @class BI.MultiSelectLoader * @class BI.MultiSelectLoader
@ -99283,6 +99464,121 @@ BI.MultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW"; BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.shortcut("bi.multi_select_trigger", BI.MultiSelectTrigger);/** BI.shortcut("bi.multi_select_trigger", BI.MultiSelectTrigger);/**
*
* 在搜索框中输入文本弹出的面板
* @class BI.MultiSelectSearchInsertPane
* @extends Widget
*/
BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
constants: {
height: 24,
lgap: 10,
tgap: 5
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectSearchInsertPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-search-pane bi-card",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
keywordGetter: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectSearchInsertPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tooltipClick = BI.createWidget({
type: "bi.label",
invisible: true,
text: BI.i18nText("BI-Click_Blank_To_Select"),
cls: "multi-select-toolbar",
height: this.constants.height
});
this.addNotMatchTip = BI.createWidget({
type: "bi.icon_text_item",
invisible: true,
logic: {
dynamic: true
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
cls: "text-add-tip-font",
height: this.constants.height,
handler: function () {
self.fireEvent(BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM, o.keywordGetter());
}
});
this.loader = BI.createWidget({
type: "bi.multi_select_search_loader",
keywordGetter: o.keywordGetter,
valueFormatter: o.valueFormatter,
itemsCreator: function (op, callback) {
o.itemsCreator.apply(self, [op, function (res) {
callback(res);
self.setKeyword(o.keywordGetter());
}]);
},
value: o.value
});
this.loader.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.resizer = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
type: "bi.float_center_adapt",
items: [this.tooltipClick, this.addNotMatchTip],
height: this.constants.height
}, {
el: this.loader
}]
});
},
setKeyword: function (keyword) {
var btn;
var isMatchTipVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === btn.getValue());
this.tooltipClick.setVisible(isMatchTipVisible);
this.addNotMatchTip.setVisible(!isMatchTipVisible);
!isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword));
},
isAllSelected: function () {
return this.loader.isAllSelected();
},
hasMatched: function () {
return this.tooltipClick.isVisible();
},
setValue: function (v) {
this.loader.setValue(v);
},
getValue: function () {
return this.loader.getValue();
},
empty: function () {
this.loader.empty();
},
populate: function (items) {
this.loader.populate.apply(this.loader, arguments);
}
});
BI.MultiSelectSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_search_insert_pane", BI.MultiSelectSearchInsertPane);/**
* 多选加载数据搜索loader面板 * 多选加载数据搜索loader面板
* Created by guy on 15/11/4. * Created by guy on 15/11/4.
* @class BI.MultiSelectSearchLoader * @class BI.MultiSelectSearchLoader
@ -99693,6 +99989,187 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, {
}); });
BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE"; BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE";
BI.shortcut("bi.multi_select_editor", BI.MultiSelectEditor);/** BI.shortcut("bi.multi_select_editor", BI.MultiSelectEditor);/**
* searcher
* Created by guy on 15/11/3.
* @class BI.MultiSelectInsertSearcher
* @extends Widget
*/
BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertSearcher.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-searcher",
itemsCreator: BI.emptyFn,
el: {},
popup: {},
valueFormatter: BI.emptyFn,
adapter: null,
masker: {},
text: BI.i18nText("BI-Basic_Please_Select")
});
},
_init: function () {
BI.MultiSelectInsertSearcher.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.multi_select_editor",
height: o.height,
text: o.text
});
this.searcher = BI.createWidget({
type: "bi.searcher",
element: this,
height: o.height,
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback();
},
el: this.editor,
popup: BI.extend({
type: "bi.multi_select_search_insert_pane",
valueFormatter: o.valueFormatter,
keywordGetter: function () {
return self.editor.getValue();
},
itemsCreator: function (op, callback) {
var keyword = self.editor.getValue();
op.keywords = [keyword];
this.setKeyword(keyword);
o.itemsCreator(op, callback);
},
value: o.value,
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM);
}
}]
}, o.popup),
adapter: o.adapter,
masker: o.masker
});
this.searcher.on(BI.Searcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_START);
});
this.searcher.on(BI.Searcher.EVENT_PAUSE, function () {
if (this.hasMatched()) {
}
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_PAUSE);
});
this.searcher.on(BI.Searcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_STOP);
});
this.searcher.on(BI.Searcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_CHANGE, arguments);
});
this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () {
var keywords = this.getKeywords();
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, keywords);
});
if (BI.isNotNull(o.value)) {
this.setState(o.value);
}
},
adjustView: function () {
this.searcher.adjustView();
},
isSearching: function () {
return this.searcher.isSearching();
},
stopSearch: function () {
this.searcher.stopSearch();
},
getKeyword: function () {
return this.editor.getValue();
},
hasMatched: function () {
return this.searcher.hasMatched();
},
hasChecked: function () {
return this.searcher.getView() && this.searcher.getView().hasChecked();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) {
var o = this.options;
ob || (ob = {});
ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
} else {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
}
},
setValue: function (ob) {
this.setState(ob);
this.searcher.setValue(ob);
},
getKey: function () {
return this.editor.getValue();
},
getValue: function () {
return this.searcher.getValue();
},
populate: function (items) {
this.searcher.populate.apply(this.searcher, arguments);
}
});
BI.MultiSelectInsertSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.MultiSelectInsertSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertSearcher.EVENT_START = "EVENT_START";
BI.MultiSelectInsertSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertSearcher.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_searcher", BI.MultiSelectInsertSearcher);/**
* searcher * searcher
* Created by guy on 15/11/3. * Created by guy on 15/11/3.
* @class BI.MultiSelectSearcher * @class BI.MultiSelectSearcher
@ -99826,8 +100303,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
} else { } else {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.assist) === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.value) <= 20) { } else if (BI.size(ob.value) <= 20) {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {
@ -100008,7 +100483,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -100018,7 +100493,24 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}
} }
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -100069,16 +100561,6 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}
} }
} }
}, { }, {
@ -100341,7 +100823,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -100351,7 +100833,24 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
}
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -100402,16 +100901,6 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
} }
} }
}, { }, {
@ -103871,7 +104360,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = o.value || {}; this.storeValue = BI.deepClone(o.value || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
@ -104290,7 +104779,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || {}; this.storeValue = BI.deepClone(v || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue); this.combo.setValue(this.storeValue);
@ -104837,6 +105326,7 @@ BI.shortcut("bi.search_multi_select_popup_view", BI.SearchMultiSelectPopupView);
var ob = {}; var ob = {};
ob.type = obj.type; ob.type = obj.type;
ob.value = o.allValueGetter() || []; ob.value = o.allValueGetter() || [];
ob.assist = obj.assist;
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All); this.editor.setState(BI.Selection.All);

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

29
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

13
dist/demo.js vendored

@ -2119,7 +2119,7 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, {
width: 200, width: 200,
value: { value: {
type: 1, type: 1,
value: ["1", "2", "3"] value: ["1", "2", "柳州市城贸金属材料有限责任公司", "3"]
} }
}, { }, {
type: "bi.button", type: "bi.button",
@ -12762,7 +12762,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () { _createMultiSelectCombo: function () {
var self = this; var self = this;
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.multi_select_insert_combo", type: "bi.multi_select_insert_no_bar_combo",
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
width: 200, width: 200,
value: { value: {
@ -12780,14 +12780,14 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_getItemsByTimes: function (items, times) { _getItemsByTimes: function (items, times) {
var res = []; var res = [];
for (var i = (times - 1) * 10; items[i] && i < times * 10; i++) { for (var i = (times - 1) * 100; items[i] && i < times * 100; i++) {
res.push(items[i]); res.push(items[i]);
} }
return res; return res;
}, },
_hasNextByTimes: function (items, times) { _hasNextByTimes: function (items, times) {
return times * 10 < items.length; return times * 100 < items.length;
}, },
_itemsCreator: function (options, callback) { _itemsCreator: function (options, callback) {
@ -12852,15 +12852,12 @@ Demo.MultiSelectList = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () { _createMultiSelectCombo: function () {
var self = this; var self = this;
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.multi_select_insert_list", type: "bi.multi_select_insert_no_bar_list",
ref: function (ref) { ref: function (ref) {
self.list = ref; self.list = ref;
}, },
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
value: {
type: 1,
value: ["柳州市城贸金属材料有限责任公司", "柳州市建福房屋租赁有限公司", "柳州市迅昌数码办公设备有限责任公司"] value: ["柳州市城贸金属材料有限责任公司", "柳州市建福房屋租赁有限公司", "柳州市迅昌数码办公设备有限责任公司"]
}
}); });
widget.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { widget.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () {

8
dist/fineui.css vendored

@ -2399,7 +2399,7 @@ li.CodeMirror-hint-active {
color: white; color: white;
} }
.bi-message-title { .bi-message-title {
font-size: 16px; font-size: 14px;
cursor: pointer; cursor: pointer;
} }
.bi-message-text { .bi-message-text {
@ -2415,7 +2415,7 @@ li.CodeMirror-hint-active {
font-size: 16px; font-size: 16px;
} }
.bi-message-close { .bi-message-close {
font-size: 25px; font-size: 16px;
} }
.bi-message-animate { .bi-message-animate {
-webkit-transition: opacity 0.3s, transform 0.4s, -webkit-transform 0.4s; -webkit-transition: opacity 0.3s, transform 0.4s, -webkit-transform 0.4s;
@ -3823,13 +3823,11 @@ ul.ztree.zTreeDragUL {
} }
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
min-width: 16px;
-webkit-border-radius: 8px; -webkit-border-radius: 8px;
-moz-border-radius: 8px; -moz-border-radius: 8px;
border-radius: 8px; border-radius: 8px;
} }
.bi-multi-select-check-selected-button .count-tip {
min-width: 16px;
}
.bi-multi-tree-check-pane .multi-tree-check-selected { .bi-multi-tree-check-pane .multi-tree-check-selected {
color: #3685f2; color: #3685f2;
} }

648
dist/fineui.js vendored

@ -50753,8 +50753,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break; break;
} }
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}, },
setValue: function (value) { setValue: function (value) {
@ -50856,7 +50856,6 @@ $.extend(BI, {
el: { el: {
type: "bi.button", type: "bi.button",
text: BI.i18nText("BI-Basic_Cancel"), text: BI.i18nText("BI-Basic_Cancel"),
height: 30,
level: "ignore", level: "ignore",
handler: function () { handler: function () {
close(); close();
@ -50871,7 +50870,6 @@ $.extend(BI, {
el: { el: {
type: "bi.button", type: "bi.button",
text: BI.i18nText("BI-Basic_OK"), text: BI.i18nText("BI-Basic_OK"),
height: 30,
handler: function () { handler: function () {
close(); close();
if (BI.isFunction(callback)) { if (BI.isFunction(callback)) {
@ -51344,7 +51342,8 @@ BI.Popover = BI.inherit(BI.Widget, {
SMALL: "small", SMALL: "small",
NORMAL: "normal", NORMAL: "normal",
BIG: "big" BIG: "big"
} },
HEADER_HEIGHT: 40
}, },
_defaultConfig: function () { _defaultConfig: function () {
@ -51391,7 +51390,7 @@ BI.Popover = BI.inherit(BI.Widget, {
items: [{ items: [{
el: BI.isPlainObject(o.header) ? BI.createWidget(o.header) : { el: BI.isPlainObject(o.header) ? BI.createWidget(o.header) : {
type: "bi.label", type: "bi.label",
height: 36, height: this._constant.HEADER_HEIGHT,
text: o.header, text: o.header,
title: o.header, title: o.header,
textAlign: "left" textAlign: "left"
@ -51407,7 +51406,7 @@ BI.Popover = BI.inherit(BI.Widget, {
el: { el: {
type: "bi.icon_button", type: "bi.icon_button",
cls: "bi-message-close close-font", cls: "bi-message-close close-font",
height: 36, height: this._constant.HEADER_HEIGHT,
handler: function () { handler: function () {
self.close(); self.close();
} }
@ -51416,7 +51415,7 @@ BI.Popover = BI.inherit(BI.Widget, {
} }
} }
}, },
height: 36 height: this._constant.HEADER_HEIGHT
}, },
center: { center: {
el: { el: {
@ -98137,7 +98136,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -98162,33 +98161,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
value: o.value value: o.value
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -98206,7 +98197,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -98217,10 +98208,10 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -98329,6 +98320,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();
@ -98504,7 +98514,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -98535,33 +98545,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -98579,7 +98581,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -98590,10 +98592,10 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -98705,6 +98707,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();
@ -98850,6 +98871,166 @@ BI.extend(BI.MultiSelectInsertNoBarCombo, {
BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_insert_no_bar_combo", BI.MultiSelectInsertNoBarCombo);/** BI.shortcut("bi.multi_select_insert_no_bar_combo", BI.MultiSelectInsertNoBarCombo);/**
*
* 复选下拉框
* @class BI.MultiSelectInsertTrigger
* @extends BI.Trigger
*/
BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
constants: {
height: 14,
rgap: 4,
lgap: 4
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-trigger bi-border",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
searcher: {},
switcher: {},
adapter: null,
masker: {}
});
},
_init: function () {
BI.MultiSelectInsertTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.height) {
this.setHeight(o.height - 2);
}
this.searcher = BI.createWidget(o.searcher, {
type: "bi.multi_select_insert_searcher",
height: o.height,
text: o.text,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
popup: {},
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_START);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_PAUSE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_PAUSE);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, arguments);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_STOP);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_CHANGE, arguments);
});
this.numberCounter = BI.createWidget(o.switcher, {
type: "bi.multi_select_check_selected_switcher",
valueFormatter: o.valueFormatter,
itemsCreator: o.itemsCreator,
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK);
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW);
});
var wrapNumberCounter = BI.createWidget({
type: "bi.right_vertical_adapt",
hgap: 4,
items: [{
el: this.numberCounter
}]
});
var wrapper = BI.createWidget({
type: "bi.htape",
element: this,
items: [
{
el: this.searcher,
width: "fill"
}, {
el: wrapNumberCounter,
width: 0
}, {
el: BI.createWidget(),
width: 24
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);
wrapper.resize();
});
});
this.element.click(function (e) {
if (self.element.__isMouseInBounds__(e) && !self.numberCounter.element.__isMouseInBounds__(e)) {
self.numberCounter.hideView();
}
});
},
getCounter: function () {
return this.numberCounter;
},
getSearcher: function () {
return this.searcher;
},
stopEditing: function () {
this.searcher.stopSearch();
this.numberCounter.hideView();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) {
this.searcher.setValue(ob);
this.numberCounter.setValue(ob);
},
getKey: function () {
return this.searcher.getKey();
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiSelectInsertTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertTrigger.EVENT_START = "EVENT_START";
BI.MultiSelectInsertTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertTrigger.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_trigger", BI.MultiSelectInsertTrigger);/**
* 多选加载数据面板 * 多选加载数据面板
* Created by guy on 15/11/2. * Created by guy on 15/11/2.
* @class BI.MultiSelectLoader * @class BI.MultiSelectLoader
@ -99526,6 +99707,121 @@ BI.MultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW"; BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.shortcut("bi.multi_select_trigger", BI.MultiSelectTrigger);/** BI.shortcut("bi.multi_select_trigger", BI.MultiSelectTrigger);/**
*
* 在搜索框中输入文本弹出的面板
* @class BI.MultiSelectSearchInsertPane
* @extends Widget
*/
BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
constants: {
height: 24,
lgap: 10,
tgap: 5
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectSearchInsertPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-search-pane bi-card",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
keywordGetter: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectSearchInsertPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tooltipClick = BI.createWidget({
type: "bi.label",
invisible: true,
text: BI.i18nText("BI-Click_Blank_To_Select"),
cls: "multi-select-toolbar",
height: this.constants.height
});
this.addNotMatchTip = BI.createWidget({
type: "bi.icon_text_item",
invisible: true,
logic: {
dynamic: true
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
cls: "text-add-tip-font",
height: this.constants.height,
handler: function () {
self.fireEvent(BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM, o.keywordGetter());
}
});
this.loader = BI.createWidget({
type: "bi.multi_select_search_loader",
keywordGetter: o.keywordGetter,
valueFormatter: o.valueFormatter,
itemsCreator: function (op, callback) {
o.itemsCreator.apply(self, [op, function (res) {
callback(res);
self.setKeyword(o.keywordGetter());
}]);
},
value: o.value
});
this.loader.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.resizer = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
type: "bi.float_center_adapt",
items: [this.tooltipClick, this.addNotMatchTip],
height: this.constants.height
}, {
el: this.loader
}]
});
},
setKeyword: function (keyword) {
var btn;
var isMatchTipVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === btn.getValue());
this.tooltipClick.setVisible(isMatchTipVisible);
this.addNotMatchTip.setVisible(!isMatchTipVisible);
!isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword));
},
isAllSelected: function () {
return this.loader.isAllSelected();
},
hasMatched: function () {
return this.tooltipClick.isVisible();
},
setValue: function (v) {
this.loader.setValue(v);
},
getValue: function () {
return this.loader.getValue();
},
empty: function () {
this.loader.empty();
},
populate: function (items) {
this.loader.populate.apply(this.loader, arguments);
}
});
BI.MultiSelectSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_search_insert_pane", BI.MultiSelectSearchInsertPane);/**
* 多选加载数据搜索loader面板 * 多选加载数据搜索loader面板
* Created by guy on 15/11/4. * Created by guy on 15/11/4.
* @class BI.MultiSelectSearchLoader * @class BI.MultiSelectSearchLoader
@ -99936,6 +100232,187 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, {
}); });
BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE"; BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE";
BI.shortcut("bi.multi_select_editor", BI.MultiSelectEditor);/** BI.shortcut("bi.multi_select_editor", BI.MultiSelectEditor);/**
* searcher
* Created by guy on 15/11/3.
* @class BI.MultiSelectInsertSearcher
* @extends Widget
*/
BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertSearcher.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-searcher",
itemsCreator: BI.emptyFn,
el: {},
popup: {},
valueFormatter: BI.emptyFn,
adapter: null,
masker: {},
text: BI.i18nText("BI-Basic_Please_Select")
});
},
_init: function () {
BI.MultiSelectInsertSearcher.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.multi_select_editor",
height: o.height,
text: o.text
});
this.searcher = BI.createWidget({
type: "bi.searcher",
element: this,
height: o.height,
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback();
},
el: this.editor,
popup: BI.extend({
type: "bi.multi_select_search_insert_pane",
valueFormatter: o.valueFormatter,
keywordGetter: function () {
return self.editor.getValue();
},
itemsCreator: function (op, callback) {
var keyword = self.editor.getValue();
op.keywords = [keyword];
this.setKeyword(keyword);
o.itemsCreator(op, callback);
},
value: o.value,
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM);
}
}]
}, o.popup),
adapter: o.adapter,
masker: o.masker
});
this.searcher.on(BI.Searcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_START);
});
this.searcher.on(BI.Searcher.EVENT_PAUSE, function () {
if (this.hasMatched()) {
}
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_PAUSE);
});
this.searcher.on(BI.Searcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_STOP);
});
this.searcher.on(BI.Searcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_CHANGE, arguments);
});
this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () {
var keywords = this.getKeywords();
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, keywords);
});
if (BI.isNotNull(o.value)) {
this.setState(o.value);
}
},
adjustView: function () {
this.searcher.adjustView();
},
isSearching: function () {
return this.searcher.isSearching();
},
stopSearch: function () {
this.searcher.stopSearch();
},
getKeyword: function () {
return this.editor.getValue();
},
hasMatched: function () {
return this.searcher.hasMatched();
},
hasChecked: function () {
return this.searcher.getView() && this.searcher.getView().hasChecked();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) {
var o = this.options;
ob || (ob = {});
ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
} else {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
}
},
setValue: function (ob) {
this.setState(ob);
this.searcher.setValue(ob);
},
getKey: function () {
return this.editor.getValue();
},
getValue: function () {
return this.searcher.getValue();
},
populate: function (items) {
this.searcher.populate.apply(this.searcher, arguments);
}
});
BI.MultiSelectInsertSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.MultiSelectInsertSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertSearcher.EVENT_START = "EVENT_START";
BI.MultiSelectInsertSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertSearcher.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_searcher", BI.MultiSelectInsertSearcher);/**
* searcher * searcher
* Created by guy on 15/11/3. * Created by guy on 15/11/3.
* @class BI.MultiSelectSearcher * @class BI.MultiSelectSearcher
@ -100069,8 +100546,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
} else { } else {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.assist) === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.value) <= 20) { } else if (BI.size(ob.value) <= 20) {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {
@ -100251,7 +100726,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -100261,7 +100736,24 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}
} }
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -100312,16 +100804,6 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}
} }
} }
}, { }, {
@ -100584,7 +101066,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -100594,7 +101076,24 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
}
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -100645,16 +101144,6 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
} }
} }
}, { }, {
@ -104114,7 +104603,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = o.value || {}; this.storeValue = BI.deepClone(o.value || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
@ -104533,7 +105022,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || {}; this.storeValue = BI.deepClone(v || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue); this.combo.setValue(this.storeValue);
@ -105080,6 +105569,7 @@ BI.shortcut("bi.search_multi_select_popup_view", BI.SearchMultiSelectPopupView);
var ob = {}; var ob = {};
ob.type = obj.type; ob.type = obj.type;
ob.value = o.allValueGetter() || []; ob.value = o.allValueGetter() || [];
ob.assist = obj.assist;
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All); this.editor.setState(BI.Selection.All);

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

35
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

4
dist/widget.css vendored

@ -181,13 +181,11 @@
} }
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
min-width: 16px;
-webkit-border-radius: 8px; -webkit-border-radius: 8px;
-moz-border-radius: 8px; -moz-border-radius: 8px;
border-radius: 8px; border-radius: 8px;
} }
.bi-multi-select-check-selected-button .count-tip {
min-width: 16px;
}
.bi-multi-tree-check-pane .multi-tree-check-selected { .bi-multi-tree-check-pane .multi-tree-check-selected {
color: #3685f2; color: #3685f2;
} }

687
dist/widget.js vendored

@ -10281,7 +10281,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -10306,33 +10306,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
value: o.value value: o.value
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -10350,7 +10342,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -10361,10 +10353,10 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -10473,6 +10465,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();
@ -10648,7 +10659,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -10679,33 +10690,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -10723,7 +10726,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -10734,10 +10737,10 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -10849,6 +10852,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();
@ -10994,6 +11016,166 @@ BI.extend(BI.MultiSelectInsertNoBarCombo, {
BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.multi_select_insert_no_bar_combo", BI.MultiSelectInsertNoBarCombo);/** BI.shortcut("bi.multi_select_insert_no_bar_combo", BI.MultiSelectInsertNoBarCombo);/**
*
* 复选下拉框
* @class BI.MultiSelectInsertTrigger
* @extends BI.Trigger
*/
BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
constants: {
height: 14,
rgap: 4,
lgap: 4
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-trigger bi-border",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
searcher: {},
switcher: {},
adapter: null,
masker: {}
});
},
_init: function () {
BI.MultiSelectInsertTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.height) {
this.setHeight(o.height - 2);
}
this.searcher = BI.createWidget(o.searcher, {
type: "bi.multi_select_insert_searcher",
height: o.height,
text: o.text,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
popup: {},
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_START);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_PAUSE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_PAUSE);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, arguments);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_STOP);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_CHANGE, arguments);
});
this.numberCounter = BI.createWidget(o.switcher, {
type: "bi.multi_select_check_selected_switcher",
valueFormatter: o.valueFormatter,
itemsCreator: o.itemsCreator,
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK);
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW);
});
var wrapNumberCounter = BI.createWidget({
type: "bi.right_vertical_adapt",
hgap: 4,
items: [{
el: this.numberCounter
}]
});
var wrapper = BI.createWidget({
type: "bi.htape",
element: this,
items: [
{
el: this.searcher,
width: "fill"
}, {
el: wrapNumberCounter,
width: 0
}, {
el: BI.createWidget(),
width: 24
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);
wrapper.resize();
});
});
this.element.click(function (e) {
if (self.element.__isMouseInBounds__(e) && !self.numberCounter.element.__isMouseInBounds__(e)) {
self.numberCounter.hideView();
}
});
},
getCounter: function () {
return this.numberCounter;
},
getSearcher: function () {
return this.searcher;
},
stopEditing: function () {
this.searcher.stopSearch();
this.numberCounter.hideView();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) {
this.searcher.setValue(ob);
this.numberCounter.setValue(ob);
},
getKey: function () {
return this.searcher.getKey();
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiSelectInsertTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertTrigger.EVENT_START = "EVENT_START";
BI.MultiSelectInsertTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertTrigger.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_trigger", BI.MultiSelectInsertTrigger);/**
* 多选加载数据面板 * 多选加载数据面板
* Created by guy on 15/11/2. * Created by guy on 15/11/2.
* @class BI.MultiSelectLoader * @class BI.MultiSelectLoader
@ -11628,48 +11810,163 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
}); });
}, },
getCounter: function () { getCounter: function () {
return this.numberCounter; return this.numberCounter;
},
getSearcher: function () {
return this.searcher;
},
stopEditing: function () {
this.searcher.stopSearch();
this.numberCounter.hideView();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) {
this.searcher.setValue(ob);
this.numberCounter.setValue(ob);
},
getKey: function () {
return this.searcher.getKey();
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK";
BI.MultiSelectTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK";
BI.MultiSelectTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectTrigger.EVENT_START = "EVENT_START";
BI.MultiSelectTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectTrigger.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.shortcut("bi.multi_select_trigger", BI.MultiSelectTrigger);/**
*
* 在搜索框中输入文本弹出的面板
* @class BI.MultiSelectSearchInsertPane
* @extends Widget
*/
BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
constants: {
height: 24,
lgap: 10,
tgap: 5
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectSearchInsertPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-search-pane bi-card",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
keywordGetter: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectSearchInsertPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tooltipClick = BI.createWidget({
type: "bi.label",
invisible: true,
text: BI.i18nText("BI-Click_Blank_To_Select"),
cls: "multi-select-toolbar",
height: this.constants.height
});
this.addNotMatchTip = BI.createWidget({
type: "bi.icon_text_item",
invisible: true,
logic: {
dynamic: true
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
cls: "text-add-tip-font",
height: this.constants.height,
handler: function () {
self.fireEvent(BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM, o.keywordGetter());
}
});
this.loader = BI.createWidget({
type: "bi.multi_select_search_loader",
keywordGetter: o.keywordGetter,
valueFormatter: o.valueFormatter,
itemsCreator: function (op, callback) {
o.itemsCreator.apply(self, [op, function (res) {
callback(res);
self.setKeyword(o.keywordGetter());
}]);
},
value: o.value
});
this.loader.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.resizer = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
type: "bi.float_center_adapt",
items: [this.tooltipClick, this.addNotMatchTip],
height: this.constants.height
}, {
el: this.loader
}]
});
},
setKeyword: function (keyword) {
var btn;
var isMatchTipVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === btn.getValue());
this.tooltipClick.setVisible(isMatchTipVisible);
this.addNotMatchTip.setVisible(!isMatchTipVisible);
!isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword));
}, },
getSearcher: function () { isAllSelected: function () {
return this.searcher; return this.loader.isAllSelected();
}, },
stopEditing: function () { hasMatched: function () {
this.searcher.stopSearch(); return this.tooltipClick.isVisible();
this.numberCounter.hideView();
}, },
setAdapter: function (adapter) { setValue: function (v) {
this.searcher.setAdapter(adapter); this.loader.setValue(v);
this.numberCounter.setAdapter(adapter);
}, },
setValue: function (ob) { getValue: function () {
this.searcher.setValue(ob); return this.loader.getValue();
this.numberCounter.setValue(ob);
}, },
getKey: function () { empty: function () {
return this.searcher.getKey(); this.loader.empty();
}, },
getValue: function () { populate: function (items) {
return this.searcher.getValue(); this.loader.populate.apply(this.loader, arguments);
} }
}); });
BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK"; BI.MultiSelectSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK"; BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.MultiSelectTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectTrigger.EVENT_START = "EVENT_START";
BI.MultiSelectTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectTrigger.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.shortcut("bi.multi_select_trigger", BI.MultiSelectTrigger);/** BI.shortcut("bi.multi_select_search_insert_pane", BI.MultiSelectSearchInsertPane);/**
* 多选加载数据搜索loader面板 * 多选加载数据搜索loader面板
* Created by guy on 15/11/4. * Created by guy on 15/11/4.
* @class BI.MultiSelectSearchLoader * @class BI.MultiSelectSearchLoader
@ -12080,6 +12377,187 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, {
}); });
BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE"; BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE";
BI.shortcut("bi.multi_select_editor", BI.MultiSelectEditor);/** BI.shortcut("bi.multi_select_editor", BI.MultiSelectEditor);/**
* searcher
* Created by guy on 15/11/3.
* @class BI.MultiSelectInsertSearcher
* @extends Widget
*/
BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertSearcher.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-searcher",
itemsCreator: BI.emptyFn,
el: {},
popup: {},
valueFormatter: BI.emptyFn,
adapter: null,
masker: {},
text: BI.i18nText("BI-Basic_Please_Select")
});
},
_init: function () {
BI.MultiSelectInsertSearcher.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.multi_select_editor",
height: o.height,
text: o.text
});
this.searcher = BI.createWidget({
type: "bi.searcher",
element: this,
height: o.height,
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback();
},
el: this.editor,
popup: BI.extend({
type: "bi.multi_select_search_insert_pane",
valueFormatter: o.valueFormatter,
keywordGetter: function () {
return self.editor.getValue();
},
itemsCreator: function (op, callback) {
var keyword = self.editor.getValue();
op.keywords = [keyword];
this.setKeyword(keyword);
o.itemsCreator(op, callback);
},
value: o.value,
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM);
}
}]
}, o.popup),
adapter: o.adapter,
masker: o.masker
});
this.searcher.on(BI.Searcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_START);
});
this.searcher.on(BI.Searcher.EVENT_PAUSE, function () {
if (this.hasMatched()) {
}
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_PAUSE);
});
this.searcher.on(BI.Searcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_STOP);
});
this.searcher.on(BI.Searcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_CHANGE, arguments);
});
this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () {
var keywords = this.getKeywords();
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, keywords);
});
if (BI.isNotNull(o.value)) {
this.setState(o.value);
}
},
adjustView: function () {
this.searcher.adjustView();
},
isSearching: function () {
return this.searcher.isSearching();
},
stopSearch: function () {
this.searcher.stopSearch();
},
getKeyword: function () {
return this.editor.getValue();
},
hasMatched: function () {
return this.searcher.hasMatched();
},
hasChecked: function () {
return this.searcher.getView() && this.searcher.getView().hasChecked();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) {
var o = this.options;
ob || (ob = {});
ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
} else {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
}
},
setValue: function (ob) {
this.setState(ob);
this.searcher.setValue(ob);
},
getKey: function () {
return this.editor.getValue();
},
getValue: function () {
return this.searcher.getValue();
},
populate: function (items) {
this.searcher.populate.apply(this.searcher, arguments);
}
});
BI.MultiSelectInsertSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.MultiSelectInsertSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertSearcher.EVENT_START = "EVENT_START";
BI.MultiSelectInsertSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertSearcher.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_searcher", BI.MultiSelectInsertSearcher);/**
* searcher * searcher
* Created by guy on 15/11/3. * Created by guy on 15/11/3.
* @class BI.MultiSelectSearcher * @class BI.MultiSelectSearcher
@ -12213,8 +12691,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
} else { } else {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.assist) === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.value) <= 20) { } else if (BI.size(ob.value) <= 20) {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {
@ -12395,7 +12871,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -12405,7 +12881,24 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
} }
}
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -12456,16 +12949,6 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}
} }
} }
}, { }, {
@ -12728,7 +13211,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -12738,7 +13221,24 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
} }
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -12789,16 +13289,6 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
} }
} }
}, { }, {
@ -16258,7 +16748,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = o.value || {}; this.storeValue = BI.deepClone(o.value || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
@ -16677,7 +17167,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || {}; this.storeValue = BI.deepClone(v || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue); this.combo.setValue(this.storeValue);
@ -17224,6 +17714,7 @@ BI.shortcut("bi.search_multi_select_popup_view", BI.SearchMultiSelectPopupView);
var ob = {}; var ob = {};
ob.type = obj.type; ob.type = obj.type;
ob.value = o.allValueGetter() || []; ob.value = o.allValueGetter() || [];
ob.assist = obj.assist;
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All); this.editor.setState(BI.Selection.All);

2
src/base/formula/formulaeditor.js

@ -217,8 +217,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break; break;
} }
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}); });
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
}, },
setValue: function (value) { setValue: function (value) {

4
src/css/widget/multiselect/trigger/button.css

@ -1,9 +1,7 @@
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
min-width: 16px;
-webkit-border-radius: 8px; -webkit-border-radius: 8px;
-moz-border-radius: 8px; -moz-border-radius: 8px;
border-radius: 8px; border-radius: 8px;
} }
.bi-multi-select-check-selected-button .count-tip {
min-width: 16px;
}

4
src/less/widget/multiselect/trigger/button.checkselected.less

@ -2,8 +2,6 @@
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
.border-radius(8px);
& .count-tip{
min-width: 16px; min-width: 16px;
} .border-radius(8px);
} }

57
src/widget/multiselect/multiselect.insert.combo.js

@ -28,7 +28,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -53,33 +53,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
value: o.value value: o.value
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -97,7 +89,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -108,10 +100,10 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -220,6 +212,25 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();

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

@ -31,7 +31,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
this.requesting = false; this.requesting = false;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_insert_trigger",
height: o.height, height: o.height,
text: o.text, text: o.text,
// adapter: this.popup, // adapter: this.popup,
@ -62,33 +62,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_START, function () {
self._setStartValue(""); self._setStartValue("");
this.getSearcher().setValue(self.storeValue); this.getSearcher().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_STOP, function () {
self._setStartValue(""); self._setStartValue("");
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
// if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); self._addItem(assertShowValue);
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
} }
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
}); });
// } this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
if (!this.getSearcher().hasMatched()) {
self._addItem(assertShowValue);
self.trigger.stopEditing();
}
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { if (keywords.length > 0) {
@ -106,7 +98,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) { if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () { self._joinAll(this.getValue(), function () {
assertShowValue(); assertShowValue();
@ -117,10 +109,10 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
} }
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue); this.getCounter().setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
self.combo.showView(); self.combo.showView();
} }
@ -232,6 +224,25 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) {
var self = this;
var keyword = this.trigger.getSearcher().getKeyword();
this._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
// 如果在不选的状态下直接把该值添加进来
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self.populate();
self._setStartValue("");
});
},
_defaultState: function () { _defaultState: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.combo.hideView(); this.combo.hideView();

161
src/widget/multiselect/multiselect.insert.trigger.js

@ -0,0 +1,161 @@
/**
*
* 复选下拉框
* @class BI.MultiSelectInsertTrigger
* @extends BI.Trigger
*/
BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
constants: {
height: 14,
rgap: 4,
lgap: 4
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-trigger bi-border",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
searcher: {},
switcher: {},
adapter: null,
masker: {}
});
},
_init: function () {
BI.MultiSelectInsertTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.height) {
this.setHeight(o.height - 2);
}
this.searcher = BI.createWidget(o.searcher, {
type: "bi.multi_select_insert_searcher",
height: o.height,
text: o.text,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
popup: {},
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_START);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_PAUSE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_PAUSE);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, arguments);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_STOP);
});
this.searcher.on(BI.MultiSelectInsertSearcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_CHANGE, arguments);
});
this.numberCounter = BI.createWidget(o.switcher, {
type: "bi.multi_select_check_selected_switcher",
valueFormatter: o.valueFormatter,
itemsCreator: o.itemsCreator,
adapter: o.adapter,
masker: o.masker,
value: o.value
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK);
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW);
});
var wrapNumberCounter = BI.createWidget({
type: "bi.right_vertical_adapt",
hgap: 4,
items: [{
el: this.numberCounter
}]
});
var wrapper = BI.createWidget({
type: "bi.htape",
element: this,
items: [
{
el: this.searcher,
width: "fill"
}, {
el: wrapNumberCounter,
width: 0
}, {
el: BI.createWidget(),
width: 24
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);
wrapper.resize();
});
});
this.element.click(function (e) {
if (self.element.__isMouseInBounds__(e) && !self.numberCounter.element.__isMouseInBounds__(e)) {
self.numberCounter.hideView();
}
});
},
getCounter: function () {
return this.numberCounter;
},
getSearcher: function () {
return this.searcher;
},
stopEditing: function () {
this.searcher.stopSearch();
this.numberCounter.hideView();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
this.numberCounter.setAdapter(adapter);
},
setValue: function (ob) {
this.searcher.setValue(ob);
this.numberCounter.setValue(ob);
},
getKey: function () {
return this.searcher.getKey();
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.MultiSelectInsertTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK";
BI.MultiSelectInsertTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertTrigger.EVENT_START = "EVENT_START";
BI.MultiSelectInsertTrigger.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertTrigger.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_trigger", BI.MultiSelectInsertTrigger);

116
src/widget/multiselect/search/multiselect.search.insert.pane.js

@ -0,0 +1,116 @@
/**
*
* 在搜索框中输入文本弹出的面板
* @class BI.MultiSelectSearchInsertPane
* @extends Widget
*/
BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
constants: {
height: 24,
lgap: 10,
tgap: 5
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectSearchInsertPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-search-pane bi-card",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
keywordGetter: BI.emptyFn
});
},
_init: function () {
BI.MultiSelectSearchInsertPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tooltipClick = BI.createWidget({
type: "bi.label",
invisible: true,
text: BI.i18nText("BI-Click_Blank_To_Select"),
cls: "multi-select-toolbar",
height: this.constants.height
});
this.addNotMatchTip = BI.createWidget({
type: "bi.icon_text_item",
invisible: true,
logic: {
dynamic: true
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
cls: "text-add-tip-font",
height: this.constants.height,
handler: function () {
self.fireEvent(BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM, o.keywordGetter());
}
});
this.loader = BI.createWidget({
type: "bi.multi_select_search_loader",
keywordGetter: o.keywordGetter,
valueFormatter: o.valueFormatter,
itemsCreator: function (op, callback) {
o.itemsCreator.apply(self, [op, function (res) {
callback(res);
self.setKeyword(o.keywordGetter());
}]);
},
value: o.value
});
this.loader.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.resizer = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
type: "bi.float_center_adapt",
items: [this.tooltipClick, this.addNotMatchTip],
height: this.constants.height
}, {
el: this.loader
}]
});
},
setKeyword: function (keyword) {
var btn;
var isMatchTipVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === btn.getValue());
this.tooltipClick.setVisible(isMatchTipVisible);
this.addNotMatchTip.setVisible(!isMatchTipVisible);
!isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword));
},
isAllSelected: function () {
return this.loader.isAllSelected();
},
hasMatched: function () {
return this.tooltipClick.isVisible();
},
setValue: function (v) {
this.loader.setValue(v);
},
getValue: function () {
return this.loader.getValue();
},
empty: function () {
this.loader.empty();
},
populate: function (items) {
this.loader.populate.apply(this.loader, arguments);
}
});
BI.MultiSelectSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_search_insert_pane", BI.MultiSelectSearchInsertPane);

182
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -0,0 +1,182 @@
/**
* searcher
* Created by guy on 15/11/3.
* @class BI.MultiSelectInsertSearcher
* @extends Widget
*/
BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.MultiSelectInsertSearcher.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-searcher",
itemsCreator: BI.emptyFn,
el: {},
popup: {},
valueFormatter: BI.emptyFn,
adapter: null,
masker: {},
text: BI.i18nText("BI-Basic_Please_Select")
});
},
_init: function () {
BI.MultiSelectInsertSearcher.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.multi_select_editor",
height: o.height,
text: o.text
});
this.searcher = BI.createWidget({
type: "bi.searcher",
element: this,
height: o.height,
isAutoSearch: false,
isAutoSync: false,
onSearch: function (op, callback) {
callback();
},
el: this.editor,
popup: BI.extend({
type: "bi.multi_select_search_insert_pane",
valueFormatter: o.valueFormatter,
keywordGetter: function () {
return self.editor.getValue();
},
itemsCreator: function (op, callback) {
var keyword = self.editor.getValue();
op.keywords = [keyword];
this.setKeyword(keyword);
o.itemsCreator(op, callback);
},
value: o.value,
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM);
}
}]
}, o.popup),
adapter: o.adapter,
masker: o.masker
});
this.searcher.on(BI.Searcher.EVENT_START, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_START);
});
this.searcher.on(BI.Searcher.EVENT_PAUSE, function () {
if (this.hasMatched()) {
}
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_PAUSE);
});
this.searcher.on(BI.Searcher.EVENT_STOP, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_STOP);
});
this.searcher.on(BI.Searcher.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_CHANGE, arguments);
});
this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () {
var keywords = this.getKeywords();
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, keywords);
});
if (BI.isNotNull(o.value)) {
this.setState(o.value);
}
},
adjustView: function () {
this.searcher.adjustView();
},
isSearching: function () {
return this.searcher.isSearching();
},
stopSearch: function () {
this.searcher.stopSearch();
},
getKeyword: function () {
return this.editor.getValue();
},
hasMatched: function () {
return this.searcher.hasMatched();
},
hasChecked: function () {
return this.searcher.getView() && this.searcher.getView().hasChecked();
},
setAdapter: function (adapter) {
this.searcher.setAdapter(adapter);
},
setState: function (ob) {
var o = this.options;
ob || (ob = {});
ob.value || (ob.value = []);
if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.assist) <= 20) {
var state = "";
BI.each(ob.assist, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
} else {
if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.value) <= 20) {
var state = "";
BI.each(ob.value, function (i, v) {
if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v);
} else {
state += "," + (o.valueFormatter(v + "") || v);
}
});
this.editor.setState(state);
} else {
this.editor.setState(BI.Selection.Multi);
}
}
},
setValue: function (ob) {
this.setState(ob);
this.searcher.setValue(ob);
},
getKey: function () {
return this.editor.getValue();
},
getValue: function () {
return this.searcher.getValue();
},
populate: function (items) {
this.searcher.populate.apply(this.searcher, arguments);
}
});
BI.MultiSelectInsertSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.MultiSelectInsertSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiSelectInsertSearcher.EVENT_START = "EVENT_START";
BI.MultiSelectInsertSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiSelectInsertSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiSelectInsertSearcher.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.MultiSelectInsertSearcher.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.shortcut("bi.multi_select_insert_searcher", BI.MultiSelectInsertSearcher);

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

@ -132,8 +132,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
} else { } else {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else if (BI.size(ob.assist) === 0) {
this.editor.setState(BI.Selection.All);
} else if (BI.size(ob.value) <= 20) { } else if (BI.size(ob.value) <= 20) {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {

29
src/widget/multiselectlist/multiselectlist.insert.js

@ -39,7 +39,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -49,7 +49,24 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}
} }
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -100,16 +117,6 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE);
}
} }
} }
}, { }, {

29
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -45,7 +45,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
}); });
this.searcherPane = BI.createWidget({ this.searcherPane = BI.createWidget({
type: "bi.multi_select_search_pane", type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom", cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
keywordGetter: function () { keywordGetter: function () {
@ -55,7 +55,24 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
op.keywords = [self.trigger.getKeyword()]; op.keywords = [self.trigger.getKeyword()];
this.setKeyword(op.keywords[0]); this.setKeyword(op.keywords[0]);
o.itemsCreator(op, callback); o.itemsCreator(op, callback);
},
listeners: [{
eventName: BI.MultiSelectSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
var keyword = self.trigger.getKeyword();
if (!self.trigger.hasMatched()) {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
} }
}
}]
}); });
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);
@ -106,16 +123,6 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
self._setStartValue(""); self._setStartValue("");
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE); self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}); });
} else {
if (self.storeValue.type === BI.Selection.Multi) {
self.storeValue.value.pushDistinct(keyword);
}
self._showAdapter();
self.adapter.setValue(self.storeValue);
self.adapter.populate();
if (self.storeValue.type === BI.Selection.Multi) {
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE);
}
} }
} }
}, { }, {

4
src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js

@ -23,7 +23,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
self.trigger.getSearcher().setState(self.storeValue); self.trigger.getSearcher().setState(self.storeValue);
self.trigger.getCounter().setButtonChecked(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue);
}; };
this.storeValue = o.value || {}; this.storeValue = BI.deepClone(o.value || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
@ -442,7 +442,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, {
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v || {}; this.storeValue = BI.deepClone(v || {});
this._updateAllValue(); this._updateAllValue();
this._assertValue(this.storeValue); this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue); this.combo.setValue(this.storeValue);

1
src/widget/searchmultitextvaluecombo/trigger/searcher.multitextvalue.js

@ -107,6 +107,7 @@ BI.SearchMultiSelectSearcher = BI.inherit(BI.Widget, {
var ob = {}; var ob = {};
ob.type = obj.type; ob.type = obj.type;
ob.value = o.allValueGetter() || []; ob.value = o.allValueGetter() || [];
ob.assist = obj.assist;
if (ob.type === BI.Selection.All) { if (ob.type === BI.Selection.All) {
if (ob.value.length === 0) { if (ob.value.length === 0) {
this.editor.setState(BI.Selection.All); this.editor.setState(BI.Selection.All);

Loading…
Cancel
Save