Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~dailer/fineui

es6
zsmj 2 years ago
parent
commit
3950eafef5
  1. 1
      demo/less/main.less
  2. 2
      package.json
  3. 19
      src/base/single/0.single.js
  4. 24
      src/core/3.ob.js
  5. 6
      src/core/4.widget.js

1
demo/less/main.less

@ -63,6 +63,7 @@ body {
right: 0; right: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
font-size: 1.2rem;
} }
.bi-theme-dark body { .bi-theme-dark body {

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20221014104548", "version": "2.0.20221017122609",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

19
src/base/single/0.single.js

@ -67,6 +67,10 @@ BI.Single = BI.inherit(BI.Widget, {
self.setValue(newValue); self.setValue(newValue);
}) : o.value; }) : o.value;
BI.Single.superclass._init.apply(this, arguments); BI.Single.superclass._init.apply(this, arguments);
},
_mounted: function () {
var o = this.options;
if (o.enableHover || BI.isKey(o.title) || BI.isKey(o.warningTitle) if (o.enableHover || BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover({ this.enableHover({
@ -91,7 +95,7 @@ BI.Single = BI.inherit(BI.Widget, {
opt || (opt = {}); opt || (opt = {});
var self = this; var self = this;
if (!this._hoverBinded) { if (!this._hoverBinded) {
this.element.on("mouseenter.title" + this.getName(), function (e) { this.element.unbind("mouseenter.title").on("mouseenter.title", function (e) {
self._e = e; self._e = e;
if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) {
delayingTooltips = self.getName(); delayingTooltips = self.getName();
@ -109,7 +113,7 @@ BI.Single = BI.inherit(BI.Widget, {
}, 500); }, 500);
} }
}); });
this.element.on("mousemove.title" + this.getName(), function (e) { this.element.unbind("mousemove.title").on("mousemove.title", function (e) {
self._e = e; self._e = e;
if (BI.isNotNull(self.showTimeout)) { if (BI.isNotNull(self.showTimeout)) {
clearTimeout(self.showTimeout); clearTimeout(self.showTimeout);
@ -138,7 +142,7 @@ BI.Single = BI.inherit(BI.Widget, {
} }
}, 500); }, 500);
}); });
this.element.on("mouseleave.title" + this.getName(), function (e) { this.element.unbind("mouseleave.title").on("mouseleave.title", function (e) {
self._e = null; self._e = null;
self._clearTimeOut(); self._clearTimeOut();
self._hideTooltip(); self._hideTooltip();
@ -151,9 +155,9 @@ BI.Single = BI.inherit(BI.Widget, {
// 取消hover事件 // 取消hover事件
this._clearTimeOut(); this._clearTimeOut();
this._hideTooltip(); this._hideTooltip();
this.element.unbind("mouseenter.title" + this.getName()) this.element.unbind("mouseenter.title")
.unbind("mousemove.title" + this.getName()) .unbind("mousemove.title")
.unbind("mouseleave.title" + this.getName()); .unbind("mouseleave.title");
this._hoverBinded = false; this._hoverBinded = false;
}, },
@ -217,8 +221,7 @@ BI.Single = BI.inherit(BI.Widget, {
return this.options.value; return this.options.value;
}, },
__d: function () { _destroyed: function () {
BI.Single.superclass.__d.call(this);
if (BI.isNotNull(this.showTimeout)) { if (BI.isNotNull(this.showTimeout)) {
clearTimeout(this.showTimeout); clearTimeout(this.showTimeout);
this.showTimeout = null; this.showTimeout = null;

24
src/core/3.ob.js

@ -79,23 +79,25 @@
// 获得一个当前对象的引用 // 获得一个当前对象的引用
_initRef: function () { _initRef: function () {
if (this.options.__ref) { var o = this.options;
this.options.__ref.call(this, this); if (o.__ref) {
BI.isFunction(o.__ref) ? o.__ref.call(this, this) : o.__ref.current = this;
} }
if (this.options.ref) { if (o.ref) {
this.options.ref.call(this, this); BI.isFunction(o.ref) ? o.ref.call(this, this) : o.ref.current = this;
} }
}, },
//释放当前对象 //释放当前对象
_purgeRef: function () { _purgeRef: function () {
if (this.options.__ref) { var o = this.options;
this.options.__ref.call(null, null); if (o.__ref) {
this.options.__ref = null; BI.isFunction(o.__ref) ? o.__ref.call(null, null) : o.__ref.current = null;
} o.__ref = null;
if (this.options.ref) { }
this.options.ref.call(null, null); if (o.ref) {
this.options.ref = null; BI.isFunction(o.ref) ? o.ref.call(null, null) : o.ref.current = null;
o.ref = null;
} }
}, },

6
src/core/4.widget.js

@ -97,6 +97,8 @@
beforeMount: null, beforeMount: null,
mounted: null, mounted: null,
// 不想重写mounted时用
_mounted: null,
shouldUpdate: null, shouldUpdate: null,
@ -109,6 +111,8 @@
beforeDestroy: null, beforeDestroy: null,
destroyed: null, destroyed: null,
// 不想重写destroyed时用
_destroyed: null,
_init: function () { _init: function () {
BI.Widget.superclass._init.apply(this, arguments); BI.Widget.superclass._init.apply(this, arguments);
@ -429,6 +433,7 @@
child.__afterMount && child.__afterMount(lifeHook, predicate); child.__afterMount && child.__afterMount(lifeHook, predicate);
} }
if (lifeHook !== false && !this.__async) { if (lifeHook !== false && !this.__async) {
callLifeHook(this, "_mounted");
callLifeHook(this, "mounted"); callLifeHook(this, "mounted");
this.fireEvent(BI.Events.MOUNT); this.fireEvent(BI.Events.MOUNT);
} }
@ -736,6 +741,7 @@
this.__d(); this.__d();
this._parent = null; this._parent = null;
this._isMounted = false; this._isMounted = false;
callLifeHook(this, "_destroyed");
callLifeHook(this, "destroyed"); callLifeHook(this, "destroyed");
this.destroyed = null; this.destroyed = null;
this._isDestroyed = true; this._isDestroyed = true;

Loading…
Cancel
Save