@visactor/vtable 0.17.4-alpha.0 → 0.17.4
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/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.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/scenegraph/graphic/chart.js +11 -4
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/dist/vtable.js +34 -9
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/scenegraph/graphic/chart.js +11 -4
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { updateCell } from './scenegraph/group-creater/cell-helper';
|
|
|
15
15
|
import { renderChart } from './scenegraph/graphic/contributions/chart-render-helper';
|
|
16
16
|
export { getDataCellPath } from './tools/get-data-path';
|
|
17
17
|
export * from './render/jsx';
|
|
18
|
-
export declare const version = "0.17.4
|
|
18
|
+
export declare const version = "0.17.4";
|
|
19
19
|
export { TYPES, core, ListTable, ListTableConstructorOptions, PivotTable, PivotTableConstructorOptions, PivotChartConstructorOptions, PivotChart, IHeaderTreeDefine, IDimension, IIndicator, ITitleDefine, ICornerDefine, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, themes, data, MousePointerCellEvent, getIcons, clearGlobal, register, DataStatistics, CustomLayout, updateCell, renderChart, graphicUtil };
|
|
20
20
|
declare function getIcons(): {
|
|
21
21
|
[key: string]: TYPES.ColumnIconOption;
|
package/cjs/index.js
CHANGED
|
@@ -128,6 +128,6 @@ Object.defineProperty(exports, "getDataCellPath", {
|
|
|
128
128
|
get: function() {
|
|
129
129
|
return get_data_path_1.getDataCellPath;
|
|
130
130
|
}
|
|
131
|
-
}), __exportStar(require("./render/jsx"), exports), exports.version = "0.17.4
|
|
131
|
+
}), __exportStar(require("./render/jsx"), exports), exports.version = "0.17.4",
|
|
132
132
|
exports.getIcons = getIcons, exports.clearGlobal = clearGlobal, TYPES.AggregationType;
|
|
133
133
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAgD;AA4F9C,4FA5FO,qBAAW,OA4FP;AA1Fb,kDAAoC;AAoDlC,sBAAK;AAnDP,6CAA+B;AAoD7B,oBAAI;AAnDN,6CAA+B;AA2E7B,oBAAI;AA1EN,+CAAiC;AACjC,qDAAuC;AA8ErC,4BAAQ;AA7EV,iDAAmC;AAuEjC,wBAAM;AAtER,yEAA2D;AAgFzD,wCAAc;AA1DhB,2CAAwC;AA0BtC,0FA1BO,qBAAS,OA0BP;AAzBX,6CAA0C;AA2BxC,2FA3BO,uBAAU,OA2BP;AA1BZ,6CAA0C;AA6BxC,2FA7BO,uBAAU,OA6BP;AA3BZ,8DAAgD;AAuD9C,oCAAY;AArDd,wEAAoE;AAsDlE,2FAtDO,wBAAU,OAsDP;AArDZ,gGAAqF;AAsDnF,4FAtDO,iCAAW,OAsDP;AAjDb,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAgD;AA4F9C,4FA5FO,qBAAW,OA4FP;AA1Fb,kDAAoC;AAoDlC,sBAAK;AAnDP,6CAA+B;AAoD7B,oBAAI;AAnDN,6CAA+B;AA2E7B,oBAAI;AA1EN,+CAAiC;AACjC,qDAAuC;AA8ErC,4BAAQ;AA7EV,iDAAmC;AAuEjC,wBAAM;AAtER,yEAA2D;AAgFzD,wCAAc;AA1DhB,2CAAwC;AA0BtC,0FA1BO,qBAAS,OA0BP;AAzBX,6CAA0C;AA2BxC,2FA3BO,uBAAU,OA2BP;AA1BZ,6CAA0C;AA6BxC,2FA7BO,uBAAU,OA6BP;AA3BZ,8DAAgD;AAuD9C,oCAAY;AArDd,wEAAoE;AAsDlE,2FAtDO,wBAAU,OAsDP;AArDZ,gGAAqF;AAsDnF,4FAtDO,iCAAW,OAsDP;AAjDb,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,QAAQ,CAAC;AAmDhC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAnBC,4BAAQ;AAqBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AAxBC,kCAAW;AAyBb,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { graphicUtil } from '@visactor/vrender';\n\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\nimport { updateCell } from './scenegraph/group-creater/cell-helper';\nimport { renderChart } from './scenegraph/graphic/contributions/chart-render-helper';\n\n// import { container, loadCanvasPicker } from '@visactor/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"0.17.4\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout,\n updateCell,\n renderChart,\n graphicUtil\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n"]}
|
|
@@ -31,10 +31,7 @@ class Chart extends vrender_1.Group {
|
|
|
31
31
|
activate(table) {
|
|
32
32
|
var _a, _b, _c, _d;
|
|
33
33
|
this.active = !0;
|
|
34
|
-
const {x1: x1, y1: y1, x2: x2, y2: y2} = this.getViewBox(),
|
|
35
|
-
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth(), bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth(),
|
|
36
|
-
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight(), bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
|
|
37
|
-
const clipBound = bodyBound.intersect({
|
|
34
|
+
const {col: col, row: row} = this.parent, {x1: x1, y1: y1, x2: x2, y2: y2} = this.getViewBox(), clipBound = getTableBounds(col, row, table).intersect({
|
|
38
35
|
x1: x1 - table.scrollLeft,
|
|
39
36
|
x2: x2 - table.scrollLeft,
|
|
40
37
|
y1: y1 - table.scrollTop,
|
|
@@ -98,5 +95,15 @@ class Chart extends vrender_1.Group {
|
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
97
|
|
|
98
|
+
function getTableBounds(col, row, table) {
|
|
99
|
+
const {layoutMap: layoutMap} = table.internalProps, bodyBound = new vutils_1.Bounds, tableBound = table.scenegraph.tableGroup.globalAABBBounds;
|
|
100
|
+
return bodyBound.x1 = tableBound.x1, bodyBound.x2 = tableBound.x2, bodyBound.y1 = tableBound.y1,
|
|
101
|
+
bodyBound.y2 = tableBound.y2, layoutMap.isFrozenColumn(col, row) || layoutMap.isRightFrozenColumn(col, row) ? layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row) || (layoutMap.isFrozenColumn(col, row) || layoutMap.isRightFrozenColumn(col, row) ? (bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight(),
|
|
102
|
+
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight()) : layoutMap.isBottomFrozenRow(col, row) && (bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth(),
|
|
103
|
+
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth())) : (bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth(),
|
|
104
|
+
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth(), bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight(),
|
|
105
|
+
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight()), bodyBound;
|
|
106
|
+
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AC,GAAG,KAAK,CAAC,UAAU,CAAC;YAC5E,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;YACxG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;YAC3E,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;SACzG,CAAC;IACJ,CAAC;;AAjKH,sBAkKC;AA3CQ,UAAI,GAAW,CAAC,CAAC","file":"chart.js","sourcesContent":["import type { GraphicType, IGroupGraphicAttribute } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\nimport { Bounds } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotChart } from '../../PivotChart';\n\ninterface IChartGraphicAttribute extends IGroupGraphicAttribute {\n canvas: HTMLCanvasElement;\n dataId: string | Record<string, string>; //如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> <dataId, series-chart的指标key用于过滤数据>\n data: any;\n spec: any;\n axes: any;\n ClassType: any;\n chartInstance: any;\n cellPadding: number[];\n mode: string;\n modeParams: any;\n dpr: number;\n // viewBox: {\n // x1: number;\n // y1: number;\n // x2: number;\n // y2: number;\n // };\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\nexport class Chart extends Group {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n chartInstance: any;\n activeChartInstance: any;\n active: boolean;\n cacheCanvas: HTMLCanvasElement | { x: number; y: number; width: number; height: number; canvas: HTMLCanvasElement }[]; // HTMLCanvasElement\n\n constructor(params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n\n // 创建chart\n if (!params.chartInstance) {\n params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {\n renderCanvas: params.canvas,\n mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',\n modeParams: this.attribute.modeParams,\n canvasControled: false,\n viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },\n dpr: params.dpr,\n // viewBox: params.viewBox,\n // viewBox: this.getViewBox(),\n // viewBox: {\n // x1: params.cellPadding[3],\n // x2: params.width - params.cellPadding[1],\n // y1: params.cellPadding[0],\n // y2: params.height - params.cellPadding[2]\n // },\n interactive: false,\n animation: false,\n autoFit: false\n });\n this.chartInstance.renderSync();\n } else {\n this.chartInstance = params.chartInstance;\n }\n\n // this.chart.load().then((cache) => {\n // this.cacheCanvas = cache;\n // this.deactivate();\n // });\n }\n\n // onBeforeAttributeUpdate() {\n // if (arguments[2] === y) {\n // debugger;\n // }\n // }\n /**\n * 激活该图表元素\n * @param table\n */\n activate(table: BaseTableAPI) {\n this.active = true;\n // this.chart = new TestChart(this.attribute.spec);\n // const ctx = this.attribute.canvas.getContext('2d');\n // const { x1, y1, x2, y2 } = this.attribute.viewBox;\n const { x1, y1, x2, y2 } = this.getViewBox();\n //获取渲染区域的bound 考虑被表头遮住部分的情况\n const tableBound = table.scenegraph.tableGroup.globalAABBBounds;\n const bodyBound = new Bounds();\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n const clipBound = bodyBound.intersect({\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n });\n this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {\n // disableDirtyBounds: true,\n renderCanvas: this.attribute.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n viewBox: {\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n },\n dpr: table.internalProps.pixelRatio,\n animation: false,\n interactive: true,\n autoFit: false, //控制当容器变化大小时vchart实例不应响应事件进行内部处理\n beforeRender: (stage: any) => {\n const ctx = stage.window.getContext();\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.beginPath();\n ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);\n ctx.clip();\n },\n afterRender(stage: any) {\n const ctx = stage.window.getContext();\n ctx.inuse = false;\n }\n });\n // this.activeChartInstance.updateData('data', this.attribute.data);\n this.activeChartInstance.renderSync();\n\n (table.internalProps.layoutMap as any)?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);\n this.activeChartInstance.on('click', (params: any) => {\n if (Chart.temp) {\n table.scenegraph.updateChartState(params?.datum);\n }\n });\n this.activeChartInstance.on('brushEnd', (params: any) => {\n table.scenegraph.updateChartState(params?.value?.inBrushData);\n Chart.temp = 0;\n setTimeout(() => {\n Chart.temp = 1;\n }, 0);\n });\n (table as PivotChart)._bindChartEvent?.(this.activeChartInstance);\n }\n static temp: number = 1;\n /**\n * 图表失去焦点\n * @param table\n */\n deactivate() {\n this.active = false;\n // move active chart view box out of broswer view\n // to avoid async render when chart is releasd\n this.activeChartInstance?.updateViewBox(\n {\n x1: -1000,\n x2: -800,\n y1: -1000,\n y2: -800\n },\n false,\n false\n );\n this.activeChartInstance?.release();\n this.activeChartInstance = null;\n }\n /** 更新图表对应数据 */\n updateData(data: any) {\n this.attribute.data = data;\n }\n\n getViewBox(): {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n } {\n const cellGroup = this.parent as Group;\n const padding = this.attribute.cellPadding;\n const table = (this.stage as any).table as BaseTableAPI;\n return {\n x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),\n x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),\n y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),\n y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/chart.ts"],"names":[],"mappings":";;;AACA,+CAAyD;AACzD,6CAA0C;AAwB7B,QAAA,iBAAiB,GAAG,IAAA,uBAAa,GAAE,CAAC;AAEjD,MAAa,KAAM,SAAQ,eAAK;IAQ9B,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,SAAI,GAAgB,OAAc,CAAC;QASjC,IAAI,CAAC,UAAU,GAAG,yBAAiB,CAAC;QAGpC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;YACzB,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC5E,YAAY,EAAE,MAAM,CAAC,MAAM;gBAC3B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB;gBACjE,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU;gBACrC,eAAe,EAAE,KAAK;gBACtB,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE;gBACvC,GAAG,EAAE,MAAM,CAAC,GAAG;gBASf,WAAW,EAAE,KAAK;gBAClB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,KAAK;aACf,CAA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C/D,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,mBAAmB,EAAE,CAAC;QAC3D,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,yBAAyB,EAAE,CAAC;KAClE;SAAM,IAAI,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE;KAE1F;SAAM,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE;QAE7C,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,mBAAmB,EAAE,CAAC;QAC3D,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,yBAAyB,EAAE,CAAC;KAClE;SAAM,IAAI,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE;QAElD,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,mBAAmB,EAAE,CAAC;QAC3D,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,yBAAyB,EAAE,CAAC;KAClE;SAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE;QAEhD,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC1D,SAAS,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,uBAAuB,EAAE,CAAC;KAChE;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","file":"chart.js","sourcesContent":["import type { GraphicType, IGroupGraphicAttribute } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\nimport { Bounds } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotChart } from '../../PivotChart';\n\ninterface IChartGraphicAttribute extends IGroupGraphicAttribute {\n canvas: HTMLCanvasElement;\n dataId: string | Record<string, string>; //如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> <dataId, series-chart的指标key用于过滤数据>\n data: any;\n spec: any;\n axes: any;\n ClassType: any;\n chartInstance: any;\n cellPadding: number[];\n mode: string;\n modeParams: any;\n dpr: number;\n // viewBox: {\n // x1: number;\n // y1: number;\n // x2: number;\n // y2: number;\n // };\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\nexport class Chart extends Group {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n chartInstance: any;\n activeChartInstance: any;\n active: boolean;\n cacheCanvas: HTMLCanvasElement | { x: number; y: number; width: number; height: number; canvas: HTMLCanvasElement }[]; // HTMLCanvasElement\n\n constructor(params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n\n // 创建chart\n if (!params.chartInstance) {\n params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {\n renderCanvas: params.canvas,\n mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',\n modeParams: this.attribute.modeParams,\n canvasControled: false,\n viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },\n dpr: params.dpr,\n // viewBox: params.viewBox,\n // viewBox: this.getViewBox(),\n // viewBox: {\n // x1: params.cellPadding[3],\n // x2: params.width - params.cellPadding[1],\n // y1: params.cellPadding[0],\n // y2: params.height - params.cellPadding[2]\n // },\n interactive: false,\n animation: false,\n autoFit: false\n });\n this.chartInstance.renderSync();\n } else {\n this.chartInstance = params.chartInstance;\n }\n\n // this.chart.load().then((cache) => {\n // this.cacheCanvas = cache;\n // this.deactivate();\n // });\n }\n\n // onBeforeAttributeUpdate() {\n // if (arguments[2] === y) {\n // debugger;\n // }\n // }\n /**\n * 激活该图表元素\n * @param table\n */\n activate(table: BaseTableAPI) {\n this.active = true;\n const { col, row } = this.parent;\n // this.chart = new TestChart(this.attribute.spec);\n // const ctx = this.attribute.canvas.getContext('2d');\n // const { x1, y1, x2, y2 } = this.attribute.viewBox;\n const { x1, y1, x2, y2 } = this.getViewBox();\n //获取渲染区域的bound 考虑被表头遮住部分的情况\n const tableBound = getTableBounds(col, row, table);\n const clipBound = tableBound.intersect({\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n });\n this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {\n // disableDirtyBounds: true,\n renderCanvas: this.attribute.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n viewBox: {\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n },\n dpr: table.internalProps.pixelRatio,\n animation: false,\n interactive: true,\n autoFit: false, //控制当容器变化大小时vchart实例不应响应事件进行内部处理\n beforeRender: (stage: any) => {\n const ctx = stage.window.getContext();\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.beginPath();\n ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);\n ctx.clip();\n },\n afterRender(stage: any) {\n const ctx = stage.window.getContext();\n ctx.inuse = false;\n }\n });\n // this.activeChartInstance.updateData('data', this.attribute.data);\n this.activeChartInstance.renderSync();\n\n (table.internalProps.layoutMap as any)?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);\n this.activeChartInstance.on('click', (params: any) => {\n if (Chart.temp) {\n table.scenegraph.updateChartState(params?.datum);\n }\n });\n this.activeChartInstance.on('brushEnd', (params: any) => {\n table.scenegraph.updateChartState(params?.value?.inBrushData);\n Chart.temp = 0;\n setTimeout(() => {\n Chart.temp = 1;\n }, 0);\n });\n (table as PivotChart)._bindChartEvent?.(this.activeChartInstance);\n }\n static temp: number = 1;\n /**\n * 图表失去焦点\n * @param table\n */\n deactivate() {\n this.active = false;\n // move active chart view box out of broswer view\n // to avoid async render when chart is releasd\n this.activeChartInstance?.updateViewBox(\n {\n x1: -1000,\n x2: -800,\n y1: -1000,\n y2: -800\n },\n false,\n false\n );\n this.activeChartInstance?.release();\n this.activeChartInstance = null;\n }\n /** 更新图表对应数据 */\n updateData(data: any) {\n this.attribute.data = data;\n }\n\n getViewBox(): {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n } {\n const cellGroup = this.parent as Group;\n const padding = this.attribute.cellPadding;\n const table = (this.stage as any).table as BaseTableAPI;\n return {\n x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),\n x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),\n y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),\n y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)\n };\n }\n}\n\nfunction getTableBounds(col: number, row: number, table: BaseTableAPI) {\n const { layoutMap } = table.internalProps;\n const bodyBound = new Bounds();\n const tableBound = table.scenegraph.tableGroup.globalAABBBounds;\n bodyBound.x1 = tableBound.x1;\n bodyBound.x2 = tableBound.x2;\n bodyBound.y1 = tableBound.y1;\n bodyBound.y2 = tableBound.y2;\n\n if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {\n // no frozen body\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) {\n // frozen cornor\n } else if (layoutMap.isFrozenColumn(col, row)) {\n // left frozen\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isRightFrozenColumn(col, row)) {\n // right frozen\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isBottomFrozenRow(col, row)) {\n // bottom frozen\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n }\n\n return bodyBound;\n}\n"]}
|
package/dist/vtable.js
CHANGED
|
@@ -50350,14 +50350,10 @@
|
|
|
50350
50350
|
}
|
|
50351
50351
|
activate(table) {
|
|
50352
50352
|
this.active = true;
|
|
50353
|
+
const { col, row } = this.parent;
|
|
50353
50354
|
const { x1, y1, x2, y2 } = this.getViewBox();
|
|
50354
|
-
const tableBound = table
|
|
50355
|
-
const
|
|
50356
|
-
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
|
|
50357
|
-
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
|
|
50358
|
-
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
|
|
50359
|
-
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
|
|
50360
|
-
const clipBound = bodyBound.intersect({
|
|
50355
|
+
const tableBound = getTableBounds(col, row, table);
|
|
50356
|
+
const clipBound = tableBound.intersect({
|
|
50361
50357
|
x1: x1 - table.scrollLeft,
|
|
50362
50358
|
x2: x2 - table.scrollLeft,
|
|
50363
50359
|
y1: y1 - table.scrollTop,
|
|
@@ -50434,6 +50430,35 @@
|
|
|
50434
50430
|
};
|
|
50435
50431
|
}
|
|
50436
50432
|
}
|
|
50433
|
+
function getTableBounds(col, row, table) {
|
|
50434
|
+
const { layoutMap } = table.internalProps;
|
|
50435
|
+
const bodyBound = new Bounds$1();
|
|
50436
|
+
const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
|
|
50437
|
+
bodyBound.x1 = tableBound.x1;
|
|
50438
|
+
bodyBound.x2 = tableBound.x2;
|
|
50439
|
+
bodyBound.y1 = tableBound.y1;
|
|
50440
|
+
bodyBound.y2 = tableBound.y2;
|
|
50441
|
+
if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
|
|
50442
|
+
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
|
|
50443
|
+
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
|
|
50444
|
+
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
|
|
50445
|
+
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
|
|
50446
|
+
}
|
|
50447
|
+
else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) ;
|
|
50448
|
+
else if (layoutMap.isFrozenColumn(col, row)) {
|
|
50449
|
+
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
|
|
50450
|
+
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
|
|
50451
|
+
}
|
|
50452
|
+
else if (layoutMap.isRightFrozenColumn(col, row)) {
|
|
50453
|
+
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
|
|
50454
|
+
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
|
|
50455
|
+
}
|
|
50456
|
+
else if (layoutMap.isBottomFrozenRow(col, row)) {
|
|
50457
|
+
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
|
|
50458
|
+
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
|
|
50459
|
+
}
|
|
50460
|
+
return bodyBound;
|
|
50461
|
+
}
|
|
50437
50462
|
|
|
50438
50463
|
const chartTypes = {};
|
|
50439
50464
|
|
|
@@ -66796,7 +66821,7 @@
|
|
|
66796
66821
|
return TABLE_EVENT_TYPE;
|
|
66797
66822
|
}
|
|
66798
66823
|
options;
|
|
66799
|
-
version = "0.17.4
|
|
66824
|
+
version = "0.17.4";
|
|
66800
66825
|
pagination;
|
|
66801
66826
|
id = `VTable${Date.now()}`;
|
|
66802
66827
|
headerStyleCache;
|
|
@@ -77494,7 +77519,7 @@
|
|
|
77494
77519
|
return new Tag$1(params ? params.attribute : {});
|
|
77495
77520
|
}
|
|
77496
77521
|
|
|
77497
|
-
const version = "0.17.4
|
|
77522
|
+
const version = "0.17.4";
|
|
77498
77523
|
function getIcons() {
|
|
77499
77524
|
return get$2();
|
|
77500
77525
|
}
|