@visactor/vtable-sheet 1.26.3-alpha.0 → 1.26.4-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43257,6 +43257,20 @@
43257
43257
  var _a, _b, _c;
43258
43258
  return null !== (_c = null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0;
43259
43259
  }
43260
+ refreshRecords(records = [], dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
43261
+ var _a;
43262
+ this.clearCache(), this.beforeChangedRecordsMap.clear(), this.groupAggregator = null, this.addRecordRule = (null == dataConfig ? void 0 : dataConfig.addRecordRule) || "Object", this.dataConfig = dataConfig, this.columns = columns, this._isGrouped = isArray$8(null == dataConfig ? void 0 : dataConfig.groupByRules), this.rowHierarchyType = rowHierarchyType, this.dataSourceObj = {
43263
+ get: index => records[index],
43264
+ length: records.length,
43265
+ records: records
43266
+ }, this._source = this.processRecords(records), this.sourceLength = (null === (_a = this.source) || void 0 === _a ? void 0 : _a.length) || 0, this.sortedIndexMap.clear(), this._currentPagerIndexedData = [], this.userPagination = pagination, this.pagination = pagination || {
43267
+ totalCount: this.sourceLength,
43268
+ perPageCount: this.sourceLength,
43269
+ currentPage: 0
43270
+ }, this.hierarchyExpandLevel = hierarchyExpandLevel >= 1 ? hierarchyExpandLevel : 0, this.currentIndexedData = Array.from({
43271
+ length: this.sourceLength
43272
+ }, (_, i) => i), this.userPagination || (this.pagination.perPageCount = this.sourceLength, this.pagination.totalCount = this.sourceLength), "tree" === rowHierarchyType && this.initTreeHierarchyState(), this.updatePagerData();
43273
+ }
43260
43274
  updateGroup() {
43261
43275
  var _a, _b, _c;
43262
43276
  this.clearCache();
@@ -43572,13 +43586,20 @@
43572
43586
  return parse$3(font);
43573
43587
  }
43574
43588
 
43575
- function getQuadProps(paddingOrigin) {
43589
+ function normalizeQuadArray(values) {
43590
+ return 0 === values.length ? [0, 0, 0, 0] : 1 === values.length ? [values[0], values[0], values[0], values[0]] : 2 === values.length ? [values[0], values[1], values[0], values[1]] : 3 === values.length ? [values[0], values[1], values[2], values[1]] : [values[0], values[1], values[2], values[3]];
43591
+ }
43592
+ function parseStringQuad(padding) {
43593
+ const tokens = padding.trim().split(/\s+/),
43594
+ values = tokens.map(token => Number.parseFloat(token)).filter(value => Number.isFinite(value));
43595
+ return values.length === tokens.length && values.length > 0 ? normalizeQuadArray(values) : [padding, padding, padding, padding];
43596
+ }
43597
+ function normalizePaddingObject(paddingOrigin) {
43576
43598
  var _a, _b, _c, _d;
43577
- if (isNumber$2(paddingOrigin) || isString$2(paddingOrigin) || isArray$8(paddingOrigin)) {
43578
- let padding = parsePadding(paddingOrigin);
43579
- return "number" == typeof padding || "string" == typeof padding ? padding = [padding, padding, padding, padding] : Array.isArray(padding) && (padding = padding.slice(0)), padding;
43580
- }
43581
- return paddingOrigin && (isFinite(paddingOrigin.bottom) || isFinite(paddingOrigin.left) || isFinite(paddingOrigin.right) || isFinite(paddingOrigin.top)) ? [null !== (_a = paddingOrigin.top) && void 0 !== _a ? _a : 0, null !== (_b = paddingOrigin.right) && void 0 !== _b ? _b : 0, null !== (_c = paddingOrigin.bottom) && void 0 !== _c ? _c : 0, null !== (_d = paddingOrigin.left) && void 0 !== _d ? _d : 0] : [0, 0, 0, 0];
43599
+ return Number.isFinite(paddingOrigin.bottom) || Number.isFinite(paddingOrigin.left) || Number.isFinite(paddingOrigin.right) || Number.isFinite(paddingOrigin.top) ? [null !== (_a = paddingOrigin.top) && void 0 !== _a ? _a : 0, null !== (_b = paddingOrigin.right) && void 0 !== _b ? _b : 0, null !== (_c = paddingOrigin.bottom) && void 0 !== _c ? _c : 0, null !== (_d = paddingOrigin.left) && void 0 !== _d ? _d : 0] : [0, 0, 0, 0];
43600
+ }
43601
+ function getQuadProps(paddingOrigin) {
43602
+ return Array.isArray(paddingOrigin) ? normalizeQuadArray(paddingOrigin.slice(0, 4)) : "number" == typeof paddingOrigin && Number.isFinite(paddingOrigin) ? [paddingOrigin, paddingOrigin, paddingOrigin, paddingOrigin] : "string" == typeof paddingOrigin ? parseStringQuad(paddingOrigin) : paddingOrigin && "object" == typeof paddingOrigin ? normalizePaddingObject(paddingOrigin) : [0, 0, 0, 0];
43582
43603
  }
43583
43604
 
43584
43605
  const TYPE_PAREN = 0,
@@ -43808,14 +43829,17 @@
43808
43829
  table.dataSource.hierarchyExpandLevel && table.refreshRowColCount(), table.render();
43809
43830
  })];
