@visactor/vtable-plugins 1.11.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC","file":"index.js","sourcesContent":["export * from './carousel-animation';\nexport * from './invert-highlight';\nexport * from './header-highlight';\n"]}
@@ -0,0 +1,18 @@
1
+ import type { Group } from '@visactor/vtable/es/scenegraph/graphic/group';
2
+ import type { CellRange } from '@visactor/vtable/es/ts-types';
3
+ import type { BaseTableAPI } from '@visactor/vtable/es/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
+ }
@@ -0,0 +1,57 @@
1
+ import { createRect } from "@visactor/vtable/es/vrender";
2
+
3
+ import { isSameRange } from "@visactor/vtable/es/tools/cell-range";
4
+
5
+ import { cellInRange } from "@visactor/vtable/es/tools/helper";
6
+
7
+ export class InvertHighlightPlugin {
8
+ constructor(table, options) {
9
+ var _a, _b;
10
+ this.table = table, this._fill = null !== (_a = null == options ? void 0 : options.fill) && void 0 !== _a ? _a : "#000",
11
+ this._opacity = null !== (_b = null == options ? void 0 : options.opacity) && void 0 !== _b ? _b : .5;
12
+ }
13
+ setInvertHighlightRange(range) {
14
+ isSameRange(this.range, range) || (this.range = range, range ? this.updateCellGroupShadow() : this.deleteAllCellGroupShadow(),
15
+ this.table.scenegraph.updateNextFrame());
16
+ }
17
+ deleteAllCellGroupShadow() {
18
+ this.table.isPivotTable() || (this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),
19
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),
20
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup), this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),
21
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),
22
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);
23
+ }
24
+ updateCellGroupShadow() {
25
+ this.table.isPivotTable() || (this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range),
26
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range)),
27
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range),
28
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range),
29
+ this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),
30
+ this.range, this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);
31
+ }
32
+ updateCellGroupShadowInContainer(container, range) {
33
+ container.forEachChildrenSkipChild((item => {
34
+ const column = item;
35
+ "column" === column.role && column.forEachChildrenSkipChild((item => {
36
+ const cell = item;
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
+ }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ACxC,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC5B,MAAM,CAAC,wBAAwB,CAAC,CAAC,IAAW,EAAE,EAAE;oBAC9C,MAAM,IAAI,GAAG,IAAwB,CAAC;oBACtC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE;wBACxB,OAAO;qBACR;oBACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACnC,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;oBACpC,IAAI,CAAC,KAAK,EAAE;wBAEV,WAAW,CAAC,cAAc,EAAE,CAAC;qBAC9B;yBAAM,IAAI,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE;wBAEjD,WAAW,CAAC,cAAc,EAAE,CAAC;qBAC9B;yBAAM,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;wBAElC,MAAM,UAAU,GAAG,UAAU,CAAC;4BAC5B,CAAC,EAAE,CAAC;4BACJ,CAAC,EAAE,CAAC;4BACJ,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK;4BAC3B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;4BAC7B,IAAI,EAAE,IAAI,CAAC,KAAK;4BAChB,OAAO,EAAE,IAAI,CAAC,QAAQ;yBACvB,CAAC,CAAC;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","file":"invert-highlight.js","sourcesContent":["import type { INode } from '@visactor/vtable/es/vrender';\nimport { createRect } from '@visactor/vtable/es/vrender';\nimport type { Group } from '@visactor/vtable/es/scenegraph/graphic/group';\nimport { isSameRange } from '@visactor/vtable/es/tools/cell-range';\nimport type { CellRange } from '@visactor/vtable/es/ts-types';\nimport type { BaseTableAPI } from '@visactor/vtable/es/ts-types/base-table';\nimport { cellInRange } from '@visactor/vtable/es/tools/helper';\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((item: INode) => {\n const column = item as unknown as Group;\n if (column.role === 'column') {\n column.forEachChildrenSkipChild((item: INode) => {\n const cell = item as unknown as 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"]}
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@visactor/vtable-plugins",
3
+ "version": "1.11.1",
4
+ "description": "The search util of VTable",
5
+ "author": {
6
+ "name": "VisActor",
7
+ "url": "https://VisActor.io/"
8
+ },
9
+ "license": "MIT",
10
+ "sideEffects": false,
11
+ "main": "cjs/index.js",
12
+ "module": "es/index.js",
13
+ "types": "es/index.d.ts",
14
+ "files": [
15
+ "cjs",
16
+ "es",
17
+ "dist"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "require": "./cjs/index.js",
22
+ "import": "./es/index.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "start": "vite ./demo",
27
+ "build": "bundle --clean"
28
+ },
29
+ "unpkg": "latest",
30
+ "unpkgFiles": [
31
+ "dist/vtable-exporter.js"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "dependencies": {
37
+ "@visactor/vutils": "~0.18.14"
38
+ },
39
+ "peerDependencies": {
40
+ "@visactor/vtable": "workspace:*"
41
+ },
42
+ "devDependencies": {
43
+ "@visactor/vchart": "1.12.12",
44
+ "@internal/bundler": "workspace:*",
45
+ "@internal/eslint-config": "workspace:*",
46
+ "@internal/ts-config": "workspace:*",
47
+ "@rushstack/eslint-patch": "~1.1.4",
48
+ "react": "^18.0.0",
49
+ "react-dom": "^18.0.0",
50
+ "@types/react": "^18.0.0",
51
+ "@types/react-dom": "^18.0.0",
52
+ "@vitejs/plugin-react": "3.1.0",
53
+ "eslint": "~8.18.0",
54
+ "vite": "3.2.6",
55
+ "typescript": "4.9.5",
56
+ "@babel/core": "7.20.12",
57
+ "@babel/preset-env": "7.20.2",
58
+ "@types/chai": "4.2.22",
59
+ "@types/jest": "^26.0.0",
60
+ "@types/mocha": "9.0.0",
61
+ "@types/node": "*",
62
+ "@types/offscreencanvas": "2019.6.4",
63
+ "chai": "4.3.4",
64
+ "jest": "^26.0.0",
65
+ "jest-electron": "^0.1.12",
66
+ "jest-transform-stub": "^2.0.0",
67
+ "magic-string": "^0.25.7",
68
+ "mocha": "9.1.3",
69
+ "postcss": "8.4.21",
70
+ "rimraf": "3.0.2",
71
+ "sass": "1.43.5",
72
+ "ts-jest": "^26.0.0",
73
+ "ts-loader": "9.2.6",
74
+ "ts-node": "10.9.0",
75
+ "tslib": "2.3.1",
76
+ "ttypescript": "1.5.13",
77
+ "typescript-transform-paths": "3.3.1",
78
+ "json-formatter-js": "^2.3.4",
79
+ "inversify": "6.0.1",
80
+ "vite-plugin-markdown": "^2.1.0",
81
+ "markdown-it": "^13.0.0",
82
+ "node-fetch": "2.6.7",
83
+ "form-data": "~4.0.0",
84
+ "axios": "^1.4.0",
85
+ "@types/react-is": "^17.0.3",
86
+ "rollup-plugin-node-resolve": "5.2.0"
87
+ }
88
+ }