Browse Source

Pull request #3129: 无JIRA任务 feature: combo显隐规则重构下

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '95cd8d4fb8dfa78558d7bf243919dbeadd0873c7':
  feature: listeners支持传对象
  update
  update
  bi-combo-popup换一种实现
  feature: combo显隐规则重构下
es6
guy-王川 2 years ago
parent
commit
475f6c2332
  1. 12
      examples/响应式布局.html
  2. 12
      src/core/4.widget.js
  3. 6
      src/core/5.inject.js
  4. 3
      src/less/base/combo/combo.less
  5. 6
      src/less/core/utils/common.less
  6. 6
      src/less/core/wrapper/inline.less
  7. 18
      src/less/core/wrapper/inline.old.less

12
examples/响应式布局.html

@ -53,13 +53,13 @@
box-shadow: 0 2px 5px rgb(0 0 0 / 16%), 0 2px 10px rgb(0 0 0 / 12%); box-shadow: 0 2px 5px rgb(0 0 0 / 16%), 0 2px 10px rgb(0 0 0 / 12%);
} }
.nav-logo { .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-repeat: no-repeat;
background-position: 50%; background-position: 50%;
background-size: contain; background-size: contain;
} }
.image { .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-repeat: no-repeat;
background-size: contain; background-size: contain;
} }
@ -79,7 +79,7 @@
border: 1px solid #4aa4e0; border: 1px solid #4aa4e0;
} }
.wave { .wave {
background-image: url(https://qn.wangchuan.cc/wave.png); background-image: url(http://qn.wangchuan.cc/wave.png);
background-size: cover; background-size: cover;
background-repeat: repeat-x; background-repeat: repeat-x;
} }
@ -205,7 +205,7 @@
maxWidth: "100%", maxWidth: "100%",
maxHeight: "100%", maxHeight: "100%",
}, },
src: "https://qn.wangchuan.cc/hero-graphic.png", src: "http://qn.wangchuan.cc/hero-graphic.png",
width: "auto", width: "auto",
height: "auto", height: "auto",
}, },
@ -318,7 +318,7 @@
maxWidth: "100%", maxWidth: "100%",
maxHeight: "100%", maxHeight: "100%",
}, },
src: "https://qn.wangchuan.cc/velocity.png", src: "http://qn.wangchuan.cc/velocity.png",
width: "auto", width: "auto",
height: "auto", height: "auto",
}, },
@ -358,7 +358,7 @@
maxWidth: "100%", maxWidth: "100%",
maxHeight: "100%", maxHeight: "100%",
}, },
src: "https://qn.wangchuan.cc/secure.png", src: "http://qn.wangchuan.cc/secure.png",
width: "auto", width: "auto",
height: "auto", height: "auto",
}, },

12
src/core/4.widget.js

@ -308,7 +308,7 @@
}) : o.invisible; }) : o.invisible;
if (invisible) { if (invisible) {
// 用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 // 用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) { _innerSetVisible: function (visible) {
var self = this, o = this.options; var self = this, o = this.options;
var lastVisible = !o.invisible; var lastVisible = !o.invisible;
this._setVisible(visible); this._setVisible(visible);
if (visible === true) { if (visible === true) {
// 用this.element.show()会把display属性改成block // 用this.element.show()会把display属性改成block
this.element.css("display", ""); this.__setElementVisible(true);
this._mount(); this._mount();
if (o.animation && !lastVisible) { if (o.animation && !lastVisible) {
this.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active").addClass(o.animation + "-enter"); this.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active").addClass(o.animation + "-enter");
@ -552,10 +556,10 @@
} }
this._animationDuring = setTimeout(function () { this._animationDuring = setTimeout(function () {
self.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active"); self.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active");
self.element.css("display", "none"); self.__setElementVisible(false);
}, o.animationDuring); }, o.animationDuring);
} else { } else {
this.element.css("display", "none"); this.__setElementVisible(false);
} }
} }
}, },

6
src/core/5.inject.js

@ -471,12 +471,18 @@
var wType = (w.type && w.type.xtype) || w.type; var wType = (w.type && w.type.xtype) || w.type;
if (wType === elType) { if (wType === elType) {
if (BI.Plugin.hasObject(elType)) { if (BI.Plugin.hasObject(elType)) {
if (!w.listeners || BI.isArray(w.listeners)) {
w.listeners = (w.listeners || []).concat([{ w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT, eventName: BI.Events.MOUNT,
action: function () { action: function () {
BI.Plugin.getObject(elType, this); BI.Plugin.getObject(elType, this);
} }
}]); }]);
} else {
w.listeners[BI.Events.MOUNT] = function () {
BI.Plugin.getObject(elType, this);
}
}
} }
return createWidget(w, context, lazy); return createWidget(w, context, lazy);
} }

3
src/less/base/combo/combo.less

@ -12,9 +12,6 @@
} }
&.bi-combo-popup { &.bi-combo-popup {
display: block !important;
visibility: visible !important;
& > .bi-trigger { & > .bi-trigger {
& .bi-trigger-icon-button { & .bi-trigger-icon-button {
& .x-icon { & .x-icon {

6
src/less/core/utils/common.less

@ -570,7 +570,7 @@
// hover-visible的原子化形式 // hover-visible的原子化形式
.bi-hover-visible-container { .bi-hover-visible-container {
&:where(:not(&:hover)) .bi-hover-visible-item { &:where(:not(&:hover)) .bi-hover-visible-item:not(.bi-combo-popup) {
display: none; display: none;
} }
@ -591,11 +591,11 @@
// } // }
//} //}
& .bi-hover-visible-item { & .bi-hover-visible-item:not(.bi-combo-popup) {
visibility: hidden; visibility: hidden;
} }
&:hover .bi-hover-visible-item { &:hover .bi-hover-visible-item:not(.bi-combo-popup) {
visibility: visible; visibility: visible;
} }
} }

6
src/less/core/wrapper/inline.less

@ -15,10 +15,4 @@
display: inline-block !important; display: inline-block !important;
} }
} }
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
} }

18
src/less/core/wrapper/inline.old.less

@ -14,12 +14,6 @@
display: inline-block !important; display: inline-block !important;
} }
} }
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
} }
.bi-inline-horizontal-adapt-layout { .bi-inline-horizontal-adapt-layout {
@ -38,12 +32,6 @@
display: inline-block !important; display: inline-block !important;
} }
} }
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
} }
.bi-inline-vertical-adapt-layout { .bi-inline-vertical-adapt-layout {
@ -62,10 +50,4 @@
display: inline-block !important; display: inline-block !important;
} }
} }
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
} }

Loading…
Cancel
Save