43810
43831
  }
43811
- function _setRecords(table, records = []) {
43832
+ function getListTableRowHierarchyType(table) {
43833
+ var _a, _b;
43812
43834
  const tableWithPlugins = table;
43835
+ let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
43836
+ return isArray$8(null === (_a = table.internalProps.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) && (rowHierarchyType = "tree"), (null === (_b = tableWithPlugins.pluginManager) || void 0 === _b ? void 0 : _b.getPluginByName("Master Detail Plugin")) && (rowHierarchyType = "grid"), rowHierarchyType;
43837
+ }
43838
+ function _setRecords(table, records = []) {
43813
43839
  _dealWithUpdateDataSource(table, () => {
43814
- var _a;
43815
43840
  table.internalProps.records = records;
43816
- let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
43817
- isArray$8(null === (_a = table.internalProps.dataConfig) || void 0 === _a ? void 0 : _a.groupByRules) && (rowHierarchyType = "tree"), tableWithPlugins.pluginManager.getPluginByName("Master Detail Plugin") && (rowHierarchyType = "grid");
43818
- const newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table));
43841
+ const rowHierarchyType = getListTableRowHierarchyType(table),
43842
+ newDataSource = table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table));
43819
43843
  table.addReleaseObj(newDataSource);
43820
43844
  });
43821
43845
  }
@@ -45191,7 +45215,7 @@
45191
45215
 
45192
45216
  function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range) {
45193
45217
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45194
- let contentWidth,
45218
+ let contentWidth = 0,
45195
45219
  leftIconWidth = 0,
45196
45220
  rightIconWidth = 0,
45197
45221
  absoluteRightIconWidth = 0;
@@ -45271,8 +45295,8 @@
45271
45295
  }), contentRightIcons.forEach(icon => {
45272
45296
  const iconMark = dealWithIcon(icon, void 0, cellGroup.col, cellGroup.row, range, table, dealWithIconComputeVar);
45273
45297
  iconMark.role = "icon-content-right", iconMark.name = icon.name, cellContent.addRightOccupyingIcon(iconMark);
45274
- }), cellContent.addContent(textMark), cellGroup.appendChild(cellContent), cellContent.layout(), contentWidth = cellContent.AABBBounds.width(), cellContent.AABBBounds.height();
45275
- } else cellGroup.firstChild ? cellGroup.insertBefore(textMark, cellGroup.firstChild) : cellGroup.appendChild(textMark), contentWidth = textMark.AABBBounds.width(), textMark.AABBBounds.height();
45298
+ }), cellContent.addContent(textMark), cellGroup.appendChild(cellContent), cellContent.layout(), autoColWidth && (contentWidth = cellContent.AABBBounds.width());
45299
+ } else cellGroup.firstChild ? cellGroup.insertBefore(textMark, cellGroup.firstChild) : cellGroup.appendChild(textMark), autoColWidth && (contentWidth = textMark.AABBBounds.width());
45276
45300
  } else if (isValid$2(textStr)) {
45277
45301
  const {
45278
45302
  text: text,
@@ -45296,7 +45320,7 @@
45296
45320
  keepCenterInLine: !0
45297
45321
  },
45298
45322
  wrapText = new Text$1(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
45299
- wrapText.name = "text", wrapText.textBaseline = textBaseline, cellGroup.appendChild(wrapText), contentWidth = wrapText.AABBBounds.width(), wrapText.AABBBounds.height();
45323
+ wrapText.name = "text", wrapText.textBaseline = textBaseline, cellGroup.appendChild(wrapText), autoColWidth && (contentWidth = wrapText.AABBBounds.width());
45300
45324
  }
45301
45325
  const width = autoColWidth ? leftIconWidth + contentWidth + rightIconWidth : cellWidth - (padding[1] + padding[3]),
45302
45326
  height = cellHeight - (padding[0] + padding[2]);
@@ -45754,7 +45778,7 @@
45754
45778
  }
