Browse Source

BI-24217 search_text_value_combo && bubble高度字体规范 && color_picker图片更新

es6
windy 6 years ago
parent
commit
cbcee1e0e9
  1. 18
      demo/js/widget/multiselect/demo.multi_select_combo.js
  2. 24
      dist/_fineui.min.js
  3. 3
      dist/base.css
  4. 14
      dist/base.js
  5. 26
      dist/bundle.css
  6. 1091
      dist/bundle.js
  7. 2
      dist/bundle.min.css
  8. 56
      dist/bundle.min.js
  9. 20
      dist/case.js
  10. 4
      dist/core.js
  11. 18
      dist/demo.js
  12. 26
      dist/fineui.css
  13. 1091
      dist/fineui.js
  14. 2
      dist/fineui.min.css
  15. 24
      dist/fineui.min.js
  16. BIN
      dist/images/1x/background/auto_color_normal.png
  17. BIN
      dist/images/2x/background/auto_color_normal.png
  18. 5
      dist/resource.css
  19. 18
      dist/widget.css
  20. 1053
      dist/widget.js
  21. 5
      public/css/background.css
  22. 2
      src/base/single/editor/editor.js
  23. 12
      src/base/single/tip/tip.bubble.js
  24. 6
      src/case/colorchooser/colorpicker/editor.colorpicker.js
  25. 14
      src/case/editor/editor.state.js
  26. 4
      src/core/controller/controller.bubbles.js
  27. 3
      src/css/base/single/tip/tip.css
  28. 5
      src/css/resource/background.css
  29. 18
      src/css/widget/searchmultiselect/searchmultiselect.css
  30. 1
      src/less/base/single/tip/tip.bubble.less
  31. 1
      src/less/lib/background.less
  32. 4
      src/less/resource/background.less
  33. 28
      src/less/widget/searchmultiselect/searchmultiselect.less
  34. 3
      src/widget/multiselect/trigger/editor.multiselect.js
  35. 474
      src/widget/searchmultiselect/multiselect.combo.search.js
  36. 151
      src/widget/searchmultiselect/multiselect.combo.trigger.search.js
  37. 173
      src/widget/searchmultiselect/multiselect.loader.search.js
  38. 88
      src/widget/searchmultiselect/multiselect.popup.view.search.js
  39. 169
      src/widget/searchmultiselect/trigger/searcher.multiselect.search.js
  40. 5
      ui/css/background.css

18
demo/js/widget/multiselect/demo.multi_select_combo.js

