@visactor/vtable 1.10.2 → 1.10.3-alpha.0
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/body-helper/style.js +1 -2
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/FouseInput.js +2 -1
- package/cjs/dataset/dataset-pivot-table.js +1 -2
- package/cjs/edit/edit-manager.js +2 -1
- package/cjs/header-helper/header-helper.js +1 -1
- package/cjs/header-helper/style.js +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +20 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/index.js +1 -2
- package/cjs/layout/simple-header-layout.js +1 -1
- package/cjs/layout/tree-helper.js +2 -2
- package/cjs/plugins/carousel-animation.d.ts +29 -0
- package/cjs/plugins/carousel-animation.js +60 -0
- package/cjs/plugins/carousel-animation.js.map +1 -0
- package/cjs/plugins/chartModules.js +1 -1
- package/cjs/plugins/custom-cell-style.js +1 -1
- package/cjs/plugins/icons.js +2 -1
- package/cjs/plugins/invert-highlight.d.ts +19 -0
- package/cjs/plugins/invert-highlight.js +72 -0
- package/cjs/plugins/invert-highlight.js.map +1 -0
- package/cjs/plugins/list-tree-stick-cell.js +1 -1
- package/cjs/plugins/themes.js +1 -1
- package/cjs/scenegraph/graphic/group.js +2 -1
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +3 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +2 -2
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/tools/cell-range.d.ts +2 -0
- package/cjs/tools/cell-range.js +10 -0
- package/cjs/tools/cell-range.js.map +1 -0
- package/cjs/ts-types/base-table.d.ts +5 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +212 -4
- package/dist/vtable.min.js +2 -2
- package/es/body-helper/style.js +1 -2
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/FouseInput.js +2 -1
- package/es/dataset/dataset-pivot-table.js +1 -2
- package/es/edit/edit-manager.js +2 -1
- package/es/header-helper/header-helper.js +1 -1
- package/es/header-helper/style.js +1 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.js.map +1 -1
- package/es/layout/index.js +1 -2
- package/es/layout/simple-header-layout.js +1 -1
- package/es/layout/tree-helper.js +1 -1
- package/es/plugins/carousel-animation.d.ts +29 -0
- package/es/plugins/carousel-animation.js +52 -0
- package/es/plugins/carousel-animation.js.map +1 -0
- package/es/plugins/chartModules.js +1 -1
- package/es/plugins/custom-cell-style.js +1 -1
- package/es/plugins/icons.js +2 -1
- package/es/plugins/invert-highlight.d.ts +19 -0
- package/es/plugins/invert-highlight.js +69 -0
- package/es/plugins/invert-highlight.js.map +1 -0
- package/es/plugins/list-tree-stick-cell.js +1 -1
- package/es/plugins/themes.js +1 -1
- package/es/scenegraph/graphic/group.js +2 -1
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +4 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +2 -2
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/tools/cell-range.d.ts +2 -0
- package/es/tools/cell-range.js +4 -0
- package/es/tools/cell-range.js.map +1 -0
- package/es/ts-types/base-table.d.ts +5 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/core/FouseInput.js
CHANGED
package/cjs/edit/edit-manager.js
CHANGED
package/cjs/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { restoreMeasureText, setCustomAlphabetCharSet } from './scenegraph/utils
|
|
|
19
19
|
export { getDataCellPath } from './tools/get-data-path';
|
|
20
20
|
export * from './render/jsx';
|
|
21
21
|
export { getTargetCell } from './event/util';
|
|
22
|
-
export declare const version = "1.10.
|
|
22
|
+
export declare const version = "1.10.3-alpha.0";
|
|
23
23
|
export { TYPES, core, ListTable, ListTableSimple, ListTableConstructorOptions, PivotTable, PivotTableSimple, PivotTableConstructorOptions, PivotChartConstructorOptions, PivotChart, GanttConstructorOptions, 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, setCustomAlphabetCharSet, restoreMeasureText };
|
|
24
24
|
declare function getIcons(): {
|
|
25
25
|
[key: string]: TYPES.ColumnIconOption;
|
|
@@ -29,3 +29,5 @@ export * from './components';
|
|
|
29
29
|
export * from './scenegraph/group-creater/cell-type';
|
|
30
30
|
export { TABLE_EVENT_TYPE } from './core/TABLE_EVENT_TYPE';
|
|
31
31
|
export { PIVOT_CHART_EVENT_TYPE, PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';
|
|
32
|
+
export { InvertHighlightPlugin } from './plugins/invert-highlight';
|
|
33
|
+
export { CarouselAnimationPlugin } from './plugins/carousel-animation';
|
package/cjs/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
29
29
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", {
|
|
31
31
|
value: !0
|
|
32
|
-
}), exports.PIVOT_TABLE_EVENT_TYPE = exports.PIVOT_CHART_EVENT_TYPE = exports.TABLE_EVENT_TYPE = exports.restoreMeasureText = exports.setCustomAlphabetCharSet = exports.graphicUtil = exports.renderChart = exports.updateCell = exports.CustomLayout = exports.DataStatistics = exports.register = exports.clearGlobal = exports.getIcons = exports.data = exports.themes = exports.PivotChart = exports.PivotTableSimple = exports.PivotTable = exports.ListTableSimple = exports.ListTable = exports.core = exports.TYPES = exports.version = exports.getTargetCell = exports.getDataCellPath = void 0;
|
|
32
|
+
}), exports.CarouselAnimationPlugin = exports.InvertHighlightPlugin = exports.PIVOT_TABLE_EVENT_TYPE = exports.PIVOT_CHART_EVENT_TYPE = exports.TABLE_EVENT_TYPE = exports.restoreMeasureText = exports.setCustomAlphabetCharSet = exports.graphicUtil = exports.renderChart = exports.updateCell = exports.CustomLayout = exports.DataStatistics = exports.register = exports.clearGlobal = exports.getIcons = exports.data = exports.themes = exports.PivotChart = exports.PivotTableSimple = exports.PivotTable = exports.ListTableSimple = exports.ListTable = exports.core = exports.TYPES = exports.version = exports.getTargetCell = exports.getDataCellPath = void 0;
|
|
33
33
|
|
|
34
34
|
const vrender_1 = require("./vrender");
|
|
35
35
|
|
|
@@ -169,7 +169,7 @@ Object.defineProperty(exports, "getTargetCell", {
|
|
|
169
169
|
get: function() {
|
|
170
170
|
return util_1.getTargetCell;
|
|
171
171
|
}
|
|
172
|
-
}), exports.version = "1.10.
|
|
172
|
+
}), exports.version = "1.10.3-alpha.0", exports.getIcons = getIcons, exports.clearGlobal = clearGlobal,
|
|
173
173
|
TYPES.AggregationType, __exportStar(require("./components"), exports), __exportStar(require("./scenegraph/group-creater/cell-type"), exports);
|
|
174
174
|
|
|
175
175
|
var TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE");
|
|
@@ -194,4 +194,22 @@ Object.defineProperty(exports, "PIVOT_CHART_EVENT_TYPE", {
|
|
|
194
194
|
return PIVOT_TABLE_EVENT_TYPE_1.PIVOT_TABLE_EVENT_TYPE;
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
|
+
|
|
198
|
+
var invert_highlight_1 = require("./plugins/invert-highlight");
|
|
199
|
+
|
|
200
|
+
Object.defineProperty(exports, "InvertHighlightPlugin", {
|
|
201
|
+
enumerable: !0,
|
|
202
|
+
get: function() {
|
|
203
|
+
return invert_highlight_1.InvertHighlightPlugin;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
var carousel_animation_1 = require("./plugins/carousel-animation");
|
|
208
|
+
|
|
209
|
+
Object.defineProperty(exports, "CarouselAnimationPlugin", {
|
|
210
|
+
enumerable: !0,
|
|
211
|
+
get: function() {
|
|
212
|
+
return carousel_animation_1.CarouselAnimationPlugin;
|
|
213
|
+
}
|
|
214
|
+
});
|
|
197
215
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAA4D;AAyG1D,4FAzGO,qBAAW,OAyGP;AAxGb,IAAA,4BAAkB,GAAE,CAAC;AAErB,kDAAoC;AA6DlC,sBAAK;AA5DP,6CAA+B;AA6D7B,oBAAI;AA5DN,6CAA+B;AAuF7B,oBAAI;AAtFN,+CAAiC;AACjC,qDAAuC;AA0FrC,4BAAQ;AAzFV,iDAAmC;AAmFjC,wBAAM;AAlFR,yEAA2D;AA4FzD,wCAAc;AArEhB,mDAA4D;AAkC1D,0FAlCuB,4BAAS,OAkCvB;AAjCX,yDAAqD;AAkCnD,gGAlCO,kCAAe,OAkCP;AAhCjB,qDAA+D;AAkC7D,2FAlCwB,8BAAU,OAkCxB;AAjCZ,2DAAuD;AAkCrD,iGAlCO,oCAAgB,OAkCP;AAjClB,6CAA0C;AAoCxC,2FApCO,uBAAU,OAoCP;AAlCZ,8DAAgD;AA+D9C,oCAAY;AA7Dd,wEAAoE;AA8DlE,2FA9DO,wBAAU,OA8DP;AA7DZ,gGAAqF;AA8DnF,4FA9DO,iCAAW,OA8DP;AA7Db,kEAA+F;AAgE7F,mGAhEO,iCAAkB,OAgEP;AADlB,yGA/D2B,uCAAwB,OA+D3B;AA1D1B,uDAAwD;AAA/C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4Bb,KAAK,CAAC,eAAe,CAAC;AAEtB,+CAA6B;AAC7B,uEAAqD;AAErD,4DAA2D;AAAlD,oHAAA,gBAAgB,OAAA;AACzB,wFAA+G;AAAtG,gIAAA,sBAAsB,OAAA;AAAE,gIAAA,sBAAsB,OAAA;AAEvD,+DAAmE;AAA1D,yHAAA,qBAAqB,OAAA;AAC9B,mEAAuE;AAA9D,6HAAA,uBAAuB,OAAA","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { graphicUtil, registerForVrender } from './vrender';\nregisterForVrender();\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 GanttConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTableAll as ListTable } from './ListTable-all';\nimport { ListTableSimple } from './ListTable-simple';\n// import { PivotTable } from './PivotTable';\nimport { PivotTableAll as PivotTable } from './PivotTable-all';\nimport { PivotTableSimple } from './PivotTable-simple';\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';\nimport { restoreMeasureText, setCustomAlphabetCharSet } from './scenegraph/utils/text-measure';\n\n// import { container, loadCanvasPicker } from '@src/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\nexport { getTargetCell } from './event/util';\n\n// export * as VRender from './vrender';\n// import * as VRender from './vrender';\n\nexport const version = \"1.10.3-alpha.0\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableSimple,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableSimple,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n GanttConstructorOptions,\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 setCustomAlphabetCharSet,\n restoreMeasureText\n // VRender // should use import {xxx} from '@visactor/vtable/es/vrender'\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\nexport * from './components';\nexport * from './scenegraph/group-creater/cell-type';\n\nexport { TABLE_EVENT_TYPE } from './core/TABLE_EVENT_TYPE';\nexport { PIVOT_CHART_EVENT_TYPE, PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';\n\nexport { InvertHighlightPlugin } from './plugins/invert-highlight';\nexport { CarouselAnimationPlugin } from './plugins/carousel-animation';\n"]}
|
package/cjs/layout/index.js
CHANGED
|
@@ -296,6 +296,6 @@ function clearNode(children) {
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
exports.DimensionTree = DimensionTree, exports.generateLayoutTree = generateLayoutTree,
|
|
300
|
-
exports.countLayoutTree = countLayoutTree, exports.dealHeader = dealHeader, exports.dealHeaderForTreeMode = dealHeaderForTreeMode;
|
|
301
299
|
//# sourceMappingURL=tree-helper.js.map
|
|
300
|
+
exports.DimensionTree = DimensionTree, exports.generateLayoutTree = generateLayoutTree,
|
|
301
|
+
exports.countLayoutTree = countLayoutTree, exports.dealHeader = dealHeader, exports.dealHeaderForTreeMode = dealHeaderForTreeMode;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { EasingType } from './../vrender';
|
|
2
|
+
import type { BaseTableAPI } from '../ts-types/base-table';
|
|
3
|
+
export interface ICarouselAnimationPluginOptions {
|
|
4
|
+
rowCount?: number;
|
|
5
|
+
colCount?: number;
|
|
6
|
+
animationDuration?: number;
|
|
7
|
+
animationDelay?: number;
|
|
8
|
+
animationEasing?: EasingType;
|
|
9
|
+
replaceScrollAction?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class CarouselAnimationPlugin {
|
|
12
|
+
table: BaseTableAPI;
|
|
13
|
+
rowCount: number;
|
|
14
|
+
colCount: number;
|
|
15
|
+
animationDuration: number;
|
|
16
|
+
animationDelay: number;
|
|
17
|
+
animationEasing: EasingType;
|
|
18
|
+
replaceScrollAction: boolean;
|
|
19
|
+
playing: boolean;
|
|
20
|
+
row: number;
|
|
21
|
+
col: number;
|
|
22
|
+
constructor(table: BaseTableAPI, options?: ICarouselAnimationPluginOptions);
|
|
23
|
+
init(): void;
|
|
24
|
+
onScrollEnd(e: Event): void;
|
|
25
|
+
play(): void;
|
|
26
|
+
pause(): void;
|
|
27
|
+
updateRow(): void;
|
|
28
|
+
updateCol(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.CarouselAnimationPlugin = void 0;
|
|
6
|
+
|
|
7
|
+
class CarouselAnimationPlugin {
|
|
8
|
+
constructor(table, options) {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
this.table = table, this.rowCount = null !== (_a = null == options ? void 0 : options.rowCount) && void 0 !== _a ? _a : void 0,
|
|
11
|
+
this.colCount = null !== (_b = null == options ? void 0 : options.colCount) && void 0 !== _b ? _b : void 0,
|
|
12
|
+
this.animationDuration = null !== (_c = null == options ? void 0 : options.animationDuration) && void 0 !== _c ? _c : 500,
|
|
13
|
+
this.animationDelay = null !== (_d = null == options ? void 0 : options.animationDelay) && void 0 !== _d ? _d : 1e3,
|
|
14
|
+
this.animationEasing = null !== (_e = null == options ? void 0 : options.animationEasing) && void 0 !== _e ? _e : "linear",
|
|
15
|
+
this.replaceScrollAction = null !== (_f = null == options ? void 0 : options.replaceScrollAction) && void 0 !== _f && _f,
|
|
16
|
+
this.playing = !1, this.row = table.frozenRowCount, this.col = table.frozenColCount,
|
|
17
|
+
this.init();
|
|
18
|
+
}
|
|
19
|
+
init() {
|
|
20
|
+
this.replaceScrollAction && (this.table.disableScroll(), this.table.scenegraph.stage.addEventListener("wheel", this.onScrollEnd.bind(this)));
|
|
21
|
+
}
|
|
22
|
+
onScrollEnd(e) {
|
|
23
|
+
this.rowCount ? (e.deltaY > 0 ? (this.row += this.rowCount, this.row = Math.min(this.row, this.table.rowCount - this.table.frozenRowCount)) : e.deltaY < 0 && (this.row -= this.rowCount,
|
|
24
|
+
this.row = Math.max(this.row, this.table.frozenRowCount)), this.table.scrollToRow(this.row, {
|
|
25
|
+
duration: this.animationDuration,
|
|
26
|
+
easing: this.animationEasing
|
|
27
|
+
})) : this.colCount && (e.deltaX > 0 ? (this.col += this.colCount, this.col = Math.min(this.col, this.table.colCount - this.table.frozenColCount)) : e.deltaX < 0 && (this.col -= this.colCount,
|
|
28
|
+
this.col = Math.max(this.col, this.table.frozenColCount)), this.table.scrollToCol(this.col, {
|
|
29
|
+
duration: this.animationDuration,
|
|
30
|
+
easing: this.animationEasing
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
play() {
|
|
34
|
+
this.playing = !0, this.rowCount ? this.updateRow() : this.colCount && this.updateCol();
|
|
35
|
+
}
|
|
36
|
+
pause() {
|
|
37
|
+
this.playing = !1;
|
|
38
|
+
}
|
|
39
|
+
updateRow() {
|
|
40
|
+
this.playing && (this.table.scenegraph.proxy.screenTopRow !== this.row ? this.row = this.table.frozenRowCount : this.row += this.rowCount,
|
|
41
|
+
this.table.scrollToRow(this.row, {
|
|
42
|
+
duration: this.animationDuration,
|
|
43
|
+
easing: this.animationEasing
|
|
44
|
+
}), setTimeout((() => {
|
|
45
|
+
this.updateRow();
|
|
46
|
+
}), this.animationDuration + this.animationDelay));
|
|
47
|
+
}
|
|
48
|
+
updateCol() {
|
|
49
|
+
this.playing && (this.table.scenegraph.proxy.screenLeftCol !== this.col ? this.col = this.table.frozenColCount : this.col += this.colCount,
|
|
50
|
+
this.table.scrollToCol(this.col, {
|
|
51
|
+
duration: this.animationDuration,
|
|
52
|
+
easing: this.animationEasing
|
|
53
|
+
}), setTimeout((() => {
|
|
54
|
+
this.updateCol();
|
|
55
|
+
}), this.animationDuration + 50));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
exports.CarouselAnimationPlugin = CarouselAnimationPlugin;
|
|
60
|
+
//# sourceMappingURL=carousel-animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/carousel-animation.ts"],"names":[],"mappings":";;;AAYA,MAAa,uBAAuB;IAalC,YAAY,KAAmB,EAAE,OAAyC;;QACxE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,QAAQ,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,SAAS,CAAC;QAC/C,IAAI,CAAC,QA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C,iBAAiB,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACrG,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC,EAAE,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;IAClC,CAAC;CACF;AAxGD,0DAwGC","file":"carousel-animation.js","sourcesContent":["import type { EasingType } from './../vrender';\nimport type { BaseTableAPI } from '../ts-types/base-table';\n\nexport interface ICarouselAnimationPluginOptions {\n rowCount?: number;\n colCount?: number;\n animationDuration?: number;\n animationDelay?: number;\n animationEasing?: EasingType;\n replaceScrollAction?: boolean;\n}\n\nexport class CarouselAnimationPlugin {\n table: BaseTableAPI;\n\n rowCount: number;\n colCount: number;\n animationDuration: number;\n animationDelay: number;\n animationEasing: EasingType;\n replaceScrollAction: boolean;\n\n playing: boolean;\n row: number;\n col: number;\n constructor(table: BaseTableAPI, options?: ICarouselAnimationPluginOptions) {\n this.table = table;\n\n this.rowCount = options?.rowCount ?? undefined;\n this.colCount = options?.colCount ?? undefined;\n this.animationDuration = options?.animationDuration ?? 500;\n this.animationDelay = options?.animationDelay ?? 1000;\n this.animationEasing = options?.animationEasing ?? 'linear';\n this.replaceScrollAction = options?.replaceScrollAction ?? false;\n\n this.playing = false;\n this.row = table.frozenRowCount;\n this.col = table.frozenColCount;\n\n this.init();\n }\n\n init() {\n if (this.replaceScrollAction) {\n this.table.disableScroll();\n\n this.table.scenegraph.stage.addEventListener('wheel', this.onScrollEnd.bind(this));\n }\n }\n\n onScrollEnd(e: Event) {\n if (this.rowCount) {\n if ((e as any).deltaY > 0) {\n this.row += this.rowCount;\n this.row = Math.min(this.row, this.table.rowCount - this.table.frozenRowCount);\n } else if ((e as any).deltaY < 0) {\n this.row -= this.rowCount;\n this.row = Math.max(this.row, this.table.frozenRowCount);\n }\n this.table.scrollToRow(this.row, { duration: this.animationDuration, easing: this.animationEasing });\n } else if (this.colCount) {\n if ((e as any).deltaX > 0) {\n this.col += this.colCount;\n this.col = Math.min(this.col, this.table.colCount - this.table.frozenColCount);\n } else if ((e as any).deltaX < 0) {\n this.col -= this.colCount;\n this.col = Math.max(this.col, this.table.frozenColCount);\n }\n this.table.scrollToCol(this.col, { duration: this.animationDuration, easing: this.animationEasing });\n }\n }\n\n play() {\n this.playing = true;\n\n if (this.rowCount) {\n this.updateRow();\n } else if (this.colCount) {\n this.updateCol();\n }\n }\n\n pause() {\n this.playing = false;\n }\n\n updateRow() {\n if (!this.playing) {\n return;\n }\n if (this.table.scenegraph.proxy.screenTopRow !== this.row) {\n this.row = this.table.frozenRowCount;\n } else {\n this.row += this.rowCount;\n }\n this.table.scrollToRow(this.row, { duration: this.animationDuration, easing: this.animationEasing });\n setTimeout(() => {\n this.updateRow();\n }, this.animationDuration + this.animationDelay);\n }\n\n updateCol() {\n if (!this.playing) {\n return;\n }\n if (this.table.scenegraph.proxy.screenLeftCol !== this.col) {\n this.col = this.table.frozenColCount;\n } else {\n this.col += this.colCount;\n }\n\n this.table.scrollToCol(this.col, { duration: this.animationDuration, easing: this.animationEasing });\n setTimeout(() => {\n this.updateCol();\n }, this.animationDuration + 50);\n }\n}\n"]}
|
package/cjs/plugins/icons.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Group } from '../scenegraph/graphic/group';
|
|
2
|
+
import type { CellRange } from '../ts-types';
|
|
3
|
+
import type { BaseTableAPI } from '../ts-types/base-table';
|
|
4
|
+
export interface InvertHighlightPluginOptions {
|
|
5
|
+
fill?: string;
|
|
6
|
+
opacity?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class InvertHighlightPlugin {
|
|
9
|
+
table: BaseTableAPI;
|
|
10
|
+
range?: CellRange;
|
|
11
|
+
_fill: string;
|
|
12
|
+
_opacity: number;
|
|
13
|
+
constructor(table: BaseTableAPI, options?: InvertHighlightPluginOptions);
|
|
14
|
+
setInvertHighlightRange(range?: CellRange): void;
|
|
15
|
+
deleteAllCellGroupShadow(): void;
|
|
16
|
+
updateCellGroupShadow(): void;
|
|
17
|
+
updateCellGroupShadowInContainer(container: Group, range?: CellRange): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function onBeforeAttributeUpdateForInvertHighlight(val: Record<string, any>, attribute: any): void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.onBeforeAttributeUpdateForInvertHighlight = exports.InvertHighlightPlugin = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_1 = require("./../vrender"), cell_range_1 = require("../tools/cell-range"), helper_1 = require("../tools/helper"), vutils_1 = require("@visactor/vutils");
|
|
8
|
+
|
|
9
|
+
class InvertHighlightPlugin {
|
|
10
|
+
constructor(table, options) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
this.table = table, this._fill = null !== (_a = null == options ? void 0 : options.fill) && void 0 !== _a ? _a : "#000",
|
|
13
|
+
this._opacity = null !== (_b = null == options ? void 0 : options.opacity) && void 0 !== _b ? _b : .5;
|
|
14
|
+
}
|
|
15
|
+
setInvertHighlightRange(range) {
|
|
16
|
+
(0, cell_range_1.isSameRange)(this.range, range) || (this.range = range, range ? this.updateCellGroupShadow() : this.deleteAllCellGroupShadow(),
|
|
17
|
+
this.table.scenegraph.updateNextFrame());
|
|
18
|
+
}
|
|
19
|
+
deleteAllCellGroupShadow() {
|
|
20
|
+
this.table.isPivotTable() || (this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),
|
|
21
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),
|
|
22
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup), this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),
|
|
23
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),
|
|
24
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);
|
|
25
|
+
}
|
|
26
|
+
updateCellGroupShadow() {
|
|
27
|
+
this.table.isPivotTable() || (this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range),
|
|
28
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range)),
|
|
29
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range),
|
|
30
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range),
|
|
31
|
+
this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),
|
|
32
|
+
this.range, this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);
|
|
33
|
+
}
|
|
34
|
+
updateCellGroupShadowInContainer(container, range) {
|
|
35
|
+
container.forEachChildrenSkipChild((column => {
|
|
36
|
+
"column" === column.role && column.forEachChildrenSkipChild((cell => {
|
|
37
|
+
if ("cell" !== cell.role) return;
|
|
38
|
+
cell.attachShadow(cell.shadowRoot);
|
|
39
|
+
const shadowGroup = cell.shadowRoot;
|
|
40
|
+
if (range) {
|
|
41
|
+
if ((0, helper_1.cellInRange)(range, cell.col, cell.row)) shadowGroup.removeAllChild(); else if (!shadowGroup.firstChild) {
|
|
42
|
+
const shadowRect = (0, vrender_1.createRect)({
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0,
|
|
45
|
+
width: cell.attribute.width,
|
|
46
|
+
height: cell.attribute.height,
|
|
47
|
+
fill: this._fill,
|
|
48
|
+
opacity: this._opacity
|
|
49
|
+
});
|
|
50
|
+
shadowRect.name = "shadow-rect", shadowGroup.appendChild(shadowRect);
|
|
51
|
+
}
|
|
52
|
+
} else shadowGroup.removeAllChild();
|
|
53
|
+
}));
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const graphic = this;
|
|
61
|
+
if (graphic.shadowRoot && graphic.shadowRoot.childrenCount && ((0, vutils_1.isValid)(val.width) || (0,
|
|
62
|
+
vutils_1.isValid)(val.height))) {
|
|
63
|
+
const shadowRect = graphic.shadowRoot.findChildrenByName("shadow-rect")[0];
|
|
64
|
+
shadowRect && shadowRect.setAttributes({
|
|
65
|
+
width: null !== (_a = val.width) && void 0 !== _a ? _a : shadowRect.attribute.width,
|
|
66
|
+
height: null !== (_b = val.height) && void 0 !== _b ? _b : shadowRect.attribute.height
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
exports.InvertHighlightPlugin = InvertHighlightPlugin, exports.onBeforeAttributeUpdateForInvertHighlight = onBeforeAttributeUpdateForInvertHighlight;
|
|
72
|
+
//# sourceMappingURL=invert-highlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/invert-highlight.ts"],"names":[],"mappings":";;;AACA,0CAA0C;AAE1C,oDAAkD;AAGlD,4CAA8C;AAC9C,6CAA2C;AAO3C,MAAa,qBAAqB;IAMhC,YAAY,KAAmB,EAAE,OAAsC;;QACrE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,KAAK,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,MAAM,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,GAAG,CAAC;IAC1C,CAAC;IAED,uBAAuB,CAAC,KAAiB;QACvC,IAAI,IAAA,wBAAW,EAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;YAClC,OAAO;SACR;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,EAAE;YAEV,IAAI,CAAC,wBAAwB,EAAE,C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AAC;wBACH,UAAU,CAAC,IAAI,GAAG,aAAa,CAAC;wBAChC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;qBACrC;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnFD,sDAmFC;AAED,SAAgB,yCAAyC,CAAC,GAAwB,EAAE,SAAc;;IAEhG,MAAM,OAAO,GAAG,IAAW,CAAC;IAC5B,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,IAAA,gBAAO,EAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE;QACzG,MAAM,UAAU,GAAI,OAAO,CAAC,UAAoB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAS,CAAC;QAC9F,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,aAAa,CAAC;gBACvB,KAAK,EAAE,MAAA,GAAG,CAAC,KAAK,mCAAI,UAAU,CAAC,SAAS,CAAC,KAAK;gBAC9C,MAAM,EAAE,MAAA,GAAG,CAAC,MAAM,mCAAI,UAAU,CAAC,SAAS,CAAC,MAAM;aAClD,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAZD,8FAYC","file":"invert-highlight.js","sourcesContent":["import type { Rect } from './../vrender';\nimport { createRect } from './../vrender';\nimport type { Group } from '../scenegraph/graphic/group';\nimport { isSameRange } from '../tools/cell-range';\nimport type { CellRange } from '../ts-types';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport { cellInRange } from '../tools/helper';\nimport { isValid } from '@visactor/vutils';\n\nexport interface InvertHighlightPluginOptions {\n fill?: string;\n opacity?: number;\n}\n\nexport class InvertHighlightPlugin {\n table: BaseTableAPI;\n range?: CellRange;\n _fill: string;\n _opacity: number;\n\n constructor(table: BaseTableAPI, options?: InvertHighlightPluginOptions) {\n this.table = table;\n\n this._fill = options?.fill ?? '#000';\n this._opacity = options?.opacity ?? 0.5;\n }\n\n setInvertHighlightRange(range?: CellRange) {\n if (isSameRange(this.range, range)) {\n return;\n }\n\n this.range = range;\n if (!range) {\n // reset highlight\n this.deleteAllCellGroupShadow();\n } else {\n // update highlight\n this.updateCellGroupShadow();\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n deleteAllCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);\n }\n\n updateCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup), this.range;\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);\n }\n updateCellGroupShadowInContainer(container: Group, range?: CellRange) {\n container.forEachChildrenSkipChild((column: Group) => {\n if (column.role === 'column') {\n column.forEachChildrenSkipChild((cell: Group) => {\n if (cell.role !== 'cell') {\n return;\n }\n cell.attachShadow(cell.shadowRoot);\n const shadowGroup = cell.shadowRoot;\n if (!range) {\n // no highlight\n shadowGroup.removeAllChild();\n } else if (cellInRange(range, cell.col, cell.row)) {\n // inside highlight\n shadowGroup.removeAllChild();\n } else if (!shadowGroup.firstChild) {\n // outside highlight\n const shadowRect = createRect({\n x: 0,\n y: 0,\n width: cell.attribute.width,\n height: cell.attribute.height,\n fill: this._fill,\n opacity: this._opacity\n });\n shadowRect.name = 'shadow-rect';\n shadowGroup.appendChild(shadowRect);\n }\n });\n }\n });\n }\n}\n\nexport function onBeforeAttributeUpdateForInvertHighlight(val: Record<string, any>, attribute: any) {\n // @ts-ignore\n const graphic = this as any;\n if (graphic.shadowRoot && graphic.shadowRoot.childrenCount && (isValid(val.width) || isValid(val.height))) {\n const shadowRect = (graphic.shadowRoot as Group).findChildrenByName('shadow-rect')[0] as Rect;\n if (shadowRect) {\n shadowRect.setAttributes({\n width: val.width ?? shadowRect.attribute.width,\n height: val.height ?? shadowRect.attribute.height\n });\n }\n }\n}\n"]}
|
package/cjs/plugins/themes.js
CHANGED
|
@@ -112,7 +112,8 @@ class Group extends vrender_1.Group {
|
|
|
112
112
|
if ("cell" === this.role) {
|
|
113
113
|
const attribute = this.attribute, {x: x, y: y, width: width, height: height} = attribute;
|
|
114
114
|
return this._AABBBounds.setValue(x, y, x + width, y + height), this.parent && this.parent.addChildUpdateBoundTag(),
|
|
115
|
-
this.clearUpdateBoundTag(), this.
|
|
115
|
+
this.clearUpdateBoundTag(), this.shadowRoot && this.shadowRoot.tryUpdateAABBBounds(),
|
|
116
|
+
this._AABBBounds;
|
|
116
117
|
}
|
|
117
118
|
return "body" === this.role || "row-header" === this.role || "col-header" === this.role || "right-frozen" === this.role || "bottom-frozen" === this.role || "corner-header" === this.role || "corner-right-top-header" === this.role || "corner-right-bottom-header" === this.role || "corner-left-bottom-header" === this.role ? (this._AABBBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0),
|
|
118
119
|
this.parent && this.parent.addChildUpdateBoundTag(), this.clearUpdateBoundTag(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/group.ts"],"names":[],"mappings":";;;AACA,6CAAwD;AAKxD,MAAa,KAAM,SAAQ,eAAY;I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C;SAC9B;IACH,CAAC;CAWF;AAvXD,sBAuXC;AAED,SAAS,KAAK,CAAC,KAAY,EAAE,UAAmB;IAC9C,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE;QACxE,OAAO;KACR;IAED,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,UAAU,EAAE;QACpC,OAAO;KACR;IACD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC","file":"group.js","sourcesContent":["import type { IGraphic, IColor, IRect, INode, IGroupGraphicAttribute, ISetAttributeContext } from './../../vrender';\nimport { Group as VRenderGroup } from './../../vrender';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { InteractionState } from '../../ts-types';\nimport { isNumber, type AABBBounds } from '@visactor/vutils';\n\nexport class Group extends VRenderGroup {\n role?: string;\n col?: number;\n row?: number;\n mergeStartCol?: number;\n mergeStartRow?: number;\n mergeEndCol?: number;\n mergeEndRow?: number;\n contentWidth?: number;\n contentHeight?: number;\n rowNumber?: number; // row number of the column group\n colHeight?: number; // current height of the column group\n border?: IRect; // table/header/body的border mark,挂载在这里方便更新\n needUpdate?: boolean;\n\n needUpdateWidth?: boolean;\n needUpdateHeight?: boolean;\n\n // changes for size align for fs\n // constructor(attribute?: IGroupGraphicAttribute) {\n // dealWidthSize(attribute, attribute);\n // super(attribute);\n // }\n\n // setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void {\n // if (key === 'x' || key === 'y' || key === 'width' || key === 'height') {\n // this.attribute[`old${key}`];\n // }\n // const values = {\n // [key]: value\n // };\n // this.setAttributes(values, forceUpdateTag, context);\n // }\n\n // setAttributes(\n // params: Partial<IGroupGraphicAttribute>,\n // forceUpdateTag?: boolean,\n // context?: ISetAttributeContext\n // ): void {\n // dealWidthSize(params, this.attribute);\n // super.setAttributes(params, forceUpdateTag, context);\n // }\n\n /**\n * @description: 清空Group下全部子元素\n * @return {*}\n */\n clear() {\n this.removeAllChild();\n }\n\n getChildByName(name: string, deep?: boolean): any {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // if (this.children[i].name === name) {\n // return this.children[i] as unknown as T;\n // }\n // }\n let result = null;\n this.forEachChildren((child: IGraphic) => {\n if (child.name === name) {\n result = child;\n return true; // 提前退出循环\n }\n return false;\n });\n\n if (deep) {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // const child = this.children[i] as Group;\n\n // if (!child.getChildByName) {\n // continue;\n // }\n\n // const target = child.getChildByName(name, true);\n\n // if (target) {\n // return target;\n // }\n // }\n this.forEachChildren((child: IGraphic) => {\n if ((child as Group).getChildByName) {\n const target = (child as Group).getChildByName(name, true);\n if (target) {\n result = target;\n return true;\n }\n }\n return false;\n });\n }\n\n return result;\n }\n\n get width() {\n let width = this.AABBBounds.width();\n if (width === Infinity || width === -Infinity) {\n width = 0;\n }\n return Math.max(width, this.attribute.width ?? 0);\n }\n\n get height() {\n let height = this.AABBBounds.height();\n if (height === Infinity || height === -Infinity) {\n height = 0;\n }\n return Math.max(height, this.attribute.height ?? 0);\n }\n\n setDeltaWidth(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);\n if (this.border) {\n this.border.setAttribute('width', this.border.attribute.width + deltaX);\n\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.width + deltaX\n );\n }\n }\n }\n\n setDeltaHeight(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);\n if (this.border) {\n this.border.setAttribute('height', this.border.attribute.height + deltaY);\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.height + deltaY\n );\n }\n }\n }\n\n setDeltaX(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('x', this.attribute.x + deltaX);\n }\n\n setDeltaY(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('y', this.attribute.y + deltaY);\n }\n\n /**\n * @description: 遍历所有子节点,跳过部分节点,默认跳过group的border\n * @return {*}\n */\n forEachChildrenSkipChild<T extends INode = INode>(\n cb: (item: T, index: number) => void | boolean,\n skipChildName = 'border-rect',\n reverse = false\n ) {\n if (reverse) {\n let child = this._lastChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._prev;\n }\n } else {\n let child = this._firstChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._next;\n }\n }\n }\n\n getColGroup(col: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.col === col) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n getRowGroup(row: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === row) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n addCellGroup(cellGroup: Group) {\n if (this.childrenCount === 0 || (this.lastChild as Group).row === cellGroup.row - 1) {\n this.addChild(cellGroup);\n } else {\n // for promise cell row order in column\n let c = this._firstChild as Group;\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === cellGroup.row - 1) {\n this.insertAfter(cellGroup, c);\n return;\n }\n c = c._next as Group;\n }\n this.addChild(cellGroup);\n }\n }\n\n getChildAt(index: number) {\n const child = super.getChildAt(index);\n if (child && child.name === 'border-rect') {\n return child._next;\n }\n return child;\n }\n\n protected tryUpdateAABBBounds(): AABBBounds {\n if (this.role === 'cell') {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds as AABBBounds;\n }\n // application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const selfChange = this.shouldSelfChangeUpdateAABBBounds();\n // const selfChange = true;\n const bounds = this.doUpdateAABBBounds();\n this.addUpdateLayoutTag();\n // application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange);\n after(this, selfChange);\n\n return bounds;\n }\n return super.tryUpdateAABBBounds() as AABBBounds;\n }\n\n // 目前优化方案会导致合并单元格无法正常更新列宽(因为合并单元格更新bounds不会触发父节点bounds更新),暂时关闭优化方案\n // shouldUpdateAABBBoundsForRowMerge(): boolean {\n\n // }\n\n // shouldUpdateAABBBounds(): boolean {\n // return this.shouldSelfChangeUpdateAABBBounds();\n // // // 检索自己是否需要更新\n // // if (super.shouldUpdateAABBBounds()) {\n // // return true;\n // // }\n // // // 检索叶子节点是否有更新(如果children是叶子节点的话)\n // // if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n // // return true;\n // // }\n // // // 检索是否子group需要更新\n // // let needUpdate = false;\n // // this.forEachChildren((node: IGraphic) => {\n // // // 只查找group层级\n // // if (node.isContainer && (node as Group).shouldUpdateAABBBounds()) {\n // // needUpdate = true;\n // // return true;\n // // }\n // // return false;\n // // });\n // // return needUpdate;\n // }\n\n protected doUpdateAABBBounds(): any {\n // const groupTheme = getTheme(this).group;\n // debugger;\n if (this.role === 'cell') {\n const attribute = this.attribute;\n const { x, y, width, height } = attribute;\n this._AABBBounds.setValue(x, y, x + width, y + height);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n return this._AABBBounds;\n } else if (\n this.role === 'body' ||\n this.role === 'row-header' ||\n this.role === 'col-header' ||\n this.role === 'right-frozen' ||\n this.role === 'bottom-frozen' ||\n this.role === 'corner-header' ||\n this.role === 'corner-right-top-header' ||\n this.role === 'corner-right-bottom-header' ||\n this.role === 'corner-left-bottom-header'\n ) {\n // Infinity bounds for manual clip group\n this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n\n if (this.shadowRoot) {\n // this.shadowRoot.clearUpdateBoundTag();\n this.shadowRoot.tryUpdateAABBBounds();\n }\n return this._AABBBounds;\n }\n return super.doUpdateAABBBounds();\n // _AABBBounds\n // const bounds = graphicService.updateGroupAABBBounds(\n // attribute,\n // getTheme(this).group,\n // this._AABBBounds,\n // this\n // ) as AABBBounds;\n\n // const { boundsPadding = groupTheme.boundsPadding } = attribute;\n // const paddingArray = parsePadding(boundsPadding);\n // if (paddingArray) {\n // bounds.expand(paddingArray);\n // }\n // // 更新bounds之后需要设置父节点,否则tag丢失\n // this.parent && this.parent.addChildUpdateBoundTag();\n // this.clearUpdateBoundTag();\n\n // this.emit('AAABBBoundsChange');\n }\n\n // update column group row number\n updateColumnRowNumber(row: number) {\n if (!this.rowNumber) {\n this.rowNumber = row;\n } else {\n this.rowNumber = Math.max(this.rowNumber, row);\n }\n }\n\n // update column height\n updateColumnHeight(cellHeight: number) {\n if (!this.colHeight) {\n this.colHeight = cellHeight;\n } else {\n this.colHeight += cellHeight;\n }\n }\n\n // doUpdateLocalMatrix() {\n // const oldX = this.attribute.x;\n // const oldY = this.attribute.y;\n // this.attribute.x = Math.floor(this.attribute.x);\n // this.attribute.y = Math.floor(this.attribute.y);\n // super.doUpdateLocalMatrix();\n // this.attribute.x = oldX;\n // this.attribute.y = oldY;\n // }\n}\n\nfunction after(group: Group, selfChange: boolean) {\n if (!group.stage || !group.stage.dirtyBounds || !group.stage.renderCount) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (group.isContainer && !selfChange) {\n return;\n }\n group.stage.dirty(group.globalAABBBounds);\n}\n\n// function dealWidthSize(values: any, attributes: any) {\n// const x = values.x ?? attributes.oldx ?? attributes.x ?? 0 + values.dx ?? attributes.dx ?? 0;\n// const y = values.y ?? attributes.oldy ?? attributes.y ?? 0 + values.dy ?? attributes.dy ?? 0;\n// const width = values.width ?? attributes.oldwidth ?? attributes.width ?? 0;\n// const height = values.height ?? attributes.oldheight ?? attributes.height ?? 0;\n// isNumber(values.width) && (values.oldwidth = values.width);\n// isNumber(values.height) && (values.oldheight = values.height);\n// isNumber(values.x) && (values.oldx = values.x);\n// isNumber(values.y) && (values.oldy = values.y);\n\n// if (Math.floor(x + width) > Math.floor(width) + Math.floor(x)) {\n// values.width = Math.ceil(width);\n// } else {\n// values.width = Math.floor(width);\n// }\n\n// if (Math.floor(y + height) > Math.floor(height) + Math.floor(y)) {\n// values.height = Math.ceil(height);\n// } else {\n// values.height = Math.floor(height);\n// }\n// isNumber(values.x) && (values.x = Math.floor(values.x));\n// isNumber(values.y) && (values.y = Math.floor(values.y));\n// }\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/group.ts"],"names":[],"mappings":";;;AACA,6CAAwD;AAKxD,MAAa,KAAM,SAAQ,eAAY;IA+CrC,KAAK;QACH,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,IAAc;QAMzC,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,eAAe,CAAC,CAAC,KAAe,EAAE,EAAE;YACvC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBACvB,MAAM,GAAG,KAAK,CAAC;gBACf,OAAO,IAAI,CAAC;aACb;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI,EAAE;YAcR,IAAI,CAAC,eAAe,CAAC,CAAC,KAAe,EAAE,EAAE;gBACvC,IAAK,KAAe,CAAC,cAAc,EAAE;oBACnC,MAAM,MAAM,GAAI,KAAe,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBAC3D,IAAI,MAAM,EAAE;wBACV,MAAM,GAAG,M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AE,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAEpE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;YACpD,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAE3B,IAAI,IAAI,CAAC,UAAU,EAAE;gBAEnB,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC;aACvC;YACD,OAAO,IAAI,CAAC,WAAW,CAAC;SACzB;QACD,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;IAmBpC,CAAC;IAGD,qBAAqB,CAAC,GAAW;QAC/B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;SACtB;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;SAChD;IACH,CAAC;IAGD,kBAAkB,CAAC,UAAkB;QACnC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;SAC7B;aAAM;YACL,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC;SAC9B;IACH,CAAC;CAWF;AA3XD,sBA2XC;AAED,SAAS,KAAK,CAAC,KAAY,EAAE,UAAmB;IAC9C,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE;QACxE,OAAO;KACR;IAED,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,UAAU,EAAE;QACpC,OAAO;KACR;IACD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAC5C,CAAC","file":"group.js","sourcesContent":["import type { IGraphic, IColor, IRect, INode, IGroupGraphicAttribute, ISetAttributeContext } from './../../vrender';\nimport { Group as VRenderGroup } from './../../vrender';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { InteractionState } from '../../ts-types';\nimport { isNumber, type AABBBounds } from '@visactor/vutils';\n\nexport class Group extends VRenderGroup {\n role?: string;\n col?: number;\n row?: number;\n mergeStartCol?: number;\n mergeStartRow?: number;\n mergeEndCol?: number;\n mergeEndRow?: number;\n contentWidth?: number;\n contentHeight?: number;\n rowNumber?: number; // row number of the column group\n colHeight?: number; // current height of the column group\n border?: IRect; // table/header/body的border mark,挂载在这里方便更新\n needUpdate?: boolean;\n\n needUpdateWidth?: boolean;\n needUpdateHeight?: boolean;\n\n // changes for size align for fs\n // constructor(attribute?: IGroupGraphicAttribute) {\n // dealWidthSize(attribute, attribute);\n // super(attribute);\n // }\n\n // setAttribute(key: string, value: any, forceUpdateTag?: boolean, context?: ISetAttributeContext): void {\n // if (key === 'x' || key === 'y' || key === 'width' || key === 'height') {\n // this.attribute[`old${key}`];\n // }\n // const values = {\n // [key]: value\n // };\n // this.setAttributes(values, forceUpdateTag, context);\n // }\n\n // setAttributes(\n // params: Partial<IGroupGraphicAttribute>,\n // forceUpdateTag?: boolean,\n // context?: ISetAttributeContext\n // ): void {\n // dealWidthSize(params, this.attribute);\n // super.setAttributes(params, forceUpdateTag, context);\n // }\n\n /**\n * @description: 清空Group下全部子元素\n * @return {*}\n */\n clear() {\n this.removeAllChild();\n }\n\n getChildByName(name: string, deep?: boolean): any {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // if (this.children[i].name === name) {\n // return this.children[i] as unknown as T;\n // }\n // }\n let result = null;\n this.forEachChildren((child: IGraphic) => {\n if (child.name === name) {\n result = child;\n return true; // 提前退出循环\n }\n return false;\n });\n\n if (deep) {\n // for (let i = 0, j = this.children.length; i < j; i++) {\n // const child = this.children[i] as Group;\n\n // if (!child.getChildByName) {\n // continue;\n // }\n\n // const target = child.getChildByName(name, true);\n\n // if (target) {\n // return target;\n // }\n // }\n this.forEachChildren((child: IGraphic) => {\n if ((child as Group).getChildByName) {\n const target = (child as Group).getChildByName(name, true);\n if (target) {\n result = target;\n return true;\n }\n }\n return false;\n });\n }\n\n return result;\n }\n\n get width() {\n let width = this.AABBBounds.width();\n if (width === Infinity || width === -Infinity) {\n width = 0;\n }\n return Math.max(width, this.attribute.width ?? 0);\n }\n\n get height() {\n let height = this.AABBBounds.height();\n if (height === Infinity || height === -Infinity) {\n height = 0;\n }\n return Math.max(height, this.attribute.height ?? 0);\n }\n\n setDeltaWidth(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('width', (this.attribute.width ?? 0) + deltaX);\n if (this.border) {\n this.border.setAttribute('width', this.border.attribute.width + deltaX);\n\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.width + deltaX\n );\n }\n }\n }\n\n setDeltaHeight(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('height', (this.attribute.height ?? 0) + deltaY);\n if (this.border) {\n this.border.setAttribute('height', this.border.attribute.height + deltaY);\n if (this.border.type === 'group') {\n (this.border.firstChild as IRect).setAttribute(\n 'width',\n (this.border.firstChild as IRect).attribute.height + deltaY\n );\n }\n }\n }\n\n setDeltaX(deltaX: number) {\n if (deltaX === 0) {\n return;\n }\n this.setAttribute('x', this.attribute.x + deltaX);\n }\n\n setDeltaY(deltaY: number) {\n if (deltaY === 0) {\n return;\n }\n this.setAttribute('y', this.attribute.y + deltaY);\n }\n\n /**\n * @description: 遍历所有子节点,跳过部分节点,默认跳过group的border\n * @return {*}\n */\n forEachChildrenSkipChild<T extends INode = INode>(\n cb: (item: T, index: number) => void | boolean,\n skipChildName = 'border-rect',\n reverse = false\n ) {\n if (reverse) {\n let child = this._lastChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._prev;\n }\n } else {\n let child = this._firstChild;\n let i = 0;\n while (child) {\n if (child.name !== skipChildName) {\n const breakTag = cb(child as T, i++);\n if (breakTag) {\n return;\n }\n }\n child = child._next;\n }\n }\n }\n\n getColGroup(col: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.col === col) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n getRowGroup(row: number) {\n let c = this._firstChild as Group;\n if (!c) {\n return null;\n }\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === row) {\n return c;\n }\n c = c._next as Group;\n }\n return null;\n }\n\n addCellGroup(cellGroup: Group) {\n if (this.childrenCount === 0 || (this.lastChild as Group).row === cellGroup.row - 1) {\n this.addChild(cellGroup);\n } else {\n // for promise cell row order in column\n let c = this._firstChild as Group;\n for (let i = 0; i < this.childrenCount; i++) {\n if (c.row === cellGroup.row - 1) {\n this.insertAfter(cellGroup, c);\n return;\n }\n c = c._next as Group;\n }\n this.addChild(cellGroup);\n }\n }\n\n getChildAt(index: number) {\n const child = super.getChildAt(index);\n if (child && child.name === 'border-rect') {\n return child._next;\n }\n return child;\n }\n\n protected tryUpdateAABBBounds(): AABBBounds {\n if (this.role === 'cell') {\n if (!this.shouldUpdateAABBBounds()) {\n return this._AABBBounds as AABBBounds;\n }\n // application.graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);\n const selfChange = this.shouldSelfChangeUpdateAABBBounds();\n // const selfChange = true;\n const bounds = this.doUpdateAABBBounds();\n this.addUpdateLayoutTag();\n // application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange);\n after(this, selfChange);\n\n return bounds;\n }\n return super.tryUpdateAABBBounds() as AABBBounds;\n }\n\n // 目前优化方案会导致合并单元格无法正常更新列宽(因为合并单元格更新bounds不会触发父节点bounds更新),暂时关闭优化方案\n // shouldUpdateAABBBoundsForRowMerge(): boolean {\n\n // }\n\n // shouldUpdateAABBBounds(): boolean {\n // return this.shouldSelfChangeUpdateAABBBounds();\n // // // 检索自己是否需要更新\n // // if (super.shouldUpdateAABBBounds()) {\n // // return true;\n // // }\n // // // 检索叶子节点是否有更新(如果children是叶子节点的话)\n // // if (this._childUpdateTag & UpdateTag.UPDATE_BOUNDS) {\n // // return true;\n // // }\n // // // 检索是否子group需要更新\n // // let needUpdate = false;\n // // this.forEachChildren((node: IGraphic) => {\n // // // 只查找group层级\n // // if (node.isContainer && (node as Group).shouldUpdateAABBBounds()) {\n // // needUpdate = true;\n // // return true;\n // // }\n // // return false;\n // // });\n // // return needUpdate;\n // }\n\n protected doUpdateAABBBounds(): any {\n // const groupTheme = getTheme(this).group;\n // debugger;\n if (this.role === 'cell') {\n const attribute = this.attribute;\n const { x, y, width, height } = attribute;\n this._AABBBounds.setValue(x, y, x + width, y + height);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n if (this.shadowRoot) {\n // this.shadowRoot.clearUpdateBoundTag();\n this.shadowRoot.tryUpdateAABBBounds();\n }\n return this._AABBBounds;\n } else if (\n this.role === 'body' ||\n this.role === 'row-header' ||\n this.role === 'col-header' ||\n this.role === 'right-frozen' ||\n this.role === 'bottom-frozen' ||\n this.role === 'corner-header' ||\n this.role === 'corner-right-top-header' ||\n this.role === 'corner-right-bottom-header' ||\n this.role === 'corner-left-bottom-header'\n ) {\n // Infinity bounds for manual clip group\n this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);\n // 更新bounds之后需要设置父节点,否则tag丢失\n this.parent && this.parent.addChildUpdateBoundTag();\n this.clearUpdateBoundTag();\n\n if (this.shadowRoot) {\n // this.shadowRoot.clearUpdateBoundTag();\n this.shadowRoot.tryUpdateAABBBounds();\n }\n return this._AABBBounds;\n }\n return super.doUpdateAABBBounds();\n // _AABBBounds\n // const bounds = graphicService.updateGroupAABBBounds(\n // attribute,\n // getTheme(this).group,\n // this._AABBBounds,\n // this\n // ) as AABBBounds;\n\n // const { boundsPadding = groupTheme.boundsPadding } = attribute;\n // const paddingArray = parsePadding(boundsPadding);\n // if (paddingArray) {\n // bounds.expand(paddingArray);\n // }\n // // 更新bounds之后需要设置父节点,否则tag丢失\n // this.parent && this.parent.addChildUpdateBoundTag();\n // this.clearUpdateBoundTag();\n\n // this.emit('AAABBBoundsChange');\n }\n\n // update column group row number\n updateColumnRowNumber(row: number) {\n if (!this.rowNumber) {\n this.rowNumber = row;\n } else {\n this.rowNumber = Math.max(this.rowNumber, row);\n }\n }\n\n // update column height\n updateColumnHeight(cellHeight: number) {\n if (!this.colHeight) {\n this.colHeight = cellHeight;\n } else {\n this.colHeight += cellHeight;\n }\n }\n\n // doUpdateLocalMatrix() {\n // const oldX = this.attribute.x;\n // const oldY = this.attribute.y;\n // this.attribute.x = Math.floor(this.attribute.x);\n // this.attribute.y = Math.floor(this.attribute.y);\n // super.doUpdateLocalMatrix();\n // this.attribute.x = oldX;\n // this.attribute.y = oldY;\n // }\n}\n\nfunction after(group: Group, selfChange: boolean) {\n if (!group.stage || !group.stage.dirtyBounds || !group.stage.renderCount) {\n return;\n }\n // group的子元素导致的bounds更新不用做dirtyBounds\n if (group.isContainer && !selfChange) {\n return;\n }\n group.stage.dirty(group.globalAABBBounds);\n}\n\n// function dealWidthSize(values: any, attributes: any) {\n// const x = values.x ?? attributes.oldx ?? attributes.x ?? 0 + values.dx ?? attributes.dx ?? 0;\n// const y = values.y ?? attributes.oldy ?? attributes.y ?? 0 + values.dy ?? attributes.dy ?? 0;\n// const width = values.width ?? attributes.oldwidth ?? attributes.width ?? 0;\n// const height = values.height ?? attributes.oldheight ?? attributes.height ?? 0;\n// isNumber(values.width) && (values.oldwidth = values.width);\n// isNumber(values.height) && (values.oldheight = values.height);\n// isNumber(values.x) && (values.oldx = values.x);\n// isNumber(values.y) && (values.oldy = values.y);\n\n// if (Math.floor(x + width) > Math.floor(width) + Math.floor(x)) {\n// values.width = Math.ceil(width);\n// } else {\n// values.width = Math.floor(width);\n// }\n\n// if (Math.floor(y + height) > Math.floor(height) + Math.floor(y)) {\n// values.height = Math.ceil(height);\n// } else {\n// values.height = Math.floor(height);\n// }\n// isNumber(values.x) && (values.x = Math.floor(values.x));\n// isNumber(values.y) && (values.y = Math.floor(values.y));\n// }\n"]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.getCustomCellMergeCustom = exports.resizeCellGroup = exports.dealWithMergeCellSizeForShadow = exports.dealWithMergeCellSize = exports.updateCell = exports.createCell = void 0;
|
|
6
6
|
|
|
7
|
-
const global_1 = require("../../tools/global"), custom_1 = require("../component/custom"), get_prop_1 = require("../utils/get-prop"), tableHelper_1 = require("../../core/tableHelper"), helper_1 = require("../../tools/helper"), deal_promise_data_1 = require("../utils/deal-promise-data"), factory_1 = require("../../core/factory"), get_hierarchy_offset_1 = require("../utils/get-hierarchy-offset"), padding_1 = require("../utils/padding"), text_icon_layout_1 = require("../utils/text-icon-layout"), vutils_1 = require("@visactor/vutils"), break_string_1 = require("../utils/break-string");
|
|
7
|
+
const global_1 = require("../../tools/global"), custom_1 = require("../component/custom"), get_prop_1 = require("../utils/get-prop"), tableHelper_1 = require("../../core/tableHelper"), helper_1 = require("../../tools/helper"), deal_promise_data_1 = require("../utils/deal-promise-data"), factory_1 = require("../../core/factory"), get_hierarchy_offset_1 = require("../utils/get-hierarchy-offset"), padding_1 = require("../utils/padding"), text_icon_layout_1 = require("../utils/text-icon-layout"), vutils_1 = require("@visactor/vutils"), break_string_1 = require("../utils/break-string"), invert_highlight_1 = require("../../plugins/invert-highlight");
|
|
8
8
|
|
|
9
9
|
function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
|
|
10
10
|
var _a, _b;
|
|
@@ -64,7 +64,8 @@ function createCell(type, value, define, table, col, row, colWidth, cellWidth, c
|
|
|
64
64
|
} else if ("radio" === type) {
|
|
65
65
|
cellGroup = factory_1.Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define);
|
|
66
66
|
}
|
|
67
|
-
return cellGroup
|
|
67
|
+
return cellGroup.onBeforeAttributeUpdate = invert_highlight_1.onBeforeAttributeUpdateForInvertHighlight,
|
|
68
|
+
cellGroup;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
function updateCell(col, row, table, addNew, isShadow) {
|