@visactor/vtable-gantt 1.8.3 → 1.9.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/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.1";
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.1";
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.1\";\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,
@@ -42993,7 +42993,8 @@
42993
42993
  const previousSort = [...this.sort],
42994
42994
  previousSortItem = this.table.internalProps.multipleSort || !previousSort.length ? null : this.sort[this.sort.length - 1];
42995
42995
  dealSort(col, row, this.table, event);
42996
- const currentSortItem = this.sort.find(item => item.col === col && item.row === row),
42996
+ const range = this.table.getCellRange(col, row),
42997
+ currentSortItem = this.sort.find(item => item.col === range.start.col && item.row === range.start.row),
42997
42998
  oldSortCol = this.table.internalProps.multipleSort || !previousSortItem ? null : previousSortItem.col,
42998
42999
  oldSortRow = this.table.internalProps.multipleSort || !previousSortItem ? null : previousSortItem.row,
42999
43000
  currentSortItemIndex = previousSort.findIndex(item => item.col === col && item.row === row);
@@ -46867,6 +46868,46 @@
46867
46868
  })), isFunction$1(style) || (layoutMap.isBottomFrozenRow(row) ? table.bodyBottomStyleCache.set(cacheKey, cacheStyle) : table.bodyStyleCache.set(cacheKey, cacheStyle)), customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
46868
46869
  }
46869
46870
 
46871
+ class Animateaaa extends ACustomAnimate {
46872
+ onUpdate(end, ratio, out) {
46873
+ if (this.from.x !== this.to.x) {
46874
+ const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
46875
+ this.params.table.scrollLeft = x;
46876
+ }
46877
+ if (this.from.y !== this.to.y) {
46878
+ const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
46879
+ this.params.table.scrollTop = y;
46880
+ }
46881
+ }
46882
+ }
46883
+ class TableAnimationManager {
46884
+ constructor(table) {
46885
+ this.table = table, this.timeline = new DefaultTimeline(), this.ticker = new DefaultTicker([this.timeline]), this.tempGraphic = createRect({});
46886
+ }
46887
+ scrollTo(position, animationOption) {
46888
+ var _a, _b, _c, _d;
46889
+ const from = {
46890
+ x: this.table.scrollLeft,
46891
+ y: this.table.scrollTop
46892
+ },
46893
+ cellRect = this.table.getCellRect(null !== (_a = position.col) && void 0 !== _a ? _a : 0, null !== (_b = position.row) && void 0 !== _b ? _b : 0),
46894
+ to = {
46895
+ x: isNumber$2(position.col) ? cellRect.left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
46896
+ y: isNumber$2(position.row) ? cellRect.top - this.table.getFrozenRowsHeight() : this.table.scrollTop
46897
+ },
46898
+ duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_c = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _c ? _c : 3e3,
46899
+ easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_d = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _d ? _d : "linear",
46900
+ animation = new Animate().bind(this.tempGraphic).play(new Animateaaa(from, to, duration, easing, {
46901
+ graphic: this.tempGraphic,
46902
+ table: this.table
46903
+ }));
46904
+ this.timeline.addAnimate(animation), this.ticker.start();
46905
+ }
46906
+ clear() {
46907
+ this.timeline.clear(), this.ticker.stop();
46908
+ }
46909
+ }
46910
+
46870
46911
  const {
46871
46912
  toBoxArray: toBoxArray
46872
46913
  } = style,
@@ -46882,7 +46923,7 @@
46882
46923
  constructor(container) {
46883
46924
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46884
46925
  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");
46926
+ if (super(), this.showFrozenIcon = !0, this.version = "1.9.1", 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
46927
  const {
46887
46928
  frozenColCount = 0,
46888
46929
  frozenRowCount: frozenRowCount,
@@ -46934,7 +46975,7 @@
46934
46975
  var _a;
46935
46976
  return "node" === Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
46936
46977
  }
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) {
46978
+ }, 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
46979
  internalProps.legends = [];
46939
46980
  const createLegend = Factory.getFunction("createLegend");
46940
46981
  if (Array.isArray(options.legends)) {
@@ -48211,20 +48252,6 @@
48211
48252
  end_row = this.rowCount - 1;
48212
48253
  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
48254
  }
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
48255
  getCopyValue() {
48229
48256
  var _a, _b, _c;
48230
48257
  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 +48683,35 @@
48656
48683
  this.eventManager.enableScroll();
48657
48684
  }
48658
48685
  getGroupTitleLevel(col, row) {}
48686
+ scrollToRow(row, animationOption) {
48687
+ animationOption ? this.animationManager.scrollTo({
48688
+ row: row
48689
+ }, animationOption) : this.scrollToCell({
48690
+ row: row
48691
+ });
48692
+ }
48693
+ scrollToCol(col, animationOption) {
48694
+ animationOption ? this.animationManager.scrollTo({
48695
+ col: col
48696
+ }, animationOption) : this.scrollToCell({
48697
+ col: col
48698
+ });
48699
+ }
48700
+ scrollToCell(cellAddr, animationOption) {
48701
+ if (animationOption) return void this.animationManager.scrollTo(cellAddr, animationOption);
48702
+ const drawRange = this.getDrawRange();
48703
+ if (isValid$1(cellAddr.col) && cellAddr.col >= this.frozenColCount) {
48704
+ const frozenWidth = this.getFrozenColsWidth(),
48705
+ left = this.getColsWidth(0, cellAddr.col - 1);
48706
+ this.scrollLeft = Math.min(left - frozenWidth, this.getAllColsWidth() - drawRange.width);
48707
+ }
48708
+ if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
48709
+ const frozenHeight = this.getFrozenRowsHeight(),
48710
+ top = this.getRowsHeight(0, cellAddr.row - 1);
48711
+ this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
48712
+ }
48713
+ this.render();
48714
+ }
48659
48715
  }
48660
48716
 
48661
48717
  const chartTypes = {};
@@ -57209,7 +57265,7 @@
57209
57265
  themes: themes$1
57210
57266
  });
57211
57267
 
57212
- const version = "1.8.3";
57268
+ const version = "1.9.1";
57213
57269
 
57214
57270
  exports.Gantt = Gantt;
57215
57271
  exports.TYPES = index$2;