@visactor/vtable-gantt 1.22.11-alpha.3 → 1.22.11-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.d.ts CHANGED
@@ -6,5 +6,5 @@ import * as tools from './tools';
6
6
  import * as VRender from './vrender';
7
7
  import * as VTable from './vtable';
8
8
  import * as plugins from './plugins';
9
- export declare const version = "1.22.11-alpha.3";
9
+ export declare const version = "1.22.11-alpha.5";
10
10
  export { TYPES, GanttConstructorOptions, Gantt, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, tools, VRender, VTable, plugins };
package/cjs/index.js CHANGED
@@ -56,5 +56,5 @@ exports.VTable = VTable;
56
56
 
57
57
  const plugins = __importStar(require("./plugins"));
58
58
 
59
- exports.plugins = plugins, exports.version = "1.22.11-alpha.3";
59
+ exports.plugins = plugins, exports.version = "1.22.11-alpha.5";
60
60
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.22.11-alpha.3\";\n/**\n * @namespace VTableGantt\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.22.11-alpha.5\";\n/**\n * @namespace VTableGantt\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
@@ -38718,6 +38718,7 @@
38718
38718
  AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
38719
38719
  AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
38720
38720
  CHANGE_CELL_VALUE: "change_cell_value",
38721
+ CHANGE_CELL_VALUES: "change_cell_values",
38721
38722
  DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
38722
38723
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
38723
38724
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
@@ -40844,6 +40845,24 @@
40844
40845
  }
40845
40846
  }
40846
40847
  }
40848
+ changeFieldValueByRecordIndex(value, recordIndex, field, table) {
40849
+ var _a, _b, _c, _d;
40850
+ if (null === field) return;
40851
+ if (null == recordIndex) return;
40852
+ const rawKey = recordIndex.toString();
40853
+ if (!this.beforeChangedRecordsMap.has(rawKey)) {
40854
+ const rawRecords = Array.isArray(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) ? this.dataSourceObj.records : null,
40855
+ originRecord = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
40856
+ this.beforeChangedRecordsMap.set(rawKey, null !== (_b = cloneDeep(originRecord, void 0, ["vtable_gantt_linkedFrom", "vtable_gantt_linkedTo"])) && void 0 !== _b ? _b : {});
40857
+ }
40858
+ if ("string" == typeof field || "number" == typeof field) {
40859
+ const beforeChangedValue = null === (_c = this.beforeChangedRecordsMap.get(rawKey)) || void 0 === _c ? void 0 : _c[field],
40860
+ rawRecords = Array.isArray(null === (_d = this.dataSourceObj) || void 0 === _d ? void 0 : _d.records) ? this.dataSourceObj.records : null,
40861
+ record = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
40862
+ let formatValue = value;
40863
+ "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);
40864
+ }
40865
+ }
40847
40866
  cacheBeforeChangedRecord(dataIndex, table) {
40848
40867
  var _a;
40849
40868
  if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
@@ -40909,9 +40928,16 @@
40909
40928
  }
40910
40929
  }
40911
40930
  adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
40912
- for (let key = this.beforeChangedRecordsMap.size - 1; key >= insertIndex; key--) {
40913
- const record = this.beforeChangedRecordsMap.get(key.toString());
40914
- this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + ("add" === type ? insertCount : -insertCount)).toString(), record);
40931
+ const delta = "add" === type ? insertCount : -insertCount,
40932
+ numericKeys = [];
40933
+ this.beforeChangedRecordsMap.forEach((_, key) => {
40934
+ const numKey = Number(key);
40935
+ Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex && numericKeys.push(numKey);
40936
+ }), numericKeys.sort((a, b) => "add" === type ? b - a : a - b);
40937
+ for (let i = 0; i < numericKeys.length; i++) {
40938
+ const key = numericKeys[i],
40939
+ record = this.beforeChangedRecordsMap.get(key.toString());
40940
+ this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + delta).toString(), record);
40915
40941
  }
40916
40942
  }
40917
40943
  deleteRecords(recordIndexs) {
@@ -57275,7 +57301,7 @@
57275
57301
  };
57276
57302
  let EventManager$1 = class EventManager {
57277
57303
  constructor(table) {
57278
- 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.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
57304
+ 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.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
57279
57305
  this.bindSelfEvent();
57280
57306
  }, 0));
57281
57307
  }
@@ -57577,15 +57603,25 @@
57577
57603
  } catch (error) {}
57578
57604
  }
