@visactor/vtable-gantt 1.21.1 → 1.22.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.
@@ -35592,6 +35592,9 @@
35592
35592
  }
35593
35593
  const rect = gantt.element.getBoundingClientRect();
35594
35594
  const mouseX = event.clientX - rect.left;
35595
+ if (deltaY === 0) {
35596
+ return;
35597
+ }
35595
35598
  const zoomIn = event.deltaY < 0;
35596
35599
  const isTouchpad = Math.abs(event.deltaY) < 100 && event.deltaY % 1 !== 0;
35597
35600
  const baseStep = gantt.parsedOptions.zoom?.step || 0.015;
@@ -38380,6 +38383,8 @@
38380
38383
  AFTER_RENDER: "after_render",
38381
38384
  INITIALIZED: "initialized",
38382
38385
  UPDATED: "updated",
38386
+ AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
38387
+ AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
38383
38388
  CHANGE_CELL_VALUE: "change_cell_value",
38384
38389
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
38385
38390
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
@@ -38389,7 +38394,12 @@
38389
38394
  BUTTON_CLICK: "button_click",
38390
38395
  BEFORE_CACHE_CHART_IMAGE: "before_cache_chart_image",
38391
38396
  PASTED_DATA: "pasted_data",
38392
- PLUGIN_EVENT: "plugin_event"
38397
+ PLUGIN_EVENT: "plugin_event",
38398
+ ADD_RECORD: "add_record",
38399
+ DELETE_RECORD: "delete_record",
38400
+ UPDATE_RECORD: "update_record",
38401
+ ADD_COLUMN: "add_column",
38402
+ DELETE_COLUMN: "delete_column"
38393
38403
  };
38394
38404
 
38395
38405
  const judgeType$1 = value => {
@@ -42155,7 +42165,7 @@
42155
42165
  }
42156
42166
  constructor(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
42157
42167
  let _isGrouped;
42158
- isArray$7(null == dataConfig ? void 0 : dataConfig.groupByRules) && (rowHierarchyType = "tree", _isGrouped = !0), super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel), this._isGrouped = _isGrouped, this._recordCache = [], this._fieldCache = {};
42168
+ isArray$7(null == dataConfig ? void 0 : dataConfig.groupByRules) && (_isGrouped = !0), super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel), this._isGrouped = _isGrouped, this._recordCache = [], this._fieldCache = {};
42159
42169
  }
42160
42170
  getOriginalRecord(index) {
42161
42171
  return isNumber$4(index) && this._recordCache && this._recordCache[index] ? this._recordCache[index] : super.getOriginalRecord(index);
@@ -42771,9 +42781,13 @@
42771
42781
  })];
42772
42782
  }
42773
42783
  function _setRecords(table, records = []) {
42784
+ const tableWithPlugins = table;
42774
42785
  _dealWithUpdateDataSource(table, () => {
42786
+ var _a;
42775
42787
  table.internalProps.records = records;
42776
- const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table));
42788
+ let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
42789
+ isArray$7(null === (_a = table.internalProps.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) && (rowHierarchyType = "tree"), tableWithPlugins.pluginManager.getPluginByName("Master Detail Plugin") && (rowHierarchyType = "grid");
42790
+ const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table));
42777
42791
  table.addReleaseObj(newDataSource);
42778
42792
  });
42779
42793
  }
@@ -44265,14 +44279,28 @@
44265
44279
  } else "mark" === child.name && child.setAttribute("x", cellGroup.attribute.width);
