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

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.
@@ -37044,8 +37044,17 @@
37044
37044
  return null == index || index > length ? length : index < 0 ? 0 : index;
37045
37045
  }
37046
37046
  _mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
37047
- if (viewIndex >= this.records.length) return rawRecords.length;
37048
- if (viewIndex <= 0) return 0;
37047
+ if (0 === this.records.length) return rawRecords.length;
37048
+ if (viewIndex <= 0) {
37049
+ const firstVisibleRecord = this.records[0],
37050
+ rawIndex = rawRecords.indexOf(firstVisibleRecord);
37051
+ return rawIndex >= 0 ? rawIndex : 0;
37052
+ }
37053
+ if (viewIndex >= this.records.length) {
37054
+ const lastVisibleRecord = this.records[this.records.length - 1],
37055
+ rawIndex = rawRecords.indexOf(lastVisibleRecord);
37056
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
37057
+ }
37049
37058
  const prevRecord = this.records[viewIndex - 1],
37050
37059
  rawIndex = rawRecords.indexOf(prevRecord);
37051
37060
  return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
@@ -37078,7 +37087,7 @@
37078
37087
  if (!rawRecords) return;
37079
37088
  const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
37080
37089
  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);
37090
+ rawRecords.splice(rawInsertIndex, 0, record), syncToOriginalRecords && this._hasFilterInEffect() && this.markForceVisibleRecord(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);
37082
37091
  }
37083
37092
  addRecords(recordArr, index, syncToOriginalRecords = !1) {
37084
37093
  var _a, _b, _c;
@@ -37106,7 +37115,8 @@
37106
37115
  if (!rawRecords || !Array.isArray(recordArr) || 0 === recordArr.length) return;
37107
37116
  const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
37108
37117
  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);
37118
+ if (rawRecords.splice(rawInsertIndex, 0, ...recordArr), syncToOriginalRecords && this._hasFilterInEffect()) for (let i = 0; i < recordArr.length; i++) this.markForceVisibleRecord(recordArr[i]);
37119
+ 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);
37110
37120
  }
37111
37121
  addRecordForSorted(record) {
37112
37122
  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));
@@ -37273,23 +37283,30 @@
37273
37283
  setSortedIndexMap(field, filedMap) {
37274
37284
  this.sortedIndexMap.set(field, filedMap);
37275
37285
  }
37286
+ markForceVisibleRecord(record) {
37287
+ !record || "object" != typeof record && "function" != typeof record || (this._forceVisibleRecords || (this._forceVisibleRecords = new WeakSet()), this._forceVisibleRecords.add(record));
37288
+ }
37289
+ clearForceVisibleRecords() {
37290
+ this._forceVisibleRecords = void 0;
37291
+ }
37276
37292
  clearFilteredChildren(record) {
37277
37293
  var _a, _b;
37278
37294
  record.filteredChildren = void 0;
37279
37295
  for (let i = 0; i < (null !== (_b = null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0); i++) this.clearFilteredChildren(record.children[i]);
37280
37296
  }
37281
37297
  filterRecord(record) {
37282
- var _a, _b, _c;
37298
+ var _a, _b, _c, _d;
37299
+ if (null === (_a = this._forceVisibleRecords) || void 0 === _a ? void 0 : _a.has(record)) return !0;
37283
37300
  let isReserved = !0;
37284
- for (let i = 0; i < (null === (_a = this.dataConfig.filterRules) || void 0 === _a ? void 0 : _a.length); i++) {
37285
- const filterRule = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules[i];
37301
+ for (let i = 0; i < (null === (_b = this.dataConfig.filterRules) || void 0 === _b ? void 0 : _b.length); i++) {
37302
+ const filterRule = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.filterRules[i];
37286
37303
  if (filterRule.filterKey) {
37287
37304
  const filterValue = record[filterRule.filterKey];
37288
37305
  if (-1 === filterRule.filteredValues.indexOf(filterValue)) {
37289
37306
  isReserved = !1;
37290
37307
  break;
37291
37308
  }
37292
- } else if (!(null === (_c = filterRule.filterFunc) || void 0 === _c ? void 0 : _c.call(filterRule, record))) {
37309
+ } else if (!(null === (_d = filterRule.filterFunc) || void 0 === _d ? void 0 : _d.call(filterRule, record))) {
37293
37310
  isReserved = !1;
37294
37311
  break;
37295
37312
  }
@@ -56177,7 +56194,7 @@
56177
56194
  }
56178
56195
  constructor(container, options = {}) {
56179
56196
  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;
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");
56197
+ if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.9", 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");
56181
56198
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56182
56199
  options: options,
56183
56200
  container: container
@@ -61194,8 +61211,8 @@
61194
61211
  updateFilterRules(filterRules, options = {
61195
61212
  clearRowHeightCache: !0
61196
61213
  }) {
61197
- var _a;
61198
- this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), this.resize();
61214
+ var _a, _b, _c;
61215
+ this.scenegraph.clearCells(), null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
61199
61216
  }
61200
61217
  getFilteredRecords() {
61201
61218
  return this.dataSource.records;