45755
45779
  }
45756
45780
 
45757
- function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
45781
+ function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, headerStyle) {
45758
45782
  var _a, _b;
45759
45783
  let cellGroup,
45760
45784
  isAsync = !1;
@@ -45789,7 +45813,7 @@
45789
45813
  customElementsGroup: customElementsGroup,
45790
45814
  renderDefault: renderDefault
45791
45815
  } = _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult);
45792
- cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
45816
+ cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
45793
45817
  const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);
45794
45818
  if (axisConfig) {
45795
45819
  const axis = new (Factory.getComponent("axis"))(axisConfig, cellGroup.attribute.width, cellGroup.attribute.height, null !== (_a = axisConfig.__vtableBodyChartCellPadding) && void 0 !== _a ? _a : padding, table);
@@ -45812,20 +45836,20 @@
45812
45836
  } = _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult),
45813
45837
  style = table._getCellStyle(col, row),
45814
45838
  dataValue = table.getCellOriginValue(col, row);
45815
- cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
45839
+ cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
45816
45840
  const progressBarGroup = Factory.getFunction("createProgressBarCell")(define, style, colWidth, value, dataValue, col, row, padding, table, range);
45817
45841
  cellGroup.firstChild ? cellGroup.insertBefore(progressBarGroup, cellGroup.firstChild) : cellGroup.appendChild(progressBarGroup);
45818
45842
  } else if ("sparkline" === type) {
45819
45843
  cellGroup = Factory.getFunction("createSparkLineCellGroup")(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table, cellTheme, isAsync);
45820
45844
  } else if ("checkbox" === type) {
45821
45845
  if ("isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row)) {
45822
- cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync);
45846
+ cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync, headerStyle);
45823
45847
  } else {
45824
45848
  cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, !1);
45825
45849
  }
45826
45850
  } else if ("radio" === type) {
45827
45851
  if ("isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row)) {
45828
- cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync);
45852
+ cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync, headerStyle);
45829
45853
  } else {
45830
45854
  cellGroup = Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define, range);
45831
45855
  }
@@ -51037,6 +51061,7 @@
51037
51061
  isMerge,
51038
51062
  customStyle,
51039
51063
  customResult,
51064
+ rawRecord,
51040
51065
  cellLocation = table.getCellLocation(col, row),
51041
51066
  value = table.getCellValue(col, row),
51042
51067
  cellWidth = colWidth,
@@ -51066,17 +51091,17 @@
51066
51091
  const isAggregation = "isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row),
51067
51092
  isSeriesNumber = table.internalProps.layoutMap.isSeriesNumber(col, row);
51068
51093
  let mayHaveIcon = "body" !== cellLocation || ((null == define ? void 0 : define.dragOrder) || !!(null == define ? void 0 : define.icon) || !!(null == define ? void 0 : define.tree)) && !(isAggregation && isSeriesNumber);