44266
44280
  }), autoRowHeight) {
44267
44281
  let newHeight = Math.max(leftIconHeight, contentHeight, rightIconHeight);
44268
- if (isCellHeightUpdate(scene, cellGroup, Math.round(newHeight + padding[0] + padding[2]), oldCellHeight)) return !0;
44282
+ if (isCellHeightUpdate(scene, cellGroup, Math.round(newHeight + padding[0] + padding[2]), oldCellHeight)) return scene.table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH) && scene.table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH, {
44283
+ col: cellGroup.col,
44284
+ row: cellGroup.row,
44285
+ cellHeight: cellHeight,
44286
+ cellGroup: cellGroup,
44287
+ padding: padding,
44288
+ textBaseline: textBaseline
44289
+ }), !0;
44269
44290
  newHeight = (null !== (_d = cellGroup.contentHeight) && void 0 !== _d ? _d : cellHeight) - (padding[0] + padding[2]), cellGroup.forEachChildren(child => {
44270
44291
  "rect" !== child.type && "chart" !== child.type && child.name !== CUSTOM_CONTAINER_NAME && ("mark" === child.name ? child.setAttribute("y", 0) : "middle" === textBaseline ? child.setAttribute("y", padding[0] + (newHeight - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", padding[0] + newHeight - child.AABBBounds.height()) : child.setAttribute("y", padding[0]));
44271
44292
  });
44272
44293
  } else "middle" !== textBaseline && "bottom" !== textBaseline || cellGroup.forEachChildren(child => {
44273
44294
  "rect" !== child.type && "chart" !== child.type && child.name !== CUSTOM_CONTAINER_NAME && ("mark" === child.name ? child.setAttribute("y", 0) : "middle" === textBaseline ? child.setAttribute("y", (cellHeight - padding[2] + padding[0] - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", cellHeight - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]));
44274
44295
  });
44275
- return !1;
44296
+ return scene.table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH) && scene.table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH, {
44297
+ col: cellGroup.col,
44298
+ row: cellGroup.row,
44299
+ cellHeight: cellHeight,
44300
+ cellGroup: cellGroup,
44301
+ padding: padding,
44302
+ textBaseline: textBaseline
44303
+ }), !1;
44276
44304
  }
44277
44305
  function updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline, table) {
44278
44306
  var _a;
@@ -49869,7 +49897,8 @@
49869
49897
  } else if (this.rowEnd === this.bodyBottomRow) {
49870
49898
  const cellGroup = this.table.scenegraph.highPerformanceGetCell(this.colStart, this.rowEnd, !0);
49871
49899
  if ("cell" === cellGroup.role) {
49872
- const deltaY = cellGroup.attribute.y + cellGroup.attribute.height - (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
49900
+ const actualRowHeight = this.table.getRowHeight(this.rowEnd),
49901
+ deltaY = cellGroup.attribute.y + actualRowHeight - (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
49873
49902
  this.deltaY = -deltaY;
49874
49903
  }
49875
49904
  } else if (isValid$3(screenTopY) && isValid$3(screenTopRow)) {
@@ -50010,6 +50039,11 @@
50010
50039
  width: colsWidth,
50011
50040
  height: rowsHeight,
50012
50041
  visible: !0
50042
+ }), table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT) && table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT, {
50043
+ startRow: computeRectCellRangeStartRow,
50044
+ endRow: computeRectCellRangeEndRow,
50045
+ currentHeight: rowsHeight,
50046
+ selectComp: selectComp
50013
50047
  }), selectComp.fillhandle) {
50014
50048
  const fillHandle = null === (_a = scene.table.options.excelOptions) || void 0 === _a ? void 0 : _a.fillHandle;
50015
50049
  let lastCellBound,
@@ -52039,7 +52073,7 @@
52039
52073
  var _a, _b, _c, _d, _e, _f;
52040
52074
  const firstBodyCell = null !== (_b = null === (_a = this.bodyGroup.firstChild) || void 0 === _a ? void 0 : _a.firstChild) && void 0 !== _b ? _b : null === (_c = this.rowHeaderGroup.firstChild) || void 0 === _c ? void 0 : _c.firstChild,
52041
52075
  lastBodyCell = null !== (_e = null === (_d = this.bodyGroup.firstChild) || void 0 === _d ? void 0 : _d.lastChild) && void 0 !== _e ? _e : null === (_f = this.rowHeaderGroup.firstChild) || void 0 === _f ? void 0 : _f.lastChild;
52042
- 0 === y && firstBodyCell && firstBodyCell.row === this.table.frozenRowCount && firstBodyCell.attribute.y + y < 0 ? y = -firstBodyCell.attribute.y : lastBodyCell && this.table.tableNoFrameHeight < this.table.getAllRowsHeight() && lastBodyCell.row === this.table.rowCount - this.table.bottomFrozenRowCount - 1 && lastBodyCell.attribute.y + lastBodyCell.attribute.height + y < this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() && (y = this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() - lastBodyCell.attribute.y - lastBodyCell.attribute.height), this.colHeaderGroup.attribute.height + y !== this.bodyGroup.attribute.y && (this.bodyGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height + y), this.table.rightFrozenColCount > 0 && this.rightFrozenGroup.setAttribute("y", this.rightTopCornerGroup.attribute.height + y), this.updateNextFrame());
52076
+ 0 === y && firstBodyCell && firstBodyCell.row === this.table.frozenRowCount && firstBodyCell.attribute.y + y < 0 ? y = -firstBodyCell.attribute.y : lastBodyCell && this.table.tableNoFrameHeight < this.table.getAllRowsHeight() && lastBodyCell.row === this.table.rowCount - this.table.bottomFrozenRowCount - 1 && lastBodyCell.attribute.y + this.table.getRowHeight(lastBodyCell.row) + y < this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() && (y = this.table.tableNoFrameHeight - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight() - lastBodyCell.attribute.y - this.table.getRowHeight(lastBodyCell.row)), this.colHeaderGroup.attribute.height + y !== this.bodyGroup.attribute.y && (this.bodyGroup.setAttribute("y", this.colHeaderGroup.attribute.height + y), this.rowHeaderGroup.setAttribute("y", this.cornerHeaderGroup.attribute.height + y), this.table.rightFrozenColCount > 0 && this.rightFrozenGroup.setAttribute("y", this.rightTopCornerGroup.attribute.height + y), this.updateNextFrame());
52043
52077
  }
