@univerjs/core 0.3.0-alpha.0 → 0.3.0-alpha.1

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/lib/es/index.js CHANGED
@@ -11117,7 +11117,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11117
11117
  };
11118
11118
  __name(_ErrorService, "ErrorService");
11119
11119
  let ErrorService = _ErrorService;
11120
- const version = "0.3.0-alpha.0";
11120
+ const version = "0.3.0-alpha.1";
11121
11121
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11122
11122
  return {
11123
11123
  id: unitID,
@@ -11471,15 +11471,15 @@ const _SpanModel = class _SpanModel extends Disposable {
11471
11471
  /**
11472
11472
  * @property Cache for RANGE_TYPE.NORMAL
11473
11473
  */
11474
- __publicField(this, "_cellCache", {});
11474
+ __publicField(this, "_cellCache", /* @__PURE__ */ new Map());
11475
11475
  /**
11476
11476
  * @property Cache for RANGE_TYPE.ROW
11477
11477
  */
11478
- __publicField(this, "_rowCache", {});
11478
+ __publicField(this, "_rowCache", /* @__PURE__ */ new Map());
11479
11479
  /**
11480
11480
  * @property Cache for RANGE_TYPE.COLUMN
11481
11481
  */
11482
- __publicField(this, "_columnCache", {});
11482
+ __publicField(this, "_columnCache", /* @__PURE__ */ new Map());
11483
11483
  /**
11484
11484
  * @property Whether has RANGE_TYPE.ALL
11485
11485
  */
@@ -11500,7 +11500,7 @@ const _SpanModel = class _SpanModel extends Disposable {
11500
11500
  this._mergeData = mergeData, this._createCache(mergeData);
11501
11501
  }
11502
11502
  _clearCache() {
11503
- this._cellCache = {}, this._rowCache = {}, this._columnCache = {}, this._hasAll = !1, this._allIndex = -1, this._rangeMap.clear(), this._skeletonCache.clear();
11503
+ this._cellCache.clear(), this._rowCache.clear(), this._columnCache.clear(), this._hasAll = !1, this._allIndex = -1, this._rangeMap.clear(), this._skeletonCache.clear();
11504
11504
  }
11505
11505
  _createCache(mergeData) {
11506
11506
  let index2 = 0;
@@ -11518,25 +11518,24 @@ const _SpanModel = class _SpanModel extends Disposable {
11518
11518
  }
11519
11519
  _createRowCache(range, index2) {
11520
11520
  const { startRow, endRow } = range;
11521
- for (let i = startRow; i <= endRow; i++) {
11522
- const key = `${i}`;
11523
- this._rowCache[key] = index2;
11524
- }
11521
+ for (let i = startRow; i <= endRow; i++)
11522
+ this._rowCache.set(i, index2);
11525
11523
  }
11526
11524
  _createColumnCache(range, index2) {
11527
11525
  const { startColumn, endColumn } = range;
11528
- for (let i = startColumn; i <= endColumn; i++) {
11529
- const key = `${i}`;
11530
- this._columnCache[key] = index2;
11531
- }
11526
+ for (let i = startColumn; i <= endColumn; i++)
11527
+ this._columnCache.set(i, index2);
11532
11528
  }
11533
11529
  _createCellAllCache(index2) {
11534
11530
  this._hasAll = !0, this._allIndex = index2;
11535
11531
  }
11536
11532
  _createCellCache(range, index2) {
11537
- for (let i = range.startRow; i <= range.endRow; i++)
11533
+ for (let i = range.startRow; i <= range.endRow; i++) {
11534
+ let columnCache = this._cellCache.get(i);
11535
+ columnCache == null && (columnCache = /* @__PURE__ */ new Map(), this._cellCache.set(i, columnCache));
11538
11536
  for (let j = range.startColumn; j <= range.endColumn; j++)
11539
- this._cellCache[`${i}-${j}`] = index2;
11537
+ columnCache.set(j, index2);
11538
+ }
11540
11539
  }
11541
11540
  add(range) {
11542
11541
  this._mergeData.push(range), this._clearCache(), this._createCache(this._mergeData);
@@ -11626,15 +11625,17 @@ const _SpanModel = class _SpanModel extends Disposable {
11626
11625
  return ranges;
11627
11626
  }
11628
11627
  _getMergeDataIndex(row, column) {
11628
+ var _a13;
11629
11629
  if (this._hasAll)
11630
11630
  return this._allIndex;
11631
- const rowKey = `${row}`, columnKey = `${column}`;
11632
- if (this._rowCache[rowKey] !== void 0)
11633
- return this._rowCache[rowKey];
11634
- if (this._columnCache[columnKey] !== void 0)
11635
- return this._columnCache[columnKey];
11636
- const key = `${row}-${column}`;
11637
- return this._cellCache[key] !== void 0 ? this._cellCache[key] : -1;
11631
+ const rowValue = this._rowCache.get(row);
11632
+ if (rowValue !== void 0)
11633
+ return rowValue;
11634
+ const columnValue = this._columnCache.get(column);
11635
+ if (columnValue !== void 0)
11636
+ return columnValue;
11637
+ const cellValue = (_a13 = this._cellCache.get(row)) == null ? void 0 : _a13.get(column);
11638
+ return cellValue !== void 0 ? cellValue : -1;
11638
11639
  }
11639
11640
  getMergeDataSnapshot() {
11640
11641
  return this._mergeData;
@@ -1,5 +1,5 @@
1
- import { Disposable } from '../shared/lifecycle';
2
1
  import { IRange } from './typedef';
2
+ import { Disposable } from '../shared/lifecycle';
3
3
  export declare class SpanModel extends Disposable {
4
4
  /**
5
5
  * @property Cache for RANGE_TYPE.NORMAL