51069
- if (!range && (table.internalProps.enableTreeNodeMerge || "body" !== cellLocation || (null == define ? void 0 : define.mergeCell)) && (range = table.getCellRange(col, row), isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row, isMerge)) {
51094
+ if (!range && (table.internalProps.enableTreeNodeMerge || "body" !== cellLocation || (null == define ? void 0 : define.mergeCell)) && (table.internalProps.enableTreeNodeMerge && "body" === cellLocation && !(null == define ? void 0 : define.mergeCell) ? (rawRecord = table.getCellRawRecord(col, row), (null == rawRecord ? void 0 : rawRecord.vtableMerge) && (range = table.getCellRange(col, row), isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row)) : (range = table.getCellRange(col, row), isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row), isMerge)) {
51070
51095
  const mergeSize = dealMerge(range, mergeMap, table, rowStart > range.start.row);
51071
51096
  cellWidth = mergeSize.cellWidth, cellHeight = mergeSize.cellHeight;
51072
51097
  }
51073
51098
  let isVtableMerge = !1;
51074
51099
  if (table.internalProps.enableTreeNodeMerge && isMerge) {
51075
- const rawRecord = table.getCellRawRecord(range.start.col, range.start.row),
51076
- {
51077
- vtableMergeName: vtableMergeName,
51078
- vtableMerge: vtableMerge
51079
- } = null != rawRecord ? rawRecord : {};
51100
+ rawRecord = null != rawRecord ? rawRecord : table.getCellRawRecord(range.start.col, range.start.row);
51101
+ const {
51102
+ vtableMergeName: vtableMergeName,
51103
+ vtableMerge: vtableMerge
51104
+ } = null != rawRecord ? rawRecord : {};
51080
51105
  isVtableMerge = vtableMerge, vtableMerge && (mayHaveIcon = !0, table.internalProps.groupTitleCustomLayout && (customResult = dealWithCustom(table.internalProps.groupTitleCustomLayout, void 0, range.start.col, range.start.row, table.getColsWidth(range.start.col, range.end.col), table.getRowsHeight(range.start.row, range.end.row), !1, table.isAutoRowHeight(row), [0, 0, 0, 0], range, table)), table.internalProps.groupTitleFieldFormat ? value = table.internalProps.groupTitleFieldFormat(rawRecord, col, row, table) : void 0 !== vtableMergeName && (value = vtableMergeName));
51081
51106
  }
51082
51107
  const type = isVtableMerge || isCustomMerge ? "text" : table.getCellType(col, row);
@@ -51106,7 +51131,7 @@
51106
51131
  const cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
51107
51132
  cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
51108
51133
  cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), cellTheme.group.width = colWidth, cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight, cellTheme._vtable.padding && (padding = cellTheme._vtable.padding), cellTheme.text.textAlign && (textAlign = cellTheme.text.textAlign), cellTheme.text.textBaseline && (textBaseline = cellTheme.text.textBaseline), "body" === cellLocation || cellTheme.group.fill || (cellTheme.group.fill = "#fff");
51109
- const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
51134
+ const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
51110
51135
  if (columnGroup.updateColumnRowNumber(row), isMerge) {
51111
51136
  const rangeHeight = table.getRowHeight(row),
51112
51137
  {
@@ -51148,7 +51173,7 @@
51148
51173
  } = createCellArgs,
51149
51174
  cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
51150
51175
  cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
51151
- cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), cellTheme.group.width = colWidth, cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight, cellTheme._vtable.padding && (padding = cellTheme._vtable.padding), cellTheme.text.textAlign && (textAlign = cellTheme.text.textAlign), cellTheme.text.textBaseline && (textBaseline = cellTheme.text.textBaseline), "body" === cellLocation || cellTheme.group.fill || (cellTheme.group.fill = "#fff"), createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
51176
+ cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), cellTheme.group.width = colWidth, cellTheme.group.height = Array.isArray(defaultRowHeight) ? defaultRowHeight[row] : defaultRowHeight, cellTheme._vtable.padding && (padding = cellTheme._vtable.padding), cellTheme.text.textAlign && (textAlign = cellTheme.text.textAlign), cellTheme.text.textBaseline && (textBaseline = cellTheme.text.textBaseline), "body" === cellLocation || cellTheme.group.fill || (cellTheme.group.fill = "#fff"), createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
51152
51177
  }
