@visactor/vtable-gantt 1.26.6 → 1.26.8

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.
@@ -43314,7 +43314,11 @@
43314
43314
  super(config), this.type = AggregationType.CUSTOM, this.isRecord = !0, this.values = [], this.aggregationFun = config.aggregationFun;
43315
43315
  }
43316
43316
  push(record) {
43317
- record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)), record.isAggregator && this.children && this.children.push(record), this.field && this.values.push(record[this.field])), this.clearCacheValue();
43317
+ if (record) {
43318
+ if (this.recalculateFromChildren && record.isAggregator) return this.isRecord && this.records && this.records.push(...record.records), this.children && this.children.push(record), this.field && this.values.push(...record.records.map(item => item[this.field])), void this.clearCacheValue();
43319
+ this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)), record.isAggregator && this.children && this.children.push(record), this.field && this.values.push(record[this.field]);
43320
+ }
43321
+ this.clearCacheValue();
43318
43322
  }
43319
43323
  updateRecord(oldRecord, newRecord) {
43320
43324
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map(item => item === oldRecord ? newRecord : item)), oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map(item => item === oldRecord ? newRecord : item)), this.field && this.records.length && (this.values = this.records.map(item => item[this.field])), this.clearCacheValue());
@@ -43330,7 +43334,18 @@
43330
43334
  this.records = [], this.children = [], this.changedValue = void 0, this.fieldValue = void 0;
43331
43335
  }
43332
43336
  recalculate() {
43333
- this.fieldValue = void 0, this._formatedValue = void 0;
43337
+ var _a;
43338
+ this.recalculateFromChildren && (null === (_a = this.children) || void 0 === _a ? void 0 : _a.length) && this.field && (this.values = [], this.records = [], this.children.forEach(child => {
43339
+ if (isValid$1(child.changedValue)) {
43340
+ const value = child.value();
43341
+ this.values.push(value), this.records.push({
43342
+ [this.field]: value
43343
+ });
43344
+ } else if (child instanceof CustomAggregator && child.recalculateFromChildren) this.values.push(...child.values), this.records.push(...child.records);else {
43345
+ const records = child.records;
43346
+ this.values.push(...records.map(record => record[this.field])), this.records.push(...records);
43347
+ }
43348
+ })), this.fieldValue = void 0, this._formatedValue = void 0;
43334
43349
  }
43335
43350
  }
43336
43351
  class RecalculateAggregator extends Aggregator {
@@ -44380,8 +44395,8 @@
44380
44395
  function isZeroStyle(style) {
44381
44396
  return 0 === style || isArray$5(style) && style.every(s => 0 === s);
44382
44397
  }
44383
- function setActiveCellRangeState(table) {
44384
- const selectRanges = table.stateManager.select.ranges,
44398
+ function setActiveCellRangeState(table, ranges = table.stateManager.select.ranges) {
44399
+ const selectRanges = ranges,
44385
44400
  setRanges = [];
44386
44401
  for (let i = 0; i < selectRanges.length; i++) {
44387
44402
  const range = selectRanges[i];
@@ -44511,12 +44526,6 @@
44511
44526
  function defaultOrderFn(v1, v2, order) {
44512
44527
  return "desc" !== order ? v1 === v2 ? 0 : v1 > v2 ? 1 : -1 : v1 === v2 ? 0 : v1 < v2 ? 1 : -1;
44513
44528
  }
44514
- function getValueByPath(obj, paths) {
44515
- let prop,
44516
- res = obj;
44517
- for (; (prop = paths.shift()) && (res = res[prop], res););
44518
- return res;
44519
- }
44520
44529
  function isAllDigits(str) {
44521
44530
  return /^-?\d+(\.\d+)?$/.test(str);
44522
44531
  }
@@ -44707,6 +44716,7 @@
44707
44716
  MOUSELEAVE_CELL: "mouseleave_cell",
44708
44717
  CONTEXTMENU_CELL: "contextmenu_cell",
44709
44718
  CONTEXTMENU_CANVAS: "contextmenu_canvas",
44719
+ CONTEXT_MENU_CLICK: "context_menu_click",
44710
44720
  RESIZE_COLUMN: "resize_column",
44711
44721
  RESIZE_COLUMN_END: "resize_column_end",
44712
44722
  RESIZE_ROW: "resize_row",
@@ -46531,7 +46541,7 @@
46531
46541
  const DARK = new TableTheme(darkTheme, darkTheme);
46532
46542
  const BRIGHT = new TableTheme(brightTheme, brightTheme);
46533
46543
  const ARCO = new TableTheme(arcoTheme, arcoTheme);
46534
- const DEFAULT = new TableTheme(defaultTheme, defaultTheme);
46544
+ let DEFAULT = new TableTheme(defaultTheme, defaultTheme);
46535
46545
  const SIMPLIFY = new TableTheme(materialDesignTheme, materialDesignTheme);
46536
46546
  const builtin$1 = {
46537
46547
  DEFAULT: DEFAULT,
@@ -46540,6 +46550,9 @@
46540
46550
  DARK: DARK,
46541
46551
  BRIGHT: BRIGHT
46542
46552
  };
46553
+ function setDefaultTheme(theme) {
46554
+ DEFAULT = theme instanceof TableTheme ? theme.extends({}) : new TableTheme(theme, theme), builtin$1.DEFAULT = DEFAULT;
46555
+ }
46543
46556
  const theme$1 = {
46544
46557
  TableTheme: TableTheme
46545
46558
  };
@@ -46558,11 +46571,14 @@
46558
46571
  DARK: DARK,
46559
46572
  BRIGHT: BRIGHT,
46560
46573
  ARCO: ARCO,
46561
- DEFAULT: DEFAULT,
46574
+ get DEFAULT() {
46575
+ return DEFAULT;
46576
+ },
46562
46577
  SIMPLIFY: SIMPLIFY,
46563
46578
  theme: theme$1,
46564
46579
  of: of$1,
46565
- get: get$5
46580
+ get: get$5,
46581
+ setDefaultTheme: setDefaultTheme
46566
46582
  };
46567
46583
 
46568
46584
  var themes$1 = /*#__PURE__*/Object.freeze({
@@ -46570,12 +46586,13 @@
46570
46586
  ARCO: ARCO,
46571
46587
  BRIGHT: BRIGHT,
46572
46588
  DARK: DARK,
46573
- DEFAULT: DEFAULT,
46589
+ get DEFAULT () { return DEFAULT; },
46574
46590
  SIMPLIFY: SIMPLIFY,
46575
46591
  TableTheme: TableTheme,
46576
46592
  default: themes,
46577
46593
  get: get$5,
46578
46594
  of: of$1,
46595
+ setDefaultTheme: setDefaultTheme,
46579
46596
  tableThemeIsChanged: tableThemeIsChanged,
46580
46597
  theme: theme$1
46581
46598
  });
@@ -49879,21 +49896,64 @@
49879
49896
  if ((void 0 === fieldGet || "" === fieldGet) && Array.isArray(record)) {
49880
49897
  return record[col - table.leftRowSeriesNumberCount];
49881
49898
  }
49882
- if (isObject$8(record) && fieldGet in record) {
49899
+ if (Array.isArray(fieldGet)) {
49900
+ return getValue$2(getRecordFieldValue(record, fieldGet), promiseCallBack);
49901
+ }
49902
+ if (isRecordContainer(record) && fieldGet in record) {
49883
49903
  return getValue$2(record[fieldGet], promiseCallBack);
49884
49904
  }
49885
49905
  if ("function" == typeof fieldGet) {
49886
49906
  return getValue$2(fieldGet(record, col, row, table), promiseCallBack);
49887
49907
  }
49888
- if (Array.isArray(fieldGet)) {
49889
- return getValue$2(getValueByPath(record, [...fieldGet]), promiseCallBack);
49890
- }
49891
49908
  const fieldArray = `${fieldGet}`.split(".");
49892
49909
  if (fieldArray.length <= 1) {
49893
49910
  return getValue$2(record[fieldGet], promiseCallBack);
49894
49911
  }
49895
49912
  return getValue$2(applyChainSafe(record, (val, name) => getField(val, name, col, row, table, emptyFn), ...fieldArray), promiseCallBack);
49896
49913
  }
49914
+ function isRecordContainer(value) {
49915
+ return null !== value && "object" == typeof value;
49916
+ }
49917
+ function getRecordFieldPath(field) {
49918
+ return Array.isArray(field) ? field : "string" == typeof field && field.includes(".") ? field.split(".") : void 0;
49919
+ }
49920
+ function hasRecordField(record, field) {
49921
+ if (!isRecordContainer(record)) return !1;
49922
+ const path = getRecordFieldPath(field);
49923
+ if (!Array.isArray(field) && field in record) return !0;
49924
+ if (!path) return !1;
49925
+ let target = record;
49926
+ for (const key of path) {
49927
+ if (!isRecordContainer(target) || !(key in target)) return !1;
49928
+ target = target[key];
49929
+ }
49930
+ return !0;
49931
+ }
49932
+ function getRecordFieldValue(record, field) {
49933
+ if (null == record) return;
49934
+ const path = getRecordFieldPath(field);
49935
+ return !Array.isArray(field) && isRecordContainer(record) && field in record ? record[field] : path ? path.reduce((current, key) => null == current ? void 0 : current[key], record) : record[field];
49936
+ }
49937
+ function setRecordProperty(record, key, value) {
49938
+ "__proto__" !== key && "constructor" !== key && "prototype" !== key ? record[key] = value : Object.defineProperty(record, key, {
49939
+ configurable: !0,
49940
+ enumerable: !0,
49941
+ value: value,
49942
+ writable: !0
49943
+ });
49944
+ }
49945
+ function setRecordFieldValue(record, field, value) {
49946
+ if (null == record) return;
49947
+ const path = getRecordFieldPath(field);
49948
+ if (!path || !Array.isArray(field) && isRecordContainer(record) && field in record) return void setRecordProperty(record, field, value);
49949
+ if (0 === path.length) return;
49950
+ let target = record;
49951
+ for (let i = 0; i < path.length - 1; i++) {
49952
+ const key = path[i];
49953
+ Object.prototype.hasOwnProperty.call(target, key) && null !== target[key] && "object" == typeof target[key] || setRecordProperty(target, key, {}), target = target[key];
49954
+ }
49955
+ setRecordProperty(target, path[path.length - 1], value);
49956
+ }
49897
49957
  function _getIndex(sortedIndexMap, index) {
49898
49958
  if (!sortedIndexMap) return index;
49899
49959
  const mapIndex = sortedIndexMap[index];
@@ -50129,21 +50189,19 @@
50129
50189
  return childrenLength;
50130
50190
  }
50131
50191
  changeFieldValue(value, index, field, col, row, table) {
50132
- var _a;
50133
50192
  if (null !== field && index >= 0) {
50134
50193
  const dataIndex = this.getIndexKey(index);
50135
- if (this.cacheBeforeChangedRecord(dataIndex, table), void 0 !== field && "" !== field || (field = col - table.leftRowSeriesNumberCount), "string" == typeof field || "number" == typeof field) {
50136
- const beforeChangedValue = null === (_a = this.beforeChangedRecordsMap.get(dataIndex.toString())) || void 0 === _a ? void 0 : _a[field],
50194
+ if (this.cacheBeforeChangedRecord(dataIndex, table), void 0 !== field && "" !== field || (field = col - table.leftRowSeriesNumberCount), "string" == typeof field || "number" == typeof field || Array.isArray(field)) {
50195
+ const beforeChangedValue = getRecordFieldValue(this.beforeChangedRecordsMap.get(dataIndex.toString()), field),
50137
50196
  record = this.getOriginalRecord(dataIndex);
50138
50197
  let formatValue = value;
50139
- "number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), isPromise(record) ? record.then(record => {
50140
- record[field] = formatValue;
50141
- }).catch(err => {}) : record ? record[field] = formatValue : (this.records[dataIndex] = "Array" === this.addRecordRule ? [] : {}, this.records[dataIndex][field] = formatValue);
50198
+ if ("number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), isPromise(record)) return record.then(record => (setRecordFieldValue(record, field, formatValue), formatValue)).catch(err => {});
50199
+ record ? setRecordFieldValue(record, field, formatValue) : (this.records[dataIndex] = "Array" === this.addRecordRule ? [] : {}, setRecordFieldValue(this.records[dataIndex], field, formatValue));
50142
50200
  }
50143
50201
  }
50144
50202
  }
50145
50203
  changeFieldValueByRecordIndex(value, recordIndex, field, table) {
50146
- var _a, _b, _c, _d;
50204
+ var _a, _b, _c;
50147
50205
  if (null === field) return;
50148
50206
  if (null == recordIndex) return;
50149
50207
  const rawKey = recordIndex.toString();
@@ -50152,12 +50210,12 @@
50152
50210
  originRecord = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
50153
50211
  this.beforeChangedRecordsMap.set(rawKey, null !== (_b = cloneDeep(originRecord, void 0, ["vtable_gantt_linkedFrom", "vtable_gantt_linkedTo"])) && void 0 !== _b ? _b : {});
50154
50212
  }
50155
- if ("string" == typeof field || "number" == typeof field) {
50156
- const beforeChangedValue = null === (_c = this.beforeChangedRecordsMap.get(rawKey)) || void 0 === _c ? void 0 : _c[field],
50157
- rawRecords = Array.isArray(null === (_d = this.dataSourceObj) || void 0 === _d ? void 0 : _d.records) ? this.dataSourceObj.records : null,
50213
+ if ("string" == typeof field || "number" == typeof field || Array.isArray(field)) {
50214
+ const beforeChangedValue = getRecordFieldValue(this.beforeChangedRecordsMap.get(rawKey), field),
50215
+ rawRecords = Array.isArray(null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.records) ? this.dataSourceObj.records : null,
50158
50216
  record = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
50159
50217
  let formatValue = value;
50160
- "number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), record ? record[field] = formatValue : rawRecords && "number" == typeof recordIndex && (rawRecords[recordIndex] = "Array" === this.addRecordRule ? [] : {}, rawRecords[recordIndex][field] = formatValue);
50218
+ "number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), record ? setRecordFieldValue(record, field, formatValue) : rawRecords && "number" == typeof recordIndex && (rawRecords[recordIndex] = "Array" === this.addRecordRule ? [] : {}, setRecordFieldValue(rawRecords[recordIndex], field, formatValue));
50161
50219
  }
50162
50220
  }
50163
50221
  cacheBeforeChangedRecord(dataIndex, table) {
@@ -50532,8 +50590,7 @@
50532
50590
  hasOriginalField(index, field) {
50533
50591
  if (null === field) return !1;
50534
50592
  if ("function" == typeof field) return !0;
50535
- const record = this.getOriginalRecord(index);
50536
- return Boolean(record && field in record);
50593
+ return hasRecordField(this.getOriginalRecord(index), field);
50537
50594
  }
50538
50595
  fieldPromiseCallBack(_index, _field, _value) {}
50539
50596
  recordPromiseCallBack(_index, _record) {}
@@ -53031,7 +53088,7 @@
53031
53088
  const cells = rowCells.split("\t"),
53032
53089
  rowValues = [];
53033
53090
  0 === rowIndex && result.push("<tbody>"), cells.forEach(function (cell, cellIndex) {
53034
- const parsedCellData = cell ? cell.toString().replace(/&/g, "&amp;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>").replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, "<br>\r\n").replace(/\x20{2,}/gi, substring => `<span style="mso-spacerun: yes">${"&nbsp;".repeat(substring.length - 1)} </span>`).replace(/\t/gi, "&#9;") : " ";
53091
+ const parsedCellData = cell ? cell.toString().replace(/&/g, "&amp;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>").replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, "<br>\r\n").replace(/\x20{2,}/gi, substring => `<span style="mso-spacerun: yes">${"&nbsp;".repeat(substring.length - 1)} </span>`).replace(/\t/gi, "&#9;") : "";
53035
53092
  rowValues.push(`<td>${parsedCellData}</td>`);
53036
53093
  }), result.push("<tr>", ...rowValues, "</tr>"), rowIndex === rows.length - 1 && result.push("</tbody>");
53037
53094
  }), result.push("</table>"), [META_HEAD, result.join("")].join("");
@@ -53942,7 +53999,61 @@
53942
53999
  }
53943
54000
  }
53944
54001
 
53945
- function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync) {
54002
+ const CELL_MEDIA_KEY = "__vtable_cell_media__";
54003
+ const CELL_MEDIA_KIND_KEY = "__vtable_cell_media_kind__";
54004
+ function markCellMedia(graphic, kind) {
54005
+ return graphic[CELL_MEDIA_KEY] = !0, graphic[CELL_MEDIA_KIND_KEY] = kind, graphic;
54006
+ }
54007
+ function isCellMedia(graphic) {
54008
+ return !0 === (null == graphic ? void 0 : graphic[CELL_MEDIA_KEY]);
54009
+ }
54010
+ function getCellMediaChildren(cellGroup) {
54011
+ const mediaChildren = [];
54012
+ return cellGroup.forEachChildren(child => {
54013
+ isCellMedia(child) && mediaChildren.push(child);
54014
+ }), mediaChildren;
54015
+ }
54016
+ function getCellMediaByKind(cellGroup, kind) {
54017
+ let graphic;
54018
+ return cellGroup.forEachChildren(child => !(!isCellMedia(child) || child[CELL_MEDIA_KIND_KEY] !== kind) && (graphic = child, !0)), graphic;
54019
+ }
54020
+ function getCellMediaImage(cellGroup) {
54021
+ return getCellMediaByKind(cellGroup, "image");
54022
+ }
54023
+ function getCellMediaPlayIcon(cellGroup) {
54024
+ return getCellMediaByKind(cellGroup, "play-icon");
54025
+ }
54026
+ function releaseVideoResource(video) {
54027
+ try {
54028
+ video.pause();
54029
+ } catch (err) {}
54030
+ video.removeAttribute("src");
54031
+ try {
54032
+ video.load();
54033
+ } catch (err) {}
54034
+ }
54035
+ function releaseGraphicMediaResource(graphic) {
54036
+ var _a;
54037
+ const source = null === (_a = null == graphic ? void 0 : graphic.attribute) || void 0 === _a ? void 0 : _a.image;
54038
+ "undefined" != typeof HTMLVideoElement && source instanceof HTMLVideoElement && releaseVideoResource(source);
54039
+ }
54040
+ function removeCellMediaChildren(cellGroup) {
54041
+ getCellMediaChildren(cellGroup).forEach(child => {
54042
+ var _a;
54043
+ releaseGraphicMediaResource(child), cellGroup.removeChild(child), null === (_a = child.release) || void 0 === _a || _a.call(child);
54044
+ });
54045
+ }
54046
+
54047
+ function hasCellMedia(cellGroup) {
54048
+ return getCellMediaChildren(cellGroup).length > 0;
54049
+ }
54050
+ function getResizeImage(cellGroup) {
54051
+ return hasCellMedia(cellGroup) ? getCellMediaImage(cellGroup) : void 0;
54052
+ }
54053
+ function getResizePlayIcon(cellGroup) {
54054
+ return hasCellMedia(cellGroup) ? getCellMediaPlayIcon(cellGroup) : void 0;
54055
+ }
54056
+ function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync, cellValue) {
53946
54057
  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;
53947
54058
  const headerStyle = table._getCellStyle(col, row),
53948
54059
  functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
@@ -53998,17 +54109,19 @@
53998
54109
  "icon-left" === child.role ? child.setAttribute("x", child.attribute.x + padding[3]) : "icon-right" === child.role ? child.setAttribute("x", child.attribute.x + width - rightIconWidth - padding[1]) : "icon-absolute-right" === child.role && child.setAttribute("x", child.attribute.x + width - absoluteRightIconWidth - padding[1]);
53999
54110
  }), cellGroup.forEachChildren(child => {
54000
54111
  "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
54001
- }), cellGroup._cellLeftIconWidth = cellLeftIconWidth, cellGroup._cellRightIconWidth = cellRightIconWidth;
54002
- }
54003
- const value = table.getCellValue(col, row),
54004
- image = createImage({
54005
- x: padding[3],
54006
- y: padding[0],
54007
- width: width - padding[1] - padding[3] - iconWidth,
54008
- height: height - padding[0] - padding[2],
54009
- image: value,
54010
- cursor: "pointer"
54011
54112
  });
54113
+ }
54114
+ cellGroup._cellLeftIconWidth = cellLeftIconWidth, cellGroup._cellRightIconWidth = cellRightIconWidth;
54115
+ const value = arguments.length >= 18 ? cellValue : table.getCellValue(col, row);
54116
+ removeCellMediaChildren(cellGroup);
54117
+ const image = markCellMedia(createImage({
54118
+ x: padding[3],
54119
+ y: padding[0],
54120
+ width: width - padding[1] - padding[3] - iconWidth,
54121
+ height: height - padding[0] - padding[2],
54122
+ image: value,
54123
+ cursor: "pointer"
54124
+ }), "image");
54012
54125
  if (image.name = "image", image.keepAspectRatio = keepAspectRatio, image.textAlign = textAlign, image.textBaseline = textBaseline, keepAspectRatio || imageAutoSizing ? image.resources && image.resources.has(image.attribute.image) && "success" === image.resources.get(image.attribute.image).state ? (image.setAttribute("opacity", 0), setTimeout(() => {
54013
54126
  image.setAttribute("opacity", 1), updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table), table.scenegraph.updateNextFrame();
54014
54127
  }, 0)) : image.successCallback = () => {
@@ -54042,10 +54155,10 @@
54042
54155
  }
54043
54156
  function updateImageCellContentWhileResize(cellGroup, col, row, deltaX, deltaY, table) {
54044
54157
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
54045
- const image = cellGroup.getChildByName("image");
54158
+ const image = getResizeImage(cellGroup);
54046
54159
  if (!image) return;
54047
54160
  const originImage = "string" != typeof image.attribute.image && image.attribute.image || (null === (_a = image.resources) || void 0 === _a ? void 0 : _a.get(image.attribute.image).data);
54048
- if (!originImage) return;
54161
+ if (!originImage && !image.isAudioIcon) return;
54049
54162
  const headerStyle = table._getCellStyle(col, row),
54050
54163
  textAlign = null !== (_b = getProp("textAlign", headerStyle, col, row, table)) && void 0 !== _b ? _b : "left",
54051
54164
  textBaseline = null !== (_c = getProp("textBaseline", headerStyle, col, row, table)) && void 0 !== _c ? _c : "middle";
@@ -54059,17 +54172,31 @@
54059
54172
  colStart = null !== (_g = cellGroup.mergeStartCol) && void 0 !== _g ? _g : cellGroup.col,
54060
54173
  rowStart = null !== (_h = cellGroup.mergeStartRow) && void 0 !== _h ? _h : cellGroup.row,
54061
54174
  colEnd = null !== (_j = cellGroup.mergeEndCol) && void 0 !== _j ? _j : cellGroup.col,
54062
- rowEnd = null !== (_k = cellGroup.mergeEndCol) && void 0 !== _k ? _k : cellGroup.row,
54175
+ rowEnd = null !== (_k = cellGroup.mergeEndRow) && void 0 !== _k ? _k : cellGroup.row,
54063
54176
  leftIconWidth = null !== (_l = cellGroup._cellLeftIconWidth) && void 0 !== _l ? _l : 0,
54064
54177
  rightIconWidth = null !== (_m = cellGroup._cellRightIconWidth) && void 0 !== _m ? _m : 0;
54065
- if (image.keepAspectRatio || isDamagePic(image)) {
54178
+ if (image.isAudioIcon) {
54179
+ const availableWidth = Math.max(1, cellWidth - padding[1] - padding[3] - leftIconWidth - rightIconWidth),
54180
+ availableHeight = Math.max(1, cellHeight - padding[0] - padding[2]),
54181
+ iconSize = Math.max(1, Math.min(availableWidth, availableHeight, 32)),
54182
+ pos = calcStartPosition(leftIconWidth, 0, cellWidth - leftIconWidth - rightIconWidth, cellHeight, iconSize, iconSize, textAlign, textBaseline, padding);
54183
+ for (let col = colStart; col <= colEnd; col++) for (let row = rowStart; row <= rowEnd; row++) {
54184
+ const image = getResizeImage(table.scenegraph.getCell(col, row));
54185
+ null == image || image.setAttributes({
54186
+ x: pos.x,
54187
+ y: pos.y,
54188
+ width: iconSize,
54189
+ height: iconSize
54190
+ });
54191
+ }
54192
+ } else if (image.keepAspectRatio || isDamagePic(image)) {
54066
54193
  const {
54067
54194
  width: imageWidth,
54068
54195
  height: imageHeight
54069
54196
  } = calcKeepAspectRatioSize(originImage.width || originImage.videoWidth, originImage.height || originImage.videoHeight, cellWidth - (padding[1] + padding[3]), cellHeight - (padding[0] + padding[2])),
54070
54197
  pos = calcStartPosition(0, 0, cellWidth, cellHeight, imageWidth, imageHeight, textAlign, textBaseline, padding);
54071
54198
  for (let col = colStart; col <= colEnd; col++) for (let row = rowStart; row <= rowEnd; row++) {
54072
- const image = table.scenegraph.getCell(col, row).getChildByName("image");
54199
+ const image = getResizeImage(table.scenegraph.getCell(col, row));
54073
54200
  null == image || image.setAttributes({
54074
54201
  x: pos.x,
54075
54202
  y: pos.y,
@@ -54078,7 +54205,7 @@
54078
54205
  });
54079
54206
  }
54080
54207
  } else for (let col = colStart; col <= colEnd; col++) for (let row = rowStart; row <= rowEnd; row++) {
54081
- const image = table.scenegraph.getCell(col, row).getChildByName("image");
54208
+ const image = getResizeImage(table.scenegraph.getCell(col, row));
54082
54209
  null == image || image.setAttributes({
54083
54210
  x: leftIconWidth + padding[3],
54084
54211
  y: padding[0],
@@ -54086,7 +54213,7 @@
54086
54213
  height: cellHeight - padding[0] - padding[2]
54087
54214
  });
54088
54215
  }
54089
- if (cellGroup.getChildByName("play-icon")) {
54216
+ if (getResizePlayIcon(cellGroup)) {
54090
54217
  const left = 0,
54091
54218
  top = 0,
54092
54219
  {
@@ -54097,7 +54224,8 @@
54097
54224
  anchorX = left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2),
54098
54225
  anchorY = top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);
54099
54226
  for (let col = colStart; col <= colEnd; col++) for (let row = rowStart; row <= rowEnd; row++) {
54100
- table.scenegraph.getCell(col, row).getChildByName("play-icon").setAttributes({
54227
+ const playIcon = getResizePlayIcon(table.scenegraph.getCell(col, row));
54228
+ null == playIcon || playIcon.setAttributes({
54101
54229
  x: anchorX - iconSize / 2,
54102
54230
  y: anchorY - iconSize / 2,
54103
54231
  width: iconSize,
@@ -54126,12 +54254,12 @@
54126
54254
  for (let col = startCol; col <= endCol; col++) for (let row = startRow; row <= endRow; row++) {
54127
54255
  const cellGroup = table.scenegraph.getCell(col, row);
54128
54256
  if (cellGroup) {
54129
- const image = cellGroup.getChildByName("image");
54257
+ const image = getResizeImage(cellGroup);
54130
54258
  image && image.setAttributes({
54131
54259
  dx: -table.getColsWidth(cellGroup.mergeStartCol, col - 1),
54132
54260
  dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
54133
54261
  });
54134
- const playIcon = cellGroup.getChildByName("play-icon");
54262
+ const playIcon = getResizePlayIcon(cellGroup);
54135
54263
  playIcon && playIcon.setAttributes({
54136
54264
  dx: -table.getColsWidth(cellGroup.mergeStartCol, col - 1),
54137
54265
  dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
@@ -54170,8 +54298,8 @@
54170
54298
  }
54171
54299
 
54172
54300
  function dealPromiseData(dataPromise, tabel, callback) {
54173
- dataPromise.then(() => {
54174
- callback(), tabel.scenegraph.updateNextFrame();
54301
+ dataPromise.then(value => {
54302
+ callback(value), tabel.scenegraph.updateNextFrame();
54175
54303
  }).catch(err => {});
54176
54304
  }
54177
54305
 
@@ -54187,16 +54315,70 @@
54187
54315
  }
54188
54316
  }
54189
54317
 
54190
- function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
54318
+ function isCornerCustomMergeRange(range, table) {
54319
+ return !!(null == range ? void 0 : range.isCustom) && (range.start.col !== range.end.col || range.start.row !== range.end.row) && table.isCornerHeader(range.start.col, range.start.row) && table.isCornerHeader(range.end.col, range.end.row);
54320
+ }
54321
+ function shouldRenderCornerCustomMergeContent(col, row, range, table) {
54322
+ return !isCornerCustomMergeRange(range, table) || col === range.end.col && row === range.end.row;
54323
+ }
54324
+ function createCornerCustomMergeContainer(customElementsGroup, width, height, range, table) {
54325
+ if (!customElementsGroup || !isCornerCustomMergeRange(range, table)) return customElementsGroup;
54326
+ const customContainer = new Group$1({
54327
+ x: 0,
54328
+ y: 0,
54329
+ width: width,
54330
+ height: height,
54331
+ fill: !1,
54332
+ stroke: !1,
54333
+ pickable: !1,
54334
+ clip: !0
54335
+ });
54336
+ return customContainer.name = CUSTOM_CONTAINER_NAME, customContainer.col = range.start.col, customContainer.row = range.start.row, customContainer.appendChild(customElementsGroup), customContainer;
54337
+ }
54338
+ function queueCornerCustomMergeContentUpdate(range, table, pendingRanges) {
54339
+ pendingRanges ? pendingRanges.set(getCornerCustomMergeRangeKey(range), range) : refreshCornerCustomMergeContent(range, table);
54340
+ }
54341
+ function flushCornerCustomMergeContentUpdates(pendingRanges, table) {
54342
+ pendingRanges.forEach(range => {
54343
+ refreshCornerCustomMergeContentForResize(range, table);
54344
+ }), pendingRanges.clear();
54345
+ }
54346
+ function getCornerCustomMergeRangeKey(range) {
54347
+ return `${range.start.col}-${range.start.row}-${range.end.col}-${range.end.row}`;
54348
+ }
54349
+ function refreshCornerCustomMergeContent(range, table) {
54350
+ var _a;
54351
+ const cellGroup = table.scenegraph.getCell(range.end.col, range.end.row),
54352
+ customContainer = cellGroup.getChildByName(CUSTOM_CONTAINER_NAME) || cellGroup.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
54353
+ customContainer && (null === (_a = table.reactCustomLayout) || void 0 === _a || _a.removeCustomCell(range.start.col, range.start.row), customContainer.removeAllChild(), cellGroup.removeChild(customContainer)), table.scenegraph.updateCellContent(range.end.col, range.end.row);
54354
+ }
54355
+ function refreshCornerCustomMergeContentForResize(range, table) {
54356
+ const cellGroup = table.scenegraph.getCell(range.end.col, range.end.row),
54357
+ customContainer = cellGroup.getChildByName(CUSTOM_CONTAINER_NAME) || cellGroup.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
54358
+ customContainer && cellGroup.removeChild(customContainer), table.scenegraph.updateCellContent(range.end.col, range.end.row);
54359
+ }
54360
+
54361
+ const PROMISE_CELL_UPDATE_TOKEN_KEY = "__vtable_promise_cell_update_token__";
54362
+ function nextPromiseCellUpdateToken(cellGroup) {
54363
+ var _a;
54364
+ const token = (null !== (_a = cellGroup[PROMISE_CELL_UPDATE_TOKEN_KEY]) && void 0 !== _a ? _a : 0) + 1;
54365
+ return cellGroup[PROMISE_CELL_UPDATE_TOKEN_KEY] = token, token;
54366
+ }
54367
+ function isPromiseCellUpdateCurrent(table, col, row, cellGroup, token) {
54368
+ return table.scenegraph.highPerformanceGetCell(col, row, !0) === cellGroup && cellGroup[PROMISE_CELL_UPDATE_TOKEN_KEY] === token;
54369
+ }
54370
+ function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellValue) {
54191
54371
  var _a, _b;
54192
54372
  let cellGroup,
54193
54373
  isAsync = !1;
54374
+ const hasCellValue = arguments.length >= 19;
54375
+ let renderValue = hasCellValue ? cellValue : value;
54194
54376
  if (isPromise(value)) {
54195
54377
  if ("cell" !== table.scenegraph.highPerformanceGetCell(col, row).role) return cellGroup;
54196
- value = table.getCellValue(col, row), isAsync = !0;
54378
+ hasCellValue || (renderValue = table.getCellValue(col, row)), isAsync = !0;
54197
54379
  }
54198
- if ("checkbox" === type && define.tree) {
54199
- cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, !0);
54380
+ if (value = renderValue, "checkbox" === type && define.tree) {
54381
+ cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, !0, value);
54200
54382
  } else if ("text" === type || "link" === type || customResult) {
54201
54383
  if ("link" === type) {
54202
54384
  const cellValue = value,
@@ -54232,9 +54414,11 @@
54232
54414
  stroke: !1
54233
54415
  }), cellGroup.clear()) : table.internalProps.layoutMap.isAxisCell(col, row) && cellGroup.clear();
54234
54416
  } else if ("image" === type) {
54235
- cellGroup = Factory.getFunction("createImageCellGroup")(columnGroup, 0, y, col, row, cellWidth, cellHeight, define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync);
54417
+ cellGroup = Factory.getFunction("createImageCellGroup")(columnGroup, 0, y, col, row, cellWidth, cellHeight, define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync, value);
54418
+ } else if ("audio" === type) {
54419
+ cellGroup = Factory.getFunction("createAudioCellGroup")(columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync, value);
54236
54420
  } else if ("video" === type) {
54237
- cellGroup = Factory.getFunction("createVideoCellGroup")(columnGroup, 0, y, col, row, cellWidth, cellHeight, define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync);
54421
+ cellGroup = Factory.getFunction("createVideoCellGroup")(columnGroup, 0, y, col, row, cellWidth, cellHeight, define.keepAspectRatio, define.imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync, value);
54238
54422
  } else if ("chart" === type) {
54239
54423
  const chartInstance = table.internalProps.layoutMap.getChartInstance(col, row);
54240
54424
  cellGroup = Factory.getFunction("createChartCellGroup")(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, value, define.chartModule, table.internalProps.layoutMap.getChartSpec(col, row), chartInstance, null !== (_b = table.internalProps.layoutMap.getChartDataId(col, row)) && void 0 !== _b ? _b : "data", table, cellTheme, table.internalProps.layoutMap.isShareChartSpec(col, row), isAsync, table.internalProps.layoutMap.isNoChartDataRenderNothing(col, row));
@@ -54249,34 +54433,40 @@
54249
54433
  const progressBarGroup = Factory.getFunction("createProgressBarCell")(define, style, colWidth, value, dataValue, col, row, padding, table, range);
54250
54434
  cellGroup.firstChild ? cellGroup.insertBefore(progressBarGroup, cellGroup.firstChild) : cellGroup.appendChild(progressBarGroup);
54251
54435
  } else if ("sparkline" === type) {
54252
- cellGroup = Factory.getFunction("createSparkLineCellGroup")(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table, cellTheme, isAsync);
54436
+ cellGroup = Factory.getFunction("createSparkLineCellGroup")(null, columnGroup, 0, y, col, row, cellWidth, cellHeight, padding, table, cellTheme, isAsync, value);
54253
54437
  } else if ("checkbox" === type) {
54254
54438
  if ("isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row)) {
54255
54439
  cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync);
54256
54440
  } else {
54257
- cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, !1);
54441
+ cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, !1, value);
54258
54442
  }
54259
54443
  } else if ("radio" === type) {
54260
54444
  if ("isAggregation" in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row)) {
54261
54445
  cellGroup = Factory.getFunction("createTextCellGroup")(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, !1, void 0, !0, cellTheme, range, isAsync);
54262
54446
  } else {
54263
- cellGroup = Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define, range);
54447
+ cellGroup = Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define, range, isAsync, value);
54264
54448
  }
54265
54449
  } else if ("switch" === type) {
54266
- cellGroup = Factory.getFunction("createSwitchCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync);
54450
+ cellGroup = Factory.getFunction("createSwitchCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, value);
54267
54451
  } else if ("button" === type) {
54268
- cellGroup = Factory.getFunction("createButtonCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync);
54452
+ cellGroup = Factory.getFunction("createButtonCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, value);
54269
54453
  }
54270
54454
  return cellGroup.onBeforeAttributeUpdate = onBeforeAttributeUpdateForInvertHighlight, cellGroup;
54271
54455
  }
54272
54456
  function _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult) {
54273
54457
  let customElementsGroup,
54274
54458
  renderDefault = !0;
54275
- if (customResult) customElementsGroup = customResult.elementsGroup, renderDefault = customResult.renderDefault;else if ((null == range ? void 0 : range.isCustom) && !table.isCornerHeader(col, row)) ;else {
54459
+ if (!shouldRenderCornerCustomMergeContent(col, row, range, table)) return {
54460
+ customElementsGroup: customElementsGroup,
54461
+ renderDefault: !1
54462
+ };
54463
+ if (customResult) customElementsGroup = createCornerCustomMergeContainer(customResult.elementsGroup, cellWidth, cellHeight, range, table), renderDefault = customResult.renderDefault;else if ((null == range ? void 0 : range.isCustom) && !table.isCornerHeader(col, row)) ;else {
54276
54464
  let customRender, customLayout;
54277
54465
  if ("body" !== table.getCellLocation(col, row) ? (customRender = null == define ? void 0 : define.headerCustomRender, customLayout = null == define ? void 0 : define.headerCustomLayout) : (customRender = (null == define ? void 0 : define.customRender) || table.customRender, customLayout = null == define ? void 0 : define.customLayout), customLayout || customRender) {
54278
- const customResult = dealWithCustom(customLayout, customRender, col, row, cellWidth, cellHeight, !1, table.isAutoRowHeight(row), padding, range, table);
54279
- customElementsGroup = customResult.elementsGroup, renderDefault = customResult.renderDefault;
54466
+ const customCol = range && isCornerCustomMergeRange(range, table) ? range.start.col : col,
54467
+ customRow = range && isCornerCustomMergeRange(range, table) ? range.start.row : row,
54468
+ customResult = dealWithCustom(customLayout, customRender, customCol, customRow, cellWidth, cellHeight, !1, table.isAutoRowHeight(row), padding, range, table);
54469
+ customElementsGroup = createCornerCustomMergeContainer(customResult.elementsGroup, cellWidth, cellHeight, range, table), renderDefault = customResult.renderDefault;
54280
54470
  }
54281
54471
  }
54282
54472
  return {
@@ -54305,7 +54495,7 @@
54305
54495
  customLayout: customLayout,
54306
54496
  customRender: customRender
54307
54497
  } = customMerge;
54308
- range = customMergeRange, isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row, value = customMergeText, customStyle = customMergeStyle, (customLayout || customRender) && (customResult = dealWithCustom(customLayout, customRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), !1, table.isAutoRowHeight(row), [0, 0, 0, 0], range, table)), isCustomMerge = !0;
54498
+ range = customMergeRange, isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row, value = customMergeText, customStyle = customMergeStyle, (customLayout || customRender) && shouldRenderCornerCustomMergeContent(col, row, customMergeRange, table) && (customResult = dealWithCustom(customLayout, customRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), !1, table.isAutoRowHeight(row), [0, 0, 0, 0], range, table)), isCustomMerge = !0;
54309
54499
  }
54310
54500
  }
54311
54501
  let colForDefine = col,
@@ -54399,25 +54589,30 @@
54399
54589
  textAlign = cellTheme.text.textAlign,
54400
54590
  textBaseline = cellTheme.text.textBaseline;
54401
54591
  let newCellGroup, cellWidth, cellHeight;
54402
- if (range ? (cellWidth = table.getColsWidth(range.start.col, range.end.col), cellHeight = table.getRowsHeight(range.start.row, range.end.row)) : (cellWidth = table.getColWidth(col), cellHeight = table.getRowHeight(row)), isPromise(value) ? (oldCellGroup.removeAllChild(), dealPromiseData(value, table, callUpdateCellContentForPromiseValue.bind(null, {
54403
- type: type,
54404
- value: value,
54405
- define: define,
54406
- table: table,
54407
- col: col,
54408
- row: row,
54409
- cellWidth: cellWidth,
54410
- cellHeight: cellHeight,
54411
- oldCellGroup: oldCellGroup,
54412
- padding: padding,
54413
- textAlign: textAlign,
54414
- textBaseline: textBaseline,
54415
- mayHaveIcon: mayHaveIcon,
54416
- addNew: addNew,
54417
- range: range,
54418
- customResult: customResult,
54419
- customStyle: customStyle
54420
- }))) : newCellGroup = updateCellContent(type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult), isMerge) {
54592
+ if (range ? (cellWidth = table.getColsWidth(range.start.col, range.end.col), cellHeight = table.getRowsHeight(range.start.row, range.end.row)) : (cellWidth = table.getColWidth(col), cellHeight = table.getRowHeight(row)), isPromise(value)) {
54593
+ const updateToken = nextPromiseCellUpdateToken(oldCellGroup);
54594
+ removeCellMediaChildren(oldCellGroup), oldCellGroup.removeAllChild(), dealPromiseData(value, table, callUpdateCellContentForPromiseValue.bind(null, {
54595
+ type: type,
54596
+ define: define,
54597
+ table: table,
54598
+ col: col,
54599
+ row: row,
54600
+ cellWidth: cellWidth,
54601
+ cellHeight: cellHeight,
54602
+ oldCellGroup: oldCellGroup,
54603
+ padding: padding,
54604
+ textAlign: textAlign,
54605
+ textBaseline: textBaseline,
54606
+ mayHaveIcon: mayHaveIcon,
54607
+ addNew: addNew,
54608
+ range: range,
54609
+ customResult: customResult,
54610
+ customStyle: customStyle,
54611
+ promiseValue: value,
54612
+ updateToken: updateToken
54613
+ }));
54614
+ } else newCellGroup = updateCellContent(type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult);
54615
+ if (isMerge) {
54421
54616
  const {
54422
54617
  width: contentWidth
54423
54618
  } = newCellGroup.attribute,
@@ -54428,9 +54623,10 @@
54428
54623
  }
54429
54624
  return newCellGroup;
54430
54625
  }
54431
- function updateCellContent(type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult) {
54626
+ function updateCellContent(type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult, cellValue) {
54432
54627
  var _a, _b;
54433
- if (isPromise(value) && (value = table.getCellValue(col, row)), !addNew && (oldCellGroup.row !== row || oldCellGroup.col !== col)) return null;
54628
+ const hasCellValue = arguments.length >= 18;
54629
+ if (!addNew && (oldCellGroup.row !== row || oldCellGroup.col !== col)) return null;
54434
54630
  if (!addNew && oldCellGroup.parent && table.reactCustomLayout) {
54435
54631
  const reactGroup = oldCellGroup.getChildByName(CUSTOM_CONTAINER_NAME);
54436
54632
  if (reactGroup) {
@@ -54441,8 +54637,10 @@
54441
54637
  isNumber$3(col) && isNumber$3(row) && table.reactCustomLayout.removeCustomCell(col, row);
54442
54638
  }
54443
54639
  }
54444
- const newCellGroup = createCell(type, value, define, table, col, row, table.getColWidth(col), cellWidth, cellHeight, addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent, addNew ? 0 : table.scenegraph.getCellGroupY(row), padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
54445
- return !addNew && oldCellGroup.parent && (oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup), oldCellGroup.parent.removeChild(oldCellGroup), oldCellGroup.release(!0), (null === (_a = table.scenegraph) || void 0 === _a ? void 0 : _a.proxy.cellCache.get(col)) && (null === (_b = table.scenegraph) || void 0 === _b || _b.proxy.cellCache.set(col, newCellGroup))), newCellGroup;
54640
+ const createCellArgs = [type, value, define, table, col, row, table.getColWidth(col), cellWidth, cellHeight, addNew ? table.scenegraph.getColGroup(col) : oldCellGroup.parent, addNew ? 0 : table.scenegraph.getCellGroupY(row), padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult];
54641
+ hasCellValue && createCellArgs.push(cellValue);
54642
+ const newCellGroup = createCell(...createCellArgs);
54643
+ return !addNew && oldCellGroup.parent && newCellGroup !== oldCellGroup && (oldCellGroup.parent.insertAfter(newCellGroup, oldCellGroup), oldCellGroup.parent.removeChild(oldCellGroup), removeCellMediaChildren(oldCellGroup), oldCellGroup.release(!0), (null === (_a = table.scenegraph) || void 0 === _a ? void 0 : _a.proxy.cellCache.get(col)) && (null === (_b = table.scenegraph) || void 0 === _b || _b.proxy.cellCache.set(col, newCellGroup))), newCellGroup;
54446
54644
  }
54447
54645
  function canUseFastUpdate(col, row, oldCellGroup, autoWrapText, mayHaveIcon, table) {
54448
54646
  var _a;
@@ -54451,29 +54649,31 @@
54451
54649
  value = table.getCellValue(col, row);
54452
54650
  return !(table.isHeader(col, row) || "cell" !== oldCellGroup.role || "text" !== cellType || autoWrapText || autoRowHeight || mayHaveIcon || "text" !== (null === (_a = oldCellGroup.firstChild) || void 0 === _a ? void 0 : _a.type) || isPromise(value));
54453
54651
  }
54454
- function callUpdateCellContentForPromiseValue(updateCellArgs) {
54652
+ function callUpdateCellContentForPromiseValue(updateCellArgs, resolvedValue) {
54455
54653
  const {
54456
- type: type,
54457
- value: value,
54458
- define: define,
54459
- table: table,
54460
- col: col,
54461
- row: row,
54462
- cellWidth: cellWidth,
54463
- cellHeight: cellHeight,
54464
- oldCellGroup: oldCellGroup,
54465
- padding: padding,
54466
- textAlign: textAlign,
54467
- textBaseline: textBaseline,
54468
- mayHaveIcon: mayHaveIcon,
54469
- addNew: addNew,
54470
- range: range,
54471
- customResult: customResult,
54472
- customStyle: customStyle
54473
- } = updateCellArgs,
54474
- cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
54654
+ type: type,
54655
+ define: define,
54656
+ table: table,
54657
+ col: col,
54658
+ row: row,
54659
+ cellWidth: cellWidth,
54660
+ cellHeight: cellHeight,
54661
+ oldCellGroup: oldCellGroup,
54662
+ padding: padding,
54663
+ textAlign: textAlign,
54664
+ textBaseline: textBaseline,
54665
+ mayHaveIcon: mayHaveIcon,
54666
+ addNew: addNew,
54667
+ range: range,
54668
+ customResult: customResult,
54669
+ customStyle: customStyle,
54670
+ promiseValue: promiseValue,
54671
+ updateToken: updateToken
54672
+ } = updateCellArgs;
54673
+ if (!isPromiseCellUpdateCurrent(table, col, row, oldCellGroup, updateToken)) return;
54674
+ const cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
54475
54675
  cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
54476
- cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), updateCellContent(type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult);
54676
+ cellTheme.group.cornerRadius = getCellCornerRadius(col, row, table), updateCellContent(type, promiseValue, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult, resolvedValue);
54477
54677
  }
54478
54678
  function dealWithMergeCellSize(range, cellWidth, cellHeight, padding, textAlign, textBaseline, table) {
54479
54679
  for (let col = range.start.col; col <= range.end.col; col++) for (let row = range.start.row; row <= range.end.row; row++) {
@@ -54541,17 +54741,17 @@
54541
54741
  customRender: customMergeRender
54542
54742
  } = customMerge;
54543
54743
  if (customMergeLayout || customMergeRender) {
54544
- const customElementsGroup = dealWithCustom(customMergeLayout, customMergeRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), !1, table.isAutoRowHeight(row), [0, 0, 0, 0], customMergeRange, table).elementsGroup;
54545
- cellGroup.childrenCount > 0 && customElementsGroup ? cellGroup.insertBefore(customElementsGroup, cellGroup.firstChild) : customElementsGroup && cellGroup.appendChild(customElementsGroup);
54546
54744
  const rangeHeight = table.getRowHeight(row),
54547
54745
  rangeWidth = table.getColWidth(col),
54548
- {
54549
- width: contentWidth
54550
- } = cellGroup.attribute,
54551
- {
54552
- height: contentHeight
54553
- } = cellGroup.attribute;
54554
- return cellGroup.contentWidth = contentWidth, cellGroup.contentHeight = contentHeight, resizeCellGroup(cellGroup, rangeWidth, rangeHeight, customMergeRange, table), customMergeRange;
54746
+ contentWidth = table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col),
54747
+ contentHeight = table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row);
54748
+ if (cellGroup.contentWidth = contentWidth, cellGroup.contentHeight = contentHeight, !shouldRenderCornerCustomMergeContent(col, row, customMergeRange, table)) {
54749
+ const customContainer = cellGroup.getChildByName(CUSTOM_CONTAINER_NAME);
54750
+ return customContainer && cellGroup.removeChild(customContainer), cellGroup.setAttribute("clip", !0), resizeCellGroup(cellGroup, rangeWidth, rangeHeight, customMergeRange, table), customMergeRange;
54751
+ }
54752
+ const customResult = dealWithCustom(customMergeLayout, customMergeRender, customMergeRange.start.col, customMergeRange.start.row, table.getColsWidth(customMergeRange.start.col, customMergeRange.end.col), table.getRowsHeight(customMergeRange.start.row, customMergeRange.end.row), !1, table.isAutoRowHeight(row), [0, 0, 0, 0], customMergeRange, table),
54753
+ customElementsGroup = createCornerCustomMergeContainer(customResult.elementsGroup, contentWidth, contentHeight, customMergeRange, table);
54754
+ return cellGroup.childrenCount > 0 && customElementsGroup ? cellGroup.insertBefore(customElementsGroup, cellGroup.firstChild) : customElementsGroup && cellGroup.appendChild(customElementsGroup), resizeCellGroup(cellGroup, rangeWidth, rangeHeight, customMergeRange, table), isCornerCustomMergeRange(customMergeRange, table) && cellGroup.setAttribute("clip", !1), customMergeRange;
54555
54755
  }
