From c70f92dd369de21220faa4a42123b85d89f86b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=95=AC=E5=B3=A5?= Date: Thu, 5 May 2022 14:55:56 +0800 Subject: [PATCH 01/26] =?UTF-8?q?BI-105186:=E5=A4=8D=E9=80=89=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E5=85=A8=E9=80=89=E9=80=BB=E8=BE=91=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=94=99=E8=AF=AF,type:2=E8=AE=BE=E7=BD=AE=E5=85=A8?= =?UTF-8?q?=E9=80=89=E6=97=B6,=E5=88=A4=E6=96=AD=E5=85=A8=E9=80=89?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E9=80=89=E6=8B=A9=E7=8A=B6=E6=80=81=E9=9C=80?= =?UTF-8?q?=E8=80=83=E8=99=91=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/list/list.select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/case/list/list.select.js b/src/case/list/list.select.js index 12037b9a9..bab4a15af 100644 --- a/src/case/list/list.select.js +++ b/src/case/list/list.select.js @@ -94,7 +94,7 @@ BI.SelectList = BI.inherit(BI.Widget, { var hasNext = this.list.hasNext(); var isAlreadyAllSelected = this.toolbar.isSelected(); var isHalf = selectLength > 0 && notSelectLength > 0; - var allSelected = isAlreadyAllSelected; + var allSelected = selectLength > 0 && notSelectLength <= 0 && (!hasNext || isAlreadyAllSelected); if (this.isAllSelected() === false) { hasNext && (isHalf = selectLength > 0); From 172f50c994c2528b772e8c74680ebe3a0b2ce5fe Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 5 May 2022 16:28:05 +0800 Subject: [PATCH 02/26] =?UTF-8?q?=E6=97=A0JIRA=20bi.search=5Feditor=20?= =?UTF-8?q?=E5=9C=A8=E6=9C=89=E5=88=9D=E5=A7=8B=E5=80=BC=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E6=98=BE=E7=A4=BAclear=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/editor/editor.search.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/widget/editor/editor.search.js b/src/widget/editor/editor.search.js index af9a14614..dac41e92d 100644 --- a/src/widget/editor/editor.search.js +++ b/src/widget/editor/editor.search.js @@ -32,7 +32,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, { this.clear = BI.createWidget({ type: "bi.icon_button", stopEvent: true, - cls: "close-font" + cls: "close-font", + invisible: !o.value }); this.clear.on(BI.IconButton.EVENT_CHANGE, function () { self.setValue(""); @@ -123,8 +124,6 @@ BI.SearchEditor = BI.inherit(BI.Widget, { this.editor.on(BI.Editor.EVENT_STOP, function () { self.fireEvent(BI.SearchEditor.EVENT_STOP); }); - - this.clear.invisible(); }, _checkClear: function () { @@ -214,4 +213,4 @@ BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER"; BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE"; BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY"; -BI.shortcut("bi.search_editor", BI.SearchEditor); \ No newline at end of file +BI.shortcut("bi.search_editor", BI.SearchEditor); From 34b277068ead96acef0a86d08954468fffa3e79f Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 5 May 2022 16:31:35 +0800 Subject: [PATCH 03/26] =?UTF-8?q?Revert=20"=E6=97=A0JIRA=20bi.search=5Fedi?= =?UTF-8?q?tor=20=E5=9C=A8=E6=9C=89=E5=88=9D=E5=A7=8B=E5=80=BC=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E6=98=BE=E7=A4=BAclear=E6=8C=89=E9=92=AE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 172f50c994c2528b772e8c74680ebe3a0b2ce5fe. --- src/widget/editor/editor.search.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/widget/editor/editor.search.js b/src/widget/editor/editor.search.js index dac41e92d..af9a14614 100644 --- a/src/widget/editor/editor.search.js +++ b/src/widget/editor/editor.search.js @@ -32,8 +32,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, { this.clear = BI.createWidget({ type: "bi.icon_button", stopEvent: true, - cls: "close-font", - invisible: !o.value + cls: "close-font" }); this.clear.on(BI.IconButton.EVENT_CHANGE, function () { self.setValue(""); @@ -124,6 +123,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, { this.editor.on(BI.Editor.EVENT_STOP, function () { self.fireEvent(BI.SearchEditor.EVENT_STOP); }); + + this.clear.invisible(); }, _checkClear: function () { @@ -213,4 +214,4 @@ BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER"; BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE"; BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY"; -BI.shortcut("bi.search_editor", BI.SearchEditor); +BI.shortcut("bi.search_editor", BI.SearchEditor); \ No newline at end of file From fe722020d9b16a9de2668931a3a0dc0aa4e63792 Mon Sep 17 00:00:00 2001 From: freddy Date: Thu, 5 May 2022 16:52:55 +0800 Subject: [PATCH 04/26] =?UTF-8?q?REPORT-70807=20fix:=E5=B9=B4=E4=BB=BD?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E9=80=82=E9=85=8Dwatermark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/year/combo.year.js | 8 ++++++-- src/widget/year/trigger.year.js | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/widget/year/combo.year.js b/src/widget/year/combo.year.js index 62a498d54..1774ca384 100644 --- a/src/widget/year/combo.year.js +++ b/src/widget/year/combo.year.js @@ -24,7 +24,8 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, { min: o.minDate, max: o.maxDate, height: o.height - border, - value: o.value || "" + value: o.value || "", + watermark: o.watermark }); this.trigger.on(BI.DynamicYearTrigger.EVENT_KEY_DOWN, function () { if (self.combo.isViewVisible()) { @@ -211,8 +212,11 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, { isStateValid: function () { return this.trigger.isValid(); - } + }, + setWaterMark: function (v) { + this.trigger.setWaterMark(v); + } }); BI.DynamicYearCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; diff --git a/src/widget/year/trigger.year.js b/src/widget/year/trigger.year.js index 91b80a431..1cbbbd683 100644 --- a/src/widget/year/trigger.year.js +++ b/src/widget/year/trigger.year.js @@ -35,7 +35,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { }, hgap: c.hgap, vgap: c.vgap, - watermark: BI.i18nText("BI-Basic_Unrestricted"), + watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), allowBlank: true, errorText: function (v) { if (BI.isPositiveInteger(v)) { @@ -188,6 +188,10 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { getKey: function () { return this.editor.getValue() | 0; + }, + + setWaterMark: function (v) { + this.editor.setWaterMark(v); } }); BI.DynamicYearTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; From 6d30eca76f8d7f8d43c6d72ef7840e67e3238009 Mon Sep 17 00:00:00 2001 From: freddy Date: Thu, 5 May 2022 17:13:40 +0800 Subject: [PATCH 05/26] =?UTF-8?q?REPORT-70807=20fix:=E7=BB=99watermark?= =?UTF-8?q?=E5=8A=A0=E4=B8=AAprops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/year/trigger.year.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widget/year/trigger.year.js b/src/widget/year/trigger.year.js index 1cbbbd683..fe8976b2f 100644 --- a/src/widget/year/trigger.year.js +++ b/src/widget/year/trigger.year.js @@ -10,7 +10,8 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { extraCls: "bi-year-trigger", min: "1900-01-01", // 最小日期 max: "2099-12-31", // 最大日期 - height: 24 + height: 24, + watermark: BI.i18nText("BI-Basic_Unrestricted") }); }, @@ -35,7 +36,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { }, hgap: c.hgap, vgap: c.vgap, - watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), + watermark: o.watermark, allowBlank: true, errorText: function (v) { if (BI.isPositiveInteger(v)) { From f61a0ce59a353d6e8a7d17a0718bb262716f4e9f Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 6 May 2022 15:40:22 +0800 Subject: [PATCH 06/26] =?UTF-8?q?feature:=20=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/less/core/wrapper/flex.horizontal.less | 4 +++- src/less/core/wrapper/flex.vertical.less | 4 +++- src/less/core/wrapper/flex.wrapper.horizontal.less | 4 +++- src/less/core/wrapper/flex.wrapper.vertical.less | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/less/core/wrapper/flex.horizontal.less b/src/less/core/wrapper/flex.horizontal.less index a6a38704d..24d8862f6 100644 --- a/src/less/core/wrapper/flex.horizontal.less +++ b/src/less/core/wrapper/flex.horizontal.less @@ -169,7 +169,9 @@ } > .f-f { - min-width: 0; + &:not(.f-s-n) { + min-width: 0; + } -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; diff --git a/src/less/core/wrapper/flex.vertical.less b/src/less/core/wrapper/flex.vertical.less index 5b97ea999..007396436 100644 --- a/src/less/core/wrapper/flex.vertical.less +++ b/src/less/core/wrapper/flex.vertical.less @@ -168,7 +168,9 @@ } > .f-f { - min-height: 0; + &:not(.f-s-n) { + min-height: 0; + } -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; diff --git a/src/less/core/wrapper/flex.wrapper.horizontal.less b/src/less/core/wrapper/flex.wrapper.horizontal.less index 1b38fa0be..09926f54b 100644 --- a/src/less/core/wrapper/flex.wrapper.horizontal.less +++ b/src/less/core/wrapper/flex.wrapper.horizontal.less @@ -265,7 +265,9 @@ } > .f-f { - min-width: 0; + &:not(.f-s-n) { + min-width: 0; + } -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; diff --git a/src/less/core/wrapper/flex.wrapper.vertical.less b/src/less/core/wrapper/flex.wrapper.vertical.less index 09693c348..118759152 100644 --- a/src/less/core/wrapper/flex.wrapper.vertical.less +++ b/src/less/core/wrapper/flex.wrapper.vertical.less @@ -259,7 +259,9 @@ } > .f-f { - min-height: 0; + &:not(.f-s-n) { + min-height: 0; + } -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-grow: 1; From ce32c94936274a4a2b4f65f57ec0d9ffca93fbe7 Mon Sep 17 00:00:00 2001 From: data Date: Fri, 6 May 2022 16:14:14 +0800 Subject: [PATCH 07/26] auto upgrade version to 2.0.20220506161353 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b3355d4f6..0170e3fa3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220505161347", + "version": "2.0.20220506161353", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 5b309f8cde10b785c9b1a175747e497cc0ddbbbb Mon Sep 17 00:00:00 2001 From: data Date: Sat, 7 May 2022 14:23:51 +0800 Subject: [PATCH 08/26] auto upgrade version to 2.0.20220507142342 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0170e3fa3..74384cb8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220506161353", + "version": "2.0.20220507142342", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 9a33d16a64ef7fe7dd43a886a7a9b7ff44ae0069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=95=AC=E5=B3=A5?= Date: Sat, 7 May 2022 14:33:05 +0800 Subject: [PATCH 09/26] =?UTF-8?q?multi=5Fselect=5Flev=E7=9A=84plus=5Fbutto?= =?UTF-8?q?n=E7=B3=BB=E7=BB=9F=E5=8F=82=E6=95=B0=E5=B8=B8=E9=87=8F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/checkbox/check.first.treenode.js | 4 ++-- src/case/checkbox/check.last.treenode.js | 4 ++-- src/case/checkbox/check.mid.treenode.js | 4 ++-- src/case/checkbox/check.treenode.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/case/checkbox/check.first.treenode.js b/src/case/checkbox/check.first.treenode.js index aa808488f..40568e700 100644 --- a/src/case/checkbox/check.first.treenode.js +++ b/src/case/checkbox/check.first.treenode.js @@ -7,8 +7,8 @@ BI.FirstTreeNodeCheckbox = BI.inherit(BI.IconButton, { _defaultConfig: function () { return BI.extend( BI.FirstTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type2" : "tree-collapse-icon-type2", - iconWidth: 24, - iconHeight: 24 + iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT }); }, diff --git a/src/case/checkbox/check.last.treenode.js b/src/case/checkbox/check.last.treenode.js index cb536f8cc..653dd785d 100644 --- a/src/case/checkbox/check.last.treenode.js +++ b/src/case/checkbox/check.last.treenode.js @@ -7,8 +7,8 @@ BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, { _defaultConfig: function () { return BI.extend(BI.LastTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type4" : "tree-collapse-icon-type4", - iconWidth: 24, - iconHeight: 24 + iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT }); }, diff --git a/src/case/checkbox/check.mid.treenode.js b/src/case/checkbox/check.mid.treenode.js index 7ec4e5230..716cb0142 100644 --- a/src/case/checkbox/check.mid.treenode.js +++ b/src/case/checkbox/check.mid.treenode.js @@ -7,8 +7,8 @@ BI.MidTreeNodeCheckbox = BI.inherit(BI.IconButton, { _defaultConfig: function () { return BI.extend( BI.MidTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type3" : "tree-collapse-icon-type3", - iconWidth: 24, - iconHeight: 24 + iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT }); }, diff --git a/src/case/checkbox/check.treenode.js b/src/case/checkbox/check.treenode.js index 128bb73c6..ab186f4fb 100644 --- a/src/case/checkbox/check.treenode.js +++ b/src/case/checkbox/check.treenode.js @@ -7,8 +7,8 @@ BI.TreeNodeCheckbox = BI.inherit(BI.IconButton, { _defaultConfig: function () { return BI.extend( BI.TreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type1" : "tree-collapse-icon-type1", - iconWidth: 24, - iconHeight: 24 + iconWidth: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + iconHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT }); }, From 45e25f37a89fb13e57060039894a57ea70dd319d Mon Sep 17 00:00:00 2001 From: data Date: Sat, 7 May 2022 15:06:03 +0800 Subject: [PATCH 10/26] auto upgrade version to 2.0.20220507150550 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 74384cb8c..f24311602 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220507142342", + "version": "2.0.20220507150550", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 2e1322acf11fa1ee087ca1ca0f7ee23aae3bff17 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 9 May 2022 13:54:37 +0800 Subject: [PATCH 11/26] =?UTF-8?q?=E6=97=A0JIRA=20feat:=E5=8D=95=E9=80=89?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=94=AF=E6=8C=81=E6=B8=85=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clear既清空value,也清空text --- .../trigger.searchtextvalue.js | 1 + .../combo/textvaluecombo/combo.textvalue.js | 21 ++++- src/case/trigger/trigger.text.js | 77 ++++++++++++++----- src/case/trigger/trigger.text.select.js | 22 ++++-- 4 files changed, 95 insertions(+), 26 deletions(-) diff --git a/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js index 7e84a4452..5673d3f47 100644 --- a/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js @@ -111,4 +111,5 @@ BI.SearchTextValueTrigger.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.SearchTextValueTrigger.EVENT_STOP = "EVENT_STOP"; BI.SearchTextValueTrigger.EVENT_START = "EVENT_START"; BI.SearchTextValueTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +BI.SearchTextValueTrigger.EVENT_CLEAR = "EVENT_CLEAR"; BI.shortcut("bi.search_text_value_trigger", BI.SearchTextValueTrigger); diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index 6b9ef321b..75f2fd41f 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -12,6 +12,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, text: "", value: "", + allowClear: false, }); }, @@ -33,7 +34,16 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { height: o.height, text: o.text, value: o.value, - warningTitle: o.warningTitle + warningTitle: o.warningTitle, + allowClear: o.allowClear, + listeners: [ + { + eventName: BI.SelectTextTrigger.EVENT_CLEAR, + action: function () { + self._clear(); + } + } + ], }); this.popup = BI.createWidget({ type: "bi.text_value_combo_popup", @@ -62,13 +72,18 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { minHeight: 25 } }); - if(BI.isKey(o.value)) { + if (BI.isKey(o.value)) { this._checkError(o.value); } }, + _clear: function () { + this.trigger.attr("text", ""); + this.setValue(); + }, + _checkError: function (v) { - if(BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) { + if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) { this.trigger.options.tipType = "success"; this.element.removeClass("combo-error"); } else { diff --git a/src/case/trigger/trigger.text.js b/src/case/trigger/trigger.text.js index e8ee789df..a85506c95 100644 --- a/src/case/trigger/trigger.text.js +++ b/src/case/trigger/trigger.text.js @@ -7,25 +7,27 @@ */ BI.TextTrigger = BI.inherit(BI.Trigger, { - _defaultConfig: function () { + props: function () { var self = this; - var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-text-trigger", + return { + baseCls: "bi-text-trigger", height: 24, textHgap: 6, textCls: "", + allowClear: false, title: function () { return self.text.getText(); } - }); + }; }, - _init: function () { - BI.TextTrigger.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options, c = this._const; - this.text = BI.createWidget({ + var text = { type: "bi.label", + ref: function (_ref) { + self.text = _ref; + }, cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, @@ -39,32 +41,69 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { tgap: o.textTgap, bgap: o.textBgap, readonly: o.readonly - }); - this.trigerButton = BI.createWidget({ + }; + + var triggerButton = { type: "bi.trigger_icon_button", + ref: function (_ref) { + self.triggerButton = _ref; + }, width: o.triggerWidth || o.height - }); + }; - BI.createWidget({ - element: this, + return ({ type: "bi.horizontal_fill", items: [ { - el: this.text, + el: text, width: "fill" }, { - el: this.trigerButton, - width: o.triggerWidth || o.height + type: "bi.vertical_adapt", + horizontalAlign: "left", + width: o.triggerWidth || o.height, + scrollable: false, + items: [ + { + el: { + type: "bi.icon_button", + ref: function (_ref) { + self.clearBtn = _ref; + }, + cls: "close-h-font", + stopPropagation: true, + handler: function () { + self.fireEvent(BI.TextTrigger.EVENT_CLEAR); + self.clearBtn.setVisible(false); + }, + invisible: true, + }, + width: o.triggerWidth || o.height + }, { + el: triggerButton, + width: o.triggerWidth || o.height + } + ] } ] }); }, - getTextor: function() { + mounted: function () { + var self = this; + if (this.options.allowClear) { + this.element.hover(function () { + BI.isKey(self.text.getText()) && self.clearBtn.setVisible(true); + }, function () { + self.clearBtn.setVisible(false); + }); + } + }, + + getTextor: function () { return this.text; }, - setTextCls: function(cls) { + setTextCls: function (cls) { var o = this.options; var oldCls = o.textCls; o.textCls = cls; @@ -80,4 +119,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { this.options.tipType = v; } }); + +BI.TextTrigger.EVENT_CLEAR = "EVENT_CLEAR"; BI.shortcut("bi.text_trigger", BI.TextTrigger); diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index 8b24c1c9c..f9b8a770e 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -11,6 +11,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { return BI.extend(BI.SelectTextTrigger.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-select-text-trigger", height: 24, + allowClear: false, }); }, @@ -32,11 +33,20 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { textTgap: o.textTgap, textBgap: o.textBgap, tipType: o.tipType, - warningTitle: o.warningTitle + warningTitle: o.warningTitle, + allowClear: o.allowClear, + listeners: [ + { + eventName: BI.TextTrigger.EVENT_CLEAR, + action: function () { + self.fireEvent(BI.SelectTextTrigger.EVENT_CLEAR); + } + } + ] }); }, - _digest: function(vals, items){ + _digest: function (vals, items) { var o = this.options; vals = BI.isArray(vals) ? vals : [vals]; var result = []; @@ -51,12 +61,12 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { return { textCls: "", text: result.join(",") - } + }; } else { return { textCls: "bi-water-mark", text: BI.isFunction(o.text) ? o.text() : o.text - } + }; } }, @@ -70,7 +80,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.trigger.setTipType(v); }, - getTextor: function() { + getTextor: function () { return this.trigger.getTextor(); }, @@ -78,4 +88,6 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.items = items; } }); + +BI.SelectTextTrigger.EVENT_CLEAR = "EVENT_CLEAR"; BI.shortcut("bi.select_text_trigger", BI.SelectTextTrigger); From 0c2fa953cf0dc895ea5862fcfd3b1b44df0b6672 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 9 May 2022 13:54:59 +0800 Subject: [PATCH 12/26] update changelog --- changelog.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/changelog.md b/changelog.md index f6824f6d6..dbcca9ccd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,19 @@ # 更新日志 + +3.0(2022-05) +- 下拉选择框支持清空 + +3.0(2022-03) +- 支持响应式 +- 全面支持Typescript +- 增加JSX支持 +- 布局组件支持更多动态特性 +- 底层API支持动画 +- 增加WebWorker支持 +- 支持路由 +- 插件支持版本控制 +- Fix数据流支持proxy版本 + 2.0(2022-01) - 提供自定义表单 From 11a0f98c421fbabd75ba248f324925c51fbeac67 Mon Sep 17 00:00:00 2001 From: Freddy Date: Sat, 7 May 2022 13:55:19 +0800 Subject: [PATCH 13/26] =?UTF-8?q?Pull=20request=20#2666:=20REPORT-70807=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B9=B4=E4=BB=BD=E6=97=A5=E6=9C=9F=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=B0=B4=E5=8D=B0=E5=8F=AA=E6=98=BE=E7=A4=BA=E6=97=A0?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge in VISUAL/fineui from ~FREDDY/fineui:master to master * commit '6d30eca76f8d7f8d43c6d72ef7840e67e3238009': REPORT-70807 fix:给watermark加个props REPORT-70807 fix:年份日期控件适配watermark (cherry picked from commit e60d977be0ad7e5e5ae984163ac92675188675d6) --- src/widget/year/combo.year.js | 8 ++++++-- src/widget/year/trigger.year.js | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/widget/year/combo.year.js b/src/widget/year/combo.year.js index 62a498d54..1774ca384 100644 --- a/src/widget/year/combo.year.js +++ b/src/widget/year/combo.year.js @@ -24,7 +24,8 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, { min: o.minDate, max: o.maxDate, height: o.height - border, - value: o.value || "" + value: o.value || "", + watermark: o.watermark }); this.trigger.on(BI.DynamicYearTrigger.EVENT_KEY_DOWN, function () { if (self.combo.isViewVisible()) { @@ -211,8 +212,11 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, { isStateValid: function () { return this.trigger.isValid(); - } + }, + setWaterMark: function (v) { + this.trigger.setWaterMark(v); + } }); BI.DynamicYearCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; diff --git a/src/widget/year/trigger.year.js b/src/widget/year/trigger.year.js index 91b80a431..fe8976b2f 100644 --- a/src/widget/year/trigger.year.js +++ b/src/widget/year/trigger.year.js @@ -10,7 +10,8 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { extraCls: "bi-year-trigger", min: "1900-01-01", // 最小日期 max: "2099-12-31", // 最大日期 - height: 24 + height: 24, + watermark: BI.i18nText("BI-Basic_Unrestricted") }); }, @@ -35,7 +36,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { }, hgap: c.hgap, vgap: c.vgap, - watermark: BI.i18nText("BI-Basic_Unrestricted"), + watermark: o.watermark, allowBlank: true, errorText: function (v) { if (BI.isPositiveInteger(v)) { @@ -188,6 +189,10 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { getKey: function () { return this.editor.getValue() | 0; + }, + + setWaterMark: function (v) { + this.editor.setWaterMark(v); } }); BI.DynamicYearTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; From 406b42e8d20cd8838194ed9d3aa4fa3251926de5 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 9 May 2022 15:10:34 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=E5=B8=83=E5=B1=80=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/layout.inline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index a1d889337..04b38a47a 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -40,7 +40,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.InlineLayout.superclass._addElement.apply(this, arguments); - var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width; + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; if (o.columnSize.length > 0) { if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) { columnSize = null; From 13123d29500c86b0f377559037abd3533af043ea Mon Sep 17 00:00:00 2001 From: data Date: Mon, 9 May 2022 15:24:10 +0800 Subject: [PATCH 15/26] auto upgrade version to 2.0.20220509152356 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f24311602..2d4eb2f3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220507150550", + "version": "2.0.20220509152356", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 310f4144f715b72f685b44a937ba04532d9c3d84 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 9 May 2022 15:34:52 +0800 Subject: [PATCH 16/26] auto upgrade version to 2.0.20220509153445 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d4eb2f3d..764120cdd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220509152356", + "version": "2.0.20220509153445", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 59b332512a06f79dbfc37b5d999ece082e05f48e Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 9 May 2022 17:31:05 +0800 Subject: [PATCH 17/26] =?UTF-8?q?DESIGN-4103=20feat:=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E7=BB=84=E4=BB=B6=E6=94=AF=E6=8C=81clear,=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A0=91=E6=94=AF=E6=8C=81=E7=BC=BA=E5=A4=B1=E6=A0=87?= =?UTF-8?q?=E7=BA=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combo.searchtextvalue.js | 9 +++ .../combo/textvaluecombo/combo.textvalue.js | 10 ++-- src/case/trigger/trigger.text.js | 60 ++++++++----------- src/case/trigger/trigger.text.select.js | 6 ++ src/less/base/combo/combo.less | 17 +++++- src/less/base/combo/combo.textvalue.less | 14 ----- src/less/base/trigger/trigger.text.less | 11 ++++ src/less/lib/theme.less | 1 + src/widget/selecttree/selecttree.combo.js | 42 ++++++++++++- src/widget/singletree/singletree.combo.js | 42 ++++++++++++- src/widget/singletree/singletree.trigger.js | 22 ++++++- 11 files changed, 172 insertions(+), 62 deletions(-) delete mode 100644 src/less/base/combo/combo.textvalue.less create mode 100644 src/less/base/trigger/trigger.text.less diff --git a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js index ac3fad335..cb4aa29f8 100644 --- a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js @@ -11,6 +11,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { items: [], tipType: "", warningTitle: "", + allowClear: false, }, render: function () { @@ -48,6 +49,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { tipType: o.tipType, warningTitle: o.warningTitle, title: o.title, + allowClear: o.allowClear, listeners: [{ eventName: BI.SearchTextValueTrigger.EVENT_CHANGE, action: function () { @@ -55,6 +57,13 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { self.combo.hideView(); self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); } + }, { + eventName: BI.SearchTextValueTrigger.EVENT_CLEAR, + action: function () { + self.setValue(); + self.combo.hideView(); + self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); + } }] }, popup: { diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index 75f2fd41f..69075f739 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -78,14 +78,14 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { }, _clear: function () { - this.trigger.attr("text", ""); this.setValue(); }, _checkError: function (v) { if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) { this.trigger.options.tipType = "success"; - this.element.removeClass("combo-error"); + this.element.removeClass("error"); + this.trigger.element.removeClass("error"); } else { v = BI.isArray(v) ? v : [v]; var result = BI.find(this.options.items, function (idx, item) { @@ -93,10 +93,12 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { }); if (BI.isNull(result)) { this.trigger.setTipType("warning"); - this.element.removeClass("combo-error").addClass("combo-error"); + this.element.addClass("error"); + this.trigger.element.addClass("error"); } else { this.trigger.setTipType("success"); - this.element.removeClass("combo-error"); + this.element.removeClass("error"); + this.trigger.element.removeClass("error"); } } }, diff --git a/src/case/trigger/trigger.text.js b/src/case/trigger/trigger.text.js index a85506c95..b9a51cc6f 100644 --- a/src/case/trigger/trigger.text.js +++ b/src/case/trigger/trigger.text.js @@ -53,52 +53,39 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { return ({ type: "bi.horizontal_fill", + columnSize: ["fill", o.triggerWidth || o.height], items: [ { el: text, width: "fill" }, { - type: "bi.vertical_adapt", - horizontalAlign: "left", - width: o.triggerWidth || o.height, - scrollable: false, - items: [ - { - el: { - type: "bi.icon_button", - ref: function (_ref) { - self.clearBtn = _ref; + el: o.allowClear ? { + type: "bi.vertical_adapt", + horizontalAlign: "left", + scrollable: false, + items: [ + { + el: { + type: "bi.icon_button", + ref: function (_ref) { + self.clearBtn = _ref; + }, + cls: "close-h-font " + (o.allowClear ? "clear-button" : ""), + stopPropagation: true, + handler: function () { + self.fireEvent(BI.TextTrigger.EVENT_CLEAR); + }, }, - cls: "close-h-font", - stopPropagation: true, - handler: function () { - self.fireEvent(BI.TextTrigger.EVENT_CLEAR); - self.clearBtn.setVisible(false); - }, - invisible: true, - }, - width: o.triggerWidth || o.height - }, { - el: triggerButton, - width: o.triggerWidth || o.height - } - ] + }, { + el: triggerButton, + } + ] + } : triggerButton, } ] }); }, - mounted: function () { - var self = this; - if (this.options.allowClear) { - this.element.hover(function () { - BI.isKey(self.text.getText()) && self.clearBtn.setVisible(true); - }, function () { - self.clearBtn.setVisible(false); - }); - } - }, - getTextor: function () { return this.text; }, @@ -112,6 +99,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { setText: function (text) { this.text.setText(text); + if (this.options.allowClear) { + this.clearBtn.setVisible(BI.isNotEmptyString(text)); + } }, setTipType: function (v) { diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index f9b8a770e..a63fc4bb0 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -39,6 +39,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { { eventName: BI.TextTrigger.EVENT_CLEAR, action: function () { + self.setText(""); self.fireEvent(BI.SelectTextTrigger.EVENT_CLEAR); } } @@ -70,6 +71,11 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { } }, + setText: function (text) { + this.options.text = text; + this.trigger.setText(text); + }, + setValue: function (vals) { var formatValue = this._digest(vals, this.options.items); this.trigger.setTextCls(formatValue.textCls); diff --git a/src/less/base/combo/combo.less b/src/less/base/combo/combo.less index 9725ac58a..f96f4b008 100644 --- a/src/less/base/combo/combo.less +++ b/src/less/base/combo/combo.less @@ -1,19 +1,22 @@ @import "../../index.less"; + @val: transform .3s ease; .bi-combo { & > .bi-trigger { - & .bi-trigger-icon-button{ + & .bi-trigger-icon-button { & .x-icon { .rotate(0deg); .transition(@val); } } } + &.bi-combo-popup { display: block !important; visibility: visible !important; + & > .bi-trigger { - & .bi-trigger-icon-button{ + & .bi-trigger-icon-button { & .x-icon { .rotate(180deg); .transition(@val); @@ -21,11 +24,13 @@ } } } + &.bi-combo-popup, &.bi-combo-hover, &:hover { &.bi-border, &.bi-border-bottom { border-color: @color-bi-border-hover-combo; } } + &.disabled { &.bi-combo-hover, &:hover { &.bi-border, &.bi-border-bottom { @@ -33,6 +38,14 @@ } } } + + &.error { + &.bi-combo-hover, &:hover { + &.bi-border, &.bi-border-bottom { + border-color: @border-color-negative; + } + } + } } .bi-theme-dark { diff --git a/src/less/base/combo/combo.textvalue.less b/src/less/base/combo/combo.textvalue.less deleted file mode 100644 index 1feec1972..000000000 --- a/src/less/base/combo/combo.textvalue.less +++ /dev/null @@ -1,14 +0,0 @@ -@import "../../index.less"; - -.bi-text-value-combo { - &.combo-error { - & .bi-select-text-trigger { - & .select-text-label { - color: @color-bi-text-error-hover-text-value-combo; - } - } - &.bi-border, &.bi-border-bottom { - border-color: @border-color-negative; - } - } -} \ No newline at end of file diff --git a/src/less/base/trigger/trigger.text.less b/src/less/base/trigger/trigger.text.less new file mode 100644 index 000000000..9e2040512 --- /dev/null +++ b/src/less/base/trigger/trigger.text.less @@ -0,0 +1,11 @@ +@import "../../index.less"; + +.bi-text-trigger { + &.error .select-text-label { + color: @color-bi-text-error-text-trigger; + } + + &:where(:not(&:hover)) .clear-button { + display: none; + } +} diff --git a/src/less/lib/theme.less b/src/less/lib/theme.less index db42c9ef4..3c85b8031 100644 --- a/src/less/lib/theme.less +++ b/src/less/lib/theme.less @@ -179,6 +179,7 @@ @color-bi-border-hover-text-value-down-list-combo: @color-bi-border-highlight; @color-bi-border-hover-text-value-check-combo: @color-bi-border-highlight; @color-bi-text-error-hover-text-value-combo: @color-bi-text-failure; +@color-bi-text-error-text-trigger: @color-bi-text-failure; @color-bi-text-error-hover-text-value-icon-combo: @color-bi-text-failure; @color-bi-text-error-hover-search-text-value-combo: @color-bi-text-failure; @color-bi-background-bubble-combo-triangle: @color-bi-background-default; diff --git a/src/widget/selecttree/selecttree.combo.js b/src/widget/selecttree/selecttree.combo.js index 98c542686..c6aca0c62 100644 --- a/src/widget/selecttree/selecttree.combo.js +++ b/src/widget/selecttree/selecttree.combo.js @@ -11,6 +11,7 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { text: "", items: [], value: "", + allowClear: false, }); }, @@ -25,7 +26,13 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { text: o.text, height: o.height, items: o.items, - value: o.value + value: o.value, + allowClear: o.allowClear, + warningTitle: o.warningTitle, + }); + + this.trigger.on(BI.SingleTreeTrigger.EVENT_CLEAR, function () { + self._clear(); }); this.popup = BI.createWidget({ @@ -53,12 +60,43 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { self.setValue(self.popup.getValue()); self.combo.hideView(); }); + + if (BI.isKey(o.value)) { + this._checkError(o.value); + } + }, + + _checkError: function (v) { + if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) { + this.trigger.options.tipType = "success"; + this.trigger.element.removeClass("error"); + this.element.removeClass("error"); + } else { + v = BI.isArray(v) ? v : [v]; + var result = BI.find(this.options.items, function (idx, item) { + return BI.contains(v, item.value); + }); + if (BI.isNull(result)) { + this.trigger.setTipType("warning"); + this.element.removeClass("error").addClass("error"); + this.trigger.element.removeClass("error").addClass("error"); + } else { + this.trigger.setTipType("success"); + this.trigger.element.removeClass("error"); + this.element.removeClass("error"); + } + } + }, + + _clear: function () { + this.setValue([]); }, setValue: function (v) { v = BI.isArray(v) ? v : [v]; this.trigger.setValue(v); this.popup.setValue(v); + this._checkError(v); }, getValue: function () { @@ -71,4 +109,4 @@ BI.SelectTreeCombo = BI.inherit(BI.Widget, { }); -BI.shortcut("bi.select_tree_combo", BI.SelectTreeCombo); \ No newline at end of file +BI.shortcut("bi.select_tree_combo", BI.SelectTreeCombo); diff --git a/src/widget/singletree/singletree.combo.js b/src/widget/singletree/singletree.combo.js index ce6d255d4..32d39d338 100644 --- a/src/widget/singletree/singletree.combo.js +++ b/src/widget/singletree/singletree.combo.js @@ -12,6 +12,7 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { text: "", items: [], value: "", + allowClear: false, }); }, @@ -26,9 +27,15 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { text: o.text, height: o.height, items: o.items, - value: o.value + value: o.value, + allowClear: o.allowClear, + warningTitle: o.warningTitle, }, o.trigger)); + this.trigger.on(BI.SingleTreeTrigger.EVENT_CLEAR, function () { + self._clear(); + }); + this.popup = BI.createWidget({ type: "bi.single_level_tree", items: o.items, @@ -58,6 +65,36 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { self.combo.hideView(); self.fireEvent(BI.SingleTreeCombo.EVENT_CHANGE); }); + + if (BI.isKey(o.value)) { + this._checkError(o.value); + } + }, + + _checkError: function (v) { + if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) { + this.trigger.options.tipType = "success"; + this.trigger.element.removeClass("error"); + this.element.removeClass("error"); + } else { + v = BI.isArray(v) ? v : [v]; + var result = BI.find(this.options.items, function (idx, item) { + return BI.contains(v, item.value); + }); + if (BI.isNull(result)) { + this.trigger.setTipType("warning"); + this.element.removeClass("error").addClass("error"); + this.trigger.element.removeClass("error").addClass("error"); + } else { + this.trigger.setTipType("success"); + this.trigger.element.removeClass("error"); + this.element.removeClass("error"); + } + } + }, + + _clear: function () { + this.setValue([]); }, populate: function (items) { @@ -68,6 +105,7 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { v = BI.isArray(v) ? v : [v]; this.trigger.setValue(v); this.popup.setValue(v); + this._checkError(v); }, getValue: function () { @@ -77,4 +115,4 @@ BI.SingleTreeCombo = BI.inherit(BI.Widget, { BI.SingleTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.SingleTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; -BI.shortcut("bi.single_tree_combo", BI.SingleTreeCombo); \ No newline at end of file +BI.shortcut("bi.single_tree_combo", BI.SingleTreeCombo); diff --git a/src/widget/singletree/singletree.trigger.js b/src/widget/singletree/singletree.trigger.js index 91183c033..d8dd3f69c 100644 --- a/src/widget/singletree/singletree.trigger.js +++ b/src/widget/singletree/singletree.trigger.js @@ -11,7 +11,8 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { height: 24, text: "", items: [], - value: "" + value: "", + allowClear: false, }); }, @@ -26,7 +27,17 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { text: o.text, items: o.items, height: o.height, - value: o.value + warningTitle: o.warningTitle, + value: o.value, + allowClear: o.allowClear, + listeners: [ + { + eventName: BI.SelectTextTrigger.EVENT_CLEAR, + action: function () { + self.fireEvent(BI.SingleTreeTrigger.EVENT_CLEAR); + } + } + ] }); }, @@ -47,11 +58,15 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { this._checkTitle(); }, + setTipType: function (v) { + this.trigger.setTipType(v); + }, + getValue: function () { return this.options.value || []; }, - getTextor: function() { + getTextor: function () { return this.trigger.getTextor(); }, @@ -61,4 +76,5 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }); +BI.SingleTreeTrigger.EVENT_CLEAR = "EVENT_CLEAR"; BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger); From 307bc13b00ed15e0d0178aa3ebf91285ab297d89 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 9 May 2022 22:25:57 +0800 Subject: [PATCH 18/26] feature: checker --- src/base/single/input/input.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js index 41e1ca0de..145129dc2 100644 --- a/src/base/single/input/input.js +++ b/src/base/single/input/input.js @@ -207,13 +207,24 @@ BI.Input = BI.inherit(BI.Single, { }, _checkValidationOnValueChange: function () { - var o = this.options; + var self = this, o = this.options; var v = this.getValue(); - this.setValid( - (o.allowBlank === true && BI.trim(v) == "") || ( - BI.isNotEmptyString(BI.trim(v)) && o.validationChecker.apply(this, [BI.trim(v)]) !== false - ) - ); + if (o.allowBlank === true && BI.trim(v) == "") { + this.setValid(true); + return; + } + if (BI.trim(v) == "") { + this.setValid(false); + return; + } + var checker = o.validationChecker.apply(this, [BI.trim(v)]); + if (checker instanceof Promise) { + checker.then(function (validate) { + self.setValid(validate !== false); + }) + } else { + this.setValid(checker !== false); + } }, focus: function () { From fff0cc07dfd95110888086ff41d55e210b9b30f1 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 9 May 2022 23:54:35 +0800 Subject: [PATCH 19/26] update --- src/base/single/input/input.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/base/single/input/input.js b/src/base/single/input/input.js index 145129dc2..e868a5747 100644 --- a/src/base/single/input/input.js +++ b/src/base/single/input/input.js @@ -206,24 +206,28 @@ BI.Input = BI.inherit(BI.Single, { this._lastValue = this.getValue(); }, - _checkValidationOnValueChange: function () { + _checkValidationOnValueChange: function (callback) { var self = this, o = this.options; var v = this.getValue(); if (o.allowBlank === true && BI.trim(v) == "") { this.setValid(true); + callback && callback(); return; } if (BI.trim(v) == "") { this.setValid(false); + callback && callback(); return; } var checker = o.validationChecker.apply(this, [BI.trim(v)]); if (checker instanceof Promise) { checker.then(function (validate) { self.setValid(validate !== false); + callback && callback(); }) } else { this.setValid(checker !== false); + callback && callback(); } }, @@ -256,14 +260,16 @@ BI.Input = BI.inherit(BI.Single, { }, setValue: function (textValue) { + var self = this; this.element.val(textValue); - BI.nextTick(BI.bind(function () { - this._checkValidationOnValueChange(); - this._defaultState(); - if (this.isValid()) { - this._lastValidValue = this._lastSubmitValue = this.getValue(); - } - }, this)); + BI.nextTick(function () { + self._checkValidationOnValueChange(function () { + self._defaultState(); + if (self.isValid()) { + self._lastValidValue = self._lastSubmitValue = self.getValue(); + } + }); + }); }, getValue: function () { From 3ca37b200491795dcf173e0e8d3f442b37d51206 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 10 May 2022 09:35:16 +0800 Subject: [PATCH 20/26] auto upgrade version to 2.0.20220510093508 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 764120cdd..591cbef84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220509153445", + "version": "2.0.20220510093508", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 5ebb3dfe201f4d15278b58a849ae318b9c15fe72 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 10 May 2022 10:35:30 +0800 Subject: [PATCH 21/26] auto upgrade version to 2.0.20220510103520 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 591cbef84..f960dc0de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220510093508", + "version": "2.0.20220510103520", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 882817a6d484d39975968c5be86c724705c0a312 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 10 May 2022 13:54:42 +0800 Subject: [PATCH 22/26] auto upgrade version to 2.0.20220510135434 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f960dc0de..557ce0550 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220510103520", + "version": "2.0.20220510135434", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 2b81ffd4031edc7af999a010fd2c1768ad1d3f62 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 10 May 2022 16:21:27 +0800 Subject: [PATCH 23/26] =?UTF-8?q?DESIGN-4103=20feat:=20=E9=87=8D=E5=86=99?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E4=B8=8B=E6=8B=89=E6=A0=91=E7=9A=84=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multilayerselecttree.combo.js | 65 +++++-------------- .../multilayerselecttree.trigger.js | 61 +++++++---------- .../multilayersingletree.combo.js | 22 +++---- .../multilayersingletree.trigger.js | 59 +++++++---------- src/widget/singletree/singletree.trigger.js | 1 + 5 files changed, 76 insertions(+), 132 deletions(-) diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index 6365ef484..1613e9fbf 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -16,59 +16,21 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { allowEdit: false, allowSearchValue: false, allowInsertValue: false, - isNeedAdjustWidth: true + isNeedAdjustWidth: true, }); }, _init: function () { var o = this.options; - if (this._shouldWrapper()) { - o.height -= 2; - BI.isNumeric(o.width) && (o.width -= 2); - } + BI.isNumeric(o.width) && (o.width -= 2); + BI.isNumeric(o.height) && (o.height -= 2); BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments); }, render: function () { var self = this, o = this.options; - var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); - - return this._shouldWrapper() ? combo : { - type: "bi.absolute", - items: [{ - el: combo, - left: 0, - right: 0, - top: 0, - bottom: 0 - }, { - el: { - type: "bi.trigger_icon_button", - cls: "trigger-icon-button", - ref: function (_ref) { - self.triggerBtn = _ref; - }, - width: o.height, - height: o.height, - handler: function () { - if (self.combo.isViewVisible()) { - self.combo.hideView(); - } else { - self.combo.showView(); - } - } - }, - right: 0, - bottom: 0, - top: 0 - }] - }; - }, - - _shouldWrapper: function () { - var o = this.options; - return !o.allowEdit && o.itemsCreator === BI.emptyFn; + return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); }, _getBaseConfig: function () { @@ -122,7 +84,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }; }, - _getSearchConfig: function() { + _getSearchConfig: function () { var self = this, o = this.options; return { el: { @@ -139,7 +101,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, watermark: o.watermark, - height: o.height - (o.simple ? 1 : 2), + // height: o.height - (o.simple ? 1 : 2), + height: o.height, text: o.text, value: o.value, tipType: o.tipType, @@ -184,7 +147,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { // IE11下,popover(position: fixed)下放置下拉控件(position: fixed), 滚动的时候会异常卡顿 // 通过container参数将popup放置于popover之外解决此问题, 其他下拉控件由于元素少或者有分页,所以 // 卡顿不明显, 先在此做尝试, 并在FineUI特殊处理待解决文档中标记跟踪 - return (o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0) ? false : self.triggerBtn.element.find(e.target).length === 0; + return !(o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0); }, listeners: [{ @@ -198,7 +161,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW); } }] - } + }; }, _getSyncConfig: function () { @@ -207,13 +170,15 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return BI.extend(baseConfig, o.allowEdit ? this._getSearchConfig() : { el: { type: "bi.single_tree_trigger", - ref: function(_ref) { + ref: function (_ref) { self.textTrigger = _ref; }, text: o.text, height: o.height, items: o.items, - value: o.value + value: o.value, + tipType: o.tipType, + warningTitle: o.warningTitle, } }); }, @@ -236,6 +201,10 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return this.trigger ? this.trigger.getSearcher() : this.textTrigger.getTextor(); }, + clear: function () { + // do some work + }, + populate: function (items) { this.combo.populate(items); }, diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 4b66b58f7..11789b5ac 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js @@ -3,7 +3,7 @@ */ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { - props: function() { + props: function () { return { extraCls: "bi-multi-layer-select-tree-trigger", height: 24, @@ -16,11 +16,12 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; - if(o.itemsCreator === BI.emptyFn) { + if (o.itemsCreator === BI.emptyFn) { this._initData(); } - var content = { - type: "bi.htape", + + return { + type: "bi.horizontal_fill", items: [ { el: { @@ -86,7 +87,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }, onSearch: function (obj, callback) { var keyword = obj.keyword; - if(o.itemsCreator === BI.emptyFn) { + if (o.itemsCreator === BI.emptyFn) { callback(self._getSearchItems(keyword)); o.allowInsertValue && self.popup.setKeyword(keyword); } else { @@ -99,51 +100,37 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE); } }] - } + }, + width: "fill", }, { el: { - type: "bi.layout", - width: 24 + type: "bi.trigger_icon_button", + cls: "trigger-icon-button", + ref: function (_ref) { + self.triggerBtn = _ref; + }, + width: 24, }, - width: 24 + width: 24, } ] }; - - return o.allowEdit ? content : { - type: "bi.absolute", - items: [{ - el: content, - left: 0, - right: 0, - top: 0, - bottom: 0 - }, { - el: { - type: "bi.layout" - }, - left: 0, - right: 24, - top: 0, - bottom: 0 - }] - }; }, - _initData: function() { + _initData: function () { var o = this.options; this.tree = new BI.Tree(); this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); this.tree.initTree(this.nodes); }, - _getSearchItems: function(keyword) { + _getSearchItems: function (keyword) { var self = this, o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 var items = []; this.tree.traverse(function (node) { var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword); - if(find.find.length > 0 || find.match.length > 0) { + if (find.find.length > 0 || find.match.length > 0) { items.push(node); return true; } @@ -151,7 +138,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { return this._fillTreeStructure4Search(items, "id"); }, - _createJson: function(node, open) { + _createJson: function (node, open) { return { id: node.id, pId: node.pId, @@ -159,10 +146,10 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { value: node.value, isParent: BI.isNotEmptyArray(node.children), open: open - } + }; }, - _getChildren: function(node) { + _getChildren: function (node) { var self = this; node.children = node.children || []; var nodes = []; @@ -179,7 +166,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var result = []; var queue = []; BI.each(leaves, function (idx, node) { - queue.push({pId: node.pId}); + queue.push({ pId: node.pId }); result.push(node); result = result.concat(self._getChildren(node)); }); @@ -188,7 +175,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { pNode.open = true; - queue.push({pId: pNode.pId}); + queue.push({ pId: pNode.pId }); result.push(pNode); } } @@ -259,4 +246,4 @@ BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP"; BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START"; BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiLayerSelectTreeTrigger.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; -BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger); \ No newline at end of file +BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger); diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index 779e645bf..d0e11182f 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -25,17 +25,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { _init: function () { var o = this.options; - if (this._shouldWrapper()) { - o.height -= 2; - BI.isNumeric(o.width) && (o.width -= 2); - } + BI.isNumeric(o.width) && (o.width -= 2); + BI.isNumeric(o.height) && (o.height -= 2); BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments); }, render: function () { var self = this, o = this.options; - var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); + return (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); return this._shouldWrapper() ? combo : { type: "bi.absolute", @@ -125,7 +123,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }; }, - _getSearchConfig: function() { + _getSearchConfig: function () { var self = this, o = this.options; return { el: { @@ -142,7 +140,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { items: o.items, itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, - height: o.height - (o.simple ? 1 : 2), + height: o.height, text: o.text, value: o.value, tipType: o.tipType, @@ -186,7 +184,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { // IE11下,popover(position: fixed)下放置下拉控件(position: fixed), 滚动的时候会异常卡顿 // 通过container参数将popup放置于popover之外解决此问题, 其他下拉控件由于元素少或者有分页,所以 // 卡顿不明显, 先在此做尝试, 并在FineUI特殊处理待解决文档中标记跟踪 - return (o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0) ? false : self.triggerBtn.element.find(e.target).length === 0 + return !(o.container && self.trigger.getSearcher().isSearching() && self.trigger.getSearcher().getView().element.find(e.target).length > 0); }, listeners: [{ eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, @@ -199,7 +197,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_BEFORE_POPUPVIEW); } }] - } + }; }, _getSyncConfig: function () { @@ -208,13 +206,15 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return BI.extend(baseConfig, o.allowEdit ? this._getSearchConfig() : { el: { type: "bi.single_tree_trigger", - ref: function(_ref) { + ref: function (_ref) { self.textTrigger = _ref; }, text: o.text, height: o.height, items: o.items, - value: o.value + value: o.value, + tipType: o.tipType, + warningTitle: o.warningTitle, } }); }, diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 75a515129..8c58b0c8c 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/src/widget/multilayersingletree/multilayersingletree.trigger.js @@ -3,7 +3,7 @@ */ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { - props: function() { + props: function () { return { extraCls: "bi-multi-layer-single-tree-trigger", height: 24, @@ -16,11 +16,12 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { render: function () { var self = this, o = this.options; - if(o.itemsCreator === BI.emptyFn) { + if (o.itemsCreator === BI.emptyFn) { this._initData(); } - var content = { - type: "bi.htape", + + return { + type: "bi.horizontal_fill", items: [ { el: { @@ -86,7 +87,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }, onSearch: function (obj, callback) { var keyword = obj.keyword; - if(o.itemsCreator === BI.emptyFn) { + if (o.itemsCreator === BI.emptyFn) { callback(self._getSearchItems(keyword)); o.allowInsertValue && self.popup.setKeyword(keyword); } else { @@ -99,51 +100,37 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { self.fireEvent(BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE); } }] - } + }, + width: "fill", }, { el: { - type: "bi.layout", - width: 24 + type: "bi.trigger_icon_button", + cls: "trigger-icon-button", + ref: function (_ref) { + self.triggerBtn = _ref; + }, + width: 24, }, width: 24 } ] }; - - return o.allowEdit ? content : { - type: "bi.absolute", - items: [{ - el: content, - left: 0, - right: 0, - top: 0, - bottom: 0 - }, { - el: { - type: "bi.layout" - }, - left: 0, - right: 24, - top: 0, - bottom: 0 - }] - }; }, - _initData: function() { + _initData: function () { var o = this.options; this.tree = new BI.Tree(); this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); this.tree.initTree(this.nodes); }, - _getSearchItems: function(keyword) { + _getSearchItems: function (keyword) { var self = this, o = this.options; // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 var items = []; this.tree.traverse(function (node) { var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword); - if(find.find.length > 0 || find.match.length > 0) { + if (find.find.length > 0 || find.match.length > 0) { items.push(node); return true; } @@ -151,7 +138,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return this._fillTreeStructure4Search(items, "id"); }, - _createJson: function(node, open) { + _createJson: function (node, open) { return { id: node.id, pId: node.pId, @@ -159,10 +146,10 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { value: node.value, isParent: BI.isNotEmptyArray(node.children), open: open - } + }; }, - _getChildren: function(node) { + _getChildren: function (node) { var self = this; node.children = node.children || []; var nodes = []; @@ -179,7 +166,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var result = []; var queue = []; BI.each(leaves, function (idx, node) { - queue.push({pId: node.pId}); + queue.push({ pId: node.pId }); result.push(node); result = result.concat(self._getChildren(node)); }); @@ -188,7 +175,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { pNode.open = true; - queue.push({pId: pNode.pId}); + queue.push({ pId: pNode.pId }); result.push(pNode); } } @@ -260,4 +247,4 @@ BI.MultiLayerSingleTreeTrigger.EVENT_STOP = "EVENT_STOP"; BI.MultiLayerSingleTreeTrigger.EVENT_START = "EVENT_START"; BI.MultiLayerSingleTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE"; BI.MultiLayerSingleTreeTrigger.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; -BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger); \ No newline at end of file +BI.shortcut("bi.multilayer_single_tree_trigger", BI.MultiLayerSingleTreeTrigger); diff --git a/src/widget/singletree/singletree.trigger.js b/src/widget/singletree/singletree.trigger.js index d8dd3f69c..2df5a259c 100644 --- a/src/widget/singletree/singletree.trigger.js +++ b/src/widget/singletree/singletree.trigger.js @@ -28,6 +28,7 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { items: o.items, height: o.height, warningTitle: o.warningTitle, + tipType: o.tipType, value: o.value, allowClear: o.allowClear, listeners: [ From c22d517f5d36c6a373ac9dd594ec89a8a4c8f1c9 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 10 May 2022 23:14:36 +0800 Subject: [PATCH 24/26] auto upgrade version to 2.0.20220510231427 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 557ce0550..c94be22b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220510135434", + "version": "2.0.20220510231427", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 8fa0c051f10cd8e03a3d21931f9f051f50286727 Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 11 May 2022 10:56:07 +0800 Subject: [PATCH 25/26] =?UTF-8?q?DESIGN-4103=20feat:=20=E5=A4=9A=E5=B1=82?= =?UTF-8?q?=E7=BA=A7=E4=B8=8B=E6=8B=89=E6=A0=91=E6=8F=90=E4=BE=9B=E4=B8=80?= =?UTF-8?q?=E5=A5=97=E7=94=B1=E5=BC=80=E5=8F=91=E8=80=85=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E7=9A=84=E6=A0=87=E7=BA=A2=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于多层级下拉树有同步和异步方式,无法想单选下拉框一样根据items自动判断缺失,所以交给外部手动控制了 --- src/case/trigger/trigger.text.select.js | 1 + src/less/base/combo/combo.less | 22 ++++++++++++++ .../multilayerselecttree.combo.less | 30 +++++++++++-------- .../multilayersingletree.combo.less | 29 ++++++++++-------- .../multilayerselecttree.combo.js | 15 +++++++++- .../multilayersingletree.combo.js | 14 ++++++++- src/widget/singletree/singletree.trigger.js | 1 + .../multilayerselecttree.combo.ts | 2 ++ .../multilayersingletree.combo.ts | 2 ++ 9 files changed, 88 insertions(+), 28 deletions(-) diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index a63fc4bb0..5461292c1 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -83,6 +83,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }, setTipType: function (v) { + this.options.tipType = v; this.trigger.setTipType(v); }, diff --git a/src/less/base/combo/combo.less b/src/less/base/combo/combo.less index f96f4b008..206953d4b 100644 --- a/src/less/base/combo/combo.less +++ b/src/less/base/combo/combo.less @@ -46,6 +46,28 @@ } } } + + + // 将来统一变成combo的特性 + //&.status-error { + // &.bi-border, &.bi-border-bottom { + // border-color: @border-color-negative; + // } + // + // .bi-trigger .select-text-label { + // color: @color-bi-text-error-text-trigger; + // } + //} + // + //&.status-warning { + // &.bi-border, &.bi-border-bottom { + // border-color: @border-color-warning; + // } + // + // .bi-trigger .select-text-label { + // color: @font-color-warning; + // } + //} } .bi-theme-dark { diff --git a/src/less/widget/multilayerselecttree/multilayerselecttree.combo.less b/src/less/widget/multilayerselecttree/multilayerselecttree.combo.less index ca3a79fbc..4ac60cf49 100644 --- a/src/less/widget/multilayerselecttree/multilayerselecttree.combo.less +++ b/src/less/widget/multilayerselecttree/multilayerselecttree.combo.less @@ -1,20 +1,24 @@ @import "../../index.less"; -@val: transform .3s ease; + .bi-multilayer-select-tree-combo { - & .trigger-icon-button{ - font-size: @font-size-16; - } - // 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下 - & .bi-combo.bi-combo-popup + .bi-trigger-icon-button { - & .x-icon { - .rotate(180deg); - .transition(@val); + + &.status-error { + &.bi-border, &.bi-border-bottom { + border-color: @border-color-negative; + } + + .bi-trigger .select-text-label { + color: @color-bi-text-error-text-trigger; } } - & .bi-combo + .bi-trigger-icon-button { - & .x-icon { - .rotate(0deg); - .transition(@val); + + &.status-warning { + &.bi-border, &.bi-border-bottom { + border-color: @border-color-warning; + } + + .bi-trigger .select-text-label { + color: @font-color-warning; } } } diff --git a/src/less/widget/multilayersingletree/multilayersingletree.combo.less b/src/less/widget/multilayersingletree/multilayersingletree.combo.less index af046bc74..6a1390230 100644 --- a/src/less/widget/multilayersingletree/multilayersingletree.combo.less +++ b/src/less/widget/multilayersingletree/multilayersingletree.combo.less @@ -1,20 +1,23 @@ @import "../../index.less"; -@val: transform .3s ease; + .bi-multilayer-single-tree-combo { - & .trigger-icon-button{ - font-size: @font-size-16; - } - // 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下 - & .bi-combo.bi-combo-popup + .bi-trigger-icon-button { - & .x-icon { - .rotate(180deg); - .transition(@val); + &.status-error { + &.bi-border, &.bi-border-bottom { + border-color: @border-color-negative; + } + + .bi-trigger .select-text-label { + color: @color-bi-text-error-text-trigger; } } - & .bi-combo + .bi-trigger-icon-button { - & .x-icon { - .rotate(0deg); - .transition(@val); + + &.status-warning { + &.bi-border, &.bi-border-bottom { + border-color: @border-color-warning; + } + + .bi-trigger .select-text-label { + color: @font-color-warning; } } } diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index 1613e9fbf..8230ace71 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -17,6 +17,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { allowSearchValue: false, allowInsertValue: false, isNeedAdjustWidth: true, + status: "", // "error","warning" }); }, @@ -37,7 +38,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; return { type: "bi.combo", - cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius", + cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius " + (BI.isKey(o.status) ? ("status-" + o.status) : ""), container: o.container, destroyWhenHide: o.destroyWhenHide, adjustLength: 2, @@ -205,6 +206,18 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { // do some work }, + setStatus: function (status) { + if (BI.isKey(this.options.status)) { + this.element.removeClass("status-" + this.options.status); + } + this.element.addClass("status-" + status); + this.options.status = status; + }, + + setTipType: function (v) { + this.trigger ? this.trigger.setTipType(v) : this.textTrigger.setTipType(v); + }, + populate: function (items) { this.combo.populate(items); }, diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index d0e11182f..2060eeaa6 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -77,7 +77,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; return { type: "bi.combo", - cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius", + cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-border-radius " + (BI.isKey(o.status) ? ("status-" + o.status) : ""), container: o.container, destroyWhenHide: o.destroyWhenHide, adjustLength: 2, @@ -237,6 +237,18 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return this.combo.getValue(); }, + setStatus: function (status) { + if (BI.isKey(this.options.status)) { + this.element.removeClass("status-" + this.options.status); + } + this.element.addClass("status-" + status); + this.options.status = status; + }, + + setTipType: function (v) { + this.trigger ? this.trigger.setTipType(v) : this.textTrigger.setTipType(v); + }, + populate: function (items) { this.combo.populate(items); }, diff --git a/src/widget/singletree/singletree.trigger.js b/src/widget/singletree/singletree.trigger.js index 2df5a259c..f4a4ca7df 100644 --- a/src/widget/singletree/singletree.trigger.js +++ b/src/widget/singletree/singletree.trigger.js @@ -60,6 +60,7 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }, setTipType: function (v) { + this.options.tipType = v; this.trigger.setTipType(v); }, diff --git a/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts b/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts index 1fc9e1519..6146190b8 100644 --- a/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts +++ b/typescript/widget/multilayerselecttree/multilayerselecttree.combo.ts @@ -21,4 +21,6 @@ export declare class MultiLayerSelectTreeCombo extends Widget { blur(): void; showView(): void; + + setStatus(status: "error" | "warning"): void; } diff --git a/typescript/widget/multilayersingletree/multilayersingletree.combo.ts b/typescript/widget/multilayersingletree/multilayersingletree.combo.ts index fcecc32c4..ebbf5c607 100644 --- a/typescript/widget/multilayersingletree/multilayersingletree.combo.ts +++ b/typescript/widget/multilayersingletree/multilayersingletree.combo.ts @@ -21,4 +21,6 @@ export declare class MultiLayerSingleTreeCombo extends Widget { blur(): void; showView(): void; + + setStatus(status: "error" | "warning"): void; } From 9c6649e03b87ba0ffade45d095a097285dfaf03d Mon Sep 17 00:00:00 2001 From: data Date: Wed, 11 May 2022 14:13:48 +0800 Subject: [PATCH 26/26] auto upgrade version to 2.0.20220511141337 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c94be22b7..de865fa9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220510231427", + "version": "2.0.20220511141337", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts",