@visactor/vtable 1.26.1 → 1.27.0-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.
Files changed (41) hide show
  1. package/cjs/body-helper/style.js +2 -1
  2. package/cjs/core/BaseTable.js +2 -3
  3. package/cjs/core/BaseTable.js.map +1 -1
  4. package/cjs/data/CachedDataSource.js +0 -1
  5. package/cjs/dataset/DataStatistics.js +2 -1
  6. package/cjs/event/sparkline-event.js +1 -2
  7. package/cjs/header-helper/style.js +2 -1
  8. package/cjs/plugins/custom-cell-style.js +1 -1
  9. package/cjs/scenegraph/animation/appear.js +5 -3
  10. package/cjs/scenegraph/animation/appear.js.map +1 -1
  11. package/cjs/scenegraph/scenegraph.d.ts +3 -1
  12. package/cjs/scenegraph/scenegraph.js +19 -4
  13. package/cjs/scenegraph/scenegraph.js.map +1 -1
  14. package/cjs/vrender-app.d.ts +14 -0
  15. package/cjs/vrender-app.js +65 -0
  16. package/cjs/vrender-app.js.map +1 -0
  17. package/cjs/vrender.d.ts +18 -1
  18. package/cjs/vrender.js +51 -14
  19. package/cjs/vrender.js.map +1 -1
  20. package/dist/vtable.js +21122 -14424
  21. package/dist/vtable.min.js +1 -1
  22. package/es/body-helper/style.js +2 -1
  23. package/es/core/BaseTable.js +2 -3
  24. package/es/core/BaseTable.js.map +1 -1
  25. package/es/data/CachedDataSource.js +1 -2
  26. package/es/dataset/DataStatistics.js +2 -1
  27. package/es/event/sparkline-event.js +1 -2
  28. package/es/header-helper/style.js +2 -1
  29. package/es/plugins/custom-cell-style.js +1 -1
  30. package/es/scenegraph/animation/appear.js +5 -3
  31. package/es/scenegraph/animation/appear.js.map +1 -1
  32. package/es/scenegraph/scenegraph.d.ts +3 -1
  33. package/es/scenegraph/scenegraph.js +18 -5
  34. package/es/scenegraph/scenegraph.js.map +1 -1
  35. package/es/vrender-app.d.ts +14 -0
  36. package/es/vrender-app.js +63 -0
  37. package/es/vrender-app.js.map +1 -0
  38. package/es/vrender.d.ts +18 -1
  39. package/es/vrender.js +31 -8
  40. package/es/vrender.js.map +1 -1
  41. package/package.json +11 -10
@@ -245,5 +245,4 @@ function syncGroupCollapseState(oldSource, newSource, oldGroupMap, newGroupMap)
245
245
  isValid(newRecord) && (newRecord.hierarchyState = oldSource[i].hierarchyState),
246
246
  isArray(null == oldRecord ? void 0 : oldRecord.children) && isArray(null == newRecord ? void 0 : newRecord.children) && 0 !== oldRecord.map.size && 0 !== newRecord.map.size && syncGroupCollapseState(oldRecord.children, newRecord.children, oldRecord.map, newRecord.map);
247
247
  }
248
- }
249
- //# sourceMappingURL=CachedDataSource.js.map
248
+ }
@@ -70,4 +70,5 @@ export function dateFormat(baseField, formatString, utcOutput, mthNames, dayName
70
70
  }
71
71
  }));
72
72
  };
73
- }
73
+ }
74
+ //# sourceMappingURL=DataStatistics.js.map
@@ -15,5 +15,4 @@ export function bindSparklineHoverEvent(table) {
15
15
  })), table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, (e => {
16
16
  table.stateManager.updateSparklineHoverPose(-1, -1, 0, 0);
17
17
  })));
18
- }
19
- //# sourceMappingURL=sparkline-event.js.map
18
+ }
@@ -13,4 +13,5 @@ export function of(headerStyle, defaultHeaderStyle, styleArg, StyleClass, global
13
13
  return headerStyle || defaultHeaderStyle ? headerStyle instanceof Style ? headerStyle : "function" == typeof headerStyle ? of(headerStyle(styleArg), defaultHeaderStyle, styleArg, StyleClass, globalAutoWrapText, theme) : (headerStyle || (headerStyle = {}),
14
14
  globalAutoWrapText && !isValid(headerStyle.autoWrapText) && (headerStyle.autoWrapText = !0),
15
15
  StyleClass === CheckboxStyle ? new CheckboxStyle(null != headerStyle ? headerStyle : {}, null != defaultHeaderStyle ? defaultHeaderStyle : {}, null !== (_a = theme.checkboxStyle) && void 0 !== _a ? _a : {}) : new StyleClass(null != headerStyle ? headerStyle : {}, null != defaultHeaderStyle ? defaultHeaderStyle : {})) : StyleClass.DEFAULT;
16
- }
16
+ }
17
+ //# sourceMappingURL=style.js.map
@@ -159,4 +159,4 @@ export function mergeStyle(cacheStyle, customCellStyle) {
159
159
  export const registerCustomCellStylePlugin = () => {
160
160
  Factory.registerComponent("customCellStylePlugin", CustomCellStylePlugin);
161
161
  };
162
- //# sourceMappingURL=custom-cell-style.js.map
162
+ //# sourceMappingURL=custom-cell-style.js.map
@@ -7,12 +7,14 @@ export function dealWithAnimationAppear(table) {
7
7
  delay = null !== (_b = table.options.animationAppear.delay) && void 0 !== _b ? _b : 0,
8
8
  type = null !== (_c = table.options.animationAppear.type) && void 0 !== _c ? _c : "one-by-one",
9
9
  direction = null !== (_d = table.options.animationAppear.direction) && void 0 !== _d ? _d : "row");
10
- const {scenegraph: scene, frozenColCount: frozenColCount, frozenRowCount: frozenRowCount} = table, {colStart: colStart, colEnd: colEnd, rowStart: rowStart, rowEnd: rowEnd} = scene.proxy;
10
+ const {scenegraph: scene} = table, {colEnd: colEnd, rowEnd: rowEnd} = scene.proxy;
11
11
  for (let col = 0; col <= colEnd; col++) for (let row = 0; row <= rowEnd; row++) {
12
12
  const cellGroup = scene.highPerformanceGetCell(col, row);
13
13
  cellGroup && "cell" === cellGroup.role && cellGroup.forEachChildren((child => {
14
- child.setAttribute("opacity", 0), child.animate().wait("one-by-one" === type ? ("row" === direction ? row : col) * (duration - delay) : delay).to({
15
- opacity: 1
14
+ var _a;
15
+ const finalOpacity = null !== (_a = child.attribute.opacity) && void 0 !== _a ? _a : 1, animationDelay = "one-by-one" === type ? ("row" === direction ? row : col) * (duration - delay) : delay;
16
+ child.setAttribute("opacity", finalOpacity), child.animate().wait(animationDelay).from({
17
+ opacity: 0
16
18
  }, duration, "linear");
17
19
  }));
18
20
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scenegraph/animation/appear.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,uBAAuB,CAAC,KAAmB;;IACzD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE;QAClC,OAAO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,SAAS,EAAE,CAAC,CAAC,CAAC;oBACjC,KAAK;yBACF,OAAO,EAAE;yBACT,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;yBAC5F,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAC5C,CAAC,CAAC,CAAC;aACJ;SACF;KACF;AACH,CAAC","file":"appear.js","sourcesContent":["import type { Text } from './../../vrender';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nexport function dealWithAnimationAppear(table: BaseTableAPI) {\n if (!table.options.animationAppear) {\n return;\n }\n\n let duration: number;\n let delay: number;\n let type: 'all' | 'one-by-one';\n let direction: 'row' | 'column';\n\n if (table.options.animationAppear === true) {\n duration = 500;\n delay = 0;\n type = 'one-by-one';\n direction = 'column';\n } else {\n duration = table.options.animationAppear.duration ?? 500;\n delay = table.options.animationAppear.delay ?? 0;\n type = table.options.animationAppear.type ?? 'one-by-one';\n direction = table.options.animationAppear.direction ?? 'row';\n }\n\n const { scenegraph: scene, frozenColCount, frozenRowCount } = table;\n\n // header cell\n const { colStart, colEnd, rowStart, rowEnd } = scene.proxy; // to do: right bottom frozen\n\n for (let col = 0; col <= colEnd; col++) {\n for (let row = 0; row <= rowEnd; row++) {\n const cellGroup = scene.highPerformanceGetCell(col, row);\n if (cellGroup && cellGroup.role === 'cell') {\n cellGroup.forEachChildren((child: Text) => {\n child.setAttribute('opacity', 0);\n child\n .animate()\n .wait(type === 'one-by-one' ? (direction === 'row' ? row : col) * (duration - delay) : delay)\n .to({ opacity: 1 }, duration, 'linear');\n });\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/animation/appear.ts"],"names":[],"mappings":"AA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AAC,KAAW,EAAE,EAAE;;oBACxC,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,SAAS,CAAC,OAAO,mCAAI,CAAC,CAAC;oBAClD,MAAM,cAAc,GAAG,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;oBAE9G,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;oBAC5C,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChF,CAAC,CAAC,CAAC;aACJ;SACF;KACF;AACH,CAAC","file":"appear.js","sourcesContent":["import type { Text } from './../../vrender';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nexport function dealWithAnimationAppear(table: BaseTableAPI) {\n if (!table.options.animationAppear) {\n return;\n }\n\n let duration: number;\n let delay: number;\n let type: 'all' | 'one-by-one';\n let direction: 'row' | 'column';\n\n if (table.options.animationAppear === true) {\n duration = 500;\n delay = 0;\n type = 'one-by-one';\n direction = 'column';\n } else {\n duration = table.options.animationAppear.duration ?? 500;\n delay = table.options.animationAppear.delay ?? 0;\n type = table.options.animationAppear.type ?? 'one-by-one';\n direction = table.options.animationAppear.direction ?? 'row';\n }\n\n const { scenegraph: scene } = table;\n\n // header cell\n const { colEnd, rowEnd } = scene.proxy; // to do: right bottom frozen\n\n for (let col = 0; col <= colEnd; col++) {\n for (let row = 0; row <= rowEnd; row++) {\n const cellGroup = scene.highPerformanceGetCell(col, row);\n if (cellGroup && cellGroup.role === 'cell') {\n cellGroup.forEachChildren((child: Text) => {\n const finalOpacity = child.attribute.opacity ?? 1;\n const animationDelay = type === 'one-by-one' ? (direction === 'row' ? row : col) * (duration - delay) : delay;\n\n child.setAttribute('opacity', finalOpacity);\n child.animate().wait(animationDelay).from({ opacity: 0 }, duration, 'linear');\n });\n }\n }\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IStage, IRect, IRectGraphicAttribute } from './../vrender';
1
+ import { type IRect, type IRectGraphicAttribute, type IStage } from './../vrender';
2
2
  import type { CellRange, CellSubLocation } from '../ts-types';
3
3
  import { type CellAddress, type SortOrder } from '../ts-types';
4
4
  import type { Group } from './graphic/group';
@@ -49,6 +49,7 @@ export declare class Scenegraph {
49
49
  lastSelectId: string;
50
50
  component: TableComponent;
51
51
  stage: IStage;
52
+ releaseVRenderAppRef?: () => void;
52
53
  table: BaseTableAPI;
53
54
  isPivot: boolean;
54
55
  hasFrozen: boolean;
@@ -81,6 +82,7 @@ export declare class Scenegraph {
81
82
  initSceneGraph(): void;
82
83
  canvasShowMenu(): void;
83
84
  clearCells(): void;
85
+ releaseStage(): void;
84
86
  updateStageBackground(): void;
85
87
  createComponent(): void;
86
88
  updateComponent(): void;
@@ -1,4 +1,4 @@
1
- import { createStage, container, vglobal, registerForVrender } from "./../vrender";
1
+ import { createStageFromVRenderApp, container, setPoptipTheme, vglobal, registerForVrender } from "./../vrender";
2
2
 
3
3
  import { InternalIconName } from "../ts-types";
4
4
 
@@ -54,8 +54,6 @@ import { initSceneGraph } from "./group-creater/init-scenegraph";
54
54
 
55
55
  import { updateContainerChildrenX, updateContainerChildrenY } from "./utils/update-container";
56
56
 
57
- import { setPoptipTheme } from "./../vrender";
58
-
59
57
  import textMeasureModule from "./utils/text-measure";
60
58
 
61
59
  import { getIconByXY, hideClickIcon, hideHoverIcon, resetResidentHoverIcon, residentHoverIcon, setIconHoverStyle, setIconNormalStyle, showClickIcon, showHoverIcon, updateFrozenIcon, updateHierarchyIcon, updateSortIcon } from "./icon/icon-update";
@@ -97,7 +95,8 @@ export class Scenegraph {
97
95
  setPoptipTheme(this.table.theme.textPopTipStyle), "node" === Env.mode ? (vglobal.setEnv("node", table.options.modeParams),
98
96
  width = table.canvasWidth, height = table.canvasHeight) : table.options.canvas && table.options.viewBox ? (vglobal.setEnv("browser"),
99
97
  width = table.options.viewBox.x2 - table.options.viewBox.x1, height = table.options.viewBox.y2 - table.options.viewBox.y1) : (vglobal.setEnv("browser"),
100
- width = table.canvas.width, height = table.canvas.height), this.stage = createStage(Object.assign({
98
+ width = table.canvas.width, height = table.canvas.height);
99
+ const {stage: stage, releaseAppRef: releaseAppRef} = createStageFromVRenderApp(Object.assign({
101
100
  canvas: table.canvas,
102
101
  width: width,
103
102
  height: height,
@@ -113,7 +112,11 @@ export class Scenegraph {
113
112
  },
114
113
  canvasControled: !table.options.canvas,
115
114
  viewBox: table.options.viewBox
116
- }, table.options.renderOption)), this.stage.defaultLayer.setTheme({
115
+ }, table.options.renderOption), {
116
+ mode: "node" === Env.mode ? "node" : "browser",
117
+ scope: "vtable"
118
+ });
119
+ this.stage = stage, this.releaseVRenderAppRef = releaseAppRef, this.stage.defaultLayer.setTheme({
117
120
  group: {
118
121
  boundsPadding: 0,
119
122
  strokeBoundsBuffer: 0,
@@ -296,6 +299,16 @@ export class Scenegraph {
296
299
  delete this.tableGroup.border), null === (_u = this.proxy) || void 0 === _u || _u.release(),
297
300
  null === (_v = this.table.reactCustomLayout) || void 0 === _v || _v.clearCache();
298
301
  }
302
+ releaseStage() {
303
+ var _a;
304
+ const releaseAppRef = this.releaseVRenderAppRef;
305
+ this.releaseVRenderAppRef = void 0;
306
+ try {
307
+ null === (_a = this.stage) || void 0 === _a || _a.release();
308
+ } finally {
309
+ null == releaseAppRef || releaseAppRef();
310
+ }
311
+ }
299
312
  updateStageBackground() {
300
313
  this.stage.background = this.table.theme.underlayBackgroundColor, this.stage.renderNextFrame();
301
314
  }