52044
52078
  setBodyAndColHeaderX(x) {
52045
52079
  const firstBodyCol = this.bodyGroup.firstChild,
@@ -55041,8 +55075,9 @@
55041
55075
  (null === (_b = table.options.customConfig) || void 0 === _b ? void 0 : _b.cancelSelectCellHook) ? (null === (_c = table.options.customConfig) || void 0 === _c ? void 0 : _c.cancelSelectCellHook(e)) && eventManager.dealTableSelect() : (null === (_e = null === (_d = table.options.select) || void 0 === _d ? void 0 : _d.blankAreaClickDeselect) || void 0 === _e || _e) && eventManager.dealTableSelect(), stateManager.endSelectCells(!0, isHasSelected), stateManager.updateCursor(), table.scenegraph.updateChartState(null);
55042
55076
  }
55043
55077
  }), table.scenegraph.stage.addEventListener("pointermove", e => {
55078
+ var _a, _b, _c;
55044
55079
  const eventArgsSet = getCellEventArgsSet(e);
55045
- stateManager.isResizeCol() || eventManager.checkColumnResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("col-resize") : stateManager.isResizeRow() || eventManager.checkRowResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("row-resize") : stateManager.isMoveCol() || stateManager.updateCursor();
55080
+ null !== (_c = null === (_b = null === (_a = e.target) || void 0 === _a ? void 0 : _a.isDescendantsOf) || void 0 === _b ? void 0 : _b.call(_a, table.scenegraph.tableGroup)) && void 0 !== _c && _c && (stateManager.isResizeCol() || eventManager.checkColumnResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("col-resize") : stateManager.isResizeRow() || eventManager.checkRowResize(eventArgsSet) ? table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet) ? stateManager.updateCursor("crosshair") : stateManager.updateCursor("row-resize") : stateManager.isMoveCol() || stateManager.updateCursor());
55046
55081
  }), table.scenegraph.tableGroup.addEventListener("checkbox_state_change", e => {
55047
55082
  var _a, _b;
55048
55083
  const eventArgsSet = getCellEventArgsSet(e),
@@ -59063,7 +59098,7 @@
59063
59098
  }
59064
59099
  constructor(container, options = {}) {
59065
59100
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
59066
- if (super(), this.showFrozenIcon = !0, this.version = "1.21.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
59101
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
59067
59102
  this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59068
59103
  options: options,
59069
59104
  container: container
@@ -63718,140 +63753,152 @@
63718
63753
  }
63719
63754
  function listTableAddRecord(record, recordIndex, table) {
63720
63755
  var _a, _b, _c, _d;
63721
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63722
- (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
63723
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63724
- table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
63725
- const oldRowCount = table.rowCount;
63726
- if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
63727
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
63728
- if (table.pagination) {
63729
- const {
63730
- perPageCount: perPageCount,
63731
- currentPage: currentPage
63732
- } = table.pagination,
63733
- endIndex = perPageCount * (currentPage || 0) + perPageCount;
63734
- if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63735
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63736
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
63737
- const updateRows = [];
63738
- for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63739
- col: row,
63740
- row: 0
63741
- }) : updateRows.push({
63742
- col: 0,
63743
- row: row
63744
- });
63745
- table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63746
- } else {
63747
- const addRows = [];
63748
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) table.transpose ? addRows.push({
63749
- col: row,
63750
- row: 0
63751
- }) : addRows.push({
63752
- col: 0,
63753
- row: row
63754
- });
63755
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63756
+ try {
63757
+ if (!record) return !1;
63758
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63759
+ (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
63760
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63761
+ table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
63762
+ const oldRowCount = table.rowCount;
63763
+ if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
63764
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
63765
+ if (table.pagination) {
63766
+ const {
63767
+ perPageCount: perPageCount,
63768
+ currentPage: currentPage
63769
+ } = table.pagination,
63770
+ endIndex = perPageCount * (currentPage || 0) + perPageCount;
63771
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63772
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63773
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
63774
+ const updateRows = [];
63775
+ for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63776
+ col: row,
63777
+ row: 0
63778
+ }) : updateRows.push({
63779
+ col: 0,
63780
+ row: row
63781
+ });
63782
+ table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63783
+ } else {
63784
+ const addRows = [];
63785
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) table.transpose ? addRows.push({
63786
+ col: row,
63787
+ row: 0
63788
+ }) : addRows.push({
63789
+ col: 0,
63790
+ row: row
63791
+ });
63792
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63793
+ }
63756
63794
  }
