@visactor/vtable 0.10.0 → 0.10.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/ListTable.d.ts +1 -2
- package/cjs/ListTable.js +2 -5
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +10 -8
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +8 -5
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/axis/get-axis-attributes.d.ts +2 -0
- package/cjs/components/axis/get-axis-attributes.js +3 -1
- package/cjs/components/axis/get-axis-attributes.js.map +1 -1
- package/cjs/components/axis/get-axis-component-size.js +65 -33
- package/cjs/components/axis/get-axis-component-size.js.map +1 -1
- package/cjs/components/tooltip/TooltipHandler.js +2 -0
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +4 -2
- package/cjs/core/BaseTable.js +29 -30
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/drill.js +2 -0
- package/cjs/event/drill.js.map +1 -1
- package/cjs/event/event.js +1 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/table-group.js +19 -9
- package/cjs/event/listener/table-group.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/pivot-header-layout.d.ts +1 -0
- package/cjs/layout/pivot-header-layout.js +28 -4
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.js +22 -10
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/table-component.d.ts +3 -3
- package/cjs/scenegraph/component/table-component.js +6 -6
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/component/util.d.ts +1 -1
- package/cjs/scenegraph/component/util.js +2 -1
- package/cjs/scenegraph/component/util.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +7 -21
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +9 -4
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -0
- package/cjs/scenegraph/scenegraph.js +20 -21
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/update-container.d.ts +2 -0
- package/cjs/scenegraph/utils/update-container.js +13 -0
- package/cjs/scenegraph/utils/update-container.js.map +1 -0
- package/cjs/state/resize/update-resize-column.d.ts +2 -0
- package/cjs/state/resize/update-resize-column.js +74 -0
- package/cjs/state/resize/update-resize-column.js.map +1 -0
- package/cjs/state/sort/index.js +4 -2
- package/cjs/state/sort/index.js.map +1 -1
- package/cjs/state/state.d.ts +2 -1
- package/cjs/state/state.js +5 -24
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +3 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +1 -1
- package/cjs/ts-types/events.js.map +1 -1
- package/dist/vtable.js +1936 -726
- package/dist/vtable.min.js +3 -3
- package/es/ListTable.d.ts +1 -2
- package/es/ListTable.js +2 -5
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +10 -8
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +8 -5
- package/es/PivotTable.js.map +1 -1
- package/es/components/axis/get-axis-attributes.d.ts +2 -0
- package/es/components/axis/get-axis-attributes.js +3 -1
- package/es/components/axis/get-axis-attributes.js.map +1 -1
- package/es/components/axis/get-axis-component-size.js +65 -33
- package/es/components/axis/get-axis-component-size.js.map +1 -1
- package/es/components/tooltip/TooltipHandler.js +2 -0
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/core/BaseTable.d.ts +4 -2
- package/es/core/BaseTable.js +28 -28
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/drill.js +2 -0
- package/es/event/drill.js.map +1 -1
- package/es/event/event.js +1 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/table-group.js +19 -9
- package/es/event/listener/table-group.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/pivot-header-layout.d.ts +1 -0
- package/es/layout/pivot-header-layout.js +26 -4
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/simple-header-layout.js +22 -10
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/table-component.d.ts +3 -3
- package/es/scenegraph/component/table-component.js +6 -6
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/component/util.d.ts +1 -1
- package/es/scenegraph/component/util.js +2 -1
- package/es/scenegraph/component/util.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +7 -21
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +9 -4
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -0
- package/es/scenegraph/scenegraph.js +18 -20
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/update-container.d.ts +2 -0
- package/es/scenegraph/utils/update-container.js +7 -0
- package/es/scenegraph/utils/update-container.js.map +1 -0
- package/es/state/resize/update-resize-column.d.ts +2 -0
- package/es/state/resize/update-resize-column.js +68 -0
- package/es/state/resize/update-resize-column.js.map +1 -0
- package/es/state/sort/index.js +4 -2
- package/es/state/sort/index.js.map +1 -1
- package/es/state/state.d.ts +2 -1
- package/es/state/state.js +6 -23
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +3 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +1 -1
- package/es/ts-types/events.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["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,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,wBAAwB,GAAG;IAI/B,gBAAgB,EAAE,UAAU,KAAmB;QAC7C,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF,CAAC;AAOF,MAAM,OAAO,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,CAAC,WAAW,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG,EAAE,GAAG,C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AC7E;QACH,CAAC,CAAC,CAAC;IACL,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","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 if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {\n const overflowText = table.getCellOverflowText(col, row);\n const headerDescription = table.getHeaderDescription(col, row);\n const rect = table.getCellRangeRelativeRect({ col, row });\n let tooltipOption;\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 if (headerDescription) {\n tooltipOption = {\n content: headerDescription,\n referencePosition: {\n placement: Placement.bottom,\n rect\n },\n style: { arrowMark: false }\n };\n }\n if (tooltipOption) {\n this._bindToCell(e.col, e.row, tooltipOption);\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.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.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":["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,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,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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 if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {\n const overflowText = table.getCellOverflowText(col, row);\n const headerDescription = table.getHeaderDescription(col, row);\n const rect = table.getCellRangeRelativeRect({ col, row });\n let tooltipOption;\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 if (headerDescription) {\n tooltipOption = {\n content: headerDescription,\n referencePosition: {\n placement: Placement.bottom,\n rect\n },\n style: { arrowMark: false }\n };\n }\n if (tooltipOption) {\n this._bindToCell(e.col, e.row, tooltipOption);\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.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"]}
|
package/es/core/BaseTable.d.ts
CHANGED
|
@@ -119,7 +119,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
119
119
|
getRowHeight(row: number): number;
|
|
120
120
|
setRowHeight(row: number, height: number, clearCache?: boolean): void;
|
|
121
121
|
getRowsHeight(startRow: number, endRow: number): number;
|
|
122
|
-
|
|
122
|
+
getColWidthDefined(col: number): string | number;
|
|
123
123
|
getColWidth(col: number): number;
|
|
124
124
|
setColWidth(col: number, width: string | number, clearCache?: boolean, skipCheckFrozen?: boolean): void;
|
|
125
125
|
_clearColRangeWidthsMap(col?: number): void;
|
|
@@ -235,7 +235,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
235
235
|
get autoWrapText(): boolean;
|
|
236
236
|
set autoWrapText(autoWrapText: boolean);
|
|
237
237
|
get theme(): TableTheme;
|
|
238
|
-
|
|
238
|
+
updateTheme(theme: TableTheme): void;
|
|
239
239
|
getBodyField(col: number, row: number): FieldDef | undefined;
|
|
240
240
|
getBodyColumnDefine(col: number, row: number): ColumnDefine;
|
|
241
241
|
getBodyColumnType(col: number, row: number): ColumnTypeOption;
|
|
@@ -269,6 +269,8 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
269
269
|
_hasField(field: FieldDef, col: number, row: number): boolean;
|
|
270
270
|
_getCellStyle(col: number, row: number): FullExtendStyle;
|
|
271
271
|
clearCellStyleCache(): void;
|
|
272
|
+
clearRowHeightCache(): void;
|
|
273
|
+
clearColWidthCache(): void;
|
|
272
274
|
_canResizeColumn(col: number, row: number): boolean;
|
|
273
275
|
_canDragHeaderPosition(col: number, row: number): boolean;
|
|
274
276
|
getCellIcons(col: number, row: number): ColumnIconOption[];
|
package/es/core/BaseTable.js
CHANGED
|
@@ -74,7 +74,7 @@ export class BaseTable extends EventTarget {
|
|
|
74
74
|
}
|
|
75
75
|
constructor(container, options = {}) {
|
|
76
76
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
77
|
-
if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.10.
|
|
77
|
+
if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.10.1-alpha.1",
|
|
78
78
|
this.id = `VTable${Date.now()}`, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
79
79
|
!container) throw new Error("vtable's container is undefined");
|
|
80
80
|
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !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} = options;
|
|
@@ -102,8 +102,8 @@ export class BaseTable extends EventTarget {
|
|
|
102
102
|
internalProps.dragHeaderMode = dragHeaderMode, internalProps.renderChartAsync = renderChartAsync,
|
|
103
103
|
setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps._rowHeightsMap = new NumberMap,
|
|
104
104
|
internalProps._rowRangeHeightsMap = new Map, internalProps._colRangeWidthsMap = new Map,
|
|
105
|
-
|
|
106
|
-
internalProps.calcWidthContext = {
|
|
105
|
+
internalProps._widthResizedColMap = new Set, this.colWidthsMap = new NumberMap,
|
|
106
|
+
this.colContentWidthsMap = new NumberMap, this.colWidthsLimit = {}, internalProps.calcWidthContext = {
|
|
107
107
|
_: internalProps,
|
|
108
108
|
get full() {
|
|
109
109
|
var _a;
|
|
@@ -341,23 +341,12 @@ export class BaseTable extends EventTarget {
|
|
|
341
341
|
if (null != cachedColWidth) return cachedColWidth;
|
|
342
342
|
const cachedLowerColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol - 1}`);
|
|
343
343
|
if (null != cachedLowerColWidth) {
|
|
344
|
-
const
|
|
345
|
-
let adjustW;
|
|
346
|
-
adjustW = width ? "adaptive" === this.widthMode || this.transpose ? Number(width) : this._adjustColWidth(endCol, this._colWidthDefineToPxWidth(width)) : this.getColWidth(endCol);
|
|
347
|
-
const addWidth = cachedLowerColWidth + adjustW;
|
|
344
|
+
const addWidth = cachedLowerColWidth + this.getColWidth(endCol);
|
|
348
345
|
return startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
|
|
349
346
|
Math.round(addWidth);
|
|
350
347
|
}
|
|
351
348
|
let w = 0;
|
|
352
349
|
for (let col = startCol; col <= endCol; col++) w += this.getColWidth(col);
|
|
353
|
-
this.colWidthsMap.each(startCol, endCol, ((width, col) => {
|
|
354
|
-
w += ("adaptive" === this.widthMode || this.transpose ? Number(width) : this._adjustColWidth(col, this._colWidthDefineToPxWidth(width))) - this.getColWidth(col);
|
|
355
|
-
}));
|
|
356
|
-
for (let col = startCol; col <= endCol; col++) {
|
|
357
|
-
if (this.colWidthsMap.has(col)) continue;
|
|
358
|
-
const adj = this._adjustColWidth(col, this.internalProps.defaultColWidth);
|
|
359
|
-
adj !== this.internalProps.defaultColWidth && (w += adj - this.internalProps.defaultColWidth);
|
|
360
|
-
}
|
|
361
350
|
return startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
|
|
362
351
|
Math.round(w);
|
|
363
352
|
}
|
|
@@ -386,13 +375,15 @@ export class BaseTable extends EventTarget {
|
|
|
386
375
|
return startRow >= 0 && endRow >= 0 && h > 0 && this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(h)),
|
|
387
376
|
Math.round(h);
|
|
388
377
|
}
|
|
389
|
-
|
|
390
|
-
var _a, _b;
|
|
391
|
-
const
|
|
392
|
-
|
|
378
|
+
getColWidthDefined(col) {
|
|
379
|
+
var _a, _b, _c;
|
|
380
|
+
const {layoutMap: layoutMap} = this.internalProps;
|
|
381
|
+
if ("autoWidth" === this.widthMode) return "auto";
|
|
382
|
+
const {width: width} = null !== (_a = null == layoutMap ? void 0 : layoutMap.getColumnWidthDefined(col)) && void 0 !== _a ? _a : {};
|
|
383
|
+
return "number" == typeof width && width <= 0 ? 0 : width || (this.isRowHeader(col, 0) || this.isCornerHeader(col, 0) ? Array.isArray(this.defaultHeaderColWidth) ? null !== (_b = this.defaultHeaderColWidth[col]) && void 0 !== _b ? _b : this.defaultColWidth : this.defaultHeaderColWidth : this.isRightFrozenColumn(col, this.columnHeaderLevelCount) && this.isPivotTable() ? Array.isArray(this.defaultHeaderColWidth) ? null !== (_c = this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount]) && void 0 !== _c ? _c : this.defaultColWidth : this.defaultHeaderColWidth : this.defaultColWidth);
|
|
393
384
|
}
|
|
394
385
|
getColWidth(col) {
|
|
395
|
-
const width = this.
|
|
386
|
+
const width = this.colWidthsMap.get(col);
|
|
396
387
|
return "adaptive" === this.widthMode && "number" == typeof width || this.transpose && "number" == typeof width ? this._colWidthDefineToPxWidth(width) : this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
|
|
397
388
|
}
|
|
398
389
|
setColWidth(col, width, clearCache, skipCheckFrozen) {
|
|
@@ -689,8 +680,9 @@ export class BaseTable extends EventTarget {
|
|
|
689
680
|
internalProps.dragHeaderMode = dragHeaderMode, internalProps.renderChartAsync = renderChartAsync,
|
|
690
681
|
setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.cellTextOverflows = {},
|
|
691
682
|
internalProps._rowHeightsMap = new NumberMap, internalProps._rowRangeHeightsMap = new Map,
|
|
692
|
-
internalProps._colRangeWidthsMap = new Map,
|
|
693
|
-
this.
|
|
683
|
+
internalProps._colRangeWidthsMap = new Map, internalProps._widthResizedColMap = new Set,
|
|
684
|
+
this.colWidthsMap = new NumberMap, this.colContentWidthsMap = new NumberMap, this.colWidthsLimit = {},
|
|
685
|
+
internalProps.theme = themes.of(null !== (_a = options.theme) && void 0 !== _a ? _a : themes.DEFAULT),
|
|
694
686
|
internalProps.autoWrapText = options.autoWrapText, internalProps.allowFrozenColCount = null !== (_b = options.allowFrozenColCount) && void 0 !== _b ? _b : internalProps.colCount,
|
|
695
687
|
internalProps.limitMaxAutoWidth = null !== (_c = options.limitMaxAutoWidth) && void 0 !== _c ? _c : 450,
|
|
696
688
|
this.dataSet = new DataSet, null === (_d = internalProps.legends) || void 0 === _d || _d.release(),
|
|
@@ -711,7 +703,8 @@ export class BaseTable extends EventTarget {
|
|
|
711
703
|
internalProps.menu = Object.assign({
|
|
712
704
|
renderMode: "html"
|
|
713
705
|
}, options.menu), "html" !== internalProps.menu.renderMode || internalProps.menuHandler || (internalProps.menuHandler = new MenuHandler(this)),
|
|
714
|
-
this.headerStyleCache = new Map, this.bodyStyleCache = new Map
|
|
706
|
+
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.clearColWidthCache(),
|
|
707
|
+
this.clearRowHeightCache();
|
|
715
708
|
}
|
|
716
709
|
getFrozenRowsHeight() {
|
|
717
710
|
return this.getRowsHeight(0, this.frozenRowCount - 1);
|
|
@@ -900,9 +893,10 @@ export class BaseTable extends EventTarget {
|
|
|
900
893
|
get theme() {
|
|
901
894
|
return this.internalProps.theme;
|
|
902
895
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
this.
|
|
896
|
+
updateTheme(theme) {
|
|
897
|
+
this.internalProps.theme = themes.of(null != theme ? theme : themes.DEFAULT), this.options.theme = theme,
|
|
898
|
+
this.scenegraph.clearCells(), this.headerStyleCache = new Map, this.bodyStyleCache = new Map,
|
|
899
|
+
this.scenegraph.createSceneGraph(), this.render();
|
|
906
900
|
}
|
|
907
901
|
getBodyField(col, row) {
|
|
908
902
|
return this.internalProps.layoutMap.getBody(col, row).field;
|
|
@@ -988,8 +982,8 @@ export class BaseTable extends EventTarget {
|
|
|
988
982
|
setRecords(records, sort) {
|
|
989
983
|
var _a, _b;
|
|
990
984
|
const time = "undefined" != typeof window ? window.performance.now() : 0;
|
|
991
|
-
if (this.scenegraph.clearCells(), void 0 !== sort && (this.sortState = sort,
|
|
992
|
-
records) {
|
|
985
|
+
if (this.scenegraph.clearCells(), void 0 !== sort && (this.internalProps.sortState = sort,
|
|
986
|
+
this.stateManeger.setSortState(this.sortState)), records) {
|
|
993
987
|
if (_setRecords(this, records), this.sortState) {
|
|
994
988
|
let order, field, fieldKey;
|
|
995
989
|
if (Array.isArray(this.sortState) ? 0 !== this.sortState.length && ({order: order, field: field, fieldKey: fieldKey} = null === (_a = this.sortState) || void 0 === _a ? void 0 : _a[0]) : ({order: order, field: field, fieldKey: fieldKey} = this.sortState),
|
|
@@ -1116,6 +1110,12 @@ export class BaseTable extends EventTarget {
|
|
|
1116
1110
|
clearCellStyleCache() {
|
|
1117
1111
|
this.headerStyleCache.clear();
|
|
1118
1112
|
}
|
|
1113
|
+
clearRowHeightCache() {
|
|
1114
|
+
this.internalProps._rowHeightsMap.clear(), this._clearRowRangeHeightsMap();
|
|
1115
|
+
}
|
|
1116
|
+
clearColWidthCache() {
|
|
1117
|
+
this.internalProps._colWidthsMap.clear(), this._clearColRangeWidthsMap();
|
|
1118
|
+
}
|
|
1119
1119
|
_canResizeColumn(col, row) {
|
|
1120
1120
|
if (!(col >= 0 && row >= 0)) return !1;
|
|
1121
1121
|
if (this.isCellRangeEqual(col, row, col + 1, row)) return !1;
|