@visactor/vtable 1.3.0 → 1.3.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/tooltip/TooltipHandler.js +1 -3
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js +7 -3
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +12 -4
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/themes/theme.js +6 -0
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/ts-types/icon.d.ts +2 -0
- package/cjs/ts-types/icon.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +2 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/ts-types/tooltip.d.ts +2 -0
- package/cjs/ts-types/tooltip.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +45 -8
- package/dist/vtable.min.js +2 -2
- package/es/components/tooltip/TooltipHandler.js +1 -3
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElement.js +7 -3
- package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +2 -2
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +12 -4
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/themes/theme.js +6 -0
- package/es/themes/theme.js.map +1 -1
- package/es/ts-types/icon.d.ts +2 -0
- package/es/ts-types/icon.js.map +1 -1
- package/es/ts-types/theme.d.ts +2 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/ts-types/tooltip.d.ts +2 -0
- package/es/ts-types/tooltip.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
|
@@ -99,9 +99,7 @@ class TooltipHandler {
|
|
|
99
99
|
rect: rect
|
|
100
100
|
},
|
|
101
101
|
disappearDelay: null !== (_a = table.internalProps.tooltip.overflowTextTooltipDisappearDelay) && void 0 !== _a ? _a : 0,
|
|
102
|
-
style:
|
|
103
|
-
arrowMark: !1
|
|
104
|
-
}
|
|
102
|
+
style: table.theme.tooltipStyle
|
|
105
103
|
};
|
|
106
104
|
} else if (null === (_b = table.internalProps.tooltip) || void 0 === _b ? void 0 : _b.isShowOverflowTextTooltip) {
|
|
107
105
|
const overflowText = table.getCellOverflowText(col, row), rect = table.getCellRangeRelativeRect({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tooltip/TooltipHandler.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAE3C,uCAA0C;AAC1C,+CAAiD;AACjD,2CAA4C;AAG5C,kEAA+D;AAE/D,MAAM,wBAAwB,GAAG;IAI/B,gBAAgB,EAAE,UAAU,KAAmB;QAC7C,OAAO,IAAI,uBAAa,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF,CAAC;AAOF,MAAa,cAAc;IAKzB,YAAY,KAAmB,EAAE,OAAgB;QAC/C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CA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AAC,MAAM;wBAC3B,IAAI;qBACL;oBACD,cAAc,EAAE,MAAA,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,iCAAiC,mCAAI,CAAC;oBAClF,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY;iBAChC,CAAC;aACH;SACF;QACD,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;SAC3C;aAAM;YACL,IAAI,CAAC,eAAe,EAAE,CAAC;SACxB;IACH,CAAC;IACD,uBAAuB,CAAC,GAAW,EAAE,GAAW;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAKhD,MAAM,WAAW,GAAG,gBAAgB,CAAC;QAErC,MAAM,QAAQ,GACZ,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACnD,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvG,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,QAAQ,CAAC,cAA8B;;QACrC,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAA,IAAI,CAAC,WAAW,0CAAE,cAAc,CAAC,EAAE;YACvF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA5ND,wCA4NC","file":"TooltipHandler.js","sourcesContent":["import type { CellRange, RectProps } from '../../ts-types';\nimport { Placement } from '../../ts-types';\nimport type { BaseTooltip } from './BaseTooltip';\nimport { BubbleTooltip } from './Tooltip';\nimport { cellInRange } from '../../tools/helper';\nimport { isMobile } from '../../tools/util';\n// import { DG_EVENT_TYPE } from '../core/DG_EVENT_TYPE';\nimport type { TooltipOptions } from '../../ts-types/tooltip';\nimport { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nconst TOOLTIP_INSTANCE_FACTORY = {\n // tooltip(table: BaseTableAPI): BaseTooltip {\n // return new Tooltip(table);\n // },\n 'bubble-tooltip': function (table: BaseTableAPI): BaseTooltip {\n return new BubbleTooltip(table);\n }\n};\ntype AttachInfo = {\n instance?: BaseTooltip;\n range: CellRange;\n tooltipOptions: TooltipOptions;\n};\n\nexport class TooltipHandler {\n private _table: BaseTableAPI;\n private _tooltipInstances?: { [type: string]: BaseTooltip };\n private _attachInfo?: AttachInfo | null;\n private confine?: boolean; //弹出框是否需要限定在canvas区域\n constructor(table: BaseTableAPI, confine: boolean) {\n this._table = table;\n this._tooltipInstances = {};\n this._bindTableEvent(table);\n this.confine = confine;\n }\n release(): void {\n const tooltipInstances = this._tooltipInstances;\n for (const k in tooltipInstances) {\n tooltipInstances[k]?.release?.();\n }\n delete this._tooltipInstances;\n this._attachInfo = null;\n }\n _bindToCell(col: number, row: number, tooltipOptions?: TooltipOptions): void {\n const info = this._attachInfo;\n const instance = this._getTooltipInstanceInfo(col, row);\n if (info && (!instance || info.instance !== instance)) {\n info.instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n if (!instance) {\n return;\n }\n // const { instance, info: tooltipInstanceInfo } = instanceInfo;\n const attach = instance && instance.bindTooltipElement(col, row, tooltipOptions, this.confine);\n if (attach) {\n const range = this._table.getCellRange(col, row);\n this._attachInfo = { range, instance, tooltipOptions };\n }\n }\n _move(col: number, row: number, tooltipOptions: TooltipOptions): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n instance?.moveTooltipElement(col, row, tooltipOptions, this.confine);\n }\n moveToPosition(\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: {\n rect: RectProps;\n placement?: Placement;\n }\n ): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n this._attachInfo.tooltipOptions.position = position;\n this._attachInfo.tooltipOptions.referencePosition = referencePosition;\n instance?.locateTooltipElement(col, row, position, referencePosition, this.confine);\n }\n _unbindFromCell(): void {\n const info = this._attachInfo;\n if (!info) {\n return;\n }\n const { instance } = info;\n instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n _isBindCell(col: number, row: number): boolean {\n const info = this._attachInfo;\n if (!info) {\n return false;\n }\n return cellInRange(info.range, col, row);\n }\n _bindTableEvent(table: BaseTableAPI): void {\n // (table.options.hover?.isShowTooltip || table.options.tooltip?.isShowOverflowTextTooltip) &&\n table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n // dropDownMenu区域不响应\n const { x1: left, x2: right, y1: top, y2: bottom } = table.stateManager.menu.bounds;\n if (\n table.stateManager.menu.isShow &&\n typeof e.x === 'number' &&\n typeof e.y === 'number' &&\n e.x > left &&\n e.x < right &&\n e.y > top &&\n e.y < bottom\n ) {\n return;\n }\n const { col, row } = e;\n this.showTooltip(col, row);\n // if (e.related) {\n // if (this._isBindCell(col, row)) {\n // return;\n // }\n // }\n });\n table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n if (this._attachInfo?.tooltipOptions?.referencePosition) {\n const position = this._attachInfo.tooltipOptions.referencePosition;\n const { event } = e;\n const { left, right, top, bottom } = position.rect;\n const abstractPos = table._getMouseAbstractPoint(event, false);\n if (\n !(\n abstractPos.inTable &&\n abstractPos.x >= left - 5 &&\n abstractPos.x <= right + 5 &&\n abstractPos.y >= top - 5 &&\n abstractPos.y <= bottom + 5\n )\n ) {\n // 这里加5px的判断buffer\n this._unbindFromCell();\n }\n }\n // dropDownMenu区域不响应\n if (this._attachInfo && table.stateManager.menu.isShow) {\n this._bindToCell(e.col, e.row);\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, e => {\n // if (e.related) {\n // if (this._isBindCell(e.related.col, e.related.row)) {\n // return;\n // }\n // }\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SELECTED_CELL, e => {\n if (this._isBindCell(e.col, e.row)) {\n this._unbindFromCell();\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, e => {\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SCROLL, e => {\n this._unbindFromCell();\n // const info = this._attachInfo;\n // if (info?.tooltipOptions && info?.range?.start) {\n // const { col, row } = info.range.start;\n // const rect = table.getCellRangeRelativeRect({ col, row });\n // info.tooltipOptions.referencePosition.rect = rect;\n // this._move(info.range.start.col, info.range.start.row, info.tooltipOptions);\n // }\n });\n }\n showTooltip(col: number, row: number) {\n let tooltipOption;\n const table = this._table;\n const headerDescription = table.getHeaderDescription(col, row);\n if (headerDescription) {\n const rect = table.getCellRangeRelativeRect({ col, row });\n tooltipOption = {\n content: headerDescription,\n referencePosition: {\n placement: Placement.bottom,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: { arrowMark: false }\n };\n } else if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {\n const overflowText = table.getCellOverflowText(col, row);\n const rect = table.getCellRangeRelativeRect({ col, row });\n if (overflowText) {\n tooltipOption = {\n content: headerDescription\n ? `${headerDescription}\n ${overflowText}`\n : overflowText,\n referencePosition: {\n placement: Placement.bottom,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: table.theme.tooltipStyle\n };\n }\n }\n if (tooltipOption) {\n this._bindToCell(col, row, tooltipOption);\n } else {\n this._unbindFromCell();\n }\n }\n _getTooltipInstanceInfo(col: number, row: number): BaseTooltip | null {\n const table = this._table;\n const tooltipInstances = this._tooltipInstances;\n // const info = getTooltipInstanceInfo(table, col, row, tooltipOptions);\n // if (!info) {\n // return null;\n // }\n const tooltipType = 'bubble-tooltip';\n // const { tooltipType } = info;\n const instance =\n (tooltipInstances && tooltipInstances[tooltipType]) ||\n (tooltipInstances && (tooltipInstances[tooltipType] = TOOLTIP_INSTANCE_FACTORY[tooltipType](table)));\n return instance;\n }\n isBinded(tooltipOptions: TooltipOptions) {\n if (JSON.stringify(tooltipOptions) === JSON.stringify(this._attachInfo?.tooltipOptions)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/tooltip/TooltipHandler.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAE3C,uCAA0C;AAC1C,+CAAiD;AACjD,2CAA4C;AAG5C,kEAA+D;AAE/D,MAAM,wBAAwB,GAAG;IAI/B,gBAAgB,EAAE,UAAU,KAAmB;QAC7C,OAAO,IAAI,uBAAa,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF,CAAC;AAOF,MAAa,cAAc;IAKzB,YAAY,KAAmB,EAAE,OAAgB;QAC/C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACD,OAAO;;QACL,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAChD,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE;YAChC,MAAA,MAAA,gBAAgB,CAAC,CAAC,CAAC,0CAAE,OAAO,kDAAI,CAAC;SAClC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAC9B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IACD,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,cAA+B;;QACnE,MAAM,IAAI,GAAG,IAAI,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AAM,WAAW,GAAG,gBAAgB,CAAC;QAErC,MAAM,QAAQ,GACZ,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACnD,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvG,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,QAAQ,CAAC,cAA8B;;QACrC,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAA,IAAI,CAAC,WAAW,0CAAE,cAAc,CAAC,EAAE;YACvF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA5ND,wCA4NC","file":"TooltipHandler.js","sourcesContent":["import type { CellRange, RectProps } from '../../ts-types';\nimport { Placement } from '../../ts-types';\nimport type { BaseTooltip } from './BaseTooltip';\nimport { BubbleTooltip } from './Tooltip';\nimport { cellInRange } from '../../tools/helper';\nimport { isMobile } from '../../tools/util';\n// import { DG_EVENT_TYPE } from '../core/DG_EVENT_TYPE';\nimport type { TooltipOptions } from '../../ts-types/tooltip';\nimport { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nconst TOOLTIP_INSTANCE_FACTORY = {\n // tooltip(table: BaseTableAPI): BaseTooltip {\n // return new Tooltip(table);\n // },\n 'bubble-tooltip': function (table: BaseTableAPI): BaseTooltip {\n return new BubbleTooltip(table);\n }\n};\ntype AttachInfo = {\n instance?: BaseTooltip;\n range: CellRange;\n tooltipOptions: TooltipOptions;\n};\n\nexport class TooltipHandler {\n private _table: BaseTableAPI;\n private _tooltipInstances?: { [type: string]: BaseTooltip };\n private _attachInfo?: AttachInfo | null;\n private confine?: boolean; //弹出框是否需要限定在canvas区域\n constructor(table: BaseTableAPI, confine: boolean) {\n this._table = table;\n this._tooltipInstances = {};\n this._bindTableEvent(table);\n this.confine = confine;\n }\n release(): void {\n const tooltipInstances = this._tooltipInstances;\n for (const k in tooltipInstances) {\n tooltipInstances[k]?.release?.();\n }\n delete this._tooltipInstances;\n this._attachInfo = null;\n }\n _bindToCell(col: number, row: number, tooltipOptions?: TooltipOptions): void {\n const info = this._attachInfo;\n const instance = this._getTooltipInstanceInfo(col, row);\n if (info && (!instance || info.instance !== instance)) {\n info.instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n if (!instance) {\n return;\n }\n // const { instance, info: tooltipInstanceInfo } = instanceInfo;\n const attach = instance && instance.bindTooltipElement(col, row, tooltipOptions, this.confine);\n if (attach) {\n const range = this._table.getCellRange(col, row);\n this._attachInfo = { range, instance, tooltipOptions };\n }\n }\n _move(col: number, row: number, tooltipOptions: TooltipOptions): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n instance?.moveTooltipElement(col, row, tooltipOptions, this.confine);\n }\n moveToPosition(\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: {\n rect: RectProps;\n placement?: Placement;\n }\n ): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n this._attachInfo.tooltipOptions.position = position;\n this._attachInfo.tooltipOptions.referencePosition = referencePosition;\n instance?.locateTooltipElement(col, row, position, referencePosition, this.confine);\n }\n _unbindFromCell(): void {\n const info = this._attachInfo;\n if (!info) {\n return;\n }\n const { instance } = info;\n instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n _isBindCell(col: number, row: number): boolean {\n const info = this._attachInfo;\n if (!info) {\n return false;\n }\n return cellInRange(info.range, col, row);\n }\n _bindTableEvent(table: BaseTableAPI): void {\n // (table.options.hover?.isShowTooltip || table.options.tooltip?.isShowOverflowTextTooltip) &&\n table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n // dropDownMenu区域不响应\n const { x1: left, x2: right, y1: top, y2: bottom } = table.stateManager.menu.bounds;\n if (\n table.stateManager.menu.isShow &&\n typeof e.x === 'number' &&\n typeof e.y === 'number' &&\n e.x > left &&\n e.x < right &&\n e.y > top &&\n e.y < bottom\n ) {\n return;\n }\n const { col, row } = e;\n this.showTooltip(col, row);\n // if (e.related) {\n // if (this._isBindCell(col, row)) {\n // return;\n // }\n // }\n });\n table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n if (this._attachInfo?.tooltipOptions?.referencePosition) {\n const position = this._attachInfo.tooltipOptions.referencePosition;\n const { event } = e;\n const { left, right, top, bottom } = position.rect;\n const abstractPos = table._getMouseAbstractPoint(event, false);\n if (\n !(\n abstractPos.inTable &&\n abstractPos.x >= left - 5 &&\n abstractPos.x <= right + 5 &&\n abstractPos.y >= top - 5 &&\n abstractPos.y <= bottom + 5\n )\n ) {\n // 这里加5px的判断buffer\n this._unbindFromCell();\n }\n }\n // dropDownMenu区域不响应\n if (this._attachInfo && table.stateManager.menu.isShow) {\n this._bindToCell(e.col, e.row);\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, e => {\n // if (e.related) {\n // if (this._isBindCell(e.related.col, e.related.row)) {\n // return;\n // }\n // }\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SELECTED_CELL, e => {\n if (this._isBindCell(e.col, e.row)) {\n this._unbindFromCell();\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, e => {\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SCROLL, e => {\n this._unbindFromCell();\n // const info = this._attachInfo;\n // if (info?.tooltipOptions && info?.range?.start) {\n // const { col, row } = info.range.start;\n // const rect = table.getCellRangeRelativeRect({ col, row });\n // info.tooltipOptions.referencePosition.rect = rect;\n // this._move(info.range.start.col, info.range.start.row, info.tooltipOptions);\n // }\n });\n }\n showTooltip(col: number, row: number) {\n let tooltipOption;\n const table = this._table;\n const headerDescription = table.getHeaderDescription(col, row);\n if (headerDescription) {\n const rect = table.getCellRangeRelativeRect({ col, row });\n tooltipOption = {\n content: headerDescription,\n referencePosition: {\n placement: Placement.bottom,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: table.theme.tooltipStyle\n };\n } else if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {\n const overflowText = table.getCellOverflowText(col, row);\n const rect = table.getCellRangeRelativeRect({ col, row });\n if (overflowText) {\n tooltipOption = {\n content: headerDescription\n ? `${headerDescription}\n ${overflowText}`\n : overflowText,\n referencePosition: {\n placement: Placement.bottom,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: table.theme.tooltipStyle\n };\n }\n }\n if (tooltipOption) {\n this._bindToCell(col, row, tooltipOption);\n } else {\n this._unbindFromCell();\n }\n }\n _getTooltipInstanceInfo(col: number, row: number): BaseTooltip | null {\n const table = this._table;\n const tooltipInstances = this._tooltipInstances;\n // const info = getTooltipInstanceInfo(table, col, row, tooltipOptions);\n // if (!info) {\n // return null;\n // }\n const tooltipType = 'bubble-tooltip';\n // const { tooltipType } = info;\n const instance =\n (tooltipInstances && tooltipInstances[tooltipType]) ||\n (tooltipInstances && (tooltipInstances[tooltipType] = TOOLTIP_INSTANCE_FACTORY[tooltipType](table)));\n return instance;\n }\n isBinded(tooltipOptions: TooltipOptions) {\n if (JSON.stringify(tooltipOptions) === JSON.stringify(this._attachInfo?.tooltipOptions)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
|
@@ -14,17 +14,19 @@ class BubbleTooltipElement {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
this._handler = new EventHandler_1.EventHandler;
|
|
16
16
|
const rootElement = this._rootElement = (0, dom_1.createElement)("div", [ TOOLTIP_CLASS, HIDDEN_CLASS ]), messageElement = (0,
|
|
17
|
-
dom_1.createElement)("
|
|
17
|
+
dom_1.createElement)("div", [ CONTENT_CLASS ]), triangle = (0, dom_1.createElement)("span", [ TRIANGLE_CLASS ]);
|
|
18
18
|
rootElement.appendChild(triangle), rootElement.appendChild(messageElement), this._messageElement = rootElement.querySelector(`.${CONTENT_CLASS}`) || void 0,
|
|
19
19
|
this._triangleElement = rootElement.querySelector(`.${TRIANGLE_CLASS}`) || void 0,
|
|
20
20
|
rootElement.addEventListener("mousemove", (() => {
|
|
21
21
|
this._disappearDelayId && clearTimeout(this._disappearDelayId);
|
|
22
22
|
})), rootElement.addEventListener("mouseleave", (() => {
|
|
23
23
|
this._disappearDelay = void 0, this.unbindFromCell();
|
|
24
|
+
})), messageElement.addEventListener("wheel", (e => {
|
|
25
|
+
e.stopPropagation();
|
|
24
26
|
}));
|
|
25
27
|
}
|
|
26
28
|
bindToCell(table, col, row, tooltipInstanceInfo, confine) {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
28
30
|
this._disappearDelay = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.disappearDelay,
|
|
29
31
|
this._disappearDelayId && clearTimeout(this._disappearDelayId);
|
|
30
32
|
const rootElement = this._rootElement, messageElement = this._messageElement, triangle = this._triangleElement;
|
|
@@ -38,8 +40,10 @@ class BubbleTooltipElement {
|
|
|
38
40
|
(null === (_j = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _j ? void 0 : _j.fontFamily) && (messageElement.style.fontFamily = null === (_k = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _k ? void 0 : _k.fontFamily),
|
|
39
41
|
(null === (_l = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _l ? void 0 : _l.color) && (messageElement.style.color = null === (_m = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _m ? void 0 : _m.color),
|
|
40
42
|
(null === (_o = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _o ? void 0 : _o.padding) && (messageElement.style.padding = `${null === (_p = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _p ? void 0 : _p.padding.join("px ")}px`),
|
|
43
|
+
(null === (_q = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _q ? void 0 : _q.maxHeight) && (messageElement.style.maxHeight = `${null === (_r = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _r ? void 0 : _r.maxHeight}px`),
|
|
44
|
+
(null === (_s = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _s ? void 0 : _s.maxWidth) && (messageElement.style.maxWidth = `${null === (_t = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _t ? void 0 : _t.maxWidth}px`),
|
|
41
45
|
messageElement && (messageElement.textContent = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.content);
|
|
42
|
-
if (this._bindToCell(table, col, row, null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.position, null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.referencePosition, confine, null === (
|
|
46
|
+
if (this._bindToCell(table, col, row, null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.position, null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.referencePosition, confine, null === (_u = null == tooltipInstanceInfo ? void 0 : tooltipInstanceInfo.style) || void 0 === _u ? void 0 : _u.arrowMark)) return null == rootElement || rootElement.classList.add(SHOWN_CLASS),
|
|
43
47
|
null == rootElement || rootElement.classList.remove(HIDDEN_CLASS), !0;
|
|
44
48
|
} else this.unbindFromCell();
|
|
45
49
|
return !1;
|
|
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AG,cAAc,GAAG,WAAW,CAAC,WAAW,CAAC;aACrD;SACF;QACD,OAAO;YACL,CAAC,EAAE,QAAQ;YACX,CAAC,EAAE,QAAQ;SACZ,CAAC;IACJ,CAAC;IACO,uBAAuB;QAC7B,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QACtC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;QACvC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;QACrC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;QACxC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;QAC5C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,CACL,KAAmB,EACnB,GAAW,EACX,GAAW,EACX,QAAmC,EACnC,iBAGC,EACD,OAAiB;QAEjB,MAAM,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;QACxG,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,CAAC;QAC/C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,QAAQ,IAAI,CAAC;IAChD,CAAC;CACF;AAzWD,oDAyWC","file":"BubbleTooltipElement.js","sourcesContent":["import { EventHandler } from '../../../event/EventHandler';\nimport type { RectProps } from '../../../ts-types';\nimport { Placement } from '../../../ts-types';\nimport { createElement } from '../../../tools/dom';\nimport { importStyle } from './BubbleTooltipElementStyle';\nimport { isMobile } from '../../../tools/util';\nimport type { TooltipOptions } from '../../../ts-types/tooltip';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimportStyle();\nconst TOOLTIP_CLASS = 'vtable__bubble-tooltip-element';\nconst CONTENT_CLASS = `${TOOLTIP_CLASS}__content`;\nconst TRIANGLE_CLASS = `${TOOLTIP_CLASS}__triangle`;\nconst HIDDEN_CLASS = `${TOOLTIP_CLASS}--hidden`;\nconst SHOWN_CLASS = `${TOOLTIP_CLASS}--shown`;\n\nexport class BubbleTooltipElement {\n private _handler: EventHandler;\n private _rootElement?: HTMLElement;\n private _messageElement?: HTMLElement;\n private _triangleElement?: HTMLElement;\n private _disappearDelay?: number; // 提示框延迟多久消失\n private _disappearDelayId?: any;\n constructor() {\n this._handler = new EventHandler();\n const rootElement = (this._rootElement = createElement('div', [TOOLTIP_CLASS, HIDDEN_CLASS]));\n const messageElement = createElement('span', [CONTENT_CLASS]);\n const triangle = createElement('span', [TRIANGLE_CLASS]);\n rootElement.appendChild(triangle);\n rootElement.appendChild(messageElement);\n this._messageElement = <HTMLElement>rootElement.querySelector(`.${CONTENT_CLASS}`) || undefined;\n this._triangleElement = <HTMLElement>rootElement.querySelector(`.${TRIANGLE_CLASS}`) || undefined;\n\n rootElement.addEventListener('mousemove', () => {\n this._disappearDelayId && clearTimeout(this._disappearDelayId);\n });\n rootElement.addEventListener('mouseleave', () => {\n this._disappearDelay = undefined;\n this.unbindFromCell();\n });\n }\n bindToCell(\n table: BaseTableAPI,\n col: number,\n row: number,\n tooltipInstanceInfo: TooltipOptions,\n confine: boolean\n ): boolean {\n this._disappearDelay = tooltipInstanceInfo?.disappearDelay;\n this._disappearDelayId && clearTimeout(this._disappearDelayId);\n const rootElement = this._rootElement;\n const messageElement = this._messageElement;\n const triangle = this._triangleElement;\n\n rootElement?.classList.remove(SHOWN_CLASS);\n rootElement?.classList.add(HIDDEN_CLASS);\n if (this._canBindToCell(table, col, row)) {\n //设置style及类名\n messageElement.setAttribute('style', '');\n triangle.setAttribute('style', '');\n tooltipInstanceInfo?.className && rootElement.classList.add(tooltipInstanceInfo.className);\n tooltipInstanceInfo?.style?.bgColor &&\n (messageElement.style.backgroundColor = tooltipInstanceInfo?.style?.bgColor);\n tooltipInstanceInfo?.style?.bgColor && (triangle.style.backgroundColor = tooltipInstanceInfo?.style?.bgColor);\n triangle.style.display = tooltipInstanceInfo?.style?.arrowMark === true ? 'block' : 'none';\n tooltipInstanceInfo?.style?.fontSize &&\n (messageElement.style.fontSize = (tooltipInstanceInfo?.style?.fontSize ?? 12) + 'px');\n tooltipInstanceInfo?.style?.fontFamily &&\n (messageElement.style.fontFamily = tooltipInstanceInfo?.style?.fontFamily);\n tooltipInstanceInfo?.style?.color && (messageElement.style.color = tooltipInstanceInfo?.style?.color);\n tooltipInstanceInfo?.style?.padding &&\n (messageElement.style.padding = `${tooltipInstanceInfo?.style?.padding.join('px ')}px`);\n messageElement && (messageElement.textContent = tooltipInstanceInfo?.content);\n const binded = this._bindToCell(\n table,\n col,\n row,\n tooltipInstanceInfo?.position,\n tooltipInstanceInfo?.referencePosition,\n confine,\n tooltipInstanceInfo?.style?.arrowMark\n );\n if (binded) {\n rootElement?.classList.add(SHOWN_CLASS);\n rootElement?.classList.remove(HIDDEN_CLASS);\n return true;\n }\n } else {\n this.unbindFromCell();\n }\n return false;\n }\n release(): void {\n this.unbindFromCell();\n\n const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.parentElement.removeChild(rootElement);\n }\n\n this._handler?.release?.();\n delete this._rootElement;\n delete this._messageElement;\n }\n move(table: BaseTableAPI, col: number, row: number, tooltipOptions?: TooltipOptions, confine?: boolean): void {\n const rootElement = this._rootElement;\n if (this._canBindToCell(table, col, row)) {\n this._bindToCell(table, col, row, tooltipOptions?.position, tooltipOptions?.referencePosition, confine);\n rootElement?.classList.add(SHOWN_CLASS);\n rootElement?.classList.remove(HIDDEN_CLASS);\n } else {\n this.unbindFromCell();\n }\n }\n unbindFromCell(): void {\n if (this._disappearDelay) {\n this._disappearDelayId = setTimeout(() => {\n const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.classList.remove(SHOWN_CLASS);\n rootElement.classList.add(HIDDEN_CLASS);\n }\n }, this._disappearDelay ?? 0);\n } else {\n const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.classList.remove(SHOWN_CLASS);\n rootElement.classList.add(HIDDEN_CLASS);\n }\n }\n }\n _canBindToCell(table: BaseTableAPI, col: number, row: number): boolean {\n const rect = table.getCellRangeRelativeRect({ col, row });\n const element = table.getElement();\n const { bottom, left, right, top } = rect;\n // const { frozenRowCount, frozenColCount } = table;\n // if (row >= frozenRowCount && frozenRowCount > 0) {\n // const frozenRect = table.getCellRangeRelativeRect({ col, row: frozenRowCount - 1 });\n // if (bottom < frozenRect.bottom) {\n // // 范围外\n // return false;\n // }\n // } else if (bottom < 0) {\n // // 范围外\n // return false;\n // }\n // if (col >= frozenColCount && frozenColCount > 0) {\n // const frozenRect = table.getCellRangeRelativeRect({ col: frozenColCount - 1, row });\n // if (right < frozenRect.right) {\n // //整个是被冻结列盖住的 不需要提示toolTip\n // return false;\n // }\n // } else if (left < 0) {\n // return false;\n // }\n\n if (table.isFrozenCell(col, row)) {\n return true;\n } else if (\n bottom < table.getFrozenRowsHeight() ||\n right < table.getFrozenColsWidth() ||\n left > table.tableNoFrameWidth - table.getRightFrozenColsWidth() ||\n top > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight()\n ) {\n // 范围外\n return false;\n }\n const { offsetHeight, offsetWidth } = element;\n if (top > offsetHeight) {\n return false;\n }\n if (left > offsetWidth) {\n return false;\n }\n return true;\n }\n _bindToCell(\n table: BaseTableAPI,\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: { rect: RectProps; placement?: Placement },\n confine?: boolean,\n arrowMark?: boolean\n ): boolean {\n const rootElement = this._rootElement;\n const rect = table.getCellRangeRelativeRect({ col, row });\n const element = table.getElement();\n const containerWidth = table.internalProps.element.offsetWidth;\n const { width } = rect;\n if (rootElement) {\n if (rootElement.parentElement !== element) {\n element.appendChild(rootElement);\n }\n rootElement.style.left = `0px`;\n // 边界碰撞检测\n let tooltipY: number;\n let tooltipX: number;\n //设置最宽尺寸\n const maxWidth = Math.min(containerWidth * 0.8, width * 4);\n rootElement.style.maxWidth = `${maxWidth}px`;\n //计算弹出框的宽度\n const rootElementWidth = rootElement.clientWidth; //Math.min(Math.max(rootElement.clientWidth, width), maxWidth);\n const rootElementHeight = rootElement.clientHeight;\n if (position || referencePosition) {\n const tooltipPosition = this.getComputedPosition(\n table,\n col,\n row,\n position,\n referencePosition,\n confine,\n arrowMark\n );\n tooltipX = tooltipPosition.x;\n tooltipY = tooltipPosition.y;\n } else {\n return false;\n }\n\n rootElement.style.left = `${tooltipX}px`;\n rootElement.style.top = `${tooltipY}px`;\n // rootElement.style.width=rootElementWidth+'px';\n if (isMobile()) {\n rootElement.style.fontSize = '11px';\n }\n\n // 判断当前tooltip范围是否与tooltip重合\n const { x1: menuLeft, x2: menuRight, y1: menuTop, y2: menuBottom } = table.stateManager.menu.bounds;\n const tooltipLeft = tooltipX;\n const tooltipRight = tooltipLeft + rootElementWidth;\n const tooltipTop = tooltipY;\n const tooltipBottom = tooltipLeft + rootElementHeight;\n if (\n table.stateManager.menu.isShow &&\n menuLeft < tooltipRight &&\n menuRight > tooltipLeft &&\n menuBottom > tooltipTop &&\n menuTop < tooltipBottom\n ) {\n return false;\n }\n return true;\n }\n return false;\n }\n private getComputedPosition(\n table: BaseTableAPI,\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: { rect: RectProps; placement?: Placement },\n confine?: boolean,\n arrowMark?: boolean\n ) {\n const rootElement = this._rootElement;\n const rect = table.getCellRangeRelativeRect({ col, row });\n const { width: containerWidth, height: containerHeight } = table.internalProps.element.getBoundingClientRect();\n const { width } = rect;\n // 边界碰撞检测\n let tooltipY: number;\n let tooltipX: number;\n //设置最宽尺寸\n const maxWidth = Math.min(containerWidth * 0.8, width * 4);\n rootElement.style.maxWidth = `${maxWidth}px`;\n //计算弹出框的宽度\n const rootElementWidth = rootElement.clientWidth; //Math.min(Math.max(rootElement.clientWidth, width), maxWidth);\n const rootElementHeight = rootElement.clientHeight;\n // this._triangleElement.setAttribute('style', '');\n const triangleHeight = arrowMark ? 6 : 0;\n if (position) {\n tooltipX = position.x;\n tooltipY = position.y + triangleHeight;\n this._triangleElement.style.left = '50%';\n this._triangleElement.style.marginLeft = '-5px';\n this._triangleElement.style.top = '-5px';\n } else if (referencePosition) {\n let placement = referencePosition.placement ?? Placement.bottom;\n const referenceXMiddle = referencePosition.rect.left + referencePosition.rect.width / 2;\n const referenceYMiddle = referencePosition.rect.top + referencePosition.rect.height / 2;\n const referenceTop = referencePosition.rect.top;\n const referenceBottom = referencePosition.rect.bottom;\n const referenceLeft = referencePosition.rect.left;\n const referenceRight = referencePosition.rect.right;\n\n let callCount = 0;\n /** 根据placement计算弹出框的位置 躲避策略[dom的这块先去除 dom可以超出显示]:根据顺时针方向依次检测placement */\n const adjustPosition = () => {\n callCount++;\n if (callCount >= 4) {\n return;\n }\n this.removeStyleFromTriangle();\n if (placement === Placement.top) {\n tooltipX = referenceXMiddle - rootElementWidth / 2;\n tooltipY = referenceTop - rootElementHeight - triangleHeight;\n this._triangleElement.style.left = '50%';\n this._triangleElement.style.marginLeft = '-5px';\n this._triangleElement.style.bottom = '-5px';\n\n // 判断如果超出左右范围则靠边显示\n if (confine && tooltipY < 0) {\n placement = Placement.right;\n adjustPosition();\n }\n } else if (placement === Placement.bottom) {\n tooltipX = referenceXMiddle - rootElementWidth / 2;\n tooltipY = referenceBottom + triangleHeight;\n this._triangleElement.style.left = '50%';\n this._triangleElement.style.marginLeft = '-5px';\n this._triangleElement.style.top = '-5px';\n if (confine && tooltipY + rootElementHeight > containerHeight) {\n placement = Placement.left;\n adjustPosition();\n }\n } else if (placement === Placement.left) {\n tooltipY = referenceYMiddle - rootElementHeight / 2;\n tooltipX = referenceLeft - rootElementWidth - triangleHeight;\n this._triangleElement.style.top = '50%';\n this._triangleElement.style.marginTop = '-5px';\n this._triangleElement.style.right = '-5px';\n if (confine && tooltipX < 0) {\n placement = Placement.top;\n adjustPosition();\n }\n } else if (placement === Placement.right) {\n tooltipY = referenceYMiddle - rootElementHeight / 2;\n tooltipX = referenceRight + triangleHeight;\n this._triangleElement.style.top = '50%';\n this._triangleElement.style.marginTop = '-5px';\n this._triangleElement.style.left = '-5px';\n if (confine && tooltipX + rootElementWidth > containerWidth) {\n placement = Placement.bottom;\n adjustPosition();\n }\n }\n };\n adjustPosition();\n }\n // 判断如果超出左右范围则靠边显示\n if (confine) {\n if (tooltipX < 0) {\n tooltipX = 0;\n } else if (tooltipX + rootElement.offsetWidth > containerWidth) {\n tooltipX = containerWidth - rootElement.offsetWidth;\n }\n }\n return {\n x: tooltipX,\n y: tooltipY\n };\n }\n private removeStyleFromTriangle() {\n this._triangleElement.style.left = '';\n this._triangleElement.style.right = '';\n this._triangleElement.style.top = '';\n this._triangleElement.style.bottom = '';\n this._triangleElement.style.marginLeft = '';\n this._triangleElement.style.marginTop = '';\n }\n _locate(\n table: BaseTableAPI,\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: {\n rect: RectProps;\n placement?: Placement;\n },\n confine?: boolean\n ) {\n const tooltipPosition = this.getComputedPosition(table, col, row, position, referencePosition, confine);\n const tooltipX = tooltipPosition.x;\n const tooltipY = tooltipPosition.y;\n this._rootElement.style.left = `${tooltipX}px`;\n this._rootElement.style.top = `${tooltipY}px`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/tooltip/logic/BubbleTooltipElement.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAE3D,gDAA8C;AAC9C,4CAAmD;AACnD,2EAA0D;AAC1D,8CAA+C;AAG/C,IAAA,uCAAW,GAAE,CAAC;AACd,MAAM,aAAa,GAAG,gCAAgC,CAAC;AACvD,MAAM,aAAa,GAAG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C,YAAY,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,CAAC;QAC/C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,QAAQ,IAAI,CAAC;IAChD,CAAC;CACF;AAjXD,oDAiXC","file":"BubbleTooltipElement.js","sourcesContent":["import { EventHandler } from '../../../event/EventHandler';\nimport type { RectProps } from '../../../ts-types';\nimport { Placement } from '../../../ts-types';\nimport { createElement } from '../../../tools/dom';\nimport { importStyle } from './BubbleTooltipElementStyle';\nimport { isMobile } from '../../../tools/util';\nimport type { TooltipOptions } from '../../../ts-types/tooltip';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimportStyle();\nconst TOOLTIP_CLASS = 'vtable__bubble-tooltip-element';\nconst CONTENT_CLASS = `${TOOLTIP_CLASS}__content`;\nconst TRIANGLE_CLASS = `${TOOLTIP_CLASS}__triangle`;\nconst HIDDEN_CLASS = `${TOOLTIP_CLASS}--hidden`;\nconst SHOWN_CLASS = `${TOOLTIP_CLASS}--shown`;\n\nexport class BubbleTooltipElement {\n private _handler: EventHandler;\n private _rootElement?: HTMLElement;\n private _messageElement?: HTMLElement;\n private _triangleElement?: HTMLElement;\n private _disappearDelay?: number; // 提示框延迟多久消失\n private _disappearDelayId?: any;\n constructor() {\n this._handler = new EventHandler();\n const rootElement = (this._rootElement = createElement('div', [TOOLTIP_CLASS, HIDDEN_CLASS]));\n const messageElement = createElement('div', [CONTENT_CLASS]);\n const triangle = createElement('span', [TRIANGLE_CLASS]);\n rootElement.appendChild(triangle);\n rootElement.appendChild(messageElement);\n this._messageElement = <HTMLElement>rootElement.querySelector(`.${CONTENT_CLASS}`) || undefined;\n this._triangleElement = <HTMLElement>rootElement.querySelector(`.${TRIANGLE_CLASS}`) || undefined;\n\n rootElement.addEventListener('mousemove', () => {\n this._disappearDelayId && clearTimeout(this._disappearDelayId);\n });\n rootElement.addEventListener('mouseleave', () => {\n this._disappearDelay = undefined;\n this.unbindFromCell();\n });\n\n messageElement.addEventListener('wheel', e => {\n e.stopPropagation();\n });\n }\n bindToCell(\n table: BaseTableAPI,\n col: number,\n row: number,\n tooltipInstanceInfo: TooltipOptions,\n confine: boolean\n ): boolean {\n this._disappearDelay = tooltipInstanceInfo?.disappearDelay;\n this._disappearDelayId && clearTimeout(this._disappearDelayId);\n const rootElement = this._rootElement;\n const messageElement = this._messageElement;\n const triangle = this._triangleElement;\n\n rootElement?.classList.remove(SHOWN_CLASS);\n rootElement?.classList.add(HIDDEN_CLASS);\n if (this._canBindToCell(table, col, row)) {\n //设置style及类名\n messageElement.setAttribute('style', '');\n triangle.setAttribute('style', '');\n tooltipInstanceInfo?.className && rootElement.classList.add(tooltipInstanceInfo.className);\n tooltipInstanceInfo?.style?.bgColor &&\n (messageElement.style.backgroundColor = tooltipInstanceInfo?.style?.bgColor);\n tooltipInstanceInfo?.style?.bgColor && (triangle.style.backgroundColor = tooltipInstanceInfo?.style?.bgColor);\n triangle.style.display = tooltipInstanceInfo?.style?.arrowMark === true ? 'block' : 'none';\n tooltipInstanceInfo?.style?.fontSize &&\n (messageElement.style.fontSize = (tooltipInstanceInfo?.style?.fontSize ?? 12) + 'px');\n tooltipInstanceInfo?.style?.fontFamily &&\n (messageElement.style.fontFamily = tooltipInstanceInfo?.style?.fontFamily);\n tooltipInstanceInfo?.style?.color && (messageElement.style.color = tooltipInstanceInfo?.style?.color);\n tooltipInstanceInfo?.style?.padding &&\n (messageElement.style.padding = `${tooltipInstanceInfo?.style?.padding.join('px ')}px`);\n tooltipInstanceInfo?.style?.maxHeight &&\n (messageElement.style.maxHeight = `${tooltipInstanceInfo?.style?.maxHeight}px`);\n tooltipInstanceInfo?.style?.maxWidth &&\n (messageElement.style.maxWidth = `${tooltipInstanceInfo?.style?.maxWidth}px`);\n messageElement && (messageElement.textContent = tooltipInstanceInfo?.content);\n const binded = this._bindToCell(\n table,\n col,\n row,\n tooltipInstanceInfo?.position,\n tooltipInstanceInfo?.referencePosition,\n confine,\n tooltipInstanceInfo?.style?.arrowMark\n );\n if (binded) {\n rootElement?.classList.add(SHOWN_CLASS);\n rootElement?.classList.remove(HIDDEN_CLASS);\n return true;\n }\n } else {\n this.unbindFromCell();\n }\n return false;\n }\n release(): void {\n this.unbindFromCell();\n\n const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.parentElement.removeChild(rootElement);\n }\n\n this._handler?.release?.();\n delete this._rootElement;\n delete this._messageElement;\n }\n move(table: BaseTableAPI, col: number, row: number, tooltipOptions?: TooltipOptions, confine?: boolean): void {\n const rootElement = this._rootElement;\n if (this._canBindToCell(table, col, row)) {\n this._bindToCell(table, col, row, tooltipOptions?.position, tooltipOptions?.referencePosition, confine);\n rootElement?.classList.add(SHOWN_CLASS);\n rootElement?.classList.remove(HIDDEN_CLASS);\n } else {\n this.unbindFromCell();\n }\n }\n unbindFromCell(): void {\n if (this._disappearDelay) {\n this._disappearDelayId = setTimeout(() => {\n const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.classList.remove(SHOWN_CLASS);\n rootElement.classList.add(HIDDEN_CLASS);\n }\n }, this._disappearDelay ?? 0);\n } else {\n const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.classList.remove(SHOWN_CLASS);\n rootElement.classList.add(HIDDEN_CLASS);\n }\n }\n }\n _canBindToCell(table: BaseTableAPI, col: number, row: number): boolean {\n const rect = table.getCellRangeRelativeRect({ col, row });\n const element = table.getElement();\n const { bottom, left, right, top } = rect;\n // const { frozenRowCount, frozenColCount } = table;\n // if (row >= frozenRowCount && frozenRowCount > 0) {\n // const frozenRect = table.getCellRangeRelativeRect({ col, row: frozenRowCount - 1 });\n // if (bottom < frozenRect.bottom) {\n // // 范围外\n // return false;\n // }\n // } else if (bottom < 0) {\n // // 范围外\n // return false;\n // }\n // if (col >= frozenColCount && frozenColCount > 0) {\n // const frozenRect = table.getCellRangeRelativeRect({ col: frozenColCount - 1, row });\n // if (right < frozenRect.right) {\n // //整个是被冻结列盖住的 不需要提示toolTip\n // return false;\n // }\n // } else if (left < 0) {\n // return false;\n // }\n\n if (table.isFrozenCell(col, row)) {\n return true;\n } else if (\n bottom < table.getFrozenRowsHeight() ||\n right < table.getFrozenColsWidth() ||\n left > table.tableNoFrameWidth - table.getRightFrozenColsWidth() ||\n top > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight()\n ) {\n // 范围外\n return false;\n }\n const { offsetHeight, offsetWidth } = element;\n if (top > offsetHeight) {\n return false;\n }\n if (left > offsetWidth) {\n return false;\n }\n return true;\n }\n _bindToCell(\n table: BaseTableAPI,\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: { rect: RectProps; placement?: Placement },\n confine?: boolean,\n arrowMark?: boolean\n ): boolean {\n const rootElement = this._rootElement;\n const rect = table.getCellRangeRelativeRect({ col, row });\n const element = table.getElement();\n const containerWidth = table.internalProps.element.offsetWidth;\n const { width } = rect;\n if (rootElement) {\n if (rootElement.parentElement !== element) {\n element.appendChild(rootElement);\n }\n rootElement.style.left = `0px`;\n // 边界碰撞检测\n let tooltipY: number;\n let tooltipX: number;\n //设置最宽尺寸\n const maxWidth = Math.min(containerWidth * 0.8, width * 4);\n rootElement.style.maxWidth = `${maxWidth}px`;\n //计算弹出框的宽度\n const rootElementWidth = rootElement.clientWidth; //Math.min(Math.max(rootElement.clientWidth, width), maxWidth);\n const rootElementHeight = rootElement.clientHeight;\n if (position || referencePosition) {\n const tooltipPosition = this.getComputedPosition(\n table,\n col,\n row,\n position,\n referencePosition,\n confine,\n arrowMark\n );\n tooltipX = tooltipPosition.x;\n tooltipY = tooltipPosition.y;\n } else {\n return false;\n }\n\n rootElement.style.left = `${tooltipX}px`;\n rootElement.style.top = `${tooltipY}px`;\n // rootElement.style.width=rootElementWidth+'px';\n if (isMobile()) {\n rootElement.style.fontSize = '11px';\n }\n\n // 判断当前tooltip范围是否与tooltip重合\n const { x1: menuLeft, x2: menuRight, y1: menuTop, y2: menuBottom } = table.stateManager.menu.bounds;\n const tooltipLeft = tooltipX;\n const tooltipRight = tooltipLeft + rootElementWidth;\n const tooltipTop = tooltipY;\n const tooltipBottom = tooltipLeft + rootElementHeight;\n if (\n table.stateManager.menu.isShow &&\n menuLeft < tooltipRight &&\n menuRight > tooltipLeft &&\n menuBottom > tooltipTop &&\n menuTop < tooltipBottom\n ) {\n return false;\n }\n return true;\n }\n return false;\n }\n private getComputedPosition(\n table: BaseTableAPI,\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: { rect: RectProps; placement?: Placement },\n confine?: boolean,\n arrowMark?: boolean\n ) {\n const rootElement = this._rootElement;\n const rect = table.getCellRangeRelativeRect({ col, row });\n const { width: containerWidth, height: containerHeight } = table.internalProps.element.getBoundingClientRect();\n const { width } = rect;\n // 边界碰撞检测\n let tooltipY: number;\n let tooltipX: number;\n //设置最宽尺寸\n const maxWidth = Math.min(containerWidth * 0.8, width * 4);\n rootElement.style.maxWidth = `${maxWidth}px`;\n //计算弹出框的宽度\n const rootElementWidth = rootElement.clientWidth; //Math.min(Math.max(rootElement.clientWidth, width), maxWidth);\n const rootElementHeight = rootElement.clientHeight;\n // this._triangleElement.setAttribute('style', '');\n const triangleHeight = arrowMark ? 6 : 0;\n if (position) {\n tooltipX = position.x;\n tooltipY = position.y + triangleHeight;\n this._triangleElement.style.left = '50%';\n this._triangleElement.style.marginLeft = '-5px';\n this._triangleElement.style.top = '-5px';\n } else if (referencePosition) {\n let placement = referencePosition.placement ?? Placement.bottom;\n const referenceXMiddle = referencePosition.rect.left + referencePosition.rect.width / 2;\n const referenceYMiddle = referencePosition.rect.top + referencePosition.rect.height / 2;\n const referenceTop = referencePosition.rect.top;\n const referenceBottom = referencePosition.rect.bottom;\n const referenceLeft = referencePosition.rect.left;\n const referenceRight = referencePosition.rect.right;\n\n let callCount = 0;\n /** 根据placement计算弹出框的位置 躲避策略[dom的这块先去除 dom可以超出显示]:根据顺时针方向依次检测placement */\n const adjustPosition = () => {\n callCount++;\n if (callCount >= 4) {\n return;\n }\n this.removeStyleFromTriangle();\n if (placement === Placement.top) {\n tooltipX = referenceXMiddle - rootElementWidth / 2;\n tooltipY = referenceTop - rootElementHeight - triangleHeight;\n this._triangleElement.style.left = '50%';\n this._triangleElement.style.marginLeft = '-5px';\n this._triangleElement.style.bottom = '-5px';\n\n // 判断如果超出左右范围则靠边显示\n if (confine && tooltipY < 0) {\n placement = Placement.right;\n adjustPosition();\n }\n } else if (placement === Placement.bottom) {\n tooltipX = referenceXMiddle - rootElementWidth / 2;\n tooltipY = referenceBottom + triangleHeight;\n this._triangleElement.style.left = '50%';\n this._triangleElement.style.marginLeft = '-5px';\n this._triangleElement.style.top = '-5px';\n if (confine && tooltipY + rootElementHeight > containerHeight) {\n placement = Placement.left;\n adjustPosition();\n }\n } else if (placement === Placement.left) {\n tooltipY = referenceYMiddle - rootElementHeight / 2;\n tooltipX = referenceLeft - rootElementWidth - triangleHeight;\n this._triangleElement.style.top = '50%';\n this._triangleElement.style.marginTop = '-5px';\n this._triangleElement.style.right = '-5px';\n if (confine && tooltipX < 0) {\n placement = Placement.top;\n adjustPosition();\n }\n } else if (placement === Placement.right) {\n tooltipY = referenceYMiddle - rootElementHeight / 2;\n tooltipX = referenceRight + triangleHeight;\n this._triangleElement.style.top = '50%';\n this._triangleElement.style.marginTop = '-5px';\n this._triangleElement.style.left = '-5px';\n if (confine && tooltipX + rootElementWidth > containerWidth) {\n placement = Placement.bottom;\n adjustPosition();\n }\n }\n };\n adjustPosition();\n }\n // 判断如果超出左右范围则靠边显示\n if (confine) {\n if (tooltipX < 0) {\n tooltipX = 0;\n } else if (tooltipX + rootElement.offsetWidth > containerWidth) {\n tooltipX = containerWidth - rootElement.offsetWidth;\n }\n }\n return {\n x: tooltipX,\n y: tooltipY\n };\n }\n private removeStyleFromTriangle() {\n this._triangleElement.style.left = '';\n this._triangleElement.style.right = '';\n this._triangleElement.style.top = '';\n this._triangleElement.style.bottom = '';\n this._triangleElement.style.marginLeft = '';\n this._triangleElement.style.marginTop = '';\n }\n _locate(\n table: BaseTableAPI,\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: {\n rect: RectProps;\n placement?: Placement;\n },\n confine?: boolean\n ) {\n const tooltipPosition = this.getComputedPosition(table, col, row, position, referencePosition, confine);\n const tooltipX = tooltipPosition.x;\n const tooltipY = tooltipPosition.y;\n this._rootElement.style.left = `${tooltipX}px`;\n this._rootElement.style.top = `${tooltipY}px`;\n }\n}\n"]}
|
|
@@ -9,7 +9,7 @@ const env_1 = require("../../../tools/env");
|
|
|
9
9
|
function importStyle() {
|
|
10
10
|
if ("node" === env_1.Env.mode) return;
|
|
11
11
|
const styleElement = document.createElement("style");
|
|
12
|
-
styleElement.id = "vtable-tooltip-styleSheet", styleElement.textContent = "\n@keyframes vtable__bubble-tooltip-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__bubble-tooltip-element {\n\tposition: absolute;\n\t\n\t// pointer-events: none;\n\t//user-select: none;\n\tmax-width: 300px;\n\tz-index: 99999;\n\n\tbackground: #FFFFFF;\n border: 1px solid #E6E8ED;\n box-sizing: border-box;\n border-radius: 4px;\n box-shadow: 0px 2px 4px rgb(27 31 35 / 8%);\n color: #141414;\n font-size: 13px;\n}\n.vtable__bubble-tooltip-element--hidden {\n\topacity: 0;\n pointer-events: none;\n\tuser-select: none;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n}\n.vtable__bubble-tooltip-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__bubble-tooltip-element--shown-animation 150ms ease-out;\n}\n.vtable__bubble-tooltip-element__content {\n\t/* font-size: .75rem; */\n\tpadding: 6px 8px;\n\tmin-height: 1em;\n\tline-height: 1.5;\n\twidth: 100%;\n\tdisplay: block;\n\twhite-space: pre-wrap;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\toverflow:
|
|
12
|
+
styleElement.id = "vtable-tooltip-styleSheet", styleElement.textContent = "\n@keyframes vtable__bubble-tooltip-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__bubble-tooltip-element {\n\tposition: absolute;\n\t\n\t// pointer-events: none;\n\t//user-select: none;\n\tmax-width: 300px;\n\tz-index: 99999;\n\n\tbackground: #FFFFFF;\n border: 1px solid #E6E8ED;\n box-sizing: border-box;\n border-radius: 4px;\n box-shadow: 0px 2px 4px rgb(27 31 35 / 8%);\n color: #141414;\n font-size: 13px;\n}\n.vtable__bubble-tooltip-element--hidden {\n\topacity: 0;\n pointer-events: none;\n\tuser-select: none;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n}\n.vtable__bubble-tooltip-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__bubble-tooltip-element--shown-animation 150ms ease-out;\n}\n.vtable__bubble-tooltip-element__content {\n\t/* font-size: .75rem; */\n\tpadding: 6px 8px;\n\tmin-height: 1em;\n\tline-height: 1.5;\n\twidth: 100%;\n\tdisplay: block;\n\twhite-space: pre-wrap;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\toverflow: auto;\n\tword-wrap: break-word;\n\tposition: relative;\n\tbackground-color: #FFF;\n\tz-index: 2;\n\tborder-radius: 4px;\n}\n/* WebKit Microsoft Edge(新版): */\n.vtable__bubble-tooltip-element__content::-webkit-scrollbar {\n width: 0;\n height: 0;\n background-color: transparent;\n}\n/* Opera Firefox */\n.vtable__bubble-tooltip-element__content > scrollbar-track {\n width: 0;\n height: 0;\n background-color: transparent;\n}\n/* Internet Explorer 11 和 Microsoft Edge(旧版) */\n.vtable__bubble-tooltip-element__content > scrollbar {\n width: 0;\n height: 0;\n background-color: transparent;\n}\n.vtable__bubble-tooltip-element__triangle {\n\t/* font-size: .75rem; */\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tdisplay: block;\n\ttransform: rotate(45deg);\n transform-origin: 50% 50% 0;\n\tz-index: 1;\n\tbackground-color: #FFF;\n\tborder: 1px solid #E6E8ED;\n}\n",
|
|
13
13
|
document.head.appendChild(styleElement);
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tooltip/logic/BubbleTooltipElementStyle.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,SAAgB,WAAW;IACzB,IAAI,SAAG,CAAC,IAAI,KAAK,MAAM,EAAE;QACvB,OAAO;KACR;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,GAAG,2BAA2B,CAAC;IAC9C,YAAY,CAAC,WAAW,GAAG
|
|
1
|
+
{"version":3,"sources":["../src/components/tooltip/logic/BubbleTooltipElementStyle.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,SAAgB,WAAW;IACzB,IAAI,SAAG,CAAC,IAAI,KAAK,MAAM,EAAE;QACvB,OAAO;KACR;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,GAAG,2BAA2B,CAAC;IAC9C,YAAY,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoF5B,CAAC;IAEA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC;AA7FD,kCA6FC","file":"BubbleTooltipElementStyle.js","sourcesContent":["import { Env } from '../../../tools/env';\n\nexport function importStyle() {\n if (Env.mode === 'node') {\n return;\n }\n const styleElement = document.createElement('style');\n styleElement.id = 'vtable-tooltip-styleSheet';\n styleElement.textContent = `\n@keyframes vtable__bubble-tooltip-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__bubble-tooltip-element {\n\tposition: absolute;\n\t\n\t// pointer-events: none;\n\t//user-select: none;\n\tmax-width: 300px;\n\tz-index: 99999;\n\n\tbackground: #FFFFFF;\n border: 1px solid #E6E8ED;\n box-sizing: border-box;\n border-radius: 4px;\n box-shadow: 0px 2px 4px rgb(27 31 35 / 8%);\n color: #141414;\n font-size: 13px;\n}\n.vtable__bubble-tooltip-element--hidden {\n\topacity: 0;\n pointer-events: none;\n\tuser-select: none;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n}\n.vtable__bubble-tooltip-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__bubble-tooltip-element--shown-animation 150ms ease-out;\n}\n.vtable__bubble-tooltip-element__content {\n\t/* font-size: .75rem; */\n\tpadding: 6px 8px;\n\tmin-height: 1em;\n\tline-height: 1.5;\n\twidth: 100%;\n\tdisplay: block;\n\twhite-space: pre-wrap;\n\tmargin: 0;\n\tbox-sizing: border-box;\n\toverflow: auto;\n\tword-wrap: break-word;\n\tposition: relative;\n\tbackground-color: #FFF;\n\tz-index: 2;\n\tborder-radius: 4px;\n}\n/* WebKit Microsoft Edge(新版): */\n.vtable__bubble-tooltip-element__content::-webkit-scrollbar {\n width: 0;\n height: 0;\n background-color: transparent;\n}\n/* Opera Firefox */\n.vtable__bubble-tooltip-element__content > scrollbar-track {\n width: 0;\n height: 0;\n background-color: transparent;\n}\n/* Internet Explorer 11 和 Microsoft Edge(旧版) */\n.vtable__bubble-tooltip-element__content > scrollbar {\n width: 0;\n height: 0;\n background-color: transparent;\n}\n.vtable__bubble-tooltip-element__triangle {\n\t/* font-size: .75rem; */\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tdisplay: block;\n\ttransform: rotate(45deg);\n transform-origin: 50% 50% 0;\n\tz-index: 1;\n\tbackground-color: #FFF;\n\tborder: 1px solid #E6E8ED;\n}\n`;\n\n document.head.appendChild(styleElement);\n}\n"]}
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -45,7 +45,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
45
45
|
}
|
|
46
46
|
constructor(container, options = {}) {
|
|
47
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.3.
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.3.1-alpha.1", this.id = `VTable${Date.now()}`,
|
|
49
49
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
50
50
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
51
51
|
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|