54556
54756
  }
54557
54757
  }
@@ -54720,7 +54920,12 @@
54720
54920
  update ? newHeights[row] = Math.round(height) : table._setRowHeight(row, height);
54721
54921
  }
54722
54922
  } else {
54723
- fillRowsHeight(computeRowHeight(table.columnHeaderLevelCount, 0, table.colCount - 1, table), table.columnHeaderLevelCount, table.rowCount - 1 - table.bottomFrozenRowCount, table, update ? newHeights : void 0);
54923
+ const fillStartRow = table.columnHeaderLevelCount,
54924
+ fillEndRow = table.rowCount - 1 - table.bottomFrozenRowCount,
54925
+ rowForCompute = getFirstUnresizedRow(table, fillStartRow, fillEndRow);
54926
+ if (rowForCompute >= 0) {
54927
+ fillRowsHeight(computeRowHeight(rowForCompute, 0, table.colCount - 1, table), fillStartRow, fillEndRow, table, update ? newHeights : void 0);
54928
+ }
54724
54929
  for (let row = table.rowCount - table.bottomFrozenRowCount; row <= rowEnd; row++) {
54725
54930
  const height = computeRowHeight(row, 0, table.colCount - 1, table);
54726
54931
  update ? newHeights[row] = Math.round(height) : table._setRowHeight(row, height);
@@ -54784,7 +54989,7 @@
54784
54989
  table.isPivotTable() && (layoutMap.disableUseGetBodyCache(), layoutMap.disableUseHeaderPathCache());
54785
54990
  }
54786
54991
  function computeRowHeight(row, startCol, endCol, table) {
54787
- return computeRowHeightInternal(row, startCol, endCol, table, !0);
54992
+ return table.internalProps._heightResizedRowMap.has(row) ? table.getRowHeight(row) : computeRowHeightInternal(row, startCol, endCol, table, !0);
54788
54993
  }
54789
54994
  function computeRowHeightInternal(row, startCol, endCol, table, enableCustomCompute) {
54790
54995
  if (!(table.isAutoRowHeight(row) || "adaptive" === table.heightMode && !1 !== table.options.autoHeightInAdaptiveMode) && "auto" !== table.getDefaultRowHeight(row)) return table.getDefaultRowHeight(row);
@@ -54885,10 +55090,14 @@
54885
55090
  }
54886
55091
  function fillRowsHeight(height, startRow, endRow, table, newHeights) {
54887
55092
  if (!table.internalProps.useOneRowHeightFillAll) {
54888
- for (let row = startRow; row <= endRow; row++) newHeights ? newHeights[row] = height : table._setRowHeight(row, height);
55093
+ for (let row = startRow; row <= endRow; row++) table.internalProps._heightResizedRowMap.has(row) || (newHeights ? newHeights[row] = height : table._setRowHeight(row, height));
54889
55094
  table.internalProps.useOneRowHeightFillAll = !0;
54890
55095
  }
54891
55096
  }
55097
+ function getFirstUnresizedRow(table, startRow, endRow) {
55098
+ for (let row = startRow; row <= endRow; row++) if (!table.internalProps._heightResizedRowMap.has(row)) return row;
55099
+ return -1;
55100
+ }
54892
55101
  function computeCustomRenderHeight(col, row, table) {
54893
55102
  var _a, _b, _c, _d, _e, _f, _g;
54894
55103
  const customRender = table.getCustomRender(col, row);
@@ -54900,17 +55109,18 @@
54900
55109
  renderDefault = !1,
54901
55110
  enableCellPadding = !1;
54902
55111
  (table.isHeader(col, row) || (null === (_a = table.getBodyColumnDefine(col, row)) || void 0 === _a ? void 0 : _a.mergeCell) || table.hasCustomMerge()) && (cellRange = table.getCellRange(col, row), spanRow = cellRange.end.row - cellRange.start.row + 1);
54903
- const arg = {
54904
- col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
54905
- row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
54906
- dataValue: table.getCellOriginValue(col, row),
54907
- value: table.getCellValue(col, row),
54908
- rect: getCellRect$1(col, row, table),
54909
- table: table,
54910
- originCol: col,
54911
- originRow: row,
54912
- forComputation: !0
54913
- };
55112
+ const skipCellValue = shouldSkipCustomRenderCellValueForComputation$1(col, row, table),
55113
+ arg = {
55114
+ col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
55115
+ row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
55116
+ dataValue: skipCellValue ? void 0 : table.getCellOriginValue(col, row),
55117
+ value: skipCellValue ? void 0 : table.getCellValue(col, row),
55118
+ rect: getCellRect$1(col, row, table),
55119
+ table: table,
55120
+ originCol: col,
55121
+ originRow: row,
55122
+ forComputation: !0
55123
+ };
54914
55124
  if ("react-custom-layout" === customLayout && (customLayout = (null === (_d = table.reactCustomLayout) || void 0 === _d ? void 0 : _d.getCustomLayoutFunc(col, row)) || emptyCustomLayout), isFunction$3(customLayout)) {
54915
55125
  const customLayoutObj = customLayout(arg);
54916
55126
  customLayoutObj.rootContainer ? (customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer), dealPercentCalc(customLayoutObj.rootContainer, table.getColWidth(col), 0), customLayoutObj.rootContainer.setStage(table.scenegraph.stage), height = null !== (_e = customLayoutObj.rootContainer.AABBBounds.height()) && void 0 !== _e ? _e : 0, renderDefault = customLayoutObj.renderDefault, enableCellPadding = customLayoutObj.enableCellPadding) : (height = 0, renderDefault = customLayoutObj.renderDefault, enableCellPadding = customLayoutObj.enableCellPadding);
@@ -54924,11 +55134,15 @@
54924
55134
  height += padding[0] + padding[2];
54925
55135
  }
54926
55136
  return {
54927
- height: height / spanRow,
55137
+ height: getMergedCellSingleRowHeight(height / spanRow, spanRow, table),
54928
55138
  renderDefault: renderDefault
54929
55139
  };
54930
55140
  }
54931
55141
  }
55142
+ function shouldSkipCustomRenderCellValueForComputation$1(col, row, table) {
55143
+ var _a, _b;
55144
+ return table.isListTable() && !table.isHeader(col, row) && !(null === (_b = null === (_a = table.internalProps.dataSource) || void 0 === _a ? void 0 : _a.dataSourceObj) || void 0 === _b ? void 0 : _b.records);
55145
+ }
54932
55146
  function computeTextHeight(col, row, cellType, table) {
54933
55147
  var _a, _b, _c, _d;
54934
55148
  let maxHeight = 0;
@@ -55012,7 +55226,14 @@
55012
55226
  maxHeight = (bounds.height() || ("number" == typeof lineHeight ? lineHeight : fontSize)) + (underline ? underlineOffset : 0);
55013
55227
  } else maxHeight = (null === (_d = table.options.customConfig) || void 0 === _d ? void 0 : _d.multilinesForXTable) ? lineHeight : lines.length * lineHeight;
55014
55228
  }
55015
- return (Math.max(maxHeight, iconHeight) + padding[0] + padding[2]) / spanRow;
55229
+ return getMergedCellSingleRowHeight((Math.max(maxHeight, iconHeight) + padding[0] + padding[2]) / spanRow, spanRow, table);
55230
+ }
55231
+ function getMergedCellSingleRowHeight(height, spanRow, table) {
55232
+ var _a;
55233
+ if (spanRow <= 1) return height;
55234
+ const configuredMinHeight = null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.minSingleRowHeight,
55235
+ minSingleRowHeight = isNumber$3(configuredMinHeight) && configuredMinHeight > 0 ? configuredMinHeight : 2;
55236
+ return Math.max(height, minSingleRowHeight);
55016
55237
  }
55017
55238
  function getCellRect$1(col, row, table) {
55018
55239
  return {
@@ -55025,14 +55246,15 @@
55025
55246
  };
55026
55247
  }
55027
55248
 
55028
- function updateRowHeight(scene, row, detaY, skipTableHeightMap) {
55029
- !skipTableHeightMap && detaY && scene.table._setRowHeight(row, scene.table.getRowHeight(row) + detaY, !0);
55249
+ function updateRowHeight(scene, row, detaY, skipTableHeightMap, pendingCornerCustomMergeRanges) {
55250
+ const shouldFlushCornerCustomMergeRanges = !pendingCornerCustomMergeRanges;
55251
+ null != pendingCornerCustomMergeRanges || (pendingCornerCustomMergeRanges = new Map()), !skipTableHeightMap && detaY && scene.table._setRowHeight(row, scene.table.getRowHeight(row) + detaY, !0);
55030
55252
  for (let col = 0; col < scene.table.colCount; col++) {
55031
55253
  const cell = scene.getCell(col, row);
55032
55254
  if ("empty" === cell.role) continue;
55033
55255
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
55034
55256
  if (mergeInfo && mergeInfo.start.col !== col) continue;
55035
- updateCellHeightForRow(scene, cell, col, row, cell.attribute.height + detaY, detaY, scene.table.isHeader(col, row)), scene.updateCellContentWhileResize(col, row);
55257
+ updateCellHeightForRow(scene, cell, col, row, cell.attribute.height + detaY, detaY, scene.table.isHeader(col, row), pendingCornerCustomMergeRanges), scene.updateCellContentWhileResize(col, row);
55036
55258
  }
55037
55259
  let rowStart = 0,
55038
55260
  rowEnd = 0;
@@ -55041,11 +55263,12 @@
55041
55263
  const cellGroup = scene.highPerformanceGetCell(colIndex, rowIndex);
55042
55264
  "cell" === cellGroup.role && cellGroup.setAttribute("y", cellGroup.attribute.y + detaY);
55043
55265
  }
55266
+ shouldFlushCornerCustomMergeRanges && flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, scene.table);
55044
55267
  }
55045
- function updateCellHeightForRow(scene, cell, col, row, height, detaY, isHeader) {
55046
- cell && updateCellHeight(scene, cell, col, row, height, detaY);
55268
+ function updateCellHeightForRow(scene, cell, col, row, height, detaY, isHeader, pendingCornerCustomMergeRanges) {
55269
+ cell && updateCellHeight(scene, cell, col, row, height, detaY, isHeader, pendingCornerCustomMergeRanges);
55047
55270
  }
55048
- function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHeader) {
55271
+ function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHeader, pendingCornerCustomMergeRanges) {
55049
55272
  var _a, _b, _c;
55050
55273
  if (cell.attribute.height === distHeight && !cell.needUpdateHeight) return;
55051
55274
  cell.needUpdateHeight = !1, cell.setAttribute("height", distHeight);
@@ -55062,16 +55285,23 @@
55062
55285
  (null == columnDefine ? void 0 : columnDefine.mergeCell) && (range = scene.table.getCellRange(col, row));
55063
55286
  const newBarCell = Factory.getFunction("createProgressBarCell")(columnDefine, style, cell.attribute.width, value, dataValue, col, row, padding, scene.table, range),
55064
55287
  oldBarCell = cell.getChildByName("progress-bar");
55065
- cell.insertBefore(newBarCell, oldBarCell), cell.removeChild(oldBarCell), oldBarCell.removeAllChild(), oldBarCell.release(), updateMergeCellContentHeight(cell, distHeight, detaY, scene.table.isAutoRowHeight(row), !0, scene.table);
55288
+ cell.insertBefore(newBarCell, oldBarCell), cell.removeChild(oldBarCell), oldBarCell.removeAllChild(), oldBarCell.release(), updateMergeCellContentHeight(cell, distHeight, detaY, scene.table.isAutoRowHeight(row), !0, scene.table, !0, pendingCornerCustomMergeRanges);
55066
55289
  } else if ("sparkline" === type) {
55067
55290
  cell.removeAllChild();
55068
55291
  const headerStyle = scene.table._getCellStyle(col, row),
55069
55292
  padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
55070
55293
  Factory.getFunction("createSparkLineCellGroup")(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table, getStyleTheme(headerStyle, scene.table, col, row, getProp).theme, !1);
55071
- } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cell, col, row, 0, detaY, scene.table);else if ("axis" === (null === (_b = cell.firstChild) || void 0 === _b ? void 0 : _b.name)) null === (_c = cell.firstChild) || void 0 === _c || _c.originAxis.resize(cell.attribute.width, cell.attribute.height);else {
55294
+ } else if ("image" === type || "video" === type || "audio" === type) updateImageCellContentWhileResize(cell, col, row, 0, detaY, scene.table);else if ("axis" === (null === (_b = cell.firstChild) || void 0 === _b ? void 0 : _b.name)) null === (_c = cell.firstChild) || void 0 === _c || _c.originAxis.resize(cell.attribute.width, cell.attribute.height);else {
55072
55295
  let renderDefault = !0;
55073
55296
  const customContainer = cell.getChildByName(CUSTOM_CONTAINER_NAME) || cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
55074
55297
  if (customContainer) {
55298
+ if (scene.table.reactCustomLayout) {
55299
+ const mergeRange = isMergeCellGroup(cell) ? scene.table.getCellRange(cell.mergeStartCol, cell.mergeStartRow) : void 0,
55300
+ shouldUseMergeStart = mergeRange && isCornerCustomMergeRange(mergeRange, scene.table),
55301
+ removeCol = shouldUseMergeStart ? mergeRange.start.col : col,
55302
+ removeRow = shouldUseMergeStart ? mergeRange.start.row : row;
55303
+ scene.table.reactCustomLayout.removeCustomCell(removeCol, removeRow);
55304
+ }
55075
55305
  let customElementsGroup;
55076
55306
  cell.removeChild(customContainer);
55077
55307
  const customMergeRange = getCustomCellMergeCustom(col, row, cell, scene.table);
@@ -55079,7 +55309,7 @@
55079
55309
  if (mergeRow === row) continue;
55080
55310
  const mergedCell = scene.getCell(col, mergeRow),
55081
55311
  customContainer = mergedCell.getChildByName(CUSTOM_CONTAINER_NAME) || mergedCell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
55082
- customContainer.removeAllChild(), mergedCell.removeChild(customContainer), getCustomCellMergeCustom(col, mergeRow, mergedCell, scene.table);
55312
+ customContainer && (customContainer.removeAllChild(), mergedCell.removeChild(customContainer)), getCustomCellMergeCustom(col, mergeRow, mergedCell, scene.table);
55083
55313
  } else {
55084
55314
  let customRender, customLayout;
55085
55315
  const cellLocation = scene.table.getCellLocation(col, row),
@@ -55094,31 +55324,31 @@
55094
55324
  customRender = (null == define ? void 0 : define.customRender) || scene.table.customRender, customLayout = null == define ? void 0 : define.customLayout;
55095
55325
  }
55096
55326
  if ((customRender || customLayout) && isMergeCellGroup(cell)) for (let mergeCol = cell.mergeStartCol; mergeCol <= cell.mergeEndCol; mergeCol++) for (let mergeRow = cell.mergeStartRow; mergeRow <= cell.mergeEndRow; mergeRow++) mergeRow !== row && scene.updateCellContent(mergeCol, mergeRow);
55097
- if (customLayout || customRender) {
55098
- const style = scene.table._getCellStyle(col, row),
55099
- padding = getQuadProps(getProp("padding", style, col, row, scene.table));
55100
- let width = cell.attribute.width,
55101
- height = cell.attribute.height;
55102
- isMergeCellGroup(cell) && (width = scene.table.getColsWidth(cell.mergeStartCol, cell.mergeEndCol), height = scene.table.getRowsHeight(cell.mergeStartRow, cell.mergeEndRow));
55103
- const customResult = dealWithCustom(customLayout, customRender, col, row, width, height, !1, scene.table.isAutoRowHeight(row), padding, isMergeCellGroup(cell) ? {
55104
- start: {
55105
- col: cell.mergeStartCol,
55106
- row: cell.mergeStartRow
55107
- },
55108
- end: {
55109
- col: cell.mergeEndCol,
55110
- row: cell.mergeEndRow
55111
- }
55112
- } : void 0, scene.table);
55113
- customElementsGroup = customResult.elementsGroup, renderDefault = customResult.renderDefault;
55327
+ const mergeRange = isMergeCellGroup(cell) ? scene.table.getCellRange(cell.mergeStartCol, cell.mergeStartRow) : void 0;
55328
+ if (shouldRenderCornerCustomMergeContent(col, row, mergeRange, scene.table)) {
55329
+ if (customLayout || customRender) {
55330
+ const style = scene.table._getCellStyle(col, row),
55331
+ padding = getQuadProps(getProp("padding", style, col, row, scene.table));
55332
+ let width = cell.attribute.width,
55333
+ height = cell.attribute.height;
55334
+ isMergeCellGroup(cell) && (width = scene.table.getColsWidth(cell.mergeStartCol, cell.mergeEndCol), height = scene.table.getRowsHeight(cell.mergeStartRow, cell.mergeEndRow));
55335
+ let customCol = col,
55336
+ customRow = row;
55337
+ mergeRange && isCornerCustomMergeRange(mergeRange, scene.table) && (customCol = mergeRange.start.col, customRow = mergeRange.start.row);
55338
+ const customResult = dealWithCustom(customLayout, customRender, customCol, customRow, width, height, !1, scene.table.isAutoRowHeight(row), padding, mergeRange, scene.table);
55339
+ customElementsGroup = createCornerCustomMergeContainer(customResult.elementsGroup, width, height, mergeRange, scene.table), renderDefault = customResult.renderDefault;
55340
+ }
55341
+ } else renderDefault = !1;
55342
+ if (cell.childrenCount > 0 && customElementsGroup ? cell.insertBefore(customElementsGroup, cell.firstChild) : customElementsGroup && cell.appendChild(customElementsGroup), isMergeCellGroup(cell)) {
55343
+ const mergeRange = scene.table.getCellRange(cell.mergeStartCol, cell.mergeStartRow);
55344
+ isCornerCustomMergeRange(mergeRange, scene.table) && cell.setAttribute("clip", !shouldRenderCornerCustomMergeContent(col, row, mergeRange, scene.table));
55114
55345
  }
55115
- cell.childrenCount > 0 && customElementsGroup ? cell.insertBefore(customElementsGroup, cell.firstChild) : customElementsGroup && cell.appendChild(customElementsGroup);
55116
55346
  }
55117
55347
  }
55118
- updateMergeCellContentHeight(cell, distHeight, detaY, scene.table.isAutoRowHeight(row), renderDefault, scene.table);
55348
+ updateMergeCellContentHeight(cell, distHeight, detaY, scene.table.isAutoRowHeight(row), renderDefault, scene.table, !customContainer, pendingCornerCustomMergeRanges);
55119
55349
  }
55120
55350
  }
55121
- function updateMergeCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, renderDefault, table) {
55351
+ function updateMergeCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, renderDefault, table, refreshCornerCustomMergeContent = !0, pendingCornerCustomMergeRanges) {
55122
55352
  if (isMergeCellGroup(cellGroup)) {
55123
55353
  distHeight = 0;
55124
55354
  for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) distHeight += table.getRowHeight(row);
@@ -55158,6 +55388,8 @@
55158
55388
  }, table);
55159
55389
  widthChange && (singleCellGroup.needUpdateWidth = !0);
55160
55390
  }
55391
+ const mergeRange = table.getCellRange(cellGroup.mergeStartCol, cellGroup.mergeStartRow);
55392
+ refreshCornerCustomMergeContent && isCornerCustomMergeRange(mergeRange, table) && queueCornerCustomMergeContentUpdate(mergeRange, table, pendingCornerCustomMergeRanges);
55161
55393
  } else {
55162
55394
  const style = table._getCellStyle(cellGroup.col, cellGroup.row),
55163
55395
  padding = getQuadProps(getProp("padding", style, cellGroup.col, cellGroup.row, table));
@@ -55165,19 +55397,20 @@
55165
55397
  }
55166
55398
  }
55167
55399
 
55168
- function updateColWidth(scene, col, detaX, skipTableWidthMap) {
55169
- skipTableWidthMap || scene.table._setColWidth(col, scene.table.getColWidth(col) + detaX, !0);
55400
+ function updateColWidth(scene, col, detaX, skipTableWidthMap, pendingCornerCustomMergeRanges) {
55401
+ const shouldFlushCornerCustomMergeRanges = !pendingCornerCustomMergeRanges;
55402
+ null != pendingCornerCustomMergeRanges || (pendingCornerCustomMergeRanges = new Map()), skipTableWidthMap || scene.table._setColWidth(col, scene.table.getColWidth(col) + detaX, !0);
55170
55403
  const colOrCornerHeaderColumn = scene.getColGroup(col, !0),
55171
55404
  rightTopColumn = scene.getColGroupInRightTopCorner(col);
55172
- colOrCornerHeaderColumn && !rightTopColumn && updateColunmWidth(colOrCornerHeaderColumn, detaX, "col-corner", scene), rightTopColumn && updateColunmWidth(rightTopColumn, detaX, "right-top", scene);
55405
+ colOrCornerHeaderColumn && !rightTopColumn && updateColunmWidth(colOrCornerHeaderColumn, detaX, "col-corner", scene, pendingCornerCustomMergeRanges), rightTopColumn && updateColunmWidth(rightTopColumn, detaX, "right-top", scene, pendingCornerCustomMergeRanges);
55173
55406
  const rowHeaderOrBodyColumn = scene.getColGroup(col);
55174
- rowHeaderOrBodyColumn && updateColunmWidth(rowHeaderOrBodyColumn, detaX, "row-body", scene);
55407
+ rowHeaderOrBodyColumn && updateColunmWidth(rowHeaderOrBodyColumn, detaX, "row-body", scene, pendingCornerCustomMergeRanges);
55175
55408
  const leftBottomColumn = scene.getColGroupInLeftBottomCorner(col);
55176
- leftBottomColumn && updateColunmWidth(leftBottomColumn, detaX, "left-bottom", scene);
55409
+ leftBottomColumn && updateColunmWidth(leftBottomColumn, detaX, "left-bottom", scene, pendingCornerCustomMergeRanges);
55177
55410
  const bottomColumn = scene.getColGroupInBottom(col);
55178
- bottomColumn && updateColunmWidth(bottomColumn, detaX, "bottom", scene);
55411
+ bottomColumn && updateColunmWidth(bottomColumn, detaX, "bottom", scene, pendingCornerCustomMergeRanges);
55179
55412
  const rightBottomColumn = scene.getColGroupInRightBottomCorner(col);
55180
- rightBottomColumn && updateColunmWidth(rightBottomColumn, detaX, "right-bottom", scene), col < scene.frozenColCount ? (scene.cornerHeaderGroup.forEachChildrenSkipChild((column, index) => {
55413
+ rightBottomColumn && updateColunmWidth(rightBottomColumn, detaX, "right-bottom", scene, pendingCornerCustomMergeRanges), col < scene.frozenColCount ? (scene.cornerHeaderGroup.forEachChildrenSkipChild((column, index) => {
55181
55414
  column.col > col && column.setAttribute("x", column.attribute.x + detaX);
55182
55415
  }), scene.rowHeaderGroup.forEachChildrenSkipChild((column, index) => {
55183
55416
  column.col > col && column.setAttribute("x", column.attribute.x + detaX);
@@ -55191,14 +55424,14 @@
55191
55424
  column.col > col && column.setAttribute("x", column.attribute.x + detaX);
55192
55425
  }), rightBottomColumn && scene.rightBottomCornerGroup.forEachChildrenSkipChild((column, index) => {
55193
55426
  column.col > col && column.setAttribute("x", column.attribute.x + detaX);
55194
- });
55427
+ }), shouldFlushCornerCustomMergeRanges && flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, scene.table);
55195
55428
  }
55196
- function updateColunmWidth(columnGroup, detaX, mode, scene) {
55429
+ function updateColunmWidth(columnGroup, detaX, mode, scene, pendingCornerCustomMergeRanges) {
55197
55430
  var _a, _b, _c, _d, _e, _f, _g;
55198
55431
  let needRerangeRow = !1;
55199
55432
  const oldColumnWidth = null !== (_a = null == columnGroup ? void 0 : columnGroup.attribute.width) && void 0 !== _a ? _a : 0;
55200
55433
  if (null == columnGroup || columnGroup.setAttribute("width", oldColumnWidth + detaX), null == columnGroup || columnGroup.forEachChildren((cell, index) => {
55201
- if (updateCellWidth(scene, cell, cell.col, cell.row, oldColumnWidth, oldColumnWidth + detaX, detaX, "row-body" !== mode || cell.col < scene.table.rowHeaderLevelCount, scene.table.internalProps.autoWrapText)) {
55434
+ if (updateCellWidth(scene, cell, cell.col, cell.row, oldColumnWidth, oldColumnWidth + detaX, detaX, "row-body" !== mode || cell.col < scene.table.rowHeaderLevelCount, scene.table.internalProps.autoWrapText, pendingCornerCustomMergeRanges)) {
55202
55435
  const mergeInfo = getCellMergeInfo(scene.table, cell.col, cell.row);
55203
55436
  if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) resetRowHeight(scene, row);else resetRowHeight(scene, cell.row);
55204
55437
  needRerangeRow = !0;
@@ -55240,7 +55473,7 @@
55240
55473
  }
55241
55474
  }
55242
55475
  }
55243
- function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoWrapText) {
55476
+ function updateCellWidth(scene, cell, col, row, oldWidth, distWidth, detaX, isHeader, autoWrapText, pendingCornerCustomMergeRanges) {
55244
55477
  var _a, _b, _c, _d, _e;
55245
55478
  if (cell.attribute.width === distWidth && !cell.needUpdateWidth) return !1;
55246
55479
  cell.needUpdateWidth = !1, cell.setAttribute("width", distWidth);
@@ -55262,14 +55495,14 @@
55262
55495
  const newBarCell = Factory.getFunction("createProgressBarCell")(columnDefine, style, cellGroup.attribute.width, value, dataValue, col, row, padding, scene.table, range),
55263
55496
  oldBarCell = cellGroup.getChildByName("progress-bar");
55264
55497
  cellGroup.insertBefore(newBarCell, oldBarCell), cellGroup.removeChild(oldBarCell), oldBarCell.removeAllChild(), oldBarCell.release();
55265
- const cellChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, !0, scene.table);
55498
+ const cellChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, !0, scene.table, !0, pendingCornerCustomMergeRanges);
55266
55499
  isHeightChange = isHeightChange || cellChange;
55267
55500
  } else if ("sparkline" === type) {
55268
55501
  cellGroup.removeAllChild();
55269
55502
  const headerStyle = scene.table._getCellStyle(col, row),
55270
55503
  padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
55271
55504
  Factory.getFunction("createSparkLineCellGroup")(cellGroup, cellGroup.parent, cellGroup.attribute.x, cellGroup.attribute.y, col, row, cellGroup.attribute.width, cellGroup.attribute.height, padding, scene.table, getStyleTheme(headerStyle, scene.table, col, row, getProp).theme, !1);
55272
- } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cellGroup, col, row, detaX, 0, scene.table);else if ("axis" === (null === (_b = cellGroup.firstChild) || void 0 === _b ? void 0 : _b.name)) {
55505
+ } else if ("image" === type || "video" === type || "audio" === type) updateImageCellContentWhileResize(cellGroup, col, row, detaX, 0, scene.table);else if ("axis" === (null === (_b = cellGroup.firstChild) || void 0 === _b ? void 0 : _b.name)) {
55273
55506
  const axisConfig = scene.table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row),
55274
55507
  cellStyle = scene.table._getCellStyle(col, row),
55275
55508
  padding = getQuadProps(getProp("padding", cellStyle, col, row, scene.table));
@@ -55281,6 +55514,13 @@
55281
55514
  let renderDefault = !0;
55282
55515
  const customContainer = cell.getChildByName(CUSTOM_CONTAINER_NAME) || cell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
55283
55516
  if (customContainer) {
55517
+ if (scene.table.reactCustomLayout) {
55518
+ const mergeRange = isMergeCellGroup(cellGroup) ? scene.table.getCellRange(cellGroup.mergeStartCol, cellGroup.mergeStartRow) : void 0,
55519
+ shouldUseMergeStart = mergeRange && isCornerCustomMergeRange(mergeRange, scene.table),
55520
+ removeCol = shouldUseMergeStart ? mergeRange.start.col : col,
55521
+ removeRow = shouldUseMergeStart ? mergeRange.start.row : row;
55522
+ scene.table.reactCustomLayout.removeCustomCell(removeCol, removeRow);
55523
+ }
55284
55524
  let customElementsGroup;
55285
55525
  cell.removeChild(customContainer);
55286
55526
  const customMergeRange = getCustomCellMergeCustom(col, row, cell, scene.table);
@@ -55288,7 +55528,7 @@
55288
55528
  if (mergeCol === col) continue;
55289
55529
  const mergedCell = scene.getCell(mergeCol, row),
55290
55530
  customContainer = mergedCell.getChildByName(CUSTOM_CONTAINER_NAME) || mergedCell.getChildByName(CUSTOM_MERGE_CONTAINER_NAME);
55291
- customContainer.removeAllChild(), mergedCell.removeChild(customContainer), getCustomCellMergeCustom(mergeCol, row, mergedCell, scene.table);
55531
+ customContainer && (customContainer.removeAllChild(), mergedCell.removeChild(customContainer)), getCustomCellMergeCustom(mergeCol, row, mergedCell, scene.table);
55292
55532
  } else {
55293
55533
  let customRender, customLayout;
55294
55534
  const cellType = scene.table.getCellLocation(col, row),
@@ -55303,28 +55543,28 @@
55303
55543
  customRender = (null == define ? void 0 : define.customRender) || scene.table.customRender, customLayout = null == define ? void 0 : define.customLayout;
55304
55544
  }
55305
55545
  if ((customRender || customLayout) && isMergeCellGroup(cellGroup)) for (let mergeCol = cellGroup.mergeStartCol; mergeCol <= cellGroup.mergeEndCol; mergeCol++) if (mergeCol !== col) for (let mergeRow = cellGroup.mergeStartRow; mergeRow <= cellGroup.mergeEndRow; mergeRow++) scene.updateCellContent(mergeCol, mergeRow);
55306
- if (customLayout || customRender) {
55307
- const style = scene.table._getCellStyle(col, row),
55308
- padding = getQuadProps(getProp("padding", style, col, row, scene.table));
55309
- let width = cellGroup.attribute.width,
55310
- height = cellGroup.attribute.height;
55311
- isMergeCellGroup(cellGroup) && (width = scene.table.getColsWidth(cellGroup.mergeStartCol, cellGroup.mergeEndCol), height = scene.table.getRowsHeight(cellGroup.mergeStartRow, cellGroup.mergeEndRow));
55312
- const customResult = dealWithCustom(customLayout, customRender, col, row, width, height, !1, scene.table.isAutoRowHeight(row), padding, isMergeCellGroup(cellGroup) ? {
55313
- start: {
55314
- col: cellGroup.mergeStartCol,
55315
- row: cellGroup.mergeStartRow
55316
- },
55317
- end: {
55318
- col: cellGroup.mergeEndCol,
55319
- row: cellGroup.mergeEndRow
55320
- }
55321
- } : void 0, scene.table);
55322
- customElementsGroup = customResult.elementsGroup, renderDefault = customResult.renderDefault, isHeightChange = !0;
55546
+ const mergeRange = isMergeCellGroup(cellGroup) ? scene.table.getCellRange(cellGroup.mergeStartCol, cellGroup.mergeStartRow) : void 0;
55547
+ if (shouldRenderCornerCustomMergeContent(col, row, mergeRange, scene.table)) {
55548
+ if (customLayout || customRender) {
55549
+ const style = scene.table._getCellStyle(col, row),
55550
+ padding = getQuadProps(getProp("padding", style, col, row, scene.table));
55551
+ let width = cellGroup.attribute.width,
55552
+ height = cellGroup.attribute.height;
55553
+ isMergeCellGroup(cellGroup) && (width = scene.table.getColsWidth(cellGroup.mergeStartCol, cellGroup.mergeEndCol), height = scene.table.getRowsHeight(cellGroup.mergeStartRow, cellGroup.mergeEndRow));
55554
+ let customCol = col,
55555
+ customRow = row;
55556
+ mergeRange && isCornerCustomMergeRange(mergeRange, scene.table) && (customCol = mergeRange.start.col, customRow = mergeRange.start.row);
55557
+ const customResult = dealWithCustom(customLayout, customRender, customCol, customRow, width, height, !1, scene.table.isAutoRowHeight(row), padding, mergeRange, scene.table);
55558
+ customElementsGroup = createCornerCustomMergeContainer(customResult.elementsGroup, width, height, mergeRange, scene.table), renderDefault = customResult.renderDefault, isHeightChange = !0;
55559
+ }
55560
+ } else renderDefault = !1;
55561
+ if (cell.childrenCount > 0 && customElementsGroup ? cell.insertBefore(customElementsGroup, cell.firstChild) : customElementsGroup && cell.appendChild(customElementsGroup), isMergeCellGroup(cellGroup)) {
55562
+ const mergeRange = scene.table.getCellRange(cellGroup.mergeStartCol, cellGroup.mergeStartRow);
55563
+ isCornerCustomMergeRange(mergeRange, scene.table) && cell.setAttribute("clip", !shouldRenderCornerCustomMergeContent(col, row, mergeRange, scene.table));
55323
55564
  }
55324
- cell.childrenCount > 0 && customElementsGroup ? cell.insertBefore(customElementsGroup, cell.firstChild) : customElementsGroup && cell.appendChild(customElementsGroup);
55325
55565
  }
55326
55566
  }
55327
- const cellChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, renderDefault, scene.table);
55567
+ const cellChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, renderDefault, scene.table, !customContainer, pendingCornerCustomMergeRanges);
55328
55568
  isHeightChange = isHeightChange || cellChange;
