From 10acbec4dc149c760c4fcd4ef5a9c6d135e9f419 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 16 Aug 2022 10:38:05 +0800 Subject: [PATCH 1/3] =?UTF-8?q?KERNEL-11286=20feat:=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86value,text,defaultText=E5=B1=9E=E6=80=A7=E8=A7=84?= =?UTF-8?q?=E5=88=99=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/multiselect.combo.js | 2 +- .../multiselect/multiselect.combo.nobar.js | 2 +- .../trigger/editor/editor.patch.js | 4 +-- .../trigger/searcher.multiselect.js | 2 +- src/widget/multitree/multi.tree.combo.js | 1 - .../multitree/multi.tree.insert.combo.js | 33 ++++++++++--------- src/widget/multitree/multi.tree.list.combo.js | 1 - 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index 23d5385b8..c370a48ee 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -47,7 +47,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { allowEdit: o.allowEdit, height: o.height - (o.simple ? 1 : 2), text: o.text, - // adapter: this.popup, + defaultText: o.defaultText, masker: { offset: { left: 0, diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index a72519750..0fe10f947 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -43,7 +43,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { type: "bi.multi_select_trigger", height: o.height - (o.simple ? 1 : 2), text: o.text, - // adapter: this.popup, + defaultText: o.defaultText, masker: { offset: { left: 0, diff --git a/src/widget/multiselect/trigger/editor/editor.patch.js b/src/widget/multiselect/trigger/editor/editor.patch.js index d19bac9bb..bec2ae7db 100644 --- a/src/widget/multiselect/trigger/editor/editor.patch.js +++ b/src/widget/multiselect/trigger/editor/editor.patch.js @@ -30,7 +30,7 @@ BI.SelectPatchEditor = 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, @@ -211,4 +211,4 @@ BI.SelectPatchEditor.EVENT_CHANGE = "EVENT_CHANGE"; BI.SelectPatchEditor.EVENT_FOCUS = "EVENT_FOCUS"; BI.SelectPatchEditor.EVENT_BLUR = "EVENT_BLUR"; -BI.shortcut("bi.select_patch_editor", BI.SelectPatchEditor); \ No newline at end of file +BI.shortcut("bi.select_patch_editor", BI.SelectPatchEditor); diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index 433f31920..5744cd1de 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -15,7 +15,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { valueFormatter: BI.emptyFn, adapter: null, masker: {}, - text: BI.i18nText("BI-Basic_Please_Select"), + defaultText: BI.i18nText("BI-Basic_Please_Select"), itemHeight: 24 }); }, diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index 3b55ee15c..f222e6f6e 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -32,7 +32,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { text: o.text, defaultText: o.defaultText, watermark: o.watermark, - // adapter: this.popup, masker: { offset: { left: 0, diff --git a/src/widget/multitree/multi.tree.insert.combo.js b/src/widget/multitree/multi.tree.insert.combo.js index 9694b3556..5159c60dd 100644 --- a/src/widget/multitree/multi.tree.insert.combo.js +++ b/src/widget/multitree/multi.tree.insert.combo.js @@ -23,14 +23,16 @@ BI.MultiTreeInsertCombo = 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, height: o.height - (o.simple ? 1 : 2), valueFormatter: o.valueFormatter, - // adapter: this.popup, + text: o.text, + defaultText: o.defaultText, + watermark: o.watermark, masker: { offset: { left: 0, @@ -41,8 +43,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { }, searcher: { type: "bi.multi_tree_searcher", - text: o.text, - watermark: o.watermark, + itemsCreator: o.itemsCreator, popup: { type: "bi.multi_tree_search_insert_pane", @@ -59,7 +60,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { }] } }, - value: {value: o.value || {}} + value: { value: o.value || {} } }); @@ -121,7 +122,7 @@ BI.MultiTreeInsertCombo = 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; @@ -147,12 +148,12 @@ BI.MultiTreeInsertCombo = 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 () { @@ -167,11 +168,11 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, { self.fireEvent(BI.MultiTreeInsertCombo.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); @@ -185,7 +186,7 @@ BI.MultiTreeInsertCombo = 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); @@ -197,7 +198,7 @@ BI.MultiTreeInsertCombo = 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); @@ -212,9 +213,9 @@ BI.MultiTreeInsertCombo = 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.MultiTreeInsertCombo.EVENT_CONFIRM); } @@ -322,7 +323,7 @@ BI.MultiTreeInsertCombo = 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/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index 559d6cf9c..a4fd16c72 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -35,7 +35,6 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { watermark: o.watermark, height: o.height - (o.simple ? 1 : 2), valueFormatter: o.valueFormatter, - // adapter: this.popup, masker: { offset: { left: 0, From 63aba7eebb095c5d1fbac3cf37915c32e13cab00 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 16 Aug 2022 11:28:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?KERNEL-11286=20feat:=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86value,text,defaultText=E5=B1=9E=E6=80=A7=E8=A7=84?= =?UTF-8?q?=E5=88=99=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/editor/editor.state.js | 4 ++-- src/case/editor/editor.state.simple.js | 3 ++- src/case/trigger/trigger.text.select.js | 2 +- src/widget/multiselect/multiselect.insert.combo.js | 3 ++- src/widget/multiselect/multiselect.insert.trigger.js | 5 +++-- .../multiselect/trigger/searcher.multiselect.insert.js | 2 +- src/widget/multitree/multi.tree.list.combo.js | 6 ++---- src/widget/multitree/trigger/searcher.list.multi.tree.js | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index d1e11b20a..e9d3900bd 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -21,8 +21,8 @@ BI.StateEditor = BI.inherit(BI.Widget, { watermark: "", errorText: "", height: 24, - defaultText: "", // 默认显示值,默认显示值与显示值的区别是默认显示值标记灰色 - text: BI.i18nText("BI-Basic_Unrestricted"), // 显示值 + defaultText: BI.i18nText("BI-Basic_Unrestricted"), // 默认显示值,默认显示值与显示值的区别是默认显示值标记灰色 + text: "", // 显示值 el: {} }); }, diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js index ec895996b..4d17ab30e 100644 --- a/src/case/editor/editor.state.simple.js +++ b/src/case/editor/editor.state.simple.js @@ -22,7 +22,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { watermark: "", errorText: "", height: 24, - text: BI.i18nText("BI-Basic_Unrestricted") + text: "", + defaultText: BI.i18nText("BI-Basic_Unrestricted"), }); }, diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index 1a74e7130..57cfadcb9 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -64,7 +64,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { if (result.length > 0) { return { textCls: "", - text: o.valueFormatter(val) || result.join(","), + text: o.valueFormatter(val) ?? result.join(","), }; } else { var text = BI.isFunction(o.text) ? o.text() : o.text; diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index b1b4a202e..329c0f3f9 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -43,6 +43,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { height: o.height - (o.simple ? 1 : 2), text: o.text, watermark: o.watermark, + defaultText: o.defaultText, // adapter: this.popup, masker: { offset: { @@ -55,7 +56,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { valueFormatter: o.valueFormatter, itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemHeight: o.itemHeight, - value: o.value + value: this.storeValue, }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_FOCUS, function () { diff --git a/src/widget/multiselect/multiselect.insert.trigger.js b/src/widget/multiselect/multiselect.insert.trigger.js index f0cf6054c..b04aebd07 100644 --- a/src/widget/multiselect/multiselect.insert.trigger.js +++ b/src/widget/multiselect/multiselect.insert.trigger.js @@ -37,6 +37,7 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, { type: "bi.multi_select_insert_searcher", height: o.height, text: o.text, + defaultText: o.defaultText, itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, itemHeight: o.itemHeight, @@ -109,7 +110,7 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, { /** * 重新调整numberCounter的空白占位符 */ - refreshPlaceHolderWidth: function(width) { + refreshPlaceHolderWidth: function (width) { this.wrapper.attr("items")[1].width = width; this.wrapper.resize(); }, @@ -150,4 +151,4 @@ BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNT BI.MultiSelectInsertTrigger.EVENT_FOCUS = "EVENT_FOCUS"; BI.MultiSelectInsertTrigger.EVENT_BLUR = "EVENT_BLUR"; -BI.shortcut("bi.multi_select_insert_trigger", BI.MultiSelectInsertTrigger); \ No newline at end of file +BI.shortcut("bi.multi_select_insert_trigger", BI.MultiSelectInsertTrigger); diff --git a/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/src/widget/multiselect/trigger/searcher.multiselect.insert.js index 36b3a115f..bf77db1e7 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.insert.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.insert.js @@ -16,7 +16,6 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { valueFormatter: BI.emptyFn, adapter: null, masker: {}, - text: BI.i18nText("BI-Basic_Please_Select"), watermark: BI.i18nText("BI-Basic_Search_And_Patch_Paste"), }); }, @@ -29,6 +28,7 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { watermark: o.watermark, height: o.height, text: o.text, + defaultText: o.defaultText, listeners: [{ eventName: BI.MultiSelectEditor.EVENT_FOCUS, action: function () { diff --git a/src/widget/multitree/multi.tree.list.combo.js b/src/widget/multitree/multi.tree.list.combo.js index a4fd16c72..e22c5a7e0 100644 --- a/src/widget/multitree/multi.tree.list.combo.js +++ b/src/widget/multitree/multi.tree.list.combo.js @@ -15,7 +15,6 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { allowInsertValue: true, isNeedAdjustWidth: true, text: "", - defaultText: "", }); }, @@ -76,8 +75,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { itemsCreator: o.itemsCreator } }, - value: { value: o.value || {} } - + value: this.storeValue }); this.combo = BI.createWidget({ @@ -141,7 +139,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, { maxWidth: o.isNeedAdjustWidth ? "auto" : 500, }, isNeedAdjustWidth: o.isNeedAdjustWidth, - value: { value: o.value || {} }, + value: this.storeValue, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; diff --git a/src/widget/multitree/trigger/searcher.list.multi.tree.js b/src/widget/multitree/trigger/searcher.list.multi.tree.js index 1d213127a..8c54afe63 100644 --- a/src/widget/multitree/trigger/searcher.list.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.list.multi.tree.js @@ -8,7 +8,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiListTreeSearcher.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multi-tree-searcher", + baseCls: "bi-multi-list-tree-searcher", itemsCreator: BI.emptyFn, valueFormatter: function (v) { return v; From adf265507037d042d8ceb0fd9b95dfc283abc41e Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 16 Aug 2022 12:30:59 +0800 Subject: [PATCH 3/3] =?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/trigger/trigger.text.select.js | 11 ++++++++++- .../multilayersingletree.combo.js | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index 57cfadcb9..52d3878fb 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -53,7 +53,16 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { _digest: function (val, items) { var o = this.options; val = BI.isArray(val) ? val[0] : val; + + // 提升valueFormatter的优先级 + if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) { + return { + text: o.valueFormatter(val), + }; + } + var result = []; + var formatItems = BI.Tree.transformToArrayFormat(items); BI.each(formatItems, function (i, item) { if (val === item.value && !BI.contains(result, item.text || item.value)) { @@ -64,7 +73,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { if (result.length > 0) { return { textCls: "", - text: o.valueFormatter(val) ?? result.join(","), + text: result.join(","), }; } else { var text = BI.isFunction(o.text) ? o.text() : o.text; diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index ba67f0c3a..8f5272545 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -200,6 +200,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { self.textTrigger = _ref; }, text: o.text, + defaultText: o.defaultText, height: o.height, items: o.items, value: o.value,