From 43ecbf5be860485a6c3d7c9a42b9db7b09e3e7f2 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 2 Nov 2022 11:35:44 +0800 Subject: [PATCH 1/4] =?UTF-8?q?KERNEL-13158:=20context=E8=B7=B3=E8=BF=87po?= =?UTF-8?q?pup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/fix/fix.compact.js | 4 +- examples/useContext.html | 54 +++++++++++++++++++++++++-- src/widget/downlist/combo.downlist.js | 37 +++++++++--------- 3 files changed, 72 insertions(+), 23 deletions(-) diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index 6179d484b..1fdba9727 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -109,13 +109,13 @@ pushTarget(this.store); return true; } - if (this._store) { + if (this._store || this.options._store) { var store = BI.Widget.findStore(this.options.context || this._parent || this.options.element || this._context); if (store) { pushTarget(store); needPop = true; } - this.store = this._store(); + this.store = (this._store || this.options._store)(); this.store && (this.store._widget = this); needPop && popTarget(); needPop = false; diff --git a/examples/useContext.html b/examples/useContext.html index 4f91239bd..96e40628c 100644 --- a/examples/useContext.html +++ b/examples/useContext.html @@ -25,7 +25,7 @@ cssScale: 2.0 }; }, - childContext: ["text"], + childContext: ["text", "cssScale"], computed: { text: function () { @@ -41,10 +41,20 @@ }); BI.model("demo.model", Model); + var TempModel = BI.inherit(BI.Model, { + state: function () { + return { + cssScale: 1.0 + }; + }, + childContext: ["cssScale"], + }); + BI.model("demo.temp_model", TempModel); + var oldFormat = BI.pixFormat; BI.pixFormat = function (pix, border) { var context = BI.useContext("cssScale"); - if (!context) { + if (!context || context.model.cssScale <=1) { return oldFormat.apply(this, arguments); } if (!BI.isNumber(pix)) { @@ -59,8 +69,8 @@ var oldPix = BI.toPix; BI.toPix = function (pix, border) { var context = BI.useContext("cssScale"); - if (!context) { - return oldPix.apply(this, arguments); + if (!context || context.model.cssScale <=1) { + return oldFormat.apply(this, arguments); } if (!BI.isNumber(pix)) { return pix; @@ -130,6 +140,42 @@ day: 15 } } + }, { + type: "bi.down_list_combo", + cls: "bi-border", + width: 24, + height: 24, + popup: { + _store: function () { + return BI.Models.getModel("demo.temp_model"); + } + }, + value: [{value: 2}, {value: 3, childValue: 4}], + items: [[{ + text: "属于", + value: 1, + cls: "dot-e-font" + }, { + text: "不属于", + value: 2, + cls: "dot-e-font" + }], [{ + el: { + text: "大于", + value: 3, + iconCls1: "dot-e-font" + }, + value: 3, + children: [{ + text: "固定值", + value: 4, + cls: "dot-e-font" + }, { + text: "平均值", + value: 5, + cls: "dot-e-font" + }] + }]] }] }; }; diff --git a/src/widget/downlist/combo.downlist.js b/src/widget/downlist/combo.downlist.js index cf983dfc4..8b9aa4c0c 100644 --- a/src/widget/downlist/combo.downlist.js +++ b/src/widget/downlist/combo.downlist.js @@ -17,7 +17,7 @@ text: item.text, icon: item.icon, cls: item.cls, - iconCls1: item.iconCls1, + iconCls1: item.iconCls1, value: item.value }; } @@ -25,7 +25,7 @@ }); return result; } - + /** * Created by roy on 15/8/14. */ @@ -41,16 +41,17 @@ container: null, stopPropagation: false, el: {}, + popup: {}, minWidth: 140, maxHeight: 1000, destroyWhenHide: false }); }, - + _init: function () { BI.DownListCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - + this.downlistcombo = BI.createWidget({ element: this, type: "bi.combo", @@ -63,12 +64,13 @@ belowMouse: o.belowMouse, stopPropagation: o.stopPropagation, destroyWhenHide: o.destroyWhenHide, - el: BI.createWidget(o.el, { + el: { type: "bi.icon_trigger", extraCls: o.iconCls, width: o.width, - height: o.height - }), + height: o.height, + ...o.el + }, popup: { el: { type: "bi.down_list_popup", @@ -94,39 +96,40 @@ }, stopPropagation: o.stopPropagation, maxHeight: o.maxHeight, - minWidth: o.minWidth + minWidth: o.minWidth, + ...o.popup } }); - + this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW); }); }, - + hideView: function () { this.downlistcombo.hideView(); }, - + showView: function (e) { this.downlistcombo.showView(e); }, - + populate: function (items) { this.popupView.populate(items); }, - + setValue: function (v) { this.popupView.setValue(v); }, - + getValue: function () { return this.popupView.getValue(); }, - + adjustWidth: function () { this.downlistcombo.adjustWidth(); }, - + adjustHeight: function () { this.downlistcombo.adjustHeight(); } @@ -134,6 +137,6 @@ BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; - + BI.shortcut("bi.down_list_combo", BI.DownListCombo); }()); From 3c2d7e826754cc12097004c52e2051f308e93ad7 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 2 Nov 2022 11:42:40 +0800 Subject: [PATCH 2/4] =?UTF-8?q?KERNEL-13158:=20context=E8=B7=B3=E8=BF=87po?= =?UTF-8?q?pup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/useContext.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/useContext.html b/examples/useContext.html index 96e40628c..f770cd294 100644 --- a/examples/useContext.html +++ b/examples/useContext.html @@ -119,7 +119,7 @@ var child; var store = BI.useStore(); return function () { - this.element[0].style.setProperty('--css-scale', store.model.cssScale); + this.element[0].style.setProperty('--css-scale', 2); return { type: "bi.vertical", vgap: 20, From 4c54640fee1858b4da24ce0e8d4637771fb314af Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 2 Nov 2022 11:43:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?KERNEL-13158:=20context=E8=B7=B3=E8=BF=87po?= =?UTF-8?q?pup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/useContext.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/useContext.html b/examples/useContext.html index f770cd294..4092713e9 100644 --- a/examples/useContext.html +++ b/examples/useContext.html @@ -22,7 +22,7 @@ state: function () { return { expand: false, - cssScale: 2.0 + cssScale: true }; }, childContext: ["text", "cssScale"], @@ -44,7 +44,7 @@ var TempModel = BI.inherit(BI.Model, { state: function () { return { - cssScale: 1.0 + cssScale: false }; }, childContext: ["cssScale"], @@ -54,7 +54,7 @@ var oldFormat = BI.pixFormat; BI.pixFormat = function (pix, border) { var context = BI.useContext("cssScale"); - if (!context || context.model.cssScale <=1) { + if (!context || context.model.cssScale === false) { return oldFormat.apply(this, arguments); } if (!BI.isNumber(pix)) { @@ -69,7 +69,7 @@ var oldPix = BI.toPix; BI.toPix = function (pix, border) { var context = BI.useContext("cssScale"); - if (!context || context.model.cssScale <=1) { + if (!context || context.model.cssScale === false) { return oldFormat.apply(this, arguments); } if (!BI.isNumber(pix)) { From 42f63d618b9a583e1f22064a1824aa939cfc4d21 Mon Sep 17 00:00:00 2001 From: data Date: Wed, 2 Nov 2022 15:05:09 +0800 Subject: [PATCH 4/4] auto upgrade version to 2.0.20221102150501 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a8cca0fbc..e4f7bd149 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221102143540", + "version": "2.0.20221102150501", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts",