@univerjs/core 0.3.0-alpha.1 → 0.3.0

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
@@ -2513,6 +2513,8 @@ let CommandService = (_a = class extends Disposable {
2513
2513
  }
2514
2514
  throw new Error(`[CommandService]: command "${id}" is not registered.`);
2515
2515
  } catch (error) {
2516
+ if (error instanceof CustomCommandExecutionError)
2517
+ return !1;
2516
2518
  throw this._logService.error(error), error;
2517
2519
  }
2518
2520
  }
@@ -11117,7 +11119,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11117
11119
  };
11118
11120
  __name(_ErrorService, "ErrorService");
11119
11121
  let ErrorService = _ErrorService;
11120
- const version = "0.3.0-alpha.1";
11122
+ const version = "0.3.0";
11121
11123
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11122
11124
  return {
11123
11125
  id: unitID,
@@ -11480,6 +11482,14 @@ const _SpanModel = class _SpanModel extends Disposable {
11480
11482
  * @property Cache for RANGE_TYPE.COLUMN
11481
11483
  */
11482
11484
  __publicField(this, "_columnCache", /* @__PURE__ */ new Map());
11485
+ /**
11486
+ * @property Whether has RANGE_TYPE.ROW
11487
+ */
11488
+ __publicField(this, "_hasRow", !1);
11489
+ /**
11490
+ * @property Whether has RANGE_TYPE.COLUMN
11491
+ */
11492
+ __publicField(this, "_hasColumn", !1);
11483
11493
  /**
11484
11494
  * @property Whether has RANGE_TYPE.ALL
11485
11495
  */
@@ -11500,7 +11510,7 @@ const _SpanModel = class _SpanModel extends Disposable {
11500
11510
  this._mergeData = mergeData, this._createCache(mergeData);
11501
11511
  }
11502
11512
  _clearCache() {
11503
- this._cellCache.clear(), this._rowCache.clear(), this._columnCache.clear(), this._hasAll = !1, this._allIndex = -1, this._rangeMap.clear(), this._skeletonCache.clear();
11513
+ this._cellCache.clear(), this._rowCache.clear(), this._columnCache.clear(), this._hasAll = !1, this._allIndex = -1, this._rangeMap.clear(), this._skeletonCache.clear(), this._hasColumn = !1, this._hasRow = !1;
11504
11514
  }
11505
11515
  _createCache(mergeData) {
11506
11516
  let index2 = 0;
@@ -11519,12 +11529,12 @@ const _SpanModel = class _SpanModel extends Disposable {
11519
11529
  _createRowCache(range, index2) {
11520
11530
  const { startRow, endRow } = range;
11521
11531
  for (let i = startRow; i <= endRow; i++)
11522
- this._rowCache.set(i, index2);
11532
+ this._rowCache.set(i, index2), this._hasRow = !0;
11523
11533
  }
11524
11534
  _createColumnCache(range, index2) {
11525
11535
  const { startColumn, endColumn } = range;
11526
11536
  for (let i = startColumn; i <= endColumn; i++)
11527
- this._columnCache.set(i, index2);
11537
+ this._columnCache.set(i, index2), this._hasColumn = !0;
11528
11538
  }
11529
11539
  _createCellAllCache(index2) {
11530
11540
  this._hasAll = !0, this._allIndex = index2;
@@ -11628,12 +11638,16 @@ const _SpanModel = class _SpanModel extends Disposable {
11628
11638
  var _a13;
11629
11639
  if (this._hasAll)
11630
11640
  return this._allIndex;
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;
11641
+ if (this._hasRow) {
11642
+ const rowValue = this._rowCache.get(row);
11643
+ if (rowValue !== void 0)
11644
+ return rowValue;
11645
+ }
11646
+ if (this._hasColumn) {
11647
+ const columnValue = this._columnCache.get(column);
11648
+ if (columnValue !== void 0)
11649
+ return columnValue;
11650
+ }
11637
11651
  const cellValue = (_a13 = this._cellCache.get(row)) == null ? void 0 : _a13.get(column);
11638
11652
  return cellValue !== void 0 ? cellValue : -1;
11639
11653
  }
@@ -1,5 +1,5 @@
1
- import { IRange } from './typedef';
2
1
  import { Disposable } from '../shared/lifecycle';
2
+ import { IRange } from './typedef';
3
3
  export declare class SpanModel extends Disposable {
4
4
  /**
5
5
  * @property Cache for RANGE_TYPE.NORMAL
@@ -13,6 +13,14 @@ export declare class SpanModel extends Disposable {
13
13
  * @property Cache for RANGE_TYPE.COLUMN
14
14
  */
15
15
  private _columnCache;
16
+ /**
17
+ * @property Whether has RANGE_TYPE.ROW
18
+ */
19
+ private _hasRow;
20
+ /**
21
+ * @property Whether has RANGE_TYPE.COLUMN
22
+ */
23
+ private _hasColumn;
16
24
  /**
17
25
  * @property Whether has RANGE_TYPE.ALL
18
26
  */