@ -9,7 +9,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_combo",
type: "bi.multi_select_combo",
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {
@ -74,12 +74,16 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
render: function () {
return {
type: "bi.absolute",
scrolly: false,
items: [{
el: this._createMultiSelectCombo(),
right: "50%",
top: 10
type: "bi.vertical",
vgap: 200,
items: [this._createMultiSelectCombo(), {
type: "bi.search_multi_select_combo",
items: Demo.CONSTANTS.ITEMS,
text: "请选择",
value: {
type: 1,
value: ["1", "2", "3"]
}
}]
};
}

24
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

3
dist/base.css vendored

@ -1279,9 +1279,6 @@ body .bi-button.button-ignore.disabled.ghost .b-font:before,
word-wrap: break-word;
word-break: break-word;
}
.bi-bubble {
font-size: 14px;
}
.bi-bubble .bubble-text {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;

14
dist/base.js vendored

@ -18520,7 +18520,7 @@ BI.Editor = BI.inherit(BI.Single, {
errorText = errorText(this.editor.getValue());
}
if (!this.disabledError && BI.isKey(errorText)) {
BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this);
BI.Bubbles.show(this.getName(), errorText, this);
this._checkToolTip();
return BI.Bubbles.get(this.getName());
}
@ -20475,7 +20475,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
direction: "top",
text: "",
level: "error",
height: 35
height: 18
});
},
_init: function () {
@ -20500,7 +20500,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
cls: "bubble-text" + (" bubble-" + o.level),
text: o.text,
hgap: 10,
height: 30
height: 18
}));
},
@ -20509,7 +20509,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
type: "bi.vertical",
items: [{
el: this._createBubbleText(),
height: 30
height: 18
}, {
el: {
type: "bi.layout"
@ -20529,7 +20529,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
height: 3
}, {
el: this._createBubbleText(),
height: 30
height: 18
}]
});
},
@ -20541,7 +20541,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
el: {
type: "bi.layout",
width: 3,
height: 30
height: 18
}
}, {
el: this._createBubbleText()
@ -20556,7 +20556,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
el: {
type: "bi.layout",
width: 3,
height: 30
height: 18
}
}, {
el: this._createBubbleText()

26
dist/bundle.css vendored

@ -2950,9 +2950,6 @@ body .bi-button.button-ignore.disabled.ghost .b-font:before,
word-wrap: break-word;
word-break: break-word;
}
.bi-bubble {
font-size: 14px;
}
.bi-bubble .bubble-text {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
@ -3909,6 +3906,24 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 2px;
border-radius: 2px;
}
.bi-search-multi-select-combo .multi-select-trigger-icon-button {
font-size: 16px;
}
.bi-search-multi-select-combo.combo-error .bi-multi-select-searcher .tip-text-style {
color: #ff4949;
}
.bi-search-multi-select-combo .trigger-up {
display: none;
}
.bi-search-multi-select-combo .trigger-down {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-up {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-down {
display: none;
}
.bi-sequence-table-dynamic-number .sequence-table-title-cell {
overflow: hidden;
overflow-x: hidden;
@ -4388,6 +4403,11 @@ textarea::-webkit-scrollbar-thumb:hover {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/background/auto_color.png');
_background: none;
}
.auto-color-normal-background {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/background/auto_color_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/background/auto_color_normal.png');
_background: none;
}
.trans-color-background {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/background/trans_color.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/background/trans_color.png');

1091
dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

56
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

20
dist/case.js vendored

@ -4624,11 +4624,11 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
_showPreColor: function (color) {
if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background");
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-normal-background");
} else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-background").addClass("trans-color-background");
this.colorShow.element.css("background-color", "").removeClass("auto-color-normal-background").addClass("trans-color-background");
} else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-background").removeClass("trans-color-background");
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-normal-background").removeClass("trans-color-background");
}
},
@ -7971,7 +7971,8 @@ BI.StateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -7996,10 +7997,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
});
this.text = BI.createWidget({
type: "bi.text_button",
cls: "state-editor-infinite-text",
cls: "state-editor-infinite-text tip-text-style",
textAlign: "left",
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
text: o.text,
hgap: 4,
handler: function () {
self._showInput();
@ -8162,6 +8163,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.StateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -8173,7 +8175,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
this.text.setTitle("");
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.setTitle("");
this.text.element.addClass("state-editor-infinite-text");
}
@ -8181,7 +8183,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}
if (BI.isString(v)) {
// if (BI.isEmpty(v)) {
// this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
// this.text.setText(o.text);
// this.text.setTitle("");
// this.text.element.addClass("state-editor-infinite-text");
// } else {
@ -8193,7 +8195,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}
if (BI.isArray(v)) {
if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else if (v.length === 1) {
this.text.setText(v[0]);

4
dist/core.js vendored

@ -26665,7 +26665,7 @@ BI.BubblesController = BI.inherit(BI.Controller, {
},
_const: {
bubbleHeight: 35
bubbleHeight: 18
},
_init: function () {
@ -26687,7 +26687,7 @@ BI.BubblesController = BI.inherit(BI.Controller, {
type: "bi.bubble",
text: text,
level: level,
height: height || 35,
height: height || 18,
direction: direct
});
},

18
dist/demo.js vendored

@ -12745,7 +12745,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_combo",
type: "bi.multi_select_combo",
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {
@ -12810,12 +12810,16 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
render: function () {
return {
type: "bi.absolute",
scrolly: false,
items: [{
el: this._createMultiSelectCombo(),
right: "50%",
top: 10
type: "bi.vertical",
vgap: 200,
items: [this._createMultiSelectCombo(), {
type: "bi.search_multi_select_combo",
items: Demo.CONSTANTS.ITEMS,
text: "请选择",
value: {
type: 1,
value: ["1", "2", "3"]
}
}]
};
}

26
dist/fineui.css vendored

@ -2950,9 +2950,6 @@ body .bi-button.button-ignore.disabled.ghost .b-font:before,
word-wrap: break-word;
word-break: break-word;
}
.bi-bubble {
font-size: 14px;
}
.bi-bubble .bubble-text {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
@ -3909,6 +3906,24 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 2px;
border-radius: 2px;
}
.bi-search-multi-select-combo .multi-select-trigger-icon-button {
font-size: 16px;
}
.bi-search-multi-select-combo.combo-error .bi-multi-select-searcher .tip-text-style {
color: #ff4949;
}
.bi-search-multi-select-combo .trigger-up {
display: none;
}
.bi-search-multi-select-combo .trigger-down {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-up {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-down {
display: none;
}
.bi-sequence-table-dynamic-number .sequence-table-title-cell {
overflow: hidden;
overflow-x: hidden;
@ -4388,6 +4403,11 @@ textarea::-webkit-scrollbar-thumb:hover {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/background/auto_color.png');
_background: none;
}
.auto-color-normal-background {
background: url('resources?path=/com/fr/web/ui/images/1x/background/auto_color_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/background/auto_color_normal.png');
_background: none;
}
.trans-color-background {
background: url('resources?path=/com/fr/web/ui/images/1x/background/trans_color.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/background/trans_color.png');

1091
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

24
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/images/1x/background/auto_color_normal.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

BIN
dist/images/2x/background/auto_color_normal.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

5
dist/resource.css vendored

@ -314,6 +314,11 @@ textarea::-webkit-scrollbar-thumb:hover {
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/background/auto_color.png');
_background: none;
}
.auto-color-normal-background {
background: url('images/1x/background/auto_color_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/background/auto_color_normal.png');
_background: none;
}
.trans-color-background {
background: url('images/1x/background/trans_color.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/background/trans_color.png');

18
dist/widget.css vendored

@ -291,6 +291,24 @@
-moz-border-radius: 2px;
border-radius: 2px;
}
.bi-search-multi-select-combo .multi-select-trigger-icon-button {
font-size: 16px;
}
.bi-search-multi-select-combo.combo-error .bi-multi-select-searcher .tip-text-style {
color: #ff4949;
}
.bi-search-multi-select-combo .trigger-up {
display: none;
}
.bi-search-multi-select-combo .trigger-down {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-up {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-down {
display: none;
}
.bi-sequence-table-dynamic-number .sequence-table-title-cell {
overflow: hidden;
overflow-x: hidden;

1053
dist/widget.js vendored

File diff suppressed because it is too large Load Diff

5
public/css/background.css

@ -243,6 +243,11 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/background/auto_color.png');
_background: none;
}
.auto-color-normal-background {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/background/auto_color_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/background/auto_color_normal.png');
_background: none;
}
.trans-color-background {
background: url('https://fanruan.coding.me/fineui/dist/images/1x/background/trans_color.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://fanruan.coding.me/fineui/dist/images/1x/background/trans_color.png');

2
src/base/single/editor/editor.js

@ -227,7 +227,7 @@ BI.Editor = BI.inherit(BI.Single, {
errorText = errorText(this.editor.getValue());
}
if (!this.disabledError && BI.isKey(errorText)) {
BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this);
BI.Bubbles.show(this.getName(), errorText, this);
this._checkToolTip();
return BI.Bubbles.get(this.getName());
}

12
src/base/single/tip/tip.bubble.js

@ -12,7 +12,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
direction: "top",
text: "",
level: "error",
height: 35
height: 18
});
},
_init: function () {
@ -37,7 +37,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
cls: "bubble-text" + (" bubble-" + o.level),
text: o.text,
hgap: 10,
height: 30
height: 18
}));
},
@ -46,7 +46,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
type: "bi.vertical",
items: [{
el: this._createBubbleText(),
height: 30
height: 18
}, {
el: {
type: "bi.layout"
@ -66,7 +66,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
height: 3
}, {
el: this._createBubbleText(),
height: 30
height: 18
}]
});
},
@ -78,7 +78,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
el: {
type: "bi.layout",
width: 3,
height: 30
height: 18
}
}, {
el: this._createBubbleText()
@ -93,7 +93,7 @@ BI.Bubble = BI.inherit(BI.Tip, {
el: {
type: "bi.layout",
width: 3,
height: 30
height: 18
}
}, {
el: this._createBubbleText()

6
src/case/colorchooser/colorpicker/editor.colorpicker.js

@ -171,11 +171,11 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
_showPreColor: function (color) {
if (color === "") {
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background");
this.colorShow.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-normal-background");
} else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-background").addClass("trans-color-background");
this.colorShow.element.css("background-color", "").removeClass("auto-color-normal-background").addClass("trans-color-background");
} else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-background").removeClass("trans-color-background");
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-normal-background").removeClass("trans-color-background");
}
},

14
src/case/editor/editor.state.js

@ -20,7 +20,8 @@ BI.StateEditor = BI.inherit(BI.Widget, {
allowBlank: true,
watermark: "",
errorText: "",
height: 24
height: 24,
text: BI.i18nText("BI-Basic_Unrestricted")
});
},
@ -45,10 +46,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
});
this.text = BI.createWidget({
type: "bi.text_button",
cls: "state-editor-infinite-text",
cls: "state-editor-infinite-text tip-text-style",
textAlign: "left",
height: o.height,
text: BI.i18nText("BI-Basic_Unrestricted"),
text: o.text,
hgap: 4,
handler: function () {
self._showInput();
@ -211,6 +212,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
},
setState: function (v) {
var o = this.options;
BI.StateEditor.superclass.setValue.apply(this, arguments);
if (BI.isNumber(v)) {
if (v === BI.Selection.All) {
@ -222,7 +224,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
this.text.setTitle("");
this.text.element.removeClass("state-editor-infinite-text");
} else {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.setTitle("");
this.text.element.addClass("state-editor-infinite-text");
}
@ -230,7 +232,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}
if (BI.isString(v)) {
// if (BI.isEmpty(v)) {
// this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
// this.text.setText(o.text);
// this.text.setTitle("");
// this.text.element.addClass("state-editor-infinite-text");
// } else {
@ -242,7 +244,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}
if (BI.isArray(v)) {
if (BI.isEmpty(v)) {
this.text.setText(BI.i18nText("BI-Basic_Unrestricted"));
this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text");
} else if (v.length === 1) {
this.text.setText(v[0]);

4
src/core/controller/controller.bubbles.js

@ -11,7 +11,7 @@ BI.BubblesController = BI.inherit(BI.Controller, {
},
_const: {
bubbleHeight: 35
bubbleHeight: 18
},
_init: function () {
@ -33,7 +33,7 @@ BI.BubblesController = BI.inherit(BI.Controller, {
type: "bi.bubble",
text: text,
level: level,
height: height || 35,
height: height || 18,
direction: direct
});
},

3
src/css/base/single/tip/tip.css

@ -1,6 +1,3 @@
.bi-bubble {
font-size: 14px;
}
.bi-bubble .bubble-text {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;

5
src/css/resource/background.css

@ -243,6 +243,11 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/background/auto_color.png');
_background: none;
}
.auto-color-normal-background {
background: url('images/1x/background/auto_color_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/background/auto_color_normal.png');
_background: none;
}
.trans-color-background {
background: url('images/1x/background/trans_color.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/1x/background/trans_color.png');

18
src/css/widget/searchmultiselect/searchmultiselect.css

@ -0,0 +1,18 @@
.bi-search-multi-select-combo .multi-select-trigger-icon-button {
font-size: 16px;
}
.bi-search-multi-select-combo.combo-error .bi-multi-select-searcher .tip-text-style {
color: #ff4949;
}
.bi-search-multi-select-combo .trigger-up {
display: none;
}
.bi-search-multi-select-combo .trigger-down {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-up {
display: block;
}
.bi-search-multi-select-combo.combo-show .trigger-down {
display: none;
}

1
src/less/base/single/tip/tip.bubble.less

@ -1,7 +1,6 @@
@import "../../../index";
.bi-bubble{
font-size: @font-size-14;
& .bubble-text{
.border-radius(2px);
}

1
src/less/lib/background.less

@ -1,4 +1,5 @@
@background-auto-color: "background/auto_color.png";
@background-auto-color-normal: "background/auto_color_normal.png";
@background-trans-color: "background/trans_color.png";
@background-farbtastic-wheel:"background/wheel.png";

4
src/less/resource/background.less

@ -231,6 +231,10 @@
.imagePath(@background-auto-color);
}
.auto-color-normal-background {
.imagePath(@background-auto-color-normal);
}
.trans-color-background {
.imagePath(@background-trans-color);
}

28
src/less/widget/searchmultiselect/searchmultiselect.less

@ -0,0 +1,28 @@
@import "../../index";
.bi-search-multi-select-combo{
& .multi-select-trigger-icon-button{
font-size: 16px;
}
&.combo-error {
& .bi-multi-select-searcher {
& .tip-text-style{
color: @color-bi-text-failure;
}
}
}
& .trigger-up {
display: none;
}
& .trigger-down {
display: block;
}
&.combo-show {
& .trigger-up {
display: block;
}
& .trigger-down {
display: none;
}
}
}

3
src/widget/multiselect/trigger/editor.multiselect.js

@ -22,7 +22,8 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, {
height: o.height,
watermark: BI.i18nText("BI-Basic_Search"),
allowBlank: true,
value: o.value
value: o.value,
text: o.text
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {

474
src/widget/searchmultiselect/multiselect.combo.search.js

@ -0,0 +1,474 @@
/**
*
* @class BI.SearchMultiSelectCombo
* @extends BI.Single
*/
BI.SearchMultiSelectCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.SearchMultiSelectCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-combo bi-search-multi-select-combo",
height: 24,
items: []
});
},
_init: function () {
BI.SearchMultiSelectCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var assertShowValue = function () {
BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue);
self._updateAllValue();
self._checkError();
self.trigger.getSearcher().setState(self.storeValue);
self.trigger.getCounter().setButtonChecked(self.storeValue);
};
this.storeValue = o.value || {};
this._updateAllValue();
this._assertValue(this.storeValue);
this._checkError();
// 标记正在请求数据
this.requesting = false;
this.trigger = BI.createWidget({
type: "bi.search_multi_select_trigger",
text: o.text,
height: o.height,
// adapter: this.popup,
masker: {
offset: {
left: 1,
top: 1,
right: 2,
bottom: 33
}
},
allValueGetter: function () {
return self.allValue;
},
valueFormatter: o.valueFormatter,
itemsCreator: function (op, callback) {
self._itemsCreator(op, function (res) {
if (op.times === 1 && BI.isNotNull(op.keywords)) {
// 预防trigger内部把当前的storeValue改掉
self.trigger.setValue(BI.deepClone(self.getValue()));
}
callback.apply(self, arguments);
});
},
value: this.storeValue
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self._setStartValue("");
this.getSearcher().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self._setStartValue("");
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword();
self._join({
type: BI.Selection.Multi,
value: [keyword]
}, function () {
self.combo.setValue(self.storeValue);
self._setStartValue(keyword);
assertShowValue();
self._populate();
self._setStartValue("");
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.isEndWithBlank(last)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue("");
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) {
if (obj instanceof BI.MultiSelectBar) {
self._joinAll(this.getValue(), function () {
assertShowValue();
});
} else {
self._join(this.getValue(), function () {
assertShowValue();
});
}
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () {
this.getCounter().setValue(self.storeValue);
});
this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
el: this.trigger,
adjustLength: 1,
popup: {
type: "bi.search_multi_select_popup_view",
ref: function () {
self.popup = this;
self.trigger.setAdapter(this);
},
listeners: [{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self.storeValue = this.getValue();
self._adjust(function () {
assertShowValue();
});
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM,
action: function () {
self._defaultState();
}
}, {
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR,
action: function () {
self.setValue();
self._defaultState();
}
}],
itemsCreator: BI.bind(self._itemsCreator, this),
valueFormatter: o.valueFormatter,
onLoaded: function () {
BI.nextTick(function () {
self.combo.adjustWidth();
self.combo.adjustHeight();
self.trigger.getCounter().adjustView();
self.trigger.getSearcher().adjustView();
});
}
},
value: o.value,
hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0;
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () {
self.element.removeClass("combo-show");
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.element.removeClass("combo-show").addClass("combo-show");
this.setValue(self.storeValue);
BI.nextTick(function () {
self._populate();
});
});
// 当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件
this.wants2Quit = false;
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
// important:关闭弹出时又可能没有退出编辑状态
self.trigger.stopEditing();
if (self.requesting === true) {
self.wants2Quit = true;
} else {
self.fireEvent(BI.SearchMultiSelectCombo.EVENT_CONFIRM);
}
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.trigger.getCounter().hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}]
});
this._checkError();
},
_defaultState: function () {
this.trigger.stopEditing();
this.combo.hideView();
},
_assertValue: function (val) {
var o = this.options;
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
BI.remove(val.value, function (idx, value) {
return !BI.contains(BI.map(o.items, "value"), value);
});
},
_makeMap: function (values) {
return BI.makeObject(values || []);
},
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
this._itemsCreator({
type: BI.SearchMultiSelectCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest (items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val);
}
});
self._adjust(callback);
}
},
_joinAll: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this.requesting = true;
this._itemsCreator({
type: BI.SearchMultiSelectCombo.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()]
}, function (ob) {
var items = BI.map(ob.items, "value");
if (self.storeValue.type === res.type) {
var change = false;
var map = self._makeMap(self.storeValue.value);
BI.each(items, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
delete map[v];
}
});
change && (self.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
var selectedMap = self._makeMap(self.storeValue.value);
var notSelectedMap = self._makeMap(res.value);
var newItems = [];
BI.each(items, function (i, item) {
if (BI.isNotNull(selectedMap[items[i]])) {
delete selectedMap[items[i]];
}
if (BI.isNull(notSelectedMap[items[i]])) {
newItems.push(item);
}
});
self.storeValue.value = newItems.concat(BI.values(selectedMap));
self._adjust(callback);
});
},
_adjust: function (callback) {
var self = this, o = this.options;
if (!this._count) {
this._itemsCreator({
type: BI.SearchMultiSelectCombo.REQ_GET_DATA_LENGTH
}, function (res) {
self._count = res.count;
adjust();
callback();
});
} else {
adjust();
callback();
}
function adjust () {
if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) {
self.storeValue = {
type: BI.Selection.Multi,
value: []
};
} else if (self.storeValue.type === BI.Selection.Multi && self.storeValue.value.length >= self._count) {
self.storeValue = {
type: BI.Selection.All,
value: []
};
}
self._updateAllValue();
self._checkError();
if (self.wants2Quit === true) {
self.fireEvent(BI.SearchMultiSelectCombo.EVENT_CONFIRM);
self.wants2Quit = false;
}
self.requesting = false;
}
},
_join: function (res, callback) {
var self = this, o = this.options;
this._assertValue(res);
this._assertValue(this.storeValue);
if (this.storeValue.type === res.type) {
var map = this._makeMap(this.storeValue.value);
BI.each(res.value, function (i, v) {
if (!map[v]) {
self.storeValue.value.push(v);
map[v] = v;
}
});
var change = false;
BI.each(res.assist, function (i, v) {
if (BI.isNotNull(map[v])) {
change = true;
delete map[v];
}
});
change && (this.storeValue.value = BI.values(map));
self._adjust(callback);
return;
}
this._joinAll(res, callback);
},
_setStartValue: function (value) {
this._startValue = value;
this.popup.setStartValue(value);
},
_getItemsByTimes: function (items, times) {
var res = [];
for (var i = (times - 1) * 10; items[i] && i < times * 10; i++) {
res.push(items[i]);
}
return res;
},
_hasNextByTimes: function (items, times) {
return times * 10 < items.length;
},
_itemsCreator: function (options, callback) {
var self = this, o = this.options;
var items = o.items;
var keywords = (options.keywords || []).slice();
if (options.keyword) {
keywords.push(options.keyword);
}
BI.each(keywords, function (i, kw) {
var search = BI.Func.getSearchResult(items, kw);
items = search.match.concat(search.find);
});
if (options.selectedValues) {// 过滤
var filter = BI.makeObject(options.selectedValues, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});
}
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({
items: items
});
return;
}
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length});
return;
}
callback({
items: self._getItemsByTimes(items, options.times),
hasNext: self._hasNextByTimes(items, options.times)
});
},
_checkError: function () {
var v = this.storeValue.value || [];
if(BI.isNotEmptyArray(v)) {
v = BI.isArray(v) ? v : [v];
var result = BI.find(this.allValue, function (idx, value) {
return BI.contains(v, value);
});
if (BI.isNull(result)) {
this.element.addClass("combo-error");
} else {
this.element.removeClass("combo-error");
}
} else {
v.length === this.allValue.length ? this.element.removeClass("combo-error") : this.element.addClass("combo-error");
}
},
_updateAllValue: function () {
this.storeValue = this.storeValue || {};
this.allValue = BI.deepClone(this.storeValue.value || []);
},
setValue: function (v) {
this.storeValue = v || {};
this._updateAllValue();
this._assertValue(this.storeValue);
this.combo.setValue(this.storeValue);
this._checkError();
},
getValue: function () {
return BI.deepClone(this.storeValue);
},
_populate: function () {
this._count = null;
this.combo.populate();
},
populate: function (items) {
this.options.items = items;
this._populate();
}
});
BI.extend(BI.SearchMultiSelectCombo, {
REQ_GET_DATA_LENGTH: 1,
REQ_GET_ALL_DATA: -1
});
BI.SearchMultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.search_multi_select_combo", BI.SearchMultiSelectCombo);

