@univerjs/core 0.4.0 → 0.4.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
@@ -4611,8 +4611,9 @@ function deleteContent(content, start, end) {
4611
4611
  return start > end ? content : content.slice(0, start) + content.slice(end);
4612
4612
  }
4613
4613
  __name(deleteContent, "deleteContent");
4614
+ const $blank = /\s/g;
4614
4615
  function isRealNum(val) {
4615
- return val === null || val.toString().replace(/\s/g, "") === "" || typeof val == "boolean" ? !1 : !isNaN(val);
4616
+ return val === null || val.toString().replace($blank, "") === "" || typeof val == "boolean" ? !1 : !isNaN(val);
4616
4617
  }
4617
4618
  __name(isRealNum, "isRealNum");
4618
4619
  function hashAlgorithm(str) {
@@ -6626,6 +6627,8 @@ __name(_Range, "Range"), __publicField(_Range, "transformRange", /* @__PURE__ */
6626
6627
  }, "transformRange"));
6627
6628
  let Range = _Range;
6628
6629
  function moveRangeByOffset(range, refOffsetX, refOffsetY, ignoreAbsolute = !1) {
6630
+ if (refOffsetX === 0 && refOffsetY === 0)
6631
+ return range;
6629
6632
  let newRange = { ...range };
6630
6633
  const startAbsoluteRefType = newRange.startAbsoluteRefType || AbsoluteRefType.NONE, endAbsoluteRefType = newRange.endAbsoluteRefType || AbsoluteRefType.NONE;
6631
6634
  return !ignoreAbsolute && startAbsoluteRefType === AbsoluteRefType.ALL && endAbsoluteRefType === AbsoluteRefType.ALL ? newRange : ignoreAbsolute || startAbsoluteRefType === AbsoluteRefType.NONE && endAbsoluteRefType === AbsoluteRefType.NONE ? Rectangle.moveOffset(newRange, refOffsetX, refOffsetY) : (startAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, startRow: newRange.startRow + refOffsetY, startColumn: newRange.startColumn + refOffsetX } : startAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, startRow: newRange.startRow + refOffsetY } : startAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, startColumn: newRange.startColumn + refOffsetX }), endAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, endRow: newRange.endRow + refOffsetY, endColumn: newRange.endColumn + refOffsetX } : endAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, endRow: newRange.endRow + refOffsetY } : endAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, endColumn: newRange.endColumn + refOffsetX }), newRange);
@@ -11390,7 +11393,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11390
11393
  };
11391
11394
  __name(_ErrorService, "ErrorService");
11392
11395
  let ErrorService = _ErrorService;
11393
- const version = "0.4.0";
11396
+ const version = "0.4.1";
11394
11397
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11395
11398
  return {
11396
11399
  id: unitID,
@@ -14031,35 +14034,19 @@ const _RTree = class _RTree {
14031
14034
  search(search) {
14032
14035
  var _a11;
14033
14036
  const { unitId, sheetId: subUnitId, range } = search, tree = (_a11 = this._tree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
14034
- if (!tree)
14035
- return /* @__PURE__ */ new Map();
14036
- const result = /* @__PURE__ */ new Map();
14037
- return tree.search({
14037
+ return tree ? tree.search({
14038
14038
  minX: range.startColumn,
14039
14039
  minY: range.startRow,
14040
14040
  maxX: range.endColumn,
14041
14041
  maxY: range.endRow
14042
- }).forEach((item) => {
14043
- result.set(item.id, {
14044
- unitId,
14045
- sheetId: subUnitId,
14046
- id: item.id,
14047
- range: {
14048
- startColumn: item.minX,
14049
- startRow: item.minY,
14050
- endColumn: item.maxX,
14051
- endRow: item.maxY
14052
- }
14053
- });
14054
- }), result;
14042
+ }) : [];
14055
14043
  }
14056
14044
  bulkSearch(searchList) {
14057
14045
  const result = /* @__PURE__ */ new Map();
14058
14046
  for (const search of searchList) {
14059
14047
  const items = this.search(search);
14060
- items.forEach((value, key) => {
14061
- result.set(key, value);
14062
- }), items.clear();
14048
+ for (const item of items)
14049
+ result.set(item.id, item);
14063
14050
  }
14064
14051
  return result;
14065
14052
  }
@@ -13,9 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /**
17
- * Determine whether it is a pure number, "12" and "12e+3" are both true
18
- * @param val The number or string to be judged
19
- * @returns Result
20
- */
21
16
  export declare function isRealNum(val: string | number | boolean): boolean;
@@ -17,7 +17,7 @@ export declare class RTree {
17
17
  getTree(unitId: string, subUnitId: string): RBush<IRBushItem>;
18
18
  insert(item: IRTreeItem): void;
19
19
  bulkInsert(items: IRTreeItem[]): void;
20
- search(search: IUnitRange): Map<string, IRTreeItem>;
20
+ search(search: IUnitRange): IRTreeItem[];
21
21
  bulkSearch(searchList: IUnitRange[]): Map<string, IRTreeItem>;
22
22
  removeById(unitId: string, subUnitId?: string): void;
23
23
  remove(search: IRTreeItem): void;