@visactor/vtable 0.23.2 → 0.23.3
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.js +4 -1
- package/cjs/ListTable.js.map +1 -1
- package/cjs/body-helper/body-helper.js +2 -1
- package/cjs/body-helper/body-helper.js.map +1 -1
- package/cjs/components/tooltip/TooltipHandler.d.ts +1 -0
- package/cjs/components/tooltip/TooltipHandler.js +36 -33
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +10 -2
- package/cjs/core/BaseTable.js +28 -9
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/FouseInput.js +2 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/row-series-number-helper.js +1 -2
- package/cjs/event/event.d.ts +3 -2
- package/cjs/event/event.js +10 -8
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/scroll-bar.js +9 -3
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/listener/table-group.js +17 -17
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/listener/touch.js +20 -18
- package/cjs/event/listener/touch.js.map +1 -1
- package/cjs/header-helper/header-helper.js +2 -1
- 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 -2
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/tree-helper.js +1 -0
- package/cjs/plugins/custom-cell-style.d.ts +1 -0
- package/cjs/plugins/custom-cell-style.js +7 -0
- package/cjs/plugins/custom-cell-style.js.map +1 -1
- package/cjs/plugins/themes.js +1 -2
- package/cjs/scenegraph/component/table-component.js +2 -2
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +3 -2
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +8 -5
- 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/scenegraph.js +2 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.js +1 -1
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/utils/text-measure.d.ts +1 -0
- package/cjs/scenegraph/utils/text-measure.js +11 -1
- package/cjs/scenegraph/utils/text-measure.js.map +1 -1
- package/cjs/state/state.js +5 -4
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +5 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +10 -2
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +2 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +731 -627
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +3 -1
- package/es/ListTable.js.map +1 -1
- package/es/body-helper/body-helper.js +2 -1
- package/es/body-helper/body-helper.js.map +1 -1
- package/es/components/tooltip/TooltipHandler.d.ts +1 -0
- package/es/components/tooltip/TooltipHandler.js +36 -33
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/core/BaseTable.d.ts +10 -2
- package/es/core/BaseTable.js +29 -10
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/FouseInput.js +2 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/row-series-number-helper.js +1 -2
- package/es/event/event.d.ts +3 -2
- package/es/event/event.js +10 -8
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/scroll-bar.js +10 -2
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/listener/table-group.js +17 -17
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/listener/touch.js +19 -15
- package/es/event/listener/touch.js.map +1 -1
- package/es/header-helper/header-helper.js +2 -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 +4 -2
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/tree-helper.js +2 -1
- package/es/plugins/custom-cell-style.d.ts +1 -0
- package/es/plugins/custom-cell-style.js +7 -0
- package/es/plugins/custom-cell-style.js.map +1 -1
- package/es/plugins/themes.js +1 -2
- package/es/scenegraph/component/table-component.js +2 -2
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +4 -1
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +8 -5
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +14 -9
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/scenegraph.js +1 -4
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/stick-text/index.js +1 -1
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/utils/text-measure.d.ts +1 -0
- package/es/scenegraph/utils/text-measure.js +9 -1
- package/es/scenegraph/utils/text-measure.js.map +1 -1
- package/es/state/state.js +5 -4
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +5 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +10 -2
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +2 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
|
@@ -87,7 +87,8 @@ export class BodyHelper {
|
|
|
87
87
|
return hierarchyState === HierarchyState.expand ? this.expandIcon : hierarchyState === HierarchyState.collapse ? this.collapseIcon : void 0;
|
|
88
88
|
}
|
|
89
89
|
getHierarchyIconWidth() {
|
|
90
|
-
|
|
90
|
+
var _a, _b;
|
|
91
|
+
return this.expandIcon.width + (null !== (_a = this.expandIcon.marginLeft) && void 0 !== _a ? _a : 0) + (null !== (_b = this.expandIcon.marginRight) && void 0 !== _b ? _b : 0);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
//# sourceMappingURL=body-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/body-helper/body-helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,aAAa,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,MAAM,OAAO,UAAU;IAIrB,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,gBAAgB,CAAC,cAAc,CAA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BAChB;qBAAM,IAAI,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,SAAS,mDAAG,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,EAAE;oBACzD,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;iBACzB;aACF;QACH,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,gBAAgB,CAAC,GAAW,EAAE,GAAW;QACvC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/D,IAAI,cAAc,KAAK,cAAc,CAAC,MAAM,EAAE;YAE5C,OAAO,IAAI,CAAC,UAAU,CAAC;SACxB;aAAM,IAAI,cAAc,KAAK,cAAc,CAAC,QAAQ,EAAE;YAErD,OAAO,IAAI,CAAC,YAAY,CAAC;SAC1B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,qBAAqB;;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,WAAW,mCAAI,CAAC,CAAC,CAAC;IACxG,CAAC;CACF","file":"body-helper.js","sourcesContent":["import type { ColumnIconOption, ImageIcon, ListTableAPI, SvgIcon } from '../ts-types';\nimport { HierarchyState, InternalIconName } from '../ts-types';\nimport * as registerIcons from '../icons';\nimport { Style } from './style/Style';\nimport { TextStyle } from './style/MultilineTextStyle';\nimport { ProgressBarStyle } from './style/ProgressBarStyle';\nimport { ImageStyle } from './style/ImageStyle';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport * as icons from '../tools/icons';\nimport { obj } from '../tools/helper';\nimport { CheckboxStyle } from './style/CheckboxStyle';\nexport class BodyHelper {\n expandIcon: SvgIcon;\n collapseIcon: SvgIcon;\n _table: BaseTableAPI;\n constructor(_table: BaseTableAPI) {\n this._table = _table;\n const regedIcons = registerIcons.get();\n //展开折叠按钮\n this.expandIcon = regedIcons[InternalIconName.expandIconName] as SvgIcon;\n this.collapseIcon = regedIcons[InternalIconName.collapseIconName] as SvgIcon;\n }\n getIcons(\n col: number,\n row: number,\n cellValue: any,\n dataValue: any,\n context: CanvasRenderingContext2D\n ): ColumnIconOption[] {\n //加入固定列图标 排序 文本中元素\n const iconArr: ColumnIconOption[] = [];\n const { icon: iconDefine } = this._table.getBodyColumnDefine(col, row);\n\n if (iconDefine) {\n let iconResults;\n if (typeof iconDefine === 'function') {\n const arg = {\n col,\n row,\n value: cellValue,\n dataValue,\n table: this._table\n };\n iconResults = iconDefine(arg);\n } else {\n iconResults = iconDefine;\n }\n const regedIcons = registerIcons.get();\n const addIcon = (columnIcon: string | ColumnIconOption) => {\n let icon;\n if (typeof columnIcon === 'string') {\n icon = regedIcons[columnIcon];\n } else {\n icon = columnIcon;\n }\n if (icon) {\n iconArr.push(icon);\n }\n };\n if (Array.isArray(iconResults)) {\n iconResults.forEach((columnIcon: string | ColumnIconOption, index: number) => {\n addIcon(columnIcon);\n });\n } else {\n addIcon(iconResults);\n }\n }\n const hierarchyIcon = this.getHierarchyIcon(col, row);\n if (hierarchyIcon) {\n iconArr.push(hierarchyIcon);\n }\n\n context &&\n iconArr.forEach((i, index) => {\n if ((i as any).content || (<ImageIcon>i).src) {\n iconArr[index] = this.getCellIconFromRecordValue(i, col, row);\n // if ((<FontIcon>i).font)\n // helper.testFontLoad((<FontIcon>i).font, (<FontIcon>i).content, col, row);\n }\n });\n\n return iconArr;\n }\n getStyleClass(\n cellType: 'text' | 'link' | 'image' | 'video' | 'chart' | 'sparkline' | 'progressbar' | 'chart' | 'checkbox'\n ) {\n switch (cellType) {\n case 'text':\n return TextStyle;\n case 'image':\n return ImageStyle;\n case 'video':\n return ImageStyle;\n case 'link':\n return TextStyle;\n case 'chart':\n return Style;\n case 'sparkline':\n return Style;\n case 'progressbar':\n return ProgressBarStyle;\n case 'checkbox':\n return CheckboxStyle;\n }\n return TextStyle;\n }\n getCellIconFromRecordValue(icon: ColumnIconOption, col: number, row: number): ColumnIconOption;\n getCellIconFromRecordValue(icon: ColumnIconOption[], col: number, row: number): ColumnIconOption[];\n getCellIconFromRecordValue(\n icon: ColumnIconOption | ColumnIconOption[],\n col: number,\n row: number\n ): ColumnIconOption | ColumnIconOption[];\n getCellIconFromRecordValue(\n icon: ColumnIconOption | ColumnIconOption[],\n col: number,\n row: number\n ): ColumnIconOption | ColumnIconOption[] {\n if (Array.isArray(icon)) {\n return icon.map(i => this.getCellIconFromRecordValue(i, col, row));\n }\n // icon.positionType = IconPosition.inlineFront;\n if (!obj.isObject(icon) || typeof icon === 'function') {\n return (this._table as ListTableAPI).getFieldData(icon, col, row);\n }\n // 新建对象 挨个属性赋值\n const retIcon: any = {};\n const iconOpt: any = icon;\n icons.iconPropKeys.forEach(k => {\n if (typeof iconOpt[k] !== 'undefined') {\n const f = (this._table as ListTableAPI).getFieldData(iconOpt[k], col, row);\n if (f != null) {\n retIcon[k] = f;\n } else if (!this._table._hasField?.(iconOpt[k], col, row)) {\n retIcon[k] = iconOpt[k];\n }\n }\n });\n return retIcon;\n }\n\n getHierarchyIcon(col: number, row: number) {\n const hierarchyState = this._table.getHierarchyState(col, row);\n if (hierarchyState === HierarchyState.expand) {\n //展开状态 应该显示-号\n return this.expandIcon;\n } else if (hierarchyState === HierarchyState.collapse) {\n //折叠状态 应该显示-号\n return this.collapseIcon;\n }\n return undefined;\n }\n getHierarchyIconWidth() {\n return this.expandIcon.width + (this.expandIcon.marginLeft ?? 0) + (this.expandIcon.marginRight ?? 0);\n }\n}\n"]}
|
|
@@ -22,6 +22,7 @@ export declare class TooltipHandler {
|
|
|
22
22
|
_unbindFromCell(): void;
|
|
23
23
|
_isBindCell(col: number, row: number): boolean;
|
|
24
24
|
_bindTableEvent(table: BaseTableAPI): void;
|
|
25
|
+
showTooltip(col: number, row: number): void;
|
|
25
26
|
_getTooltipInstanceInfo(col: number, row: number): BaseTooltip | null;
|
|
26
27
|
isBinded(tooltipOptions: TooltipOptions): boolean;
|
|
27
28
|
}
|
|
@@ -63,43 +63,11 @@ export class TooltipHandler {
|
|
|
63
63
|
}
|
|
64
64
|
_bindTableEvent(table) {
|
|
65
65
|
table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, (e => {
|
|
66
|
-
var _a;
|
|
67
66
|
if (isMobile()) return;
|
|
68
67
|
const {x1: left, x2: right, y1: top, y2: bottom} = table.stateManager.menu.bounds;
|
|
69
68
|
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
69
|
const {col: col, row: row} = e;
|
|
71
|
-
|
|
72
|
-
const headerDescription = table.getHeaderDescription(col, row);
|
|
73
|
-
if (headerDescription) {
|
|
74
|
-
const rect = table.getCellRangeRelativeRect({
|
|
75
|
-
col: col,
|
|
76
|
-
row: row
|
|
77
|
-
});
|
|
78
|
-
tooltipOption = {
|
|
79
|
-
content: headerDescription,
|
|
80
|
-
referencePosition: {
|
|
81
|
-
placement: Placement.bottom,
|
|
82
|
-
rect: rect
|
|
83
|
-
},
|
|
84
|
-
style: {
|
|
85
|
-
arrowMark: !1
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
} else if (null === (_a = table.internalProps.tooltip) || void 0 === _a ? void 0 : _a.isShowOverflowTextTooltip) {
|
|
89
|
-
const overflowText = table.getCellOverflowText(col, row), rect = table.getCellRangeRelativeRect({
|
|
90
|
-
col: col,
|
|
91
|
-
row: row
|
|
92
|
-
});
|
|
93
|
-
overflowText && (tooltipOption = {
|
|
94
|
-
content: headerDescription ? `${headerDescription}\n ${overflowText}` : overflowText,
|
|
95
|
-
referencePosition: {
|
|
96
|
-
placement: Placement.bottom,
|
|
97
|
-
rect: rect
|
|
98
|
-
},
|
|
99
|
-
style: table.theme.tooltipStyle
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
tooltipOption && this._bindToCell(e.col, e.row, tooltipOption);
|
|
70
|
+
this.showTooltip(col, row);
|
|
103
71
|
})), table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, (e => {
|
|
104
72
|
var _a, _b;
|
|
105
73
|
if (!isMobile()) {
|
|
@@ -119,6 +87,41 @@ export class TooltipHandler {
|
|
|
119
87
|
this._unbindFromCell();
|
|
120
88
|
}));
|
|
121
89
|
}
|
|
90
|
+
showTooltip(col, row) {
|
|
91
|
+
var _a;
|
|
92
|
+
let tooltipOption;
|
|
93
|
+
const table = this._table, headerDescription = table.getHeaderDescription(col, row);
|
|
94
|
+
if (headerDescription) {
|
|
95
|
+
const rect = table.getCellRangeRelativeRect({
|
|
96
|
+
col: col,
|
|
97
|
+
row: row
|
|
98
|
+
});
|
|
99
|
+
tooltipOption = {
|
|
100
|
+
content: headerDescription,
|
|
101
|
+
referencePosition: {
|
|
102
|
+
placement: Placement.bottom,
|
|
103
|
+
rect: rect
|
|
104
|
+
},
|
|
105
|
+
style: {
|
|
106
|
+
arrowMark: !1
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
} else if (null === (_a = table.internalProps.tooltip) || void 0 === _a ? void 0 : _a.isShowOverflowTextTooltip) {
|
|
110
|
+
const overflowText = table.getCellOverflowText(col, row), rect = table.getCellRangeRelativeRect({
|
|
111
|
+
col: col,
|
|
112
|
+
row: row
|
|
113
|
+
});
|
|
114
|
+
overflowText && (tooltipOption = {
|
|
115
|
+
content: headerDescription ? `${headerDescription}\n ${overflowText}` : overflowText,
|
|
116
|
+
referencePosition: {
|
|
117
|
+
placement: Placement.bottom,
|
|
118
|
+
rect: rect
|
|
119
|
+
},
|
|
120
|
+
style: table.theme.tooltipStyle
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
tooltipOption ? this._bindToCell(col, row, tooltipOption) : this._unbindFromCell();
|
|
124
|
+
}
|
|
122
125
|
_getTooltipInstanceInfo(col, row) {
|
|
123
126
|
const table = this._table, tooltipInstances = this._tooltipInstances;
|
|
124
127
|
return tooltipInstances && tooltipInstances["bubble-tooltip"] || tooltipInstances && (tooltipInstances["bubble-tooltip"] = TOOLTIP_INSTANCE_FACTORY["bubble-tooltip"](table));
|
|
@@ -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,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,EAA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S,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: table.theme.tooltipStyle\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 this._unbindFromCell();\n // const info = this._attachInfo;\n // if (info?.tooltipOptions && info?.range?.start) {\n // const { col, row } = info.range.start;\n // const rect = table.getCellRangeRelativeRect({ col, row });\n // info.tooltipOptions.referencePosition.rect = rect;\n // this._move(info.range.start.col, info.range.start.row, info.tooltipOptions);\n // }\n });\n }\n _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,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,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AAM;YACL,IAAI,CAAC,eAAe,EAAE,CAAC;SACxB;IACH,CAAC;IACD,uBAAuB,CAAC,GAAW,EAAE,GAAW;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAKhD,MAAM,WAAW,GAAG,gBAAgB,CAAC;QAErC,MAAM,QAAQ,GACZ,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACnD,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACvG,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,QAAQ,CAAC,cAA8B;;QACrC,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAA,IAAI,CAAC,WAAW,0CAAE,cAAc,CAAC,EAAE;YACvF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF","file":"TooltipHandler.js","sourcesContent":["import type { CellRange, RectProps } from '../../ts-types';\nimport { Placement } from '../../ts-types';\nimport type { BaseTooltip } from './BaseTooltip';\nimport { BubbleTooltip } from './Tooltip';\nimport { cellInRange } from '../../tools/helper';\nimport { isMobile } from '../../tools/util';\n// import { DG_EVENT_TYPE } from '../core/DG_EVENT_TYPE';\nimport type { TooltipOptions } from '../../ts-types/tooltip';\nimport { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nconst TOOLTIP_INSTANCE_FACTORY = {\n // tooltip(table: BaseTableAPI): BaseTooltip {\n // return new Tooltip(table);\n // },\n 'bubble-tooltip': function (table: BaseTableAPI): BaseTooltip {\n return new BubbleTooltip(table);\n }\n};\ntype AttachInfo = {\n instance?: BaseTooltip;\n range: CellRange;\n tooltipOptions: TooltipOptions;\n};\n\nexport class TooltipHandler {\n private _table: BaseTableAPI;\n private _tooltipInstances?: { [type: string]: BaseTooltip };\n private _attachInfo?: AttachInfo | null;\n private confine?: boolean; //弹出框是否需要限定在canvas区域\n constructor(table: BaseTableAPI, confine: boolean) {\n this._table = table;\n this._tooltipInstances = {};\n this._bindTableEvent(table);\n this.confine = confine;\n }\n release(): void {\n const tooltipInstances = this._tooltipInstances;\n for (const k in tooltipInstances) {\n tooltipInstances[k]?.release?.();\n }\n delete this._tooltipInstances;\n this._attachInfo = null;\n }\n _bindToCell(col: number, row: number, tooltipOptions?: TooltipOptions): void {\n const info = this._attachInfo;\n const instance = this._getTooltipInstanceInfo(col, row);\n if (info && (!instance || info.instance !== instance)) {\n info.instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n if (!instance) {\n return;\n }\n // const { instance, info: tooltipInstanceInfo } = instanceInfo;\n const attach = instance && instance.bindTooltipElement(col, row, tooltipOptions, this.confine);\n if (attach) {\n const range = this._table.getCellRange(col, row);\n this._attachInfo = { range, instance, tooltipOptions };\n }\n }\n _move(col: number, row: number, tooltipOptions: TooltipOptions): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n instance?.moveTooltipElement(col, row, tooltipOptions, this.confine);\n }\n moveToPosition(\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: {\n rect: RectProps;\n placement?: Placement;\n }\n ): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n this._attachInfo.tooltipOptions.position = position;\n this._attachInfo.tooltipOptions.referencePosition = referencePosition;\n instance?.locateTooltipElement(col, row, position, referencePosition, this.confine);\n }\n _unbindFromCell(): void {\n const info = this._attachInfo;\n if (!info) {\n return;\n }\n const { instance } = info;\n instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n _isBindCell(col: number, row: number): boolean {\n const info = this._attachInfo;\n if (!info) {\n return false;\n }\n return cellInRange(info.range, col, row);\n }\n _bindTableEvent(table: BaseTableAPI): void {\n // (table.options.hover?.isShowTooltip || table.options.tooltip?.isShowOverflowTextTooltip) &&\n table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n // dropDownMenu区域不响应\n const { x1: left, x2: right, y1: top, y2: bottom } = table.stateManager.menu.bounds;\n if (\n table.stateManager.menu.isShow &&\n typeof e.x === 'number' &&\n typeof e.y === 'number' &&\n e.x > left &&\n e.x < right &&\n e.y > top &&\n e.y < bottom\n ) {\n return;\n }\n const { col, row } = e;\n this.showTooltip(col, row);\n // if (e.related) {\n // if (this._isBindCell(col, row)) {\n // return;\n // }\n // }\n });\n table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n if (this._attachInfo?.tooltipOptions?.referencePosition) {\n const position = this._attachInfo.tooltipOptions.referencePosition;\n const { event } = e;\n const { left, right, top, bottom } = position.rect;\n const abstractPos = table._getMouseAbstractPoint(event, false);\n if (\n !(\n abstractPos.inTable &&\n abstractPos.x >= left - 5 &&\n abstractPos.x <= right + 5 &&\n abstractPos.y >= top - 5 &&\n abstractPos.y <= bottom + 5\n )\n ) {\n // 这里加5px的判断buffer\n this._unbindFromCell();\n }\n }\n // dropDownMenu区域不响应\n if (this._attachInfo && table.stateManager.menu.isShow) {\n this._bindToCell(e.col, e.row);\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, e => {\n // if (e.related) {\n // if (this._isBindCell(e.related.col, e.related.row)) {\n // return;\n // }\n // }\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SELECTED_CELL, e => {\n if (this._isBindCell(e.col, e.row)) {\n this._unbindFromCell();\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, e => {\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SCROLL, e => {\n this._unbindFromCell();\n // const info = this._attachInfo;\n // if (info?.tooltipOptions && info?.range?.start) {\n // const { col, row } = info.range.start;\n // const rect = table.getCellRangeRelativeRect({ col, row });\n // info.tooltipOptions.referencePosition.rect = rect;\n // this._move(info.range.start.col, info.range.start.row, info.tooltipOptions);\n // }\n });\n }\n showTooltip(col: number, row: number) {\n let tooltipOption;\n const table = this._table;\n const headerDescription = table.getHeaderDescription(col, row);\n if (headerDescription) {\n const rect = table.getCellRangeRelativeRect({ col, row });\n tooltipOption = {\n content: headerDescription,\n referencePosition: {\n placement: Placement.bottom,\n rect\n },\n 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: table.theme.tooltipStyle\n };\n }\n }\n if (tooltipOption) {\n this._bindToCell(col, row, tooltipOption);\n } else {\n this._unbindFromCell();\n }\n }\n _getTooltipInstanceInfo(col: number, row: number): BaseTooltip | null {\n const table = this._table;\n const tooltipInstances = this._tooltipInstances;\n // const info = getTooltipInstanceInfo(table, col, row, tooltipOptions);\n // if (!info) {\n // return null;\n // }\n const tooltipType = 'bubble-tooltip';\n // const { tooltipType } = info;\n const instance =\n (tooltipInstances && tooltipInstances[tooltipType]) ||\n (tooltipInstances && (tooltipInstances[tooltipType] = TOOLTIP_INSTANCE_FACTORY[tooltipType](table)));\n return instance;\n }\n isBinded(tooltipOptions: TooltipOptions) {\n if (JSON.stringify(tooltipOptions) === JSON.stringify(this._attachInfo?.tooltipOptions)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
package/es/core/BaseTable.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CellAddress, type CellRange, type TableEventHandlersEventArgumentMap, type TableEventHandlersReturnMap, type TableKeyboardOptions, type DropDownMenuHighlightInfo, type MenuListItem, type WidthModeDef, type ICustomRender, type ICellHeaderPaths, type HeaderData, type FullExtendStyle, type FieldDef, type ColumnTypeOption, type SortState, type IPagination, type ICustomLayout, type CellInfo, type CellStyle, type DropDownMenuOptions, type FieldData, type MaybePromiseOrUndefined, type MousePointerCellEvent, type DropDownMenuEventInfo, type HierarchyState, type FieldKeyDef, type CellLocation, type LayoutObjectId, type HeightModeDef, type ITableThemeDefine } from '../ts-types';
|
|
2
|
-
import type { AnyFunction, CellAddressWithBound, ColumnIconOption, ColumnSeriesNumber, IRowSeriesNumber, ColumnStyleOption, TableEventOptions } from '../ts-types';
|
|
2
|
+
import type { AnyFunction, CellAddressWithBound, ColumnIconOption, ColumnSeriesNumber, IRowSeriesNumber, ColumnStyleOption, TableEventOptions, WidthAdaptiveModeDef, HeightAdaptiveModeDef } from '../ts-types';
|
|
3
3
|
import { TABLE_EVENT_TYPE } from './TABLE_EVENT_TYPE';
|
|
4
4
|
import { EventTarget } from '../event/EventTarget';
|
|
5
5
|
import { NumberMap } from '../tools/NumberMap';
|
|
@@ -9,13 +9,14 @@ import { Scenegraph } from '../scenegraph/scenegraph';
|
|
|
9
9
|
import { StateManager } from '../state/state';
|
|
10
10
|
import { EventManager } from '../event/event';
|
|
11
11
|
import type { CachedDataSource, DataSource } from '../data';
|
|
12
|
-
import { type ITextSize } from '@visactor/vutils';
|
|
12
|
+
import { AABBBounds, type ITextSize } from '@visactor/vutils';
|
|
13
13
|
import type { ColumnData, ColumnDefine, ColumnsDefine, IndicatorData, SeriesNumberColumnData } from '../ts-types/list-table/layout-map/api';
|
|
14
14
|
import type { TooltipOptions } from '../ts-types/tooltip';
|
|
15
15
|
import type { BaseTableAPI, BaseTableConstructorOptions, IBaseTableProtected } from '../ts-types/base-table';
|
|
16
16
|
import { DataSet } from '@visactor/vdataset';
|
|
17
17
|
import { NumberRangeMap } from '../layout/row-height-map';
|
|
18
18
|
import { CustomCellStylePlugin } from '../plugins/custom-cell-style';
|
|
19
|
+
import type { ITextGraphicAttribute } from './../vrender';
|
|
19
20
|
export declare abstract class BaseTable extends EventTarget implements BaseTableAPI {
|
|
20
21
|
internalProps: IBaseTableProtected;
|
|
21
22
|
showFrozenIcon: boolean;
|
|
@@ -34,6 +35,8 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
34
35
|
_heightMode: HeightModeDef;
|
|
35
36
|
_autoFillWidth: boolean;
|
|
36
37
|
_autoFillHeight: boolean;
|
|
38
|
+
_widthAdaptiveMode: WidthAdaptiveModeDef;
|
|
39
|
+
_heightAdaptiveMode: HeightAdaptiveModeDef;
|
|
37
40
|
customRender?: ICustomRender;
|
|
38
41
|
canvasWidth?: number;
|
|
39
42
|
canvasHeight?: number;
|
|
@@ -121,6 +124,10 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
121
124
|
set autoFillWidth(autoFillWidth: boolean);
|
|
122
125
|
get autoFillHeight(): boolean;
|
|
123
126
|
set autoFillHeight(autoFillHeight: boolean);
|
|
127
|
+
get widthAdaptiveMode(): WidthAdaptiveModeDef;
|
|
128
|
+
set widthAdaptiveMode(widthAdaptiveMode: WidthAdaptiveModeDef);
|
|
129
|
+
get heightAdaptiveMode(): HeightAdaptiveModeDef;
|
|
130
|
+
set heightAdaptiveMode(heightAdaptiveMode: HeightAdaptiveModeDef);
|
|
124
131
|
_colWidthDefineToPxWidth(width: string | number): number;
|
|
125
132
|
private _getColWidthLimits;
|
|
126
133
|
_adjustColWidth(col: number, orgWidth: number): number;
|
|
@@ -362,6 +369,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
362
369
|
fontWeight: string | number;
|
|
363
370
|
fontFamily: string;
|
|
364
371
|
}): ITextSize;
|
|
372
|
+
measureTextBounds(attribute: ITextGraphicAttribute): AABBBounds;
|
|
365
373
|
getCustomRender(col: number, row: number): ICustomRender;
|
|
366
374
|
getCustomLayout(col: number, row: number): ICustomLayout;
|
|
367
375
|
hasAutoImageColumn(): HeaderData | ColumnData;
|
package/es/core/BaseTable.js
CHANGED
|
@@ -40,7 +40,7 @@ import { TooltipHandler } from "../components/tooltip/TooltipHandler";
|
|
|
40
40
|
|
|
41
41
|
import { AABBBounds, isNumber, isBoolean, isFunction, isValid, cloneDeep } from "@visactor/vutils";
|
|
42
42
|
|
|
43
|
-
import { textMeasure } from "../scenegraph/utils/text-measure";
|
|
43
|
+
import { measureTextBounds, textMeasure } from "../scenegraph/utils/text-measure";
|
|
44
44
|
|
|
45
45
|
import { getProp } from "../scenegraph/utils/get-prop";
|
|
46
46
|
|
|
@@ -82,13 +82,14 @@ export class BaseTable extends EventTarget {
|
|
|
82
82
|
}
|
|
83
83
|
constructor(container, options = {}) {
|
|
84
84
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
85
|
-
if (super(), this.showFrozenIcon = !0, this.version = "0.23.
|
|
85
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.23.3", this.id = `VTable${Date.now()}`,
|
|
86
86
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
87
87
|
!container && "node" !== options.mode) throw new Error("vtable's container is undefined");
|
|
88
|
-
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, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, 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;
|
|
88
|
+
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, 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;
|
|
89
89
|
this.container = container, this.options = options, this._widthMode = widthMode,
|
|
90
|
-
this._heightMode = heightMode, this.
|
|
91
|
-
this.
|
|
90
|
+
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
|
|
91
|
+
this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, this.customRender = customRender,
|
|
92
|
+
this.padding = {
|
|
92
93
|
top: 0,
|
|
93
94
|
right: 0,
|
|
94
95
|
left: 0,
|
|
@@ -315,6 +316,18 @@ export class BaseTable extends EventTarget {
|
|
|
315
316
|
set autoFillHeight(autoFillHeight) {
|
|
316
317
|
autoFillHeight !== this._autoFillHeight && (this._autoFillHeight = autoFillHeight);
|
|
317
318
|
}
|
|
319
|
+
get widthAdaptiveMode() {
|
|
320
|
+
return this._widthAdaptiveMode;
|
|
321
|
+
}
|
|
322
|
+
set widthAdaptiveMode(widthAdaptiveMode) {
|
|
323
|
+
widthAdaptiveMode !== this._widthAdaptiveMode && (this._widthAdaptiveMode = widthAdaptiveMode);
|
|
324
|
+
}
|
|
325
|
+
get heightAdaptiveMode() {
|
|
326
|
+
return this._heightAdaptiveMode;
|
|
327
|
+
}
|
|
328
|
+
set heightAdaptiveMode(heightAdaptiveMode) {
|
|
329
|
+
heightAdaptiveMode !== this._heightAdaptiveMode && (this._heightAdaptiveMode = heightAdaptiveMode);
|
|
330
|
+
}
|
|
318
331
|
_colWidthDefineToPxWidth(width) {
|
|
319
332
|
return "auto" === width ? 0 : _toPxWidth(this, width);
|
|
320
333
|
}
|
|
@@ -390,7 +403,7 @@ export class BaseTable extends EventTarget {
|
|
|
390
403
|
}
|
|
391
404
|
getDefaultRowHeight(row) {
|
|
392
405
|
var _a, _b;
|
|
393
|
-
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(
|
|
406
|
+
return this.isColumnHeader(0, row) || this.isCornerHeader(0, row) || this.isSeriesNumberInHeader(0, row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_a = this.defaultHeaderRowHeight[row]) && void 0 !== _a ? _a : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.isBottomFrozenRow(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;
|
|
394
407
|
}
|
|
395
408
|
_setRowHeight(row, height, clearCache) {
|
|
396
409
|
this.rowHeightsMap.put(row, Math.round(height)), clearCache && this._clearRowRangeHeightsMap(row);
|
|
@@ -715,7 +728,7 @@ export class BaseTable extends EventTarget {
|
|
|
715
728
|
this.release();
|
|
716
729
|
}
|
|
717
730
|
release() {
|
|
718
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
731
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
719
732
|
const internalProps = this.internalProps;
|
|
720
733
|
null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
721
734
|
null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c),
|
|
@@ -728,7 +741,8 @@ export class BaseTable extends EventTarget {
|
|
|
728
741
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
729
742
|
})), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
|
|
730
743
|
const {parentElement: parentElement} = internalProps.element;
|
|
731
|
-
parentElement && parentElement.removeChild(internalProps.element), this.
|
|
744
|
+
parentElement && parentElement.removeChild(internalProps.element), null === (_p = null === (_o = null === (_m = this.editorManager) || void 0 === _m ? void 0 : _m.editingEditor) || void 0 === _o ? void 0 : _o.onEnd) || void 0 === _p || _p.call(_o),
|
|
745
|
+
this.isReleased = !0;
|
|
732
746
|
}
|
|
733
747
|
fireListeners(type, event) {
|
|
734
748
|
return super.fireListeners(type, event);
|
|
@@ -736,7 +750,7 @@ export class BaseTable extends EventTarget {
|
|
|
736
750
|
updateOption(options) {
|
|
737
751
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
738
752
|
this.options = options;
|
|
739
|
-
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth} = options;
|
|
753
|
+
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, widthAdaptiveMode: widthAdaptiveMode, heightAdaptiveMode: heightAdaptiveMode, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth} = options;
|
|
740
754
|
pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio),
|
|
741
755
|
padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding,
|
|
742
756
|
this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
|
|
@@ -744,6 +758,8 @@ export class BaseTable extends EventTarget {
|
|
|
744
758
|
padding.right && (this.padding.right = padding.right))), this.showFrozenIcon = "boolean" != typeof showFrozenIcon || showFrozenIcon,
|
|
745
759
|
"number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
|
|
746
760
|
this.widthMode = null != widthMode ? widthMode : "standard", this.heightMode = null != heightMode ? heightMode : "standard",
|
|
761
|
+
this._widthAdaptiveMode = null != widthAdaptiveMode ? widthAdaptiveMode : "only-body",
|
|
762
|
+
this._heightAdaptiveMode = null != heightAdaptiveMode ? heightAdaptiveMode : "only-body",
|
|
747
763
|
this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight,
|
|
748
764
|
this.customRender = customRender;
|
|
749
765
|
const internalProps = this.internalProps;
|
|
@@ -781,7 +797,7 @@ export class BaseTable extends EventTarget {
|
|
|
781
797
|
renderMode: "html"
|
|
782
798
|
}, options.menu), "html" !== internalProps.menu.renderMode || internalProps.menuHandler || (internalProps.menuHandler = new MenuHandler(this)),
|
|
783
799
|
this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
|
|
784
|
-
|
|
800
|
+
internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin.updateCustomCell(null !== (_g = options.customCellStyle) && void 0 !== _g ? _g : [], null !== (_h = options.customCellStyleArrangement) && void 0 !== _h ? _h : []);
|
|
785
801
|
}
|
|
786
802
|
renderWithRecreateCells() {
|
|
787
803
|
const oldHoverState = {
|
|
@@ -1529,6 +1545,9 @@ export class BaseTable extends EventTarget {
|
|
|
1529
1545
|
measureText(text, font) {
|
|
1530
1546
|
return textMeasure.measureText(text, font);
|
|
1531
1547
|
}
|
|
1548
|
+
measureTextBounds(attribute) {
|
|
1549
|
+
return measureTextBounds(attribute);
|
|
1550
|
+
}
|
|
1532
1551
|
getCustomRender(col, row) {
|
|
1533
1552
|
let customRender;
|
|
1534
1553
|
if ("body" !== this.getCellLocation(col, row)) {
|