51153
51178
  function dealMerge(range, mergeMap, table, forceUpdate) {
51154
51179
  let cellWidth = 0,
@@ -53044,7 +53069,8 @@
53044
53069
  for (let col = table.colCount - currentRightFrozenCol - 1; col >= table.colCount - distRightFrozenCol; col--) {
53045
53070
  insertBefore(rightFrozenGroup, scene.getColGroup(col), rightFrozenGroup.firstChild);
53046
53071
  insertBefore(rightTopCornerGroup, scene.getColGroup(col, !0), rightTopCornerGroup.firstChild);
53047
- insertBefore(rightBottomCornerGroup, scene.getColGroupInBottom(col), rightBottomCornerGroup.firstChild);
53072
+ const bottomColGroup = scene.getColGroupInBottom(col);
53073
+ bottomColGroup && insertBefore(rightBottomCornerGroup, bottomColGroup, rightBottomCornerGroup.firstChild);
53048
53074
  }
53049
53075
  let x = 0;
53050
53076
  rightFrozenGroup.forEachChildren(columnGroup => {
@@ -53061,7 +53087,10 @@
53061
53087
  const headerColGroup = scene.getColGroupInRightTopCorner(col);
53062
53088
  headerColGroup.setAttribute("x", colHeaderGroup.lastChild.attribute.x + table.getColWidth(colHeaderGroup.lastChild.col)), colHeaderGroup.appendChild(headerColGroup);
53063
53089
  const bottomColGroup = scene.getColGroupInRightBottomCorner(col);
53064
- bottomColGroup.setAttribute("x", bottomFrozenGroup.lastChild.attribute.x + table.getColWidth(bottomFrozenGroup.lastChild.col)), bottomFrozenGroup.appendChild(bottomColGroup);
53090
+ if (bottomColGroup) {
53091
+ const lastBottomColGroup = bottomFrozenGroup.lastChild;
53092
+ bottomColGroup.setAttribute("x", lastBottomColGroup ? lastBottomColGroup.attribute.x + table.getColWidth(lastBottomColGroup.col) : 0), bottomFrozenGroup.appendChild(bottomColGroup);
53093
+ }
53065
53094
  }
53066
53095
  let x = 0;
53067
53096
  rightFrozenGroup.forEachChildren(columnGroup => {
@@ -54594,16 +54623,28 @@
54594
54623
  updateContainerChildrenX(this.rightFrozenGroup, rightStartX), updateContainerChildrenX(this.rightTopCornerGroup, rightStartX), updateContainerChildrenX(this.rightBottomCornerGroup, rightStartX), this.updateNextFrame();
54595
54624
  }
54596
54625
  updateContainerAttrHeightAndY() {
54597
- var _a, _b, _c;
54598
- for (let i = 0; i < this.cornerHeaderGroup.children.length; i++) updateContainerChildrenY(this.cornerHeaderGroup.children[i], 0);
54599
- for (let i = 0; i < this.colHeaderGroup.children.length; i++) updateContainerChildrenY(this.colHeaderGroup.children[i], 0);
54600
- for (let i = 0; i < this.rightTopCornerGroup.children.length; i++) updateContainerChildrenY(this.rightTopCornerGroup.children[i], 0);
54601
- for (let i = 0; i < this.rowHeaderGroup.children.length; i++) this.rowHeaderGroup.children[i].firstChild && updateContainerChildrenY(this.rowHeaderGroup.children[i], this.rowHeaderGroup.children[i].firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, this.rowHeaderGroup.children[i].firstChild.row - 1) : 0);
54602
- for (let i = 0; i < this.bodyGroup.children.length; i++) this.bodyGroup.children[i].firstChild && updateContainerChildrenY(this.bodyGroup.children[i], this.bodyGroup.children[i].firstChild.row > 0 ? this.table.getRowsHeight(null !== (_b = this.table.frozenRowCount) && void 0 !== _b ? _b : 0, this.bodyGroup.children[i].firstChild.row - 1) : 0);
54603
- for (let i = 0; i < this.rightFrozenGroup.children.length; i++) this.rightFrozenGroup.children[i].firstChild && updateContainerChildrenY(this.rightFrozenGroup.children[i], this.rightFrozenGroup.children[i].firstChild.row > 0 ? this.table.getRowsHeight(null !== (_c = this.table.frozenRowCount) && void 0 !== _c ? _c : 0, this.rightFrozenGroup.children[i].firstChild.row - 1) : 0);
54604
- for (let i = 0; i < this.leftBottomCornerGroup.children.length; i++) updateContainerChildrenY(this.leftBottomCornerGroup.children[i], 0);
54605
- for (let i = 0; i < this.bottomFrozenGroup.children.length; i++) updateContainerChildrenY(this.bottomFrozenGroup.children[i], 0);
54606
- for (let i = 0; i < this.rightBottomCornerGroup.children.length; i++) updateContainerChildrenY(this.rightBottomCornerGroup.children[i], 0);
54626
+ this.cornerHeaderGroup.forEachChildrenSkipChild(column => {
54627
+ updateContainerChildrenY(column, 0);
54628
+ }), this.colHeaderGroup.forEachChildrenSkipChild(column => {
54629
+ updateContainerChildrenY(column, 0);
54630
+ }), this.rightTopCornerGroup.forEachChildrenSkipChild(column => {
54631
+ updateContainerChildrenY(column, 0);
54632
+ }), this.rowHeaderGroup.forEachChildrenSkipChild(column => {
54633
+ var _a;
54634
+ column.firstChild && updateContainerChildrenY(column, column.firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, column.firstChild.row - 1) : 0);
54635
+ }), this.bodyGroup.forEachChildrenSkipChild(column => {
54636
+ var _a;
54637
+ column.firstChild && updateContainerChildrenY(column, column.firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, column.firstChild.row - 1) : 0);
54638
+ }), this.rightFrozenGroup.forEachChildrenSkipChild(column => {
54639
+ var _a;
54640
+ column.firstChild && updateContainerChildrenY(column, column.firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, column.firstChild.row - 1) : 0);
54641
+ }), this.leftBottomCornerGroup.forEachChildrenSkipChild(column => {
54642
+ updateContainerChildrenY(column, 0);
54643
+ }), this.bottomFrozenGroup.forEachChildrenSkipChild(column => {
54644
+ updateContainerChildrenY(column, 0);
54645
+ }), this.rightBottomCornerGroup.forEachChildrenSkipChild(column => {
54646
+ updateContainerChildrenY(column, 0);
54647
+ });
54607
54648
  }
