@visactor/vtable-calendar 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.
@@ -34794,6 +34794,8 @@
34794
34794
  AFTER_RENDER: "after_render",
34795
34795
  INITIALIZED: "initialized",
34796
34796
  UPDATED: "updated",
34797
+ AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
34798
+ AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
34797
34799
  CHANGE_CELL_VALUE: "change_cell_value",
34798
34800
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
34799
34801
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
@@ -34803,7 +34805,12 @@
34803
34805
  BUTTON_CLICK: "button_click",
34804
34806
  BEFORE_CACHE_CHART_IMAGE: "before_cache_chart_image",
34805
34807
  PASTED_DATA: "pasted_data",
34806
- PLUGIN_EVENT: "plugin_event"
34808
+ PLUGIN_EVENT: "plugin_event",
34809
+ ADD_RECORD: "add_record",
34810
+ DELETE_RECORD: "delete_record",
34811
+ UPDATE_RECORD: "update_record",
34812
+ ADD_COLUMN: "add_column",
34813
+ DELETE_COLUMN: "delete_column"
34807
34814
  };
34808
34815
 
34809
34816
  const judgeType = value => {
@@ -38555,7 +38562,7 @@
38555
38562
  }
38556
38563
  constructor(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
38557
38564
  let _isGrouped;
38558
- 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 = {};
38565
+ isArray$7(null == dataConfig ? void 0 : dataConfig.groupByRules) && (_isGrouped = !0), super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel), this._isGrouped = _isGrouped, this._recordCache = [], this._fieldCache = {};
38559
38566
  }
38560
38567
  getOriginalRecord(index) {
38561
38568
  return isNumber$4(index) && this._recordCache && this._recordCache[index] ? this._recordCache[index] : super.getOriginalRecord(index);
@@ -39171,9 +39178,13 @@
39171
39178
  })];
39172
39179
  }
39173
39180
  function _setRecords(table, records = []) {
39181
+ const tableWithPlugins = table;
39174
39182
  _dealWithUpdateDataSource(table, () => {
39183
+ var _a;
39175
39184
  table.internalProps.records = records;
39176
- const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table));
39185
+ let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
39186
+ isArray$7(null === (_a = table.internalProps.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) && (rowHierarchyType = "tree"), tableWithPlugins.pluginManager.getPluginByName("Master Detail Plugin") && (rowHierarchyType = "grid");
39187
+ const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table));
39177
39188
  table.addReleaseObj(newDataSource);
39178
39189
  });
39179
39190
  }
@@ -40665,14 +40676,28 @@
40665
40676
  } else "mark" === child.name && child.setAttribute("x", cellGroup.attribute.width);
40666
40677
  }), autoRowHeight) {
40667
40678
  let newHeight = Math.max(leftIconHeight, contentHeight, rightIconHeight);
40668
- if (isCellHeightUpdate(scene, cellGroup, Math.round(newHeight + padding[0] + padding[2]), oldCellHeight)) return !0;
40679
+ 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, {
40680
+ col: cellGroup.col,
40681
+ row: cellGroup.row,
40682
+ cellHeight: cellHeight,
40683
+ cellGroup: cellGroup,
40684
+ padding: padding,
40685
+ textBaseline: textBaseline
40686
+ }), !0;
40669
40687
  newHeight = (null !== (_d = cellGroup.contentHeight) && void 0 !== _d ? _d : cellHeight) - (padding[0] + padding[2]), cellGroup.forEachChildren(child => {
40670
40688
  "rect" !== child.type && "chart" !== child.type && child.name !== CUSTOM_CONTAINER_NAME$1 && ("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]));
40671
40689
  });
40672
40690
  } else "middle" !== textBaseline && "bottom" !== textBaseline || cellGroup.forEachChildren(child => {
40673
40691
  "rect" !== child.type && "chart" !== child.type && child.name !== CUSTOM_CONTAINER_NAME$1 && ("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]));
40674
40692
  });
40675
- return !1;
40693
+ return scene.table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH) && scene.table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_CELL_CONTENT_WIDTH, {
40694
+ col: cellGroup.col,
40695
+ row: cellGroup.row,
40696
+ cellHeight: cellHeight,
40697
+ cellGroup: cellGroup,
40698
+ padding: padding,
40699
+ textBaseline: textBaseline
40700
+ }), !1;
40676
40701
  }
