From 9018cbaa1200f4eee8a0c170326aa6aca30f97f6 Mon Sep 17 00:00:00 2001 From: zsmj Date: Fri, 12 Aug 2022 14:07:41 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-77978=20fix:=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A0=91=E6=B0=B4=E5=8D=B0=E8=A1=A8=E7=8E=B0=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/editor/editor.state.simple.js | 7 +++-- .../combo.listtreevaluechooser.js | 1 + .../combo.treevaluechooser.insert.js | 1 + src/widget/multiselect/multiselect.trigger.js | 1 + .../multiselect/trigger/editor.multiselect.js | 2 +- .../trigger/searcher.multiselect.js | 1 + src/widget/multitree/multi.tree.combo.js | 29 ++++++++++--------- src/widget/multitree/multi.tree.list.combo.js | 29 ++++++++++--------- .../trigger/searcher.list.multi.tree.js | 1 + .../multitree/trigger/searcher.multi.tree.js | 3 +- 10 files changed, 43 insertions(+), 32 deletions(-) diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js index 81b815441..ec895996b 100644 --- a/src/case/editor/editor.state.simple.js +++ b/src/case/editor/editor.state.simple.js @@ -136,7 +136,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); - if(BI.isNotNull(o.text)){ + if (BI.isNotNull(o.text)) { this.setState(o.text); } }, @@ -232,6 +232,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { setState: function (v) { var o = this.options; BI.SimpleStateEditor.superclass.setValue.apply(this, arguments); + var defaultText = BI.isFunction(o.defaultText) ? o.defaultText() : o.defaultText; if (BI.isNumber(v)) { if (v === BI.Selection.All) { this._setText(BI.i18nText("BI-Already_Selected")); @@ -240,7 +241,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { this._setText(BI.i18nText("BI-Already_Selected")); this.text.element.removeClass("bi-water-mark"); } else { - this._setText(o.text); + this._setText(BI.isKey(defaultText) ? defaultText : o.text); this.text.element.addClass("bi-water-mark"); } return; @@ -280,4 +281,4 @@ BI.SimpleStateEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE"; BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; -BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor); \ No newline at end of file +BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor); diff --git a/src/component/treevaluechooser/combo.listtreevaluechooser.js b/src/component/treevaluechooser/combo.listtreevaluechooser.js index fb6b3dfa8..0366a4bbc 100644 --- a/src/component/treevaluechooser/combo.listtreevaluechooser.js +++ b/src/component/treevaluechooser/combo.listtreevaluechooser.js @@ -30,6 +30,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, isNeedAdjustWidth: o.isNeedAdjustWidth, element: this, text: o.text, + defaultText: o.defaultText, value: o.value, watermark: o.watermark, allowInsertValue: o.allowInsertValue, diff --git a/src/component/treevaluechooser/combo.treevaluechooser.insert.js b/src/component/treevaluechooser/combo.treevaluechooser.insert.js index ec60a0a4a..f9c6ebf4b 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.insert.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.insert.js @@ -30,6 +30,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { isNeedAdjustWidth: o.isNeedAdjustWidth, allowEdit: o.allowEdit, text: o.text, + defaultText: o.defaultText, value: o.value, watermark: o.watermark, element: this, diff --git a/src/widget/multiselect/multiselect.trigger.js b/src/widget/multiselect/multiselect.trigger.js index 7140741ff..937e83804 100644 --- a/src/widget/multiselect/multiselect.trigger.js +++ b/src/widget/multiselect/multiselect.trigger.js @@ -37,6 +37,7 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { type: "bi.multi_select_searcher", height: o.height, text: o.text, + defaultText: o.defaultText, itemsCreator: o.itemsCreator, itemHeight: o.itemHeight, valueFormatter: o.valueFormatter, diff --git a/src/widget/multiselect/trigger/editor.multiselect.js b/src/widget/multiselect/trigger/editor.multiselect.js index 29ee8489b..db9acc9a4 100644 --- a/src/widget/multiselect/trigger/editor.multiselect.js +++ b/src/widget/multiselect/trigger/editor.multiselect.js @@ -24,7 +24,7 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { watermark: o.watermark, allowBlank: true, value: o.value, - defaultText: o.text, + defaultText: o.defaultText, text: o.text, tipType: o.tipType, warningTitle: o.warningTitle, diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index 4dbfbead7..433f31920 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -27,6 +27,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { type: "bi.multi_select_editor", height: o.height, text: o.text, + defaultText: o.defaultText, watermark: o.watermark, listeners: [{ eventName: BI.MultiSelectEditor.EVENT_FOCUS, diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index 4e42df154..3b55ee15c 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -22,7 +22,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { var isInit = false; var want2showCounter = false; - this.storeValue = {value: o.value || {}}; + this.storeValue = { value: o.value || {} }; this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", @@ -30,6 +30,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { height: o.height - (o.simple ? 1 : 2), valueFormatter: o.valueFormatter, text: o.text, + defaultText: o.defaultText, watermark: o.watermark, // adapter: this.popup, masker: { @@ -44,7 +45,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { type: "bi.multi_tree_searcher", itemsCreator: o.itemsCreator }, - value: {value: o.value || {}} + value: { value: o.value || {} } }); this.combo = BI.createWidget({ @@ -105,7 +106,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { maxWidth: o.isNeedAdjustWidth ? "auto" : 500, }, isNeedAdjustWidth: o.isNeedAdjustWidth, - value: {value: o.value || {}}, + value: { value: o.value || {} }, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; @@ -131,12 +132,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; this.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); }); this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { - self.storeValue = {value: this.getValue()}; + self.storeValue = { value: this.getValue() }; self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); BI.nextTick(function () { @@ -151,11 +152,11 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { self.fireEvent(BI.MultiTreeCombo.EVENT_SEARCHING); }); - function showCounter () { + function showCounter() { if (isSearching()) { - self.storeValue = {value: self.trigger.getValue()}; + self.storeValue = { value: self.trigger.getValue() }; } else if (isPopupView()) { - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; } self.trigger.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); @@ -174,7 +175,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { var checked = this.getSearcher().hasChecked(); var val = { type: BI.Selection.Multi, - value: checked ? {1: 1} : {} + value: checked ? { 1: 1 } : {} }; this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); @@ -186,7 +187,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { return; } if (change === true) { - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; change = false; } self.combo.setValue(self.storeValue); @@ -201,9 +202,9 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { } else { if (isPopupView()) { self._stopEditing(); - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; if (clear === true) { - self.storeValue = {value: {}}; + self.storeValue = { value: {} }; } self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); } @@ -245,7 +246,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }, itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, - value: {value: o.value || {}} + value: { value: o.value || {} } }); this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { if (!self.combo.isViewVisible()) { @@ -306,7 +307,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }); }, - _stopEditing: function() { + _stopEditing: function () { this.trigger.stopEditing(); this.numberCounter.hideView(); }, diff --git a/src/widget/multitree/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index ff5a2864a..559d6cf9c 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -14,6 +14,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { allowEdit: true, allowInsertValue: true, isNeedAdjustWidth: true, + text: "", + defaultText: "", }); }, @@ -23,12 +25,13 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { var isInit = false; var want2showCounter = false; - this.storeValue = {value: o.value || []}; + this.storeValue = { value: o.value || [] }; this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", allowEdit: o.allowEdit, text: o.text, + defaultText: o.defaultText, watermark: o.watermark, height: o.height - (o.simple ? 1 : 2), valueFormatter: o.valueFormatter, @@ -74,7 +77,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { itemsCreator: o.itemsCreator } }, - value: {value: o.value || {}} + value: { value: o.value || {} } }); @@ -139,7 +142,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { maxWidth: o.isNeedAdjustWidth ? "auto" : 500, }, isNeedAdjustWidth: o.isNeedAdjustWidth, - value: {value: o.value || {}}, + value: { value: o.value || {} }, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; @@ -165,12 +168,12 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; this.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); }); this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { - self.storeValue = {value: this.getValue()}; + self.storeValue = { value: this.getValue() }; self.combo.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); BI.nextTick(function () { @@ -185,11 +188,11 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { self.fireEvent(BI.MultiTreeListCombo.EVENT_SEARCHING); }); - function showCounter () { + function showCounter() { if (isSearching()) { - self.storeValue = {value: self.trigger.getValue()}; + self.storeValue = { value: self.trigger.getValue() }; } else if (isPopupView()) { - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; } self.trigger.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue); @@ -203,7 +206,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { var checked = this.getSearcher().hasChecked(); var val = { type: BI.Selection.Multi, - value: checked ? {1: 1} : {} + value: checked ? { 1: 1 } : {} }; this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); self.numberCounter.setButtonChecked(val); @@ -215,7 +218,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { return; } if (change === true) { - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; change = false; } self.combo.setValue(self.storeValue); @@ -230,9 +233,9 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { } else { if (isPopupView()) { self._stopEditing(); - self.storeValue = {value: self.combo.getValue()}; + self.storeValue = { value: self.combo.getValue() }; if (clear === true) { - self.storeValue = {value: []}; + self.storeValue = { value: [] }; } self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); } @@ -340,7 +343,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { this.numberCounter.setButtonChecked(this.storeValue); }, - _stopEditing: function() { + _stopEditing: function () { this.trigger.stopEditing(); this.numberCounter.hideView(); }, diff --git a/src/widget/multitree/trigger/searcher.list.multi.tree.js b/src/widget/multitree/trigger/searcher.list.multi.tree.js index 555d1b783..1d213127a 100644 --- a/src/widget/multitree/trigger/searcher.list.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.list.multi.tree.js @@ -27,6 +27,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, { type: "bi.multi_select_editor", height: o.height, text: o.text, + defaultText: o.defaultText, watermark: o.watermark, el: { type: "bi.simple_state_editor", diff --git a/src/widget/multitree/trigger/searcher.multi.tree.js b/src/widget/multitree/trigger/searcher.multi.tree.js index 35d59f200..8b9c4f004 100644 --- a/src/widget/multitree/trigger/searcher.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.multi.tree.js @@ -30,6 +30,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { el: { type: "bi.simple_state_editor", text: o.text, + defaultText: o.defaultText, height: o.height }, listeners: [{ @@ -149,7 +150,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { } } - function getChildrenNode (ob) { + function getChildrenNode(ob) { var text = ""; var index = 0, size = BI.size(ob); var names = BI.Func.getSortedResult(BI.keys(ob));