@visactor/vtable-sheet 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.
package/cjs/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import VTableSheet from './components/vtable-sheet';
2
2
  import type { ISheetDefine, IVTableSheetOptions } from './ts-types';
3
3
  import * as TYPES from './ts-types';
4
4
  import * as VTable from './vtable';
5
- export declare const version = "1.22.11-alpha.7";
5
+ export declare const version = "1.22.11-alpha.9";
6
6
  export { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };
package/cjs/index.js CHANGED
@@ -47,4 +47,4 @@ exports.VTable = VTable;
47
47
 
48
48
  const style_manager_1 = require("./styles/style-manager");
49
49
 
50
- exports.version = "1.22.11-alpha.7", (0, style_manager_1.importStyles)();
50
+ exports.version = "1.22.11-alpha.9", (0, style_manager_1.importStyles)();
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.22.11-alpha.7\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAAoD;AAW3C,sBAXF,sBAAW,CAWE;AATpB,kDAAoC;AASd,sBAAK;AAR3B,iDAAmC;AAQN,wBAAM;AAPnC,0DAAsD;AACzC,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,4BAAY,GAAE,CAAC","file":"index.js","sourcesContent":["import VTableSheet from './components/vtable-sheet';\nimport type { ISheetDefine, IVTableSheetOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport * as VTable from './vtable';\nimport { importStyles } from './styles/style-manager';\nexport const version = \"1.22.11-alpha.9\";\n// 导入样式\nimportStyles();\n/**\n * @namespace VTableSheet\n */\nexport { VTableSheet, TYPES, VTable, ISheetDefine, IVTableSheetOptions };\n"]}
@@ -41007,8 +41007,17 @@
41007
41007
  return null == index || index > length ? length : index < 0 ? 0 : index;
41008
41008
  }
41009
41009
  _mapViewInsertIndexToRawInsertIndex(rawRecords, viewIndex) {
41010
- if (viewIndex >= this.records.length) return rawRecords.length;
41011
- if (viewIndex <= 0) return 0;
41010
+ if (0 === this.records.length) return rawRecords.length;
41011
+ if (viewIndex <= 0) {
41012
+ const firstVisibleRecord = this.records[0],
41013
+ rawIndex = rawRecords.indexOf(firstVisibleRecord);
41014
+ return rawIndex >= 0 ? rawIndex : 0;
41015
+ }
41016
+ if (viewIndex >= this.records.length) {
41017
+ const lastVisibleRecord = this.records[this.records.length - 1],
41018
+ rawIndex = rawRecords.indexOf(lastVisibleRecord);
41019
+ return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
41020
+ }
41012
41021
  const prevRecord = this.records[viewIndex - 1],
41013
41022
  rawIndex = rawRecords.indexOf(prevRecord);
41014
41023
  return rawIndex >= 0 ? rawIndex + 1 : rawRecords.length;
@@ -41041,7 +41050,7 @@
41041
41050
  if (!rawRecords) return;
41042
41051
  const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
41043
41052
  rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
41044
- 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);
41053
+ 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);
41045
41054
  }
41046
41055
  addRecords(recordArr, index, syncToOriginalRecords = !1) {
41047
41056
  var _a, _b, _c;
@@ -41069,7 +41078,8 @@
41069
41078
  if (!rawRecords || !Array.isArray(recordArr) || 0 === recordArr.length) return;
41070
41079
  const viewInsertIndex = this._normalizeInsertIndex(index, this.records.length),
41071
41080
  rawInsertIndex = this._hasFilterInEffect() ? this._mapViewInsertIndexToRawInsertIndex(rawRecords, viewInsertIndex) : this._normalizeInsertIndex(viewInsertIndex, rawRecords.length);
41072
- 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);
41081
+ if (rawRecords.splice(rawInsertIndex, 0, ...recordArr), syncToOriginalRecords && this._hasFilterInEffect()) for (let i = 0; i < recordArr.length; i++) this.markForceVisibleRecord(recordArr[i]);
41082
+ 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);
41073
41083
  }
41074
41084
  addRecordForSorted(record) {
41075
41085
  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));
@@ -41236,23 +41246,30 @@
41236
41246
  setSortedIndexMap(field, filedMap) {
41237
41247
  this.sortedIndexMap.set(field, filedMap);
41238
41248
  }
41249
+ markForceVisibleRecord(record) {
41250
+ !record || "object" != typeof record && "function" != typeof record || (this._forceVisibleRecords || (this._forceVisibleRecords = new WeakSet()), this._forceVisibleRecords.add(record));
41251
+ }
41252
+ clearForceVisibleRecords() {
41253
+ this._forceVisibleRecords = void 0;
41254
+ }
41239
41255
  clearFilteredChildren(record) {
41240
41256
  var _a, _b;
41241
41257
  record.filteredChildren = void 0;
41242
41258
  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]);
41243
41259
  }
41244
41260
  filterRecord(record) {
41245
- var _a, _b, _c;
41261
+ var _a, _b, _c, _d;
41262
+ if (null === (_a = this._forceVisibleRecords) || void 0 === _a ? void 0 : _a.has(record)) return !0;
41246
41263
  let isReserved = !0;
41247
- for (let i = 0; i < (null === (_a = this.dataConfig.filterRules) || void 0 === _a ? void 0 : _a.length); i++) {
41248
- const filterRule = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.filterRules[i];
41264
+ for (let i = 0; i < (null === (_b = this.dataConfig.filterRules) || void 0 === _b ? void 0 : _b.length); i++) {
41265
+ const filterRule = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.filterRules[i];
41249
41266
  if (filterRule.filterKey) {
41250
41267
  const filterValue = record[filterRule.filterKey];
41251
41268
  if (-1 === filterRule.filteredValues.indexOf(filterValue)) {
41252
41269
  isReserved = !1;
41253
41270
  break;
41254
41271
  }
41255
- } else if (!(null === (_c = filterRule.filterFunc) || void 0 === _c ? void 0 : _c.call(filterRule, record))) {
41272
+ } else if (!(null === (_d = filterRule.filterFunc) || void 0 === _d ? void 0 : _d.call(filterRule, record))) {
41256
41273
  isReserved = !1;
41257
41274
  break;
41258
41275
  }
@@ -60140,7 +60157,7 @@
60140
60157
  }
60141
60158
  constructor(container, options = {}) {
60142
60159
  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;
60143
- 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$1.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");
60160
+ 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$1.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");
60144
60161
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
60145
60162
  options: options,
60146
60163
  container: container
@@ -65193,8 +65210,8 @@
65193
65210
  updateFilterRules(filterRules, options = {
65194
65211
  clearRowHeightCache: !0
65195
65212
  }) {
65196
- var _a;
65197
- 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();
65213
+ var _a, _b, _c;
65214
+ 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();
65198
65215
  }
65199
65216
  getFilteredRecords() {
65200
65217
  return this.dataSource.records;
@@ -91335,7 +91352,7 @@
91335
91352
  importStyle();
91336
91353
  }
91337
91354
 
91338
- const version = "1.22.11-alpha.7";
91355
+ const version = "1.22.11-alpha.9";
91339
91356
  importStyles();
91340
91357
 
91341
91358
  exports.TYPES = index;