63795
+ } else {
63796
+ const addRows = [];
63797
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) table.transpose ? addRows.push({
63798
+ col: row,
63799
+ row: 0
63800
+ }) : addRows.push({
63801
+ col: 0,
63802
+ row: row
63803
+ });
63804
+ const updateRows = [],
63805
+ topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63806
+ bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
63807
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63808
+ col: row,
63809
+ row: 0
63810
+ }) : updateRows.push({
63811
+ col: 0,
63812
+ row: row
63813
+ });
63814
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63815
+ col: row,
63816
+ row: 0
63817
+ }) : updateRows.push({
63818
+ col: 0,
63819
+ row: row
63820
+ });
63821
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63757
63822
  }
63758
- } else {
63759
- const addRows = [];
63760
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) table.transpose ? addRows.push({
63761
- col: row,
63762
- row: 0
63763
- }) : addRows.push({
63764
- col: 0,
63765
- row: row
63766
- });
63767
- const updateRows = [],
63768
- topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63769
- bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
63770
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63771
- col: row,
63772
- row: 0
63773
- }) : updateRows.push({
63774
- col: 0,
63775
- row: row
63776
- });
63777
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63778
- col: row,
63779
- row: 0
63780
- }) : updateRows.push({
63781
- col: 0,
63782
- row: row
63783
- });
63784
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63785
63823
  }
63824
+ return !0;
63825
+ } catch (error) {
63826
+ return !1;
63786
63827
  }
63787
63828
  }
63788
63829
  function listTableAddRecords(records, recordIndex, table) {
63789
63830
  var _a, _b, _c, _d;
63790
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63791
- void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
63792
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63793
- table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
63794
- const oldRowCount = table.transpose ? table.colCount : table.rowCount;
63795
- if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
63796
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
63797
- if (table.pagination) {
63798
- const {
63799
- perPageCount: perPageCount,
63800
- currentPage: currentPage
63801
- } = table.pagination,
63802
- endIndex = perPageCount * (currentPage || 0) + perPageCount;
63803
- if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63804
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63805
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
63806
- const updateRows = [];
63807
- for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63808
- col: row,
63809
- row: 0
63810
- }) : updateRows.push({
63811
- col: 0,
63812
- row: row
63813
- });
63814
- table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63815
- } else {
63816
- const addRows = [];
63817
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) table.transpose ? addRows.push({
63818
- col: row,
63819
- row: 0
63820
- }) : addRows.push({
63821
- col: 0,
63822
- row: row
63823
- });
63824
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63831
+ try {
63832
+ if (!records || 0 === records.length) return !1;
63833
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63834
+ void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
63835
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
63836
+ table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
63837
+ const oldRowCount = table.transpose ? table.colCount : table.rowCount;
63838
+ if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
63839
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
63840
+ if (table.pagination) {
63841
+ const {
63842
+ perPageCount: perPageCount,
63843
+ currentPage: currentPage
63844
+ } = table.pagination,
63845
+ endIndex = perPageCount * (currentPage || 0) + perPageCount;
63846
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
63847
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
63848
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
63849
+ const updateRows = [];
63850
+ for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
63851
+ col: row,
63852
+ row: 0
63853
+ }) : updateRows.push({
63854
+ col: 0,
63855
+ row: row
63856
+ });
63857
+ table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
63858
+ } else {
63859
+ const addRows = [];
63860
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) table.transpose ? addRows.push({
63861
+ col: row,
63862
+ row: 0
63863
+ }) : addRows.push({
63864
+ col: 0,
63865
+ row: row
63866
+ });
63867
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
63868
+ }
63825
63869
  }