57579
57605
  handleCut(e) {
57606
+ var _a;
57580
57607
  return __awaiter$1(this, void 0, void 0, function* () {
57581
- this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
57582
- this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer = null);
57608
+ 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 => ({
57609
+ start: {
57610
+ col: r.start.col,
57611
+ row: r.start.row
57612
+ },
57613
+ end: {
57614
+ col: r.end.col,
57615
+ row: r.end.row
57616
+ }
57617
+ })), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
57618
+ this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer = null);
57583
57619
  }, 3e4), this.saveClipboardContent();
57584
57620
  });
57585
57621
  }
57586
57622
  handlePaste(e) {
57587
57623
  this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
57588
- this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
57624
+ 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));
57589
57625
  }).catch(() => {
57590
57626
  this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
57591
57627
  }) : this.executePaste(e);
@@ -57662,9 +57698,9 @@
57662
57698
  }
57663
57699
  clearCutArea(table) {
57664
57700
  try {
57665
- const selectCells = this.cutCellRange;
57666
- if (!selectCells || 0 === selectCells.length) return;
57667
- for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, void 0);
57701
+ const ranges = this.cutRanges;
57702
+ if (!ranges || 0 === ranges.length) return;
57703
+ table.changeCellValuesByIds(ranges, "");
57668
57704
  } catch (error) {}
57669
57705
  }
57670
57706
  checkClipboardChanged() {
@@ -59602,6 +59638,15 @@
59602
59638
  constructor(table, customCellStyle, customCellStyleArrangement) {
59603
59639
  this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
59604
59640
  }
59641
+ clearCustomCellStyleArrangement() {
59642
+ this.customCellStyleArrangement = [];
59643
+ }
59644
+ addCustomCellStyleArrangement(cellPosition, customStyleId) {
59645
+ this.customCellStyleArrangement.push({
59646
+ cellPosition: cellPosition,
59647
+ customStyleId: customStyleId
59648
+ });
59649
+ }
59605
59650
  getCustomCellStyle(col, row) {
59606
59651
  const customStyleIds = this.getCustomCellStyleIds(col, row);
59607
59652
  if (customStyleIds.length) {
@@ -59907,7 +59952,7 @@
59907
59952
  }
59908
59953
  constructor(container, options = {}) {
59909
59954
  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;
59910
- if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
59955
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.5", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
59911
59956
  this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
59912
59957
  options: options,
59913
59958
  container: container
@@ -63718,15 +63763,16 @@
63718
63763
  step((generator = generator.apply(thisArg, _arguments || [])).next());
63719
63764
  });
63720
63765
  };
63721
- function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
63766
+ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
63722
63767
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
63723
- const recordIndex = table.getRecordShowIndexByCell(col, row),
63768
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row),
63769
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
63724
63770
  {
63725
63771
  field: field
63726
63772
  } = table.internalProps.layoutMap.getBody(col, row),
63727
63773
  beforeChangeValue = table.getCellRawValue(col, row),
63728
63774
  oldValue = table.getCellOriginValue(col, row);
63729
- table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
63775
+ table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
63730
63776
  const range = table.getCellRange(col, row),
63731
63777
  aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
63732
63778
  if (aggregators) {
@@ -63749,16 +63795,24 @@
63749
63795
  table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
63750
63796
  }
63751
63797
  const changedValue = table.getCellOriginValue(col, row);
63752
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
63753
- col: col,
63754
- row: row,
63755
- rawValue: beforeChangeValue,
63756
- currentValue: oldValue,
63757
- changedValue: changedValue
63758
- }), table.scenegraph.updateNextFrame();
63798
+ if (oldValue !== changedValue && triggerEvent) {
63799
+ const changeValue = {
63800
+ col: col,
63801
+ row: row,
63802
+ recordIndex: recordIndex,
63803
+ field: field,
63804
+ rawValue: beforeChangeValue,
63805
+ currentValue: oldValue,
63806
+ changedValue: changedValue
63807
+ };
63808
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
63809
+ values: [changeValue]
63810
+ });
63811
+ }
63812
+ table.scenegraph.updateNextFrame();
63759
63813
  }
63760
63814
  }
63761
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
63815
+ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
63762
63816
  var _a, _b;
63763
63817
  return __awaiter(this, void 0, void 0, function* () {
63764
63818
  const changedCellResults = [];
@@ -63780,6 +63834,7 @@
63780
63834
  oldRowValues.push(oldValue);
63781
63835
  }
63782
63836
  }
63837
+ const resultChangeValues = [];
63783
63838
  for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
63784
63839
  changedCellResults[i] = [], pasteRowEnd = startRow + i;
63785
63840
  const rowValues = values[i];
@@ -63803,25 +63858,34 @@
63803
63858
  if (isCanChange) {
63804
63859
  changedCellResults[i][j] = !0;
63805
63860
  const value = rowValues[j],
63806
- recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
63861
+ recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
63862
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
63807
63863
  {
63808
63864
  field: field
63809
63865
  } = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
63810
63866
  beforeChangeValue = beforeChangeValues[i][j],
63811
63867
  oldValue = oldValues[i][j];
63812
- table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
63868
+ 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);
63813
63869
  const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
63814
- oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
63815
- col: startCol + j,
63816
- row: startRow + i,
63817
- rawValue: beforeChangeValue,
63818
- currentValue: oldValue,
63819
- changedValue: changedValue
63820
- });
63870
+ if (oldValue !== changedValue && triggerEvent) {
63871
+ const changeValue = {
63872
+ col: startCol + j,
63873
+ row: startRow + i,
63874
+ recordIndex: recordIndex,
63875
+ field: field,
63876
+ rawValue: beforeChangeValue,
63877
+ currentValue: oldValue,
63878
+ changedValue: changedValue
63879
+ };
63880
+ table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
63881
+ }
63821
63882
  } else changedCellResults[i][j] = !1;
63822
63883
  }
63823
63884
  pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
63824
63885
  }
63886
+ silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
63887
+ values: resultChangeValues
63888
+ });
63825
63889
  const startRange = table.getCellRange(startCol, startRow),
63826
63890
  range = table.getCellRange(pasteColEnd, pasteRowEnd),
63827
63891
  aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
@@ -63855,6 +63919,58 @@
63855
63919
  return table.scenegraph.updateNextFrame(), changedCellResults;
63856
63920
  });
63857
63921
  }
63922
+ function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
63923
+ var _a, _b;
63924
+ return __awaiter(this, void 0, void 0, function* () {
63925
+ const resultChangeValues = [],
63926
+ processed = new Set(),
63927
+ nextValue = null != value ? value : "";
63928
+ for (let i = 0; i < (null !== (_a = null == ranges ? void 0 : ranges.length) && void 0 !== _a ? _a : 0); i++) {
63929
+ const range = ranges[i],
63930
+ startCol = Math.min(range.start.col, range.end.col),
63931
+ endCol = Math.max(range.start.col, range.end.col),
63932
+ startRow = Math.min(range.start.row, range.end.row),
63933
+ endRow = Math.max(range.start.row, range.end.row);
63934
+ if (startCol > endCol || startRow > endRow) continue;
63935
+ const values = [],
63936
+ oldValues = [];
63937
+ for (let row = startRow; row <= endRow; row++) {
63938
+ const rowValues = [],
63939
+ rowOldValues = [];
63940
+ for (let col = startCol; col <= endCol; col++) rowValues.push(nextValue), rowOldValues.push(table.getCellOriginValue(col, row));
63941
+ values.push(rowValues), oldValues.push(rowOldValues);
63942
+ }
63943
+ const changedCellResults = yield listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, !0);
63944
+ for (let r = 0; r < values.length; r++) for (let c = 0; c < values[r].length; c++) {
63945
+ const col = startCol + c,
63946
+ row = startRow + r,
63947
+ key = `${col},${row}`;
63948
+ if (processed.has(key)) continue;
63949
+ if (processed.add(key), !triggerEvent || !(null === (_b = null == changedCellResults ? void 0 : changedCellResults[r]) || void 0 === _b ? void 0 : _b[c])) continue;
63950
+ const oldValue = oldValues[r][c],
63951
+ changedValue = table.getCellOriginValue(col, row);
63952
+ if (oldValue === changedValue) continue;
63953
+ const recordShowIndex = table.getRecordShowIndexByCell(col, row),
63954
+ recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
63955
+ {
63956
+ field: field
63957
+ } = table.internalProps.layoutMap.getBody(col, row);
63958
+ resultChangeValues.push({
63959
+ col: col,
63960
+ row: row,
63961
+ recordIndex: recordIndex,
63962
+ field: field,
63963
+ rawValue: oldValue,
63964
+ currentValue: oldValue,
63965
+ changedValue: changedValue
63966
+ });
63967
+ }
63968
+ }
63969
+ !silentChangeCellValuesEvent && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
63970
+ values: resultChangeValues
63971
+ });
63972
+ });
63973
+ }
63858
63974
  function getCellUpdateType(col, row, table, oldCellUpdateType) {
63859
63975
  if ("group" === oldCellUpdateType) return oldCellUpdateType;
63860
63976
  if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
@@ -65018,43 +65134,165 @@
65018
65134
  }
65019
65135
  return isValid$1(editorDefine);
65020
65136
  }
65021
- changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0) {
65022
- return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
65137
+ changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65138
+ return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65139
+ }
65140
+ changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65141
+ return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65142
+ }
65143
+ changeCellValuesByIds(ranges, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
65144
+ return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
65145
+ }
65146
+ changeSourceCellValue(recordIndex, field, value) {
65147
+ const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
65148
+ cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
65149
+ if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) return;
65150
+ this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
65151
+ const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row),
65152
+ oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row),
65153
+ changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
65154
+ if (oldValue !== changedValue) {
65155
+ const changeValue = {
65156
+ col: cellAddr.col,
65157
+ row: cellAddr.row,
65158
+ recordIndex: recordIndex,
65159
+ field: field,
65160
+ rawValue: beforeChangeValue,
65161
+ currentValue: oldValue,
65162
+ changedValue: changedValue
65163
+ };
65164
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65165
+ values: [changeValue]
65166
+ });
65167
+ }
65168
+ }
65169
+ changeCellValueByRecord(recordIndex, field, value, options) {
65170
+ var _a, _b, _c, _d, _e;
65171
+ const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
65172
+ silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
65173
+ autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
65174
+ records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
65175
+ let record, oldValue;
65176
+ 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;
65177
+ const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
65178
+ if (oldValue !== changedValue) {
65179
+ const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex),
65180
+ changeValue = {
65181
+ col: null !== (_d = null == cellAddr ? void 0 : cellAddr.col) && void 0 !== _d ? _d : -1,
65182
+ row: null !== (_e = null == cellAddr ? void 0 : cellAddr.row) && void 0 !== _e ? _e : -1,
65183
+ recordIndex: recordIndex,
65184
+ field: field,
65185
+ rawValue: oldValue,
65186
+ currentValue: oldValue,
65187
+ changedValue: changedValue
65188
+ };
65189
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65190
+ values: [changeValue]
65191
+ });
65192
+ }
65193
+ autoRefresh && this.refreshAfterSourceChange();
65023
65194
  }
65024
- changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
65025
- return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
65195
+ changeCellValueBySource(recordIndex, field, value, triggerEvent = !0, silentChangeCellValuesEvent) {
65196
+ return this.changeCellValueByRecord(recordIndex, field, value, {
65197
+ triggerEvent: triggerEvent,
65198
+ silentChangeCellValuesEvent: silentChangeCellValuesEvent,
65199
+ autoRefresh: !0
65200
+ });
65026
65201
  }
65027
- addRecord(record, recordIndex) {
65202
+ changeCellValuesByRecords(changeValues, options) {
65203
+ var _a, _b, _c, _d, _e, _f, _g;
65204
+ const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
65205
+ silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
65206
+ autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
65207
+ resultChangeValues = [];
65208
+ for (let i = 0; i < changeValues.length; i++) {
65209
+ const {
65210
+ recordIndex: recordIndex,
65211
+ field: field,
65212
+ value: value
65213
+ } = changeValues[i],
65214
+ records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
65215
+ let record, oldValue;
65216
+ 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) {
65217
+ const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
65218
+ if (oldValue !== changedValue) {
65219
+ const changeValue = {
65220
+ col: null !== (_e = null === (_d = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _d ? void 0 : _d.col) && void 0 !== _e ? _e : -1,
65221
+ row: null !== (_g = null === (_f = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _f ? void 0 : _f.row) && void 0 !== _g ? _g : -1,
65222
+ recordIndex: recordIndex,
65223
+ field: field,
65224
+ rawValue: oldValue,
65225
+ currentValue: oldValue,
65226
+ changedValue: changedValue
65227
+ };
65228
+ this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
65229
+ }
65230
+ }
65231
+ }
65232
+ !silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
65233
+ values: resultChangeValues
65234
+ }), autoRefresh && this.refreshAfterSourceChange();
65235
+ }
65236
+ changeCellValuesBySource(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
65237
+ return this.changeCellValuesByRecords(changeValues, {
65238
+ triggerEvent: triggerEvent,
65239
+ silentChangeCellValuesEvent: silentChangeCellValuesEvent,
65240
+ autoRefresh: !0
65241
+ });
65242
+ }
65243
+ refreshAfterSourceChange(options) {
65244
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
65245
+ const reapplyFilter = null === (_a = null == options ? void 0 : options.reapplyFilter) || void 0 === _a || _a,
65246
+ reapplySort = null === (_b = null == options ? void 0 : options.reapplySort) || void 0 === _b || _b,
65247
+ clearRowHeightCache = null === (_c = null == options ? void 0 : options.clearRowHeightCache) || void 0 === _c || _c;
65248
+ this.scenegraph.clearCells(), this.sortState && reapplySort && (null === (_e = (_d = this.dataSource).clearSortedIndexMap) || void 0 === _e || _e.call(_d), null === (_g = null === (_f = this.dataSource.sortedIndexMap) || void 0 === _f ? void 0 : _f.clear) || void 0 === _g || _g.call(_f)), reapplyFilter ? this.sortState && reapplySort ? (this.dataSource.updateFilterRulesForSorted(null === (_h = this.dataSource.dataConfig) || void 0 === _h ? void 0 : _h.filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(null === (_j = this.dataSource.dataConfig) || void 0 === _j ? void 0 : _j.filterRules) : this.sortState && reapplySort && sortRecords(this);
65249
+ const traverseColumns = columns => {
65250
+ var _a, _b, _c, _d;
65251
+ for (let i = 0; i < (null !== (_a = null == columns ? void 0 : columns.length) && void 0 !== _a ? _a : 0); i++) {
65252
+ const column = columns[i],
65253
+ aggregators = null == column ? void 0 : column.vtable_aggregator;
65254
+ if (aggregators) if (Array.isArray(aggregators)) for (let j = 0; j < aggregators.length; j++) null === (_c = null === (_b = aggregators[j]) || void 0 === _b ? void 0 : _b.recalculate) || void 0 === _c || _c.call(_b);else null === (_d = null == aggregators ? void 0 : aggregators.recalculate) || void 0 === _d || _d.call(aggregators);
65255
+ (null == column ? void 0 : column.columns) && traverseColumns(column.columns);
65256
+ }
65257
+ };
65258
+ traverseColumns(this.internalProps.columns), this.refreshRowColCount(), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!clearRowHeightCache), null === (_k = this.internalProps.emptyTip) || void 0 === _k || _k.resetVisible(), this.resize();
65259
+ }
65260
+ addRecord(record, recordIndex, triggerEvent = !0) {
65028
65261
  var _a;
65029
65262
  const success = listTableAddRecord(record, recordIndex, this);
65030
- adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65263
+ adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65031
65264
  records: [record],
65032
65265
  recordIndex: recordIndex,
65033
65266
  recordCount: 1
65034
65267
  });
65035
65268
  }
65036
- addRecords(records, recordIndex) {
65269
+ addRecords(records, recordIndex, triggerEvent = !0) {
65037
65270
  var _a;
65038
65271
  const success = listTableAddRecords(records, recordIndex, this);
65039
- "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65272
+ "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
65040
65273
  records: records,
65041
65274
  recordIndex: recordIndex,
65042
65275
  recordCount: records.length
65043
65276
  });
65044
65277
  }
65045
- deleteRecords(recordIndexs) {
65278
+ deleteRecords(recordIndexs, triggerEvent = !0) {
65046
65279
  var _a;
65047
- listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65280
+ const deletedRecords = [];
65281
+ (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
65282
+ let record = null;
65283
+ record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
65284
+ }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
65048
65285
  const rowIndexs = [];
65049
65286
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
65050
- this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65287
+ triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
65051
65288
  recordIndexs: recordIndexs,
65289
+ records: deletedRecords,
65052
65290
  rowIndexs: rowIndexs,
65053
65291
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
65054
65292
  });
65055
65293
  }
65056
- updateRecords(records, recordIndexs) {
65057
- listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65294
+ updateRecords(records, recordIndexs, triggerEvent = !0) {
65295
+ listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
65058
65296
  records: records,
65059
65297
  recordIndexs: recordIndexs,
65060
65298
  updateCount: records.length
@@ -76212,7 +76450,7 @@
76212
76450
  PluginManager: PluginManager
76213
76451
  });
76214
76452
 
76215
- const version = "1.22.11-alpha.3";
76453
+ const version = "1.22.11-alpha.5";
76216
76454
 
76217
76455
  exports.Gantt = Gantt;
76218
76456
  exports.TYPES = index$4;