55329
55569
  }
55330
55570
  if (!autoWrapText) {
@@ -55332,7 +55572,7 @@
55332
55572
  }
55333
55573
  return !(!autoRowHeight || !autoWrapText) && isHeightChange;
55334
55574
  }
55335
- function updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, renderDefault, table) {
55575
+ function updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, renderDefault, table, refreshCornerCustomMergeContent = !0, pendingCornerCustomMergeRanges) {
55336
55576
  if (isMergeCellGroup(cellGroup)) {
55337
55577
  distWidth = 0;
55338
55578
  let isHeightChange = !1;
@@ -55386,7 +55626,8 @@
55386
55626
  }, table);
55387
55627
  heightChange && (singleCellGroup.needUpdateHeight = !0), isHeightChange = isHeightChange || changed;
55388
55628
  }
55389
- return isHeightChange;
55629
+ const mergeRange = table.getCellRange(cellGroup.mergeStartCol, cellGroup.mergeStartRow);
55630
+ return refreshCornerCustomMergeContent && isCornerCustomMergeRange(mergeRange, table) && queueCornerCustomMergeContentUpdate(mergeRange, table, pendingCornerCustomMergeRanges), isHeightChange;
55390
55631
  }
55391
55632
  const style = table._getCellStyle(cellGroup.col, cellGroup.row),
55392
55633
  padding = getQuadProps(getProp("padding", style, cellGroup.col, cellGroup.row, table)),
@@ -56794,17 +57035,18 @@
56794
57035
  renderDefault = !1,
56795
57036
  enableCellPadding = !1;
56796
57037
  (table.isHeader(col, row) || (null === (_a = table.getBodyColumnDefine(col, row)) || void 0 === _a ? void 0 : _a.mergeCell) || table.hasCustomMerge()) && (cellRange = table.getCellRange(col, row), spanCol = cellRange.end.col - cellRange.start.col + 1);
56797
- const arg = {
56798
- col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
56799
- row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
56800
- dataValue: table.getCellOriginValue(col, row),
56801
- value: table.getCellValue(col, row),
56802
- rect: getCellRect(col, row, table),
56803
- table: table,
56804
- originCol: col,
56805
- originRow: row,
56806
- forComputation: !0
56807
- };
57038
+ const skipCellValue = shouldSkipCustomRenderCellValueForComputation(col, row, table),
57039
+ arg = {
57040
+ col: null !== (_b = null == cellRange ? void 0 : cellRange.start.col) && void 0 !== _b ? _b : col,
57041
+ row: null !== (_c = null == cellRange ? void 0 : cellRange.start.row) && void 0 !== _c ? _c : row,
57042
+ dataValue: skipCellValue ? void 0 : table.getCellOriginValue(col, row),
57043
+ value: skipCellValue ? void 0 : table.getCellValue(col, row),
57044
+ rect: getCellRect(col, row, table),
57045
+ table: table,
57046
+ originCol: col,
57047
+ originRow: row,
57048
+ forComputation: !0
57049
+ };
56808
57050
  if ("react-custom-layout" === customLayout && (customLayout = (null === (_d = table.reactCustomLayout) || void 0 === _d ? void 0 : _d.getCustomLayoutFunc(col, row)) || emptyCustomLayout), isFunction$3(customLayout)) {
56809
57051
  const customLayoutObj = customLayout(arg);
56810
57052
  if (customLayoutObj.rootContainer) {
@@ -56827,6 +57069,10 @@
56827
57069
  };
56828
57070
  }
56829
57071
  }
57072
+ function shouldSkipCustomRenderCellValueForComputation(col, row, table) {
57073
+ var _a, _b;
57074
+ return table.isListTable() && !table.isHeader(col, row) && !(null === (_b = null === (_a = table.internalProps.dataSource) || void 0 === _a ? void 0 : _a.dataSourceObj) || void 0 === _b ? void 0 : _b.records);
57075
+ }
56830
57076
  function computeTextWidth(col, row, cellType, table) {
56831
57077
  var _a, _b, _c, _d;
56832
57078
  let maxWidth = 0;
@@ -56936,8 +57182,12 @@
56936
57182
  const maxWidthColumnMap = new Map(),
56937
57183
  minWidthColumnMap = new Map();
56938
57184
  for (let col = startCol; col < endColPlus1; col++) {
56939
- const width = update && null !== (_a = newWidths[col]) && void 0 !== _a ? _a : table.getColWidth(col),
56940
- maxWidth = table.getMaxColWidth(col),
57185
+ const width = update && null !== (_a = newWidths[col]) && void 0 !== _a ? _a : table.getColWidth(col);
57186
+ if ("adaptive" === table.widthMode && table.internalProps._widthResizedColMap.has(col)) {
57187
+ totalDrawWidth -= width;
57188
+ continue;
57189
+ }
57190
+ const maxWidth = table.getMaxColWidth(col),
56941
57191
  minWidth = table.getMinColWidth(col);
56942
57192
  if (actualWidth += width, adaptiveColumns.push(col), maxWidth === width ? maxWidthColumnMap.set(col, width) : minWidth === width && minWidthColumnMap.set(col, width), null === (_b = table.options.customConfig) || void 0 === _b ? void 0 : _b.shrinkSparklineFirst) {
56943
57193
  "sparkline" === table.getBodyColumnType(col, 0) && (sparklineColumns.push({
@@ -57082,9 +57332,10 @@
57082
57332
  }
57083
57333
  const type = isVtableMerge || isCustomMerge ? "text" : table.getCellType(col, row);
57084
57334
  if (isPromise(value)) {
57085
- createEmptyCellGroup(col, row, 0, y, cellWidth, cellHeight, columnGroup), dealPromiseData(value, table, callCreateCellForPromiseValue.bind(null, {
57335
+ const cellGroup = createEmptyCellGroup(col, row, 0, y, cellWidth, cellHeight, columnGroup),
57336
+ updateToken = nextPromiseCellUpdateToken(cellGroup);
57337
+ dealPromiseData(value, table, callCreateCellForPromiseValue.bind(null, {
57086
57338
  type: type,
57087
- value: value,
57088
57339
  define: define,
57089
57340
  table: table,
57090
57341
  col: col,
@@ -57099,7 +57350,10 @@
57099
57350
  cellLocation: cellLocation,
57100
57351
  range: range,
57101
57352
  customResult: customResult,
57102
- defaultRowHeight: defaultRowHeight
57353
+ defaultRowHeight: defaultRowHeight,
57354
+ promiseValue: value,
57355
+ oldCellGroup: cellGroup,
57356
+ updateToken: updateToken
57103
57357
  })), columnGroup.updateColumnRowNumber(row);
57104
57358
  const height = table.getRowHeight(row);
57105
57359
  columnGroup.updateColumnHeight(height), y += height;
@@ -57126,30 +57380,33 @@
57126
57380
  height: y
57127
57381
  };
57128
57382
  }
57129
- function callCreateCellForPromiseValue(createCellArgs) {
57383
+ function callCreateCellForPromiseValue(createCellArgs, resolvedValue) {
57130
57384
  let padding, textAlign, textBaseline;
57131
57385
  const {
57132
- type: type,
57133
- value: value,
57134
- define: define,
57135
- table: table,
57136
- col: col,
57137
- row: row,
57138
- colWidth: colWidth,
57139
- cellWidth: cellWidth,
57140
- cellHeight: cellHeight,
57141
- columnGroup: columnGroup,
57142
- y: y,
57143
- cellLocation: cellLocation,
57144
- mayHaveIcon: mayHaveIcon,
57145
- customStyle: customStyle,
57146
- range: range,
57147
- customResult: customResult,
57148
- defaultRowHeight: defaultRowHeight
57149
- } = createCellArgs,
57150
- cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
57386
+ type: type,
57387
+ define: define,
57388
+ table: table,
57389
+ col: col,
57390
+ row: row,
57391
+ colWidth: colWidth,
57392
+ cellWidth: cellWidth,
57393
+ cellHeight: cellHeight,
57394
+ columnGroup: columnGroup,
57395
+ y: y,
57396
+ cellLocation: cellLocation,
57397
+ mayHaveIcon: mayHaveIcon,
57398
+ customStyle: customStyle,
57399
+ range: range,
57400
+ customResult: customResult,
57401
+ defaultRowHeight: defaultRowHeight,
57402
+ promiseValue: promiseValue,
57403
+ oldCellGroup: oldCellGroup,
57404
+ updateToken: updateToken
57405
+ } = createCellArgs;
57406
+ if (!isPromiseCellUpdateCurrent(table, col, row, oldCellGroup, updateToken)) return;
57407
+ const cellStyle = customStyle || table._getCellStyle(range ? range.start.col : col, range ? range.start.row : row),
57151
57408
  cellTheme = getStyleTheme(cellStyle, table, range ? range.start.col : col, range ? range.start.row : row, getProp).theme;
57152
- 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);
57409
+ 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, promiseValue, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, resolvedValue);
57153
57410
  }
57154
57411
  function dealMerge(range, mergeMap, table, forceUpdate) {
57155
57412
  let cellWidth = 0,
@@ -57175,7 +57432,7 @@
57175
57432
  width: width,
57176
57433
  height: height
57177
57434
  });
57178
- cellGroup.role = "cell", cellGroup.col = col, cellGroup.row = row, columnGroup.addChild(cellGroup);
57435
+ return cellGroup.role = "cell", cellGroup.col = col, cellGroup.row = row, columnGroup.addChild(cellGroup), cellGroup;
57179
57436
  }
57180
57437
 
57181
57438
  function createColGroup(containerGroup, xOrigin, yOrigin, colStart, colEnd, rowStart, rowEnd, cellLocation, table, rowLimit) {
@@ -57218,7 +57475,7 @@
57218
57475
  let targetRow = distRow;
57219
57476
  for (; targetRow < bodyBottomRow && table.getRowsHeight(table.frozenRowCount, targetRow) < visibleBodyHeight;) {
57220
57477
  const nextRow = targetRow + 1;
57221
- computeRowsHeight(table, nextRow, nextRow, !1), targetRow = nextRow;
57478
+ table.internalProps._heightResizedRowMap.has(nextRow) || computeRowsHeight(table, nextRow, nextRow, !1), targetRow = nextRow;
57222
57479
  }
57223
57480
  return targetRow;
57224
57481
  }
@@ -57238,7 +57495,20 @@
57238
57495
  let distCol, distRow, distColForCompute, distRowForCompute;
57239
57496
  proxy.setParamsForRow(), proxy.setParamsForColumn(), "adaptive" === table.widthMode || table.options.autoWrapText && ("adaptive" === table.heightMode || table.isAutoRowHeight(table.columnHeaderLevelCount)) ? (distColForCompute = table.colCount - 1, distCol = Math.min(proxy.firstScreenColLimit - 1, table.colCount - 1)) : distCol = Math.min(proxy.firstScreenColLimit - 1, table.colCount - 1), "adaptive" === table.heightMode ? (distRowForCompute = table.rowCount - 1, distRow = Math.min(proxy.firstScreenRowLimit - 1, table.rowCount - 1)) : distRow = Math.min(proxy.firstScreenRowLimit - 1, table.rowCount - 1);
57240
57497
  let bodyDistRow = Math.min(proxy.bodyBottomRow, distRow - table.bottomFrozenRowCount);
57241
- 0 === table.internalProps._widthResizedColMap.size && computeColsWidth(table, 0, null != distColForCompute ? distColForCompute : distCol), 0 === table.internalProps._heightResizedRowMap.size && (computeRowsHeight(table, 0, "auto" === table.options.canvasHeight || (null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.forceComputeAllRowHeight) ? table.rowCount - 1 : null != distRowForCompute ? distRowForCompute : distRow), "autoHeight" === table.heightMode && (bodyDistRow = fillVisibleBodyRows$1(proxy, bodyDistRow), syncVisibleBodyRows(proxy, bodyDistRow))), distCol < table.colCount - table.rightFrozenColCount && table.colCount - table.rightFrozenColCount <= table.colCount - 1 && computeColsWidth(table, table.colCount - table.rightFrozenColCount, table.colCount - 1), distRow < table.rowCount - table.bottomFrozenRowCount && table.rowCount - table.bottomFrozenRowCount <= table.rowCount - 1 && computeRowsHeight(table, table.rowCount - table.bottomFrozenRowCount, table.rowCount - 1), table.scenegraph.colHeaderGroup.setAttribute("x", table.getFrozenColsWidth()), table.scenegraph.rowHeaderGroup.setAttribute("y", table.getFrozenRowsHeight()), table.scenegraph.bottomFrozenGroup.setAttribute("x", table.getFrozenColsWidth()), table.scenegraph.rightFrozenGroup.setAttribute("y", table.getFrozenRowsHeight()), table.scenegraph.bodyGroup.setAttributes({
57498
+ const colEndForCompute = null != distColForCompute ? distColForCompute : distCol;
57499
+ let hasUnresizedColumns = !1;
57500
+ for (let col = 0; col <= colEndForCompute; col++) if (!table.internalProps._widthResizedColMap.has(col)) {
57501
+ hasUnresizedColumns = !0;
57502
+ break;
57503
+ }
57504
+ hasUnresizedColumns && computeColsWidth(table, 0, colEndForCompute);
57505
+ const rowEndForCompute = "auto" === table.options.canvasHeight || (null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.forceComputeAllRowHeight) ? table.rowCount - 1 : null != distRowForCompute ? distRowForCompute : distRow;
57506
+ let hasUnresizedRows = !1;
57507
+ for (let row = 0; row <= rowEndForCompute; row++) if (!table.internalProps._heightResizedRowMap.has(row)) {
57508
+ hasUnresizedRows = !0;
57509
+ break;
57510
+ }
57511
+ hasUnresizedRows && computeRowsHeight(table, 0, rowEndForCompute), "autoHeight" === table.heightMode && (bodyDistRow = fillVisibleBodyRows$1(proxy, bodyDistRow), syncVisibleBodyRows(proxy, bodyDistRow)), distCol < table.colCount - table.rightFrozenColCount && table.colCount - table.rightFrozenColCount <= table.colCount - 1 && computeColsWidth(table, table.colCount - table.rightFrozenColCount, table.colCount - 1), distRow < table.rowCount - table.bottomFrozenRowCount && table.rowCount - table.bottomFrozenRowCount <= table.rowCount - 1 && computeRowsHeight(table, table.rowCount - table.bottomFrozenRowCount, table.rowCount - 1), table.scenegraph.colHeaderGroup.setAttribute("x", table.getFrozenColsWidth()), table.scenegraph.rowHeaderGroup.setAttribute("y", table.getFrozenRowsHeight()), table.scenegraph.bottomFrozenGroup.setAttribute("x", table.getFrozenColsWidth()), table.scenegraph.rightFrozenGroup.setAttribute("y", table.getFrozenRowsHeight()), table.scenegraph.bodyGroup.setAttributes({
57242
57512
  x: table.getFrozenColsWidth(),
57243
57513
  y: table.getFrozenRowsHeight()
57244
57514
  }), createColGroup(cornerHeaderGroup, xOrigin, yOrigin, 0, table.frozenColCount - 1, 0, table.frozenRowCount - 1, table.isListTable() ? "columnHeader" : "cornerHeader", table), distCol - table.rightFrozenColCount >= table.frozenColCount && createColGroup(colHeaderGroup, xOrigin, yOrigin, table.frozenColCount, distCol - table.rightFrozenColCount, 0, table.frozenRowCount - 1, "columnHeader", table), table.frozenColCount > 0 && (table.leftRowSeriesNumberCount > 0 && createColGroup(rowHeaderGroup, xOrigin, yOrigin, 0, table.leftRowSeriesNumberCount - 1, table.frozenRowCount, bodyDistRow, "rowHeader", table), table.frozenColCount > table.leftRowSeriesNumberCount && createColGroup(rowHeaderGroup, xOrigin, yOrigin, table.leftRowSeriesNumberCount, Math.min(table.frozenColCount - 1, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount - 1), table.frozenRowCount, bodyDistRow, "rowHeader", table), table.frozenColCount > table.rowHeaderLevelCount + table.leftRowSeriesNumberCount && createColGroup(rowHeaderGroup, xOrigin, yOrigin, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, table.frozenColCount - 1, table.frozenRowCount, bodyDistRow, "body", table)), table.bottomFrozenRowCount > 0 && (table.frozenColCount > 0 && (table.leftRowSeriesNumberCount > 0 && createColGroup(leftBottomCornerGroup, xOrigin, yOrigin, 0, table.leftRowSeriesNumberCount - 1, table.rowCount - 1 - table.bottomFrozenRowCount + 1, table.rowCount - 1, "rowHeader", table), table.rowHeaderLevelCount > 0 && createColGroup(leftBottomCornerGroup, xOrigin, yOrigin, table.leftRowSeriesNumberCount, table.leftRowSeriesNumberCount + table.rowHeaderLevelCount - 1, table.rowCount - 1 - table.bottomFrozenRowCount + 1, table.rowCount - 1, "rowHeader", table), table.frozenColCount > table.rowHeaderLevelCount + table.leftRowSeriesNumberCount && createColGroup(leftBottomCornerGroup, xOrigin, yOrigin, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, table.frozenColCount - 1, table.rowCount - 1 - table.bottomFrozenRowCount + 1, table.rowCount - 1, "body", table)), distCol - table.rightFrozenColCount >= table.frozenColCount && createColGroup(bottomFrozenGroup, xOrigin, yOrigin, table.frozenColCount, distCol - table.rightFrozenColCount, table.rowCount - 1 - table.bottomFrozenRowCount + 1, table.rowCount - 1, table.isPivotChart() ? "rowHeader" : "body", table)), table.rightFrozenColCount > 0 && (createColGroup(rightTopCornerGroup, xOrigin, yOrigin, table.colCount - 1 - table.rightFrozenColCount + 1, table.colCount - 1, 0, table.frozenRowCount - 1, "columnHeader", table), createColGroup(rightFrozenGroup, xOrigin, yOrigin, table.colCount - 1 - table.rightFrozenColCount + 1, table.colCount - 1, table.frozenRowCount, bodyDistRow, table.isPivotChart() ? "rowHeader" : "body", table)), table.bottomFrozenRowCount > 0 && table.rightFrozenColCount > 0 && createColGroup(rightBottomCornerGroup, xOrigin, yOrigin, table.colCount - 1 - table.rightFrozenColCount + 1, table.colCount - 1, table.rowCount - 1 - table.bottomFrozenRowCount + 1, table.rowCount - 1, "body", table), distCol - table.rightFrozenColCount >= table.frozenColCount && createColGroup(bodyGroup, xOrigin, yOrigin, table.frozenColCount, distCol - table.rightFrozenColCount, table.frozenRowCount, bodyDistRow, "body", table), bodyGroup.firstChild || colHeaderGroup.firstChild || cornerHeaderGroup.firstChild || rowHeaderGroup.firstChild ? (proxy.currentRow = null !== (_e = null !== (_c = null === (_b = bodyGroup.firstChild) || void 0 === _b ? void 0 : _b.rowNumber) && void 0 !== _c ? _c : null === (_d = rowHeaderGroup.firstChild) || void 0 === _d ? void 0 : _d.rowNumber) && void 0 !== _e ? _e : proxy.totalRow, proxy.rowEnd = proxy.currentRow, proxy.rowUpdatePos = proxy.rowEnd + 1, proxy.referenceRow = proxy.rowStart + Math.floor((proxy.rowEnd - proxy.rowStart) / 2), proxy.currentCol = null !== (_o = null !== (_l = null !== (_j = null !== (_g = null === (_f = bodyGroup.lastChild) || void 0 === _f ? void 0 : _f.col) && void 0 !== _g ? _g : null === (_h = colHeaderGroup.lastChild) || void 0 === _h ? void 0 : _h.col) && void 0 !== _j ? _j : null === (_k = rowHeaderGroup.lastChild) || void 0 === _k ? void 0 : _k.col) && void 0 !== _l ? _l : null === (_m = cornerHeaderGroup.lastChild) || void 0 === _m ? void 0 : _m.col) && void 0 !== _o ? _o : proxy.totalCol, proxy.colEnd = proxy.currentCol, proxy.colUpdatePos = proxy.colEnd + 1, proxy.referenceCol = proxy.colStart + Math.floor((proxy.colEnd - proxy.colStart) / 2), proxy.progress()) : (proxy.currentRow = proxy.totalRow, proxy.rowEnd = proxy.currentRow, proxy.rowUpdatePos = proxy.rowEnd + 1, proxy.referenceRow = proxy.rowStart + Math.floor((proxy.rowEnd - proxy.rowStart) / 2), proxy.currentCol = proxy.totalCol, proxy.colEnd = proxy.currentCol, proxy.colUpdatePos = proxy.colEnd + 1, proxy.referenceCol = proxy.colStart + Math.floor((proxy.colEnd - proxy.colStart) / 2));
@@ -57720,6 +57990,7 @@
57720
57990
  });
57721
57991
  }
57722
57992
 
57993
+ let stickTextUpdateId = 0;
57723
57994
  function resetTextStick(table) {
57724
57995
  const {
57725
57996
  changedCells: changedCells
@@ -57735,6 +58006,8 @@
57735
58006
  }
57736
58007
  function handleTextStick(table) {
57737
58008
  const changedCells = resetTextStick(table),
58009
+ horizontalUpdateId = ++stickTextUpdateId,
58010
+ verticalUpdateId = ++stickTextUpdateId,
57738
58011
  {
57739
58012
  scrollTop: scrollTop,
57740
58013
  scrollLeft: scrollLeft,
@@ -57757,42 +58030,53 @@
57757
58030
  for (let row = 0; row < frozenRowCount && !(colEnd < colStart); row++) [colStart, colEnd].forEach(col => {
57758
58031
  const style = table._getCellStyle(col, row);
57759
58032
  if ((null == style ? void 0 : style.textStick) && "vertical" !== (null == style ? void 0 : style.textStick)) {
57760
- adjustCellContentHorizontalLayout(table.scenegraph.getCell(col, row), frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table);
58033
+ adjustCellContentHorizontalLayout(table.scenegraph.getCell(col, row), frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table, horizontalUpdateId, {
58034
+ colStart: colStart,
58035
+ colEnd: colEnd,
58036
+ rowStart: row,
58037
+ rowEnd: row
58038
+ });
57761
58039
  }
57762
58040
  });
57763
58041
  for (let col = 0; col < frozenColCount && !(rowEnd < rowStart); col++) [rowStart, rowEnd].forEach(row => {
57764
58042
  const style = table._getCellStyle(col, row);
57765
58043
  if ((null == style ? void 0 : style.textStick) && "horizontal" !== (null == style ? void 0 : style.textStick)) {
57766
- adjustCellContentVerticalLayout(table.scenegraph.getCell(col, row), frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table);
58044
+ adjustCellContentVerticalLayout(table.scenegraph.getCell(col, row), frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table, verticalUpdateId, {
58045
+ colStart: col,
58046
+ colEnd: col,
58047
+ rowStart: rowStart,
58048
+ rowEnd: rowEnd
58049
+ });
57767
58050
  }
57768
58051
  });
57769
58052
  for (let col = colStart; col <= colEnd && !(rowEnd < rowStart); col++) [rowStart, rowEnd].forEach(row => {
57770
58053
  const style = table._getCellStyle(col, row);
57771
58054
  if ((null == style ? void 0 : style.textStick) && "horizontal" !== (null == style ? void 0 : style.textStick)) {
57772
- adjustCellContentVerticalLayout(table.scenegraph.getCell(col, row), frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table);
58055
+ adjustCellContentVerticalLayout(table.scenegraph.getCell(col, row), frozenRowsHeight + table.tableY, table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() + table.tableY, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table, verticalUpdateId, {
58056
+ colStart: col,
58057
+ colEnd: col,
58058
+ rowStart: rowStart,
58059
+ rowEnd: rowEnd
58060
+ });
57773
58061
  }
57774
58062
  });
57775
58063
  for (let row = rowStart; row <= rowEnd && !(colEnd < colStart); row++) [colStart, colEnd].forEach(col => {
57776
58064
  const style = table._getCellStyle(col, row);
57777
58065
  if ((null == style ? void 0 : style.textStick) && "vertical" !== (null == style ? void 0 : style.textStick)) {
57778
- adjustCellContentHorizontalLayout(table.scenegraph.getCell(col, row), frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table);
58066
+ adjustCellContentHorizontalLayout(table.scenegraph.getCell(col, row), frozenColsWidth + table.tableX, table.tableNoFrameWidth - table.getRightFrozenColsWidth() + table.tableX, changedCells, null == style ? void 0 : style.textStickBaseOnAlign, table, horizontalUpdateId, {
58067
+ colStart: colStart,
58068
+ colEnd: colEnd,
58069
+ rowStart: row,
58070
+ rowEnd: row
58071
+ });
57779
58072
  }
57780
58073
  });
57781
58074
  }
57782
58075
  }
57783
- function adjustCellContentVerticalLayout(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign, table) {
57784
- if (isNumber$3(cellGroup.mergeStartCol) && isNumber$3(cellGroup.mergeStartRow) && isNumber$3(cellGroup.mergeEndCol) && isNumber$3(cellGroup.mergeEndRow)) {
57785
- const {
57786
- colStart: colStart,
57787
- colEnd: colEnd,
57788
- rowStart: rowStart,
57789
- rowEnd: rowEnd
57790
- } = getCellMergeRange(cellGroup, table.scenegraph);
57791
- for (let col = colStart; col <= colEnd; col++) for (let row = rowStart; row <= rowEnd; row++) {
57792
- const singleCellGroup = table.scenegraph.getCell(col, row);
57793
- "cell" === singleCellGroup.role && dealVertical(singleCellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign);
57794
- }
57795
- } else dealVertical(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign);
58076
+ function adjustCellContentVerticalLayout(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign, table, updateId, visibleRange) {
58077
+ dealMergedCellGroups(cellGroup, table, visibleRange, updateId, "verticalStickUpdateId", singleCellGroup => {
58078
+ dealVertical(singleCellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign);
58079
+ });
57796
58080
  }
57797
58081
  function dealVertical(cellGroup, minTop, maxTop, changedCells, textStickBaseOnAlign) {
57798
58082
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
@@ -57850,19 +58134,31 @@
57850
58134
  });
57851
58135
  }
57852
58136
  }
57853
- function adjustCellContentHorizontalLayout(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign, table) {
58137
+ function adjustCellContentHorizontalLayout(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign, table, updateId, visibleRange) {
58138
+ dealMergedCellGroups(cellGroup, table, visibleRange, updateId, "horizontalStickUpdateId", singleCellGroup => {
58139
+ dealHorizontal(singleCellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign);
58140
+ });
58141
+ }
58142
+ function dealMergedCellGroups(cellGroup, table, visibleRange, updateId, updateIdKey, dealCell) {
57854
58143
  if (isNumber$3(cellGroup.mergeStartCol) && isNumber$3(cellGroup.mergeStartRow) && isNumber$3(cellGroup.mergeEndCol) && isNumber$3(cellGroup.mergeEndRow)) {
57855
58144
  const {
57856
- colStart: colStart,
57857
- colEnd: colEnd,
57858
- rowStart: rowStart,
57859
- rowEnd: rowEnd
57860
- } = getCellMergeRange(cellGroup, table.scenegraph);
57861
- for (let col = colStart; col <= colEnd; col++) for (let row = rowStart; row <= rowEnd; row++) {
58145
+ colStart: colStart,
58146
+ colEnd: colEnd,
58147
+ rowStart: rowStart,
58148
+ rowEnd: rowEnd
58149
+ } = getCellMergeRange(cellGroup, table.scenegraph),
58150
+ visibleColStart = Math.max(colStart, visibleRange.colStart),
58151
+ visibleColEnd = Math.min(colEnd, visibleRange.colEnd),
58152
+ visibleRowStart = Math.max(rowStart, visibleRange.rowStart),
58153
+ visibleRowEnd = Math.min(rowEnd, visibleRange.rowEnd);
58154
+ for (let col = visibleColStart; col <= visibleColEnd; col++) for (let row = visibleRowStart; row <= visibleRowEnd; row++) {
57862
58155
  const singleCellGroup = table.scenegraph.getCell(col, row);
57863
- "cell" === singleCellGroup.role && dealHorizontal(singleCellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign);
58156
+ "cell" === singleCellGroup.role && singleCellGroup[updateIdKey] !== updateId && (singleCellGroup[updateIdKey] = updateId, dealCell(singleCellGroup));
57864
58157
  }
57865
- } else dealHorizontal(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign);
58158
+ } else {
58159
+ if (cellGroup[updateIdKey] === updateId) return;
58160
+ cellGroup[updateIdKey] = updateId, dealCell(cellGroup);
58161
+ }
57866
58162
  }
57867
58163
  function dealHorizontal(cellGroup, minLeft, maxLeft, changedCells, textStickBaseOnAlign) {
57868
58164
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
@@ -57962,7 +58258,9 @@
57962
58258
  };
57963
58259
  class SceneProxy {
57964
58260
  constructor(table) {
57965
- this.isRelease = !1, this.mode = "column", this.rowLimit = 200, this.currentRow = 0, this.rowStart = 0, this.rowEnd = 0, this.referenceRow = 0, this.screenTopRow = 0, this.deltaY = 0, this.deltaHeight = 0, this.colLimit = 100, this.screenLeftCol = 0, this.deltaX = 0, this.deltaWidth = 0, this.cellCache = new Map(), this.table = table, this.table.isPivotChart() ? (this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight)), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))) : this.table.isAutoRowHeight(table.columnHeaderLevelCount) ? this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight)) : ("autoWidth" === this.table.widthMode || (this.rowLimit = Math.max(200, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight))), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))), this.table.internalProps.transpose ? this.mode = "row" : this.table.isPivotTable() && (this.mode = "pivot"), this.table.options.maintainedDataCount && (this.rowLimit = this.table.options.maintainedDataCount), this.table.options.maintainedColumnCount && (this.colLimit = this.table.options.maintainedColumnCount), "adaptive" === this.table.heightMode && (this.rowLimit = this.table.rowCount), "adaptive" === this.table.widthMode && (this.colLimit = this.table.colCount);
58261
+ this.isRelease = !1, this.mode = "column", this.rowLimit = 200, this.currentRow = 0, this.rowStart = 0, this.rowEnd = 0, this.referenceRow = 0, this.screenTopRow = 0, this.deltaY = 0, this.deltaHeight = 0, this.colLimit = 100, this.screenLeftCol = 0, this.deltaX = 0, this.deltaWidth = 0, this.cellCache = new Map(), this.table = table;
58262
+ const defaultRowHeight = this.getEstimatedRowHeightForProxy();
58263
+ this.table.isPivotChart() ? (this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / defaultRowHeight)), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))) : this.table.isAutoRowHeight(table.columnHeaderLevelCount) ? this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / defaultRowHeight)) : ("autoWidth" === this.table.widthMode || (this.rowLimit = Math.max(200, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight))), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))), this.table.internalProps.transpose ? this.mode = "row" : this.table.isPivotTable() && (this.mode = "pivot"), this.table.options.maintainedDataCount && (this.rowLimit = this.table.options.maintainedDataCount), this.table.options.maintainedColumnCount && (this.colLimit = this.table.options.maintainedColumnCount), "adaptive" === this.table.heightMode && (this.rowLimit = this.table.rowCount), "adaptive" === this.table.widthMode && (this.colLimit = this.table.colCount);
57966
58264
  }
57967
58265
  get bodyLeftCol() {
57968
58266
  return this.table.frozenColCount;
@@ -57986,7 +58284,7 @@
57986
58284
  this.bodyBottomRow = this.table.rowCount - 1 - this.table.bottomFrozenRowCount;
57987
58285
  const totalActualBodyRowCount = Math.min(this.rowLimit, this.bodyBottomRow - this.bodyTopRow + 1);
57988
58286
  this.totalActualBodyRowCount = totalActualBodyRowCount, this.totalRow = this.bodyTopRow + totalActualBodyRowCount - 1, this.rowStart = this.bodyTopRow, this.rowEnd = this.totalRow;
57989
- const defaultRowHeight = this.table.defaultRowHeight;
58287
+ const defaultRowHeight = this.getEstimatedRowHeightForProxy();
57990
58288
  this.taskRowCount = 1 * Math.ceil(this.table.tableNoFrameHeight / defaultRowHeight);
57991
58289
  const totalBodyHeight = defaultRowHeight * totalActualBodyRowCount,
57992
58290
  totalHeight = defaultRowHeight * (this.bodyBottomRow - this.bodyTopRow + 1);
@@ -58009,11 +58307,16 @@
58009
58307
  this.taskColCount = 1 * Math.ceil(this.table.tableNoFrameWidth / defaultColWidth);
58010
58308
  const widthLimit = 5 * this.table.tableNoFrameWidth;
58011
58309
  this.screenColCount = Math.ceil(this.table.tableNoFrameWidth / defaultColWidth), this.firstScreenColLimit = this.bodyLeftCol + Math.min(this.colLimit, Math.ceil(widthLimit / defaultColWidth));
58012
- const defaultRowHeight = this.table.defaultRowHeight;
58310
+ const defaultRowHeight = this.getEstimatedRowHeightForProxy();
58013
58311
  this.taskRowCount = 1 * Math.ceil(this.table.tableNoFrameHeight / defaultRowHeight);
58014
58312
  const heightLimit = 5 * this.table.tableNoFrameHeight;
58015
58313
  this.screenRowCount = Math.ceil(this.table.tableNoFrameHeight / defaultRowHeight), this.firstScreenRowLimit = this.bodyTopRow + Math.min(this.rowLimit, Math.ceil(heightLimit / defaultRowHeight));
58016
58314
  }
58315
+ getEstimatedRowHeightForProxy() {
58316
+ var _a;
58317
+ const minSingleRowHeight = null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a.minSingleRowHeight;
58318
+ return "autoHeight" === this.table.heightMode ? isNumber$3(minSingleRowHeight) && minSingleRowHeight > 0 ? minSingleRowHeight : 2 : this.table.defaultRowHeight;
58319
+ }
58017
58320
  createGroupForFirstScreen(cornerHeaderGroup, colHeaderGroup, rowHeaderGroup, rightFrozenGroup, bottomFrozenGroup, bodyGroup, xOrigin, yOrigin) {
58018
58321
  createGroupForFirstScreen(cornerHeaderGroup, colHeaderGroup, rowHeaderGroup, rightFrozenGroup, bottomFrozenGroup, bodyGroup, xOrigin, yOrigin, this);
58019
58322
  }
@@ -59610,6 +59913,7 @@
59610
59913
  },
59611
59914
  placement: baseIcon.tooltip.placement
59612
59915
  },
59916
+ appearDelay: baseIcon.tooltip.appearDelay,
59613
59917
  disappearDelay: baseIcon.tooltip.disappearDelay,
59614
59918
  style: Object.assign({}, null === (_a = scene.table.internalProps.theme) || void 0 === _a ? void 0 : _a.tooltipStyle, null === (_b = baseIcon.tooltip) || void 0 === _b ? void 0 : _b.style)
59615
59919
  };
@@ -60161,6 +60465,7 @@
60161
60465
  }
60162
60466
  releaseStage() {
60163
60467
  var _a, _b, _c;
60468
+ this.clear = !0, this._needUpdateContainer = !1;
60164
60469
  const releaseAppRef = this.releaseVRenderAppRef;
60165
60470
  this.releaseVRenderAppRef = void 0;
60166
60471
  try {
@@ -60352,8 +60657,8 @@
60352
60657
  updateCellSelectBorder(this, cellRange), moveSelectingRangeComponentsToSelectedRangeComponents(this);
60353
60658
  });
60354
60659
  }
60355
- updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap) {
60356
- updateColWidth(this, col, Math.round(detaX), skipTableWidthMap), skipUpdateContainer || this.updateContainer({
60660
+ updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap, pendingCornerCustomMergeRanges) {
60661
+ updateColWidth(this, col, Math.round(detaX), skipTableWidthMap, pendingCornerCustomMergeRanges), skipUpdateContainer || this.updateContainer({
60357
60662
  async: !0
60358
60663
  });
60359
60664
  }
@@ -60422,51 +60727,17 @@
60422
60727
  this.proxy.resize(), ("adaptive" === this.table.widthMode || this.table.autoFillWidth) && (0 === this.table.internalProps._widthResizedColMap.size ? this.recalculateColWidths() : this.dealWidthMode()), "adaptive" === this.table.heightMode ? 0 === this.table.internalProps._heightResizedRowMap.size ? this.recalculateRowHeights() : this.dealHeightMode() : this.table.autoFillHeight && this.dealHeightMode(), this.resetFrozen(), this.updateTableSize(), this.updateBorderSizeAndPosition(), this.component.updateScrollBar(), ("adaptive" === this.table.widthMode || "adaptive" === this.table.heightMode || this.table.autoFillWidth || this.table.autoFillHeight || (null === (_a = this.table.containerFit) || void 0 === _a ? void 0 : _a.width) || (null === (_b = this.table.containerFit) || void 0 === _b ? void 0 : _b.height)) && this.updateChartSizeForResizeColWidth(-1), this.proxy.progress(), this.updateNextFrame();
60423
60728
  }
60424
60729
  updateTableSize() {
60425
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
60730
+ var _a, _b, _c;
60426
60731
  const contentWidth = Math.max(this.colHeaderGroup.attribute.width, this.bodyGroup.attribute.width, this.bottomFrozenGroup.attribute.width, 0) + Math.max(this.cornerHeaderGroup.attribute.width, this.rowHeaderGroup.attribute.width, this.leftBottomCornerGroup.attribute.width, 0) + Math.max(this.rightTopCornerGroup.attribute.width, this.rightFrozenGroup.attribute.width, this.rightBottomCornerGroup.attribute.width, 0),
60427
60732
  contentHeight = Math.max(this.colHeaderGroup.attribute.height, this.cornerHeaderGroup.attribute.height, this.rightTopCornerGroup.attribute.height, 0) + Math.max(this.rowHeaderGroup.attribute.height, this.bodyGroup.attribute.height, this.rightFrozenGroup.attribute.height, 0) + Math.max(this.leftBottomCornerGroup.attribute.height, this.bottomFrozenGroup.attribute.height, this.rightBottomCornerGroup.attribute.height, 0);
60428
60733
  let tableWidth = contentWidth,
60429
60734
  tableHeight = contentHeight;
60430
- if (tableWidth = (null === (_a = this.table.containerFit) || void 0 === _a ? void 0 : _a.width) ? this.table.tableNoFrameWidth : Math.min(this.table.tableNoFrameWidth, contentWidth), tableHeight = (null === (_b = this.table.containerFit) || void 0 === _b ? void 0 : _b.height) ? this.table.tableNoFrameHeight : Math.min(this.table.tableNoFrameHeight, contentHeight), this.tableGroup.setAttributes({
60735
+ tableWidth = (null === (_a = this.table.containerFit) || void 0 === _a ? void 0 : _a.width) ? this.table.tableNoFrameWidth : Math.min(this.table.tableNoFrameWidth, contentWidth), tableHeight = (null === (_b = this.table.containerFit) || void 0 === _b ? void 0 : _b.height) ? this.table.tableNoFrameHeight : Math.min(this.table.tableNoFrameHeight, contentHeight), this.tableGroup.setAttributes({
60431
60736
  x: this.table.tableX,
60432
60737
  y: this.table.tableY,
60433
60738
  width: tableWidth,
60434
60739
  height: tableHeight
60435
- }), this.tableGroup.border) {
60436
- const rectAttributes = null === (_c = this.tableGroup.border) || void 0 === _c ? void 0 : _c.attribute;
60437
- let borderTop, borderRight, borderBottom, borderLeft;
60438
- (null == rectAttributes ? void 0 : rectAttributes.strokeArrayWidth) ? (borderTop = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[0] : null !== (_d = rectAttributes.lineWidth) && void 0 !== _d ? _d : 0, borderRight = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[1] : null !== (_e = rectAttributes.lineWidth) && void 0 !== _e ? _e : 0, borderBottom = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[2] : null !== (_f = rectAttributes.lineWidth) && void 0 !== _f ? _f : 0, borderLeft = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[3] : null !== (_g = rectAttributes.lineWidth) && void 0 !== _g ? _g : 0) : (borderTop = null !== (_h = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _h ? _h : 0, borderRight = null !== (_j = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _j ? _j : 0, borderBottom = null !== (_k = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _k ? _k : 0, borderLeft = null !== (_l = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _l ? _l : 0), "rect" === this.tableGroup.border.type ? (null === (_m = this.table.theme.frameStyle) || void 0 === _m ? void 0 : _m.innerBorder) ? this.tableGroup.border.setAttributes({
60439
- x: this.table.tableX + borderLeft / 2,
60440
- y: this.table.tableY + borderTop / 2,
60441
- width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2,
60442
- height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2
60443
- }) : this.tableGroup.border.setAttributes({
60444
- x: this.table.tableX - borderLeft / 2,
60445
- y: this.table.tableY - borderTop / 2,
60446
- width: this.tableGroup.attribute.width + borderLeft / 2 + borderRight / 2,
60447
- height: this.tableGroup.attribute.height + borderTop / 2 + borderBottom / 2
60448
- }) : "group" === this.tableGroup.border.type && ((null === (_o = this.table.theme.frameStyle) || void 0 === _o ? void 0 : _o.innerBorder) ? (this.tableGroup.border.setAttributes({
60449
- x: this.table.tableX + borderLeft / 2,
60450
- y: this.table.tableY + borderTop / 2,
60451
- width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2,
60452
- height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2
60453
- }), null === (_p = this.tableGroup.border.firstChild) || void 0 === _p || _p.setAttributes({
60454
- x: 0,
60455
- y: 0,
60456
- width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2,
60457
- height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2
60458
- })) : (this.tableGroup.border.setAttributes({
60459
- x: this.table.tableX - borderLeft / 2,
60460
- y: this.table.tableY - borderTop / 2,
60461
- width: this.tableGroup.attribute.width + borderLeft / 2 + borderRight / 2,
60462
- height: this.tableGroup.attribute.height + borderTop / 2 + borderBottom / 2
60463
- }), null === (_q = this.tableGroup.border.firstChild) || void 0 === _q || _q.setAttributes({
60464
- x: borderLeft / 2,
60465
- y: borderTop / 2,
60466
- width: this.tableGroup.attribute.width,
60467
- height: this.tableGroup.attribute.height
60468
- })));
60469
- }
60740
+ });
60470
60741
  const hasFrozenCols = this.table.frozenColCount > 0,
60471
60742
  hasRightFrozenCols = this.table.rightFrozenColCount > 0,
60472
60743
  hasFrozenRows = this.table.frozenRowCount > 0,
@@ -60517,10 +60788,51 @@
60517
60788
  width: 0,
60518
60789
  height: 0
60519
60790
  });
60520
- this.updateDomContainer();
60791
+ if (hasBottomFrozenRows && !(null === (_c = this.table.containerFit) || void 0 === _c ? void 0 : _c.height)) {
60792
+ const actualContentBottom = Math.max(this.colHeaderGroup.attribute.y + this.colHeaderGroup.attribute.height, this.cornerHeaderGroup.attribute.y + this.cornerHeaderGroup.attribute.height, this.rightTopCornerGroup.attribute.y + this.rightTopCornerGroup.attribute.height, this.rowHeaderGroup.attribute.y + this.rowHeaderGroup.attribute.height, this.bodyGroup.attribute.y + this.bodyGroup.attribute.height, this.rightFrozenGroup.attribute.y + this.rightFrozenGroup.attribute.height, this.leftBottomCornerGroup.attribute.y + this.leftBottomCornerGroup.attribute.height, this.bottomFrozenGroup.attribute.y + this.bottomFrozenGroup.attribute.height, this.rightBottomCornerGroup.attribute.y + this.rightBottomCornerGroup.attribute.height);
60793
+ actualContentBottom > 0 && actualContentBottom < this.tableGroup.attribute.height && this.tableGroup.setAttribute("height", actualContentBottom);
60794
+ }
60795
+ this.updateTableGroupBorder(), this.updateDomContainer();
60796
+ }
60797
+ updateTableGroupBorder() {
60798
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
60799
+ if (!this.tableGroup.border) return;
60800
+ const rectAttributes = null === (_a = this.tableGroup.border) || void 0 === _a ? void 0 : _a.attribute;
60801
+ let borderTop, borderRight, borderBottom, borderLeft;
60802
+ (null == rectAttributes ? void 0 : rectAttributes.strokeArrayWidth) ? (borderTop = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[0] : null !== (_b = rectAttributes.lineWidth) && void 0 !== _b ? _b : 0, borderRight = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[1] : null !== (_c = rectAttributes.lineWidth) && void 0 !== _c ? _c : 0, borderBottom = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[2] : null !== (_d = rectAttributes.lineWidth) && void 0 !== _d ? _d : 0, borderLeft = rectAttributes.strokeArrayWidth ? rectAttributes.strokeArrayWidth[3] : null !== (_e = rectAttributes.lineWidth) && void 0 !== _e ? _e : 0) : (borderTop = null !== (_f = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _f ? _f : 0, borderRight = null !== (_g = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _g ? _g : 0, borderBottom = null !== (_h = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _h ? _h : 0, borderLeft = null !== (_j = null == rectAttributes ? void 0 : rectAttributes.lineWidth) && void 0 !== _j ? _j : 0), "rect" === this.tableGroup.border.type ? (null === (_k = this.table.theme.frameStyle) || void 0 === _k ? void 0 : _k.innerBorder) ? this.tableGroup.border.setAttributes({
60803
+ x: this.table.tableX + borderLeft / 2,
60804
+ y: this.table.tableY + borderTop / 2,
60805
+ width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2,
60806
+ height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2
60807
+ }) : this.tableGroup.border.setAttributes({
60808
+ x: this.table.tableX - borderLeft / 2,
60809
+ y: this.table.tableY - borderTop / 2,
60810
+ width: this.tableGroup.attribute.width + borderLeft / 2 + borderRight / 2,
60811
+ height: this.tableGroup.attribute.height + borderTop / 2 + borderBottom / 2
60812
+ }) : "group" === this.tableGroup.border.type && ((null === (_l = this.table.theme.frameStyle) || void 0 === _l ? void 0 : _l.innerBorder) ? (this.tableGroup.border.setAttributes({
60813
+ x: this.table.tableX + borderLeft / 2,
60814
+ y: this.table.tableY + borderTop / 2,
60815
+ width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2,
60816
+ height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2
60817
+ }), null === (_m = this.tableGroup.border.firstChild) || void 0 === _m || _m.setAttributes({
60818
+ x: 0,
60819
+ y: 0,
60820
+ width: this.tableGroup.attribute.width - borderLeft / 2 - borderRight / 2,
60821
+ height: this.tableGroup.attribute.height - borderTop / 2 - borderBottom / 2
60822
+ })) : (this.tableGroup.border.setAttributes({
60823
+ x: this.table.tableX - borderLeft / 2,
60824
+ y: this.table.tableY - borderTop / 2,
60825
+ width: this.tableGroup.attribute.width + borderLeft / 2 + borderRight / 2,
60826
+ height: this.tableGroup.attribute.height + borderTop / 2 + borderBottom / 2
60827
+ }), null === (_o = this.tableGroup.border.firstChild) || void 0 === _o || _o.setAttributes({
60828
+ x: borderLeft / 2,
60829
+ y: borderTop / 2,
60830
+ width: this.tableGroup.attribute.width,
60831
+ height: this.tableGroup.attribute.height
60832
+ })));
60521
60833
  }
60522
- updateRowHeight(row, detaY, skipTableHeightMap) {
60523
- detaY = Math.round(detaY), updateRowHeight(this, row, detaY, skipTableHeightMap), this.updateContainerHeight(row, detaY);
60834
+ updateRowHeight(row, detaY, skipTableHeightMap, pendingCornerCustomMergeRanges) {
60835
+ detaY = Math.round(detaY), updateRowHeight(this, row, detaY, skipTableHeightMap, pendingCornerCustomMergeRanges), this.updateContainerHeight(row, detaY);
60524
60836
  }
60525
60837
  updateRowsHeight(rows, detaYs, skipTableHeightMap) {
60526
60838
  for (let i = 0; i < rows.length; i++) {
@@ -60729,7 +61041,7 @@
60729
61041
  var _a;
60730
61042
  updateConfig.async ? this._needUpdateContainer || (this._needUpdateContainer = !0, setTimeout(() => {
60731
61043
  var _a;
60732
- this.updateContainerSync(null !== (_a = updateConfig.needUpdateCellY) && void 0 !== _a && _a);
61044
+ this._needUpdateContainer && !this.clear ? this.updateContainerSync(null !== (_a = updateConfig.needUpdateCellY) && void 0 !== _a && _a) : this._needUpdateContainer = !1;
60733
61045
  }, 0)) : (this._needUpdateContainer = !0, this.updateContainerSync(null !== (_a = updateConfig.needUpdateCellY) && void 0 !== _a && _a));
60734
61046
  }
60735
61047
  updateContainerSync(needUpdateCellY = !1) {
@@ -60814,7 +61126,7 @@
60814
61126
  var _a;
60815
61127
  const type = (null === (_a = this.table.getCellRawRecord(col, row)) || void 0 === _a ? void 0 : _a.vtableMerge) ? "text" : this.table.getCellType(col, row),
60816
61128
  cellGroup = this.getCell(col, row);
60817
- "image" !== type && "video" !== type || updateImageCellContentWhileResize(cellGroup, col, row, 0, 0, this.table);
61129
+ "image" !== type && "video" !== type && "audio" !== type || updateImageCellContentWhileResize(cellGroup, col, row, 0, 0, this.table);
60818
61130
  }
60819
61131
  createFrameBorder() {
60820
61132
  var _a, _b, _c, _d, _e;
@@ -61794,7 +62106,12 @@
61794
62106
  colMax = Math.max(sourceMergeInfo.end.col, targetMergeInfo.end.col, oldSourceMergeInfo.end.col, oldTargetMergeInfo.end.col),
61795
62107
  rowMin = Math.min(sourceMergeInfo.start.row, targetMergeInfo.start.row, oldSourceMergeInfo.start.row, oldTargetMergeInfo.start.row);
61796
62108
  let rowMax = Math.max(sourceMergeInfo.end.row, targetMergeInfo.end.row, oldSourceMergeInfo.end.row, oldTargetMergeInfo.end.row);
61797
- "row" === moveContext.moveType && "tree" === state.table.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), state.table.transpose || !state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) && "row" !== state.columnMove.movingColumnOrRow || (state.table.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), state.changeCheckboxAndRadioOrder(moveContext.sourceIndex, moveContext.targetIndex)), "column" === moveContext.moveType ? clearWidthsAndHeightsCache(colMin, colMax, 0, -1, state.table) : clearWidthsAndHeightsCache(0, -1, rowMin, rowMax, state.table), state.table.clearCellStyleCache(), state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) || "row" === state.columnMove.movingColumnOrRow ? state.table.scenegraph.updateHeaderPosition(state.table.scenegraph.proxy.colStart, state.table.scenegraph.proxy.colEnd, state.table.scenegraph.proxy.rowStart, state.table.scenegraph.proxy.rowEnd, moveContext.moveType) : "column" === moveContext.moveType ? state.table.scenegraph.updateHeaderPosition(colMin, colMax, 0, -1, moveContext.moveType) : state.table.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType), "adjustFrozenCount" === state.table.internalProps.frozenColDragHeaderMode && state.table.isListTable() && (state.table.isLeftFrozenColumn(state.columnMove.colTarget) && !state.table.isLeftFrozenColumn(state.columnMove.colSource) ? state.table.frozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : state.table.isLeftFrozenColumn(state.columnMove.colSource) && !state.table.isLeftFrozenColumn(state.columnMove.colTarget) && (state.table.frozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1), state.table.isRightFrozenColumn(state.columnMove.colTarget) && !state.table.isRightFrozenColumn(state.columnMove.colSource) ? state.table.rightFrozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : state.table.isRightFrozenColumn(state.columnMove.colSource) && !state.table.isRightFrozenColumn(state.columnMove.colTarget) && (state.table.rightFrozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1)), moveColResult = !0;
62109
+ if ("row" === moveContext.moveType && "tree" === state.table.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), state.table.isListTable() && !state.table.transpose && (state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) || "row" === state.columnMove.movingColumnOrRow)) {
62110
+ const sourceRecordPath = state.table.getRecordIndexByCell(0, moveContext.sourceIndex),
62111
+ targetRecordPath = state.table.getRecordIndexByCell(0, moveContext.targetIndex);
62112
+ state.table.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), state.changeCheckboxOrder(sourceRecordPath, targetRecordPath), state.changeRadioOrder(sourceRecordPath, targetRecordPath);
62113
+ }
62114
+ "column" === moveContext.moveType ? clearWidthsAndHeightsCache(colMin, colMax, 0, -1, state.table) : clearWidthsAndHeightsCache(0, -1, rowMin, rowMax, state.table), state.table.clearCellStyleCache(), state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) || "row" === state.columnMove.movingColumnOrRow ? state.table.scenegraph.updateHeaderPosition(state.table.scenegraph.proxy.colStart, state.table.scenegraph.proxy.colEnd, state.table.scenegraph.proxy.rowStart, state.table.scenegraph.proxy.rowEnd, moveContext.moveType) : "column" === moveContext.moveType ? state.table.scenegraph.updateHeaderPosition(colMin, colMax, 0, -1, moveContext.moveType) : state.table.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType), "adjustFrozenCount" === state.table.internalProps.frozenColDragHeaderMode && state.table.isListTable() && (state.table.isLeftFrozenColumn(state.columnMove.colTarget) && !state.table.isLeftFrozenColumn(state.columnMove.colSource) ? state.table.frozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : state.table.isLeftFrozenColumn(state.columnMove.colSource) && !state.table.isLeftFrozenColumn(state.columnMove.colTarget) && (state.table.frozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1), state.table.isRightFrozenColumn(state.columnMove.colTarget) && !state.table.isRightFrozenColumn(state.columnMove.colSource) ? state.table.rightFrozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : state.table.isRightFrozenColumn(state.columnMove.colSource) && !state.table.isRightFrozenColumn(state.columnMove.colTarget) && (state.table.rightFrozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1)), moveColResult = !0;
61798
62115
  }
61799
62116
  }
61800
62117
  return state.columnMove.moving = !1, setTimeout(() => {
@@ -61866,17 +62183,20 @@
61866
62183
  }), state.table.internalProps.title && state.table.internalProps.title.resize(), state.table.internalProps.emptyTip && state.table.internalProps.emptyTip.resize(), state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose ? state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen) : state.table.options.frozenColCount && state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1), (state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount && !state.table.isPivotTable() && !state.table.transpose || state.table.options.rightFrozenColCount) && state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount), state.table.scenegraph.updateNextFrame();
61867
62184
  }
61868
62185
  function updateResizeColForColumn(detaX, state) {
61869
- "adaptive" === state.table.widthMode && state.columnResize.col < state.table.colCount - 1 ? (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX), state.table.scenegraph.updateColWidth(state.columnResize.col + 1, -detaX), state.table.internalProps._widthResizedColMap.add(state.columnResize.col), state.table.internalProps._widthResizedColMap.add(state.columnResize.col + 1)) : (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX), state.table.internalProps._widthResizedColMap.add(state.columnResize.col));
62186
+ const pendingCornerCustomMergeRanges = new Map();
62187
+ "adaptive" === state.table.widthMode && state.columnResize.col < state.table.colCount - 1 ? (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX, void 0, void 0, pendingCornerCustomMergeRanges), state.table.scenegraph.updateColWidth(state.columnResize.col + 1, -detaX, void 0, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._widthResizedColMap.add(state.columnResize.col), state.table.internalProps._widthResizedColMap.add(state.columnResize.col + 1)) : (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX, void 0, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._widthResizedColMap.add(state.columnResize.col)), flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
61870
62188
  }
61871
62189
  function updateResizeColForAll$1(detaX, state) {
61872
- const layout = state.table.internalProps.layoutMap;
62190
+ const layout = state.table.internalProps.layoutMap,
62191
+ pendingCornerCustomMergeRanges = new Map();
61873
62192
  for (let col = state.table.frozenColCount; col < state.table.colCount - state.table.rightFrozenColCount; col++) {
61874
62193
  if (!(state.table.internalProps.transpose || state.table.isPivotTable() && !layout.indicatorsAsCol)) {
61875
62194
  const cellDefine = layout.getBody(col, state.table.columnHeaderLevelCount);
61876
62195
  if (null == cellDefine ? void 0 : cellDefine.disableColumnResize) continue;
61877
62196
  }
61878
- state.table.scenegraph.updateColWidth(col, detaX), state.table.internalProps._widthResizedColMap.add(col);
62197
+ state.table.scenegraph.updateColWidth(col, detaX, void 0, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._widthResizedColMap.add(col);
61879
62198
  }
62199
+ flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
61880
62200
  }
61881
62201
  function updateResizeColForIndicator$1(detaX, state) {
61882
62202
  const layout = state.table.internalProps.layoutMap;
@@ -61886,14 +62206,16 @@
61886
62206
  headerPath = headerPaths.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
61887
62207
  resizeDimensionKey = headerPath.dimensionKey, resizeDimensionValue = headerPath.value;
61888
62208
  }
62209
+ const pendingCornerCustomMergeRanges = new Map();
61889
62210
  for (let col = state.table.rowHeaderLevelCount; col < state.table.colCount - state.table.rightFrozenColCount; col++) {
61890
62211
  const indicatorKey = layout.getIndicatorKey(col, state.table.columnHeaderLevelCount);
61891
- if (layout.indicatorsAsCol && indicatorKey === resizeIndicatorKey) state.table.scenegraph.updateColWidth(col, detaX), state.table.internalProps._widthResizedColMap.add(col);else if (!layout.indicatorsAsCol) {
62212
+ if (layout.indicatorsAsCol && indicatorKey === resizeIndicatorKey) state.table.scenegraph.updateColWidth(col, detaX, void 0, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._widthResizedColMap.add(col);else if (!layout.indicatorsAsCol) {
61892
62213
  const headerPaths = layout.getCellHeaderPaths(col, state.table.columnHeaderLevelCount - 1),
61893
62214
  headerPath = null == headerPaths ? void 0 : headerPaths.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
61894
- headerPath && resizeDimensionKey === headerPath.dimensionKey && resizeDimensionValue === headerPath.value && (state.table.scenegraph.updateColWidth(col, detaX), state.table.internalProps._widthResizedColMap.add(col));
62215
+ headerPath && resizeDimensionKey === headerPath.dimensionKey && resizeDimensionValue === headerPath.value && (state.table.scenegraph.updateColWidth(col, detaX, void 0, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._widthResizedColMap.add(col));
61895
62216
  }
61896
62217
  }
62218
+ flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
61897
62219
  }
61898
62220
  function updateResizeColForIndicatorGroup$1(detaX, state) {
61899
62221
  const layout = state.table.internalProps.layoutMap,
@@ -61902,15 +62224,17 @@
61902
62224
  startCol = node.startInTotal + state.table.frozenColCount,
61903
62225
  endCol = node.startInTotal + state.table.frozenColCount + node.size - 1,
61904
62226
  totalColWidth = state.table.getColsWidth(startCol, endCol),
61905
- moveX = detaX;
62227
+ moveX = detaX,
62228
+ pendingCornerCustomMergeRanges = new Map();
61906
62229
  for (let col = startCol; col <= endCol; col++) {
61907
62230
  if (!(state.table.internalProps.transpose || state.table.isPivotTable() && !layout.indicatorsAsCol)) {
61908
62231
  const cellDefine = layout.getBody(col, state.table.columnHeaderLevelCount);
61909
62232
  if (null == cellDefine ? void 0 : cellDefine.disableColumnResize) continue;
61910
62233
  }
61911
62234
  let deltaWidth = state.table.getColWidth(col) / totalColWidth * moveX;
61912
- deltaWidth > 0 && deltaWidth < .5 ? deltaWidth = .5 : deltaWidth < 0 && deltaWidth >= -.5 && (deltaWidth = -.5), state.table.scenegraph.updateColWidth(col, deltaWidth), state.table.internalProps._widthResizedColMap.add(col);
62235
+ deltaWidth > 0 && deltaWidth < .5 ? deltaWidth = .5 : deltaWidth < 0 && deltaWidth >= -.5 && (deltaWidth = -.5), state.table.scenegraph.updateColWidth(col, deltaWidth, void 0, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._widthResizedColMap.add(col);
61913
62236
  }
62237
+ flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
61914
62238
  }
61915
62239
 
61916
62240
  function setRadioState(col, row, field, type, indexInCell, state) {
@@ -61969,20 +62293,71 @@
61969
62293
  null == radio || radio._handlePointerUp();
61970
62294
  }
61971
62295
  }
61972
- function changeRadioOrder(sourceIndex, targetIndex, state) {
61973
- const {
61974
- radioState: radioState,
61975
- table: table
61976
- } = state;
61977
- if (table.internalProps.transpose ? (sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0), targetIndex = table.getRecordShowIndexByCell(targetIndex, 0)) : (sourceIndex = table.getRecordShowIndexByCell(0, sourceIndex), targetIndex = table.getRecordShowIndexByCell(0, targetIndex)), sourceIndex > targetIndex) {
61978
- const sourceRecord = radioState[sourceIndex];
61979
- for (let i = sourceIndex; i > targetIndex; i--) radioState[i] = radioState[i - 1];
61980
- radioState[targetIndex] = sourceRecord;
61981
- } else if (sourceIndex < targetIndex) {
61982
- const sourceRecord = radioState[sourceIndex];
61983
- for (let i = sourceIndex; i < targetIndex; i++) radioState[i] = radioState[i + 1];
61984
- radioState[targetIndex] = sourceRecord;
62296
+ function normalizeRecordPath$1(recordPath) {
62297
+ return Array.isArray(recordPath) ? recordPath : [recordPath];
62298
+ }
62299
+ function parseRecordPathKey(key) {
62300
+ return isNumber$3(key) ? [key] : key.split(",").map(item => Number(item));
62301
+ }
62302
+ function isSameRecordPath$1(source, target) {
62303
+ return source.length === target.length && source.every((item, index) => item === target[index]);
62304
+ }
62305
+ function isSameParentPath$1(source, target) {
62306
+ return source.length === target.length && source.slice(0, -1).every((item, index) => item === target[index]);
62307
+ }
62308
+ function isDescendantPath$1(path, ancestor) {
62309
+ return ancestor.length <= path.length && ancestor.every((item, index) => item === path[index]);
62310
+ }
62311
+ function getMovedRecordPath$1(path, source, target) {
62312
+ return target.concat(path.slice(source.length));
62313
+ }
62314
+ function getShiftedSiblingPath$1(path, parent, sourceIndex, targetIndex) {
62315
+ if (path.length <= parent.length || !isDescendantPath$1(path.slice(0, parent.length), parent)) return path;
62316
+ const siblingIndex = path[parent.length];
62317
+ if (sourceIndex < targetIndex && siblingIndex > sourceIndex && siblingIndex <= targetIndex) {
62318
+ const shifted = [...path];
62319
+ return shifted[parent.length] = siblingIndex - 1, shifted;
61985
62320
  }
62321
+ if (sourceIndex > targetIndex && siblingIndex >= targetIndex && siblingIndex < sourceIndex) {
62322
+ const shifted = [...path];
62323
+ return shifted[parent.length] = siblingIndex + 1, shifted;
62324
+ }
62325
+ return path;
62326
+ }
62327
+ function getChangedRecordPath(path, sourcePath, targetPath) {
62328
+ const parentPath = sourcePath.slice(0, -1),
62329
+ sourceIndex = sourcePath[sourcePath.length - 1],
62330
+ targetIndex = targetPath[targetPath.length - 1];
62331
+ return isDescendantPath$1(path, sourcePath) ? getMovedRecordPath$1(path, sourcePath, targetPath) : getShiftedSiblingPath$1(path, parentPath, sourceIndex, targetIndex);
62332
+ }
62333
+ function getRadioStateValue(recordPath) {
62334
+ return 1 === recordPath.length ? recordPath[0] : recordPath;
62335
+ }
62336
+ function getRadioStateKey(recordPath) {
62337
+ return recordPath.toString();
62338
+ }
62339
+ function changeRadioStateValue(value, sourcePath, targetPath) {
62340
+ if (isNumber$3(value)) return getRadioStateValue(getChangedRecordPath([value], sourcePath, targetPath));
62341
+ if (Array.isArray(value)) return getRadioStateValue(getChangedRecordPath(value, sourcePath, targetPath));
62342
+ if (isString$2(value)) return getRadioStateKey(getChangedRecordPath(parseRecordPathKey(value), sourcePath, targetPath));
62343
+ if (isObject$8(value)) {
62344
+ const nextValue = {};
62345
+ return Object.keys(value).forEach(key => {
62346
+ const nextPath = getChangedRecordPath(parseRecordPathKey(key), sourcePath, targetPath);
62347
+ nextValue[getRadioStateKey(nextPath)] = value[key];
62348
+ }), nextValue;
62349
+ }
62350
+ return value;
62351
+ }
62352
+ function changeRadioOrder(sourceRecordPath, targetRecordPath, state) {
62353
+ const {
62354
+ radioState: radioState
62355
+ } = state,
62356
+ sourcePath = normalizeRecordPath$1(sourceRecordPath),
62357
+ targetPath = normalizeRecordPath$1(targetRecordPath);
62358
+ !isSameRecordPath$1(sourcePath, targetPath) && isSameParentPath$1(sourcePath, targetPath) && Object.keys(radioState).forEach(field => {
62359
+ radioState[field] = changeRadioStateValue(radioState[field], sourcePath, targetPath);
62360
+ });
61986
62361
  }
61987
62362
 
61988
62363
  function setCheckedState(col, row, field, checked, state) {
@@ -62107,41 +62482,58 @@
62107
62482
  checkbox = (null == cellGroup ? void 0 : cellGroup.getChildByName("checkbox")) || (null === (_b = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildByName("checkbox-content")) || void 0 === _a ? void 0 : _a._checkboxGroup) || void 0 === _b ? void 0 : _b.getChildByName("checkbox"));
62108
62483
  checkbox && ("indeterminate" === checked ? (checkbox.setAttribute("indeterminate", !0), checkbox.setAttribute("checked", void 0)) : (checkbox.setAttribute("indeterminate", void 0), checkbox.setAttribute("checked", checked)));
62109
62484
  }
62110
- function changeCheckboxOrder(sourceIndex, targetIndex, state) {
62111
- const {
62112
- checkedState: checkedState,
62113
- table: table
62114
- } = state;
62115
- let source, target;
62116
- if (table.internalProps.transpose ? (sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0), targetIndex = table.getRecordShowIndexByCell(targetIndex, 0)) : (source = table.isPivotTable() ? void 0 : table.getRecordIndexByCell(0, sourceIndex), target = table.isPivotTable() ? void 0 : table.getRecordIndexByCell(0, targetIndex)), isNumber$3(source) && isNumber$3(target)) {
62117
- if ((sourceIndex = source) > (targetIndex = target)) {
62118
- const sourceRecord = checkedState.get(sourceIndex.toString());
62119
- for (let i = sourceIndex; i > targetIndex; i--) checkedState.set(i.toString(), checkedState.get((i - 1).toString()));
62120
- checkedState.set(targetIndex.toString(), sourceRecord);
62121
- } else if (sourceIndex < targetIndex) {
62122
- const sourceRecord = checkedState.get(sourceIndex.toString());
62123
- for (let i = sourceIndex; i < targetIndex; i++) checkedState.set(i.toString(), checkedState.get((i + 1).toString()));
62124
- checkedState.set(targetIndex.toString(), sourceRecord);
62125
- }
62126
- } else if (isArray$5(source) && isArray$5(target)) if ((sourceIndex = source[source.length - 1]) > (targetIndex = target[target.length - 1])) {
62127
- const sourceRecord = checkedState.get(source.toString());
62128
- for (let i = sourceIndex; i > targetIndex; i--) {
62129
- const now = [...source];
62130
- now[now.length - 1] = i;
62131
- const last = [...source];
62132
- last[last.length - 1] = i - 1, checkedState.set(now.toString(), checkedState.get(last.toString()));
62133
- }
62134
- checkedState.set(target.toString(), sourceRecord);
62135
- } else if (sourceIndex < targetIndex) {
62136
- const sourceRecord = checkedState.get(source.toString());
62137
- for (let i = sourceIndex; i < targetIndex; i++) {
62138
- const now = [...source];
62139
- now[now.length - 1] = i;
62140
- const next = [...source];
62141
- next[next.length - 1] = i + 1, checkedState.set(now.toString(), checkedState.get(next.toString()));
62142
- }
62143
- checkedState.set(target.toString(), sourceRecord);
62485
+ function normalizeRecordPath(recordPath) {
62486
+ return isArray$5(recordPath) ? recordPath : [recordPath];
62487
+ }
62488
+ function parseCheckboxStateKey(key) {
62489
+ return isNumber$3(key) ? [key] : key.split(",").map(item => Number(item));
62490
+ }
62491
+ function stringifyRecordPath(recordPath) {
62492
+ return recordPath.toString();
62493
+ }
62494
+ function isSameRecordPath(source, target) {
62495
+ return source.length === target.length && source.every((item, index) => item === target[index]);
62496
+ }
62497
+ function isSameParentPath(source, target) {
62498
+ return source.length === target.length && source.slice(0, -1).every((item, index) => item === target[index]);
62499
+ }
62500
+ function isDescendantPath(path, ancestor) {
62501
+ return ancestor.length <= path.length && ancestor.every((item, index) => item === path[index]);
62502
+ }
62503
+ function getMovedRecordPath(path, source, target) {
62504
+ return target.concat(path.slice(source.length));
62505
+ }
62506
+ function getShiftedSiblingPath(path, parent, sourceIndex, targetIndex) {
62507
+ if (path.length <= parent.length || !isDescendantPath(path.slice(0, parent.length), parent)) return path;
62508
+ const siblingIndex = path[parent.length];
62509
+ if (sourceIndex < targetIndex && siblingIndex > sourceIndex && siblingIndex <= targetIndex) {
62510
+ const shifted = [...path];
62511
+ return shifted[parent.length] = siblingIndex - 1, shifted;
62512
+ }
62513
+ if (sourceIndex > targetIndex && siblingIndex >= targetIndex && siblingIndex < sourceIndex) {
62514
+ const shifted = [...path];
62515
+ return shifted[parent.length] = siblingIndex + 1, shifted;
62144
62516
  }
62517
+ return path;
62518
+ }
62519
+ function changeCheckboxOrder(sourceRecordPath, targetRecordPath, state) {
62520
+ const {
62521
+ checkedState: checkedState
62522
+ } = state,
62523
+ sourcePath = normalizeRecordPath(sourceRecordPath),
62524
+ targetPath = normalizeRecordPath(targetRecordPath);
62525
+ if (isSameRecordPath(sourcePath, targetPath) || !isSameParentPath(sourcePath, targetPath)) return;
62526
+ const parentPath = sourcePath.slice(0, -1),
62527
+ sourceIndex = sourcePath[sourcePath.length - 1],
62528
+ targetIndex = targetPath[targetPath.length - 1],
62529
+ nextCheckedState = new Map();
62530
+ checkedState.forEach((value, key) => {
62531
+ const keyPath = parseCheckboxStateKey(key);
62532
+ let nextPath;
62533
+ nextPath = isDescendantPath(keyPath, sourcePath) ? getMovedRecordPath(keyPath, sourcePath, targetPath) : getShiftedSiblingPath(keyPath, parentPath, sourceIndex, targetIndex), nextCheckedState.set(stringifyRecordPath(nextPath), value);
62534
+ }), checkedState.clear(), nextCheckedState.forEach((value, key) => {
62535
+ checkedState.set(key, value);
62536
+ });
62145
62537
  }
62146
62538
  function getGroupCheckboxState(table) {
62147
62539
  const result = [],
@@ -62307,10 +62699,13 @@
62307
62699
  }), state.table.internalProps.title && state.table.internalProps.title.resize(), state.table.internalProps.emptyTip && state.table.internalProps.emptyTip.resize(), state.table.scenegraph.updateNextFrame();
62308
62700
  }
62309
62701
  function updateResizeColForRow(detaY, state) {
62310
- "adaptive" === state.table.heightMode && state.rowResize.row < state.table.rowCount - 1 ? (state.table.scenegraph.updateRowHeight(state.rowResize.row, detaY), state.table.scenegraph.updateRowHeight(state.rowResize.row + 1, -detaY), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row + 1)) : (state.table.scenegraph.updateRowHeight(state.rowResize.row, detaY), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row));
62702
+ const pendingCornerCustomMergeRanges = new Map();
62703
+ "adaptive" === state.table.heightMode && state.rowResize.row < state.table.rowCount - 1 ? (state.table.scenegraph.updateRowHeight(state.rowResize.row, detaY, void 0, pendingCornerCustomMergeRanges), state.table.scenegraph.updateRowHeight(state.rowResize.row + 1, -detaY, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row + 1)) : (state.table.scenegraph.updateRowHeight(state.rowResize.row, detaY, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row)), flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
62311
62704
  }
