fix: issue while using ui.min.js
with requireJs
fix: clear `enabledDict` after `init` fix: set `display: none` after tooltip holder disappeared
This commit is contained in:
@ -16,7 +16,7 @@ import { GridColumn, GridInputColumn, GridTextColumn, GridDropdownColumn, GridCh
|
|||||||
* @version 1.0.2
|
* @version 1.0.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const ScriptPath = (self.document == null ? self.location.href : self.document.currentScript.src).replace(/ui\.min\.js\?.+$/, '');
|
const ScriptPath = (self.document == null ? self.location.href : self.document.currentScript?.src ?? '').replace(/ui\.min\.js\?.+$/, '');
|
||||||
const Encoder = new TextEncoder('utf-8');
|
const Encoder = new TextEncoder('utf-8');
|
||||||
|
|
||||||
const ColumnChangedType = {
|
const ColumnChangedType = {
|
||||||
@ -612,7 +612,7 @@ export class Grid {
|
|||||||
* @type {KeyMap<string | boolean>}
|
* @type {KeyMap<string | boolean>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
enabledDict: {},
|
enabledDict: null,
|
||||||
/**
|
/**
|
||||||
* 合计行数据
|
* 合计行数据
|
||||||
* @type {GridRowItem}
|
* @type {GridRowItem}
|
||||||
@ -752,6 +752,12 @@ export class Grid {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
needResize: null,
|
needResize: null,
|
||||||
|
/**
|
||||||
|
* 提示条消失的 Timer
|
||||||
|
* @type {number}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
tooltipTimer: null,
|
||||||
/**
|
/**
|
||||||
* 页面元素引用
|
* 页面元素引用
|
||||||
* @private
|
* @private
|
||||||
@ -1331,6 +1337,7 @@ export class Grid {
|
|||||||
this._var.rendering = true;
|
this._var.rendering = true;
|
||||||
this._var.parent = container;
|
this._var.parent = container;
|
||||||
this._var.isFirefox = /Firefox\//i.test(navigator.userAgent);
|
this._var.isFirefox = /Firefox\//i.test(navigator.userAgent);
|
||||||
|
this._var.enabledDict = {};
|
||||||
const grid = createElement('div', 'ui-grid');
|
const grid = createElement('div', 'ui-grid');
|
||||||
grid.setAttribute('tabindex', 0);
|
grid.setAttribute('tabindex', 0);
|
||||||
grid.addEventListener('keydown', e => {
|
grid.addEventListener('keydown', e => {
|
||||||
@ -1418,6 +1425,7 @@ export class Grid {
|
|||||||
const col = Number(holder.dataset.col);
|
const col = Number(holder.dataset.col);
|
||||||
if (holder.classList.contains('active')) {
|
if (holder.classList.contains('active')) {
|
||||||
holder.classList.remove('active');
|
holder.classList.remove('active');
|
||||||
|
this._clearHolder(holder);
|
||||||
}
|
}
|
||||||
return this._onRowClicked(e, row, col);
|
return this._onRowClicked(e, row, col);
|
||||||
});
|
});
|
||||||
@ -3896,6 +3904,22 @@ export class Grid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除 tooltip 显示框,并延时后设置 `display: none`
|
||||||
|
* 不设置 display 的话会导致元素依然被算入滚动范围,从而影响滚动条显示
|
||||||
|
* @private
|
||||||
|
* @param {HTMLDivElement} holder
|
||||||
|
*/
|
||||||
|
_clearHolder(holder) {
|
||||||
|
if (this._var.tooltipTimer != null) {
|
||||||
|
clearTimeout(this._var.tooltipTimer);
|
||||||
|
}
|
||||||
|
this._var.tooltipTimer = setTimeout(() => {
|
||||||
|
holder.style.display = 'none';
|
||||||
|
this._var.tooltipTimer = null;
|
||||||
|
}, 120);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @param {MouseEvent} e
|
* @param {MouseEvent} e
|
||||||
@ -3912,6 +3936,7 @@ export class Grid {
|
|||||||
delete holder.dataset.col;
|
delete holder.dataset.col;
|
||||||
if (holder.classList.contains('active')) {
|
if (holder.classList.contains('active')) {
|
||||||
holder.classList.remove('active');
|
holder.classList.remove('active');
|
||||||
|
this._clearHolder(holder);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3931,6 +3956,7 @@ export class Grid {
|
|||||||
delete holder.dataset.col;
|
delete holder.dataset.col;
|
||||||
if (holder.classList.contains('active')) {
|
if (holder.classList.contains('active')) {
|
||||||
holder.classList.remove('active');
|
holder.classList.remove('active');
|
||||||
|
this._clearHolder(holder);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3943,6 +3969,7 @@ export class Grid {
|
|||||||
delete holder.dataset.row;
|
delete holder.dataset.row;
|
||||||
delete holder.dataset.col;
|
delete holder.dataset.col;
|
||||||
holder.classList.remove('active');
|
holder.classList.remove('active');
|
||||||
|
this._clearHolder(holder);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3968,6 +3995,7 @@ export class Grid {
|
|||||||
delete holder.dataset.row;
|
delete holder.dataset.row;
|
||||||
delete holder.dataset.col;
|
delete holder.dataset.col;
|
||||||
holder.classList.remove('active');
|
holder.classList.remove('active');
|
||||||
|
this._clearHolder(holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user