40677
40702
  function updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline, table) {
40678
40703
  var _a;
@@ -46269,7 +46294,8 @@
46269
46294
  } else if (this.rowEnd === this.bodyBottomRow) {
46270
46295
  const cellGroup = this.table.scenegraph.highPerformanceGetCell(this.colStart, this.rowEnd, !0);
46271
46296
  if ("cell" === cellGroup.role) {
46272
- const deltaY = cellGroup.attribute.y + cellGroup.attribute.height - (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
46297
+ const actualRowHeight = this.table.getRowHeight(this.rowEnd),
46298
+ deltaY = cellGroup.attribute.y + actualRowHeight - (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
46273
46299
  this.deltaY = -deltaY;
46274
46300
  }
46275
46301
  } else if (isValid$3(screenTopY) && isValid$3(screenTopRow)) {
@@ -46410,6 +46436,11 @@
46410
46436
  width: colsWidth,
46411
46437
  height: rowsHeight,
46412
46438
  visible: !0
46439
+ }), table.hasListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT) && table.fireListeners(TABLE_EVENT_TYPE.AFTER_UPDATE_SELECT_BORDER_HEIGHT, {
46440
+ startRow: computeRectCellRangeStartRow,
46441
+ endRow: computeRectCellRangeEndRow,
46442
+ currentHeight: rowsHeight,
46443
+ selectComp: selectComp
46413
46444
  }), selectComp.fillhandle) {
46414
46445
  const fillHandle = null === (_a = scene.table.options.excelOptions) || void 0 === _a ? void 0 : _a.fillHandle;
46415
46446
  let lastCellBound,
@@ -48439,7 +48470,7 @@
48439
48470
  var _a, _b, _c, _d, _e, _f;
48440
48471
  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,
48441
48472
  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;
48442
- 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());
48473
+ 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());
48443
48474
  }
48444
48475
  setBodyAndColHeaderX(x) {
48445
48476
  const firstBodyCol = this.bodyGroup.firstChild,
@@ -51441,8 +51472,9 @@
51441
51472
  (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);
51442
51473
  }
51443
51474
  }), table.scenegraph.stage.addEventListener("pointermove", e => {
51475
+ var _a, _b, _c;
51444
51476
  const eventArgsSet = getCellEventArgsSet(e);
51445
- 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();
51477
+ 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());
51446
51478
  }), table.scenegraph.tableGroup.addEventListener("checkbox_state_change", e => {
51447
51479
  var _a, _b;
51448
51480
  const eventArgsSet = getCellEventArgsSet(e),
@@ -55463,7 +55495,7 @@
55463
55495
  }
55464
55496
  constructor(container, options = {}) {
55465
55497
  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;
55466
- 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");
55498
+ 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");
55467
55499
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
55468
55500
  options: options,
55469
55501
  container: container
@@ -60082,140 +60114,152 @@
60082
60114
  }
60083
60115
  function listTableAddRecord(record, recordIndex, table) {
60084
60116
  var _a, _b, _c, _d;
60085
- 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 {
60086
- (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
60087
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60088
- table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
60089
- const oldRowCount = table.rowCount;
60090
- if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
60091
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
60092
- if (table.pagination) {
60093
- const {
60094
- perPageCount: perPageCount,
60095
- currentPage: currentPage
60096
- } = table.pagination,
60097
- endIndex = perPageCount * (currentPage || 0) + perPageCount;
60098
- if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60099
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
60100
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
60101
- const updateRows = [];
60102
- for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
60103
- col: row,
60104
- row: 0
60105
- }) : updateRows.push({
60106
- col: 0,
60107
- row: row
60108
- });
60109
- table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
60110
- } else {
60111
- const addRows = [];
60112
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) table.transpose ? addRows.push({
60113
- col: row,
60114
- row: 0
60115
- }) : addRows.push({
60116
- col: 0,
60117
- row: row
60118
- });
60119
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60117
+ try {
60118
+ if (!record) return !1;
60119
+ 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 {
60120
+ (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
60121
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60122
+ table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
60123
+ const oldRowCount = table.rowCount;
60124
+ if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60125
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
60126
+ if (table.pagination) {
60127
+ const {
60128
+ perPageCount: perPageCount,
60129
+ currentPage: currentPage
60130
+ } = table.pagination,
60131
+ endIndex = perPageCount * (currentPage || 0) + perPageCount;
60132
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60133
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
60134
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
60135
+ const updateRows = [];
60136
+ for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
60137
+ col: row,
60138
+ row: 0
60139
+ }) : updateRows.push({
60140
+ col: 0,
60141
+ row: row
60142
+ });
60143
+ table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
60144
+ } else {
60145
+ const addRows = [];
60146
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + 1); row++) table.transpose ? addRows.push({
60147
+ col: row,
60148
+ row: 0
60149
+ }) : addRows.push({
60150
+ col: 0,
60151
+ row: row
60152
+ });
60153
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60154
+ }
60120
60155
  }
