@visactor/vtable 1.22.11-alpha.8 → 1.22.11-alpha.9
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 +34 -7
- package/cjs/ListTable.js +138 -18
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +0 -3
- package/cjs/PivotChart.js +5 -12
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/components/index.js +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/index.d.ts +1 -0
- package/cjs/core/index.js +30 -0
- package/cjs/core/index.js.map +1 -0
- package/cjs/core/record-helper.d.ts +4 -2
- package/cjs/core/record-helper.js +120 -47
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +13 -4
- package/cjs/data/DataSource.js +174 -60
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.d.ts +2 -1
- package/cjs/event/event.js +20 -9
- 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 +2 -8
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/listener/table-group.js +8 -14
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +1 -1
- package/cjs/event/scroll.js +1 -1
- package/cjs/event/sparkline-event.js +1 -1
- package/cjs/event/util.js +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/index.js +1 -2
- package/cjs/layout/pivot-header-layout.d.ts +0 -6
- package/cjs/layout/pivot-header-layout.js +20 -39
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/plugins/custom-cell-style.d.ts +5 -0
- package/cjs/plugins/custom-cell-style.js +9 -0
- package/cjs/plugins/custom-cell-style.js.map +1 -1
- package/cjs/plugins/interface.js +1 -1
- package/cjs/plugins/invert-highlight.js +2 -1
- package/cjs/plugins/list-tree-stick-cell.js +1 -1
- package/cjs/plugins/plugin-manager.js +1 -1
- package/cjs/scenegraph/graphic/active-cell-chart-list.d.ts +2 -15
- package/cjs/scenegraph/graphic/active-cell-chart-list.js +75 -198
- package/cjs/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +1 -10
- package/cjs/scenegraph/graphic/chart.js +27 -61
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +4 -3
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +1 -2
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -2
- package/cjs/scenegraph/scenegraph.js +11 -44
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/tools/util.d.ts +0 -5
- package/cjs/tools/util.js +4 -22
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +2 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +15 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +33 -13
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +898 -711
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +34 -7
- package/es/ListTable.js +134 -18
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +0 -3
- package/es/PivotChart.js +4 -13
- package/es/PivotChart.js.map +1 -1
- package/es/components/index.js +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/es/core/TABLE_EVENT_TYPE.js +1 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/index.d.ts +1 -0
- package/es/core/index.js +2 -0
- package/es/core/index.js.map +1 -0
- package/es/core/record-helper.d.ts +4 -2
- package/es/core/record-helper.js +114 -43
- package/es/core/record-helper.js.map +1 -1
- package/es/data/DataSource.d.ts +13 -4
- package/es/data/DataSource.js +174 -60
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.d.ts +2 -1
- package/es/event/event.js +20 -9
- 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 +2 -8
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/listener/table-group.js +8 -13
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +1 -1
- package/es/event/scroll.js +1 -1
- package/es/event/sparkline-event.js +1 -1
- package/es/event/util.js +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/index.js +1 -2
- package/es/layout/pivot-header-layout.d.ts +0 -6
- package/es/layout/pivot-header-layout.js +20 -39
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/plugins/custom-cell-style.d.ts +5 -0
- package/es/plugins/custom-cell-style.js +9 -0
- package/es/plugins/custom-cell-style.js.map +1 -1
- package/es/plugins/interface.js +1 -1
- package/es/plugins/invert-highlight.js +2 -1
- package/es/plugins/list-tree-stick-cell.js +1 -1
- package/es/plugins/plugin-manager.js +1 -1
- package/es/scenegraph/graphic/active-cell-chart-list.d.ts +2 -15
- package/es/scenegraph/graphic/active-cell-chart-list.js +68 -186
- package/es/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +1 -10
- package/es/scenegraph/graphic/chart.js +25 -58
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +4 -3
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +1 -2
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -2
- package/es/scenegraph/scenegraph.js +10 -43
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/tools/util.d.ts +0 -5
- package/es/tools/util.js +0 -18
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +2 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +15 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +33 -13
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
|
@@ -10,6 +10,11 @@ export declare class CustomCellStylePlugin {
|
|
|
10
10
|
customCellStyle: CustomCellStyle[];
|
|
11
11
|
customCellStyleArrangement: CustomCellStyleArrangement[];
|
|
12
12
|
constructor(table: BaseTableAPI, customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]);
|
|
13
|
+
clearCustomCellStyleArrangement(): void;
|
|
14
|
+
addCustomCellStyleArrangement(cellPosition: {
|
|
15
|
+
col: number;
|
|
16
|
+
row: number;
|
|
17
|
+
}, customStyleId: string | undefined | null): void;
|
|
13
18
|
getCustomCellStyle(col: number, row: number): any;
|
|
14
19
|
getCustomCellStyleIds(col: number, row: number): string[];
|
|
15
20
|
getCustomCellStyleOption(customStyleId: string): CustomCellStyle;
|
|
@@ -8,6 +8,15 @@ export class CustomCellStylePlugin {
|
|
|
8
8
|
constructor(table, customCellStyle, customCellStyleArrangement) {
|
|
9
9
|
this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
|
|
10
10
|
}
|
|
11
|
+
clearCustomCellStyleArrangement() {
|
|
12
|
+
this.customCellStyleArrangement = [];
|
|
13
|
+
}
|
|
14
|
+
addCustomCellStyleArrangement(cellPosition, customStyleId) {
|
|
15
|
+
this.customCellStyleArrangement.push({
|
|
16
|
+
cellPosition: cellPosition,
|
|
17
|
+
customStyleId: customStyleId
|
|
18
|
+
});
|
|
19
|
+
}
|
|
11
20
|
getCustomCellStyle(col, row) {
|
|
12
21
|
const customStyleIds = this.getCustomCellStyleIds(col, row);
|
|
13
22
|
if (customStyleIds.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EACL,aAAa,EAKd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU1C,MAAM,OAAO,qBAAqB;IAKhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;IAC/D,CAAC;IAED,kBAAkB,CAAC,GAAW,EAAE,GAAW;QACzC,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,cAAc,CAAC,MAAM,EAAE;YACzB,MAAM,MAAM,GAAwB,EAAE,CAAC;YAEvC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBACrC,MAAM,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;gBACjE,IAAI,UAAU,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CA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,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;YACjB,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,OAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC","file":"custom-cell-style.js","sourcesContent":["import { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\nexport interface ICustomCellStylePlugin {\n new (\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ): CustomCellStylePlugin;\n}\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null,\n forceFastUpdate?: boolean\n ) {\n const index = this.customCellStyleArrangement.findIndex(style => {\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n this.customCellStyleArrangement.splice(index, 1);\n }\n\n const style = this.getCustomCellStyleOption(customStyleId)?.style;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (isValid(value)) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n\nexport const registerCustomCellStylePlugin = () => {\n Factory.registerComponent('customCellStylePlugin', CustomCellStylePlugin);\n};\n\n// export type ICustomCellStylePlugin = typeof CustomCellStylePlugin;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EACL,aAAa,EAKd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU1C,MAAM,OAAO,qBAAqB;IAKhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAAI,CAAC,KAAK,GAAG,KAAK,CA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AI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,0BAA0B,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3C,eAAe,CAAC,OAAO,CAAC,CAAC,SAA0B,EAAE,EAAE;YACrD,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QACH,0BAA0B,CAAC,OAAO,CAAC,CAAC,SAAqC,EAAE,EAAE;YAC3E,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB,CAAC,aAAqB;QACtC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,aAAa,CAAC,CAAC;IACxE,CAAC;CACF;AAED,MAAM,UAAU,UAAU,CAAC,UAAiB,EAAE,eAAkC;IAC9E,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;YACjB,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,OAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC","file":"custom-cell-style.js","sourcesContent":["import { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\nexport interface ICustomCellStylePlugin {\n new (\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ): CustomCellStylePlugin;\n}\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n }\n\n clearCustomCellStyleArrangement() {\n this.customCellStyleArrangement = [];\n }\n\n addCustomCellStyleArrangement(\n cellPosition: {\n col: number;\n row: number;\n },\n customStyleId: string | undefined | null\n ) {\n this.customCellStyleArrangement.push({\n cellPosition,\n customStyleId\n });\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null,\n forceFastUpdate?: boolean\n ) {\n const index = this.customCellStyleArrangement.findIndex(style => {\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n this.customCellStyleArrangement.splice(index, 1);\n }\n\n const style = this.getCustomCellStyleOption(customStyleId)?.style;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (isValid(value)) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n\nexport const registerCustomCellStylePlugin = () => {\n Factory.registerComponent('customCellStylePlugin', CustomCellStylePlugin);\n};\n\n// export type ICustomCellStylePlugin = typeof CustomCellStylePlugin;\n"]}
|
package/es/plugins/interface.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { };
|
|
2
|
-
//# sourceMappingURL=interface.js.map
|
|
2
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -175,4 +175,4 @@ function scrollToRow(row, table) {
|
|
|
175
175
|
export const registerListTreeStickCellPlugin = () => {
|
|
176
176
|
Factory.registerComponent("listTreeStickCellPlugin", ListTreeStickCellPlugin);
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=list-tree-stick-cell.js.map
|
|
178
|
+
//# sourceMappingURL=list-tree-stick-cell.js.map
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import type { BaseTableAPI } from '../../ts-types/base-table';
|
|
2
|
-
export declare function setBrushingChartInstance(chartInstance: any, col: number, row: number): void;
|
|
3
|
-
export declare function clearBrushingChartInstance(): void;
|
|
4
|
-
export declare function getBrushingChartInstance(): any;
|
|
5
|
-
export declare function getBrushingChartInstanceCellPos(): {
|
|
6
|
-
col: number;
|
|
7
|
-
row: number;
|
|
8
|
-
};
|
|
9
2
|
export declare const chartInstanceListColumnByColumnDirection: Record<number, Record<number, any>>;
|
|
10
3
|
export declare const chartInstanceListRowByRowDirection: Record<number, Record<number, any>>;
|
|
11
4
|
export declare function generateChartInstanceListByColumnDirection(col: number, dimensionValueOrXValue: string, positionValueOrYValue: string | number, canvasXY: {
|
|
12
5
|
x: number;
|
|
13
6
|
y: number;
|
|
14
7
|
}, table: BaseTableAPI, hideTooltip?: boolean, isScatter?: boolean): void;
|
|
8
|
+
export declare function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI): void;
|
|
15
9
|
export declare function generateChartInstanceListByRowDirection(row: number, dimensionValueOrXValue: string, positionValueOrYValue: string | number, canvasXY: {
|
|
16
10
|
x: number;
|
|
17
11
|
y: number;
|
|
18
12
|
}, table: BaseTableAPI, hideTooltip?: boolean, isScatter?: boolean): void;
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI, forceRelease?: boolean): void;
|
|
21
|
-
export declare function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI, forceRelease?: boolean): void;
|
|
22
|
-
export declare function clearDelayRunDimensionHoverTimers(): void;
|
|
23
|
-
export declare function clearAllChartInstanceList(table: BaseTableAPI, forceRelease?: boolean): void;
|
|
24
|
-
export declare function isDisabledShowTooltipToAllChartInstances(): boolean;
|
|
25
|
-
export declare function disableTooltipToAllChartInstances(): void;
|
|
26
|
-
export declare function enableTooltipToAllChartInstances(): void;
|
|
13
|
+
export declare function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI): void;
|
|
@@ -1,223 +1,136 @@
|
|
|
1
1
|
import { isValid } from "@visactor/vutils";
|
|
2
2
|
|
|
3
|
-
let brushingChartInstance, brushingChartInstanceCellPos = {
|
|
4
|
-
col: -1,
|
|
5
|
-
row: -1
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function setBrushingChartInstance(chartInstance, col, row) {
|
|
9
|
-
brushingChartInstance = chartInstance, brushingChartInstanceCellPos = {
|
|
10
|
-
col: col,
|
|
11
|
-
row: row
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function clearBrushingChartInstance() {
|
|
16
|
-
brushingChartInstance = void 0, brushingChartInstanceCellPos = {
|
|
17
|
-
col: -1,
|
|
18
|
-
row: -1
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getBrushingChartInstance() {
|
|
23
|
-
return brushingChartInstance;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function getBrushingChartInstanceCellPos() {
|
|
27
|
-
return brushingChartInstanceCellPos;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
3
|
export const chartInstanceListColumnByColumnDirection = {};
|
|
31
4
|
|
|
32
5
|
export const chartInstanceListRowByRowDirection = {};
|
|
33
6
|
|
|
34
|
-
const delayRunDimensionHoverTimer = [];
|
|
35
|
-
|
|
36
7
|
export function generateChartInstanceListByColumnDirection(col, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = !1, isScatter = !1) {
|
|
37
8
|
var _a;
|
|
38
|
-
|
|
9
|
+
isValid(chartInstanceListColumnByColumnDirection[col]) || (chartInstanceListColumnByColumnDirection[col] = {});
|
|
39
10
|
const {rowStart: rowStart} = table.getBodyVisibleRowRange();
|
|
40
11
|
let rowEnd = table.getBodyVisibleRowRange().rowEnd;
|
|
41
12
|
rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
|
|
42
13
|
for (let i = rowStart; i <= rowEnd; i++) {
|
|
43
14
|
const cellGroup = table.scenegraph.getCell(col, i), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
|
|
44
|
-
chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var _a, _b, _c, _d;
|
|
15
|
+
chartNode.addUpdateShapeAndBoundsTag(), chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.activeChartInstance || chartNode.activate(table),
|
|
16
|
+
chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance),
|
|
17
|
+
setTimeout((() => {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
48
19
|
if (null === (_a = chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
|
|
49
20
|
const chartDimensionLinkage = table.options.chartDimensionLinkage;
|
|
50
21
|
let isShowTooltip = !isScatter;
|
|
51
|
-
if (isScatter
|
|
52
|
-
|
|
53
|
-
const
|
|
22
|
+
if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
|
|
23
|
+
i === rowEnd && isShowTooltip) {
|
|
24
|
+
const heightLimitToShowTooltipForEdgeRow = null !== (_c = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _c ? _c : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
|
|
25
|
+
if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
|
|
26
|
+
const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
|
|
27
|
+
isShowTooltip = rowEnd2 !== rowEnd;
|
|
28
|
+
}
|
|
29
|
+
} else if (i === rowStart && isShowTooltip) {
|
|
30
|
+
const heightLimitToShowTooltipForEdgeRow = null !== (_d = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _d ? _d : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
|
|
31
|
+
if (rowStart1 === rowStart) isShowTooltip = !0; else {
|
|
32
|
+
const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
|
|
33
|
+
isShowTooltip = rowStart2 !== rowStart;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (isScatter) table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || null === (_f = (_e = chartInstanceListColumnByColumnDirection[col][i]).showCrosshair) || void 0 === _f || _f.call(_e, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
|
|
37
|
+
const bodyBoundryTop = table.frozenRowCount ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom : 0, absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);
|
|
54
38
|
hideTooltip ? (table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || chartInstanceListColumnByColumnDirection[col][i].hideTooltip(),
|
|
55
39
|
chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
|
|
56
40
|
tooltip: !1,
|
|
57
41
|
showTooltipOption: {
|
|
58
|
-
x: canvasXY.x
|
|
59
|
-
y: absolutePositionTop
|
|
42
|
+
x: canvasXY.x,
|
|
43
|
+
y: absolutePositionTop,
|
|
60
44
|
activeType: "dimension"
|
|
61
45
|
}
|
|
62
46
|
})) : chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
|
|
63
47
|
tooltip: isShowTooltip,
|
|
64
48
|
showTooltipOption: {
|
|
65
|
-
x: canvasXY.x
|
|
66
|
-
y: absolutePositionTop
|
|
49
|
+
x: canvasXY.x,
|
|
50
|
+
y: absolutePositionTop,
|
|
67
51
|
activeType: "dimension"
|
|
68
52
|
}
|
|
69
53
|
});
|
|
70
54
|
}
|
|
71
55
|
}
|
|
72
|
-
}), 0);
|
|
73
|
-
|
|
56
|
+
}), 0), table.scenegraph.updateNextFrame();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function clearChartInstanceListByColumnDirection(col, excludedRow, table) {
|
|
61
|
+
var _a;
|
|
62
|
+
if (isValid(chartInstanceListColumnByColumnDirection[col])) {
|
|
63
|
+
for (const i in chartInstanceListColumnByColumnDirection[col]) {
|
|
64
|
+
if (isValid(excludedRow) && Number(i) === excludedRow) continue;
|
|
65
|
+
const cellGroup = table.scenegraph.getCell(col, Number(i)), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
|
|
66
|
+
chartNode.addUpdateShapeAndBoundsTag(), isValid(chartNode) && (chartNode.deactivate(table, {
|
|
67
|
+
releaseChartInstance: !0,
|
|
68
|
+
releaseColumnChartInstance: !1,
|
|
69
|
+
releaseRowChartInstance: !1
|
|
70
|
+
}), chartInstanceListColumnByColumnDirection[col][i] = null);
|
|
71
|
+
}
|
|
72
|
+
delete chartInstanceListColumnByColumnDirection[col];
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
export function generateChartInstanceListByRowDirection(row, dimensionValueOrXValue, positionValueOrYValue, canvasXY, table, hideTooltip = !1, isScatter = !1) {
|
|
78
77
|
var _a;
|
|
79
|
-
|
|
78
|
+
isValid(chartInstanceListRowByRowDirection[row]) || (chartInstanceListRowByRowDirection[row] = {});
|
|
80
79
|
const {colStart: colStart} = table.getBodyVisibleColRange();
|
|
81
80
|
let colEnd = table.getBodyVisibleColRange().colEnd;
|
|
82
81
|
colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
|
|
83
82
|
for (let i = colStart; i <= colEnd; i++) {
|
|
84
83
|
const cellGroup = table.scenegraph.getCell(i, row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
|
|
85
|
-
chartInstanceListRowByRowDirection[row][i] || isValid(chartNode) && (chartNode.
|
|
86
|
-
|
|
87
|
-
const timer = setTimeout((() => {
|
|
84
|
+
chartNode.addUpdateShapeAndBoundsTag(), chartInstanceListRowByRowDirection[row][i] || isValid(chartNode) && (chartNode.activeChartInstance || chartNode.activate(table),
|
|
85
|
+
chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance), setTimeout((() => {
|
|
88
86
|
var _a, _b, _c, _d;
|
|
89
87
|
if (null === (_a = chartInstanceListRowByRowDirection[row]) || void 0 === _a ? void 0 : _a[i]) {
|
|
90
88
|
const chartDimensionLinkage = table.options.chartDimensionLinkage;
|
|
91
89
|
let isShowTooltip = !isScatter;
|
|
92
|
-
if (isScatter
|
|
93
|
-
|
|
94
|
-
const
|
|
90
|
+
if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
|
|
91
|
+
i === colEnd && isShowTooltip) {
|
|
92
|
+
const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
|
|
93
|
+
if (colEnd1 === colEnd) isShowTooltip = !0; else {
|
|
94
|
+
const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
|
|
95
|
+
isShowTooltip = colEnd2 !== colEnd;
|
|
96
|
+
}
|
|
97
|
+
} else if (i === colStart && isShowTooltip) {
|
|
98
|
+
const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
|
|
99
|
+
if (colStart1 === colStart) isShowTooltip = !0; else {
|
|
100
|
+
const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
|
|
101
|
+
isShowTooltip = colStart2 !== colStart;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (isScatter) table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || null === (_d = (_c = chartInstanceListRowByRowDirection[row][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
|
|
105
|
+
const bodyBoundryLeft = table.frozenColCount ? table.getCellRelativeRect(table.frozenColCount - 1, row).right : 0, absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);
|
|
95
106
|
hideTooltip ? (table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || chartInstanceListRowByRowDirection[row][i].hideTooltip(),
|
|
96
107
|
chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
|
|
97
108
|
tooltip: !1,
|
|
98
109
|
showTooltipOption: {
|
|
99
|
-
x: absolutePositionLeft
|
|
100
|
-
y: canvasXY.y
|
|
110
|
+
x: absolutePositionLeft,
|
|
111
|
+
y: canvasXY.y,
|
|
101
112
|
activeType: "dimension"
|
|
102
113
|
}
|
|
103
114
|
})) : chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
|
|
104
115
|
tooltip: isShowTooltip,
|
|
105
116
|
showTooltipOption: {
|
|
106
|
-
x: absolutePositionLeft
|
|
107
|
-
y: canvasXY.y
|
|
117
|
+
x: absolutePositionLeft,
|
|
118
|
+
y: canvasXY.y,
|
|
108
119
|
activeType: "dimension"
|
|
109
120
|
}
|
|
110
121
|
});
|
|
111
122
|
}
|
|
112
123
|
}
|
|
113
|
-
}), 0);
|
|
114
|
-
delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function generateChartInstanceListByViewRange(datum, table, deactivate = !1) {
|
|
119
|
-
var _a;
|
|
120
|
-
clearDelayRunDimensionHoverTimers();
|
|
121
|
-
const {rowStart: rowStart} = table.getBodyVisibleRowRange();
|
|
122
|
-
let rowEnd = table.getBodyVisibleRowRange().rowEnd;
|
|
123
|
-
rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
|
|
124
|
-
const {colStart: colStart} = table.getBodyVisibleColRange();
|
|
125
|
-
let colEnd = table.getBodyVisibleColRange().colEnd;
|
|
126
|
-
colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
|
|
127
|
-
for (let col = colStart; col <= colEnd; col++) {
|
|
128
|
-
isValid(chartInstanceListColumnByColumnDirection[col]) || (chartInstanceListColumnByColumnDirection[col] = {});
|
|
129
|
-
for (let i = rowStart; i <= rowEnd; i++) {
|
|
130
|
-
const cellGroup = table.scenegraph.getCell(col, i), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
|
|
131
|
-
chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(),
|
|
132
|
-
chartNode.activeChartInstance ? chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance : "pie" === chartNode.attribute.spec.type && (chartNode.activate(table),
|
|
133
|
-
chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance));
|
|
134
|
-
const timer = setTimeout((() => {
|
|
135
|
-
var _a, _b;
|
|
136
|
-
if (null === (_a = chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
|
|
137
|
-
const chartDimensionLinkage = table.options.chartDimensionLinkage;
|
|
138
|
-
let isShowTooltip = !0;
|
|
139
|
-
"object" == typeof chartDimensionLinkage && (deactivate ? (chartInstanceListColumnByColumnDirection[col][i].setHovered(),
|
|
140
|
-
chartInstanceListColumnByColumnDirection[col][i].hideTooltip()) : (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
|
|
141
|
-
isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table), isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(col, table),
|
|
142
|
-
chartInstanceListColumnByColumnDirection[col][i].setHovered(datum), isShowTooltip && chartInstanceListColumnByColumnDirection[col][i].showTooltip(datum, {
|
|
143
|
-
activeType: "mark"
|
|
144
|
-
})));
|
|
145
|
-
}
|
|
146
|
-
}), 0);
|
|
147
|
-
delayRunDimensionHoverTimer.push(timer), table.scenegraph.updateNextFrame();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function checkIsShowTooltipForEdgeRow(row, table) {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
let isShowTooltip = !0;
|
|
155
|
-
const {rowStart: rowStart} = table.getBodyVisibleRowRange();
|
|
156
|
-
let rowEnd = table.getBodyVisibleRowRange().rowEnd;
|
|
157
|
-
rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
|
|
158
|
-
const chartDimensionLinkage = table.options.chartDimensionLinkage;
|
|
159
|
-
if (row === rowEnd && isShowTooltip) {
|
|
160
|
-
const heightLimitToShowTooltipForEdgeRow = null !== (_a = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _a ? _a : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
|
|
161
|
-
if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
|
|
162
|
-
const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
|
|
163
|
-
isShowTooltip = rowEnd2 !== rowEnd;
|
|
164
|
-
}
|
|
165
|
-
} else if (row === rowStart && isShowTooltip) {
|
|
166
|
-
const heightLimitToShowTooltipForEdgeRow = null !== (_b = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _b ? _b : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
|
|
167
|
-
if (rowStart1 === rowStart) isShowTooltip = !0; else {
|
|
168
|
-
const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
|
|
169
|
-
isShowTooltip = rowStart2 !== rowStart;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return isShowTooltip;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function checkIsShowTooltipForEdgeColumn(col, table) {
|
|
176
|
-
let isShowTooltip = !0;
|
|
177
|
-
const {colStart: colStart} = table.getBodyVisibleColRange();
|
|
178
|
-
let colEnd = table.getBodyVisibleColRange().colEnd;
|
|
179
|
-
colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
|
|
180
|
-
const chartDimensionLinkage = table.options.chartDimensionLinkage;
|
|
181
|
-
if (col === colEnd && isShowTooltip) {
|
|
182
|
-
const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
|
|
183
|
-
if (colEnd1 === colEnd) isShowTooltip = !0; else {
|
|
184
|
-
const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
|
|
185
|
-
isShowTooltip = colEnd2 !== colEnd;
|
|
186
|
-
}
|
|
187
|
-
} else if (col === colStart && isShowTooltip) {
|
|
188
|
-
const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
|
|
189
|
-
if (colStart1 === colStart) isShowTooltip = !0; else {
|
|
190
|
-
const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
|
|
191
|
-
isShowTooltip = colStart2 !== colStart;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return isShowTooltip;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export function clearChartInstanceListByColumnDirection(col, excludedRow, table, forceRelease = !1) {
|
|
198
|
-
var _a;
|
|
199
|
-
if (isValid(chartInstanceListColumnByColumnDirection[col])) {
|
|
200
|
-
for (const i in chartInstanceListColumnByColumnDirection[col]) {
|
|
201
|
-
if (isValid(excludedRow) && Number(i) === excludedRow) continue;
|
|
202
|
-
const cellGroup = table.scenegraph.getCell(col, Number(i)), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
|
|
203
|
-
isValid(chartNode) && (chartNode.addUpdateShapeAndBoundsTag(), chartNode.deactivate(table, {
|
|
204
|
-
forceRelease: forceRelease,
|
|
205
|
-
releaseChartInstance: !0,
|
|
206
|
-
releaseColumnChartInstance: !1,
|
|
207
|
-
releaseRowChartInstance: !1
|
|
208
|
-
}), chartInstanceListColumnByColumnDirection[col][i] = null);
|
|
209
|
-
}
|
|
210
|
-
delete chartInstanceListColumnByColumnDirection[col];
|
|
124
|
+
}), 0), table.scenegraph.updateNextFrame();
|
|
211
125
|
}
|
|
212
126
|
}
|
|
213
127
|
|
|
214
|
-
export function clearChartInstanceListByRowDirection(row, excludedCol, table
|
|
128
|
+
export function clearChartInstanceListByRowDirection(row, excludedCol, table) {
|
|
215
129
|
var _a;
|
|
216
130
|
if (isValid(chartInstanceListRowByRowDirection[row])) for (const i in chartInstanceListRowByRowDirection[row]) {
|
|
217
131
|
if (isValid(excludedCol) && Number(i) === excludedCol) continue;
|
|
218
132
|
const cellGroup = table.scenegraph.getCell(Number(i), row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
|
|
219
|
-
isValid(chartNode) && (chartNode.
|
|
220
|
-
forceRelease: forceRelease,
|
|
133
|
+
chartNode.addUpdateShapeAndBoundsTag(), isValid(chartNode) && (chartNode.deactivate(table, {
|
|
221
134
|
releaseChartInstance: !0,
|
|
222
135
|
releaseColumnChartInstance: !1,
|
|
223
136
|
releaseRowChartInstance: !1
|
|
@@ -225,35 +138,4 @@ export function clearChartInstanceListByRowDirection(row, excludedCol, table, fo
|
|
|
225
138
|
}
|
|
226
139
|
delete chartInstanceListRowByRowDirection[row];
|
|
227
140
|
}
|
|
228
|
-
|
|
229
|
-
export function clearDelayRunDimensionHoverTimers() {
|
|
230
|
-
for (const timer of delayRunDimensionHoverTimer) clearTimeout(timer);
|
|
231
|
-
delayRunDimensionHoverTimer.length = 0;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export function clearAllChartInstanceList(table, forceRelease = !1) {
|
|
235
|
-
clearDelayRunDimensionHoverTimers();
|
|
236
|
-
for (const col in chartInstanceListColumnByColumnDirection) clearChartInstanceListByColumnDirection(Number(col), void 0, table, forceRelease);
|
|
237
|
-
for (const row in chartInstanceListRowByRowDirection) clearChartInstanceListByRowDirection(Number(row), void 0, table, forceRelease);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
let disabledShowTooltipToAllChartInstances = !1;
|
|
241
|
-
|
|
242
|
-
export function isDisabledShowTooltipToAllChartInstances() {
|
|
243
|
-
return disabledShowTooltipToAllChartInstances;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export function disableTooltipToAllChartInstances() {
|
|
247
|
-
disabledShowTooltipToAllChartInstances = !0, clearDelayRunDimensionHoverTimers();
|
|
248
|
-
for (const col in chartInstanceListColumnByColumnDirection) for (const row in chartInstanceListColumnByColumnDirection[col]) chartInstanceListColumnByColumnDirection[col][row].disableTooltip(!0),
|
|
249
|
-
chartInstanceListColumnByColumnDirection[col][row].hideTooltip();
|
|
250
|
-
for (const row in chartInstanceListRowByRowDirection) for (const col in chartInstanceListRowByRowDirection[row]) chartInstanceListRowByRowDirection[row][col].disableTooltip(!0),
|
|
251
|
-
chartInstanceListRowByRowDirection[row][col].hideTooltip();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export function enableTooltipToAllChartInstances() {
|
|
255
|
-
disabledShowTooltipToAllChartInstances = !1;
|
|
256
|
-
for (const col in chartInstanceListColumnByColumnDirection) for (const row in chartInstanceListColumnByColumnDirection[col]) chartInstanceListColumnByColumnDirection[col][row].disableTooltip(!1);
|
|
257
|
-
for (const row in chartInstanceListRowByRowDirection) for (const col in chartInstanceListRowByRowDirection[row]) chartInstanceListRowByRowDirection[row][col].disableTooltip(!1);
|
|
258
|
-
}
|
|
259
141
|
//# sourceMappingURL=active-cell-chart-list.js.map
|