62312
62705
  function updateResizeColForAll(detaY, state) {
62313
- for (let row = state.table.frozenRowCount; row < state.table.rowCount - state.table.bottomFrozenRowCount; row++) state.table.scenegraph.updateRowHeight(row, detaY), state.table.internalProps._heightResizedRowMap.add(row);
62706
+ const pendingCornerCustomMergeRanges = new Map();
62707
+ for (let row = state.table.frozenRowCount; row < state.table.rowCount - state.table.bottomFrozenRowCount; row++) state.table.scenegraph.updateRowHeight(row, detaY, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._heightResizedRowMap.add(row);
62708
+ flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
62314
62709
  }
62315
62710
  function updateResizeColForIndicator(detaY, state) {
62316
62711
  var _a, _b;
@@ -62321,16 +62716,18 @@
62321
62716
  headerPath = null === (_a = headerPaths.rowHeaderPaths) || void 0 === _a ? void 0 : _a[headerPaths.rowHeaderPaths.length - 1];
62322
62717
  resizeDimensionKey = null == headerPath ? void 0 : headerPath.dimensionKey, resizeDimensionValue = null == headerPath ? void 0 : headerPath.value;
62323
62718
  } else resizeIndicatorKey = layout.getIndicatorKey(state.table.rowHeaderLevelCount, state.rowResize.row);
62719
+ const pendingCornerCustomMergeRanges = new Map();
62324
62720
  for (let row = state.table.columnHeaderLevelCount; row < state.table.rowCount - state.table.bottomFrozenRowCount; row++) {
62325
62721
  const indicatorKey = layout.getIndicatorKey(state.table.rowHeaderLevelCount, row);
62326
62722
  if (layout.indicatorsAsCol || indicatorKey !== resizeIndicatorKey) {
62327
62723
  if (layout.indicatorsAsCol) {
62328
62724
  const headerPaths = layout.getCellHeaderPaths(state.table.rowHeaderLevelCount - 1, row),
62329
62725
  headerPath = null === (_b = null == headerPaths ? void 0 : headerPaths.rowHeaderPaths) || void 0 === _b ? void 0 : _b[headerPaths.rowHeaderPaths.length - 1];
62330
- headerPath && resizeDimensionKey === headerPath.dimensionKey && resizeDimensionValue === headerPath.value && (state.table.scenegraph.updateRowHeight(row, detaY), state.table.internalProps._heightResizedRowMap.add(row));
62726
+ headerPath && resizeDimensionKey === headerPath.dimensionKey && resizeDimensionValue === headerPath.value && (state.table.scenegraph.updateRowHeight(row, detaY, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._heightResizedRowMap.add(row));
62331
62727
  }
62332
- } else state.table.scenegraph.updateRowHeight(row, detaY), state.table.internalProps._heightResizedRowMap.add(row);
62728
+ } else state.table.scenegraph.updateRowHeight(row, detaY, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._heightResizedRowMap.add(row);
62333
62729
  }
62730
+ flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
62334
62731
  }
62335
62732
  function updateResizeColForIndicatorGroup(detaY, state) {
62336
62733
  const layout = state.table.internalProps.layoutMap,
@@ -62339,11 +62736,13 @@
62339
62736
  startRow = node.startInTotal + state.table.frozenRowCount,
62340
62737
  endRow = node.startInTotal + state.table.frozenRowCount + node.size - 1,
62341
62738
  totalRowHeight = state.table.getRowsHeight(startRow, endRow),
62342
- moveY = detaY;
62739
+ moveY = detaY,
62740
+ pendingCornerCustomMergeRanges = new Map();
62343
62741
  for (let row = startRow; row <= endRow; row++) {
62344
62742
  let deltaHeight = state.table.getRowHeight(row) / totalRowHeight * moveY;
62345
- deltaHeight > 0 && deltaHeight < .5 ? deltaHeight = .5 : deltaHeight < 0 && deltaHeight >= -.5 && (deltaHeight = -.51), state.table.scenegraph.updateRowHeight(row, deltaHeight), state.table.internalProps._heightResizedRowMap.add(row);
62743
+ deltaHeight > 0 && deltaHeight < .5 ? deltaHeight = .5 : deltaHeight < 0 && deltaHeight >= -.5 && (deltaHeight = -.51), state.table.scenegraph.updateRowHeight(row, deltaHeight, void 0, pendingCornerCustomMergeRanges), state.table.internalProps._heightResizedRowMap.add(row);
62346
62744
  }
62745
+ flushCornerCustomMergeContentUpdates(pendingCornerCustomMergeRanges, state.table);
62347
62746
  }
62348
62747
 
62349
62748
  function updateCustomSelectBorder(scene, selectRange, style) {
@@ -62694,6 +63093,7 @@
62694
63093
  placement: inlineIcon.attribute.tooltip.placement
62695
63094
  },
62696
63095
  style: Object.assign({}, null === (_e = this.table.internalProps.theme) || void 0 === _e ? void 0 : _e.tooltipStyle, null === (_f = inlineIcon.tooltip) || void 0 === _f ? void 0 : _f.style, null === (_h = null === (_g = inlineIcon.attribute) || void 0 === _g ? void 0 : _g.tooltip) || void 0 === _h ? void 0 : _h.style),
63096
+ appearDelay: inlineIcon.attribute.tooltip.appearDelay,
62697
63097
  disappearDelay: inlineIcon.attribute.tooltip.disappearDelay
62698
63098
  };
62699
63099
  this.table.internalProps.tooltipHandler.isBinded(tooltipOptions) || this.table.showTooltip(col, row, tooltipOptions);
@@ -63278,16 +63678,117 @@
63278
63678
  syncRadioState(col, row, field, radioType, indexInCell, isChecked) {
63279
63679
  return syncRadioState(col, row, field, radioType, indexInCell, isChecked, this);
63280
63680
  }
63281
- changeCheckboxAndRadioOrder(sourceIndex, targetIndex) {
63282
- this.checkedState.size && changeCheckboxOrder(sourceIndex, targetIndex, this), this.radioState.length && changeRadioOrder(sourceIndex, targetIndex, this);
63681
+ changeCheckboxOrder(sourceRecordPath, targetRecordPath) {
63682
+ this.checkedState.size && changeCheckboxOrder(sourceRecordPath, targetRecordPath, this);
63683
+ }
63684
+ changeRadioOrder(sourceRecordPath, targetRecordPath) {
63685
+ Object.keys(this.radioState).length && changeRadioOrder(sourceRecordPath, targetRecordPath, this);
63283
63686
  }
63284
63687
  setCustomSelectRanges(customSelectRanges) {
63285
63688
  deletaCustomSelectRanges(this), addCustomSelectRanges(customSelectRanges, this);
63286
63689
  }
63287
63690
  };
63288
63691
 
63692
+ const AUDIO_EXTENSIONS = new Set(["mp3", "wav", "oga", "m4a", "aac", "flac", "opus"]);
63693
+ function isAudioUrl(value) {
63694
+ if ("string" != typeof value) return !1;
63695
+ const trimmedValue = value.trim(),
63696
+ queryIndex = trimmedValue.indexOf("?"),
63697
+ hashIndex = trimmedValue.indexOf("#");
63698
+ let endIndex = trimmedValue.length;
63699
+ queryIndex >= 0 && (endIndex = queryIndex), hashIndex >= 0 && hashIndex < endIndex && (endIndex = hashIndex);
63700
+ const path = trimmedValue.slice(0, endIndex),
63701
+ dotIndex = path.lastIndexOf(".");
63702
+ return !(dotIndex < 0 || dotIndex === path.length - 1) && AUDIO_EXTENSIONS.has(path.slice(dotIndex + 1).toLowerCase());
63703
+ }
63704
+
63705
+ const MEDIA_PREVIEW_MANAGER_KEY = "__vtable_media_preview_manager__";
63706
+ function formatAudioTime(time) {
63707
+ if (!Number.isFinite(time) || time < 0) return "0:00";
63708
+ return `${Math.floor(time / 60)}:${Math.floor(time % 60).toString().padStart(2, "0")}`;
63709
+ }
63710
+ function updateAudioProgressStyle(progress, value) {
63711
+ progress.style.background = `linear-gradient(\n to right,\n #2563EB 0%,\n #2563EB ${value}%,\n #D1D5DB ${value}%,\n #D1D5DB 100%\n )`;
63712
+ }
63713
+ function ensureAudioPreviewStyle() {
63714
+ const styleId = "vtable-audio-preview-style";
63715
+ if (document.getElementById(styleId)) return;
63716
+ const style = document.createElement("style");
63717
+ style.id = styleId, style.textContent = "\n .vtable-audio-preview-progress {\n -webkit-appearance: none;\n appearance: none;\n }\n .vtable-audio-preview-progress::-webkit-slider-runnable-track {\n height: 4px;\n border-radius: 999px;\n background: transparent;\n }\n .vtable-audio-preview-progress::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 12px;\n height: 12px;\n margin-top: -4px;\n border-radius: 50%;\n border: 0;\n background: #2563EB;\n }\n .vtable-audio-preview-progress::-moz-range-track {\n height: 4px;\n border-radius: 999px;\n background: transparent;\n }\n .vtable-audio-preview-progress::-moz-range-thumb {\n width: 12px;\n height: 12px;\n border-radius: 50%;\n border: 0;\n background: #2563EB;\n }\n ", document.head.appendChild(style);
63718
+ }
63719
+ function createAudioPreview(cellValue) {
63720
+ ensureAudioPreviewStyle();
63721
+ const audio = document.createElement("audio");
63722
+ audio.src = cellValue, audio.preload = "auto";
63723
+ let released = !1;
63724
+ const wrapper = document.createElement("div");
63725
+ wrapper.style.width = "80%", wrapper.style.maxWidth = "640px", wrapper.style.height = "54px", wrapper.style.boxSizing = "border-box", wrapper.style.padding = "0 16px", wrapper.style.borderRadius = "27px", wrapper.style.background = "#F8FAFC", wrapper.style.display = "flex", wrapper.style.alignItems = "center", wrapper.style.gap = "10px", wrapper.style.boxShadow = "0 8px 24px rgba(15, 23, 42, 0.16)";
63726
+ const playButton = document.createElement("button");
63727
+ playButton.type = "button", playButton.textContent = "▶", playButton.style.width = "34px", playButton.style.height = "34px", playButton.style.border = "1px solid #CBD5E1", playButton.style.borderRadius = "8px", playButton.style.background = "#EFF6FF", playButton.style.color = "#0F172A", playButton.style.cursor = "pointer", playButton.style.flex = "0 0 auto", playButton.style.fontSize = "14px";
63728
+ const timeLabel = document.createElement("span");
63729
+ timeLabel.textContent = "0:00 / 0:00", timeLabel.style.color = "#0F172A", timeLabel.style.font = "14px sans-serif", timeLabel.style.whiteSpace = "nowrap";
63730
+ const progress = document.createElement("input");
63731
+ progress.className = "vtable-audio-preview-progress", progress.type = "range", progress.min = "0", progress.max = "100", progress.value = "0", progress.step = "0.1", progress.style.flex = "1 1 auto", progress.style.height = "4px", progress.style.borderRadius = "999px", progress.style.outline = "none", progress.style.cursor = "pointer", progress.style.accentColor = "#2563EB", updateAudioProgressStyle(progress, 0);
63732
+ const updateProgress = () => {
63733
+ const duration = Number.isFinite(audio.duration) ? audio.duration : 0,
63734
+ currentTime = audio.currentTime || 0,
63735
+ value = duration > 0 ? Math.min(100, currentTime / duration * 100) : 0;
63736
+ progress.disabled = duration <= 0, progress.style.cursor = duration > 0 ? "pointer" : "default", progress.value = `${value}`, timeLabel.textContent = `${formatAudioTime(currentTime)} / ${formatAudioTime(duration)}`, updateAudioProgressStyle(progress, value);
63737
+ };
63738
+ return playButton.addEventListener("click", e => {
63739
+ if (e.stopPropagation(), audio.paused) {
63740
+ const playPromise = audio.play();
63741
+ playPromise && playPromise.catch(error => {
63742
+ released || "AbortError" === (null == error ? void 0 : error.name) || (playButton.textContent = "▶");
63743
+ });
63744
+ } else audio.pause();
63745
+ }), progress.addEventListener("click", e => {
63746
+ e.stopPropagation();
63747
+ }), progress.addEventListener("input", () => {
63748
+ const duration = Number.isFinite(audio.duration) ? audio.duration : 0,
63749
+ value = Number(progress.value);
63750
+ duration > 0 && Number.isFinite(value) && (audio.currentTime = duration * value / 100), updateProgress();
63751
+ }), audio.addEventListener("loadedmetadata", updateProgress), audio.addEventListener("durationchange", updateProgress), audio.addEventListener("timeupdate", updateProgress), audio.addEventListener("play", () => {
63752
+ playButton.textContent = "❚❚";
63753
+ }), audio.addEventListener("pause", () => {
63754
+ playButton.textContent = "▶";
63755
+ }), audio.addEventListener("ended", () => {
63756
+ audio.currentTime = 0, playButton.textContent = "▶", updateProgress();
63757
+ }), wrapper.appendChild(playButton), wrapper.appendChild(timeLabel), wrapper.appendChild(progress), wrapper.appendChild(audio), {
63758
+ element: wrapper,
63759
+ destroy: () => {
63760
+ released = !0, audio.pause(), audio.removeAttribute("src"), audio.load();
63761
+ }
63762
+ };
63763
+ }
63764
+ function createMediaPreviewManager(table) {
63765
+ const manager = {
63766
+ closePreview: null,
63767
+ registered: !1,
63768
+ close() {
63769
+ const closePreview = manager.closePreview;
63770
+ manager.closePreview = null, null == closePreview || closePreview();
63771
+ },
63772
+ open(closePreview) {
63773
+ manager.close(), manager.closePreview = closePreview;
63774
+ },
63775
+ release() {
63776
+ manager.close(), manager.registered = !1;
63777
+ },
63778
+ ensureRegistered() {
63779
+ manager.registered || (table.addReleaseObj(manager), manager.registered = !0);
63780
+ }
63781
+ };
63782
+ return manager;
63783
+ }
63784
+ function getMediaPreviewManager(table) {
63785
+ const tableWithManager = table;
63786
+ tableWithManager[MEDIA_PREVIEW_MANAGER_KEY] || (tableWithManager[MEDIA_PREVIEW_MANAGER_KEY] = createMediaPreviewManager(table));
63787
+ const manager = tableWithManager[MEDIA_PREVIEW_MANAGER_KEY];
63788
+ return manager.ensureRegistered(), manager;
63789
+ }
63289
63790
  function bindMediaClick(table) {
63290
- "browser" === Env$1.mode && table.on(TABLE_EVENT_TYPE.CLICK_CELL, e => {
63791
+ "browser" === Env$1.mode && (getMediaPreviewManager(table), table.on(TABLE_EVENT_TYPE.CLICK_CELL, e => {
63291
63792
  const {
63292
63793
  col: col,
63293
63794
  row: row
@@ -63343,25 +63844,60 @@
63343
63844
  clickToPreview: clickToPreview
63344
63845
  } = columnDefine;
63345
63846
  if (!1 === clickToPreview) return;
63346
- const overlay = document.createElement("div");
63347
- overlay.style.width = "100%", overlay.style.height = "100%", overlay.style.position = "fixed", overlay.style.top = "0", overlay.style.left = "0", overlay.style.backgroundColor = "rgba(30, 30, 30, 0.4)", overlay.style.display = "flex", overlay.style.justifyContent = "center", overlay.style.alignItems = "center", overlay.style.overflow = "hidden", overlay.style.zIndex = "9999", overlay.addEventListener("click", e => {
63348
- e.target === overlay && document.body.removeChild(overlay);
63847
+ if (!cellValue) return;
63848
+ const previewManager = getMediaPreviewManager(table),
63849
+ overlay = document.createElement("div");
63850
+ overlay.style.width = "100%", overlay.style.height = "100%", overlay.style.position = "fixed", overlay.style.top = "0", overlay.style.left = "0", overlay.style.backgroundColor = "rgba(30, 30, 30, 0.4)", overlay.style.display = "flex", overlay.style.justifyContent = "center", overlay.style.alignItems = "center", overlay.style.overflow = "hidden", overlay.style.zIndex = "9999";
63851
+ const closeOverlay = () => {
63852
+ overlay.parentNode && document.body.removeChild(overlay);
63853
+ };
63854
+ previewManager.open(closeOverlay), overlay.addEventListener("click", e => {
63855
+ e.target === overlay && previewManager.close();
63349
63856
  });
63350
63857
  const image = new Image();
63351
63858
  image.src = cellValue, image.style.maxWidth = "80%", image.style.maxHeight = "80%", image.style.backgroundColor = "#FFF", overlay.appendChild(image), document.body.appendChild(overlay);
63859
+ } else if ("audio" === cellType || "video" === cellType && isAudioUrl(cellValue)) {
63860
+ const {
63861
+ clickToPreview: clickToPreview
63862
+ } = columnDefine;
63863
+ if (!1 === clickToPreview) return;
63864
+ if (!cellValue) return;
63865
+ const previewManager = getMediaPreviewManager(table),
63866
+ overlay = document.createElement("div");
63867
+ overlay.style.width = "100%", overlay.style.height = "100%", overlay.style.position = "fixed", overlay.style.top = "0", overlay.style.left = "0", overlay.style.backgroundColor = "rgba(30, 30, 30, 0.4)", overlay.style.display = "flex", overlay.style.justifyContent = "center", overlay.style.alignItems = "center", overlay.style.overflow = "hidden", overlay.style.zIndex = "9999";
63868
+ const audioPreview = createAudioPreview(cellValue),
63869
+ closeOverlay = () => {
63870
+ audioPreview.destroy(), overlay.parentNode && document.body.removeChild(overlay);
63871
+ };
63872
+ previewManager.open(closeOverlay), overlay.addEventListener("click", e => {
63873
+ e.target === overlay && previewManager.close();
63874
+ }), overlay.appendChild(audioPreview.element), document.body.appendChild(overlay);
63352
63875
  } else if ("video" === cellType) {
63353
63876
  const {
63354
63877
  clickToPreview: clickToPreview
63355
63878
  } = columnDefine;
63356
63879
  if (!1 === clickToPreview) return;
63357
- const overlay = document.createElement("div");
63358
- overlay.style.width = "100%", overlay.style.height = "100%", overlay.style.position = "fixed", overlay.style.top = "0", overlay.style.left = "0", overlay.style.backgroundColor = "rgba(30, 30, 30, 0.4)", overlay.style.display = "flex", overlay.style.justifyContent = "center", overlay.style.alignItems = "center", overlay.style.overflow = "hidden", overlay.style.zIndex = "9999", overlay.addEventListener("click", e => {
63359
- e.target === overlay && document.body.removeChild(overlay);
63360
- });
63880
+ if (!cellValue) return;
63881
+ const previewManager = getMediaPreviewManager(table),
63882
+ overlay = document.createElement("div");
63883
+ overlay.style.width = "100%", overlay.style.height = "100%", overlay.style.position = "fixed", overlay.style.top = "0", overlay.style.left = "0", overlay.style.backgroundColor = "rgba(30, 30, 30, 0.4)", overlay.style.display = "flex", overlay.style.justifyContent = "center", overlay.style.alignItems = "center", overlay.style.overflow = "hidden", overlay.style.zIndex = "9999";
63361
63884
  const video = document.createElement("video");
63362
- video.src = cellValue, video.style.maxWidth = "80%", video.style.maxHeight = "80%", video.setAttribute("preload", "auto"), video.setAttribute("controls", "true"), overlay.appendChild(video), document.body.appendChild(overlay);
63885
+ video.src = cellValue, video.style.maxWidth = "80%", video.style.maxHeight = "80%", video.setAttribute("preload", "auto"), video.setAttribute("controls", "true");
63886
+ const closeOverlay = () => {
63887
+ try {
63888
+ video.pause();
63889
+ } catch (err) {}
63890
+ video.removeAttribute("src");
63891
+ try {
63892
+ video.load();
63893
+ } catch (err) {}
63894
+ overlay.parentNode && document.body.removeChild(overlay);
63895
+ };
63896
+ previewManager.open(closeOverlay), overlay.appendChild(video), overlay.addEventListener("click", e => {
63897
+ e.target === overlay && previewManager.close();
63898
+ }), document.body.appendChild(overlay);
63363
63899
  }
63364
- });
63900
+ }));
63365
63901
  }
63366
63902
 
63367
63903
  function bindDrillEvent(table) {
@@ -64955,7 +65491,7 @@
64955
65491
  };
64956
65492
  let EventManager$1 = class EventManager {
64957
65493
  constructor(table) {
64958
- this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.cutRanges = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env$1.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
65494
+ this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationId = 0, this.clipboardOperationId = 0, this.pasteOperationId = 0, this.pasteWriteInProgress = !1, this.pasteWritePromise = Promise.resolve(), this.clipboardWritePromise = Promise.resolve(), this.lastCopiedClipboardData = null, this.internalFormulaHtmlMarkerId = 0, this.fieldKeyIds = new WeakMap(), this.fieldKeyId = 0, this.activeCutState = null, this.lastClipboardContent = "", this.cutCellRange = null, this.cutRanges = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env$1.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
64959
65495
  this.bindSelfEvent();
64960
65496
  }, 0));
64961
65497
  }
@@ -65176,7 +65712,7 @@
65176
65712
  }
65177
65713
  release() {
65178
65714
  var _a;
65179
- null === (_a = this.gesture) || void 0 === _a || _a.release(), this.globalEventListeners.forEach(item => {
65715
+ this.clipboardOperationId++, this.pasteOperationId++, this.resetCutState(), null === (_a = this.gesture) || void 0 === _a || _a.release(), this.globalEventListeners.forEach(item => {
65180
65716
  "document" === item.env ? document.removeEventListener(item.name, item.callback) : "body" === item.env ? document.body.removeEventListener(item.name, item.callback) : "window" === item.env ? window.removeEventListener(item.name, item.callback) : "vglobal" === item.env && vglobal.removeEventListener(item.name, item.callback);
65181
65717
  }), this.globalEventListeners = [];
65182
65718
  }
@@ -65189,289 +65725,807 @@
65189
65725
  handleCopy(e, isCut = !1) {
65190
65726
  var _a, _b, _c, _d, _e, _f;
65191
65727
  return __awaiter$1(this, void 0, void 0, function* () {
65192
- const table = this.table;
65193
- !isCut && (this.cutWaitPaste = !1), this.copySourceRange = null;
65194
- const sourceRanges = table.stateManager.select.ranges;
65195
- if (sourceRanges && 1 === sourceRanges.length) {
65196
- const sourceRange = sourceRanges[0];
65197
- this.copySourceRange = {
65198
- startCol: Math.min(sourceRange.start.col, sourceRange.end.col),
65199
- startRow: Math.min(sourceRange.start.row, sourceRange.end.row)
65200
- };
65201
- } else if (!(null == sourceRanges ? void 0 : sourceRanges.length)) return void (this.copySourceRange = null);
65728
+ const table = this.table,
65729
+ operationId = ++this.clipboardOperationId;
65730
+ this.pasteOperationId++, isCut || this.resetCutState();
65731
+ const copySnapshot = this.getCopySnapshot(isCut);
65732
+ if (this.copySourceRange = null, this.lastCopiedClipboardData = null, !copySnapshot) return this.copySourceRange = null, null;
65202
65733
  const data = this.table.getCopyValue(null === (_b = null === (_a = table.options.keyboardOptions) || void 0 === _a ? void 0 : _a.getCopyCellValue) || void 0 === _b ? void 0 : _b.value);
65203
- if (isValid$1(data)) {
65734
+ if (!isValid$1(data)) return null;
65735
+ {
65204
65736
  e.preventDefault();
65737
+ let copySucceeded = !1,
65738
+ copiedClipboardData = null;
65739
+ const canUseAsyncClipboard = window.isSecureContext && !!(null === (_c = navigator.clipboard) || void 0 === _c ? void 0 : _c.writeText),
65740
+ canWriteRichClipboard = window.isSecureContext && !!(null === (_d = navigator.clipboard) || void 0 === _d ? void 0 : _d.write) && !!window.ClipboardItem,
65741
+ hasEventClipboard = !!e.clipboardData,
65742
+ dataHTML = !canUseAsyncClipboard || canWriteRichClipboard || hasEventClipboard ? this.getCopyDataHTML(data) : null,
65743
+ formulaClipboardData = this.getCopyFormulaPlainData(data, isCut);
65744
+ if (null === formulaClipboardData) return null;
65745
+ const plainClipboardData = data,
65746
+ internalFormulaText = formulaClipboardData !== plainClipboardData ? formulaClipboardData : void 0,
65747
+ internalFormulaHtmlMarker = internalFormulaText ? this.createInternalFormulaHtmlMarker() : void 0,
65748
+ clipboardHTML = dataHTML && internalFormulaHtmlMarker ? this.attachInternalFormulaHtmlMarker(dataHTML, internalFormulaHtmlMarker) : dataHTML,
65749
+ eventClipboardWriteData = hasEventClipboard ? this.setCopyDataToEventClipboard(plainClipboardData, clipboardHTML, e, internalFormulaText, internalFormulaHtmlMarker) : null;
65750
+ if (eventClipboardWriteData) return copiedClipboardData = eventClipboardWriteData, this.lastCopiedClipboardData = copiedClipboardData, isCut && (this.lastClipboardContent = this.getClipboardSignature(copiedClipboardData), copySnapshot.clipboardData = copiedClipboardData, copySnapshot.clipboardSignature = this.lastClipboardContent), this.copySourceRange = copySnapshot.copySourceRange, this.afterCopyData(data, isCut, copySnapshot, !isCut), isCut && (null === (_e = table.keyboardOptions) || void 0 === _e ? void 0 : _e.showCopyCellBorder) && window.setTimeout(() => {
65751
+ this.isClipboardOperationCurrent(operationId) && (setActiveCellRangeState(table, copySnapshot.ranges), table.clearSelected());
65752
+ }, 0), copySnapshot;
65205
65753
  const element = table.getElement();
65206
- element && element !== document.activeElement && (element.focus(), yield new Promise(resolve => setTimeout(resolve, 10)));
65754
+ if (element && element !== document.activeElement && (element.focus(), yield new Promise(resolve => setTimeout(resolve, 10)), !this.isClipboardOperationCurrent(operationId))) return null;
65207
65755
  try {
65208
65756
  if (navigator.clipboard && navigator.clipboard.writeText) {
65209
65757
  let hasPermission = !0;
65210
65758
  if (navigator.permissions && navigator.permissions.query) try {
65211
- hasPermission = "granted" === (yield navigator.permissions.query({
65759
+ if (hasPermission = "granted" === (yield navigator.permissions.query({
65212
65760
  name: "clipboard-write"
65213
- })).state;
65761
+ })).state, !this.isClipboardOperationCurrent(operationId)) return null;
65214
65762
  } catch (permissionError) {
65215
65763
  hasPermission = !0;
65216
65764
  }
65217
65765
  if (hasPermission) try {
65218
- if (window.ClipboardItem) {
65219
- let htmlValues = data;
65220
- 1 === table.stateManager.select.ranges.length && (null === (_d = null === (_c = table.options.keyboardOptions) || void 0 === _c ? void 0 : _c.getCopyCellValue) || void 0 === _d ? void 0 : _d.html) && (htmlValues = this.table.getCopyValue(null === (_e = table.options.keyboardOptions) || void 0 === _e ? void 0 : _e.getCopyCellValue.html));
65221
- const dataHTML = setDataToHTML(htmlValues);
65222
- yield navigator.clipboard.write([new ClipboardItem({
65223
- "text/html": new Blob([dataHTML], {
65766
+ if (!this.isClipboardOperationCurrent(operationId)) return null;
65767
+ copiedClipboardData = yield this.queueClipboardWrite(() => __awaiter$1(this, void 0, void 0, function* () {
65768
+ return this.isClipboardOperationCurrent(operationId) ? canWriteRichClipboard && clipboardHTML ? (yield navigator.clipboard.write([new ClipboardItem({
65769
+ "text/html": new Blob([clipboardHTML], {
65224
65770
  type: "text/html"
65225
65771
  }),
65226
- "text/plain": new Blob([data], {
65772
+ "text/plain": new Blob([plainClipboardData], {
65227
65773
  type: "text/plain"
65228
65774
  })
65229
- })]);
65230
- } else yield navigator.clipboard.writeText(data);
65775
+ })]), {
65776
+ html: clipboardHTML,
65777
+ text: plainClipboardData,
65778
+ hasHtml: !0,
65779
+ hasText: !0,
65780
+ internalFormulaText: internalFormulaText,
65781
+ internalFormulaHtmlMarker: internalFormulaHtmlMarker
65782
+ }) : (yield navigator.clipboard.writeText(plainClipboardData), {
65783
+ html: "",
65784
+ text: plainClipboardData,
65785
+ hasText: !0,
65786
+ internalFormulaText: internalFormulaText
65787
+ }) : null;
65788
+ })), copiedClipboardData && (copySucceeded = !0);
65231
65789
  } catch (clipboardError) {
65232
- this.fallbackCopyToClipboard(data, e);
65233
- } else this.fallbackCopyToClipboard(data, e);
65234
- } else this.fallbackCopyToClipboard(data, e);
65235
- table.fireListeners(TABLE_EVENT_TYPE.COPY_DATA, {
65236
- cellRange: table.stateManager.select.ranges,
65237
- copyData: data,
65238
- isCut: isCut
65790
+ if (!this.isClipboardOperationCurrent(operationId)) return null;
65791
+ if (copySucceeded = this.fallbackCopyToClipboard(plainClipboardData), !this.isClipboardOperationCurrent(operationId)) return null;
65792
+ copySucceeded && (copiedClipboardData = {
65793
+ html: "",
65794
+ text: plainClipboardData,
65795
+ hasText: !0,
65796
+ internalFormulaText: internalFormulaText
65797
+ });
65798
+ } else copySucceeded = this.fallbackCopyToClipboard(plainClipboardData), copySucceeded && (copiedClipboardData = {
65799
+ html: "",
65800
+ text: plainClipboardData,
65801
+ hasText: !0,
65802
+ internalFormulaText: internalFormulaText
65803
+ });
65804
+ } else copySucceeded = this.fallbackCopyToClipboard(plainClipboardData), copySucceeded && (copiedClipboardData = {
65805
+ html: "",
65806
+ text: plainClipboardData,
65807
+ hasText: !0,
65808
+ internalFormulaText: internalFormulaText
65239
65809
  });
65810
+ if (!copySucceeded) return null;
65811
+ if (!this.isClipboardOperationCurrent(operationId)) return null;
65812
+ this.lastCopiedClipboardData = copiedClipboardData, isCut && (this.lastClipboardContent = this.getClipboardSignature(copiedClipboardData), copySnapshot.clipboardData = copiedClipboardData, copySnapshot.clipboardSignature = this.lastClipboardContent), this.copySourceRange = copySnapshot.copySourceRange, this.afterCopyData(data, isCut, copySnapshot, !1);
65240
65813
  } catch (error) {
65241
- this.fallbackCopyToClipboard(data, e);
65814
+ if (!this.isClipboardOperationCurrent(operationId)) return null;
65815
+ if (!this.fallbackCopyToClipboard(plainClipboardData)) return null;
65816
+ if (!this.isClipboardOperationCurrent(operationId)) return null;
65817
+ this.lastCopiedClipboardData = {
65818
+ html: "",
65819
+ text: plainClipboardData,
65820
+ hasText: !0,
65821
+ internalFormulaText: internalFormulaText
65822
+ }, isCut && (this.lastClipboardContent = this.getClipboardSignature(this.lastCopiedClipboardData), copySnapshot.clipboardData = this.lastCopiedClipboardData, copySnapshot.clipboardSignature = this.lastClipboardContent), this.copySourceRange = copySnapshot.copySourceRange, this.afterCopyData(data, isCut, copySnapshot, !1);
65823
+ }
65824
+ }
65825
+ return (null === (_f = table.keyboardOptions) || void 0 === _f ? void 0 : _f.showCopyCellBorder) && (setActiveCellRangeState(table, copySnapshot.ranges), table.clearSelected()), copySnapshot;
65826
+ });
65827
+ }
65828
+ afterCopyData(data, isCut, copySnapshot, updateCopyCellBorder = !0) {
65829
+ var _a;
65830
+ const table = this.table;
65831
+ try {
65832
+ table.fireListeners(TABLE_EVENT_TYPE.COPY_DATA, {
65833
+ cellRange: this.cloneRanges(copySnapshot.ranges),
65834
+ copyData: data,
65835
+ isCut: isCut
65836
+ });
65837
+ } catch (error) {}
65838
+ updateCopyCellBorder && (null === (_a = table.keyboardOptions) || void 0 === _a ? void 0 : _a.showCopyCellBorder) && (setActiveCellRangeState(table, copySnapshot.ranges), table.clearSelected());
65839
+ }
65840
+ getCopySnapshot(includeCellInfos) {
65841
+ const ranges = this.table.stateManager.select.ranges;
65842
+ if (!(null == ranges ? void 0 : ranges.length)) return null;
65843
+ const clonedRanges = ranges.map(range => ({
65844
+ start: {
65845
+ col: range.start.col,
65846
+ row: range.start.row
65847
+ },
65848
+ end: {
65849
+ col: range.end.col,
65850
+ row: range.end.row
65242
65851
  }
65852
+ })),
65853
+ sourceRange = 1 === ranges.length ? ranges[0] : null,
65854
+ sourceCellMatrix = this.getSourceCellMatrix(clonedRanges),
65855
+ sourceCells = this.getSourceCells(sourceCellMatrix),
65856
+ sourceSize = this.getSourceSize(clonedRanges, sourceCellMatrix);
65857
+ return {
65858
+ ranges: clonedRanges,
65859
+ copySourceRange: sourceRange ? {
65860
+ startCol: Math.min(sourceRange.start.col, sourceRange.end.col),
65861
+ startRow: Math.min(sourceRange.start.row, sourceRange.end.row)
65862
+ } : null,
65863
+ cellInfos: includeCellInfos ? this.table.getSelectedCellInfos() : null,
65864
+ sourceCells: sourceCells,
65865
+ sourceCellMatrix: sourceCellMatrix,
65866
+ sourceColCount: sourceSize.colCount,
65867
+ sourceRowCount: sourceSize.rowCount,
65868
+ clipboardData: null,
65869
+ clipboardSignature: ""
65870
+ };
65871
+ }
65872
+ cloneRanges(ranges) {
65873
+ return ranges.map(range => ({
65874
+ start: {
65875
+ col: range.start.col,
65876
+ row: range.start.row
65877
+ },
65878
+ end: {
65879
+ col: range.end.col,
65880
+ row: range.end.row
65881
+ }
65882
+ }));
65883
+ }
65884
+ getSourceCellMatrix(ranges) {
65885
+ const table = this.table,
65886
+ createSourceCell = (col, row) => {
65887
+ var _a, _b, _c, _d, _e, _f, _g, _h;
65888
+ const recordShowIndex = null === (_a = table.getRecordShowIndexByCell) || void 0 === _a ? void 0 : _a.call(table, col, row);
65889
+ return {
65890
+ col: col,
65891
+ row: row,
65892
+ recordIndex: recordShowIndex >= 0 ? null === (_c = null === (_b = table.dataSource) || void 0 === _b ? void 0 : _b.getIndexKey) || void 0 === _c ? void 0 : _c.call(_b, recordShowIndex) : void 0,
65893
+ field: null === (_g = null === (_f = null === (_e = null === (_d = table.internalProps) || void 0 === _d ? void 0 : _d.layoutMap) || void 0 === _e ? void 0 : _e.getBody) || void 0 === _f ? void 0 : _f.call(_e, col, row)) || void 0 === _g ? void 0 : _g.field,
65894
+ value: null === (_h = table.getCellOriginValue) || void 0 === _h ? void 0 : _h.call(table, col, row)
65895
+ };
65896
+ };
65897
+ if (1 === ranges.length) {
65898
+ const range = ranges[0],
65899
+ startCol = Math.min(range.start.col, range.end.col),
65900
+ endCol = Math.max(range.start.col, range.end.col),
65901
+ startRow = Math.min(range.start.row, range.end.row),
65902
+ endRow = Math.max(range.start.row, range.end.row),
65903
+ sourceCellMatrix = [];
65904
+ for (let row = startRow; row <= endRow; row++) {
65905
+ const rowCells = [];
65906
+ for (let col = startCol; col <= endCol; col++) rowCells.push(createSourceCell(col, row));
65907
+ sourceCellMatrix.push(rowCells);
65243
65908
  }
65244
- (null === (_f = table.keyboardOptions) || void 0 === _f ? void 0 : _f.showCopyCellBorder) && (setActiveCellRangeState(table), table.clearSelected());
65909
+ return sourceCellMatrix;
65910
+ }
65911
+ let minCol = Math.min(ranges[0].start.col, ranges[0].end.col),
65912
+ maxCol = Math.max(ranges[0].start.col, ranges[0].end.col),
65913
+ minRow = Math.min(ranges[0].start.row, ranges[0].end.row),
65914
+ maxRow = Math.max(ranges[0].start.row, ranges[0].end.row);
65915
+ ranges.forEach(range => {
65916
+ minCol = Math.min(minCol, range.start.col, range.end.col), maxCol = Math.max(maxCol, range.start.col, range.end.col), minRow = Math.min(minRow, range.start.row, range.end.row), maxRow = Math.max(maxRow, range.start.row, range.end.row);
65245
65917
  });
65918
+ const isExistDataInRow = row => ranges.some(range => {
65919
+ const startRow = Math.min(range.start.row, range.end.row),
65920
+ endRow = Math.max(range.start.row, range.end.row);
65921
+ return startRow <= row && endRow >= row;
65922
+ }),
65923
+ isExistDataInCol = col => ranges.some(range => {
65924
+ const startCol = Math.min(range.start.col, range.end.col),
65925
+ endCol = Math.max(range.start.col, range.end.col);
65926
+ return startCol <= col && endCol >= col;
65927
+ }),
65928
+ getRangeExistDataInCell = (col, row) => ranges.some(range => {
65929
+ const startRow = Math.min(range.start.row, range.end.row),
65930
+ endRow = Math.max(range.start.row, range.end.row),
65931
+ startCol = Math.min(range.start.col, range.end.col),
65932
+ endCol = Math.max(range.start.col, range.end.col);
65933
+ return startCol <= col && endCol >= col && startRow <= row && endRow >= row;
65934
+ }),
65935
+ sourceCellMatrix = [];
65936
+ for (let row = minRow; row <= maxRow; row++) {
65937
+ if (!isExistDataInRow(row)) continue;
65938
+ const rowCells = [];
65939
+ for (let col = minCol; col <= maxCol; col++) isExistDataInCol(col) && rowCells.push(getRangeExistDataInCell(col, row) ? createSourceCell(col, row) : null);
65940
+ sourceCellMatrix.push(rowCells);
65941
+ }
65942
+ return sourceCellMatrix;
65943
+ }
65944
+ getSourceCells(sourceCellMatrix) {
65945
+ const sourceCells = [];
65946
+ for (let row = 0; row < sourceCellMatrix.length; row++) for (let col = 0; col < sourceCellMatrix[row].length; col++) {
65947
+ const sourceCell = sourceCellMatrix[row][col];
65948
+ sourceCell && sourceCells.push(sourceCell);
65949
+ }
65950
+ return sourceCells;
65951
+ }
65952
+ getSourceSize(ranges, sourceCellMatrix) {
65953
+ var _a, _b;
65954
+ if (sourceCellMatrix.length) return {
65955
+ colCount: null !== (_b = null === (_a = sourceCellMatrix[0]) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0,
65956
+ rowCount: sourceCellMatrix.length
65957
+ };
65958
+ if (1 === ranges.length) {
65959
+ const range = ranges[0];
65960
+ return {
65961
+ colCount: Math.abs(range.end.col - range.start.col) + 1,
65962
+ rowCount: Math.abs(range.end.row - range.start.row) + 1
65963
+ };
65964
+ }
65965
+ return {
65966
+ colCount: 0,
65967
+ rowCount: 0
65968
+ };
65969
+ }
65970
+ getClipboardSignature(data) {
65971
+ return data ? JSON.stringify({
65972
+ html: data.hasHtml ? data.html : null,
65973
+ text: data.hasText ? data.text : null
65974
+ }) : "";
65246
65975
  }
65247
- fallbackCopyToClipboard(data, e) {
65976
+ isClipboardOperationCurrent(operationId) {
65977
+ return operationId === this.clipboardOperationId && !this.table.isReleased;
65978
+ }
65979
+ isPasteOperationCurrent(operationId) {
65980
+ return (void 0 === operationId || operationId === this.pasteOperationId) && !this.table.isReleased;
65981
+ }
65982
+ queueClipboardWrite(write) {
65983
+ return __awaiter$1(this, void 0, void 0, function* () {
65984
+ const previousWrite = this.clipboardWritePromise;
65985
+ let settleCurrentWrite = () => {};
65986
+ this.clipboardWritePromise = previousWrite.catch(() => {}).then(() => new Promise(resolve => {
65987
+ settleCurrentWrite = resolve;
65988
+ })), yield previousWrite.catch(() => {});
65989
+ try {
65990
+ return yield write();
65991
+ } finally {
65992
+ settleCurrentWrite();
65993
+ }
65994
+ });
65995
+ }
65996
+ isClipboardDataChanged(clipboardData, cutState) {
65997
+ if (!clipboardData || clipboardData.readFailed) return null;
65998
+ const sourceData = cutState.clipboardData;
65999
+ if (!sourceData) return this.getClipboardSignature(clipboardData) !== cutState.clipboardSignature;
66000
+ if (sourceData.hasHtml && !clipboardData.hasHtml) return null;
66001
+ if (sourceData.hasText && !clipboardData.hasText) return null;
66002
+ let hasComparableType = !1;
66003
+ return !(!clipboardData.hasHtml || !sourceData.hasHtml || (hasComparableType = !0, clipboardData.html === sourceData.html)) || !(!clipboardData.hasText || !sourceData.hasText || (hasComparableType = !0, clipboardData.text === sourceData.text)) || !hasComparableType && null;
66004
+ }
66005
+ isClipboardDataSameAsLastCopy(clipboardData) {
66006
+ const sourceData = this.lastCopiedClipboardData;
66007
+ return !(!clipboardData || clipboardData.readFailed || !sourceData) && this.isClipboardDataSameBySignature(clipboardData, sourceData);
66008
+ }
66009
+ isClipboardDataSameBySignature(clipboardData, sourceData) {
66010
+ return !(sourceData.hasHtml !== clipboardData.hasHtml || sourceData.hasText !== clipboardData.hasText || sourceData.hasHtml && sourceData.html !== clipboardData.html || sourceData.hasText && sourceData.text !== clipboardData.text);
66011
+ }
66012
+ getCopyFormulaPlainData(data, isCut) {
66013
+ var _a, _b;
66014
+ const table = this.table;
66015
+ if (1 !== table.stateManager.select.ranges.length || !(null === (_b = null === (_a = table.options.keyboardOptions) || void 0 === _a ? void 0 : _a.getCopyCellValue) || void 0 === _b ? void 0 : _b.html)) return data;
66016
+ try {
66017
+ return this.table.getCopyValue(table.options.keyboardOptions.getCopyCellValue.html);
66018
+ } catch (error) {
66019
+ return isCut ? null : data;
66020
+ }
66021
+ }
66022
+ getCopyDataHTML(data) {
66023
+ var _a, _b, _c;
66024
+ const table = this.table;
66025
+ let htmlValues = data;
66026
+ try {
66027
+ return 1 === table.stateManager.select.ranges.length && (null === (_b = null === (_a = table.options.keyboardOptions) || void 0 === _a ? void 0 : _a.getCopyCellValue) || void 0 === _b ? void 0 : _b.html) && (htmlValues = this.table.getCopyValue(null === (_c = table.options.keyboardOptions) || void 0 === _c ? void 0 : _c.getCopyCellValue.html)), setDataToHTML(htmlValues);
66028
+ } catch (error) {
66029
+ try {
66030
+ return setDataToHTML(data);
66031
+ } catch (fallbackError) {
66032
+ return null;
66033
+ }
66034
+ }
66035
+ }
66036
+ createInternalFormulaHtmlMarker() {
66037
+ return `vtable-formula-${Date.now()}-${++this.internalFormulaHtmlMarkerId}`;
66038
+ }
66039
+ attachInternalFormulaHtmlMarker(html, marker) {
66040
+ return `${html}\x3c!--${marker}--\x3e`;
66041
+ }
66042
+ setCopyDataToEventClipboard(data, dataHTML, e, internalFormulaText, internalFormulaHtmlMarker) {
66043
+ const clipboardData = e.clipboardData;
66044
+ if (!clipboardData) return null;
66045
+ try {
66046
+ clipboardData.setData("text/plain", data);
66047
+ const copiedClipboardData = {
66048
+ html: "",
66049
+ text: data,
66050
+ hasText: !0,
66051
+ internalFormulaText: internalFormulaText
66052
+ };
66053
+ if (dataHTML) try {
66054
+ clipboardData.setData("text/html", dataHTML), copiedClipboardData.html = dataHTML, copiedClipboardData.hasHtml = !0, copiedClipboardData.internalFormulaHtmlMarker = internalFormulaHtmlMarker;
66055
+ } catch (error) {}
66056
+ return copiedClipboardData;
66057
+ } catch (error) {
66058
+ return null;
66059
+ }
66060
+ }
66061
+ fallbackCopyToClipboard(data) {
65248
66062
  try {
65249
- if (e.clipboardData) return void e.clipboardData.setData("text/plain", data);
65250
66063
  document.activeElement && document.activeElement !== document.body && document.activeElement.blur();
65251
66064
  const textArea = document.createElement("textarea");
65252
66065
  textArea.value = data, textArea.style.position = "fixed", textArea.style.left = "-999999px", textArea.style.top = "-999999px", textArea.style.opacity = "0", textArea.setAttribute("readonly", ""), textArea.setAttribute("aria-hidden", "true"), document.body.appendChild(textArea), textArea.focus(), textArea.select(), textArea.setSelectionRange(0, data.length);
65253
66066
  try {
65254
- document.execCommand("copy");
66067
+ const successful = document.execCommand("copy");
66068
+ return successful;
65255
66069
  } catch (execError) {} finally {
65256
66070
  document.body.removeChild(textArea);
65257
66071
  }
65258
66072
  } catch (error) {}
66073
+ return !1;
65259
66074
  }
65260
66075
  handleCut(e) {
65261
- var _a;
65262
66076
  return __awaiter$1(this, void 0, void 0, function* () {
65263
- this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.cutRanges = null === (_a = this.table.stateManager.select.ranges) || void 0 === _a ? void 0 : _a.map(r => ({
65264
- start: {
65265
- col: r.start.col,
65266
- row: r.start.row
65267
- },
65268
- end: {
65269
- col: r.end.col,
65270
- row: r.end.row
65271
- }
65272
- })), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
65273
- this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer = null);
65274
- }, 3e4), this.saveClipboardContent();
66077
+ const copySnapshot = yield this.handleCopy(e, !0);
66078
+ if (!copySnapshot) return;
66079
+ const cutState = {
66080
+ id: ++this.cutOperationId,
66081
+ ranges: this.cloneRanges(copySnapshot.ranges),
66082
+ cellInfos: copySnapshot.cellInfos,
66083
+ sourceCells: copySnapshot.sourceCells,
66084
+ sourceCellMatrix: copySnapshot.sourceCellMatrix,
66085
+ sourceColCount: copySnapshot.sourceColCount,
66086
+ sourceRowCount: copySnapshot.sourceRowCount,
66087
+ clipboardData: copySnapshot.clipboardData,
66088
+ clipboardSignature: copySnapshot.clipboardSignature,
66089
+ copySourceRange: copySnapshot.copySourceRange,
66090
+ isSingleRange: 1 === copySnapshot.ranges.length
66091
+ };
66092
+ this.cutWaitPaste = !0, this.activeCutState = cutState, this.cutCellRange = cutState.cellInfos, this.cutRanges = cutState.ranges, this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
66093
+ this.cutWaitPaste && this.resetCutState();
66094
+ }, 3e4), this.lastClipboardContent = cutState.clipboardSignature;
65275
66095
  });
65276
66096
  }
65277
66097
  handlePaste(e) {
65278
- this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
65279
- this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
65280
- }).catch(() => {
65281
- this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
65282
- }) : this.executePaste(e);
66098
+ const pasteOperationId = ++this.pasteOperationId,
66099
+ pasteRange = this.getPasteRange();
66100
+ if (!pasteRange) return;
66101
+ const eventClipboardData = this.getEventClipboardData(e),
66102
+ pasteCopySourceRange = this.copySourceRange;
66103
+ if (!this.cutWaitPaste) return void this.readClipboardDataForPaste(eventClipboardData).then(clipboardData => {
66104
+ if (!this.isPasteOperationCurrent(pasteOperationId)) return;
66105
+ const copySourceRange = this.isClipboardDataSameAsLastCopy(clipboardData) ? pasteCopySourceRange : null;
66106
+ this.executePaste(clipboardData, {
66107
+ pasteRange: pasteRange,
66108
+ copySourceRange: copySourceRange,
66109
+ pasteOperationId: pasteOperationId
66110
+ });
66111
+ }).catch(error => {});
66112
+ const cutState = this.activeCutState;
66113
+ cutState ? this.readClipboardDataForPaste(eventClipboardData).then(clipboardData => __awaiter$1(this, void 0, void 0, function* () {
66114
+ var _a, _b, _c, _d, _e;
66115
+ if (!this.isPasteOperationCurrent(pasteOperationId) || (null === (_a = this.activeCutState) || void 0 === _a ? void 0 : _a.id) !== cutState.id) return;
66116
+ const changed = this.isClipboardDataChanged(clipboardData, cutState);
66117
+ if (null === changed) return void (yield this.executePaste(clipboardData, {
66118
+ pasteRange: pasteRange,
66119
+ copySourceRange: this.isClipboardDataSameAsLastCopy(clipboardData) ? pasteCopySourceRange : null,
66120
+ pasteOperationId: pasteOperationId
66121
+ }));
66122
+ const pasteResult = yield this.executePaste(clipboardData, {
66123
+ pasteRange: pasteRange,
66124
+ copySourceRange: changed ? null : cutState.copySourceRange,
66125
+ cutState: changed ? null : cutState,
66126
+ pasteOperationId: pasteOperationId
66127
+ });
66128
+ if (this.isPasteOperationCurrent(pasteOperationId) && (null === (_b = this.activeCutState) || void 0 === _b ? void 0 : _b.id) === cutState.id) if (changed || !pasteResult.pasted || (null === (_c = this.activeCutState) || void 0 === _c ? void 0 : _c.id) !== cutState.id) changed && (null === (_e = this.activeCutState) || void 0 === _e ? void 0 : _e.id) === cutState.id && this.resetCutState();else if (pasteResult.migratedSourceCells.length === cutState.sourceCells.length) {
66129
+ if (!(yield this.clearCutArea(pasteResult.migratedSourceCells, pasteResult.changedCells))) return void this.resetCutState();
66130
+ (null === (_d = this.activeCutState) || void 0 === _d ? void 0 : _d.id) === cutState.id && this.resetCutState();
66131
+ }
66132
+ })).catch(() => __awaiter$1(this, void 0, void 0, function* () {
66133
+ this.isPasteOperationCurrent(pasteOperationId) && (yield this.executePaste(eventClipboardData, {
66134
+ pasteRange: pasteRange,
66135
+ copySourceRange: this.isClipboardDataSameAsLastCopy(eventClipboardData) ? pasteCopySourceRange : null,
66136
+ pasteOperationId: pasteOperationId
66137
+ }));
66138
+ })) : this.executePaste(eventClipboardData, {
66139
+ pasteRange: pasteRange,
66140
+ copySourceRange: this.isClipboardDataSameAsLastCopy(eventClipboardData) ? pasteCopySourceRange : null,
66141
+ pasteOperationId: pasteOperationId
66142
+ });
65283
66143
  }
65284
- executePaste(e) {
65285
- var _a, _b, _c;
66144
+ executePaste(clipboardData, pasteContext) {
66145
+ var _a, _b, _c, _d;
65286
66146
  return __awaiter$1(this, void 0, void 0, function* () {
65287
- const table = this.table;
65288
- if (!(null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.editingEditor)) {
65289
- if (table.changeCellValues && (null === (_b = table.stateManager.select.ranges) || void 0 === _b ? void 0 : _b.length) > 0) try {
65290
- if (navigator.clipboard && navigator.clipboard.read) try {
65291
- const clipboardItems = yield navigator.clipboard.read();
65292
- let handled = !1;
65293
- for (const item of clipboardItems) {
65294
- if (item.types.includes("text/html")) {
65295
- yield this.pasteHtmlToTable(item), handled = !0;
65296
- break;
65297
- }
65298
- if (item.types.includes("text/plain")) {
65299
- yield this.pasteTextToTable(item), handled = !0;
65300
- break;
65301
- }
65302
- }
65303
- handled || (yield this.fallbackPasteFromClipboard(e));
65304
- } catch (clipboardError) {
65305
- yield this.fallbackPasteFromClipboard(e);
65306
- } else yield this.fallbackPasteFromClipboard(e);
66147
+ const table = this.table,
66148
+ emptyResult = this.getEmptyPasteResult(),
66149
+ pasteClipboardData = this.getPasteClipboardData(clipboardData, pasteContext);
66150
+ if (!this.isPasteOperationCurrent(pasteContext.pasteOperationId) || (null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.editingEditor)) return emptyResult;
66151
+ if (this.pasteWriteInProgress && (yield this.pasteWritePromise.catch(() => {}), !this.isPasteOperationCurrent(pasteContext.pasteOperationId) || (null === (_b = table.editorManager) || void 0 === _b ? void 0 : _b.editingEditor))) return emptyResult;
66152
+ let pasteResult = emptyResult,
66153
+ settlePasteWrite = () => {};
66154
+ this.pasteWritePromise = new Promise(resolve => {
66155
+ settlePasteWrite = resolve;
66156
+ }), this.pasteWriteInProgress = !0;
66157
+ try {
66158
+ if (table.changeCellValues) try {
66159
+ if (null == pasteClipboardData ? void 0 : pasteClipboardData.html) try {
66160
+ const htmlResult = yield this.processPastedHTML(pasteClipboardData.html, pasteContext);
66161
+ if (htmlResult.pasted) return pasteResult = htmlResult, pasteResult;
66162
+ } catch (error) {
66163
+ if (/<table\b/i.test(pasteClipboardData.html)) return emptyResult;
66164
+ }
66165
+ if ((null == pasteClipboardData ? void 0 : pasteClipboardData.hasText) || (null == pasteClipboardData ? void 0 : pasteClipboardData.text)) return pasteResult = yield this.processPastedText(null !== (_c = pasteClipboardData.internalFormulaText) && void 0 !== _c ? _c : pasteClipboardData.text, pasteContext), pasteResult;
65307
66166
  } catch (error) {
65308
- yield this.fallbackPasteFromClipboard(e);
66167
+ pasteContext.cutState && this.resetCutState();
65309
66168
  }
65310
- (null === (_c = table.keyboardOptions) || void 0 === _c ? void 0 : _c.showCopyCellBorder) && clearActiveCellRangeState(table);
66169
+ return pasteResult;
66170
+ } finally {
66171
+ this.pasteWriteInProgress = !1, settlePasteWrite(), !pasteContext.cutState && (null === (_d = table.keyboardOptions) || void 0 === _d ? void 0 : _d.showCopyCellBorder) && clearActiveCellRangeState(table);
65311
66172
  }
65312
66173
  });
65313
66174
  }
65314
- fallbackPasteFromClipboard(e) {
66175
+ getPasteClipboardData(clipboardData, pasteContext) {
66176
+ var _a, _b;
66177
+ if (!clipboardData || !pasteContext.copySourceRange) return clipboardData;
66178
+ const sourceData = null !== (_b = null === (_a = pasteContext.cutState) || void 0 === _a ? void 0 : _a.clipboardData) && void 0 !== _b ? _b : this.lastCopiedClipboardData;
66179
+ return (null == sourceData ? void 0 : sourceData.internalFormulaText) && sourceData.internalFormulaHtmlMarker && sourceData.hasHtml && clipboardData.hasHtml && this.isClipboardDataSameBySignature(clipboardData, sourceData) && clipboardData.html.includes(sourceData.internalFormulaHtmlMarker) ? Object.assign(Object.assign({}, clipboardData), {
66180
+ internalFormulaText: sourceData.internalFormulaText
66181
+ }) : clipboardData;
66182
+ }
66183
+ getPasteRange() {
66184
+ const ranges = this.table.stateManager.select.ranges;
66185
+ if (!(null == ranges ? void 0 : ranges.length)) return null;
66186
+ const range = ranges[ranges.length - 1];
66187
+ return {
66188
+ col: Math.min(range.start.col, range.end.col),
66189
+ row: Math.min(range.start.row, range.end.row),
66190
+ maxCol: Math.max(range.start.col, range.end.col),
66191
+ maxRow: Math.max(range.start.row, range.end.row)
66192
+ };
66193
+ }
66194
+ getEventClipboardData(e) {
66195
+ var _a;
66196
+ const clipboardData = e.clipboardData || window.clipboardData;
66197
+ if (!clipboardData) return null;
66198
+ try {
66199
+ const types = Array.from(null !== (_a = clipboardData.types) && void 0 !== _a ? _a : []),
66200
+ html = clipboardData.getData("text/html") || "",
66201
+ text = clipboardData.getData("text/plain") || clipboardData.getData("text") || clipboardData.getData("Text") || "",
66202
+ hasHtml = types.includes("text/html") || !!html;
66203
+ return {
66204
+ html: html,
66205
+ text: text,
66206
+ hasHtml: hasHtml,
66207
+ hasText: types.includes("text/plain") || types.includes("text") || types.includes("Text") || !!text
66208
+ };
66209
+ } catch (error) {
66210
+ return {
66211
+ html: "",
66212
+ text: "",
66213
+ readFailed: !0
66214
+ };
66215
+ }
66216
+ }
66217
+ readClipboardDataForPaste(eventClipboardData) {
66218
+ var _a, _b;
65315
66219
  return __awaiter$1(this, void 0, void 0, function* () {
65316
- const table = this.table,
65317
- ranges = table.stateManager.select.ranges,
65318
- col = Math.min(ranges[0].start.col, ranges[0].end.col),
65319
- row = Math.min(ranges[0].start.row, ranges[0].end.row);
65320
- try {
65321
- const element = table.getElement();
65322
- element && element !== document.activeElement && (element.focus(), yield new Promise(resolve => setTimeout(resolve, 10)));
65323
- const clipboardData = e.clipboardData || window.clipboardData || window.Clipboard;
65324
- if (clipboardData) {
65325
- const pastedData = clipboardData.getData("text") || clipboardData.getData("Text");
65326
- if (pastedData) return void (yield this.processPastedText(pastedData, col, row));
65327
- }
66220
+ if ((null == eventClipboardData ? void 0 : eventClipboardData.readFailed) || (null == eventClipboardData ? void 0 : eventClipboardData.hasHtml) || (null == eventClipboardData ? void 0 : eventClipboardData.hasText)) return eventClipboardData;
66221
+ if (null === (_a = navigator.clipboard) || void 0 === _a ? void 0 : _a.read) try {
66222
+ const clipboardItems = yield navigator.clipboard.read(),
66223
+ clipboardData = {
66224
+ html: "",
66225
+ text: ""
66226
+ };
66227
+ for (const item of clipboardItems) {
66228
+ if (!clipboardData.html && item.types.includes("text/html")) try {
66229
+ clipboardData.html = yield (yield item.getType("text/html")).text(), clipboardData.hasHtml = !0;
66230
+ } catch (error) {}
66231
+ if (!clipboardData.text && item.types.includes("text/plain")) try {
66232
+ clipboardData.text = yield (yield item.getType("text/plain")).text(), clipboardData.hasText = !0;
66233
+ } catch (error) {}
66234
+ }
66235
+ if (clipboardData.hasHtml || clipboardData.hasText) return clipboardData;
66236
+ } catch (error) {}
66237
+ if (null === (_b = navigator.clipboard) || void 0 === _b ? void 0 : _b.readText) try {
66238
+ return {
66239
+ html: "",
66240
+ text: yield navigator.clipboard.readText(),
66241
+ hasText: !0
66242
+ };
65328
66243
  } catch (error) {}
66244
+ return null != eventClipboardData ? eventClipboardData : {
66245
+ html: "",
66246
+ text: "",
66247
+ readFailed: !0
66248
+ };
65329
66249
  });
65330
66250
  }
65331
- processPastedText(pastedData, col, row) {
66251
+ decodeHTMLCellValue(cellHTML) {
65332
66252
  var _a;
66253
+ const template = document.createElement("template");
66254
+ return template.innerHTML = cellHTML.replace(/<br\b[^>]*>(?:\r\n|\r|\n)?/gim, "\n").replace(/&nbsp;/gi, " "), null !== (_a = template.content.textContent) && void 0 !== _a ? _a : "";
66255
+ }
66256
+ processPastedHTML(pastedData, pasteContext) {
66257
+ var _a, _b, _c;
65333
66258
  return __awaiter$1(this, void 0, void 0, function* () {
65334
- const table = this.table,
65335
- rows = pastedData.split("\n"),
66259
+ const cellRegex = /<t[dh][^>]*>([\s\S]*?)<\/t[dh]>/gi,
66260
+ table = this.table,
66261
+ pasteRange = pasteContext.pasteRange,
66262
+ {
66263
+ col: col,
66264
+ row: row,
66265
+ maxCol: maxCol,
66266
+ maxRow: maxRow
66267
+ } = pasteRange;
66268
+ let pasteValuesColCount = 0,
66269
+ pasteValuesRowCount = 0,
65336
66270
  values = [];
66271
+ if (!pastedData || !/<table\b/i.test(pastedData)) return this.getEmptyPasteResult();
66272
+ const matches = Array.from(pastedData.matchAll(/<tr[^>]*>([\s\S]*?)<\/tr>/gi));
66273
+ for (const match of matches) {
66274
+ const rowContent = match[1],
66275
+ cellMatches = Array.from(rowContent.matchAll(cellRegex));
66276
+ if (!cellMatches.length) continue;
66277
+ const rowValues = cellMatches.map(cellMatch => this.decodeHTMLCellValue(cellMatch[1]));
66278
+ values.push(rowValues), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
66279
+ }
66280
+ if (pasteValuesRowCount = null !== (_b = values.length) && void 0 !== _b ? _b : 0, !pasteValuesRowCount || !pasteValuesColCount) return this.getEmptyPasteResult();
65337
66281
  let processedValues;
65338
- rows.forEach(function (rowCells) {
65339
- const cells = rowCells.split("\t"),
65340
- rowValues = [];
65341
- values.push(rowValues), cells.forEach(function (cell, cellIndex) {
65342
- cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
65343
- });
65344
- }), (null === (_a = table.options.keyboardOptions) || void 0 === _a ? void 0 : _a.processFormulaBeforePaste) && this.copySourceRange && (processedValues = table.options.keyboardOptions.processFormulaBeforePaste(values, this.copySourceRange.startCol, this.copySourceRange.startRow, col, row));
65345
- const changedCellResults = yield table.changeCellValues(col, row, processedValues || values, !0);
65346
- table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
66282
+ values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1), (null === (_c = table.options.keyboardOptions) || void 0 === _c ? void 0 : _c.processFormulaBeforePaste) && pasteContext.copySourceRange && (processedValues = table.options.keyboardOptions.processFormulaBeforePaste(values, pasteContext.copySourceRange.startCol, pasteContext.copySourceRange.startRow, col, row));
66283
+ const valuesToPaste = processedValues || values,
66284
+ targetCells = this.getPasteTargetCells(pasteRange, valuesToPaste);
66285
+ if (!this.isPasteOperationCurrent(pasteContext.pasteOperationId)) return this.getEmptyPasteResult();
66286
+ if (pasteContext.cutState) {
66287
+ const validatedCellResults = yield this.validatePasteTargetCells(pasteRange, valuesToPaste);
66288
+ if (!this.isPasteOperationCurrent(pasteContext.pasteOperationId)) return this.getEmptyPasteResult();
66289
+ if (!this.isFullPasteAllowed(valuesToPaste, validatedCellResults)) return this.getEmptyPasteResult(validatedCellResults);
66290
+ }
66291
+ const rawChangedCellResults = yield table.changeCellValues(col, row, valuesToPaste, !pasteContext.cutState, !0, void 0, () => !this.isPasteOperationCurrent(pasteContext.pasteOperationId));
66292
+ if (!this.isPasteOperationCurrent(pasteContext.pasteOperationId)) return this.getEmptyPasteResult();
66293
+ const changedCellResults = this.normalizeChangedCellResults(rawChangedCellResults, pasteRange, valuesToPaste),
66294
+ changedCells = this.getChangedCells(targetCells, changedCellResults),
66295
+ migratedSourceCells = this.getMigratedSourceCells(pasteContext.cutState, changedCellResults);
66296
+ return changedCells.length ? (this.firePastedDataEvent(col, row, valuesToPaste, changedCellResults), {
66297
+ pasted: !0,
66298
+ changedCellResults: changedCellResults,
66299
+ changedCells: changedCells,
66300
+ migratedSourceCells: migratedSourceCells
66301
+ }) : this.getEmptyPasteResult(changedCellResults);
66302
+ });
66303
+ }
66304
+ processPastedText(pastedData, pasteContext) {
66305
+ var _a;
66306
+ return __awaiter$1(this, void 0, void 0, function* () {
66307
+ const table = this.table,
66308
+ pasteRange = pasteContext.pasteRange,
66309
+ {
66310
+ col: col,
66311
+ row: row,
66312
+ maxCol: maxCol,
66313
+ maxRow: maxRow
66314
+ } = pasteRange;
66315
+ let values = this.parsePlainTextPastedData(pastedData);
66316
+ const pasteValuesRowCount = values.length,
66317
+ pasteValuesColCount = Math.max(...values.map(rowValues => rowValues.length));
66318
+ if (!pasteValuesRowCount || !pasteValuesColCount) return this.getEmptyPasteResult();
66319
+ let processedValues;
66320
+ values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1), (null === (_a = table.options.keyboardOptions) || void 0 === _a ? void 0 : _a.processFormulaBeforePaste) && pasteContext.copySourceRange && (processedValues = table.options.keyboardOptions.processFormulaBeforePaste(values, pasteContext.copySourceRange.startCol, pasteContext.copySourceRange.startRow, col, row));
66321
+ const valuesToPaste = processedValues || values,
66322
+ targetCells = this.getPasteTargetCells(pasteRange, valuesToPaste);
66323
+ if (!this.isPasteOperationCurrent(pasteContext.pasteOperationId)) return this.getEmptyPasteResult();
66324
+ if (pasteContext.cutState) {
66325
+ const validatedCellResults = yield this.validatePasteTargetCells(pasteRange, valuesToPaste);
66326
+ if (!this.isPasteOperationCurrent(pasteContext.pasteOperationId)) return this.getEmptyPasteResult();
66327
+ if (!this.isFullPasteAllowed(valuesToPaste, validatedCellResults)) return this.getEmptyPasteResult(validatedCellResults);
66328
+ }
66329
+ const rawChangedCellResults = yield table.changeCellValues(col, row, valuesToPaste, !pasteContext.cutState, !0, void 0, () => !this.isPasteOperationCurrent(pasteContext.pasteOperationId));
66330
+ if (!this.isPasteOperationCurrent(pasteContext.pasteOperationId)) return this.getEmptyPasteResult();
66331
+ const changedCellResults = this.normalizeChangedCellResults(rawChangedCellResults, pasteRange, valuesToPaste),
66332
+ changedCells = this.getChangedCells(targetCells, changedCellResults),
66333
+ migratedSourceCells = this.getMigratedSourceCells(pasteContext.cutState, changedCellResults);
66334
+ return changedCells.length ? (this.firePastedDataEvent(col, row, valuesToPaste, changedCellResults), {
66335
+ pasted: !0,
66336
+ changedCellResults: changedCellResults,
66337
+ changedCells: changedCells,
66338
+ migratedSourceCells: migratedSourceCells
66339
+ }) : this.getEmptyPasteResult(changedCellResults);
66340
+ });
66341
+ }
66342
+ firePastedDataEvent(col, row, pasteData, changedCellResults) {
66343
+ const table = this.table;
66344
+ if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) try {
66345
+ table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
65347
66346
  col: col,
65348
66347
  row: row,
65349
- pasteData: processedValues || values,
66348
+ pasteData: pasteData,
65350
66349
  changedCellResults: changedCellResults
65351
66350
  });
65352
- });
65353
- }
65354
- clearCutArea(table) {
65355
- try {
65356
- const ranges = this.cutRanges;
65357
- if (!ranges || 0 === ranges.length) return;
65358
- table.changeCellValuesByRanges(ranges, "");
65359
66351
  } catch (error) {}
65360
66352
  }
65361
- checkClipboardChanged() {
65362
- return __awaiter$1(this, void 0, void 0, function* () {
65363
- if (!navigator.clipboard || !navigator.clipboard.readText) return !1;
65364
- try {
65365
- return (yield navigator.clipboard.readText()) !== this.lastClipboardContent;
65366
- } catch (err) {
65367
- return !1;
65368
- }
65369
- });
66353
+ getEmptyPasteResult(changedCellResults = []) {
66354
+ return {
66355
+ pasted: !1,
66356
+ changedCellResults: changedCellResults,
66357
+ changedCells: [],
66358
+ migratedSourceCells: []
66359
+ };
65370
66360
  }
65371
- saveClipboardContent() {
65372
- navigator.clipboard && navigator.clipboard.readText && setTimeout(() => {
65373
- navigator.clipboard.readText().then(text => {
65374
- this.lastClipboardContent = text;
65375
- }).catch(err => {});
65376
- }, 50);
65377
- }
65378
- pasteHtmlToTable(item) {
65379
- const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g,
65380
- cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g,
65381
- table = this.table,
65382
- ranges = table.stateManager.select.ranges,
65383
- selectRangeLength = ranges.length,
65384
- col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
65385
- row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
65386
- maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
65387
- maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
65388
- let pasteValuesColCount = 0,
65389
- pasteValuesRowCount = 0,
65390
- values = [];
65391
- item.getType("text/html").then(blob => {
65392
- blob.text().then(pastedData => __awaiter$1(this, void 0, void 0, function* () {
65393
- var _a, _b, _c;
65394
- if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
65395
- const matches = Array.from(pastedData.matchAll(regex));
65396
- for (const match of matches) {
65397
- const rowContent = match[1],
65398
- rowValues = Array.from(rowContent.matchAll(cellRegex)).map(cellMatch => cellMatch[1].replace(/(<(?!br)([^>]+)>)/gi, "").replace(/<br(\s*|\/)>[\r\n]?/gim, "\n").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&#9;/gi, "\t").replace(/&nbsp;/g, " "));
65399
- values.push(rowValues), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
65400
- }
65401
- let processedValues;
65402
- pasteValuesRowCount = null !== (_b = values.length) && void 0 !== _b ? _b : 0, values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1), (null === (_c = table.options.keyboardOptions) || void 0 === _c ? void 0 : _c.processFormulaBeforePaste) && this.copySourceRange && (processedValues = table.options.keyboardOptions.processFormulaBeforePaste(values, this.copySourceRange.startCol, this.copySourceRange.startRow, col, row));
65403
- const changedCellResults = yield table.changeCellValues(col, row, processedValues || values, !0);
65404
- table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
65405
- col: col,
65406
- row: row,
65407
- pasteData: processedValues || values,
65408
- changedCellResults: changedCellResults
65409
- });
65410
- } else navigator.clipboard.read().then(clipboardItems => {
65411
- for (const item of clipboardItems) item.types.includes("text/plain") && item.getType("text/plain").then(blob => {
65412
- blob.text().then(data => this._pasteValue(data));
65413
- });
65414
- });
65415
- }));
65416
- });
66361
+ getPasteTargetCells(pasteRange, values) {
66362
+ const targetCells = [];
66363
+ for (let rowIndex = 0; rowIndex < values.length; rowIndex++) {
66364
+ targetCells[rowIndex] = [];
66365
+ for (let colIndex = 0; colIndex < values[rowIndex].length; colIndex++) targetCells[rowIndex][colIndex] = this.getCellIdentity(pasteRange.col + colIndex, pasteRange.row + rowIndex);
66366
+ }
66367
+ return targetCells;
65417
66368
  }
65418
- _pasteValue(pastedData) {
65419
- var _a, _b;
66369
+ getChangedCells(targetCells, changedCellResults) {
66370
+ var _a, _b, _c;
66371
+ const changedCells = [];
66372
+ for (let rowIndex = 0; rowIndex < changedCellResults.length; rowIndex++) for (let colIndex = 0; colIndex < (null !== (_b = null === (_a = changedCellResults[rowIndex]) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0); colIndex++) changedCellResults[rowIndex][colIndex] && (null === (_c = targetCells[rowIndex]) || void 0 === _c ? void 0 : _c[colIndex]) && changedCells.push(targetCells[rowIndex][colIndex]);
66373
+ return changedCells;
66374
+ }
66375
+ normalizeChangedCellResults(changedCellResults, pasteRange, values) {
66376
+ if (Array.isArray(changedCellResults)) return changedCellResults;
66377
+ const table = this.table;
66378
+ return values.map((rowValues, rowIndex) => rowValues.map((_value, colIndex) => {
66379
+ const targetCol = pasteRange.col + colIndex,
66380
+ targetRow = pasteRange.row + rowIndex;
66381
+ return targetCol < table.colCount && targetRow < table.rowCount && (!table.isHasEditorDefine || table.isHasEditorDefine(targetCol, targetRow));
66382
+ }));
66383
+ }
66384
+ validatePasteTargetCells(pasteRange, values) {
66385
+ var _a, _b, _c, _d;
65420
66386
  return __awaiter$1(this, void 0, void 0, function* () {
65421
66387
  const table = this.table,
65422
- ranges = table.stateManager.select.ranges,
65423
- selectRangeLength = ranges.length,
65424
- col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
65425
- row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
65426
- maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
65427
- maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
65428
- let pasteValuesColCount = 0,
65429
- pasteValuesRowCount = 0,
65430
- values = [];
65431
- let processedValues;
65432
- pastedData.split("\n").forEach(function (rowCells, rowIndex) {
65433
- var _a;
65434
- const cells = rowCells.split("\t"),
65435
- rowValues = [];
65436
- values.push(rowValues), cells.forEach(function (cell, cellIndex) {
65437
- cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
65438
- }), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
65439
- }), pasteValuesRowCount = null !== (_a = values.length) && void 0 !== _a ? _a : 0, values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1), (null === (_b = table.options.keyboardOptions) || void 0 === _b ? void 0 : _b.processFormulaBeforePaste) && this.copySourceRange && (processedValues = table.options.keyboardOptions.processFormulaBeforePaste(values, this.copySourceRange.startCol, this.copySourceRange.startRow, col, row));
65440
- const changedCellResults = yield table.changeCellValues(col, row, processedValues || values, !0);
65441
- table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
65442
- col: col,
65443
- row: row,
65444
- pasteData: processedValues || values,
65445
- changedCellResults: changedCellResults
65446
- });
66388
+ changedCellResults = [];
66389
+ for (let rowIndex = 0; rowIndex < values.length; rowIndex++) {
66390
+ changedCellResults[rowIndex] = [];
66391
+ for (let colIndex = 0; colIndex < values[rowIndex].length; colIndex++) {
66392
+ const targetCol = pasteRange.col + colIndex,
66393
+ targetRow = pasteRange.row + rowIndex,
66394
+ tableAny = table;
66395
+ let canChange = targetCol < tableAny.colCount && targetRow < tableAny.rowCount && (!tableAny.isHasEditorDefine || tableAny.isHasEditorDefine(targetCol, targetRow));
66396
+ if (canChange) {
66397
+ const editor = null === (_a = tableAny.getEditor) || void 0 === _a ? void 0 : _a.call(tableAny, targetCol, targetRow),
66398
+ oldValue = null === (_b = table.getCellOriginValue) || void 0 === _b ? void 0 : _b.call(table, targetCol, targetRow),
66399
+ validateResult = null === (_d = null === (_c = null == editor ? void 0 : editor.validateValue) || void 0 === _c ? void 0 : _c.call(editor, values[rowIndex][colIndex], oldValue, {
66400
+ col: targetCol,
66401
+ row: targetRow
66402
+ }, table)) || void 0 === _d || _d,
66403
+ resolvedValidateResult = validateResult && "function" == typeof validateResult.then ? yield validateResult : validateResult;
66404
+ canChange = !0 === resolvedValidateResult || "validate-exit" === resolvedValidateResult || "validate-not-exit" === resolvedValidateResult;
66405
+ }
66406
+ changedCellResults[rowIndex][colIndex] = canChange;
66407
+ }
66408
+ }
66409
+ return changedCellResults;
65447
66410
  });
65448
66411
  }
65449
- pasteTextToTable(item) {
66412
+ isFullPasteAllowed(values, changedCellResults) {
66413
+ return values.every((rowValues, rowIndex) => rowValues.every((_value, colIndex) => {
66414
+ var _a;
66415
+ return !0 === (null === (_a = changedCellResults[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex]);
66416
+ }));
66417
+ }
66418
+ getMigratedSourceCells(cutState, changedCellResults) {
66419
+ var _a, _b, _c, _d, _e;
66420
+ if (!(null == cutState ? void 0 : cutState.sourceCells.length) || !cutState.sourceColCount || !cutState.sourceRowCount) return [];
66421
+ const migratedSourceCells = [],
66422
+ migratedKeys = new Set();
66423
+ if (!cutState.isSingleRange) {
66424
+ for (let rowIndex = 0; rowIndex < changedCellResults.length; rowIndex++) for (let colIndex = 0; colIndex < (null !== (_b = null === (_a = changedCellResults[rowIndex]) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0); colIndex++) {
66425
+ if (!changedCellResults[rowIndex][colIndex]) continue;
66426
+ const sourceRow = rowIndex % cutState.sourceRowCount,
66427
+ sourceCol = colIndex % cutState.sourceColCount,
66428
+ sourceCell = null === (_c = cutState.sourceCellMatrix[sourceRow]) || void 0 === _c ? void 0 : _c[sourceCol];
66429
+ if (!sourceCell) continue;
66430
+ const sourceKey = this.getCellKey(sourceCell);
66431
+ migratedKeys.has(sourceKey) || (migratedKeys.add(sourceKey), migratedSourceCells.push(sourceCell));
66432
+ }
66433
+ return migratedSourceCells.length === cutState.sourceCells.length ? migratedSourceCells : [];
66434
+ }
66435
+ for (let rowIndex = 0; rowIndex < changedCellResults.length; rowIndex++) for (let colIndex = 0; colIndex < (null !== (_e = null === (_d = changedCellResults[rowIndex]) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0); colIndex++) {
66436
+ if (!changedCellResults[rowIndex][colIndex]) continue;
66437
+ const sourceRow = rowIndex % cutState.sourceRowCount,
66438
+ sourceCol = colIndex % cutState.sourceColCount,
66439
+ sourceIndex = sourceRow * cutState.sourceColCount + sourceCol,
66440
+ sourceCell = cutState.sourceCells[sourceIndex];
66441
+ if (!sourceCell) continue;
66442
+ const sourceKey = this.getCellKey(sourceCell);
66443
+ migratedKeys.has(sourceKey) || (migratedKeys.add(sourceKey), migratedSourceCells.push(sourceCell));
66444
+ }
66445
+ return migratedSourceCells;
66446
+ }
66447
+ getCellIdentity(col, row) {
66448
+ var _a, _b, _c, _d, _e, _f, _g;
66449
+ const table = this.table,
66450
+ recordShowIndex = null === (_a = table.getRecordShowIndexByCell) || void 0 === _a ? void 0 : _a.call(table, col, row);
66451
+ return {
66452
+ col: col,
66453
+ row: row,
66454
+ recordIndex: recordShowIndex >= 0 ? null === (_c = null === (_b = table.dataSource) || void 0 === _b ? void 0 : _b.getIndexKey) || void 0 === _c ? void 0 : _c.call(_b, recordShowIndex) : void 0,
66455
+ field: null === (_g = null === (_f = null === (_e = null === (_d = table.internalProps) || void 0 === _d ? void 0 : _d.layoutMap) || void 0 === _e ? void 0 : _e.getBody) || void 0 === _f ? void 0 : _f.call(_e, col, row)) || void 0 === _g ? void 0 : _g.field
66456
+ };
66457
+ }
66458
+ clearCutArea(migratedSourceCells, changedTargetCells) {
66459
+ var _a, _b;
65450
66460
  return __awaiter$1(this, void 0, void 0, function* () {
65451
- const table = this.table,
65452
- ranges = table.stateManager.select.ranges,
65453
- selectRangeLength = ranges.length,
65454
- col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
65455
- row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
65456
- maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
65457
- maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
65458
66461
  try {
65459
- const blob = yield item.getType("text/plain"),
65460
- pastedData = yield blob.text(),
65461
- values = this.parsePastedData(pastedData),
65462
- pasteValuesRowCount = values.length,
65463
- pasteValuesColCount = Math.max(...values.map(row => row.length), 0),
65464
- processedValues = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1),
65465
- changedCellResults = yield table.changeCellValues(col, row, processedValues, !0);
65466
- table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
65467
- col: col,
65468
- row: row,
65469
- pasteData: processedValues,
65470
- changedCellResults: changedCellResults
66462
+ const table = this.table,
66463
+ changedTargetKeys = new Set();
66464
+ changedTargetCells.forEach(cell => {
66465
+ changedTargetKeys.add(this.getCellKey(cell)), changedTargetKeys.add(this.getCoordKey(cell));
65471
66466
  });
65472
- } catch (error) {}
66467
+ const clearedKeys = new Set(),
66468
+ sourceChanges = [],
66469
+ coordChanges = [];
66470
+ for (let i = 0; i < migratedSourceCells.length; i++) {
66471
+ const sourceCell = migratedSourceCells[i],
66472
+ sourceKey = this.getCellKey(sourceCell);
66473
+ if (clearedKeys.has(sourceKey) || changedTargetKeys.has(sourceKey) || changedTargetKeys.has(this.getCoordKey(sourceCell))) continue;
66474
+ const currentAddress = this.getCurrentCellAddress(sourceCell);
66475
+ currentAddress && this.isSourceCellUnchanged(sourceCell, currentAddress) && (void 0 !== sourceCell.recordIndex && void 0 !== sourceCell.field && table.changeCellValuesByRecords ? sourceChanges.push({
66476
+ recordIndex: sourceCell.recordIndex,
66477
+ field: sourceCell.field,
66478
+ value: ""
66479
+ }) : coordChanges.push(currentAddress), clearedKeys.add(sourceKey));
66480
+ }
66481
+ sourceChanges.length && table.changeCellValuesByRecords(sourceChanges, {
66482
+ triggerEvent: !0,
66483
+ autoRefresh: !1
66484
+ });
66485
+ for (let i = 0; i < coordChanges.length; i++) yield table.changeCellValues(coordChanges[i].col, coordChanges[i].row, [[""]], !1);
66486
+ return sourceChanges.length && (null === (_b = (_a = table).refreshAfterSourceChange) || void 0 === _b || _b.call(_a)), !0;
66487
+ } catch (error) {
66488
+ return !1;
66489
+ }
65473
66490
  });
65474
66491
  }
66492
+ isSourceCellUnchanged(sourceCell, currentAddress) {
66493
+ var _a;
66494
+ const table = this.table;
66495
+ return Object.is(null === (_a = table.getCellOriginValue) || void 0 === _a ? void 0 : _a.call(table, currentAddress.col, currentAddress.row), sourceCell.value);
66496
+ }
66497
+ getCurrentCellAddress(sourceCell) {
66498
+ const table = this.table;
66499
+ if (void 0 !== sourceCell.recordIndex && void 0 !== sourceCell.field && table.getCellAddrByFieldRecord) {
66500
+ const address = table.getCellAddrByFieldRecord(sourceCell.field, sourceCell.recordIndex);
66501
+ return address && address.col >= 0 && address.row >= 0 ? address : null;
66502
+ }
66503
+ return {
66504
+ col: sourceCell.col,
66505
+ row: sourceCell.row
66506
+ };
66507
+ }
66508
+ getCellKey(cell) {
66509
+ return void 0 !== cell.recordIndex && void 0 !== cell.field ? `record:${this.getStableKeyPart(cell.recordIndex)}:${this.getStableKeyPart(cell.field)}` : this.getCoordKey(cell);
66510
+ }
66511
+ getCoordKey(cell) {
66512
+ return `coord:${cell.col}:${cell.row}`;
66513
+ }
66514
+ getStableKeyPart(value) {
66515
+ if (null === value) return "null";
66516
+ const valueType = typeof value;
66517
+ if ("string" === valueType || "number" === valueType || "boolean" === valueType) return `${valueType}:${JSON.stringify(value)}`;
66518
+ if (Array.isArray(value)) return `array:[${value.map(item => this.getStableKeyPart(item)).join(",")}]`;
66519
+ if ("object" === valueType || "function" === valueType) {
66520
+ let id = this.fieldKeyIds.get(value);
66521
+ return void 0 === id && (id = ++this.fieldKeyId, this.fieldKeyIds.set(value, id)), `${valueType}:#${id}`;
66522
+ }
66523
+ return `${valueType}:${String(value)}`;
66524
+ }
66525
+ resetCutState() {
66526
+ var _a;
66527
+ this.cutWaitPaste = !1, this.activeCutState = null, this.cutCellRange = null, this.cutRanges = null, (null === (_a = this.table.keyboardOptions) || void 0 === _a ? void 0 : _a.showCopyCellBorder) && clearActiveCellRangeState(this.table), this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null);
66528
+ }
65475
66529
  parsePastedData(pastedData) {
65476
66530
  const rows = pastedData.replace(/\r(?!\n)/g, "\r\n").split("\r\n"),
65477
66531
  values = [];
@@ -65480,6 +66534,10 @@
65480
66534
  values.push(rowValues);
65481
66535
  }), values;
65482
66536
  }
66537
+ parsePlainTextPastedData(pastedData) {
66538
+ const rows = pastedData.replace(/\r\n|\r/g, "\n").split("\n");
66539
+ return rows.length > 1 && "" === rows[rows.length - 1] && rows.pop(), rows.map(rowCells => rowCells.split("\t"));
66540
+ }
65483
66541
  processCellValue(cell) {
65484
66542
  cell.includes("\n") && (cell = cell.replace(/^"(.*)"$/, "$1").replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join("")));
65485
66543
  const numValue = Number(cell);
@@ -65669,6 +66727,7 @@
65669
66727
  return TextStyle;
65670
66728
  case "image":
65671
66729
  case "video":
66730
+ case "audio":
65672
66731
  return ImageStyle$1;
65673
66732
  case "chart":
65674
66733
  case "sparkline":
@@ -66627,6 +67686,7 @@
66627
67686
  return TextHeaderStyle;
66628
67687
  case "image":
66629
67688
  case "video":
67689
+ case "audio":
66630
67690
  return ImageStyle;
66631
67691
  case "checkbox":
66632
67692
  return CheckboxStyle;
@@ -67677,7 +68737,7 @@
67677
68737
  }
67678
68738
  constructor(container, options = {}) {
67679
68739
  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;
67680
- if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.26.6", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
68740
+ if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.26.8", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
67681
68741
  const g = window;
67682
68742
  g[this.id] = this;
67683
68743
  const registry = g.__vtable__ || (g.__vtable__ = {
@@ -68682,7 +69742,7 @@
68682
69742
  defaultRowHeight = 40,
68683
69743
  defaultHeaderRowHeight: defaultHeaderRowHeight,
68684
69744
  defaultColWidth = 80,
68685
- defaultHeaderColWidth = 80,
69745
+ defaultHeaderColWidth: defaultHeaderColWidth,
68686
69746
  keyboardOptions: keyboardOptions,
68687
69747
  eventOptions: eventOptions,
68688
69748
  rowSeriesNumber: rowSeriesNumber,
@@ -69008,7 +70068,13 @@
69008
70068
  colMax = Math.max(sourceMergeInfo.end.col, targetMergeInfo.end.col, oldSourceMergeInfo.end.col, oldTargetMergeInfo.end.col),
69009
70069
  rowMin = Math.min(sourceMergeInfo.start.row, targetMergeInfo.start.row, oldSourceMergeInfo.start.row, oldTargetMergeInfo.start.row);
69010
70070
  let rowMax = Math.max(sourceMergeInfo.end.row, targetMergeInfo.end.row, oldSourceMergeInfo.end.row, oldTargetMergeInfo.end.row);
69011
- if ("row" === moveContext.moveType && "tree" === this.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), this.transpose || !this.isSeriesNumberInBody(args.source.col, args.source.row) && "row" !== args.movingColumnOrRow || (this.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), this.stateManager.changeCheckboxAndRadioOrder(moveContext.sourceIndex, moveContext.targetIndex)), "column" === moveContext.moveType) for (let col = colMin; col <= colMax; col++) this._clearColRangeWidthsMap(col);else for (let row = rowMin; row <= rowMax; row++) this._clearRowRangeHeightsMap(row);
70071
+ if ("row" === moveContext.moveType && "tree" === this.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), this.isListTable() && !this.transpose && (this.isSeriesNumberInBody(args.source.col, args.source.row) || "row" === args.movingColumnOrRow)) {
70072
+ const listTable = this,
70073
+ sourceRecordPath = listTable.getRecordIndexByCell(args.source.col, moveContext.sourceIndex),
70074
+ targetRecordPath = listTable.getRecordIndexByCell(args.target.col, moveContext.targetIndex);
70075
+ this.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), this.stateManager.changeCheckboxOrder(sourceRecordPath, targetRecordPath), this.stateManager.changeRadioOrder(sourceRecordPath, targetRecordPath);
70076
+ }
70077
+ if ("column" === moveContext.moveType) for (let col = colMin; col <= colMax; col++) this._clearColRangeWidthsMap(col);else for (let row = rowMin; row <= rowMax; row++) this._clearRowRangeHeightsMap(row);
69012
70078
  return this.clearCellStyleCache(), this.isSeriesNumberInBody(args.source.col, args.source.row) || "row" === args.movingColumnOrRow ? this.scenegraph.updateHeaderPosition(this.scenegraph.proxy.colStart, this.scenegraph.proxy.colEnd, this.scenegraph.proxy.rowStart, this.scenegraph.proxy.rowEnd, moveContext.moveType) : "column" === moveContext.moveType ? this.scenegraph.updateHeaderPosition(colMin, colMax, 0, -1, moveContext.moveType) : this.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType), "adjustFrozenCount" === this.internalProps.frozenColDragHeaderMode && this.isListTable() && (this.isLeftFrozenColumn(args.target.col) && !this.isLeftFrozenColumn(args.source.col) ? this.frozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isLeftFrozenColumn(args.source.col) && !this.isLeftFrozenColumn(args.target.col) && (this.frozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1), this.isRightFrozenColumn(args.target.col) && !this.isRightFrozenColumn(args.source.col) ? this.rightFrozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isRightFrozenColumn(args.source.col) && !this.isRightFrozenColumn(args.target.col) && (this.rightFrozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1)), null === (_e = (_d = this.scenegraph).updateNextFrame) || void 0 === _e || _e.call(_d), !0;
69013
70079
  } finally {
69014
70080
  this.stateManager.columnMove.movingColumnOrRow = prevMoving;
@@ -71670,6 +72736,23 @@
71670
72736
  if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) table.scenegraph.updateCellContent(col, row);
71671
72737
  }
71672
72738
  }
72739
+ function isSameRecordIndex(sourceRecordIndex, currentRecordIndex) {
72740
+ return Array.isArray(sourceRecordIndex) || Array.isArray(currentRecordIndex) ? Array.isArray(sourceRecordIndex) && Array.isArray(currentRecordIndex) && sourceRecordIndex.length === currentRecordIndex.length && sourceRecordIndex.every((value, index) => value === currentRecordIndex[index]) : sourceRecordIndex === currentRecordIndex;
72741
+ }
72742
+ function isTargetCellSnapshotCurrent(table, snapshot) {
72743
+ if (table.isHeader(snapshot.col, snapshot.row) !== snapshot.isHeader) return !1;
72744
+ if (snapshot.isHeader) return !0;
72745
+ const recordShowIndex = table.getRecordShowIndexByCell(snapshot.col, snapshot.row),
72746
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
72747
+ {
72748
+ field: field
72749
+ } = table.internalProps.layoutMap.getBody(snapshot.col, snapshot.row);
72750
+ return isSameRecordIndex(snapshot.recordIndex, recordIndex) && snapshot.field === field;
72751
+ }
72752
+ function areTargetCellSnapshotsCurrent(table, snapshots) {
72753
+ for (let i = 0; i < snapshots.length; i++) for (let j = 0; j < snapshots[i].length; j++) if (!isTargetCellSnapshotCurrent(table, snapshots[i][j])) return !1;
72754
+ return !0;
72755
+ }
71673
72756
  function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
71674
72757
  var _a, _b;
71675
72758
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
@@ -71724,29 +72807,70 @@
71724
72807
  table.scenegraph.updateNextFrame();
71725
72808
  }
71726
72809
  }
71727
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
71728
- var _a, _b;
72810
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent, shouldCancel) {
72811
+ var _a, _b, _c, _d, _e;
71729
72812
  return __awaiter(this, void 0, void 0, function* () {
71730
72813
  const changedCellResults = [];
71731
72814
  let pasteColEnd = startCol,
71732
72815
  pasteRowEnd = startRow;
71733
72816
  const beforeChangeValues = [],
71734
- oldValues = [];
72817
+ oldValues = [],
72818
+ targetSnapshots = [];
71735
72819
  let cellUpdateType;
71736
72820
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
71737
72821
  const rowValues = values[i],
71738
72822
  rawRowValues = [],
71739
- oldRowValues = [];
71740
- beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues);
72823
+ oldRowValues = [],
72824
+ rowTargetSnapshots = [];
72825
+ beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues), targetSnapshots.push(rowTargetSnapshots);
71741
72826
  for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
72827
+ const col = startCol + j,
72828
+ row = startRow + i;
71742
72829
  cellUpdateType = getCellUpdateType(startCol + j, startRow + i, table, cellUpdateType);
71743
- const beforeChangeValue = table.getCellRawValue(startCol + j, startRow + i);
72830
+ const beforeChangeValue = table.getCellRawValue(col, row);
71744
72831
  rawRowValues.push(beforeChangeValue);
71745
- const oldValue = table.getCellOriginValue(startCol + j, startRow + i);
72832
+ const oldValue = table.getCellOriginValue(col, row);
71746
72833
  oldRowValues.push(oldValue);
72834
+ const isHeader = table.isHeader(col, row),
72835
+ recordShowIndex = table.getRecordShowIndexByCell(col, row),
72836
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
72837
+ {
72838
+ field: field
72839
+ } = table.internalProps.layoutMap.getBody(col, row);
72840
+ rowTargetSnapshots.push({
72841
+ col: col,
72842
+ row: row,
72843
+ isHeader: isHeader,
72844
+ recordIndex: recordIndex,
72845
+ field: field
72846
+ });
72847
+ }
72848
+ }
72849
+ const resultChangeValues = [],
72850
+ preValidatedCellResults = shouldCancel && workOnEditableCell ? [] : null;
72851
+ if (preValidatedCellResults) for (let i = 0; i < values.length; i++) {
72852
+ if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
72853
+ if (startRow + i > table.rowCount - 1) break;
72854
+ preValidatedCellResults[i] = [];
72855
+ const rowValues = values[i];
72856
+ for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
72857
+ let isCanChange = !1;
72858
+ if (table.isHasEditorDefine(startCol + j, startRow + i)) {
72859
+ const editor = table.getEditor(startCol + j, startRow + i),
72860
+ oldValue = oldValues[i][j],
72861
+ value = rowValues[j],
72862
+ maybePromiseOrValue = null === (_b = null === (_a = null == editor ? void 0 : editor.validateValue) || void 0 === _a ? void 0 : _a.call(editor, value, oldValue, {
72863
+ col: startCol + j,
72864
+ row: startRow + i
72865
+ }, table)) || void 0 === _b || _b,
72866
+ validateResult = isPromise(maybePromiseOrValue) ? yield maybePromiseOrValue : maybePromiseOrValue;
72867
+ if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
72868
+ isCanChange = !0 === validateResult || "validate-exit" === validateResult || "validate-not-exit" === validateResult;
72869
+ }
72870
+ preValidatedCellResults[i][j] = isCanChange;
71747
72871
  }
71748
72872
  }
71749
- const resultChangeValues = [];
72873
+ if ((null == shouldCancel ? void 0 : shouldCancel()) || !areTargetCellSnapshotsCurrent(table, targetSnapshots)) return changedCellResults;
71750
72874
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
71751
72875
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
71752
72876
  const rowValues = values[i];
@@ -71754,16 +72878,17 @@
71754
72878
  for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
71755
72879
  thisRowPasteColEnd = startCol + j;
71756
72880
  let isCanChange = !1;
71757
- if (!1 === workOnEditableCell) isCanChange = !0;else if (table.isHasEditorDefine(startCol + j, startRow + i)) {
72881
+ if (preValidatedCellResults) isCanChange = !0 === (null === (_c = preValidatedCellResults[i]) || void 0 === _c ? void 0 : _c[j]);else if (!1 === workOnEditableCell) isCanChange = !0;else if (table.isHasEditorDefine(startCol + j, startRow + i)) {
71758
72882
  const editor = table.getEditor(startCol + j, startRow + i),
71759
72883
  oldValue = oldValues[i][j],
71760
72884
  value = rowValues[j],
71761
- maybePromiseOrValue = null === (_b = null === (_a = null == editor ? void 0 : editor.validateValue) || void 0 === _a ? void 0 : _a.call(editor, value, oldValue, {
72885
+ maybePromiseOrValue = null === (_e = null === (_d = null == editor ? void 0 : editor.validateValue) || void 0 === _d ? void 0 : _d.call(editor, value, oldValue, {
71762
72886
  col: startCol + j,
71763
72887
  row: startRow + i
71764
- }, table)) || void 0 === _b || _b;
72888
+ }, table)) || void 0 === _e || _e;
71765
72889
  if (isPromise(maybePromiseOrValue)) {
71766
72890
  const validateResult = yield maybePromiseOrValue;
72891
+ if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
71767
72892
  isCanChange = !0 === validateResult || "validate-exit" === validateResult || "validate-not-exit" === validateResult;
71768
72893
  } else isCanChange = !0 === maybePromiseOrValue || "validate-exit" === maybePromiseOrValue || "validate-not-exit" === maybePromiseOrValue;
71769
72894
  }
@@ -71777,7 +72902,10 @@
71777
72902
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
71778
72903
  beforeChangeValue = beforeChangeValues[i][j],
71779
72904
  oldValue = oldValues[i][j];
71780
- table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
72905
+ if (table.isHeader(startCol + j, startRow + i)) table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value);else {
72906
+ const changeResult = table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
72907
+ isPromise(changeResult) && (yield changeResult);
72908
+ }
71781
72909
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
71782
72910
  if (oldValue !== changedValue && triggerEvent) {
71783
72911
  const changeValue = {
@@ -72474,6 +73602,9 @@
72474
73602
  }), clearLayoutColumnState(null !== (_a = column.children) && void 0 !== _a ? _a : column.columns);
72475
73603
  });
72476
73604
  }
73605
+ function isSameField(left, right) {
73606
+ return left === right || Array.isArray(left) && Array.isArray(right) && arrayEqual(left, right);
73607
+ }
72477
73608
  class ListTable extends BaseTable {
72478
73609
  constructor(container, options) {
72479
73610
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -72776,7 +73907,7 @@
72776
73907
  return this.transpose ? this.dataSource.getTableIndex(recordIndex) + this.rowHeaderLevelCount : this.dataSource.getTableIndex(recordIndex) + this.columnHeaderLevelCount;
72777
73908
  }
72778
73909
  getTableIndexByField(field) {
72779
- const colObj = this.internalProps.layoutMap.columnObjects.find(col => col.field === field);
73910
+ const colObj = this.internalProps.layoutMap.columnObjects.find(col => isSameField(col.field, field));
72780
73911
  if (!colObj) return -1;
72781
73912
  const layoutRange = this.internalProps.layoutMap.getBodyLayoutRangeById(colObj.id);
72782
73913
  return this.transpose ? layoutRange.start.row : layoutRange.start.col;
@@ -72919,7 +74050,7 @@
72919
74050
  const {
72920
74051
  layoutMap: layoutMap
72921
74052
  } = this.internalProps,
72922
- colObj = layoutMap.columnObjects.find(col => col.field === field);
74053
+ colObj = layoutMap.columnObjects.find(col => isSameField(col.field, field));
72923
74054
  if (colObj) {
72924
74055
  const layoutRange = layoutMap.getBodyLayoutRangeById(colObj.id);
72925
74056
  let startRow;
@@ -73034,7 +74165,7 @@
73034
74165
  _getSortFuncFromHeaderOption(columns, field, fieldKey) {
73035
74166
  if (columns || (columns = this.internalProps.columns), field && columns && columns.length > 0) for (let i = 0; i < columns.length; i++) {
73036
74167
  const header = columns[i];
73037
- if ((fieldKey && fieldKey === header.fieldKey || !fieldKey && header.field === field) && header.sort && "function" == typeof header.sort) return header.sort;
74168
+ if ((fieldKey && fieldKey === header.fieldKey || !fieldKey && isSameField(header.field, field)) && header.sort && "function" == typeof header.sort) return header.sort;
73038
74169
  if (header.columns) {
73039
74170
  const sort = this._getSortFuncFromHeaderOption(header.columns, field, fieldKey);
73040
74171
  if (sort) return sort;
@@ -73046,7 +74177,7 @@
73046
74177
  const normalizedSortState = (Array.isArray(sortState) ? sortState : sortState ? [sortState] : []).filter(Boolean);
73047
74178
  if (normalizedSortState.length ? this.internalProps.sortState = sortState : this.internalProps.sortState = null, executeSort) if (normalizedSortState.length) this.internalProps.layoutMap.headerObjects.some(item => !1 !== item.define.sort) && (this.dataSource.sort(normalizedSortState.map(item => {
73048
74179
  const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, item.field);
73049
- this.internalProps.layoutMap.headerObjects.find(col => col && col.field === item.field);
74180
+ this.internalProps.layoutMap.headerObjects.find(col => col && isSameField(col.field, item.field));
73050
74181
  return {
73051
74182
  field: item.field,
73052
74183
  order: item.order,
@@ -73134,15 +74265,17 @@
73134
74265
  this.stateManager.endResizeIfResizing(), clearChartRenderQueue(), null === (_a = this.internalProps.dataSource) || void 0 === _a || _a.release(), this.internalProps.releaseList = null === (_b = this.internalProps.releaseList) || void 0 === _b ? void 0 : _b.filter(item => !item.dataSourceObj), this.internalProps.dataSource = null, Array.isArray(option) || (null == option ? void 0 : option.order) ? sort = option : option ? sort = option.sortState : null === option && (sort = null);
73135
74266
  "undefined" != typeof window && window.performance.now();
73136
74267
  const oldHoverState = {
73137
- col: this.stateManager.hover.cellPos.col,
73138
- row: this.stateManager.hover.cellPos.row
73139
- };
74268
+ col: this.stateManager.hover.cellPos.col,
74269
+ row: this.stateManager.hover.cellPos.row
74270
+ },
74271
+ oldScrollLeft = this.stateManager.scroll.horizontalBarPos,
74272
+ oldScrollTop = this.stateManager.scroll.verticalBarPos;
73140
74273
  if (this.scenegraph.clearCells(), void 0 !== sort && (null === sort || !Array.isArray(sort) && isValid$1(sort.field) || Array.isArray(sort)) && (this.internalProps.sortState = this.internalProps.multipleSort ? Array.isArray(sort) ? sort : [sort] : sort, this.stateManager.setSortState(this.sortState)), records) {
73141
74274
  if (_setRecords(this, records), this.sortState) {
73142
74275
  const sortState = Array.isArray(this.sortState) ? this.sortState : [this.sortState];
73143
74276
  sortState.some(item => item.order && item.field && "normal" !== item.order) && this.internalProps.layoutMap.headerObjectsIncludeHided.some(item => !1 !== item.define.sort) && this.dataSource.sort(sortState.map(item => {
73144
74277
  const sortFunc = this._getSortFuncFromHeaderOption(void 0, item.field);
73145
- this.internalProps.layoutMap.headerObjectsIncludeHided.find(col => col && col.field === item.field);
74278
+ this.internalProps.layoutMap.headerObjectsIncludeHided.find(col => col && isSameField(col.field, item.field));
73146
74279
  return {
73147
74280
  field: item.field,
73148
74281
  order: item.order || "asc",
@@ -73152,13 +74285,13 @@
73152
74285
  }
73153
74286
  this.refreshRowColCount();
73154
74287
  } else _setRecords(this, records);
73155
- this.stateManager.initCheckedState(records), this.clearCellStyleCache(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this._updateSize();
74288
+ this.stateManager.initCheckedState(records), this.clearCellStyleCache(), this.stateManager.scroll.horizontalBarPos = 0, this.stateManager.scroll.verticalBarPos = 0, this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this._updateSize();
73156
74289
  if ((null !== (_c = this.options.componentLayoutOrder) && void 0 !== _c ? _c : ["legend", "title"]).forEach(component => {
73157
74290
  var _a, _b;
73158
74291
  "legend" === component ? null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach(legend => {
73159
74292
  null == legend || legend.resize();
73160
74293
  }) : "title" === component && (null === (_b = this.internalProps.title) || void 0 === _b || _b.resize());
73161
- }), this.scenegraph.resize(), this.options.emptyTip) if (this.internalProps.emptyTip) null === (_d = this.internalProps.emptyTip) || void 0 === _d || _d.resetVisible();else {
74294
+ }), this.scenegraph.resize(), oldScrollLeft && this.stateManager.setScrollLeft(oldScrollLeft, void 0, !1), oldScrollTop && this.stateManager.setScrollTop(oldScrollTop, void 0, !1), this.options.emptyTip) if (this.internalProps.emptyTip) null === (_d = this.internalProps.emptyTip) || void 0 === _d || _d.resetVisible();else {
73162
74295
  const EmptyTip = Factory.getComponent("emptyTip");
73163
74296
  this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_e = this.internalProps.emptyTip) || void 0 === _e || _e.resetVisible();
73164
74297
  }
@@ -73228,8 +74361,8 @@
73228
74361
  changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
73229
74362
  return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
73230
74363
  }
73231
- changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
73232
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
74364
+ changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, noTriggerChangeCellValuesEvent, shouldCancel) {
74365
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent, shouldCancel);
73233
74366
  }
73234
74367
  changeCellValuesByRanges(ranges, value, workOnEditableCell = !1, triggerEvent = !0, noTriggerChangeCellValuesEvent) {
73235
74368
  return listTableChangeCellValuesByRanges(ranges, value, workOnEditableCell, triggerEvent, this, noTriggerChangeCellValuesEvent);
@@ -73264,8 +74397,8 @@
73264
74397
  autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
73265
74398
  records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
73266
74399
  let record, oldValue;
73267
- if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), !triggerEvent) return;
73268
- const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
74400
+ if (Array.isArray(records) && ("string" == typeof field || "number" == typeof field || Array.isArray(field)) && (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = getRecordFieldValue(record, field)), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), Array.isArray(records) && (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex]), !triggerEvent) return;
74401
+ const changedValue = record && ("string" == typeof field || "number" == typeof field || Array.isArray(field)) ? getRecordFieldValue(record, field) : value;
73269
74402
  if (oldValue !== changedValue) {
73270
74403
  const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex),
73271
74404
  changeValue = {
@@ -73304,8 +74437,8 @@
73304
74437
  } = changeValues[i],
73305
74438
  records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
73306
74439
  let record, oldValue;
73307
- if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), triggerEvent) {
73308
- const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
74440
+ if (Array.isArray(records) && ("string" == typeof field || "number" == typeof field || Array.isArray(field)) && (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = getRecordFieldValue(record, field)), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), Array.isArray(records) && (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex]), triggerEvent) {
74441
+ const changedValue = record && ("string" == typeof field || "number" == typeof field || Array.isArray(field)) ? getRecordFieldValue(record, field) : value;
73309
74442
  if (oldValue !== changedValue) {
73310
74443
  const changeValue = {
73311
74444
  col: null !== (_e = null === (_d = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _d ? void 0 : _d.col) && void 0 !== _e ? _e : -1,
@@ -75386,12 +76519,30 @@
75386
76519
  }
75387
76520
  release() {
75388
76521
  var _a, _b;
76522
+ this._clearPendingBind();
75389
76523
  const tooltipInstances = this._tooltipInstances;
75390
76524
  for (const k in tooltipInstances) null === (_b = null === (_a = tooltipInstances[k]) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a);
75391
- delete this._tooltipInstances, this._attachInfo = null;
76525
+ delete this._tooltipInstances, this._attachInfo = null, this._pendingInfo = null;
75392
76526
  }
75393
76527
  _bindToCell(col, row, tooltipOptions) {
76528
+ this._clearPendingBind();
76529
+ const appearDelay = null == tooltipOptions ? void 0 : tooltipOptions.appearDelay;
76530
+ if (tooltipOptions && appearDelay && appearDelay > 0) {
76531
+ this._unbindAttachedTooltip();
76532
+ const id = setTimeout(() => {
76533
+ this._pendingInfo = null, this._bindToCellImmediately(col, row, tooltipOptions);
76534
+ }, appearDelay);
76535
+ this._pendingInfo = {
76536
+ id: id,
76537
+ col: col,
76538
+ row: row,
76539
+ tooltipOptions: tooltipOptions
76540
+ };
76541
+ } else this._bindToCellImmediately(col, row, tooltipOptions);
76542
+ }
76543
+ _bindToCellImmediately(col, row, tooltipOptions) {
75394
76544
  var _a;
76545
+ if (!tooltipOptions) return void this._unbindAttachedTooltip();
75395
76546
  const info = this._attachInfo,
75396
76547
  instance = this._getTooltipInstanceInfo(col, row);
75397
76548
  if (!info || instance && info.instance === instance || (null === (_a = info.instance) || void 0 === _a || _a.unbindTooltipElement(), this._attachInfo = null), !instance) return;
@@ -75404,6 +76555,17 @@
75404
76555
  };
75405
76556
  }
75406
76557
  }
76558
+ _clearPendingBind() {
76559
+ this._pendingInfo && (clearTimeout(this._pendingInfo.id), this._pendingInfo = null);
76560
+ }
76561
+ _unbindAttachedTooltip() {
76562
+ const info = this._attachInfo;
76563
+ if (!info) return;
76564
+ const {
76565
+ instance: instance
76566
+ } = info;
76567
+ null == instance || instance.unbindTooltipElement(), this._attachInfo = null;
76568
+ }
75407
76569
  _move(col, row, tooltipOptions) {
75408
76570
  const info = this._attachInfo;
75409
76571
  if (!info || !cellInRange(info.range, col, row)) return;
@@ -75421,14 +76583,10 @@
75421
76583
  this._attachInfo.tooltipOptions.position = position, this._attachInfo.tooltipOptions.referencePosition = referencePosition, null == instance || instance.locateTooltipElement(col, row, position, referencePosition, this.confine);
75422
76584
  }
75423
76585
  _unbindFromCell() {
75424
- const info = this._attachInfo;
75425
- if (!info) return;
75426
- const {
75427
- instance: instance
75428
- } = info;
75429
- null == instance || instance.unbindTooltipElement(), this._attachInfo = null;
76586
+ this._clearPendingBind(), this._unbindAttachedTooltip();
75430
76587
  }
75431
76588
  _isBindCell(col, row) {
76589
+ if (this._pendingInfo && this._pendingInfo.col === col && this._pendingInfo.row === row) return !0;
75432
76590
  const info = this._attachInfo;
75433
76591
  return !!info && cellInRange(info.range, col, row);
75434
76592
  }
@@ -75519,8 +76677,8 @@
75519
76677
  return tooltipInstances && tooltipInstances["bubble-tooltip"] || tooltipInstances && (tooltipInstances["bubble-tooltip"] = TOOLTIP_INSTANCE_FACTORY["bubble-tooltip"](table));
75520
76678
  }
75521
76679
  isBinded(tooltipOptions) {
75522
- var _a;
75523
- return JSON.stringify(tooltipOptions) === JSON.stringify(null === (_a = this._attachInfo) || void 0 === _a ? void 0 : _a.tooltipOptions);
76680
+ var _a, _b;
76681
+ return JSON.stringify(tooltipOptions) === JSON.stringify(null === (_a = this._attachInfo) || void 0 === _a ? void 0 : _a.tooltipOptions) || JSON.stringify(tooltipOptions) === JSON.stringify(null === (_b = this._pendingInfo) || void 0 === _b ? void 0 : _b.tooltipOptions);
75524
76682
  }
75525
76683
  }
75526
76684
 
@@ -75785,7 +76943,7 @@
75785
76943
  cornerRadius: cellTheme.group.cornerRadius
75786
76944
  })).role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup = null !== (_0 = null == columnGroup ? void 0 : columnGroup.addCellGroup(cellGroup)) && void 0 !== _0 ? _0 : cellGroup);
75787
76945
  }
75788
- if (cellGroup.AABBBounds.width(), isNoChartDataRenderNothing && Array.isArray(table.getCellValue(col, row)) || !isNoChartDataRenderNothing) {
76946
+ if (cellGroup.AABBBounds.width(), isNoChartDataRenderNothing && Array.isArray(dataValue) || !isNoChartDataRenderNothing) {
75789
76947
  const chartGroup = new Chart(isShareChartSpec, {
75790
76948
  stroke: !1,
75791
76949
  x: padding[3],
@@ -75799,7 +76957,7 @@
75799
76957
  height: height - padding[2] - padding[0],
75800
76958
  chartInstance: chartInstance,
75801
76959
  dataId: dataId,
75802
- data: table.getCellValue(col, row) || [],
76960
+ data: dataValue || [],
75803
76961
  cellPadding: padding,
75804
76962
  dpr: table.internalProps.pixelRatio,
75805
76963
  detectPickChartItem: null === (_2 = table.options.customConfig) || void 0 === _2 ? void 0 : _2.detectPickChartItem,
@@ -75890,8 +77048,9 @@
75890
77048
  }
75891
77049
  }
75892
77050
 
75893
- function createCheckboxCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, isCheckboxTree) {
77051
+ function createCheckboxCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, isCheckboxTree, cellValue) {
75894
77052
  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;
77053
+ const value = arguments.length >= 20 ? cellValue : table.getCellValue(col, row);
75895
77054
  if (!cellGroup) {
75896
77055
  const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
75897
77056
  isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0)) && "cell" === cellGroup.role && cellGroup.setAttributes({
@@ -75952,7 +77111,7 @@
75952
77111
  "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
75953
77112
  });
75954
77113
  }