60156
+ } else {
60157
+ const addRows = [];
60158
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) table.transpose ? addRows.push({
60159
+ col: row,
60160
+ row: 0
60161
+ }) : addRows.push({
60162
+ col: 0,
60163
+ row: row
60164
+ });
60165
+ const updateRows = [],
60166
+ topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
60167
+ bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
60168
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
60169
+ col: row,
60170
+ row: 0
60171
+ }) : updateRows.push({
60172
+ col: 0,
60173
+ row: row
60174
+ });
60175
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
60176
+ col: row,
60177
+ row: 0
60178
+ }) : updateRows.push({
60179
+ col: 0,
60180
+ row: row
60181
+ });
60182
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60121
60183
  }
60122
- } else {
60123
- const addRows = [];
60124
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + 1; row++) table.transpose ? addRows.push({
60125
- col: row,
60126
- row: 0
60127
- }) : addRows.push({
60128
- col: 0,
60129
- row: row
60130
- });
60131
- const updateRows = [],
60132
- topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
60133
- bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
60134
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
60135
- col: row,
60136
- row: 0
60137
- }) : updateRows.push({
60138
- col: 0,
60139
- row: row
60140
- });
60141
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
60142
- col: row,
60143
- row: 0
60144
- }) : updateRows.push({
60145
- col: 0,
60146
- row: row
60147
- });
60148
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60149
60184
  }
60185
+ return !0;
60186
+ } catch (error) {
60187
+ return !1;
60150
60188
  }
60151
60189
  }
60152
60190
  function listTableAddRecords(records, recordIndex, table) {
60153
60191
  var _a, _b, _c, _d;
60154
- 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 {
60155
- void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
60156
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60157
- table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
60158
- const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60159
- if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
60160
- const newRowCount = table.transpose ? table.colCount : table.rowCount;
60161
- if (table.pagination) {
60162
- const {
60163
- perPageCount: perPageCount,
60164
- currentPage: currentPage
60165
- } = table.pagination,
60166
- endIndex = perPageCount * (currentPage || 0) + perPageCount;
60167
- if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60168
- const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
60169
- if (oldRowCount - headerCount === table.pagination.perPageCount) {
60170
- const updateRows = [];
60171
- for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
60172
- col: row,
60173
- row: 0
60174
- }) : updateRows.push({
60175
- col: 0,
60176
- row: row
60177
- });
60178
- table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
60179
- } else {
60180
- const addRows = [];
60181
- for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) table.transpose ? addRows.push({
60182
- col: row,
60183
- row: 0
60184
- }) : addRows.push({
60185
- col: 0,
60186
- row: row
60187
- });
60188
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60192
+ try {
60193
+ if (!records || 0 === records.length) return !1;
60194
+ 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 {
60195
+ void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
60196
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60197
+ table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
60198
+ const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60199
+ if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60200
+ const newRowCount = table.transpose ? table.colCount : table.rowCount;
60201
+ if (table.pagination) {
60202
+ const {
60203
+ perPageCount: perPageCount,
60204
+ currentPage: currentPage
60205
+ } = table.pagination,
60206
+ endIndex = perPageCount * (currentPage || 0) + perPageCount;
60207
+ if (recordIndex < endIndex) if (recordIndex < endIndex - perPageCount) table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60208
+ const rowNum = recordIndex - (endIndex - perPageCount) + headerCount;
60209
+ if (oldRowCount - headerCount === table.pagination.perPageCount) {
60210
+ const updateRows = [];
60211
+ for (let row = rowNum; row < newRowCount; row++) table.transpose ? updateRows.push({
60212
+ col: row,
60213
+ row: 0
60214
+ }) : updateRows.push({
60215
+ col: 0,
60216
+ row: row
60217
+ });
60218
+ table.transpose ? table.scenegraph.updateCol([], [], updateRows) : table.scenegraph.updateRow([], [], updateRows);
60219
+ } else {
60220
+ const addRows = [];
60221
+ for (let row = rowNum; row < Math.min(newRowCount, rowNum + (Array.isArray(records) ? records.length : 1)); row++) table.transpose ? addRows.push({
60222
+ col: row,
60223
+ row: 0
60224
+ }) : addRows.push({
60225
+ col: 0,
60226
+ row: row
60227
+ });
60228
+ table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60229
+ }
60189
60230
  }
60231
+ } else {
60232
+ const addRows = [];
60233
+ for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) table.transpose ? addRows.push({
60234
+ col: row,
60235
+ row: 0
60236
+ }) : addRows.push({
60237
+ col: 0,
60238
+ row: row
60239
+ });
60240
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
60241
+ bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount,
60242
+ updateRows = [];
60243
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
60244
+ col: row,
60245
+ row: 0
60246
+ }) : updateRows.push({
60247
+ col: 0,
60248
+ row: row
60249
+ });
60250
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
60251
+ col: row,
60252
+ row: 0
60253
+ }) : updateRows.push({
60254
+ col: 0,
60255
+ row: row
60256
+ });
60257
+ table.transpose ? table.scenegraph.updateCol([], addRows, updateRows) : table.scenegraph.updateRow([], addRows, updateRows);
60190
60258
  }
