From c00763e9af107d28018aea6b5f38e8508eba2a90 Mon Sep 17 00:00:00 2001 From: data Date: Thu, 8 Sep 2022 11:25:25 +0800 Subject: [PATCH 1/8] auto upgrade version to 2.0.20220908112504 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 218bbd018..7a397e94d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220908094558", + "version": "2.0.20220908112504", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 1b1832c843d8ed007c432bdf55e359ed57753354 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 9 Sep 2022 14:33:15 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=8D=95=E9=80=89=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=94=AF=E6=8C=81=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combo/textvaluecombo/combo.textvalue.js | 23 +++++++++++++++++-- .../combo/textvaluecombo/popup.textvalue.js | 2 +- src/case/trigger/trigger.text.select.js | 4 ++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index d6c80ac95..f027474dd 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -72,6 +72,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { } ], }; + let changeTag = false; const popup = { type: "bi.text_value_combo_popup", ref: ref => this.popup = ref, @@ -81,9 +82,12 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { { eventName: BI.TextValueComboPopup.EVENT_CHANGE, action: (...args) => { + changeTag = true; this.setValue(this.popup.getValue()); - this.combo.hideView(); - this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); + if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) { + this.combo.hideView(); + this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); + } } }, { eventName: BI.Controller.EVENT_CHANGE, @@ -101,6 +105,21 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { direction: o.direction, adjustLength: 2, el: trigger, + listeners: [ + { + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: (...args) => { + changeTag = false; + } + }, { + eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, + action: (...args) => { + if (changeTag) { + this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); + } + } + } + ], popup: { el: popup, value: o.value, diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js index 6702f8bfa..1876c9a55 100644 --- a/src/case/combo/textvaluecombo/popup.textvalue.js +++ b/src/case/combo/textvaluecombo/popup.textvalue.js @@ -39,7 +39,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { var o = this.options; return BI.map(items, function (i, item) { return BI.extend({ - type: "bi.single_select_item", + type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item", textAlign: o.textAlign, title: item.title || item.text }, item); diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index 3be2d7757..c6c1b3923 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -52,7 +52,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { _digest: function (val, items) { var o = this.options; - val = BI.isArray(val) ? val[0] : val; + val = BI.isArray(val) ? val : [val]; // 提升valueFormatter的优先级 if (o.valueFormatter !== BI.emptyFn && BI.isFunction(o.valueFormatter)) { @@ -65,7 +65,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { var formatItems = BI.Tree.transformToArrayFormat(items); BI.each(formatItems, function (i, item) { - if (val === item.value && !BI.contains(result, item.text || item.value)) { + if (BI.contains(val, item.value) && !BI.contains(result, item.text || item.value)) { result.push(item.text || item.value); } }); From db90ce4cbbc6b006ad31d788bf07ee4df472c572 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 9 Sep 2022 14:50:27 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=AF=8F=E6=AC=A1unmount=E9=83=BDassertMou?= =?UTF-8?q?nt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/4.widget.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/4.widget.js b/src/core/4.widget.js index df560dc24..957ae836f 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -743,6 +743,7 @@ }, _unMount: function () { + this._assetMounted(); this.__destroy(); this.fireEvent(BI.Events.UNMOUNT); this.purgeListeners(); From c72e1d0745c9ff7f0dcecc9569f465a865500495 Mon Sep 17 00:00:00 2001 From: data Date: Fri, 9 Sep 2022 14:58:08 +0800 Subject: [PATCH 4/8] auto upgrade version to 2.0.20220909145748 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a397e94d..13a511348 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220908112504", + "version": "2.0.20220909145748", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From d2b147876e3b4df55e42a6a3005cd747ec77359e Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 9 Sep 2022 15:51:00 +0800 Subject: [PATCH 5/8] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combo/textvaluecombo/combo.textvalue.js | 8 +- .../textvaluecombo/combo.textvaluesmall.js | 74 +++++++------------ 2 files changed, 31 insertions(+), 51 deletions(-) diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index f027474dd..022739fb3 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -13,6 +13,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { text: "", value: "", defaultText: "", + el: {}, allowClear: false, status: "success", // success | warning | error, title: null, @@ -71,6 +72,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { } } ], + ...o.el }; let changeTag = false; const popup = { @@ -150,11 +152,9 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { var vals = BI.isArray(v) ? v : [v]; - var result = BI.find(this.options.items, function (idx, item) { - return BI.contains(vals, item.value); - }); + var result = BI.intersection(BI.map(this.options.items, (i, item) => item.value), vals); - if (BI.isNull(result)) { + if (result.length !== vals.length) { this.setStatus("error"); } else { this.setStatus("success"); diff --git a/src/case/combo/textvaluecombo/combo.textvaluesmall.js b/src/case/combo/textvaluecombo/combo.textvaluesmall.js index b6609544b..155b124ce 100644 --- a/src/case/combo/textvaluecombo/combo.textvaluesmall.js +++ b/src/case/combo/textvaluecombo/combo.textvaluesmall.js @@ -15,65 +15,45 @@ BI.SmallTextValueCombo = BI.inherit(BI.Widget, { }); }, - _init: function () { - var self = this, o = this.options; - o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) { - self.setValue(newValue); - }) : o.value; - o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { - self.populate(newValue); - }) : o.items; - BI.SmallTextValueCombo.superclass._init.apply(this, arguments); - this.trigger = BI.createWidget(o.el, { - type: "bi.small_select_text_trigger", - items: o.items, + render: function () { + var o = this.options; + return { + type: "bi.text_value_combo", + ref: (_ref) => { + this.combo = _ref; + }, height: o.height, - text: o.text - }); - this.popup = BI.createWidget({ - type: "bi.text_value_combo_popup", chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextValueCombo.hideView(); - self.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextValueCombo = BI.createWidget({ - type: "bi.combo", - element: this, - container: o.container, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 240, - minHeight: 25 - } - }); - - if(BI.isKey(o.value)){ - this.setValue(o.value); + el: { + type: "bi.small_select_text_trigger", + ...o.el + }, + text: o.text, + value: o.value, + defaultText: o.defaultText, + allowClear: o.allowClear, + status: o.status, + title: o.title, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: (...args) => { + this.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE, ...args); + } + }] } }, setValue: function (v) { - this.trigger.setValue(v); - this.popup.setValue(v); + this.combo.setValue(v); }, getValue: function () { - return this.popup.getValue(); + return this.combo.getValue(); }, populate: function (items) { - this.options.items = items; - this.SmallTextValueCombo.populate(items); + this.combo.populate(items); } }); BI.SmallTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo); \ No newline at end of file +BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo); From 54a714526b0fcfc4707ec2e762cc82750dadba7f Mon Sep 17 00:00:00 2001 From: data Date: Fri, 9 Sep 2022 16:16:10 +0800 Subject: [PATCH 6/8] auto upgrade version to 2.0.20220909161557 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13a511348..9a2b8725a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220909145748", + "version": "2.0.20220909161557", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 4c7abdc0a45bd514d174d0a2d772ab34ac9322eb Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 9 Sep 2022 17:43:55 +0800 Subject: [PATCH 7/8] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/combo/textvaluecombo/combo.textvalue.js | 2 +- src/case/trigger/trigger.text.select.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index 022739fb3..7637773f2 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -133,7 +133,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { mounted: function () { const o = this.options; - if (BI.isKey(o.value)) { + if (BI.isKey(o.value) || BI.isObject(o.value)) { this._checkError(o.value); } }, diff --git a/src/case/trigger/trigger.text.select.js b/src/case/trigger/trigger.text.select.js index c6c1b3923..dd7849115 100644 --- a/src/case/trigger/trigger.text.select.js +++ b/src/case/trigger/trigger.text.select.js @@ -67,10 +67,11 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { BI.each(formatItems, function (i, item) { if (BI.contains(val, item.value) && !BI.contains(result, item.text || item.value)) { result.push(item.text || item.value); + BI.remove(val, item.value); } }); - if (result.length > 0) { + if (result.length > 0 && val.length === 0) { return { textCls: "", text: result.join(","), From 9cf08a64453029ad070f6c258d39aef3faf181dc Mon Sep 17 00:00:00 2001 From: data Date: Fri, 9 Sep 2022 18:07:22 +0800 Subject: [PATCH 8/8] auto upgrade version to 2.0.20220909180703 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9a2b8725a..c9e5f1955 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220909161557", + "version": "2.0.20220909180703", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts",