@visactor/vtable-calendar 1.22.11-alpha.5 → 1.22.11-alpha.7

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.
@@ -35900,6 +35900,9 @@
35900
35900
  var _a;
35901
35901
  return null !== (_a = defaultStyle.textAlign) && void 0 !== _a ? _a : "left";
35902
35902
  },
35903
+ get textStickBaseOnAlign() {
35904
+ return defaultStyle.textStickBaseOnAlign;
35905
+ },
35903
35906
  get textBaseline() {
35904
35907
  var _a;
35905
35908
  return null !== (_a = defaultStyle.textBaseline) && void 0 !== _a ? _a : "middle";
@@ -36583,6 +36586,9 @@
36583
36586
  get textStick() {
36584
36587
  return style.textStick;
36585
36588
  },
36589
+ get textStickBaseOnAlign() {
36590
+ return style.textStickBaseOnAlign;
36591
+ },
36586
36592
  get marked() {
36587
36593
  return style.marked;
36588
36594
  },
@@ -37025,41 +37031,82 @@
37025
37031
  Array.isArray(indexed) || this.records.splice(indexed, 1, record);
37026
37032
  }
37027
37033
  }
37028
- addRecord(record, index) {
37034
+ _getRawRecordsArray() {
37029
37035
  var _a;
37030
- if (Array.isArray(this.records)) {
37031
- this.records.splice(index, 0, record), this.adjustBeforeChangedRecordsMap(index, 1), this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1;
37032
- for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].push(record);
37033
- if ("tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination) {
37034
- this.pagination.totalCount = this._sourceLength;
37035
- const {
37036
- perPageCount: perPageCount,
37037
- currentPage: currentPage
37038
- } = this.pagination;
37039
- index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
37040
- } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
37041
- (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, 1);
37036
+ const rawRecords = null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records;
37037
+ return Array.isArray(rawRecords) ? rawRecords : null;
37038
+ }
37039
+ _hasFilterInEffect() {
37040
+ var _a, _b, _c, _d, _e;
37041
+ return (null !== (_c = null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0) >= 1 || (null !== (_e = null === (_d = this.lastFilterRules) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0) >= 1;
37042
+ }
37043
+ _normalizeInsertIndex(index, length) {
37044
+ return null == index || index > length ? length : index < 0 ? 0 : index;
37045
+ }
37046
+ _mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
37047
+ if (viewIndex >= this.records.length) return rawRecords.length;
37048
+ if (viewIndex <= 0) return 0;
37049
+ const prevRecord = this.records[viewIndex - 1],
37050
+ rawIndex = rawRecords.indexOf(prevRecord);
37051
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
37052
+ }
37053
+ _resetIndexingFromViewRecords() {
37054
+ if (this._sourceLength = this.records.length, this.currentIndexedData = Array.from({
37055
+ length: this._sourceLength
37056
+ }, (_, i) => i), "tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination) return this.pagination.totalCount = this._sourceLength, void this.updatePagerData();
37057
+ this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
37058
+ }
37059
+ addRecord(record, index, syncToOriginalRecords = !1) {
37060
+ var _a, _b, _c;
37061
+ if (!syncToOriginalRecords) {
37062
+ if (Array.isArray(this.records)) {
37063
+ this.records.splice(index, 0, record), this.adjustBeforeChangedRecordsMap(index, 1), this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1;
37064
+ for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].push(record);
37065
+ if ("tree" === this.rowHierarchyType && this.initTreeHierarchyState(), this.userPagination) {
37066
+ this.pagination.totalCount = this._sourceLength;
37067
+ const {
37068
+ perPageCount: perPageCount,
37069
+ currentPage: currentPage
37070
+ } = this.pagination;
37071
+ index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
37072
+ } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
37073
+ (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, 1);
37074
+ }
37075
+ return;
37042
37076
  }
37077
+ const rawRecords = this._getRawRecordsArray();
37078
+ if (!rawRecords) return;
37079
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
37080
+ rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
37081
+ rawRecords.splice(rawInsertIndex, 0, record), this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules), (null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.added) && this.dataSourceObj.added(rawInsertIndex, 1);
37043
37082
  }
37044
- addRecords(recordArr, index) {
37045
- var _a;
37046
- if (Array.isArray(this.records)) {
37047
- if (Array.isArray(recordArr)) {
37048
- this.records.splice(index, 0, ...recordArr), this.adjustBeforeChangedRecordsMap(index, recordArr.length);
37049
- for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
37050
- this._sourceLength += recordArr.length;
37051
- for (let i = 0; i < this.fieldAggregators.length; i++) for (let j = 0; j < recordArr.length; j++) this.fieldAggregators[i].push(recordArr[j]);
37083
+ addRecords(recordArr, index, syncToOriginalRecords = !1) {
37084
+ var _a, _b, _c;
37085
+ if (!syncToOriginalRecords) {
37086
+ if (Array.isArray(this.records)) {
37087
+ if (Array.isArray(recordArr)) {
37088
+ this.records.splice(index, 0, ...recordArr), this.adjustBeforeChangedRecordsMap(index, recordArr.length);
37089
+ for (let i = 0; i < recordArr.length; i++) this.currentIndexedData.push(this.currentIndexedData.length);
37090
+ this._sourceLength += recordArr.length;
37091
+ for (let i = 0; i < this.fieldAggregators.length; i++) for (let j = 0; j < recordArr.length; j++) this.fieldAggregators[i].push(recordArr[j]);
37092
+ }
37093
+ if (this.userPagination) {
37094
+ this.pagination.totalCount = this._sourceLength;
37095
+ const {
37096
+ perPageCount: perPageCount,
37097
+ currentPage: currentPage
37098
+ } = this.pagination;
37099
+ index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
37100
+ } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
37101
+ (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, recordArr.length);
37052
37102
  }
37053
- if (this.userPagination) {
37054
- this.pagination.totalCount = this._sourceLength;
37055
- const {
37056
- perPageCount: perPageCount,
37057
- currentPage: currentPage
37058
- } = this.pagination;
37059
- index < perPageCount * (currentPage || 0) + perPageCount && this.updatePagerData();
37060
- } else this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength, this.updatePagerData();
37061
- (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.added) && this.dataSourceObj.added(index, recordArr.length);
37103
+ return;
37062
37104
  }
37105
+ const rawRecords = this._getRawRecordsArray();
37106
+ if (!rawRecords || !Array.isArray(recordArr) || 0 === recordArr.length) return;
37107
+ const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
37108
+ rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
37109
+ rawRecords.splice(rawInsertIndex, 0, ...recordArr), this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules), (null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.added) && this.dataSourceObj.added(rawInsertIndex, recordArr.length);
37063
37110
  }
37064
37111
  addRecordForSorted(record) {
37065
37112
  Array.isArray(this.records) && (this.beforeChangedRecordsMap.clear(), this.records.push(record), this.currentIndexedData.push(this.currentIndexedData.length), this._sourceLength += 1, this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength));
@@ -37087,22 +37134,37 @@
37087
37134
  this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + delta).toString(), record);
37088
37135
  }
