Browse Source

BI-125411 fix:colorchooser 的 this 指向和 event_blur 失效

es6
Treecat 2 years ago
parent
commit
c6ab14d406
  1. 2
      packages/fineui/src/base/combination/bubble.js
  2. 5
      packages/fineui/src/bundle.js
  3. 4
      packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js
  4. 4
      packages/fineui/src/case/colorchooser/colorchooser.popup.js
  5. 5
      packages/fineui/src/core/constant/var.js
  6. 18
      packages/fineui/src/core/structure/cache.js

2
packages/fineui/src/base/combination/bubble.js

@ -506,7 +506,7 @@ export class Bubble extends Widget {
} }
_setEnable(arg) { _setEnable(arg) {
super._setEnable(arguments); super._setEnable(...arguments);
if (arg === true) { if (arg === true) {
this.element.removeClass("base-disabled disabled"); this.element.removeClass("base-disabled disabled");
} else if (arg === false) { } else if (arg === false) {

5
packages/fineui/src/bundle.js

@ -14,3 +14,8 @@ Object.assign(_global, {
}); });
Object.assign(_global.BI, fuiExport, injectFn); Object.assign(_global.BI, fuiExport, injectFn);
Object.defineProperty(_global.BI, "EVENT_BLUR", {
set: fuiExport.setEventBlur,
get: () => fuiExport.EVENT_BLUR
});

4
packages/fineui/src/case/colorchooser/colorchooser.popup.hex.js

@ -267,8 +267,8 @@ export class HexColorChooserPopup extends Widget {
type: Layout.xtype, type: Layout.xtype,
cls: "disable-mask", cls: "disable-mask",
invisible: !o.disabled, invisible: !o.disabled,
ref: () => { ref: (ref) => {
this.mask = this; this.mask = ref;
}, },
}, },
left: 0, left: 0,

4
packages/fineui/src/case/colorchooser/colorchooser.popup.js

@ -191,8 +191,8 @@ export class ColorChooserPopup extends Widget {
type: Layout.xtype, type: Layout.xtype,
cls: "disable-mask", cls: "disable-mask",
invisible: !o.disabled, invisible: !o.disabled,
ref: () => { ref: (ref) => {
this.mask = this; this.mask = ref;
}, },
}, },
left: 0, left: 0,

5
packages/fineui/src/core/constant/var.js

@ -2,11 +2,14 @@
* 常量 * 常量
*/ */
import { isNumber } from "../2.base"; import { isNumber } from "../2.base";
import { Cache } from "../structure/cache";
export let EVENT_BLUR = Cache.getItem("event.blur", {typeConversion: true, defaultValue: true});
export const setEventBlur = (v) => { EVENT_BLUR = v, Cache.setItem("event.blur", v) };
export const MAX = 0xfffffffffffffff; export const MAX = 0xfffffffffffffff;
export const MIN = -0xfffffffffffffff; export const MIN = -0xfffffffffffffff;
export const EVENT_RESPONSE_TIME = 200; export const EVENT_RESPONSE_TIME = 200;
export const EVENT_BLUR = true;
export const zIndex_layer = 1e5; export const zIndex_layer = 1e5;
export const zIndex_popover = 1e6; export const zIndex_popover = 1e6;
export const zIndex_popup = 1e7; export const zIndex_popup = 1e7;

18
packages/fineui/src/core/structure/cache.js

@ -12,8 +12,22 @@ export const Cache = {
_generateKey: function (key) { _generateKey: function (key) {
return Cache._getKeyPrefix() + (key || ""); return Cache._getKeyPrefix() + (key || "");
}, },
getItem: function (key) { getItem: function (key, opt = {}) {
return localStorage.getItem(Cache._generateKey(key)); const { defaultValue, typeConversion } = opt;
const storageKey = Cache._generateKey(key);
let value = localStorage.getItem(storageKey);
if (value !== null && typeConversion) {
if (value === "true") {
value = true;
} else if (value === "false") {
value = false;
} else if (Number.isNaN(Number(value))) {
value = Number(value);
}
}
return value !== null ? value : defaultValue;
}, },
setItem: function (key, value) { setItem: function (key, value) {
localStorage.setItem(Cache._generateKey(key), value); localStorage.setItem(Cache._generateKey(key), value);

Loading…
Cancel
Save