54608
54649
  updateContainer(updateConfig = {
54609
54650
  async: !1,
@@ -62490,7 +62531,7 @@
62490
62531
  const internalProps = this.internalProps;
62491
62532
  if ("node" === Env$1.mode || options.canvas || updateRootElementPadding(internalProps.element, this.padding), this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal", internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = null === (_e = null != enableCheckboxCascade ? enableCheckboxCascade : null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox) || void 0 === _e || _e, internalProps.enableHeaderCheckboxCascade = enableCheckboxCascade || null == enableHeaderCheckboxCascade || enableHeaderCheckboxCascade, internalProps.columnResizeMode = null !== (_f = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _f ? _f : columnResizeMode, internalProps.canResizeColumn = null == resize ? void 0 : resize.canResizeColumn, internalProps.rowResizeMode = null !== (_g = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _g ? _g : rowResizeMode, internalProps.dragHeaderMode = null !== (_j = null !== (_h = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _h ? _h : dragHeaderMode) && void 0 !== _j ? _j : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps.cellTextOverflows = {}, internalProps.groupBy = null !== (_k = null == groupConfig ? void 0 : groupConfig.groupBy) && void 0 !== _k ? _k : groupBy, internalProps.groupTitleCheckbox = null == groupConfig ? void 0 : groupConfig.titleCheckbox, internalProps.groupTitleFieldFormat = null !== (_l = null == groupConfig ? void 0 : groupConfig.titleFieldFormat) && void 0 !== _l ? _l : groupTitleFieldFormat, internalProps.groupTitleCustomLayout = null !== (_m = null == groupConfig ? void 0 : groupConfig.titleCustomLayout) && void 0 !== _m ? _m : groupTitleCustomLayout, internalProps.enableTreeStickCell = null !== (_o = null == groupConfig ? void 0 : groupConfig.enableTreeStickCell) && void 0 !== _o ? _o : enableTreeStickCell, (null == updateConfig ? void 0 : updateConfig.clearColWidthCache) && (internalProps._widthResizedColMap.clear(), this.colWidthsMap = new NumberMap(), this.colContentWidthsMap = new NumberMap(), this.colWidthsLimit = {}), (null == updateConfig ? void 0 : updateConfig.clearRowHeightCache) && (internalProps._heightResizedRowMap.clear(), internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map(), internalProps._colRangeWidthsMap = new Map()), internalProps.stick.changedCells.clear(), internalProps.theme = themes.of(null !== (_p = options.theme) && void 0 !== _p ? _p : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_q = options.allowFrozenColCount) && void 0 !== _q ? _q : 0, internalProps.limitMaxAutoWidth = null !== (_r = options.limitMaxAutoWidth) && void 0 !== _r ? _r : 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, null === (_s = internalProps.legends) || void 0 === _s || _s.forEach(legend => {
62492
62533
  null == legend || legend.release();
62493
- }), null === (_t = internalProps.title) || void 0 === _t || _t.release(), internalProps.title = null, null === (_u = internalProps.emptyTip) || void 0 === _u || _u.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), clearChartRenderQueue(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
62534
+ }), null === (_t = internalProps.title) || void 0 === _t || _t.release(), internalProps.title = null, null === (_u = internalProps.emptyTip) || void 0 === _u || _u.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), clearChartRenderQueue(), (null == updateConfig ? void 0 : updateConfig.skipClearCells) || this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
62494
62535
  internalProps.legends = [];
62495
62536
  const createLegend = Factory.getFunction("createLegend");