37089
37136
  }
37090
- deleteRecords(recordIndexs) {
37091
- var _a;
37092
- if (Array.isArray(this.records)) {
37093
- const realDeletedRecordIndexs = [],
37094
- recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
37095
- for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
37096
- const recordIndex = recordIndexsMaxToMin[index];
37097
- if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
37098
- this.adjustBeforeChangedRecordsMap(recordIndex, 1, "delete"), realDeletedRecordIndexs.push(recordIndex);
37099
- const deletedRecord = this.records[recordIndex];
37100
- for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].deleteRecord(deletedRecord);
37101
- this.records.splice(recordIndex, 1), this.currentIndexedData.pop(), this._sourceLength -= 1;
37137
+ deleteRecords(recordIndexs, syncToOriginalRecords = !1) {
37138
+ var _a, _b, _c;
37139
+ if (!syncToOriginalRecords) {
37140
+ if (Array.isArray(this.records)) {
37141
+ const realDeletedRecordIndexs = [],
37142
+ recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
37143
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
37144
+ const recordIndex = recordIndexsMaxToMin[index];
37145
+ if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
37146
+ this.adjustBeforeChangedRecordsMap(recordIndex, 1, "delete"), realDeletedRecordIndexs.push(recordIndex);
37147
+ const deletedRecord = this.records[recordIndex];
37148
+ for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].deleteRecord(deletedRecord);
37149
+ this.records.splice(recordIndex, 1), this.currentIndexedData.pop(), this._sourceLength -= 1;
37150
+ }
37151
+ return this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength), this.updatePagerData(), (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.deleted) && this.dataSourceObj.deleted(realDeletedRecordIndexs), realDeletedRecordIndexs;
37102
37152
  }
37103
- return this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength), this.updatePagerData(), (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.deleted) && this.dataSourceObj.deleted(realDeletedRecordIndexs), realDeletedRecordIndexs;
37153
+ return [];
37104
37154
  }