60191
- } else {
60192
- const addRows = [];
60193
- for (let row = recordIndex + headerCount; row < recordIndex + headerCount + (Array.isArray(records) ? records.length : 1); row++) table.transpose ? addRows.push({
60194
- col: row,
60195
- row: 0
60196
- }) : addRows.push({
60197
- col: 0,
60198
- row: row
60199
- });
60200
- const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
60201
- bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount,
60202
- updateRows = [];
60203
- for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
60204
- col: row,
60205
- row: 0
60206
- }) : updateRows.push({
60207
- col: 0,
60208
- row: row
60209
- });
60210
- for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) table.transpose ? updateRows.push({
60211
- col: row,
60212
- row: 0
60213
- }) : updateRows.push({
60214
- col: 0,
60215
- row: row
60216
- });
60217
- table.transpose ? table.scenegraph.updateCol([], addRows, updateRows) : table.scenegraph.updateRow([], addRows, updateRows);
60218
60259
  }
60260
+ return !0;
60261
+ } catch (error) {
60262
+ return !1;
60219
60263
  }
60220
60264
  }
60221
60265
  function listTableDeleteRecords(recordIndexs, table) {
@@ -60625,21 +60669,33 @@
60625
60669
  };
60626
60670
  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();
60627
60671
  }
60628
- addColumn(column, colIndex, isMaintainArrayData = !0) {
60672
+ addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
60629
60673
  const columns = this.options.columns;
60630
- if (void 0 === colIndex) columns.push(column);else {
60631
- 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);
60632
- columns.splice(colIndex, 0, column);
60633
- }
60634
- if (isMaintainArrayData) for (let i = 0; i < this.records.length; i++) {
60635
- const record = this.records[i];
60636
- Array.isArray(record) && record.splice(colIndex, 0, void 0);
60674
+ if (void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns), isMaintainArrayData) {
60675
+ for (let i = 0; i < columns.length; i++) columns[i].field = i;
60676
+ for (let i = 0; i < this.records.length; i++) {
60677
+ const record = this.records[i];
60678
+ Array.isArray(record) && record.splice(colIndex, 0, ...Array(toAddColumns.length).fill(void 0));
60679
+ }
60637
60680
  }
60638
- this.updateColumns(columns);
60681
+ this.updateColumns(columns), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
60682
+ columnIndex: colIndex,
60683
+ columnCount: toAddColumns.length,
60684
+ columns: columns
60685
+ });
60639
60686
  }