63870
+ } else {
63871
+ const addRows = [];
63872
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) table.transpose ? addRows.push({
63873
+ col: row,
63874
+ row: 0
63875
+ }) : addRows.push({
63876
+ col: 0,
63877
+ row: row
63878
+ });
63879
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63880
+ bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount,
63881
+ updateRows = [];
63882
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63883
+ col: row,
63884
+ row: 0
63885
+ }) : updateRows.push({
63886
+ col: 0,
63887
+ row: row
63888
+ });
63889
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63890
+ col: row,
63891
+ row: 0
63892
+ }) : updateRows.push({
63893
+ col: 0,
63894
+ row: row
63895
+ });
63896
+ table.transpose ? table.scenegraph.updateCol([], addRows, updateRows) : table.scenegraph.updateRow([], addRows, updateRows);
63826
63897
  }
63827
- } else {
63828
- const addRows = [];
63829
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) table.transpose ? addRows.push({
63830
- col: row,
63831
- row: 0
63832
- }) : addRows.push({
63833
- col: 0,
63834
- row: row
63835
- });
63836
- const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
63837
- bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount,
63838
- updateRows = [];
63839
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
63840
- col: row,
63841
- row: 0
63842
- }) : updateRows.push({
63843
- col: 0,
63844
- row: row
63845
- });
63846
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
63847
- col: row,
63848
- row: 0
63849
- }) : updateRows.push({
63850
- col: 0,
63851
- row: row
63852
- });
63853
- table.transpose ? table.scenegraph.updateCol([], addRows, updateRows) : table.scenegraph.updateRow([], addRows, updateRows);
63854
63898
  }
63899
+ return !0;
63900
+ } catch (error) {
63901
+ return !1;
63855
63902
  }
63856
63903
  }
63857
63904
  function listTableDeleteRecords(recordIndexs, table) {
@@ -64261,21 +64308,33 @@
64261
64308
  };
64262
64309
  this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this._updateSize(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
64263
64310
  }
64264
- addColumn(column, colIndex, isMaintainArrayData = !0) {
64311
+ addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
64265
64312
  const columns = this.options.columns;
64266
- if (void 0 === colIndex) columns.push(column);else {
64267
- if (isMaintainArrayData) for (let i = 0; i < columns.length; i++) "number" == typeof columns[i].field && columns[i].field >= colIndex && (columns[i].field = columns[i].field + 1);
64268
- columns.splice(colIndex, 0, column);
64269
- }
64270
- if (isMaintainArrayData) for (let i = 0; i < this.records.length; i++) {
64271
- const record = this.records[i];
64272
- Array.isArray(record) && record.splice(colIndex, 0, void 0);
64313
+ if (void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns), isMaintainArrayData) {
64314
+ for (let i = 0; i < columns.length; i++) columns[i].field = i;
64315
+ for (let i = 0; i < this.records.length; i++) {
64316
+ const record = this.records[i];
64317
+ Array.isArray(record) && record.splice(colIndex, 0, ...Array(toAddColumns.length).fill(void 0));
64318
+ }
64273
64319
  }
64274
- this.updateColumns(columns);
64320
+ this.updateColumns(columns), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
64321
+ columnIndex: colIndex,
64322
+ columnCount: toAddColumns.length,
64323
+ columns: columns
64324
+ });
64275
64325
  }
64276
- deleteColumn(colIndex) {
64326
+ deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
64277
64327
  const columns = this.options.columns;
64278
- columns.splice(colIndex, 1), this.updateColumns(columns);
64328
+ deleteColIndexs.sort((a, b) => b - a);
64329
+ for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
64330
+ const record = this.records[j];
64331
+ Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
64332
+ }
64333
+ if (isMaintainArrayData) for (let i = 0; i < columns.length; i++) columns[i].field = i;
64334
+ this.updateColumns(columns), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
64335
+ deleteColIndexs: deleteColIndexs,
64336
+ columns: columns
64337
+ });
64279
64338
  }
