From d0b8e240deff330a9e2d89925f035fdee1ce2a7f Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 13 May 2019 10:42:02 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-552=20feat:=20=E5=A4=8D=E9=80=89?= =?UTF-8?q?=E4=B8=8E=E6=A0=91=E4=B8=8B=E6=8B=89trigger=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=8F=AF=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + .../multiselect/demo.multi_select_combo.js | 1 + .../multiselect/multiselect.insert.combo.js | 4 +++- .../multiselect/multiselect.insert.trigger.js | 17 ++++++++++++++++- src/widget/multiselect/multiselect.trigger.js | 17 ++++++++++++++++- src/widget/multitree/multi.tree.insert.combo.js | 4 +++- src/widget/multitree/multi.tree.list.combo.js | 4 +++- 7 files changed, 43 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 446cc57fe..b8f161945 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2019-05) +- 复选下拉控件和树下拉控件支持trigger是否可编辑 - 时分秒控件支持自定义时间显示格式和是否可编辑 - 日期/时间/日期区间/时间区间支持自定义日期选择范围和是否可编辑 - 日期/时间/日期区间/时间区间支持自定义日期显示格式和是否可编辑 diff --git a/demo/js/widget/multiselect/demo.multi_select_combo.js b/demo/js/widget/multiselect/demo.multi_select_combo.js index 4875747b1..bcf487f36 100644 --- a/demo/js/widget/multiselect/demo.multi_select_combo.js +++ b/demo/js/widget/multiselect/demo.multi_select_combo.js @@ -10,6 +10,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, { var self = this; var widget = BI.createWidget({ type: "bi.multi_select_insert_combo", + // allowEdit: false, itemsCreator: BI.bind(this._itemsCreator, this), width: 200, value: { diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index ed2b2087c..4ac0d488e 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -13,7 +13,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { height: 24, attributes: { tabIndex: 0 - } + }, + allowEdit: true }); }, @@ -32,6 +33,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_insert_trigger", + allowEdit: o.allowEdit, height: o.height, text: o.text, // adapter: this.popup, diff --git a/src/widget/multiselect/multiselect.insert.trigger.js b/src/widget/multiselect/multiselect.insert.trigger.js index b18ba7fac..d174bb140 100644 --- a/src/widget/multiselect/multiselect.insert.trigger.js +++ b/src/widget/multiselect/multiselect.insert.trigger.js @@ -22,7 +22,8 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, { switcher: {}, adapter: null, - masker: {} + masker: {}, + allowEdit: true }); }, @@ -102,6 +103,20 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, { }] }); + !o.allowEdit && BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.layout" + }, + left: 0, + right: 24, + top: 0, + bottom: 0 + }] + }); + this.numberCounter.on(BI.Events.VIEW, function (b) { BI.nextTick(function () {// 自动调整宽度 wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0); diff --git a/src/widget/multiselect/multiselect.trigger.js b/src/widget/multiselect/multiselect.trigger.js index 65a89cc05..8e9f8f09d 100644 --- a/src/widget/multiselect/multiselect.trigger.js +++ b/src/widget/multiselect/multiselect.trigger.js @@ -22,7 +22,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { switcher: {}, adapter: null, - masker: {} + masker: {}, + allowEdit: true }); }, @@ -99,6 +100,20 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { }] }); + !o.allowEdit && BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.layout" + }, + left: 0, + right: 24, + top: 0, + bottom: 0 + }] + }); + this.numberCounter.on(BI.Events.VIEW, function (b) { BI.nextTick(function () {// 自动调整宽度 wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0); diff --git a/src/widget/multitree/multi.tree.insert.combo.js b/src/widget/multitree/multi.tree.insert.combo.js index 6133cf92f..39e06b447 100644 --- a/src/widget/multitree/multi.tree.insert.combo.js +++ b/src/widget/multitree/multi.tree.insert.combo.js @@ -20,7 +20,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { baseCls: "bi-multi-tree-insert-combo", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - height: 24 + height: 24, + allowEdit: true }); }, @@ -36,6 +37,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", + allowEdit: o.allowEdit, height: o.height, valueFormatter: o.valueFormatter, // adapter: this.popup, diff --git a/src/widget/multitree/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index b5d3df844..6b7ffc356 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -20,7 +20,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { baseCls: "bi-multi-tree-list-combo", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - height: 24 + height: 24, + allowEdit: true }); }, @@ -36,6 +37,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", + allowEdit: o.allowEdit, height: o.height, valueFormatter: o.valueFormatter, // adapter: this.popup,