151
src/widget/searchmultiselect/multiselect.combo.trigger.search.js

@ -0,0 +1,151 @@
BI.SearchMultiSelectTrigger = BI.inherit(BI.Trigger, {
constants: {
height: 14,
rgap: 4,
lgap: 4
},
_defaultConfig: function () {
return BI.extend(BI.SearchMultiSelectTrigger.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.SearchMultiSelectTrigger.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.search_multi_select_searcher",
height: o.height,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
allValueGetter: o.allValueGetter,
popup: {},
adapter: o.adapter,
masker: o.masker,
value: o.value,
text: o.text
});
this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () {
self.fireEvent(BI.SearchMultiSelectTrigger.EVENT_START);
});
this.searcher.on(BI.MultiSelectSearcher.EVENT_PAUSE, function () {
self.fireEvent(BI.SearchMultiSelectTrigger.EVENT_PAUSE);
});
this.searcher.on(BI.MultiSelectSearcher.EVENT_SEARCHING, function () {
self.fireEvent(BI.SearchMultiSelectTrigger.EVENT_SEARCHING, arguments);
});
this.searcher.on(BI.MultiSelectSearcher.EVENT_STOP, function () {
self.fireEvent(BI.SearchMultiSelectTrigger.EVENT_STOP);
});
this.searcher.on(BI.MultiSelectSearcher.EVENT_CHANGE, function () {
self.fireEvent(BI.SearchMultiSelectTrigger.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.SearchMultiSelectTrigger.EVENT_COUNTER_CLICK);
});
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.SearchMultiSelectTrigger.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.SearchMultiSelectTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK";
BI.SearchMultiSelectTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK";
BI.SearchMultiSelectTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchMultiSelectTrigger.EVENT_START = "EVENT_START";
BI.SearchMultiSelectTrigger.EVENT_STOP = "EVENT_STOP";
BI.SearchMultiSelectTrigger.EVENT_PAUSE = "EVENT_PAUSE";
BI.SearchMultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.SearchMultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW";
BI.shortcut("bi.search_multi_select_trigger", BI.SearchMultiSelectTrigger);

173
src/widget/searchmultiselect/multiselect.loader.search.js

@ -0,0 +1,173 @@
/**
* 多选加载数据面板
* Created by guy on 15/11/2.
* @class BI.SearchMultiSelectLoader
* @extends Widget
*/
BI.SearchMultiSelectLoader = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SearchMultiSelectLoader.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-loader",
logic: {
dynamic: true
},
el: {
height: 400
},
valueFormatter: BI.emptyFn,
itemsCreator: BI.emptyFn,
onLoaded: BI.emptyFn
});
},
_init: function () {
BI.SearchMultiSelectLoader.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
var hasNext = false;
this.storeValue = opts.value || {};
this._assertValue(this.storeValue);
this.button_group = BI.createWidget({
type: "bi.select_list",
element: this,
logic: opts.logic,
el: BI.extend({
onLoaded: opts.onLoaded,
el: {
type: "bi.loader",
isDefaultInit: false,
logic: {
dynamic: true,
scrolly: true
},
el: {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
behaviors: {
redmark: function () {
return true;
}
},
layouts: [{
type: "bi.vertical"
}]
}
}
}, opts.el),
itemsCreator: function (op, callback) {
var startValue = self._startValue;
self.storeValue && (op = BI.extend(op || {}, {
selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi
? self.storeValue.value.concat(startValue) : self.storeValue.value
}));
opts.itemsCreator(op, function (ob) {
hasNext = ob.hasNext;
var firstItems = [];
if (op.times === 1 && self.storeValue) {
var json = BI.map(self.storeValue.value, function (i, v) {
var txt = opts.valueFormatter(v) || v;
return {
text: txt,
value: v,
title: txt,
selected: self.storeValue.type === BI.Selection.Multi
};
});
if (BI.isKey(self._startValue) && !self.storeValue.value.contains(self._startValue)) {
var txt = opts.valueFormatter(startValue) || startValue;
json.unshift({
text: txt,
value: startValue,
title: txt,
selected: true
});
}
firstItems = self._createItems(json);
}
callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || "");
if (op.times === 1 && self.storeValue) {
BI.isKey(startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](startValue);
self.setValue(self.storeValue);
}
(op.times === 1) && self._scrollToTop();
});
},
hasNext: function () {
return hasNext;
},
value: this.storeValue
});
this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.button_group.on(BI.SelectList.EVENT_CHANGE, function () {
self.fireEvent(BI.SearchMultiSelectLoader.EVENT_CHANGE, arguments);
});
},
_createItems: function (items) {
return BI.createItems(items, {
type: "bi.multi_select_item",
logic: this.options.logic,
height: 24,
selected: this.isAllSelected()
});
},
_scrollToTop: function () {
var self = this;
BI.delay(function () {
self.button_group.element.scrollTop(0);
}, 30);
},
isAllSelected: function () {
return this.button_group.isAllSelected();
},
_assertValue: function (val) {
val || (val = {});
val.type || (val.type = BI.Selection.Multi);
val.value || (val.value = []);
},
setStartValue: function (v) {
this._startValue = v;
},
setValue: function (v) {
this.storeValue = v || {};
this._assertValue(this.storeValue);
this.button_group.setValue(this.storeValue);
},
getValue: function () {
return this.button_group.getValue();
},
getAllButtons: function () {
return this.button_group.getAllButtons();
},
empty: function () {
this.button_group.empty();
},
populate: function (items) {
arguments[0] = this._createItems(items);
this.button_group.populate.apply(this.button_group, arguments);
},
resetHeight: function (h) {
this.button_group.resetHeight(h);
},
resetWidth: function (w) {
this.button_group.resetWidth(w);
}
});
BI.SearchMultiSelectLoader.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.search_multi_select_loader", BI.SearchMultiSelectLoader);

