From c09ea7d0ee7ff71308c00395266b40234ba4966d Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 10:28:14 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feature:=20combo=E6=98=BE=E9=9A=90=E8=A7=84?= =?UTF-8?q?=E5=88=99=E9=87=8D=E6=9E=84=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/combo.js | 5 +++++ src/core/4.widget.js | 12 ++++++++---- src/less/base/combo/combo.less | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 7abbf77eb..8d2849ad6 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -48,6 +48,11 @@ }); }, + // 复写visual相关代码,让其通过class实现显隐藏 + __setElementVisible: function (visible) { + this.element[visible ? "removeClass" : "addClass"]("bi-combo-hidden"); + }, + render: function () { var self = this, o = this.options; this._initCombo(); diff --git a/src/core/4.widget.js b/src/core/4.widget.js index 5af118dd5..49c1238cc 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -308,7 +308,7 @@ }) : o.invisible; if (invisible) { // 用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 - this.element.css("display", "none"); + this.__setElementVisible(false); } } }, @@ -513,13 +513,17 @@ } }, + __setElementVisible: function (visible) { + this.element.css("display", visible ? "" : "none"); + }, + _innerSetVisible: function (visible) { var self = this, o = this.options; var lastVisible = !o.invisible; this._setVisible(visible); if (visible === true) { // 用this.element.show()会把display属性改成block - this.element.css("display", ""); + this.__setElementVisible(true); this._mount(); if (o.animation && !lastVisible) { this.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active").addClass(o.animation + "-enter"); @@ -552,10 +556,10 @@ } this._animationDuring = setTimeout(function () { self.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active"); - self.element.css("display", "none"); + self.__setElementVisible(false); }, o.animationDuring); } else { - this.element.css("display", "none"); + this.__setElementVisible(false); } } }, diff --git a/src/less/base/combo/combo.less b/src/less/base/combo/combo.less index 206953d4b..3ebed47bc 100644 --- a/src/less/base/combo/combo.less +++ b/src/less/base/combo/combo.less @@ -12,9 +12,6 @@ } &.bi-combo-popup { - display: block !important; - visibility: visible !important; - & > .bi-trigger { & .bi-trigger-icon-button { & .x-icon { @@ -24,6 +21,9 @@ } } } + &.bi-combo-hidden:not(.bi-combo-popup) { + display: none !important; + } &.bi-combo-popup, &.bi-combo-hover, &:hover { &.bi-border, &.bi-border-bottom { From 2ec1bd2ce6f77181fe3f3febe1cc07a25c96eb8a Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 11:29:10 +0800 Subject: [PATCH 2/5] =?UTF-8?q?bi-combo-popup=E6=8D=A2=E4=B8=80=E7=A7=8D?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/响应式布局.html | 12 ++++++------ src/base/combination/combo.js | 5 ----- src/less/core/utils/common.less | 6 +++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/响应式布局.html b/examples/响应式布局.html index b0148d2b4..72a71951f 100644 --- a/examples/响应式布局.html +++ b/examples/响应式布局.html @@ -53,13 +53,13 @@ box-shadow: 0 2px 5px rgb(0 0 0 / 16%), 0 2px 10px rgb(0 0 0 / 12%); } .nav-logo { - background-image: url(https://qn.wangchuan.cc/pullrequest-logo.svg); + background-image: url(http://qn.wangchuan.cc/pullrequest-logo.svg); background-repeat: no-repeat; background-position: 50%; background-size: contain; } .image { - background-image: url(https://qn.wangchuan.cc/hero-graphic.png); + background-image: url(http://qn.wangchuan.cc/hero-graphic.png); background-repeat: no-repeat; background-size: contain; } @@ -79,7 +79,7 @@ border: 1px solid #4aa4e0; } .wave { - background-image: url(https://qn.wangchuan.cc/wave.png); + background-image: url(http://qn.wangchuan.cc/wave.png); background-size: cover; background-repeat: repeat-x; } @@ -205,7 +205,7 @@ maxWidth: "100%", maxHeight: "100%", }, - src: "https://qn.wangchuan.cc/hero-graphic.png", + src: "http://qn.wangchuan.cc/hero-graphic.png", width: "auto", height: "auto", }, @@ -318,7 +318,7 @@ maxWidth: "100%", maxHeight: "100%", }, - src: "https://qn.wangchuan.cc/velocity.png", + src: "http://qn.wangchuan.cc/velocity.png", width: "auto", height: "auto", }, @@ -358,7 +358,7 @@ maxWidth: "100%", maxHeight: "100%", }, - src: "https://qn.wangchuan.cc/secure.png", + src: "http://qn.wangchuan.cc/secure.png", width: "auto", height: "auto", }, diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 8d2849ad6..7abbf77eb 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -48,11 +48,6 @@ }); }, - // 复写visual相关代码,让其通过class实现显隐藏 - __setElementVisible: function (visible) { - this.element[visible ? "removeClass" : "addClass"]("bi-combo-hidden"); - }, - render: function () { var self = this, o = this.options; this._initCombo(); diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less index 0a0b0e53b..d4b0d3bcd 100644 --- a/src/less/core/utils/common.less +++ b/src/less/core/utils/common.less @@ -570,7 +570,7 @@ // hover-visible的原子化形式 .bi-hover-visible-container { - &:where(:not(&:hover)) .bi-hover-visible-item { + &:where(:not(&:hover)) .bi-hover-visible-item:not(.bi-combo-popup) { display: none; } @@ -591,11 +591,11 @@ // } //} - & .bi-hover-visible-item { + & .bi-hover-visible-item:not(.bi-combo-popup) { visibility: hidden; } - &:hover .bi-hover-visible-item { + &:hover .bi-hover-visible-item:not(.bi-combo-popup) { visibility: visible; } } From 67c70cf144480c6727c050d514c35133c73383ab Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 11:30:24 +0800 Subject: [PATCH 3/5] update --- src/less/base/combo/combo.less | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/less/base/combo/combo.less b/src/less/base/combo/combo.less index 3ebed47bc..b6e9d2e00 100644 --- a/src/less/base/combo/combo.less +++ b/src/less/base/combo/combo.less @@ -21,9 +21,6 @@ } } } - &.bi-combo-hidden:not(.bi-combo-popup) { - display: none !important; - } &.bi-combo-popup, &.bi-combo-hover, &:hover { &.bi-border, &.bi-border-bottom { From e7a5e07081010eaa797d200ca5d9f98214a0a555 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 11:34:37 +0800 Subject: [PATCH 4/5] update --- src/less/core/wrapper/inline.less | 6 ------ src/less/core/wrapper/inline.old.less | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/src/less/core/wrapper/inline.less b/src/less/core/wrapper/inline.less index f87f98c8a..804586e81 100644 --- a/src/less/core/wrapper/inline.less +++ b/src/less/core/wrapper/inline.less @@ -15,10 +15,4 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } diff --git a/src/less/core/wrapper/inline.old.less b/src/less/core/wrapper/inline.old.less index 6d6b1b4a5..8c9ef9584 100644 --- a/src/less/core/wrapper/inline.old.less +++ b/src/less/core/wrapper/inline.old.less @@ -14,12 +14,6 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } .bi-inline-horizontal-adapt-layout { @@ -38,12 +32,6 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } .bi-inline-vertical-adapt-layout { @@ -62,10 +50,4 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } From 5dd22609b56e171e9595a40a8f5d89b4fad7c629 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 14:58:53 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feature:=20listeners=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BC=A0=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/5.inject.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/5.inject.js b/src/core/5.inject.js index 0554740f7..5e2cb0a72 100644 --- a/src/core/5.inject.js +++ b/src/core/5.inject.js @@ -449,7 +449,7 @@ } else if (item.el && (item.el.type || options.type)) { el = BI.extend({}, options, item.el); } - + if (el) { var elType = (el.type && el.type.xtype) || el.type; runConfigFunction(elType); @@ -471,12 +471,18 @@ var wType = (w.type && w.type.xtype) || w.type; if (wType === elType) { if (BI.Plugin.hasObject(elType)) { - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { + if (!w.listeners || BI.isArray(w.listeners)) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(elType, this); + } + }]); + } else { + w.listeners[BI.Events.MOUNT] = function () { BI.Plugin.getObject(elType, this); } - }]); + } } return createWidget(w, context, lazy); }