60640
- deleteColumn(colIndex) {
60687
+ deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
60641
60688
  const columns = this.options.columns;
60642
- columns.splice(colIndex, 1), this.updateColumns(columns);
60689
+ deleteColIndexs.sort((a, b) => b - a);
60690
+ for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
60691
+ const record = this.records[j];
60692
+ Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
60693
+ }
60694
+ if (isMaintainArrayData) for (let i = 0; i < columns.length; i++) columns[i].field = i;
60695
+ this.updateColumns(columns), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
60696
+ deleteColIndexs: deleteColIndexs,
60697
+ columns: columns
60698
+ });
60643
60699
  }
60644
60700
  get columns() {
60645
60701
  return this.internalProps.layoutMap.columnTree.getCopiedTree();
@@ -61041,6 +61097,9 @@
61041
61097
  updateFilterRules(filterRules) {
61042
61098
  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();
61043
61099
  }
61100
+ getFilteredRecords() {
61101
+ return this.dataSource.records;
61102
+ }
61044
61103
  getCheckboxState(field) {
61045
61104
  if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount && this.stateManager.initLeftRecordsCheckState(this.records), isValid$3(field)) {
61046
61105
  let stateArr = Array.from(this.stateManager.checkedState.keys()).sort((a, b) => {
@@ -61180,18 +61239,39 @@
61180
61239
  }
61181
61240
  addRecord(record, recordIndex) {
61182
61241
  var _a;
61183
- listTableAddRecord(record, recordIndex, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61242
+ const success = listTableAddRecord(record, recordIndex, this);
61243
+ null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
61244
+ records: [record],
61245
+ recordIndex: recordIndex,
61246
+ recordCount: 1
61247
+ });
61184
61248
  }
61185
61249
  addRecords(records, recordIndex) {
61186
61250
  var _a;
61187
- listTableAddRecords(records, recordIndex, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61251
+ const success = listTableAddRecords(records, recordIndex, this);
61252
+ null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
61253
+ records: records,
61254
+ recordIndex: recordIndex,
61255
+ recordCount: records.length
61256
+ });
61188
61257
  }
61189
61258
  deleteRecords(recordIndexs) {
61190
61259
  var _a;
61191
61260
  listTableDeleteRecords(recordIndexs, this), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
61261
+ const rowIndexs = [];
61262
+ for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
61263
+ this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
61264
+ recordIndexs: recordIndexs,
61265
+ rowIndexs: rowIndexs,
61266
+ deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
61267
+ });
61192
61268
  }
61193
61269
  updateRecords(records, recordIndexs) {
61194
- listTableUpdateRecords(records, recordIndexs, this);
61270
+ listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
61271
+ records: records,
61272
+ recordIndexs: recordIndexs,
61273
+ updateCount: records.length
61274
+ });
61195
61275
  }
61196
61276
  _hasCustomRenderOrLayout() {
61197
61277
  var _a, _b, _c, _d;
@@ -65405,7 +65485,7 @@
65405
65485
  }
65406
65486
 
65407
65487
  function createProgressBarCell(progressBarDefine, style, width, value, dataValue, col, row, padding, table, range) {
65408
- var _a, _b, _c, _d, _e;
65488
+ var _a, _b, _c, _d, _e, _f;
65409
65489
  if (progressBarDefine.dependField) {
65410
65490
  const dependField = getOrApply(progressBarDefine.dependField, {
65411
65491
  col: col,
@@ -65442,7 +65522,14 @@
65442
65522
  cellHeaderPaths: void 0
65443
65523
  })) && void 0 !== _e ? _e : min + 100;
65444
65524
  let height = 0;
65445
- height = range ? table.getRowsHeight(range.start.row, range.end.row) : table.getRowHeight(row);
65525
+ if (height = range ? table.getRowsHeight(range.start.row, range.end.row) : table.getRowHeight(row), table.pluginManager) {
65526
+ if (table.pluginManager.getPluginByName("Master Detail Plugin")) {
65527
+ const bodyRowIndex = row - table.columnHeaderLevelCount,
65528
+ internalProps = table.internalProps,
65529
+ originalHeight = null === (_f = null == internalProps ? void 0 : internalProps.originalRowHeights) || void 0 === _f ? void 0 : _f.get(bodyRowIndex);
65530
+ void 0 !== originalHeight && originalHeight > 0 && (height = originalHeight);
65531
+ }
65532
+ }
65446
65533
  let contentWidth = width,
65447
65534
  contentHeight = height,
65448
65535
  _contentOffset = 0;