diff --git a/demo/js/component/demo.treevaluechoosercombo.js b/demo/js/component/demo.treevaluechoosercombo.js index 8fa557ee1..e104e9eda 100644 --- a/demo/js/component/demo.treevaluechoosercombo.js +++ b/demo/js/component/demo.treevaluechoosercombo.js @@ -4,8 +4,8 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, { }, render: function () { - var widget = BI.createWidget({ - type: "bi.tree_value_chooser_combo", + this.widget = BI.createWidget({ + type: "bi.list_tree_value_chooser_insert_combo", width: 300, // items: BI.deepClone(Demo.CONSTANTS.TREEITEMS), itemsCreator: function (op, callback) { @@ -16,8 +16,18 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 200, vgap: 10, - items: [widget] + items: [this.widget] }; + }, + + mounted: function () { + this.widget.setValue([ + ["中国", "安徽省"], + ["中国", "澳门特别行政区"], + ["中国", "北京市"], + ["中国", "福建省"], + ["中国", "甘肃省"] + ]); } }); BI.shortcut("demo.tree_value_chooser_combo", Demo.TreeValueChooser); diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js index bf301e15f..cd7e8c78c 100644 --- a/src/base/single/input/input.js +++ b/src/base/single/input/input.js @@ -164,7 +164,7 @@ BI.Input = BI.inherit(BI.Single, { this.fireEvent(BI.Input.EVENT_BACKSPACE); } } - this.fireEvent(BI.Input.EVENT_KEY_DOWN); + this.fireEvent(BI.Input.EVENT_KEY_DOWN, keyCode); if (BI.isEndWithBlank(this.getValue())) { this._pause = true; diff --git a/src/css/widget/multiselect/trigger/editor.css b/src/css/widget/multiselect/trigger/editor.css index 0e02317b1..35572c150 100644 --- a/src/css/widget/multiselect/trigger/editor.css +++ b/src/css/widget/multiselect/trigger/editor.css @@ -3,5 +3,5 @@ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0f3685f2,endColorstr=#0f3685f2); } .bi-multi-select-block-editor .search-editor { - min-width: 40px; + min-width: 25px; } diff --git a/src/less/widget/multiselect/trigger/editor.block.multiselect.less b/src/less/widget/multiselect/trigger/editor.block.multiselect.less index 4927905f3..c7383d3f2 100644 --- a/src/less/widget/multiselect/trigger/editor.block.multiselect.less +++ b/src/less/widget/multiselect/trigger/editor.block.multiselect.less @@ -7,6 +7,6 @@ } } & .search-editor { - min-width: 40px; + min-width: 25px; } } \ No newline at end of file diff --git a/src/widget/multiselect/trigger/editor.block.multiselect.js b/src/widget/multiselect/trigger/editor.block.multiselect.js index ef42a98e0..ba00f6291 100644 --- a/src/widget/multiselect/trigger/editor.block.multiselect.js +++ b/src/widget/multiselect/trigger/editor.block.multiselect.js @@ -19,6 +19,7 @@ BI.MultiSelectBlockEditor = BI.inherit(BI.Widget, { items: [{ el: { type: "bi.inline_vertical_adapt", + scrollable: false, tagName: "ul", cls: "label-wrapper", ref: function (_ref) { @@ -40,16 +41,38 @@ BI.MultiSelectBlockEditor = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE); } }, { - eventName: BI.Editor.EVENT_PAUSE, + eventName: BI.SignEditor.EVENT_PAUSE, action: function () { self.fireEvent(BI.MultiSelectBlockEditor.EVENT_PAUSE); } + }, { + eventName: BI.SignEditor.EVENT_STOP, + action: function () { + self.fireEvent(BI.MultiSelectBlockEditor.EVENT_STOP); + } + }, { + eventName: BI.SignEditor.EVENT_KEY_DOWN, + action: function (keyCode) { + // if(keyCode === ) { + // + // } + self.fireEvent(BI.MultiSelectBlockEditor.EVENT_KEY_DOWN); + } }], height: 22 }] }; }, + _checkPosition: function () { + var width = this.element.width(); + var blockRegionWidth = width - 25 > 0 ? width - 25 : 0; + var blockWrapWidth = this.labelWrapper.element.width(); + if (blockRegionWidth < blockWrapWidth) { + this.labelWrapper.element.width(blockRegionWidth); + } + }, + focus: function () { this.editor.focus(); }, @@ -59,6 +82,7 @@ BI.MultiSelectBlockEditor = BI.inherit(BI.Widget, { }, setState: function (state) { + var self = this; var values = BI.map(state, function (idx, path) { return BI.last(path); }); @@ -70,6 +94,9 @@ BI.MultiSelectBlockEditor = BI.inherit(BI.Widget, { text: value }; })); + BI.defer(function () { + self._checkPosition(); + }); }, setValue: function (v) { @@ -97,5 +124,6 @@ BI.MultiSelectBlockEditor = BI.inherit(BI.Widget, { } }); -BI.MultiSelectBlockEditor.EVENT_PAUSE = "MultiSelectBlockEditor.EVENT_PAUSE"; +BI.MultiSelectBlockEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.MultiSelectBlockEditor.EVENT_STOP = "EVENT_STOP"; BI.shortcut("bi.multi_select_block_editor", BI.MultiSelectBlockEditor); diff --git a/src/widget/multitree/trigger/searcher.list.multi.tree.js b/src/widget/multitree/trigger/searcher.list.multi.tree.js index dbbd48625..8ddcffb52 100644 --- a/src/widget/multitree/trigger/searcher.list.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.list.multi.tree.js @@ -29,7 +29,13 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, { el: { type: "bi.simple_state_editor", height: o.height - } + }, + listeners: [{ + eventName: BI.MultiSelectBlockEditor.EVENT_STOP, + action: function (v) { + self.fireEvent(BI.MultiListTreeSearcher.EVENT_REMOVE, v); + } + }] }); this.searcher = BI.createWidget({