Browse Source

Pull request #2915: BI-109153 feat: bi工程内,因为禁用而置灰的按钮, 对应的tooltip要改为正常底色

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

* commit '772663ba8a9ba34cd72103dc3d70ba0a04b61652':
  无JIRA 解决一下single嵌套导致的tooltip一闪的问题.
  update ts
  BI-109153 feat: bi工程内,因为禁用而置灰的按钮, 对应的tooltip要改为正常底色
es6
Dailer 3 years ago
parent
commit
87bc4da806
  1. 11
      src/base/single/0.single.js
  2. 8
      typescript/core/base.ts

11
src/base/single/0.single.js

@ -9,6 +9,9 @@
* @extends BI.Widget * @extends BI.Widget
* @abstract * @abstract
*/ */
var delayingTooltips;
BI.Single = BI.inherit(BI.Widget, { BI.Single = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); var conf = BI.Single.superclass._defaultConfig.apply(this, arguments);
@ -30,7 +33,7 @@ BI.Single = BI.inherit(BI.Widget, {
if (BI.isPlainObject(title)) { if (BI.isPlainObject(title)) {
tooltipOpt = title; tooltipOpt = title;
} else { } else {
tooltipOpt.level = this.getTipType() || (this.isEnabled() ? "success" : "warning"); tooltipOpt.level = this.getTipType() || "success";
tooltipOpt.text = tooltipOpt.level === "success" ? title : (this.getWarningTitle() || title); tooltipOpt.text = tooltipOpt.level === "success" ? title : (this.getWarningTitle() || title);
} }
if (BI.isKey(tooltipOpt.text)) { if (BI.isKey(tooltipOpt.text)) {
@ -85,14 +88,16 @@ BI.Single = BI.inherit(BI.Widget, {
this.element.on("mouseenter.title" + this.getName(), function (e) { this.element.on("mouseenter.title" + this.getName(), 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();
self.showTimeout = BI.delay(function () { self.showTimeout = BI.delay(function () {
if (BI.isNotNull(self.showTimeout)) { if (BI.isNotNull(self.showTimeout) && delayingTooltips === self.getName()) {
self._showToolTip(self._e || e, opt); self._showToolTip(self._e || e, opt);
} }
}, 200); }, 200);
} else if (self.getTipType() === "success" || self.isEnabled()) { } else if (self.getTipType() === "success" || self.isEnabled()) {
delayingTooltips = self.getName();
self.showTimeout = BI.delay(function () { self.showTimeout = BI.delay(function () {
if (BI.isNotNull(self.showTimeout)) { if (BI.isNotNull(self.showTimeout) && delayingTooltips === self.getName()) {
self._showToolTip(self._e || e, opt); self._showToolTip(self._e || e, opt);
} }
}, 500); }, 500);

8
typescript/core/base.ts

@ -1,7 +1,7 @@
import { _Widget } from "./widget"; import { _Widget } from "./widget";
export interface _base { export interface _base {
assert: (v: any, is: Function) => Boolean assert: (v: any, is: Function) => Boolean;
warn: (message: any) => Boolean; warn: (message: any) => Boolean;
@ -15,7 +15,7 @@ export interface _base {
packageItems: (items: any[], layouts: any[]) => any[]; packageItems: (items: any[], layouts: any[]) => any[];
formatEL: <T>(obj: T) => {el: T} | T formatEL: <T>(obj: T) => { el: T } | T;
stripEL: <T>(obj: { el: T } | T) => T; stripEL: <T>(obj: { el: T } | T) => T;
@ -263,7 +263,7 @@ export interface _base {
deepClone: <T>(obj: T) => T; deepClone: <T>(obj: T) => T;
deepExtend: merge['deepExtend']; deepExtend: merge["deepExtend"];
isDeepMatch: (object: any, attrs: any) => boolean; isDeepMatch: (object: any, attrs: any) => boolean;
@ -307,7 +307,7 @@ export interface _base {
wrap: (value: any, wrapper: Function) => Function; wrap: (value: any, wrapper: Function) => Function;
nextTick: (func: Function) => Promise<any>; nextTick: (func?: Function) => Promise<any>;
random: (min?: number, max?: number, floating?: boolean) => number; random: (min?: number, max?: number, floating?: boolean) => number;

Loading…
Cancel
Save