UNPKG

e-virt-table

Version:

A powerful data table based on canvas. You can use it as data grid、Microsoft Excel or Google sheets. It supports virtual scroll、cell edit etc.

46 lines 1.58 kB
export default class Tooltip { constructor(ctx) { Object.defineProperty(this, "ctx", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "emptyEl", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.ctx = ctx; const { EMPTY_TEXT, EMPTY_CUSTOM_STYLE } = this.ctx.config; if (this.ctx.emptyElement) { this.emptyEl = this.ctx.emptyElement; } else { this.emptyEl = document.createElement('div'); this.emptyEl.innerText = EMPTY_TEXT; } this.emptyEl.className = 'e-virt-table-empty'; this.emptyEl.style.display = 'none'; this.ctx.containerElement.appendChild(this.emptyEl); this.ctx.on('emptyChange', ({ type, headerHeight, bodyHeight, footerHeight }) => { const top = headerHeight + (bodyHeight + footerHeight) / 2; const contentStyle = { display: type === 'empty' ? 'block' : 'none', position: 'absolute', fontSize: '14px', color: '#666', left: '50%', top: `${top}px`, transform: 'translate(-50%, -50%)', ...EMPTY_CUSTOM_STYLE, }; Object.assign(this.emptyEl.style, contentStyle); }); } destroy() { this.emptyEl.remove(); } } //# sourceMappingURL=Empty.js.map