88
src/widget/searchmultiselect/multiselect.popup.view.search.js

@ -0,0 +1,88 @@
BI.SearchMultiSelectPopupView = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SearchMultiSelectPopupView.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-popup-view",
maxWidth: "auto",
minWidth: 135,
maxHeight: 400,
valueFormatter: BI.emptyFn,
itemsCreator: BI.emptyFn,
onLoaded: BI.emptyFn
});
},
_init: function () {
BI.SearchMultiSelectPopupView.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.loader = BI.createWidget({
type: "bi.search_multi_select_loader",
itemsCreator: opts.itemsCreator,
valueFormatter: opts.valueFormatter,
onLoaded: opts.onLoaded,
value: opts.value
});
this.popupView = BI.createWidget({
type: "bi.multi_popup_view",
stopPropagation: false,
maxWidth: opts.maxWidth,
minWidth: opts.minWidth,
maxHeight: opts.maxHeight,
element: this,
buttons: [BI.i18nText("BI-Basic_Clears"), BI.i18nText("BI-Basic_Sure")],
el: this.loader,
value: opts.value
});
this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () {
self.fireEvent(BI.SearchMultiSelectPopupView.EVENT_CHANGE);
});
this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) {
switch (index) {
case 0:
self.fireEvent(BI.SearchMultiSelectPopupView.EVENT_CLICK_CLEAR);
break;
case 1:
self.fireEvent(BI.SearchMultiSelectPopupView.EVENT_CLICK_CONFIRM);
break;
}
});
},
isAllSelected: function () {
return this.loader.isAllSelected();
},
setStartValue: function (v) {
this.loader.setStartValue(v);
},
setValue: function (v) {
this.popupView.setValue(v);
},
getValue: function () {
return this.popupView.getValue();
},
populate: function (items) {
this.popupView.populate.apply(this.popupView, arguments);
},
resetHeight: function (h) {
this.popupView.resetHeight(h);
},
resetWidth: function (w) {
this.popupView.resetWidth(w);
}
});
BI.SearchMultiSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchMultiSelectPopupView.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.SearchMultiSelectPopupView.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
BI.shortcut("bi.search_multi_select_popup_view", BI.SearchMultiSelectPopupView);

