@visactor/vtable 0.15.0 → 0.15.2
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/ListTable.d.ts +1 -0
- package/cjs/ListTable.js +32 -14
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +25 -14
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +15 -7
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/menu/dom/logic/MenuElement.js +5 -5
- package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/cjs/components/tooltip/TooltipHandler.js +3 -3
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js +2 -2
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +7 -7
- package/cjs/core/BaseTable.js +52 -35
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/drill.js +3 -3
- package/cjs/event/drill.js.map +1 -1
- package/cjs/event/event.d.ts +1 -1
- package/cjs/event/event.js +19 -19
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.d.ts +2 -2
- package/cjs/event/listener/container-dom.js +6 -7
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/scroll-bar.d.ts +2 -2
- package/cjs/event/listener/scroll-bar.js +16 -16
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/listener/table-group.d.ts +3 -3
- package/cjs/event/listener/table-group.js +77 -67
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/listener/touch.d.ts +2 -2
- package/cjs/event/listener/touch.js +23 -23
- package/cjs/event/listener/touch.js.map +1 -1
- package/cjs/event/pivot-chart/axis-click.js +1 -1
- package/cjs/event/pivot-chart/axis-click.js.map +1 -1
- package/cjs/event/scroll.d.ts +4 -4
- package/cjs/event/scroll.js.map +1 -1
- package/cjs/event/sparkline-event.js +3 -3
- package/cjs/event/sparkline-event.js.map +1 -1
- package/cjs/header-helper/header-helper.js +2 -2
- package/cjs/header-helper/header-helper.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +2 -6
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +17 -7
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/cell-mover.js +6 -6
- package/cjs/scenegraph/component/cell-mover.js.map +1 -1
- package/cjs/scenegraph/component/table-component.js +2 -2
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +12 -9
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +8 -7
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js +2 -2
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +7 -8
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +3 -3
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +3 -3
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +11 -4
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/cjs/scenegraph/layout/auto-height.js +1 -1
- package/cjs/scenegraph/layout/auto-height.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +7 -3
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +12 -8
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/move-cell.js +9 -3
- package/cjs/scenegraph/layout/move-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +1 -1
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +11 -7
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -0
- package/cjs/scenegraph/scenegraph.js +20 -10
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/render-service.js +1 -1
- package/cjs/scenegraph/utils/render-service.js.map +1 -1
- package/cjs/state/cell-move/index.d.ts +4 -4
- package/cjs/state/cell-move/index.js +1 -1
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/state/frozen/index.js.map +1 -1
- package/cjs/state/hover/is-cell-hover.d.ts +2 -2
- package/cjs/state/hover/is-cell-hover.js +2 -2
- package/cjs/state/hover/is-cell-hover.js.map +1 -1
- package/cjs/state/hover/update-position.d.ts +2 -2
- package/cjs/state/hover/update-position.js.map +1 -1
- package/cjs/state/resize/update-resize-column.d.ts +2 -2
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/select/update-position.d.ts +2 -2
- package/cjs/state/select/update-position.js +86 -88
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/sort/index.js +2 -2
- package/cjs/state/sort/index.js.map +1 -1
- package/cjs/state/state.d.ts +1 -1
- package/cjs/state/state.js +8 -8
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/ARCO.js +1 -2
- package/cjs/themes/BRIGHT.js +2 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -1
- package/cjs/tools/NumberMap.js +1 -1
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +6 -6
- package/cjs/ts-types/base-table.js +1 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.js +1 -1
- package/cjs/ts-types/events.d.ts +0 -1
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
- package/dist/vtable.js +588 -420
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -0
- package/es/ListTable.js +33 -14
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +26 -13
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +17 -6
- package/es/PivotTable.js.map +1 -1
- package/es/components/menu/dom/logic/MenuElement.js +5 -5
- package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/es/components/tooltip/TooltipHandler.js +3 -3
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/components/tooltip/logic/BubbleTooltipElement.js +2 -2
- package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
- package/es/core/BaseTable.d.ts +7 -7
- package/es/core/BaseTable.js +55 -38
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/drill.js +3 -3
- package/es/event/drill.js.map +1 -1
- package/es/event/event.d.ts +1 -1
- package/es/event/event.js +16 -16
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.d.ts +2 -2
- package/es/event/listener/container-dom.js +6 -7
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/scroll-bar.d.ts +2 -2
- package/es/event/listener/scroll-bar.js +15 -15
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/listener/table-group.d.ts +3 -3
- package/es/event/listener/table-group.js +77 -66
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/listener/touch.d.ts +2 -2
- package/es/event/listener/touch.js +21 -21
- package/es/event/listener/touch.js.map +1 -1
- package/es/event/pivot-chart/axis-click.js +1 -1
- package/es/event/pivot-chart/axis-click.js.map +1 -1
- package/es/event/scroll.d.ts +4 -4
- package/es/event/scroll.js.map +1 -1
- package/es/event/sparkline-event.js +3 -3
- package/es/event/sparkline-event.js.map +1 -1
- package/es/header-helper/header-helper.js +1 -1
- package/es/header-helper/header-helper.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/layout/chart-helper/get-chart-spec.js +2 -6
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/pivot-header-layout.js +17 -7
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/component/cell-mover.js +6 -6
- package/es/scenegraph/component/cell-mover.js.map +1 -1
- package/es/scenegraph/component/table-component.js +2 -2
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +12 -9
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +7 -7
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js +2 -2
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +7 -6
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +3 -3
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +3 -3
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +11 -4
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/es/scenegraph/layout/auto-height.js +1 -1
- package/es/scenegraph/layout/auto-height.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +7 -3
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +12 -8
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/move-cell.js +9 -3
- package/es/scenegraph/layout/move-cell.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +1 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +11 -7
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -0
- package/es/scenegraph/scenegraph.js +20 -10
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/render-service.js +1 -1
- package/es/scenegraph/utils/render-service.js.map +1 -1
- package/es/state/cell-move/index.d.ts +4 -4
- package/es/state/cell-move/index.js +1 -1
- package/es/state/cell-move/index.js.map +1 -1
- package/es/state/frozen/index.js.map +1 -1
- package/es/state/hover/is-cell-hover.d.ts +2 -2
- package/es/state/hover/is-cell-hover.js +2 -2
- package/es/state/hover/is-cell-hover.js.map +1 -1
- package/es/state/hover/update-position.d.ts +2 -2
- package/es/state/hover/update-position.js.map +1 -1
- package/es/state/resize/update-resize-column.d.ts +2 -2
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/select/update-position.d.ts +2 -2
- package/es/state/select/update-position.js +86 -88
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/sort/index.js +2 -2
- package/es/state/sort/index.js.map +1 -1
- package/es/state/state.d.ts +1 -1
- package/es/state/state.js +6 -6
- package/es/state/state.js.map +1 -1
- package/es/themes/ARCO.js +1 -2
- package/es/themes/BRIGHT.js +2 -1
- package/es/tools/LimitPromiseQueue.js +1 -1
- package/es/tools/NumberMap.js +1 -1
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +6 -6
- package/es/ts-types/base-table.js +1 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.js +1 -1
- package/es/ts-types/events.d.ts +0 -1
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/list-table/define/basic-define.js.map +1 -1
- package/package.json +5 -5
|
@@ -65,8 +65,8 @@ export class TooltipHandler {
|
|
|
65
65
|
table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, (e => {
|
|
66
66
|
var _a;
|
|
67
67
|
if (isMobile()) return;
|
|
68
|
-
const {x1: left, x2: right, y1: top, y2: bottom} = table.
|
|
69
|
-
if (table.
|
|
68
|
+
const {x1: left, x2: right, y1: top, y2: bottom} = table.stateManager.menu.bounds;
|
|
69
|
+
if (table.stateManager.menu.isShow && "number" == typeof e.x && "number" == typeof e.y && e.x > left && e.x < right && e.y > top && e.y < bottom) return;
|
|
70
70
|
const {col: col, row: row} = e;
|
|
71
71
|
if (e.related && this._isBindCell(col, row)) return;
|
|
72
72
|
let tooltipOption;
|
|
@@ -110,7 +110,7 @@ export class TooltipHandler {
|
|
|
110
110
|
const position = this._attachInfo.tooltipOptions.referencePosition, {event: event} = e, {left: left, right: right, top: top, bottom: bottom} = position.rect, abstractPos = table._getMouseAbstractPoint(event, !1);
|
|
111
111
|
abstractPos.inTable && abstractPos.x >= left - 5 && abstractPos.x <= right + 5 && abstractPos.y >= top - 5 && abstractPos.y <= bottom + 5 || this._unbindFromCell();
|
|
112
112
|
}
|
|
113
|
-
this._attachInfo && table.
|
|
113
|
+
this._attachInfo && table.stateManager.menu.isShow && this._bindToCell(e.col, e.row);
|
|
114
114
|
}
|
|
115
115
|
})), table.on(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, (e => {
|
|
116
116
|
e.related && this._isBindCell(e.related.col, e.related.row) || this._unbindFromCell();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tooltip/TooltipHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oB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AAC,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","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.stateManeger.menu.bounds;\n if (\n table.stateManeger.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 if (e.related) {\n if (this._isBindCell(col, row)) {\n return;\n }\n }\n let tooltipOption;\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 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 style: { arrowMark: false }\n };\n }\n }\n if (tooltipOption) {\n this._bindToCell(e.col, e.row, tooltipOption);\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.stateManeger.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 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 _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,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EA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9C,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","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 if (e.related) {\n if (this._isBindCell(col, row)) {\n return;\n }\n }\n let tooltipOption;\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 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 style: { arrowMark: false }\n };\n }\n }\n if (tooltipOption) {\n this._bindToCell(e.col, e.row, tooltipOption);\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 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 _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"]}
|
|
@@ -84,8 +84,8 @@ export class BubbleTooltipElement {
|
|
|
84
84
|
}
|
|
85
85
|
rootElement.style.left = `${tooltipX}px`, rootElement.style.top = `${tooltipY}px`,
|
|
86
86
|
isMobile() && (rootElement.style.fontSize = "11px");
|
|
87
|
-
const {x1: menuLeft, x2: menuRight, y1: menuTop, y2: menuBottom} = table.
|
|
88
|
-
return !(table.
|
|
87
|
+
const {x1: menuLeft, x2: menuRight, y1: menuTop, y2: menuBottom} = table.stateManager.menu.bounds, tooltipLeft = tooltipX, tooltipRight = tooltipLeft + rootElementWidth, tooltipTop = tooltipY, tooltipBottom = tooltipLeft + rootElementHeight;
|
|
88
|
+
return !(table.stateManager.menu.isShow && menuLeft < tooltipRight && menuRight > tooltipLeft && menuBottom > tooltipTop && menuTop < tooltipBottom);
|
|
89
89
|
}
|
|
90
90
|
return !1;
|
|
91
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tooltip/logic/BubbleTooltipElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,WAAW,EAAE,CAAC;AACd,MAAM,aAAa,GAAG,gCAAgC,CAAC;AACvD,MAAM,aAAa,GAAG,GAAG,aAAa,WAAW,CAAC;AAClD,MAAM,cAAc,GAAG,GAAG,aAAa,YAAY,CAAC;AACpD,MAAM,YAAY,GAAG,GAAG,aAAa,UAAU,CAAC;AAChD,MAAM,WAAW,GAAG,GAAG,aAAa,SAAS,CAAC;AAE9C,MAAM,OAAO,oBAAoB;IAK/B;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,YAAY,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QAC9F,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,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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","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 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 bindToCell(\n table: BaseTableAPI,\n col: number,\n row: number,\n tooltipInstanceInfo: TooltipOptions,\n confine: boolean\n ): boolean {\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 const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.classList.remove(SHOWN_CLASS);\n rootElement.classList.add(HIDDEN_CLASS);\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.stateManeger.menu.bounds;\n const tooltipLeft = tooltipX;\n const tooltipRight = tooltipLeft + rootElementWidth;\n const tooltipTop = tooltipY;\n const tooltipBottom = tooltipLeft + rootElementHeight;\n if (\n table.stateManeger.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,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,WAAW,EAAE,CAAC;AACd,MAAM,aAAa,GAAG,gCAAgC,CAAC;AACvD,MAAM,aAAa,GAAG,GAAG,aAAa,WAAW,CAAC;AAClD,MAAM,cAAc,GAAG,GAAG,aAAa,YAAY,CAAC;AACpD,MAAM,YAAY,GAAG,GAAG,aAAa,UAAU,CAAC;AAChD,MAAM,WAAW,GAAG,GAAG,aAAa,SAAS,CAAC;AAE9C,MAAM,OAAO,oBAAoB;IAK/B;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,YAAY,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QAC9F,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACzD,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAClC,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACxC,IAAI,CAAC,eAAe,GAAgB,WAAW,CAAC,aAAa,CAAC,IAAI,aAAa,EAAE,CAAC,IAAI,SAAS,CAAC;QA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K,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","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 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 bindToCell(\n table: BaseTableAPI,\n col: number,\n row: number,\n tooltipInstanceInfo: TooltipOptions,\n confine: boolean\n ): boolean {\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 const rootElement = this._rootElement;\n if (rootElement?.parentElement) {\n rootElement.classList.remove(SHOWN_CLASS);\n rootElement.classList.add(HIDDEN_CLASS);\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"]}
|
package/es/core/BaseTable.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { NumberMap } from '../tools/NumberMap';
|
|
|
6
6
|
import { Rect } from '../tools/Rect';
|
|
7
7
|
import type { TableTheme } from '../themes/theme';
|
|
8
8
|
import { Scenegraph } from '../scenegraph/scenegraph';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { StateManager } from '../state/state';
|
|
10
|
+
import { EventManager } from '../event/event';
|
|
11
11
|
import type { CachedDataSource, DataSource } from '../data';
|
|
12
12
|
import { type ITextSize } from '@visactor/vutils';
|
|
13
13
|
import type { ColumnData, ColumnDefine, ColumnsDefine, IndicatorData } from '../ts-types/list-table/layout-map/api';
|
|
@@ -38,8 +38,8 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
38
38
|
canvasHeight?: number;
|
|
39
39
|
_vDataSet: DataSet;
|
|
40
40
|
scenegraph: Scenegraph;
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
stateManager?: StateManager;
|
|
42
|
+
eventManager?: EventManager;
|
|
43
43
|
_pixelRatio: number;
|
|
44
44
|
static get EVENT_TYPE(): typeof TABLE_EVENT_TYPE;
|
|
45
45
|
readonly options: BaseTableConstructorOptions;
|
|
@@ -117,16 +117,15 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
117
117
|
setPixelRatio(pixelRatio: number): void;
|
|
118
118
|
_updateSize(): void;
|
|
119
119
|
get rowHierarchyType(): 'grid' | 'tree';
|
|
120
|
-
setColWidths(widths: number[]): void;
|
|
121
120
|
getColsWidth(startCol: number, endCol: number): number;
|
|
122
121
|
getRowHeight(row: number): number;
|
|
123
122
|
getDefaultRowHeight(row: number): number | "auto";
|
|
124
|
-
|
|
123
|
+
_setRowHeight(row: number, height: number, clearCache?: boolean): void;
|
|
125
124
|
getRowsHeight(startRow: number, endRow: number): number;
|
|
126
125
|
getColWidthDefined(col: number): string | number;
|
|
127
126
|
getColWidthDefinedNumber(col: number): number;
|
|
128
127
|
getColWidth(col: number): number;
|
|
129
|
-
|
|
128
|
+
_setColWidth(col: number, width: string | number, clearCache?: boolean, skipCheckFrozen?: boolean): void;
|
|
130
129
|
_clearColRangeWidthsMap(col?: number): void;
|
|
131
130
|
_clearRowRangeHeightsMap(row?: number): void;
|
|
132
131
|
_getColContentWidth(col: number): number;
|
|
@@ -329,6 +328,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
329
328
|
hasAutoImageColumn(): ColumnData;
|
|
330
329
|
_getActiveChartInstance(): any;
|
|
331
330
|
cellIsInVisualView(col: number, row: number): boolean;
|
|
331
|
+
getCustomMergeValue(col: number, row: number): string | undefined;
|
|
332
332
|
exportImg(): string;
|
|
333
333
|
exportCellImg(col: number, row: number): string;
|
|
334
334
|
exportCellRangeImg(cellRange: CellRange): string;
|
package/es/core/BaseTable.js
CHANGED
|
@@ -28,9 +28,9 @@ import { Env } from "../tools/env";
|
|
|
28
28
|
|
|
29
29
|
import { Scenegraph } from "../scenegraph/scenegraph";
|
|
30
30
|
|
|
31
|
-
import {
|
|
31
|
+
import { StateManager } from "../state/state";
|
|
32
32
|
|
|
33
|
-
import {
|
|
33
|
+
import { EventManager } from "../event/event";
|
|
34
34
|
|
|
35
35
|
import { BodyHelper } from "../body-helper/body-helper";
|
|
36
36
|
|
|
@@ -72,7 +72,7 @@ export class BaseTable extends EventTarget {
|
|
|
72
72
|
}
|
|
73
73
|
constructor(container, options = {}) {
|
|
74
74
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
75
|
-
if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.15.
|
|
75
|
+
if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.15.2",
|
|
76
76
|
this.id = `VTable${Date.now()}`, this.isReleased = !1, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
77
77
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
78
78
|
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, keyboardOptions: keyboardOptions, columnResizeMode: columnResizeMode, dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth} = options;
|
|
@@ -116,8 +116,8 @@ export class BaseTable extends EventTarget {
|
|
|
116
116
|
internalProps.autoWrapText = options.autoWrapText, internalProps.allowFrozenColCount = null !== (_c = options.allowFrozenColCount) && void 0 !== _c ? _c : internalProps.colCount,
|
|
117
117
|
internalProps.limitMaxAutoWidth = null !== (_d = options.limitMaxAutoWidth) && void 0 !== _d ? _d : 450,
|
|
118
118
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
119
|
-
this._vDataSet = new DataSet, this.scenegraph = new Scenegraph(this), this.
|
|
120
|
-
this.
|
|
119
|
+
this._vDataSet = new DataSet, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this),
|
|
120
|
+
this.eventManager = new EventManager(this), options.legends && (internalProps.legends = createLegend(options.legends, this),
|
|
121
121
|
this.scenegraph.tableGroup.setAttributes({
|
|
122
122
|
x: this.tableX,
|
|
123
123
|
y: this.tableY
|
|
@@ -168,12 +168,12 @@ export class BaseTable extends EventTarget {
|
|
|
168
168
|
set frozenColCount(frozenColCount) {
|
|
169
169
|
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount,
|
|
170
170
|
this.options.frozenColCount = frozenColCount, this.tableNoFrameWidth - this.getColsWidth(0, frozenColCount - 1) <= 120 && (this.internalProps.frozenColCount = 0),
|
|
171
|
-
this.
|
|
171
|
+
this.stateManager.setFrozenCol(this.internalProps.frozenColCount);
|
|
172
172
|
}
|
|
173
173
|
setFrozenColCount(frozenColCount) {
|
|
174
174
|
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount,
|
|
175
175
|
this.options.frozenColCount = frozenColCount, this.tableNoFrameWidth - this.getColsWidth(0, frozenColCount - 1) <= 120 && (this.internalProps.frozenColCount = 0),
|
|
176
|
-
this.
|
|
176
|
+
this.stateManager.setFrozenCol(this.internalProps.frozenColCount);
|
|
177
177
|
}
|
|
178
178
|
_setFrozenColCount(frozenColCount) {
|
|
179
179
|
frozenColCount >= this.colCount && (frozenColCount = 0), this.internalProps.frozenColCount = frozenColCount;
|
|
@@ -338,9 +338,6 @@ export class BaseTable extends EventTarget {
|
|
|
338
338
|
get rowHierarchyType() {
|
|
339
339
|
return "grid";
|
|
340
340
|
}
|
|
341
|
-
setColWidths(widths) {
|
|
342
|
-
widths.forEach(((value, index) => this.setColWidth(index, value)));
|
|
343
|
-
}
|
|
344
341
|
getColsWidth(startCol, endCol) {
|
|
345
342
|
endCol = Math.min(endCol, this.colCount - 1);
|
|
346
343
|
const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
|
|
@@ -365,7 +362,7 @@ export class BaseTable extends EventTarget {
|
|
|
365
362
|
var _a, _b;
|
|
366
363
|
return this.isColumnHeader(0, row) || this.isCornerHeader(0, row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_a = this.defaultHeaderRowHeight[row]) && void 0 !== _a ? _a : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.isBottomFrozenRow(this.rowHeaderLevelCount, row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_b = this.defaultHeaderRowHeight[this.columnHeaderLevelCount > 0 ? this.columnHeaderLevelCount - this.bottomFrozenRowCount : 0]) && void 0 !== _b ? _b : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.internalProps.defaultRowHeight;
|
|
367
364
|
}
|
|
368
|
-
|
|
365
|
+
_setRowHeight(row, height, clearCache) {
|
|
369
366
|
this.rowHeightsMap.put(row, Math.round(height)), clearCache && this._clearRowRangeHeightsMap(row);
|
|
370
367
|
}
|
|
371
368
|
getRowsHeight(startRow, endRow) {
|
|
@@ -402,9 +399,9 @@ export class BaseTable extends EventTarget {
|
|
|
402
399
|
const width = null !== (_a = this.colWidthsMap.get(col)) && void 0 !== _a ? _a : col < this.rowHeaderLevelCount ? Array.isArray(this.defaultHeaderColWidth) ? null !== (_b = this.defaultHeaderColWidth[col]) && void 0 !== _b ? _b : this.defaultColWidth : this.defaultHeaderColWidth : this.defaultColWidth;
|
|
403
400
|
return "adaptive" === this.widthMode && "number" == typeof width || this.transpose && "number" == typeof width ? this._colWidthDefineToPxWidth(width) : this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
|
|
404
401
|
}
|
|
405
|
-
|
|
402
|
+
_setColWidth(col, width, clearCache, skipCheckFrozen) {
|
|
406
403
|
this.colWidthsMap.put(col, "number" == typeof width ? Math.round(width) : width),
|
|
407
|
-
clearCache && this._clearColRangeWidthsMap(col), skipCheckFrozen || this.
|
|
404
|
+
clearCache && this._clearColRangeWidthsMap(col), skipCheckFrozen || this.stateManager.checkFrozen();
|
|
408
405
|
}
|
|
409
406
|
_clearColRangeWidthsMap(col) {
|
|
410
407
|
if ("number" != typeof col) this._colRangeWidthsMap.clear(); else {
|
|
@@ -655,16 +652,16 @@ export class BaseTable extends EventTarget {
|
|
|
655
652
|
return count;
|
|
656
653
|
}
|
|
657
654
|
get scrollTop() {
|
|
658
|
-
return this.
|
|
655
|
+
return this.stateManager.scroll.verticalBarPos;
|
|
659
656
|
}
|
|
660
657
|
set scrollTop(scrollTop) {
|
|
661
|
-
this.
|
|
658
|
+
this.stateManager.setScrollTop(scrollTop);
|
|
662
659
|
}
|
|
663
660
|
get scrollLeft() {
|
|
664
|
-
return this.
|
|
661
|
+
return this.stateManager.scroll.horizontalBarPos;
|
|
665
662
|
}
|
|
666
663
|
set scrollLeft(scrollLeft) {
|
|
667
|
-
this.
|
|
664
|
+
this.stateManager.setScrollLeft(scrollLeft);
|
|
668
665
|
}
|
|
669
666
|
getScrollLeft() {
|
|
670
667
|
return this.scrollLeft;
|
|
@@ -732,12 +729,13 @@ export class BaseTable extends EventTarget {
|
|
|
732
729
|
internalProps._rowRangeHeightsMap = new Map, internalProps._colRangeWidthsMap = new Map,
|
|
733
730
|
internalProps._widthResizedColMap = new Set, this.colWidthsMap = new NumberMap,
|
|
734
731
|
this.colContentWidthsMap = new NumberMap, this.colWidthsLimit = {}, internalProps.theme = themes.of(null !== (_a = options.theme) && void 0 !== _a ? _a : themes.DEFAULT),
|
|
735
|
-
|
|
732
|
+
this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText,
|
|
733
|
+
internalProps.allowFrozenColCount = null !== (_b = options.allowFrozenColCount) && void 0 !== _b ? _b : internalProps.colCount,
|
|
736
734
|
internalProps.limitMaxAutoWidth = null !== (_c = options.limitMaxAutoWidth) && void 0 !== _c ? _c : 450,
|
|
737
735
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
738
736
|
this._vDataSet = new DataSet, null === (_d = internalProps.legends) || void 0 === _d || _d.release(),
|
|
739
737
|
null === (_e = internalProps.title) || void 0 === _e || _e.release(), internalProps.layoutMap.release(),
|
|
740
|
-
this.scenegraph.clearCells(), this.
|
|
738
|
+
this.scenegraph.clearCells(), this.stateManager.initState(), this._updateSize(),
|
|
741
739
|
options.legends && (internalProps.legends = createLegend(options.legends, this),
|
|
742
740
|
this.scenegraph.tableGroup.setAttributes({
|
|
743
741
|
x: this.tableX,
|
|
@@ -754,8 +752,13 @@ export class BaseTable extends EventTarget {
|
|
|
754
752
|
this.clearRowHeightCache();
|
|
755
753
|
}
|
|
756
754
|
renderWithRecreateCells() {
|
|
755
|
+
const oldHoverState = {
|
|
756
|
+
col: this.stateManager.hover.cellPos.col,
|
|
757
|
+
row: this.stateManager.hover.cellPos.row
|
|
758
|
+
};
|
|
757
759
|
this.refreshHeader(), this.scenegraph.clearCells(), this.headerStyleCache = new Map,
|
|
758
|
-
this.bodyStyleCache = new Map, this.scenegraph.createSceneGraph(), this.
|
|
760
|
+
this.bodyStyleCache = new Map, this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row),
|
|
761
|
+
this.render();
|
|
759
762
|
}
|
|
760
763
|
getFrozenRowsHeight() {
|
|
761
764
|
return this.getRowsHeight(0, this.frozenRowCount - 1);
|
|
@@ -903,17 +906,17 @@ export class BaseTable extends EventTarget {
|
|
|
903
906
|
return Math.min(Math.ceil(absoluteX / this.internalProps.defaultColWidth), this.colCount - 1);
|
|
904
907
|
}
|
|
905
908
|
clearSelected() {
|
|
906
|
-
this.
|
|
909
|
+
this.stateManager.updateSelectPos(-1, -1);
|
|
907
910
|
}
|
|
908
911
|
selectCell(col, row) {
|
|
909
|
-
this.
|
|
912
|
+
this.stateManager.updateSelectPos(col, row), this.stateManager.endSelectCells();
|
|
910
913
|
}
|
|
911
914
|
selectCells(cellRanges) {
|
|
912
915
|
const {scrollLeft: scrollLeft, scrollTop: scrollTop} = this;
|
|
913
916
|
cellRanges.forEach(((cellRange, index) => {
|
|
914
|
-
this.
|
|
915
|
-
this.
|
|
916
|
-
this.
|
|
917
|
+
cellRange.start.col === cellRange.end.col && cellRange.start.row === cellRange.end.row ? this.stateManager.updateSelectPos(cellRange.start.col, cellRange.start.row, !1, index >= 1) : (this.stateManager.updateSelectPos(cellRange.start.col, cellRange.start.row, !1, index >= 1),
|
|
918
|
+
this.stateManager.updateInteractionState(InteractionState.grabing), this.stateManager.updateSelectPos(cellRange.end.col, cellRange.end.row, !1, index >= 1)),
|
|
919
|
+
this.stateManager.endSelectCells(!1), this.stateManager.updateInteractionState(InteractionState.default);
|
|
917
920
|
})), this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft);
|
|
918
921
|
}
|
|
919
922
|
get allowFrozenColCount() {
|
|
@@ -953,9 +956,14 @@ export class BaseTable extends EventTarget {
|
|
|
953
956
|
this.internalProps.theme = themes.of(null != theme ? theme : themes.DEFAULT), this.options.theme = theme;
|
|
954
957
|
}
|
|
955
958
|
updateTheme(theme) {
|
|
959
|
+
const oldHoverState = {
|
|
960
|
+
col: this.stateManager.hover.cellPos.col,
|
|
961
|
+
row: this.stateManager.hover.cellPos.row
|
|
962
|
+
};
|
|
956
963
|
this.internalProps.theme = themes.of(null != theme ? theme : themes.DEFAULT), this.options.theme = theme,
|
|
957
|
-
this.scenegraph.
|
|
958
|
-
this.scenegraph.createSceneGraph(), this.
|
|
964
|
+
this.scenegraph.updateStageBackground(), this.scenegraph.clearCells(), this.headerStyleCache = new Map,
|
|
965
|
+
this.bodyStyleCache = new Map, this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row),
|
|
966
|
+
this.render();
|
|
959
967
|
}
|
|
960
968
|
getBodyField(col, row) {
|
|
961
969
|
return this.internalProps.layoutMap.getBody(col, row).field;
|
|
@@ -1038,7 +1046,7 @@ export class BaseTable extends EventTarget {
|
|
|
1038
1046
|
col: col,
|
|
1039
1047
|
row: row,
|
|
1040
1048
|
table: this,
|
|
1041
|
-
value:
|
|
1049
|
+
value: customMerge.text,
|
|
1042
1050
|
dataValue: this.getCellOriginValue(col, row),
|
|
1043
1051
|
cellHeaderPaths: this.getCellHeaderPaths(col, row)
|
|
1044
1052
|
}, styleClass, this.options.autoWrapText);
|
|
@@ -1068,10 +1076,10 @@ export class BaseTable extends EventTarget {
|
|
|
1068
1076
|
return description;
|
|
1069
1077
|
}
|
|
1070
1078
|
setDropDownMenuHighlight(cells) {
|
|
1071
|
-
this.
|
|
1079
|
+
this.stateManager.setDropDownMenuHighlight(cells);
|
|
1072
1080
|
}
|
|
1073
1081
|
_dropDownMenuIsHighlight(colNow, rowNow, index) {
|
|
1074
|
-
return this.
|
|
1082
|
+
return this.stateManager.dropDownMenuIsHighlight(colNow, rowNow, index);
|
|
1075
1083
|
}
|
|
1076
1084
|
isHeader(col, row) {
|
|
1077
1085
|
return this.internalProps.layoutMap && this.internalProps.layoutMap.isHeader(col, row);
|
|
@@ -1208,8 +1216,8 @@ export class BaseTable extends EventTarget {
|
|
|
1208
1216
|
return !(limit && limit.min && limit.max) || limit.max !== limit.min;
|
|
1209
1217
|
}
|
|
1210
1218
|
_canDragHeaderPosition(col, row) {
|
|
1211
|
-
if (this.isHeader(col, row) && this.
|
|
1212
|
-
const selectRange = this.
|
|
1219
|
+
if (this.isHeader(col, row) && this.stateManager.isSelected(col, row)) {
|
|
1220
|
+
const selectRange = this.stateManager.select.ranges[0];
|
|
1213
1221
|
if (this.isColumnHeader(col, row)) {
|
|
1214
1222
|
if (selectRange.end.row !== this.rowCount - 1) return !1;
|
|
1215
1223
|
} else {
|
|
@@ -1239,7 +1247,7 @@ export class BaseTable extends EventTarget {
|
|
|
1239
1247
|
showDropDownMenu(col, row, dropDownMenuOptions) {
|
|
1240
1248
|
let menuType = "dropdown-menu";
|
|
1241
1249
|
dropDownMenuOptions && (menuType = Array.isArray(dropDownMenuOptions.content) ? "dropdown-menu" : "container"),
|
|
1242
|
-
"html" === this.internalProps.menu.renderMode && (this.
|
|
1250
|
+
"html" === this.internalProps.menu.renderMode && (this.stateManager.menu.isShow = !0,
|
|
1243
1251
|
this.internalProps.menuHandler._bindToCell(col, row, menuType, dropDownMenuOptions));
|
|
1244
1252
|
}
|
|
1245
1253
|
showTooltip(col, row, tooltipOptions) {
|
|
@@ -1301,8 +1309,8 @@ export class BaseTable extends EventTarget {
|
|
|
1301
1309
|
}
|
|
1302
1310
|
getCopyValue() {
|
|
1303
1311
|
var _a, _b;
|
|
1304
|
-
if ((null === (_b = null === (_a = this.
|
|
1305
|
-
const ranges = this.
|
|
1312
|
+
if ((null === (_b = null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.ranges) || void 0 === _b ? void 0 : _b.length) > 0) {
|
|
1313
|
+
const ranges = this.stateManager.select.ranges;
|
|
1306
1314
|
let minCol = Math.min(ranges[0].start.col, ranges[0].end.col), maxCol = Math.max(ranges[0].start.col, ranges[0].end.col), minRow = Math.min(ranges[0].start.row, ranges[0].end.row), maxRow = Math.max(ranges[0].start.row, ranges[0].end.row);
|
|
1307
1315
|
ranges.forEach((a => {
|
|
1308
1316
|
minCol = Math.min(minCol, a.start.col, a.end.col), maxCol = Math.max(maxCol, a.start.col, a.end.col),
|
|
@@ -1361,8 +1369,8 @@ export class BaseTable extends EventTarget {
|
|
|
1361
1369
|
}
|
|
1362
1370
|
getSelectedCellInfos() {
|
|
1363
1371
|
var _a;
|
|
1364
|
-
if (!(null === (_a = this.
|
|
1365
|
-
const ranges = this.
|
|
1372
|
+
if (!(null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.ranges)) return null;
|
|
1373
|
+
const ranges = this.stateManager.select.ranges;
|
|
1366
1374
|
if (!ranges.length) return [];
|
|
1367
1375
|
let minCol = Math.min(ranges[0].start.col, ranges[0].end.col), maxCol = Math.max(ranges[0].start.col, ranges[0].end.col), minRow = Math.min(ranges[0].start.row, ranges[0].end.row), maxRow = Math.max(ranges[0].start.row, ranges[0].end.row);
|
|
1368
1376
|
ranges.forEach((a => {
|
|
@@ -1434,13 +1442,22 @@ export class BaseTable extends EventTarget {
|
|
|
1434
1442
|
}
|
|
1435
1443
|
_getActiveChartInstance() {
|
|
1436
1444
|
var _a, _b, _c, _d, _e, _f;
|
|
1437
|
-
const cellGroup = this.scenegraph.getCell(null === (_b = null === (_a = this.
|
|
1445
|
+
const cellGroup = this.scenegraph.getCell(null === (_b = null === (_a = this.stateManager.hover) || void 0 === _a ? void 0 : _a.cellPos) || void 0 === _b ? void 0 : _b.col, null === (_d = null === (_c = this.stateManager.hover) || void 0 === _c ? void 0 : _c.cellPos) || void 0 === _d ? void 0 : _d.row);
|
|
1438
1446
|
return "chart" === (null === (_f = null === (_e = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _e ? void 0 : _e[0]) || void 0 === _f ? void 0 : _f.type) ? cellGroup.getChildren()[0].activeChartInstance : null;
|
|
1439
1447
|
}
|
|
1440
1448
|
cellIsInVisualView(col, row) {
|
|
1441
1449
|
const drawRange = this.getDrawRange(), rect = this.getCellRelativeRect(col, row);
|
|
1442
1450
|
return col < this.frozenColCount && row < this.frozenRowCount || rect.top >= drawRange.top && rect.bottom <= drawRange.bottom && rect.left >= drawRange.left && rect.right <= drawRange.right;
|
|
1443
1451
|
}
|
|
1452
|
+
getCustomMergeValue(col, row) {
|
|
1453
|
+
if (this.internalProps.customMergeCell) {
|
|
1454
|
+
const customMerge = this.getCustomMerge(col, row);
|
|
1455
|
+
if (customMerge) {
|
|
1456
|
+
const {text: text} = customMerge;
|
|
1457
|
+
return text;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1444
1461
|
exportImg() {
|
|
1445
1462
|
return this.scenegraph.stage.toCanvas().toDataURL();
|
|
1446
1463
|
}
|