75955
- const checkboxComponent = createCheckbox(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table, isCheckboxTree);
77114
+ const checkboxComponent = createCheckbox(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table, isCheckboxTree, value);
75956
77115
  if (1 !== cellContentLeftIcons.length || cellContentLeftIcons[0].name !== InternalIconName.expandIconName && cellContentLeftIcons[0].name !== InternalIconName.collapseIconName) checkboxComponent && cellGroup.appendChild(checkboxComponent), checkboxComponent.render();else {
75957
77116
  const checkContent = new CheckboxContent({
75958
77117
  x: 0,
@@ -75987,7 +77146,7 @@
75987
77146
  }
75988
77147
  return width -= padding[1] + padding[3] + iconWidth, height -= padding[0] + padding[2], "center" === textAlign ? checkboxComponent.setAttribute("x", padding[3] + cellLeftIconWidth + (width - checkboxComponent.AABBBounds.width()) / 2) : "right" === textAlign ? checkboxComponent.setAttribute("x", padding[3] + cellLeftIconWidth + width - checkboxComponent.AABBBounds.width()) : checkboxComponent.setAttribute("x", padding[3] + cellLeftIconWidth), "middle" === textBaseline ? checkboxComponent.setAttribute("y", padding[0] + (height - checkboxComponent.AABBBounds.height()) / 2) : "bottom" === textBaseline ? checkboxComponent.setAttribute("y", padding[0] + height - checkboxComponent.AABBBounds.height()) : checkboxComponent.setAttribute("y", padding[0]), cellGroup;
75989
77148
  }
75990
- function createCheckbox(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table, isCheckboxTree) {
77149
+ function createCheckbox(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table, isCheckboxTree, cellValue) {
75991
77150
  var _a, _b, _c, _d;
75992
77151
  const style = table._getCellStyle(col, row),
75993
77152
  size = getProp("size", style, col, row, table),
@@ -76001,7 +77160,7 @@
76001
77160
  disableCheckedStroke = getProp("disableCheckedStroke", style, col, row, table),
76002
77161
  checkIconImage = getProp("checkIconImage", style, col, row, table),
76003
77162
  indeterminateIconImage = getProp("indeterminateIconImage", style, col, row, table),
76004
- value = table.getCellValue(col, row),
77163
+ value = cellValue,
76005
77164
  dataValue = table.getCellOriginValue(col, row);
76006
77165
  let isChecked,
76007
77166
  isDisabled,
@@ -76076,11 +77235,12 @@
76076
77235
  return checkbox.name = "checkbox", checkbox;
76077
77236
  }
76078
77237
 
76079
- function createRadioCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, table, cellTheme, define, range) {
76080
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
77238
+ function createRadioCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, table, cellTheme, define, range, isAsync, cellValue) {
77239
+ 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;
77240
+ const value = arguments.length >= 18 ? cellValue : table.getCellValue(col, row);
76081
77241
  if (!cellGroup) {
76082
77242
  const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
76083
- (cellGroup = new Group$1({
77243
+ isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0)) && "cell" === cellGroup.role && cellGroup.setAttributes({
76084
77244
  x: xOrigin,
76085
77245
  y: yOrigin,
76086
77246
  width: width,
@@ -76095,17 +77255,32 @@
76095
77255
  lineCap: "butt",
76096
77256
  clip: !0,
76097
77257
  cornerRadius: cellTheme.group.cornerRadius
76098
- })).role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup = null !== (_o = null == columnGroup ? void 0 : columnGroup.addCellGroup(cellGroup)) && void 0 !== _o ? _o : cellGroup;
77258
+ }), cellGroup && "cell" === cellGroup.role || ((cellGroup = new Group$1({
77259
+ x: xOrigin,
77260
+ y: yOrigin,
77261
+ width: width,
77262
+ height: height,
77263
+ lineWidth: null !== (_p = null === (_o = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _o ? void 0 : _o.lineWidth) && void 0 !== _p ? _p : void 0,
77264
+ fill: null !== (_r = null === (_q = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _q ? void 0 : _q.fill) && void 0 !== _r ? _r : void 0,
77265
+ stroke: null !== (_t = null === (_s = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _s ? void 0 : _s.stroke) && void 0 !== _t ? _t : void 0,
77266
+ strokeArrayWidth: strokeArrayWidth,
77267
+ strokeArrayColor: null !== (_v = null === (_u = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _u ? void 0 : _u.strokeArrayColor) && void 0 !== _v ? _v : void 0,
77268
+ cursor: null !== (_x = null === (_w = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _w ? void 0 : _w.cursor) && void 0 !== _x ? _x : void 0,
77269
+ lineDash: null !== (_z = null === (_y = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _y ? void 0 : _y.lineDash) && void 0 !== _z ? _z : void 0,
77270
+ lineCap: "butt",
77271
+ clip: !0,
77272
+ cornerRadius: cellTheme.group.cornerRadius
77273
+ })).role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup = null !== (_0 = null == columnGroup ? void 0 : columnGroup.addCellGroup(cellGroup)) && void 0 !== _0 ? _0 : cellGroup);
76099
77274
  }
76100
77275
  const {
76101
77276
  width: radioWidth,
76102
77277
  height: radioHeight
76103
- } = createRadio(col, row, colWidth, width, height, padding, cellTheme, define, cellGroup, range, table);
77278
+ } = createRadio(col, row, colWidth, width, height, padding, cellTheme, define, cellGroup, range, table, value);
76104
77279
  return width -= padding[1] + padding[3], height -= padding[0] + padding[2], cellGroup.forEachChildren(radioComponent => {
76105
77280
  "center" === textAlign ? radioComponent.setAttribute("x", padding[3] + radioComponent.attribute.x + (width - radioWidth) / 2) : "right" === textAlign ? radioComponent.setAttribute("x", padding[3] + radioComponent.attribute.x + width - radioWidth) : radioComponent.setAttribute("x", padding[3] + radioComponent.attribute.x), "middle" === textBaseline ? radioComponent.setAttribute("y", padding[0] + radioComponent.attribute.y + (height - radioHeight) / 2) : "bottom" === textBaseline ? radioComponent.setAttribute("y", padding[0] + radioComponent.attribute.y + height - radioHeight) : radioComponent.setAttribute("y", padding[0] + radioComponent.attribute.y);
76106
77281
  }), cellGroup;
76107
77282
  }
76108
- function createRadio(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, cellGroup, range, table) {
77283
+ function createRadio(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, cellGroup, range, table, cellValue) {
76109
77284
  var _a, _b, _c, _d;
76110
77285
  const style = table._getCellStyle(col, row);
76111
77286
  let size = getProp("size", style, col, row, table),
@@ -76121,7 +77296,7 @@
76121
77296
  disableCheckedFill = getProp("disableCheckedFill", style, col, row, table),
76122
77297
  disableCheckedStroke = getProp("disableCheckedStroke", style, col, row, table);
76123
77298
  isNumber$3(outerRadius) ? size = 2 * outerRadius : outerRadius = Math.round(size / 2), (!isNumber$3(innerRadius) || innerRadius < 0) && (innerRadius = Math.round(outerRadius / 7 * 3));
76124
- const value = table.getCellValue(col, row),
77299
+ const value = cellValue,
76125
77300
  dataValue = table.getCellOriginValue(col, row),
76126
77301
  hierarchyOffset = getHierarchyOffset(col, row, table),
76127
77302
  cellStyle = table._getCellStyle(col, row),
@@ -76217,8 +77392,9 @@
76217
77392
  return null !== (_a = null != isDisabled ? isDisabled : globalDisable) && void 0 !== _a && _a;
76218
77393
  }
76219
77394
 
76220
- function createSwitchCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync) {
77395
+ function createSwitchCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, cellValue) {
76221
77396
  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;
77397
+ const value = arguments.length >= 19 ? cellValue : table.getCellValue(col, row);
76222
77398
  if (!cellGroup) {
76223
77399
  const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
76224
77400
  isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0)) && "cell" === cellGroup.role && cellGroup.setAttributes({
@@ -76274,10 +77450,10 @@
76274
77450
  "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
76275
77451
  });
76276
77452
  }
76277
- const switchComponent = createSwitch(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table);
77453
+ const switchComponent = createSwitch(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table, value);
76278
77454
  return switchComponent && cellGroup.appendChild(switchComponent), switchComponent.render(), width -= padding[1] + padding[3] + iconWidth, height -= padding[0] + padding[2], "center" === textAlign ? switchComponent.setAttribute("x", padding[3] + cellLeftIconWidth + (width - switchComponent.AABBBounds.width()) / 2) : "right" === textAlign ? switchComponent.setAttribute("x", padding[3] + cellLeftIconWidth + width - switchComponent.AABBBounds.width()) : switchComponent.setAttribute("x", padding[3] + cellLeftIconWidth), "middle" === textBaseline ? switchComponent.setAttribute("y", padding[0] + (height - switchComponent.AABBBounds.height()) / 2) : "bottom" === textBaseline ? switchComponent.setAttribute("y", padding[0] + height - switchComponent.AABBBounds.height()) : switchComponent.setAttribute("y", padding[0]), cellGroup;
76279
77455
  }
76280
- function createSwitch(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table) {
77456
+ function createSwitch(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table, cellValue) {
76281
77457
  var _a, _b, _c, _d;
76282
77458
  const style = table._getCellStyle(col, row),
76283
77459
  spaceBetweenTextAndCircle = getProp("spaceBetweenTextAndCircle", style, col, row, table),
@@ -76289,7 +77465,7 @@
76289
77465
  disableCheckedFill = getProp("disableCheckedFill", style, col, row, table),
76290
77466
  disableUncheckedFill = getProp("disableUncheckedFill", style, col, row, table),
76291
77467
  circleFill = getProp("circleFill", style, col, row, table),
76292
- value = table.getCellValue(col, row),
77468
+ value = cellValue,
76293
77469
  dataValue = table.getCellOriginValue(col, row);
76294
77470
  let isChecked,
76295
77471
  isDisabled,
@@ -76380,8 +77556,9 @@
76380
77556
 
76381
77557
  const xScale = new PointScale(),
76382
77558
  yScale = new LinearScale();
76383
- function createSparkLineCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, table, cellTheme, isAsync) {
77559
+ function createSparkLineCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, table, cellTheme, isAsync, cellValue) {
76384
77560
  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;
77561
+ const value = arguments.length >= 13 ? cellValue : table.getCellValue(col, row);
76385
77562
  if (!cellGroup) {
76386
77563
  const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
76387
77564
  isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0)) && "cell" === cellGroup.role && cellGroup.setAttributes({
@@ -76416,13 +77593,13 @@
76416
77593
  cornerRadius: cellTheme.group.cornerRadius
76417
77594
  })).role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup = null !== (_0 = null == columnGroup ? void 0 : columnGroup.addCellGroup(cellGroup)) && void 0 !== _0 ? _0 : cellGroup);
76418
77595
  }
76419
- const chartGroup = createSparkLine(col, row, width, height, padding, table);
77596
+ const chartGroup = createSparkLine(col, row, width, height, padding, table, value);
76420
77597
  return chartGroup && cellGroup.appendChild(chartGroup), cellGroup;
76421
77598
  }
76422
- function createSparkLine(col, row, width, height, padding, table) {
77599
+ function createSparkLine(col, row, width, height, padding, table, cellValue) {
76423
77600
  let sparklineSpec, chartGroup;
76424
77601
  const chartSpecRaw = table.internalProps.layoutMap.getBody(col, row).sparklineSpec,
76425
- dataValue = table.getCellValue(col, row);
77602
+ dataValue = cellValue;
76426
77603
  if (!Array.isArray(dataValue)) return;
76427
77604
  const x = padding[3],
76428
77605
  y = padding[0];
@@ -76433,7 +77610,7 @@
76433
77610
  col: col,
76434
77611
  row: row,
76435
77612
  dataValue: table.getCellOriginValue(col, row) || "",
76436
- value: table.getCellValue(col, row) || "",
77613
+ value: dataValue || "",
76437
77614
  rect: table.getCellRangeRelativeRect(table.getCellRange(col, row)),
76438
77615
  table: table
76439
77616
  };
@@ -76576,15 +77753,91 @@
76576
77753
  return numbers;
76577
77754
  }
76578
77755
 
77756
+ const audioIconSvg = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="42" height="42" rx="10" fill="#F8FAFF" fill-opacity="0.92"/><rect x="3.75" y="3.75" width="40.5" height="40.5" rx="9.25" stroke="#1D4ED8" stroke-opacity="0.22" stroke-width="1.5"/><path d="M16 30H12C10.8954 30 10 29.1046 10 28V20C10 18.8954 10.8954 18 12 18H16L26 10V38L16 30Z" fill="#EAF1FF" stroke="#0F172A" stroke-opacity="0.24" stroke-width="5.5" stroke-linejoin="round"/><path d="M31.5 18.5C33.3 21.3 33.3 26.7 31.5 29.5" stroke="#0F172A" stroke-opacity="0.24" stroke-width="5.5" stroke-linecap="round"/><path d="M36 15C39.2 20.4 39.2 27.6 36 33" stroke="#0F172A" stroke-opacity="0.24" stroke-width="5.5" stroke-linecap="round"/><path d="M16 30H12C10.8954 30 10 29.1046 10 28V20C10 18.8954 10.8954 18 12 18H16L26 10V38L16 30Z" fill="#EAF1FF" stroke="#2563EB" stroke-width="3.2" stroke-linejoin="round"/><path d="M31.5 18.5C33.3 21.3 33.3 26.7 31.5 29.5" stroke="#2563EB" stroke-width="3.2" stroke-linecap="round"/><path d="M36 15C39.2 20.4 39.2 27.6 36 33" stroke="#2563EB" stroke-width="3.2" stroke-linecap="round"/></svg>';
77757
+ function createAudioCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync, _cellValue) {
77758
+ 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;
77759
+ const headerStyle = table._getCellStyle(col, row),
77760
+ functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
77761
+ (null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.imageMargin) ? padding = getQuadProps(null === (_b = table.options.customConfig) || void 0 === _b ? void 0 : _b.imageMargin) : isValid$1(functionalPadding) && (padding = functionalPadding), (null === (_c = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _c ? void 0 : _c.textAlign) && (textAlign = cellTheme.text.textAlign), (null === (_d = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _d ? void 0 : _d.textBaseline) && (textBaseline = cellTheme.text.textBaseline);
77762
+ const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
77763
+ let cellGroup, cellIcons;
77764
+ if (isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0), cellGroup && "cell" === cellGroup.role && cellGroup.setAttributes({
77765
+ x: xOrigin,
77766
+ y: yOrigin,
77767
+ width: width,
77768
+ height: height,
77769
+ lineWidth: null !== (_f = null === (_e = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _e ? void 0 : _e.lineWidth) && void 0 !== _f ? _f : void 0,
77770
+ fill: null !== (_h = null === (_g = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _g ? void 0 : _g.fill) && void 0 !== _h ? _h : void 0,
77771
+ stroke: null !== (_k = null === (_j = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _j ? void 0 : _j.stroke) && void 0 !== _k ? _k : void 0,
77772
+ strokeArrayWidth: strokeArrayWidth,
77773
+ strokeArrayColor: null !== (_m = null === (_l = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _l ? void 0 : _l.strokeArrayColor) && void 0 !== _m ? _m : void 0,
77774
+ cursor: null !== (_p = null === (_o = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _o ? void 0 : _o.cursor) && void 0 !== _p ? _p : void 0,
77775
+ lineDash: null !== (_r = null === (_q = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _q ? void 0 : _q.lineDash) && void 0 !== _r ? _r : void 0,
77776
+ lineCap: "butt",
77777
+ clip: !0,
77778
+ cornerRadius: cellTheme.group.cornerRadius
77779
+ })), cellGroup && "cell" === cellGroup.role || (cellGroup = new Group$1({
77780
+ x: xOrigin,
77781
+ y: yOrigin,
77782
+ width: width,
77783
+ height: height,
77784
+ lineWidth: null !== (_t = null === (_s = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _s ? void 0 : _s.lineWidth) && void 0 !== _t ? _t : void 0,
77785
+ fill: null !== (_v = null === (_u = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _u ? void 0 : _u.fill) && void 0 !== _v ? _v : void 0,
77786
+ stroke: null !== (_x = null === (_w = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _w ? void 0 : _w.stroke) && void 0 !== _x ? _x : void 0,
77787
+ strokeArrayWidth: strokeArrayWidth,
77788
+ strokeArrayColor: null !== (_z = null === (_y = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _y ? void 0 : _y.strokeArrayColor) && void 0 !== _z ? _z : void 0,
77789
+ cursor: null !== (_1 = null === (_0 = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _0 ? void 0 : _0.cursor) && void 0 !== _1 ? _1 : void 0,
77790
+ lineDash: null !== (_3 = null === (_2 = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _2 ? void 0 : _2.lineDash) && void 0 !== _3 ? _3 : void 0,
77791
+ lineCap: "butt",
77792
+ clip: !0,
77793
+ cornerRadius: cellTheme.group.cornerRadius
77794
+ }), cellGroup.role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup = null !== (_4 = null == columnGroup ? void 0 : columnGroup.addCellGroup(cellGroup)) && void 0 !== _4 ? _4 : cellGroup), mayHaveIcon) {
77795
+ let iconCol = col,
77796
+ iconRow = row;
77797
+ range && (iconCol = range.start.col, iconRow = range.start.row), cellIcons = table.getCellIcons(iconCol, iconRow);
77798
+ }
77799
+ let cellLeftIconWidth = 0,
77800
+ cellRightIconWidth = 0;
77801
+ if (Array.isArray(cellIcons) && 0 !== cellIcons.length) {
77802
+ const {
77803
+ leftIconWidth: leftIconWidth,
77804
+ rightIconWidth: rightIconWidth,
77805
+ absoluteRightIconWidth: absoluteRightIconWidth
77806
+ } = dealWithIconLayout(cellIcons, cellGroup, range, table);
77807
+ cellLeftIconWidth = leftIconWidth, cellRightIconWidth = rightIconWidth, cellGroup.forEachChildren(child => {
77808
+ "icon-left" === child.role ? child.setAttribute("x", child.attribute.x + padding[3]) : "icon-right" === child.role ? child.setAttribute("x", child.attribute.x + width - rightIconWidth - padding[1]) : "icon-absolute-right" === child.role && child.setAttribute("x", child.attribute.x + width - absoluteRightIconWidth - padding[1]);
77809
+ }), cellGroup.forEachChildren(child => {
77810
+ "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
77811
+ });
77812
+ }
77813
+ cellGroup._cellLeftIconWidth = cellLeftIconWidth, cellGroup._cellRightIconWidth = cellRightIconWidth;
77814
+ const availableWidth = Math.max(1, width - padding[1] - padding[3] - cellLeftIconWidth - cellRightIconWidth),
77815
+ availableHeight = Math.max(1, height - padding[0] - padding[2]),
77816
+ iconSize = Math.max(1, Math.min(availableWidth, availableHeight, 32)),
77817
+ pos = calcStartPosition(cellLeftIconWidth, 0, width - cellLeftIconWidth - cellRightIconWidth, height, iconSize, iconSize, textAlign, textBaseline, padding);
77818
+ removeCellMediaChildren(cellGroup);
77819
+ const image = markCellMedia(createImage({
77820
+ x: pos.x,
77821
+ y: pos.y,
77822
+ width: iconSize,
77823
+ height: iconSize,
77824
+ image: audioIconSvg,
77825
+ cursor: "pointer"
77826
+ }), "image");
77827
+ return image.name = "image", image.keepAspectRatio = !0, image.isAudioIcon = !0, image.textAlign = textAlign, image.textBaseline = textBaseline, cellGroup.appendChild(image), cellGroup;
77828
+ }
77829
+
76579
77830
  const regedIcons = get$4();
76580
- function releaseVideoResource(video) {
76581
- try {
76582
- video.pause();
76583
- } catch (err) {}
76584
- video.removeAttribute("src");
76585
- try {
76586
- video.load();
76587
- } catch (err) {}
77831
+ function updateVideoMediaDxDy(startCol, endCol, startRow, endRow, table) {
77832
+ for (let col = startCol; col <= endCol; col++) for (let row = startRow; row <= endRow; row++) {
77833
+ const cellGroup = table.scenegraph.getCell(col, row);
77834
+ cellGroup && cellGroup.forEachChildren(child => {
77835
+ isCellMedia(child) && child.setAttributes({
77836
+ dx: -table.getColsWidth(cellGroup.mergeStartCol, col - 1),
77837
+ dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
77838
+ });
77839
+ });
77840
+ }
76588
77841
  }
76589
77842
  function getVideoFirstFrameTimeout(table) {
76590
77843
  var _a;
@@ -76599,7 +77852,7 @@
76599
77852
  function snapshotVideoFirstFrame(video, image, table) {
76600
77853
  const displayWidth = image.attribute.width,
76601
77854
  displayHeight = image.attribute.height;
76602
- if ("number" != typeof displayWidth || "number" != typeof displayHeight || displayWidth <= 0 || displayHeight <= 0) return !1;
77855
+ if (video.videoWidth <= 0 || video.videoHeight <= 0 || "number" != typeof displayWidth || "number" != typeof displayHeight || displayWidth <= 0 || displayHeight <= 0) return !1;
76603
77856
  const canvas = document.createElement("canvas"),
76604
77857
  context = canvas.getContext("2d");
76605
77858
  if (!context) return !1;
@@ -76635,7 +77888,7 @@
76635
77888
  height: viewBoxHeight
76636
77889
  } : void 0;
76637
77890
  }
76638
- function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync) {
77891
+ function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync, cellValue) {
76639
77892
  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;
76640
77893
  const headerStyle = table._getCellStyle(col, row),
76641
77894
  functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
@@ -76690,10 +77943,26 @@
76690
77943
  "icon-left" === child.role ? child.setAttribute("x", child.attribute.x + padding[3]) : "icon-right" === child.role ? child.setAttribute("x", child.attribute.x + width - rightIconWidth - padding[1]) : "icon-absolute-right" === child.role && child.setAttribute("x", child.attribute.x + width - absoluteRightIconWidth - padding[1]);
76691
77944
  }), cellGroup.forEachChildren(child => {
76692
77945
  "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
76693
- }), cellGroup._cellLeftIconWidth = cellLeftIconWidth, cellGroup._cellRightIconWidth = cellRightIconWidth;
77946
+ });
76694
77947
  }
76695
- const value = table.getCellValue(col, row),
76696
- video = document.createElement("video");
77948
+ cellGroup._cellLeftIconWidth = cellLeftIconWidth, cellGroup._cellRightIconWidth = cellRightIconWidth;
77949
+ const value = arguments.length >= 18 ? cellValue : table.getCellValue(col, row);
77950
+ if (removeCellMediaChildren(cellGroup), isAudioUrl(value)) {
77951
+ const availableWidth = Math.max(1, width - padding[1] - padding[3] - cellLeftIconWidth - cellRightIconWidth),
77952
+ availableHeight = Math.max(1, height - padding[0] - padding[2]),
77953
+ iconSize = Math.max(1, Math.min(availableWidth, availableHeight, 32)),
77954
+ pos = calcStartPosition(cellLeftIconWidth, 0, width - cellLeftIconWidth - cellRightIconWidth, height, iconSize, iconSize, textAlign, textBaseline, padding),
77955
+ image = markCellMedia(createImage({
77956
+ x: pos.x,
77957
+ y: pos.y,
77958
+ width: iconSize,
77959
+ height: iconSize,
77960
+ image: audioIconSvg,
77961
+ cursor: "pointer"
77962
+ }), "image");
77963
+ return image.name = "image", image.keepAspectRatio = !0, image.isAudioIcon = !0, image.textAlign = textAlign, image.textBaseline = textBaseline, cellGroup.appendChild(image), cellGroup;
77964
+ }
77965
+ const video = document.createElement("video");
76697
77966
  video.muted = !0, video.playsInline = !0;
76698
77967
  const shouldSnapshot = !0 === (null === (_7 = table.options.customConfig) || void 0 === _7 ? void 0 : _7.videoFirstFrameSnapshot);
76699
77968
  let loadTimer,
@@ -76704,7 +77973,7 @@
76704
77973
  releaseCurrentVideo = () => {
76705
77974
  videoReleased || (videoReleased = !0, clearVideoLoadTimer(), releaseVideoResource(video));
76706
77975
  },
76707
- isCurrentImage = () => cellGroup.getChildByName("image", !0) === image,
77976
+ isCurrentImage = () => getCellMediaImage(cellGroup) === image,
76708
77977
  handleVideoLoadFail = () => {
76709
77978
  videoReleased || (isCurrentImage() && ((() => {
76710
77979
  var _a, _b;
@@ -76736,7 +78005,7 @@
76736
78005
  y: pos.y,
76737
78006
  width: imageWidth,
76738
78007
  height: imageHeight
76739
- }), isMerge && updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
78008
+ }), isMerge && updateVideoMediaDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
76740
78009
  }
76741
78010
  })(), table.scenegraph.updateNextFrame()), shouldSnapshot && releaseCurrentVideo());
76742
78011
  };
@@ -76745,6 +78014,7 @@
76745
78014
  if (!isCurrentImage()) return void releaseCurrentVideo();
76746
78015
  const scenegraph = table.scenegraph;
76747
78016
  if (!scenegraph) return;
78017
+ if (video.videoWidth <= 0 || video.videoHeight <= 0) return void handleVideoLoadFail();
76748
78018
  imageAutoSizing && _adjustWidthHeight(col, row, video.videoWidth, video.videoHeight, scenegraph, padding, cellGroup);
76749
78019
  const {
76750
78020
  width: cellWidth,
@@ -76771,7 +78041,7 @@
76771
78041
  height: cellHeight - padding[2] - padding[0],
76772
78042
  dy: 0
76773
78043
  });
76774
- isMerge && updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
78044
+ isMerge && updateVideoMediaDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
76775
78045
  const {
76776
78046
  width: width,
76777
78047
  height: height
@@ -76779,11 +78049,10 @@
76779
78049
  iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2),
76780
78050
  anchorX = 0 + (width > image.attribute.width ? image.attribute.x - 0 + image.attribute.width / 2 : width / 2),
76781
78051
  anchorY = 0 + (height > image.attribute.height ? image.attribute.y - 0 + image.attribute.height / 2 : height / 2),
76782
- imageGraphic = cellGroup.getChildByName("image", !0),
76783
78052
  {
76784
78053
  dx: dx,
76785
78054
  dy: dy
76786
- } = imageGraphic.attribute,
78055
+ } = image.attribute,
76787
78056
  playIcon = new Icon$1({
76788
78057
  x: anchorX - iconSize / 2,
76789
78058
  y: anchorY - iconSize / 2,
@@ -76794,16 +78063,16 @@
76794
78063
  dx: dx,
76795
78064
  dy: dy
76796
78065
  });
76797
- playIcon.name = "play-icon", cellGroup.appendChild(playIcon), shouldSnapshot && snapshotVideoFirstFrame(video, image, table) && releaseCurrentVideo(), scenegraph.updateNextFrame();
78066
+ markCellMedia(playIcon, "play-icon"), playIcon.name = "play-icon", cellGroup.appendChild(playIcon), shouldSnapshot && snapshotVideoFirstFrame(video, image, table) && releaseCurrentVideo(), scenegraph.updateNextFrame();
76798
78067
  }), video.addEventListener("error", handleVideoLoadFail), video.addEventListener("abort", handleVideoLoadFail);
76799
- const image = createImage({
78068
+ const image = markCellMedia(createImage({
76800
78069
  x: padding[3],
76801
78070
  y: padding[0],
76802
- width: width - padding[1] - padding[3],
76803
- height: height - padding[2] - padding[0],
78071
+ width: Math.max(1, width - padding[1] - padding[3]),
78072
+ height: Math.max(1, height - padding[2] - padding[0]),
76804
78073
  image: video,
76805
78074
  cursor: "pointer"
76806
- });
78075
+ }), "image");
76807
78076
  image.name = "image", image.keepAspectRatio = keepAspectRatio, image.textAlign = textAlign, image.textBaseline = textBaseline, cellGroup.appendChild(image), image.successCallback = () => {
76808
78077
  const scenegraph = table.scenegraph;
76809
78078
  scenegraph && isDamagePic(image) && (updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table), scenegraph.updateNextFrame());
@@ -76870,8 +78139,9 @@
76870
78139
  }
76871
78140
 
76872
78141
  function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync) {
76873
- 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, _9;
76874
- const headerStyle = table._getCellStyle(col, row),
78142
+ 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, _9, _10, _11;
78143
+ const isCornerCustomMergeContentCell = isCornerCustomMergeRange(range, table) && col === range.end.col && row === range.end.row,
78144
+ headerStyle = table._getCellStyle(col, row),
76875
78145
  functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
76876
78146
  isValid$1(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);
76877
78147
  const autoRowHeight = table.isAutoRowHeight(row),
@@ -76893,7 +78163,7 @@
76893
78163
  cursor: null !== (_q = null === (_p = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _p ? void 0 : _p.cursor) && void 0 !== _q ? _q : void 0,
76894
78164
  lineDash: null !== (_s = null === (_r = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _r ? void 0 : _r.lineDash) && void 0 !== _s ? _s : void 0,
76895
78165
  lineCap: "butt",
76896
- clip: !0,
78166
+ clip: !isCornerCustomMergeContentCell,
76897
78167
  cornerRadius: cellTheme.group.cornerRadius
76898
78168
  })), cellGroup && "cell" === cellGroup.role || (cellGroup = new Group$1({
76899
78169
  x: xOrigin,
@@ -76908,9 +78178,12 @@
76908
78178
  cursor: null !== (_2 = null === (_1 = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _1 ? void 0 : _1.cursor) && void 0 !== _2 ? _2 : void 0,
76909
78179
  lineDash: null !== (_4 = null === (_3 = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _3 ? void 0 : _3.lineDash) && void 0 !== _4 ? _4 : void 0,
76910
78180
  lineCap: "butt",
76911
- clip: !0,
78181
+ clip: !isCornerCustomMergeContentCell,
76912
78182
  cornerRadius: cellTheme.group.cornerRadius
76913
- }), cellGroup.role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup = null !== (_5 = null == columnGroup ? void 0 : columnGroup.addCellGroup(cellGroup)) && void 0 !== _5 ? _5 : cellGroup), customElementsGroup && cellGroup.appendChild(customElementsGroup), renderDefault) {
78183
+ }), cellGroup.role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup = null !== (_5 = null == columnGroup ? void 0 : columnGroup.addCellGroup(cellGroup)) && void 0 !== _5 ? _5 : cellGroup), customElementsGroup && cellGroup.appendChild(customElementsGroup), isCornerCustomMergeContentCell && cellGroup.setAttributes({
78184
+ width: Math.max(cellGroup.attribute.width, null !== (_6 = null == customElementsGroup ? void 0 : customElementsGroup.attribute.width) && void 0 !== _6 ? _6 : 0),
78185
+ height: Math.max(cellGroup.attribute.height, null !== (_7 = null == customElementsGroup ? void 0 : customElementsGroup.attribute.height) && void 0 !== _7 ? _7 : 0)
78186
+ }), renderDefault) {
76914
78187
  const textStr = value;
76915
78188
  let icons;
76916
78189
  if (mayHaveIcon) {
@@ -76918,11 +78191,11 @@
76918
78191
  iconRow = row;
76919
78192
  range && (iconCol = range.start.col, iconRow = range.start.row), icons = table.getCellIcons(iconCol, iconRow);
76920
78193
  }
76921
- createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, "number" == typeof lineClamp ? lineClamp : void 0, cellGroup.attribute.width, cellGroup.attribute.height, textAlign, textBaseline, table, cellTheme, range), (null === (_6 = null == cellTheme ? void 0 : cellTheme._vtable) || void 0 === _6 ? void 0 : _6.marked) && createMark(null === (_7 = null == cellTheme ? void 0 : cellTheme._vtable) || void 0 === _7 ? void 0 : _7.marked, cellGroup);
78194
+ createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, "number" == typeof lineClamp ? lineClamp : void 0, cellGroup.attribute.width, cellGroup.attribute.height, textAlign, textBaseline, table, cellTheme, range), (null === (_8 = null == cellTheme ? void 0 : cellTheme._vtable) || void 0 === _8 ? void 0 : _8.marked) && createMark(null === (_9 = null == cellTheme ? void 0 : cellTheme._vtable) || void 0 === _9 ? void 0 : _9.marked, cellGroup);
76922
78195
  }
76923
78196
  return customElementsGroup && cellGroup.setAttributes({
76924
- width: Math.max(cellGroup.attribute.width, null !== (_8 = customElementsGroup.attribute.width) && void 0 !== _8 ? _8 : 0),
76925
- height: Math.max(cellGroup.attribute.height, null !== (_9 = customElementsGroup.attribute.height) && void 0 !== _9 ? _9 : 0)
78197
+ width: Math.max(cellGroup.attribute.width, null !== (_10 = customElementsGroup.attribute.width) && void 0 !== _10 ? _10 : 0),
78198
+ height: Math.max(cellGroup.attribute.height, null !== (_11 = customElementsGroup.attribute.height) && void 0 !== _11 ? _11 : 0)
76926
78199
  }), cellGroup;
76927
78200
  }
76928
78201
 
@@ -77388,8 +78661,9 @@
77388
78661
  scale.niceMax(target.targetTicks.length);
77389
78662
  }
77390
78663
 
77391
- function createButtonCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync) {
78664
+ function createButtonCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync, cellValue) {
77392
78665
  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;
78666
+ const value = arguments.length >= 19 ? cellValue : table.getCellValue(col, row);
77393
78667
  if (!cellGroup) {
77394
78668
  const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
77395
78669
  isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0)) && "cell" === cellGroup.role && cellGroup.setAttributes({
@@ -77445,10 +78719,10 @@
77445
78719
  "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
77446
78720
  });
77447
78721
  }
77448
- const buttonComponent = createButton(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table);
78722
+ const buttonComponent = createButton(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table, value);
77449
78723
  return buttonComponent && cellGroup.appendChild(buttonComponent), width -= padding[1] + padding[3] + iconWidth, height -= padding[0] + padding[2], "center" === textAlign ? buttonComponent.setAttribute("x", padding[3] + cellLeftIconWidth + (width - buttonComponent.AABBBounds.width()) / 2) : "right" === textAlign ? buttonComponent.setAttribute("x", padding[3] + cellLeftIconWidth + width - buttonComponent.AABBBounds.width()) : buttonComponent.setAttribute("x", padding[3] + cellLeftIconWidth), "middle" === textBaseline ? buttonComponent.setAttribute("y", padding[0] + (height - buttonComponent.AABBBounds.height()) / 2) : "bottom" === textBaseline ? buttonComponent.setAttribute("y", padding[0] + height - buttonComponent.AABBBounds.height()) : buttonComponent.setAttribute("y", padding[0]), cellGroup;
77450
78724
  }
77451
- function createButton(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table) {
78725
+ function createButton(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table, cellValue) {
77452
78726
  var _a, _b;
77453
78727
  const style = table._getCellStyle(col, row),
77454
78728
  buttonColor = getProp("buttonColor", style, col, row, table),
@@ -77462,7 +78736,7 @@
77462
78736
  buttonDisableColor = getProp("buttonDisableColor", style, col, row, table),
77463
78737
  buttonDisableBorderColor = getProp("buttonDisableBorderColor", style, col, row, table),
77464
78738
  buttonTextDisableColor = getProp("buttonTextDisableColor", style, col, row, table),
77465
- value = table.getCellValue(col, row),
78739
+ value = cellValue,
77466
78740
  dataValue = table.getCellOriginValue(col, row),
77467
78741
  hierarchyOffset = getHierarchyOffset(col, row, table),
77468
78742
  cellStyle = table._getCellStyle(col, row),
@@ -77573,8 +78847,11 @@
77573
78847
  const registerVideoCell = () => {
77574
78848
  Factory.registerFunction("createVideoCellGroup", createVideoCellGroup);
77575
78849
  };
78850
+ const registerAudioCell = () => {
78851
+ Factory.registerFunction("createAudioCellGroup", createAudioCellGroup);
78852
+ };
77576
78853
 
77577
- registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerCustomCellStylePlugin(), registerAnimation(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSwitchCell(), registerButtonCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
78854
+ registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerCustomCellStylePlugin(), registerAnimation(), registerAudioCell(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSwitchCell(), registerButtonCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
77578
78855
  class ListTableAll extends ListTable {}
77579
78856
 
77580
78857
  class Circle extends Circle$1 {
@@ -79025,30 +80302,36 @@
79025
80302
  }
79026
80303
  else if (Array.isArray(markLine)) {
79027
80304
  return markLine.map((item, index) => {
80305
+ const style = item.style;
79028
80306
  return {
79029
80307
  ...item,
79030
80308
  date: item.date,
79031
80309
  scrollToMarkLine: item.scrollToMarkLine,
79032
80310
  position: item.position ?? 'left',
79033
- style: {
79034
- lineColor: item.style?.lineColor || 'red',
79035
- lineWidth: item.style?.lineWidth || 1,
79036
- lineDash: item.style?.lineDash
79037
- }
80311
+ style: typeof style === 'function'
80312
+ ? style
80313
+ : {
80314
+ lineColor: style?.lineColor || 'red',
80315
+ lineWidth: style?.lineWidth ?? 1,
80316
+ lineDash: style?.lineDash
80317
+ }
79038
80318
  };
79039
80319
  });
79040
80320
  }
80321
+ const style = markLine.style;
79041
80322
  return [
79042
80323
  {
79043
80324
  ...markLine,
79044
80325
  date: markLine.date,
79045
80326
  scrollToMarkLine: markLine.scrollToMarkLine ?? true,
79046
80327
  position: markLine.position ?? 'left',
79047
- style: {
79048
- lineColor: markLine.style?.lineColor || 'red',
79049
- lineWidth: markLine.style?.lineWidth || 1,
79050
- lineDash: markLine.style?.lineDash
79051
- }
80328
+ style: typeof style === 'function'
80329
+ ? style
80330
+ : {
80331
+ lineColor: style?.lineColor || 'red',
80332
+ lineWidth: style?.lineWidth ?? 1,
80333
+ lineDash: style?.lineDash
80334
+ }
79052
80335
  }
79053
80336
  ];
79054
80337
  }
@@ -81197,6 +82480,15 @@
81197
82480
  }
81198
82481
  }
81199
82482
 
82483
+ function resolveMarkLineStyle(line, args) {
82484
+ const style = typeof line.style === 'function' ? line.style(args) : line.style;
82485
+ const lineWidth = typeof style?.lineWidth === 'function' ? style.lineWidth(args) : style?.lineWidth;
82486
+ return {
82487
+ lineColor: style?.lineColor || 'red',
82488
+ lineWidth: lineWidth ?? 1,
82489
+ lineDash: style?.lineDash
82490
+ };
82491
+ }
81200
82492
  class MarkLine {
81201
82493
  _scene;
81202
82494
  group;
@@ -81242,7 +82534,6 @@
81242
82534
  const minDate = this._scene._gantt.parsedOptions.minDate;
81243
82535
  minDate &&
81244
82536
  markLine.forEach(line => {
81245
- const style = line.style;
81246
82537
  const contentStyle = line.contentStyle || {};
81247
82538
  const date = this._scene._gantt.parsedOptions.timeScaleIncludeHour
81248
82539
  ? createDateAtMidnight(line.date)
@@ -81265,6 +82556,15 @@
81265
82556
  else if (line.position === 'middle') {
81266
82557
  dateX = cellStartX + cellWidth / 2;
81267
82558
  }
82559
+ const style = resolveMarkLineStyle(line, {
82560
+ date,
82561
+ dateIndex: cellIndex,
82562
+ dateX,
82563
+ cellStartX,
82564
+ cellWidth,
82565
+ timelineColWidth: this._scene._gantt.parsedOptions.timelineColWidth,
82566
+ millisecondsPerPixel: this._scene._gantt.getCurrentMillisecondsPerPixel()
82567
+ });
81268
82568
  const markLineGroup = new Group$2({
81269
82569
  pickable: false,
81270
82570
  x: dateX - this.markLineContainerWidth / 2,
@@ -87912,7 +89212,7 @@
87912
89212
  PluginManager: PluginManager
87913
89213
  });
87914
89214
 
87915
- const version = "1.26.6";
89215
+ const version = "1.26.8";
87916
89216
 
87917
89217
  exports.Gantt = Gantt;
87918
89218
  exports.TABLE_EVENT_TYPE = TABLE_EVENT_TYPE;