64280
64339
  get columns() {
64281
64340
  return this.internalProps.layoutMap.columnTree.getCopiedTree();
@@ -64677,6 +64736,9 @@
64677
64736
  updateFilterRules(filterRules) {
64678
64737
  this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(), this.resize();
64679
64738
  }
64739
+ getFilteredRecords() {
64740
+ return this.dataSource.records;
64741
+ }
64680
64742
  getCheckboxState(field) {
64681
64743
  if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount && this.stateManager.initLeftRecordsCheckState(this.records), isValid$3(field)) {
64682
64744
  let stateArr = Array.from(this.stateManager.checkedState.keys()).sort((a, b) => {
@@ -64816,18 +64878,39 @@
64816
64878
  }
64817
64879
  addRecord(record, recordIndex) {
64818
64880
  var _a;
64819
- listTableAddRecord(record, recordIndex, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
64881
+ const success = listTableAddRecord(record, recordIndex, this);
64882
+ null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
64883
+ records: [record],
64884
+ recordIndex: recordIndex,
64885
+ recordCount: 1
64886
+ });
64820
64887
  }
64821
64888
  addRecords(records, recordIndex) {
64822
64889
  var _a;
64823
- listTableAddRecords(records, recordIndex, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
64890
+ const success = listTableAddRecords(records, recordIndex, this);
64891
+ null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
64892
+ records: records,
64893
+ recordIndex: recordIndex,
64894
+ recordCount: records.length
64895
+ });
64824
64896
  }
64825
64897
  deleteRecords(recordIndexs) {
64826
64898
  var _a;
64827
64899
  listTableDeleteRecords(recordIndexs, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
64900
+ const rowIndexs = [];
64901
+ for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
64902
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
64903
+ recordIndexs: recordIndexs,
64904
+ rowIndexs: rowIndexs,
64905
+ deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
64906
+ });
64828
64907
  }
64829
64908
  updateRecords(records, recordIndexs) {
64830
- listTableUpdateRecords(records, recordIndexs, this);
64909
+ listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
64910
+ records: records,
64911
+ recordIndexs: recordIndexs,
64912
+ updateCount: records.length
64913
+ });
64831
64914
  }
64832
64915
  _hasCustomRenderOrLayout() {
64833
64916
  var _a, _b, _c, _d;
@@ -69041,7 +69124,7 @@
69041
69124
  }
69042
69125
 
69043
69126
  function createProgressBarCell(progressBarDefine, style, width, value, dataValue, col, row, padding, table, range) {
69044
- var _a, _b, _c, _d, _e;
69127
+ var _a, _b, _c, _d, _e, _f;
69045
69128
  if (progressBarDefine.dependField) {
69046
69129
  const dependField = getOrApply(progressBarDefine.dependField, {
69047
69130
  col: col,
@@ -69078,7 +69161,14 @@
69078
69161
  cellHeaderPaths: void 0
69079
69162
  })) && void 0 !== _e ? _e : min + 100;
69080
69163
  let height = 0;
69081
- height = range ? table.getRowsHeight(range.start.row, range.end.row) : table.getRowHeight(row);
69164
+ if (height = range ? table.getRowsHeight(range.start.row, range.end.row) : table.getRowHeight(row), table.pluginManager) {
69165
+ if (table.pluginManager.getPluginByName("Master Detail Plugin")) {
69166
+ const bodyRowIndex = row - table.columnHeaderLevelCount,
69167
+ internalProps = table.internalProps,
69168
+ originalHeight = null === (_f = null == internalProps ? void 0 : internalProps.originalRowHeights) || void 0 === _f ? void 0 : _f.get(bodyRowIndex);
69169
+ void 0 !== originalHeight && originalHeight > 0 && (height = originalHeight);
69170
+ }
69171
+ }
69082
69172
  let contentWidth = width,
69083
69173
  contentHeight = height,
69084
69174
  _contentOffset = 0;
@@ -76815,7 +76905,7 @@
76815
76905
  PluginManager: PluginManager
76816
76906
  });
76817
76907
 
76818
- const version = "1.21.1";
76908
+ const version = "1.22.0";
76819
76909
 
76820
76910
  exports.Gantt = Gantt;
76821
76911
  exports.TYPES = index$4;