37105
- return [];
37155
+ const rawRecords = this._getRawRecordsArray();
37156
+ if (!rawRecords || !Array.isArray(this.records)) return [];
37157
+ const realDeletedRecordIndexs = [],
37158
+ recordIndexsMaxToMin = recordIndexs.slice().sort((a, b) => b - a),
37159
+ rawDeletedIndexs = [];
37160
+ for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
37161
+ const viewIndex = recordIndexsMaxToMin[index];
37162
+ if (viewIndex >= this.records.length || viewIndex < 0) continue;
37163
+ const deletedRecord = this.records[viewIndex],
37164
+ rawIndex = rawRecords.indexOf(deletedRecord);
37165
+ rawIndex >= 0 && (rawRecords.splice(rawIndex, 1), rawDeletedIndexs.push(rawIndex)), realDeletedRecordIndexs.push(viewIndex);
37166
+ }
37167
+ return this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules), (null === (_c = this.dataSourceObj) || void 0 === _c ? void 0 : _c.deleted) && this.dataSourceObj.deleted(rawDeletedIndexs), realDeletedRecordIndexs;
37106
37168
  }
37107
37169
  deleteRecordsForSorted(recordIndexs) {
37108
37170
  if (Array.isArray(this.records)) {
@@ -37116,18 +37178,34 @@
37116
37178
  this.sortedIndexMap.clear(), this.userPagination || (this.pagination.perPageCount = this._sourceLength, this.pagination.totalCount = this._sourceLength), this.beforeChangedRecordsMap.clear();
37117
37179
  }
37118
37180
  }
37119
- updateRecords(records, recordIndexs) {
37120
- const realDeletedRecordIndexs = [];
37181
+ updateRecords(records, recordIndexs, syncToOriginalRecords = !1) {
37182
+ var _a;
37183
+ if (!syncToOriginalRecords) {
37184
+ const realDeletedRecordIndexs = [];
37185
+ for (let index = 0; index < recordIndexs.length; index++) {
37186
+ const recordIndex = recordIndexs[index];
37187
+ if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce((acc, key) => (void 0 === acc[key] && (acc[key] = {}), acc[key].children), this.records)[recordIndex[recordIndex.length - 1]] = records[index];else {
37188
+ if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
37189
+ this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex);
37190
+ for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
37191
+ this.records[recordIndex] = records[index];
37192
+ }
37193
+ }
37194
+ return this.userPagination && this.updatePagerData(), realDeletedRecordIndexs;
37195
+ }
37196
+ const rawRecords = this._getRawRecordsArray();
37197
+ if (!rawRecords || !Array.isArray(this.records)) return [];
37198
+ const realUpdatedIndexs = [];
37121
37199
  for (let index = 0; index < recordIndexs.length; index++) {
37122
37200
  const recordIndex = recordIndexs[index];
37123
- if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce((acc, key) => (void 0 === acc[key] && (acc[key] = {}), acc[key].children), this.records)[recordIndex[recordIndex.length - 1]] = records[index];else {
37124
- if (recordIndex >= this._sourceLength || recordIndex < 0) continue;
37125
- this.beforeChangedRecordsMap.delete(recordIndex.toString()), realDeletedRecordIndexs.push(recordIndex);
37126
- for (let i = 0; i < this.fieldAggregators.length; i++) this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
37127
- this.records[recordIndex] = records[index];
37201
+ if (Array.isArray(recordIndex)) this.beforeChangedRecordsMap.delete(recordIndex.toString()), realUpdatedIndexs.push(recordIndex), recordIndex.slice(0, -1).reduce((acc, key) => (void 0 === acc[key] && (acc[key] = {}), acc[key].children), rawRecords)[recordIndex[recordIndex.length - 1]] = records[index];else {
37202
+ if (recordIndex >= this.records.length || recordIndex < 0) continue;
37203
+ const oldRecord = this.records[recordIndex],
37204
+ rawIndex = rawRecords.indexOf(oldRecord);
37205
+ rawIndex >= 0 && (rawRecords[rawIndex] = records[index]), realUpdatedIndexs.push(recordIndex);
37128
37206
  }
37129
37207
  }
37130
- return this.userPagination && this.updatePagerData(), realDeletedRecordIndexs;
37208
+ return this.beforeChangedRecordsMap.clear(), this.sortedIndexMap.clear(), this.updateFilterRules(null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules), realUpdatedIndexs;
37131
37209
  }
37132
37210
  updateRecordsForSorted(records, recordIndexs) {
37133
37211
  for (let index = 0; index < recordIndexs.length; index++) {
@@ -56099,7 +56177,7 @@
56099
56177
  }
56100
56178
  constructor(container, options = {}) {
56101
56179
  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;
56102
- 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");
56180
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.7", 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");
56103
56181
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56104
56182
  options: options,
56105
56183
  container: container
@@ -60099,13 +60177,16 @@
60099
60177
  }), table.dataSource.sort(sortState));
60100
60178
  }
60101
60179
  function listTableAddRecord(record, recordIndex, table) {
60102
- var _a, _b, _c, _d;
60180
+ var _a, _b, _c, _d, _e, _f;
60103
60181
  try {
60104
60182
  if (!record) return !1;
60105
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60183
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, [record], recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, [record], recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) {
60184
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.addRecord(record, table.dataSource.records.length, !0) : table.dataSource.addRecordForSorted(record), table.stateManager.checkedState.clear(), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
60185
+ } else {
60106
60186
  (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
60107
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60108
- table.dataSource.addRecord(record, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1);
60187
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60188
+ syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
60189
+ if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60109
60190
  const oldRowCount = table.rowCount;
60110
60191
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60111
60192
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -60174,13 +60255,16 @@
60174
60255
  }
60175
60256
  }
60176
60257
  function listTableAddRecords(records, recordIndex, table) {
60177
- var _a, _b, _c, _d;
60258
+ var _a, _b, _c, _d, _e, _f;
60178
60259
  try {
60179
60260
  if (!records || 0 === records.length) return !1;
60180
- if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60261
+ if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).addRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndex), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).addRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) {
60262
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.addRecords(records, table.dataSource.records.length, !0) : table.dataSource.addRecordsForSorted(records), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
60263
+ } else {
60181
60264
  void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
60182
- const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60183
- table.dataSource.addRecords(records, recordIndex), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length);
60265
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60266
+ syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
60267
+ if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60184
60268
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60185
60269
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60186
60270
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -60249,16 +60333,20 @@
60249
60333
  }
60250
60334
  }
60251
60335
  function listTableDeleteRecords(recordIndexs, table) {
60252
- var _a, _b, _c, _d, _e, _f, _g, _h;
60336
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
60253
60337
  if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).deleteRecordsForGroup) || void 0 === _b || _b.call(_a, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) {
60254
60338
  const deletedRecordIndexs = null === (_d = (_c = table.dataSource).deleteRecordsForTree) || void 0 === _d ? void 0 : _d.call(_c, recordIndexs);
60255
60339
  if (0 === deletedRecordIndexs.length) return;
60256
60340
  for (let index = 0; index < deletedRecordIndexs.length; index++) adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
60257
60341
  table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
60258
- } else if (table.sortState) table.dataSource.deleteRecordsForSorted(recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60259
- const deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs);
60342
+ } else if (table.sortState) {
60343
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.deleteRecords(recordIndexs, !0) : table.dataSource.deleteRecordsForSorted(recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
60344
+ } else {
60345
+ const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
60346
+ deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
60260
60347
  if (0 === deletedRecordIndexs.length) return;
60261
60348
  for (let index = 0; index < deletedRecordIndexs.length; index++) adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
60349
+ if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
60262
60350
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60263
60351
  table.refreshRowColCount();
60264
60352
  const newRowCount = table.transpose ? table.colCount : table.rowCount,
@@ -60296,7 +60384,7 @@
60296
60384
  col: 0,
60297
60385
  row: row
60298
60386
  });
60299
- null === (_e = table.reactCustomLayout) || void 0 === _e || _e.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_f = table.reactCustomLayout) || void 0 === _f || _f.updateAllCustomCell();
60387
+ null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell();
60300
60388
  }
60301
60389
  } else {
60302
60390
  const delRows = [],
@@ -60328,15 +60416,19 @@
60328
60416
  col: 0,
60329
60417
  row: row
60330
60418
  });
60331
- null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell();
60419
+ null === (_j = table.reactCustomLayout) || void 0 === _j || _j.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_k = table.reactCustomLayout) || void 0 === _k || _k.updateAllCustomCell();
60332
60420
  }
60333
60421
  }
60334
60422
  }
60335
60423
  function listTableUpdateRecords(records, recordIndexs, table) {
60336
- var _a, _b, _c, _d;
60337
- if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).updateRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).updateRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) table.dataSource.updateRecordsForSorted(records, recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else {
60338
- const updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs);
60424
+ var _a, _b, _c, _d, _e, _f;
60425
+ if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).updateRecordsForGroup) || void 0 === _b || _b.call(_a, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) null === (_d = (_c = table.dataSource).updateRecordsForTree) || void 0 === _d || _d.call(_c, records, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if (table.sortState) {
60426
+ !!(null === (_e = table.options) || void 0 === _e ? void 0 : _e.syncRecordOperationsToSourceRecords) ? table.dataSource.updateRecords(records, recordIndexs, !0) : table.dataSource.updateRecordsForSorted(records, recordIndexs), sortRecords(table), table.refreshRowColCount(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();
60427
+ } else {
60428
+ const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
60429
+ updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
60339
60430
  if (0 === updateRecordIndexs.length) return;
60431
+ if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
60340
60432
  const recordIndexsMinToMax = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index)).sort((a, b) => a - b);
60341
60433
  if (table.pagination) {
60342
60434
  const {