169
src/widget/searchmultiselect/trigger/searcher.multiselect.search.js

@ -0,0 +1,169 @@
BI.SearchMultiSelectSearcher = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SearchMultiSelectSearcher.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-searcher",
itemsCreator: BI.emptyFn,
el: {},
popup: {},
valueFormatter: BI.emptyFn,
adapter: null,
masker: {}
});
},
_init: function () {
BI.SearchMultiSelectSearcher.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_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
}, o.popup),
adapter: o.adapter,
masker: o.masker
});
this.searcher.on(BI.Searcher.EVENT_START, function () {
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_START);
});
this.searcher.on(BI.Searcher.EVENT_PAUSE, function () {
if (this.hasMatched()) {
}
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_PAUSE);
});
this.searcher.on(BI.Searcher.EVENT_STOP, function () {
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_STOP);
});
this.searcher.on(BI.Searcher.EVENT_CHANGE, function () {
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_CHANGE, arguments);
});
this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () {
var keywords = this.getKeywords();
self.fireEvent(BI.SearchMultiSelectSearcher.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 (obj) {
var o = this.options;
var ob = {};
ob.type = obj.type;
ob.value = o.allValueGetter() || [];
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.SearchMultiSelectSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.SearchMultiSelectSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchMultiSelectSearcher.EVENT_START = "EVENT_START";
BI.SearchMultiSelectSearcher.EVENT_STOP = "EVENT_STOP";
BI.SearchMultiSelectSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.SearchMultiSelectSearcher.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.shortcut("bi.search_multi_select_searcher", BI.SearchMultiSelectSearcher);

5
ui/css/background.css

@ -243,6 +243,11 @@
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/background/auto_color.png');
_background: none;
}
.auto-color-normal-background {
background: url('resources?path=/com/fr/web/ui/images/1x/background/auto_color_normal.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/background/auto_color_normal.png');
_background: none;
}
.trans-color-background {
background: url('resources?path=/com/fr/web/ui/images/1x/background/trans_color.png') no-repeat center center;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='resources?path=/com/fr/web/ui/images/1x/background/trans_color.png');

Loading…
Cancel
Save