@visactor/vtable-gantt 1.8.3 → 1.9.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/index.d.ts CHANGED
@@ -5,5 +5,5 @@ import { Gantt } from './Gantt';
5
5
  import * as tools from './tools';
6
6
  import * as VRender from './vrender';
7
7
  import * as VTable from './vtable';
8
- export declare const version = "1.8.3";
8
+ export declare const version = "1.9.0";
9
9
  export { TYPES, GanttConstructorOptions, Gantt, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, tools, VRender, VTable };
package/cjs/index.js CHANGED
@@ -52,5 +52,5 @@ exports.VRender = VRender;
52
52
 
53
53
  const VTable = __importStar(require("./vtable"));
54
54
 
55
- exports.VTable = VTable, exports.version = "1.8.3";
55
+ exports.VTable = VTable, exports.version = "1.9.0";
56
56
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAuBlC,sBAAK;AATP,mCAAgC;AAW9B,sFAXO,aAAK,OAWP;AAVP,+CAAiC;AAsB/B,sBAAK;AArBP,mDAAqC;AAsBnC,0BAAO;AArBT,iDAAmC;AAsBjC,wBAAM;AArBK,QAAA,OAAO,GAAG,OAAO,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nexport const version = \"1.8.3\";\n/**\n * @namespace VTable\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable\n};\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAuBlC,sBAAK;AATP,mCAAgC;AAW9B,sFAXO,aAAK,OAWP;AAVP,+CAAiC;AAsB/B,sBAAK;AArBP,mDAAqC;AAsBnC,0BAAO;AArBT,iDAAmC;AAsBjC,wBAAM;AArBK,QAAA,OAAO,GAAG,OAAO,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nexport const version = \"1.9.0\";\n/**\n * @namespace VTable\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable\n};\n"]}
@@ -40870,7 +40870,7 @@
40870
40870
  }
40871
40871
  clearCells() {
40872
40872
  var _a, _b;
40873
- (this.table.isPivotChart() || this.table._hasCustomRenderOrLayout()) && this.stage.pluginService.findPluginsByName("poptipForText").forEach(plugin => {
40873
+ this.table.animationManager.clear(), (this.table.isPivotChart() || this.table._hasCustomRenderOrLayout()) && this.stage.pluginService.findPluginsByName("poptipForText").forEach(plugin => {
40874
40874
  plugin.deactivate(this.stage.pluginService);
40875
40875
  }), this.clear = !0, this.hasFrozen = !1, this.mergeMap.clear(), this.colHeaderGroup.clear(), this.rowHeaderGroup.clear(), this.cornerHeaderGroup.clear(), this.bodyGroup.clear(), this.bottomFrozenGroup.clear(), this.rightFrozenGroup.clear(), this.rightTopCornerGroup.clear(), this.rightBottomCornerGroup.clear(), this.leftBottomCornerGroup.clear(), this.colHeaderGroup.setAttributes({
40876
40876
  x: 0,
@@ -46867,6 +46867,46 @@
46867
46867
  })), isFunction$1(style) || (layoutMap.isBottomFrozenRow(row) ? table.bodyBottomStyleCache.set(cacheKey, cacheStyle) : table.bodyStyleCache.set(cacheKey, cacheStyle)), customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
46868
46868
  }
46869
46869
 
46870
+ class Animateaaa extends ACustomAnimate {
46871
+ onUpdate(end, ratio, out) {
46872
+ if (this.from.x !== this.to.x) {
46873
+ const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
46874
+ this.params.table.scrollLeft = x;
46875
+ }
46876
+ if (this.from.y !== this.to.y) {
46877
+ const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
46878
+ this.params.table.scrollTop = y;
46879
+ }
46880
+ }
46881
+ }
46882
+ class TableAnimationManager {
46883
+ constructor(table) {
46884
+ this.table = table, this.timeline = new DefaultTimeline(), this.ticker = new DefaultTicker([this.timeline]), this.tempGraphic = createRect({});
46885
+ }
46886
+ scrollTo(position, animationOption) {
46887
+ var _a, _b, _c, _d;
46888
+ const from = {
46889
+ x: this.table.scrollLeft,
46890
+ y: this.table.scrollTop
46891
+ },
46892
+ cellRect = this.table.getCellRect(null !== (_a = position.col) && void 0 !== _a ? _a : 0, null !== (_b = position.row) && void 0 !== _b ? _b : 0),
46893
+ to = {
46894
+ x: isNumber$2(position.col) ? cellRect.left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
46895
+ y: isNumber$2(position.row) ? cellRect.top - this.table.getFrozenRowsHeight() : this.table.scrollTop
46896
+ },
46897
+ duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_c = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _c ? _c : 3e3,
46898
+ easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_d = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _d ? _d : "linear",
46899
+ animation = new Animate().bind(this.tempGraphic).play(new Animateaaa(from, to, duration, easing, {
46900
+ graphic: this.tempGraphic,
46901
+ table: this.table
46902
+ }));
46903
+ this.timeline.addAnimate(animation), this.ticker.start();
46904
+ }
46905
+ clear() {
46906
+ this.timeline.clear(), this.ticker.stop();
46907
+ }
46908
+ }
46909
+
46870
46910
  const {
46871
46911
  toBoxArray: toBoxArray
46872
46912
  } = style,
@@ -46882,7 +46922,7 @@
46882
46922
  constructor(container) {
46883
46923
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46884
46924
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
46885
- if (super(), this.showFrozenIcon = !0, this.version = "1.8.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
46925
+ if (super(), this.showFrozenIcon = !0, this.version = "1.9.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
46886
46926
  const {
46887
46927
  frozenColCount = 0,
46888
46928
  frozenRowCount: frozenRowCount,
@@ -46934,7 +46974,7 @@
46934
46974
  var _a;
46935
46975
  return "node" === Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
46936
46976
  }
46937
- }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_c = options.theme) && void 0 !== _c ? _c : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new BodyHelper(this), internalProps.headerHelper = new HeaderHelper(this), internalProps.rowSeriesNumberHelper = new RowSeriesNumberHelper(this), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_d = options.allowFrozenColCount) && void 0 !== _d ? _d : 0, internalProps.limitMaxAutoWidth = null !== (_e = options.limitMaxAutoWidth) && void 0 !== _e ? _e : 450, internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10, internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager$1(this), this.eventManager = new EventManager$1(this), options.legends) {
46977
+ }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_c = options.theme) && void 0 !== _c ? _c : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new BodyHelper(this), internalProps.headerHelper = new HeaderHelper(this), internalProps.rowSeriesNumberHelper = new RowSeriesNumberHelper(this), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_d = options.allowFrozenColCount) && void 0 !== _d ? _d : 0, internalProps.limitMaxAutoWidth = null !== (_e = options.limitMaxAutoWidth) && void 0 !== _e ? _e : 450, internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10, internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager$1(this), this.eventManager = new EventManager$1(this), this.animationManager = new TableAnimationManager(this), options.legends) {
46938
46978
  internalProps.legends = [];
46939
46979
  const createLegend = Factory.getFunction("createLegend");
46940
46980
  if (Array.isArray(options.legends)) {
@@ -48211,20 +48251,6 @@
48211
48251
  end_row = this.rowCount - 1;
48212
48252
  return Array(end_row - start_row + 1).fill(0).map((_, i) => Array(end_col - start_col + 1).fill(0).map((_, j) => this.getCellInfo(j + start_col, i + start_row)));
48213
48253
  }
48214
- scrollToCell(cellAddr) {
48215
- const drawRange = this.getDrawRange();
48216
- if (isValid$1(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
48217
- const frozenWidth = this.getFrozenColsWidth(),
48218
- left = this.getColsWidth(0, cellAddr.col - 1);
48219
- this.scrollLeft = Math.min(left - frozenWidth, this.getAllColsWidth() - drawRange.width);
48220
- }
48221
- if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
48222
- const frozenHeight = this.getFrozenRowsHeight(),
48223
- top = this.getRowsHeight(0, cellAddr.row - 1);
48224
- this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
48225
- }
48226
- this.render();
48227
- }
48228
48254
  getCopyValue() {
48229
48255
  var _a, _b, _c;
48230
48256
  if ((null === (_b = null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.ranges) || void 0 === _b ? void 0 : _b.length) > 0) {
@@ -48656,6 +48682,35 @@
48656
48682
  this.eventManager.enableScroll();
48657
48683
  }
48658
48684
  getGroupTitleLevel(col, row) {}
48685
+ scrollToRow(row, animationOption) {
48686
+ animationOption ? this.animationManager.scrollTo({
48687
+ row: row
48688
+ }, animationOption) : this.scrollToCell({
48689
+ row: row
48690
+ });
48691
+ }
48692
+ scrollToCol(col, animationOption) {
48693
+ animationOption ? this.animationManager.scrollTo({
48694
+ col: col
48695
+ }, animationOption) : this.scrollToCell({
48696
+ col: col
48697
+ });
48698
+ }
48699
+ scrollToCell(cellAddr, animationOption) {
48700
+ if (animationOption) return void this.animationManager.scrollTo(cellAddr, animationOption);
48701
+ const drawRange = this.getDrawRange();
48702
+ if (isValid$1(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
48703
+ const frozenWidth = this.getFrozenColsWidth(),
48704
+ left = this.getColsWidth(0, cellAddr.col - 1);
48705
+ this.scrollLeft = Math.min(left - frozenWidth, this.getAllColsWidth() - drawRange.width);
48706
+ }
48707
+ if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
48708
+ const frozenHeight = this.getFrozenRowsHeight(),
48709
+ top = this.getRowsHeight(0, cellAddr.row - 1);
48710
+ this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
48711
+ }
48712
+ this.render();
48713
+ }
48659
48714
  }
48660
48715
 
48661
48716
  const chartTypes = {};
@@ -57209,7 +57264,7 @@
57209
57264
  themes: themes$1
57210
57265
  });
57211
57266
 
57212
- const version = "1.8.3";
57267
+ const version = "1.9.0";
57213
57268
 
57214
57269
  exports.Gantt = Gantt;
57215
57270
  exports.TYPES = index$2;