@visactor/vtable 1.9.2-alpha.4 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +1 -0
- package/cjs/ListTable.js +7 -3
- package/cjs/ListTable.js.map +1 -1
- package/cjs/body-helper/style.js +2 -1
- package/cjs/components/menu/dom/logic/MenuElement.js +1 -1
- package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/cjs/components/menu/dom/logic/MenuElementStyle.js +1 -1
- package/cjs/components/menu/dom/logic/MenuElementStyle.js.map +1 -1
- package/cjs/components/title/title.js +3 -3
- package/cjs/components/title/title.js.map +1 -1
- package/cjs/core/BaseTable.js +2 -3
- 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/event/listener/table-group.js +3 -3
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/index.d.ts +1 -3
- package/cjs/index.js +2 -20
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +4 -3
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/plugins/chartModules.js +1 -1
- package/cjs/scenegraph/component/menu.d.ts +41 -0
- package/cjs/scenegraph/component/util.js +1 -1
- package/cjs/scenegraph/component/util.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +5 -5
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/group.js +1 -2
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +2 -3
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +5 -4
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/style/frame-border.js +9 -1
- package/cjs/scenegraph/style/frame-border.js.map +1 -1
- package/cjs/scenegraph/utils/cell-border-stroke-width.js +9 -4
- package/cjs/scenegraph/utils/cell-border-stroke-width.js.map +1 -1
- package/cjs/scenegraph/utils/text-measure.d.ts +33 -0
- package/cjs/state/state.js +18 -8
- package/cjs/state/state.js.map +1 -1
- package/cjs/tools/style.d.ts +2 -0
- package/cjs/tools/style.js +17 -4
- package/cjs/tools/style.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +2 -4
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +6 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +8229 -9964
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -0
- package/es/ListTable.js +7 -3
- package/es/ListTable.js.map +1 -1
- package/es/body-helper/style.js +2 -1
- package/es/components/menu/dom/logic/MenuElement.js +1 -1
- package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/es/components/menu/dom/logic/MenuElementStyle.js +1 -1
- package/es/components/menu/dom/logic/MenuElementStyle.js.map +1 -1
- package/es/components/title/title.js +4 -4
- package/es/components/title/title.js.map +1 -1
- package/es/core/BaseTable.js +2 -3
- 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/event/listener/table-group.js +3 -3
- package/es/event/listener/table-group.js.map +1 -1
- package/es/index.d.ts +1 -3
- package/es/index.js +1 -5
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +4 -3
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/plugins/chartModules.js +1 -1
- package/es/scenegraph/component/menu.d.ts +41 -0
- package/es/scenegraph/component/util.js +1 -1
- package/es/scenegraph/component/util.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +5 -5
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/group.js +1 -2
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +1 -4
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +5 -4
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +1 -1
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/style/frame-border.js +9 -1
- package/es/scenegraph/style/frame-border.js.map +1 -1
- package/es/scenegraph/utils/cell-border-stroke-width.js +3 -1
- package/es/scenegraph/utils/cell-border-stroke-width.js.map +1 -1
- package/es/scenegraph/utils/text-measure.d.ts +33 -0
- package/es/state/state.js +18 -8
- package/es/state/state.js.map +1 -1
- package/es/tools/style.d.ts +2 -0
- package/es/tools/style.js +10 -0
- package/es/tools/style.js.map +1 -1
- package/es/ts-types/base-table.d.ts +2 -4
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +6 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +6 -6
- package/cjs/plugins/carousel-animation.d.ts +0 -29
- package/cjs/plugins/carousel-animation.js +0 -60
- package/cjs/plugins/carousel-animation.js.map +0 -1
- package/cjs/plugins/invert-highlight.d.ts +0 -19
- package/cjs/plugins/invert-highlight.js +0 -72
- package/cjs/plugins/invert-highlight.js.map +0 -1
- package/cjs/tools/cell-range.d.ts +0 -2
- package/cjs/tools/cell-range.js +0 -10
- package/cjs/tools/cell-range.js.map +0 -1
- package/es/plugins/carousel-animation.d.ts +0 -29
- package/es/plugins/carousel-animation.js +0 -52
- package/es/plugins/carousel-animation.js.map +0 -1
- package/es/plugins/invert-highlight.d.ts +0 -19
- package/es/plugins/invert-highlight.js +0 -69
- package/es/plugins/invert-highlight.js.map +0 -1
- package/es/tools/cell-range.d.ts +0 -2
- package/es/tools/cell-range.js +0 -4
- package/es/tools/cell-range.js.map +0 -1
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export class CarouselAnimationPlugin {
|
|
2
|
-
constructor(table, options) {
|
|
3
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4
|
-
this.table = table, this.rowCount = null !== (_a = null == options ? void 0 : options.rowCount) && void 0 !== _a ? _a : void 0,
|
|
5
|
-
this.colCount = null !== (_b = null == options ? void 0 : options.colCount) && void 0 !== _b ? _b : void 0,
|
|
6
|
-
this.animationDuration = null !== (_c = null == options ? void 0 : options.animationDuration) && void 0 !== _c ? _c : 500,
|
|
7
|
-
this.animationDelay = null !== (_d = null == options ? void 0 : options.animationDelay) && void 0 !== _d ? _d : 1e3,
|
|
8
|
-
this.animationEasing = null !== (_e = null == options ? void 0 : options.animationEasing) && void 0 !== _e ? _e : "linear",
|
|
9
|
-
this.replaceScrollAction = null !== (_f = null == options ? void 0 : options.replaceScrollAction) && void 0 !== _f && _f,
|
|
10
|
-
this.playing = !1, this.row = table.frozenRowCount, this.col = table.frozenColCount,
|
|
11
|
-
this.init();
|
|
12
|
-
}
|
|
13
|
-
init() {
|
|
14
|
-
this.replaceScrollAction && (this.table.disableScroll(), this.table.scenegraph.stage.addEventListener("wheel", this.onScrollEnd.bind(this)));
|
|
15
|
-
}
|
|
16
|
-
onScrollEnd(e) {
|
|
17
|
-
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,
|
|
18
|
-
this.row = Math.max(this.row, this.table.frozenRowCount)), this.table.scrollToRow(this.row, {
|
|
19
|
-
duration: this.animationDuration,
|
|
20
|
-
easing: this.animationEasing
|
|
21
|
-
})) : 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,
|
|
22
|
-
this.col = Math.max(this.col, this.table.frozenColCount)), this.table.scrollToCol(this.col, {
|
|
23
|
-
duration: this.animationDuration,
|
|
24
|
-
easing: this.animationEasing
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
play() {
|
|
28
|
-
this.playing = !0, this.rowCount ? this.updateRow() : this.colCount && this.updateCol();
|
|
29
|
-
}
|
|
30
|
-
pause() {
|
|
31
|
-
this.playing = !1;
|
|
32
|
-
}
|
|
33
|
-
updateRow() {
|
|
34
|
-
this.playing && (this.table.scenegraph.proxy.screenTopRow !== this.row ? this.row = this.table.frozenRowCount : this.row += this.rowCount,
|
|
35
|
-
this.table.scrollToRow(this.row, {
|
|
36
|
-
duration: this.animationDuration,
|
|
37
|
-
easing: this.animationEasing
|
|
38
|
-
}), setTimeout((() => {
|
|
39
|
-
this.updateRow();
|
|
40
|
-
}), this.animationDuration + this.animationDelay));
|
|
41
|
-
}
|
|
42
|
-
updateCol() {
|
|
43
|
-
this.playing && (this.table.scenegraph.proxy.screenLeftCol !== this.col ? this.col = this.table.frozenColCount : this.col += this.colCount,
|
|
44
|
-
this.table.scrollToCol(this.col, {
|
|
45
|
-
duration: this.animationDuration,
|
|
46
|
-
easing: this.animationEasing
|
|
47
|
-
}), setTimeout((() => {
|
|
48
|
-
this.updateCol();
|
|
49
|
-
}), this.animationDuration + 50));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=carousel-animation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/carousel-animation.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,uBAAuB;IAalC,YAAY,KAAmB,EAAE,OAAyC;;QACxE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,QAA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SAC3B;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,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","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"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { createRect } from "./../vrender";
|
|
2
|
-
|
|
3
|
-
import { isSameRange } from "../tools/cell-range";
|
|
4
|
-
|
|
5
|
-
import { cellInRange } from "../tools/helper";
|
|
6
|
-
|
|
7
|
-
import { isValid } from "@visactor/vutils";
|
|
8
|
-
|
|
9
|
-
export 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
|
-
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 (cellInRange(range, cell.col, cell.row)) shadowGroup.removeAllChild(); else if (!shadowGroup.firstChild) {
|
|
42
|
-
const shadowRect = 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
|
-
export function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
|
|
59
|
-
var _a, _b;
|
|
60
|
-
const graphic = this;
|
|
61
|
-
if (graphic.shadowRoot && graphic.shadowRoot.childrenCount && (isValid(val.width) || isValid(val.height))) {
|
|
62
|
-
const shadowRect = graphic.shadowRoot.findChildrenByName("shadow-rect")[0];
|
|
63
|
-
shadowRect && shadowRect.setAttributes({
|
|
64
|
-
width: null !== (_a = val.width) && void 0 !== _a ? _a : shadowRect.attribute.width,
|
|
65
|
-
height: null !== (_b = val.height) && void 0 !== _b ? _b : shadowRect.attribute.height
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=invert-highlight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/invert-highlight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAO3C,MAAM,OAAO,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,WAAW,CAAC,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,CAAC;SACjC;aAAM;YAEL,IAAI,CAAC,qBAAqB,EAAE,CAAC;SAC9B;QAED,IAAI,CAAC,KA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qBACrC;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,UAAU,yCAAyC,CAAC,GAAwB,EAAE,SAAc;;IAEhG,MAAM,OAAO,GAAG,IAAW,CAAC;IAC5B,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,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","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/es/tools/cell-range.d.ts
DELETED
package/es/tools/cell-range.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export function isSameRange(range1, range2) {
|
|
2
|
-
return !range1 && !range2 || !(!range1 || !range2) && (range1.start.col === range2.start.col && range1.start.row === range2.start.row && range1.end.col === range2.end.col && range1.end.row === range2.end.row);
|
|
3
|
-
}
|
|
4
|
-
//# sourceMappingURL=cell-range.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tools/cell-range.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,MAAoC,EAAE,MAAoC;IACpG,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE;QACtB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE;QACtB,OAAO,KAAK,CAAC;KACd;IAED,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG;QACrC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG;QACrC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG;QACjC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG,CAClC,CAAC;AACJ,CAAC","file":"cell-range.js","sourcesContent":["import type { CellRange } from '../ts-types';\n\nexport function isSameRange(range1: CellRange | undefined | null, range2: CellRange | undefined | null) {\n if (!range1 && !range2) {\n return true;\n }\n\n if (!range1 || !range2) {\n return false;\n }\n\n return (\n range1.start.col === range2.start.col &&\n range1.start.row === range2.start.row &&\n range1.end.col === range2.end.col &&\n range1.end.row === range2.end.row\n );\n}\n"]}
|