62496
62537
  if (Array.isArray(options.legends)) {
@@ -63644,16 +63685,17 @@
63644
63685
  }
63645
63686
  scrollToRow(row, animationOption) {
63646
63687
  var _a;
63647
- const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
63688
+ const targetRow = Math.min(Math.max(row, 0), this.rowCount - 1),
63689
+ targetRowInt = Math.floor(targetRow);
63648
63690
  if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
63649
- row: targetRow
63650
- }), void this._scheduleScrollToRowCorrect(targetRow);
63691
+ row: targetRowInt
63692
+ }), void this._scheduleScrollToRowCorrect(targetRowInt);
63651
63693
  const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
63652
63694
  this.animationManager.scrollTo({
63653
63695
  row: targetRow
63654
- }, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
63655
- this.scrollToRow(targetRow, !1);
63656
- }, duration);
63696
+ }, animationOption), targetRowInt === targetRow && (this._scrollToRowCorrectTimer = setTimeout(() => {
63697
+ this.scrollToRow(targetRowInt, !1);
63698
+ }, duration));
63657
63699
  }
63658
63700
  scrollToCol(col, animationOption) {
63659
63701
  animationOption ? this.animationManager.scrollTo({
@@ -66551,14 +66593,19 @@
66551
66593
  clearRowHeightCache: !0
66552
66594
  }) {
66553
66595
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
66554
- const internalProps = this.internalProps;
66555
- if (this.pluginManager.removeOrAddPlugins(options.plugins), super.updateOption(options, updateConfig), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule) : {
66596
+ const internalProps = this.internalProps,
66597
+ prevSortState = internalProps.sortState,
66598
+ hasActiveSortState = (Array.isArray(options.sortState) ? options.sortState : options.sortState ? [options.sortState] : []).some(item => (null == item ? void 0 : item.field) && (null == item ? void 0 : item.order) && "normal" !== item.order),
66599
+ shouldSkipInitialClearCells = Boolean(options.records) || !!options.dataSource && this.dataSource !== options.dataSource;
66600
+ if (this.pluginManager.removeOrAddPlugins(options.plugins), super.updateOption(options, Object.assign(Object.assign({}, updateConfig), {
66601
+ skipClearCells: shouldSkipInitialClearCells
66602
+ })), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule) : {
66556
66603
  addRecordRule: options.addRecordRule
66557
66604
  }, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$2(this.internalProps.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.internalProps.rowHeightConfig = options.rowHeightConfig, internalProps.releaseList) for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
66558
66605
  const releaseObj = internalProps.releaseList[i];
66559
66606
  releaseObj instanceof DataSource ? releaseObj.updateColumns(this.internalProps.columns) : (null === (_g = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _g || _g.call(releaseObj), internalProps.releaseList.splice(i, 1));
66560
66607
  }
66561
- if (options.dataSource && this.dataSource !== options.dataSource ? this.dataSource = options.dataSource : options.records ? this.setRecords(options.records, {
66608
+ if (options.dataSource && this.dataSource !== options.dataSource ? this.dataSource = options.dataSource : options.records && options.records === internalProps.records && options.sortState === prevSortState && !hasActiveSortState && this.dataSource instanceof CachedDataSource ? this._refreshCurrentRecordsForOptionUpdate(options.records) : options.records ? this.setRecords(options.records, {
66562
66609
  sortState: options.sortState
66563
66610
  }) : (this.refreshRowColCount(), this._resetFrozenColCount(), this.scenegraph.createSceneGraph(), this.render()), options.title) {
66564
66611
  const Title = Factory.getComponent("title");
@@ -66574,6 +66621,22 @@
66574
66621
  setTimeout(resolve, 0);
66575
66622
  });
66576
66623
  }
66624
+ _refreshCurrentRecordsForOptionUpdate(records) {
66625
+ var _a;
66626
+ const dataSource = this.dataSource;
66627
+ this.stateManager.endResizeIfResizing(), clearChartRenderQueue();
66628
+ const oldHoverState = {
66629
+ col: this.stateManager.hover.cellPos.col,
66630
+ row: this.stateManager.hover.cellPos.row
66631
+ };
66632
+ this.scenegraph.clearCells(), this.internalProps.records = records, dataSource.refreshRecords(records, this.internalProps.dataConfig, this.pagination, this.internalProps.columns, getListTableRowHierarchyType(this), getHierarchyExpandLevel(this)), this.refreshRowColCount(), this.stateManager.initCheckedState(records), this.clearCellStyleCache(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this._updateSize();
66633
+ (null !== (_a = this.options.componentLayoutOrder) && void 0 !== _a ? _a : ["legend", "title"]).forEach(component => {
66634
+ var _a, _b;
66635
+ "legend" === component ? null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach(legend => {
66636
+ null == legend || legend.resize();
66637
+ }) : "title" === component && (null === (_b = this.internalProps.title) || void 0 === _b || _b.resize());
66638
+ }), this.scenegraph.resize(), this.render();
66639
+ }
66577
66640
  updatePagination(pagination) {
66578
66641
  this.pagination && ("number" == typeof pagination.currentPage && pagination.currentPage >= 0 && (this.pagination.currentPage = pagination.currentPage), pagination.perPageCount && (this.pagination.perPageCount = pagination.perPageCount || this.pagination.perPageCount), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.clearCells(), this.dataSource.updatePagination(this.pagination), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(), this.renderAsync());
66579
66642
  }
@@ -70479,10 +70542,10 @@
70479
70542
  }
70480
70543
  }
70481
70544
 
70482
- function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync) {
70545
+ function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle) {
70483
70546
  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, _0, _1, _2, _3, _4, _5, _6, _7, _8;
70484
- const headerStyle = table._getCellStyle(col, row),
70485
- functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
70547
+ headerStyle = headerStyle || table._getCellStyle(col, row);
70548
+ const functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
70486
70549
  isValid$2(functionalPadding) && (padding = functionalPadding), (null === (_a = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _a ? void 0 : _a.textAlign) && (textAlign = null === (_b = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _b ? void 0 : _b.textAlign), (null === (_c = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _c ? void 0 : _c.textBaseline) && (textBaseline = null === (_d = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _d ? void 0 : _d.textBaseline);
70487
70550
  const autoRowHeight = table.isAutoRowHeight(row),
70488
70551
  autoColWidth = "auto" === colWidth,
@@ -87769,7 +87832,7 @@
87769
87832
  return this.element;
87770
87833
  }
87771
87834
  targetIsOnEditor(target) {
87772
- return target === this.element || target === this.sheet.formulaUIManager.formulaInput;
87835
+ return target === this.element || target === this.sheet?.formulaUIManager.formulaInput;
87773
87836
  }
87774
87837
  createElement() {
87775
87838
  super.createElement();
@@ -87801,7 +87864,10 @@
87801
87864
  return;
87802
87865
  }
87803
87866
  const value = this.element.value;
87804
- this.sheet.formulaUIManager.formulaInput.value = value;
87867
+ const formulaInput = this.sheet.formulaUIManager.formulaInput;
87868
+ if (formulaInput) {
87869
+ formulaInput.value = value;
87870
+ }
87805
87871
  const highlightManager = this.sheet.formulaManager.cellHighlightManager;
87806
87872
  if (highlightManager) {
87807
87873
  if (value.startsWith('=')) {
@@ -91299,6 +91365,28 @@
91299
91365
  }
91300
91366
  }
91301
91367
 
91368
+ const normalizeColumnsField = (columns, startFieldIndex = 0) => {
91369
+ if (!columns?.length) {
91370
+ return startFieldIndex;
91371
+ }
91372
+ let fieldIndex = startFieldIndex;
91373
+ columns.forEach(column => {
91374
+ const childColumns = column
91375
+ .columns;
91376
+ if (childColumns?.length) {
91377
+ fieldIndex = normalizeColumnsField(childColumns, fieldIndex);
91378
+ return;
91379
+ }
91380
+ if (!isValid$2(column.field)) {
91381
+ column.field = fieldIndex;
91382
+ }
91383
+ if (!isValid$2(column.key)) {
91384
+ column.key = column.field;
91385
+ }
91386
+ fieldIndex++;
91387
+ });
91388
+ return fieldIndex;
91389
+ };
91302
91390
  class WorkSheet {
91303
91391
  options;
91304
91392
  container;
@@ -91426,10 +91514,7 @@
91426
91514
  this.options.columns = [];
91427
91515
  }
91428
91516
  else {
91429
- for (let i = 0; i < this.options.columns.length; i++) {
91430
- this.options.columns[i].field = i;
91431
- this.options.columns[i].key = i;
91432
- }
91517
+ normalizeColumnsField(this.options.columns);
91433
91518
  }
91434
91519
  if (!this.options.data) {
91435
91520
  this.options.data = [];