@univerjs/core 1.0.0-alpha.6 → 1.0.0-alpha.8
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/cjs/facade.js +6 -138
- package/lib/cjs/index.js +379 -510
- package/lib/es/facade.js +8 -134
- package/lib/es/index.js +372 -508
- package/lib/facade.js +8 -134
- package/lib/index.js +372 -508
- package/lib/types/bases/index.d.ts +1 -1
- package/lib/types/bases/typedef.d.ts +31 -0
- package/lib/types/docs/data-model/paragraph-style.d.ts +7 -1
- package/lib/types/docs/data-model/rich-text-builder.d.ts +11 -1
- package/lib/types/docs/data-model/text-x/build-utils/data-stream-change.d.ts +3 -3
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/utils.d.ts +1 -0
- package/lib/types/docs/data-model/types.d.ts +0 -2
- package/lib/types/facade/f-univer.d.ts +1 -22
- package/lib/types/facade/index.d.ts +0 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/context/context.d.ts +1 -2
- package/lib/types/services/instance/instance.service.d.ts +0 -8
- package/lib/types/services/region/region.service.d.ts +28 -0
- package/lib/types/shared/common.d.ts +0 -5
- package/lib/types/shared/object-matrix.d.ts +0 -14
- package/lib/types/shared/rectangle.d.ts +0 -15
- package/lib/types/shared/tools.d.ts +0 -2
- package/lib/types/sheets/sheet-skeleton.d.ts +2 -6
- package/lib/types/sheets/typedef.d.ts +0 -14
- package/lib/types/sheets/workbook.d.ts +0 -2
- package/lib/types/sheets/worksheet.d.ts +0 -6
- package/lib/types/types/const/page-size.d.ts +2 -0
- package/lib/types/types/enum/theme-color-type.d.ts +0 -4
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +0 -2
- package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +2 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +93 -12
- package/lib/types/types/interfaces/i-style-data.d.ts +43 -0
- package/lib/types/univer.d.ts +5 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +21 -21
- package/package.json +4 -4
- package/lib/types/facade/f-hooks.d.ts +0 -74
package/lib/cjs/index.js
CHANGED
|
@@ -152,7 +152,7 @@ function installShims() {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
//#endregion
|
|
155
|
-
//#region \0@oxc-project+runtime@0.
|
|
155
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
156
156
|
function _typeof(o) {
|
|
157
157
|
"@babel/helpers - typeof";
|
|
158
158
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -163,7 +163,7 @@ function _typeof(o) {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
//#endregion
|
|
166
|
-
//#region \0@oxc-project+runtime@0.
|
|
166
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
167
167
|
function toPrimitive(t, r) {
|
|
168
168
|
if ("object" != _typeof(t) || !t) return t;
|
|
169
169
|
var e = t[Symbol.toPrimitive];
|
|
@@ -176,14 +176,14 @@ function toPrimitive(t, r) {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
//#endregion
|
|
179
|
-
//#region \0@oxc-project+runtime@0.
|
|
179
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
180
180
|
function toPropertyKey(t) {
|
|
181
181
|
var i = toPrimitive(t, "string");
|
|
182
182
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
//#endregion
|
|
186
|
-
//#region \0@oxc-project+runtime@0.
|
|
186
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
187
187
|
function _defineProperty(e, r, t) {
|
|
188
188
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
189
189
|
value: t,
|
|
@@ -712,76 +712,6 @@ var Tools = class Tools {
|
|
|
712
712
|
if (isIE11) return "IE11";
|
|
713
713
|
return "Unknown browser";
|
|
714
714
|
}
|
|
715
|
-
/** @deprecated This method is deprecated, please use `import { merge } from '@univerjs/core` instead */
|
|
716
|
-
static deepMerge(target, ...sources) {
|
|
717
|
-
sources.forEach((item) => item && deepItem(item));
|
|
718
|
-
function isDangerousKey(key) {
|
|
719
|
-
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
720
|
-
}
|
|
721
|
-
function deepArray(array, to) {
|
|
722
|
-
array.forEach((value, key) => {
|
|
723
|
-
if (typeof key === "string" && isDangerousKey(key)) return;
|
|
724
|
-
if (Tools.isArray(value)) {
|
|
725
|
-
var _to$key;
|
|
726
|
-
const origin = (_to$key = to[key]) !== null && _to$key !== void 0 ? _to$key : [];
|
|
727
|
-
to[key] = origin;
|
|
728
|
-
deepArray(value, origin);
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
if (Tools.isObject(value)) {
|
|
732
|
-
var _to$key2;
|
|
733
|
-
const origin = (_to$key2 = to[key]) !== null && _to$key2 !== void 0 ? _to$key2 : {};
|
|
734
|
-
to[key] = origin;
|
|
735
|
-
deepObject(value, origin);
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
to[key] = value;
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
function deepObject(object, to) {
|
|
742
|
-
Object.keys(object).forEach((key) => {
|
|
743
|
-
if (isDangerousKey(key)) return;
|
|
744
|
-
const value = object[key];
|
|
745
|
-
if (Tools.isObject(value)) {
|
|
746
|
-
var _to$key3;
|
|
747
|
-
const origin = (_to$key3 = to[key]) !== null && _to$key3 !== void 0 ? _to$key3 : {};
|
|
748
|
-
to[key] = origin;
|
|
749
|
-
deepObject(value, origin);
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
if (Tools.isArray(value)) {
|
|
753
|
-
var _to$key4;
|
|
754
|
-
const origin = (_to$key4 = to[key]) !== null && _to$key4 !== void 0 ? _to$key4 : [];
|
|
755
|
-
to[key] = origin;
|
|
756
|
-
deepArray(value, origin);
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
to[key] = value;
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
function deepItem(item) {
|
|
763
|
-
Object.keys(item).forEach((key) => {
|
|
764
|
-
if (isDangerousKey(key)) return;
|
|
765
|
-
const value = item[key];
|
|
766
|
-
if (Tools.isArray(value)) {
|
|
767
|
-
var _target$key;
|
|
768
|
-
const origin = (_target$key = target[key]) !== null && _target$key !== void 0 ? _target$key : [];
|
|
769
|
-
target[key] = origin;
|
|
770
|
-
deepArray(value, origin);
|
|
771
|
-
return;
|
|
772
|
-
}
|
|
773
|
-
if (Tools.isObject(value)) {
|
|
774
|
-
var _target$key2;
|
|
775
|
-
const origin = (_target$key2 = target[key]) !== null && _target$key2 !== void 0 ? _target$key2 : {};
|
|
776
|
-
target[key] = origin;
|
|
777
|
-
deepObject(value, origin);
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
target[key] = value;
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
return target;
|
|
784
|
-
}
|
|
785
715
|
static diffValue(one, two) {
|
|
786
716
|
return isValueEqual(one, two);
|
|
787
717
|
}
|
|
@@ -1681,8 +1611,6 @@ let CellValueType = /* @__PURE__ */ function(CellValueType) {
|
|
|
1681
1611
|
*/
|
|
1682
1612
|
/**
|
|
1683
1613
|
* Theme color type enum
|
|
1684
|
-
*
|
|
1685
|
-
* @deprecated
|
|
1686
1614
|
*/
|
|
1687
1615
|
let ThemeColorType = /* @__PURE__ */ function(ThemeColorType) {
|
|
1688
1616
|
/**
|
|
@@ -1710,8 +1638,6 @@ let ThemeColorType = /* @__PURE__ */ function(ThemeColorType) {
|
|
|
1710
1638
|
}({});
|
|
1711
1639
|
/**
|
|
1712
1640
|
* Preset theme names.
|
|
1713
|
-
*
|
|
1714
|
-
* @deprecated
|
|
1715
1641
|
*/
|
|
1716
1642
|
let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
|
|
1717
1643
|
ThemeColors["OFFICE"] = "Office";
|
|
@@ -1743,7 +1669,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
|
|
|
1743
1669
|
//#endregion
|
|
1744
1670
|
//#region package.json
|
|
1745
1671
|
var name = "@univerjs/core";
|
|
1746
|
-
var version = "1.0.0-alpha.
|
|
1672
|
+
var version = "1.0.0-alpha.8";
|
|
1747
1673
|
|
|
1748
1674
|
//#endregion
|
|
1749
1675
|
//#region src/common/array.ts
|
|
@@ -2091,7 +2017,7 @@ function hashLogContent(...args) {
|
|
|
2091
2017
|
}
|
|
2092
2018
|
|
|
2093
2019
|
//#endregion
|
|
2094
|
-
//#region \0@oxc-project+runtime@0.
|
|
2020
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
2095
2021
|
function __decorateParam(paramIndex, decorator) {
|
|
2096
2022
|
return function(target, key) {
|
|
2097
2023
|
decorator(target, key, paramIndex);
|
|
@@ -2099,7 +2025,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
2099
2025
|
}
|
|
2100
2026
|
|
|
2101
2027
|
//#endregion
|
|
2102
|
-
//#region \0@oxc-project+runtime@0.
|
|
2028
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
2103
2029
|
function __decorate(decorators, target, key, desc) {
|
|
2104
2030
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2105
2031
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2460,17 +2386,7 @@ function fromCallback(callback) {
|
|
|
2460
2386
|
*/
|
|
2461
2387
|
function takeAfter(callback) {
|
|
2462
2388
|
return function complateAfter(source) {
|
|
2463
|
-
return
|
|
2464
|
-
source.subscribe({
|
|
2465
|
-
next: (v) => {
|
|
2466
|
-
subscriber.next(v);
|
|
2467
|
-
if (callback(v)) subscriber.complete();
|
|
2468
|
-
},
|
|
2469
|
-
complete: () => subscriber.complete(),
|
|
2470
|
-
error: (error) => subscriber.error(error)
|
|
2471
|
-
});
|
|
2472
|
-
return () => subscriber.unsubscribe();
|
|
2473
|
-
});
|
|
2389
|
+
return source.pipe((0, rxjs.takeWhile)((value) => !callback(value), true));
|
|
2474
2390
|
};
|
|
2475
2391
|
}
|
|
2476
2392
|
function bufferDebounceTime(time = 0) {
|
|
@@ -3412,12 +3328,13 @@ var ColorKit = class ColorKit {
|
|
|
3412
3328
|
const rgb2 = new ColorKit(color2).toRgb();
|
|
3413
3329
|
const alpha1 = (_rgb1$a = rgb1.a) !== null && _rgb1$a !== void 0 ? _rgb1$a : 1;
|
|
3414
3330
|
const alpha2 = (_rgb2$a = rgb2.a) !== null && _rgb2$a !== void 0 ? _rgb2$a : 1;
|
|
3415
|
-
|
|
3331
|
+
const rgba = {
|
|
3416
3332
|
r: (rgb2.r - rgb1.r) * amount + rgb1.r,
|
|
3417
3333
|
g: (rgb2.g - rgb1.g) * amount + rgb1.g,
|
|
3418
3334
|
b: (rgb2.b - rgb1.b) * amount + rgb1.b,
|
|
3419
3335
|
a: (alpha2 - alpha1) * amount + alpha1
|
|
3420
|
-
}
|
|
3336
|
+
};
|
|
3337
|
+
return new ColorKit(rgba);
|
|
3421
3338
|
}
|
|
3422
3339
|
static getContrastRatio(foreground, background) {
|
|
3423
3340
|
const lumA = new ColorKit(foreground).getLuminance();
|
|
@@ -3913,57 +3830,6 @@ let DOC_RANGE_TYPE = /* @__PURE__ */ function(DOC_RANGE_TYPE) {
|
|
|
3913
3830
|
DOC_RANGE_TYPE["TEXT"] = "TEXT";
|
|
3914
3831
|
return DOC_RANGE_TYPE;
|
|
3915
3832
|
}({});
|
|
3916
|
-
/**
|
|
3917
|
-
* Determines whether the cell(row, column) is within the range of the merged cells.
|
|
3918
|
-
* @deprecated please use worksheet.getCellInfoInMergeData instead
|
|
3919
|
-
*/
|
|
3920
|
-
function getCellInfoInMergeData(row, column, mergeData) {
|
|
3921
|
-
let isMerged = false;
|
|
3922
|
-
let isMergedMainCell = false;
|
|
3923
|
-
let newEndRow = row;
|
|
3924
|
-
let newEndColumn = column;
|
|
3925
|
-
let mergeRow = row;
|
|
3926
|
-
let mergeColumn = column;
|
|
3927
|
-
if (mergeData == null) return {
|
|
3928
|
-
actualRow: row,
|
|
3929
|
-
actualColumn: column,
|
|
3930
|
-
isMergedMainCell,
|
|
3931
|
-
isMerged,
|
|
3932
|
-
endRow: newEndRow,
|
|
3933
|
-
endColumn: newEndColumn,
|
|
3934
|
-
startRow: mergeRow,
|
|
3935
|
-
startColumn: mergeColumn
|
|
3936
|
-
};
|
|
3937
|
-
for (let i = 0; i < mergeData.length; i++) {
|
|
3938
|
-
const { startRow: startRowMarge, endRow: endRowMarge, startColumn: startColumnMarge, endColumn: endColumnMarge } = mergeData[i];
|
|
3939
|
-
if (row === startRowMarge && column === startColumnMarge) {
|
|
3940
|
-
newEndRow = endRowMarge;
|
|
3941
|
-
newEndColumn = endColumnMarge;
|
|
3942
|
-
mergeRow = startRowMarge;
|
|
3943
|
-
mergeColumn = startColumnMarge;
|
|
3944
|
-
isMergedMainCell = true;
|
|
3945
|
-
break;
|
|
3946
|
-
}
|
|
3947
|
-
if (row >= startRowMarge && row <= endRowMarge && column >= startColumnMarge && column <= endColumnMarge) {
|
|
3948
|
-
newEndRow = endRowMarge;
|
|
3949
|
-
newEndColumn = endColumnMarge;
|
|
3950
|
-
mergeRow = startRowMarge;
|
|
3951
|
-
mergeColumn = startColumnMarge;
|
|
3952
|
-
isMerged = true;
|
|
3953
|
-
break;
|
|
3954
|
-
}
|
|
3955
|
-
}
|
|
3956
|
-
return {
|
|
3957
|
-
actualRow: row,
|
|
3958
|
-
actualColumn: column,
|
|
3959
|
-
isMergedMainCell,
|
|
3960
|
-
isMerged,
|
|
3961
|
-
endRow: newEndRow,
|
|
3962
|
-
endColumn: newEndColumn,
|
|
3963
|
-
startRow: mergeRow,
|
|
3964
|
-
startColumn: mergeColumn
|
|
3965
|
-
};
|
|
3966
|
-
}
|
|
3967
3833
|
let CellModeEnum = /* @__PURE__ */ function(CellModeEnum) {
|
|
3968
3834
|
CellModeEnum["Raw"] = "raw";
|
|
3969
3835
|
CellModeEnum["Intercepted"] = "intercepted";
|
|
@@ -8051,24 +7917,15 @@ var ObjectMatrix = class ObjectMatrix {
|
|
|
8051
7917
|
const objectArray = this.getRowOrCreate(row);
|
|
8052
7918
|
objectArray[column] = value;
|
|
8053
7919
|
}
|
|
8054
|
-
|
|
8055
|
-
* !!
|
|
8056
|
-
* Please +1 ‘!’, who fell into this pit.
|
|
8057
|
-
* @deprecated use `realDelete` or `splice`
|
|
8058
|
-
*/
|
|
8059
|
-
deleteValue(row, column) {
|
|
7920
|
+
realDeleteValue(row, column) {
|
|
8060
7921
|
var _this$_matrix2;
|
|
8061
7922
|
(_this$_matrix2 = this._matrix) === null || _this$_matrix2 === void 0 || (_this$_matrix2 = _this$_matrix2[row]) === null || _this$_matrix2 === void 0 || delete _this$_matrix2[column];
|
|
8062
|
-
}
|
|
8063
|
-
realDeleteValue(row, column) {
|
|
8064
|
-
var _this$_matrix3;
|
|
8065
|
-
(_this$_matrix3 = this._matrix) === null || _this$_matrix3 === void 0 || (_this$_matrix3 = _this$_matrix3[row]) === null || _this$_matrix3 === void 0 || delete _this$_matrix3[column];
|
|
8066
7923
|
if (this.getRow(row)) {
|
|
8067
7924
|
const objectArray = this.getRow(row);
|
|
8068
7925
|
if (objectArray == null) return;
|
|
8069
7926
|
if (Object.keys(objectArray).length === 0) {
|
|
8070
|
-
var _this$
|
|
8071
|
-
(_this$
|
|
7927
|
+
var _this$_matrix3;
|
|
7928
|
+
(_this$_matrix3 = this._matrix) === null || _this$_matrix3 === void 0 || delete _this$_matrix3[row];
|
|
8072
7929
|
}
|
|
8073
7930
|
}
|
|
8074
7931
|
}
|
|
@@ -8267,23 +8124,10 @@ var ObjectMatrix = class ObjectMatrix {
|
|
|
8267
8124
|
});
|
|
8268
8125
|
return array;
|
|
8269
8126
|
}
|
|
8270
|
-
/**
|
|
8271
|
-
* @deprecated Use getMatrix as a substitute.
|
|
8272
|
-
*/
|
|
8273
|
-
toJSON() {
|
|
8274
|
-
return this._matrix;
|
|
8275
|
-
}
|
|
8276
8127
|
clone() {
|
|
8277
8128
|
const json = JSON.stringify(this._matrix);
|
|
8278
8129
|
return JSON.parse(json);
|
|
8279
8130
|
}
|
|
8280
|
-
/**
|
|
8281
|
-
* @deprecated Use clone as a substitute.
|
|
8282
|
-
*/
|
|
8283
|
-
getData() {
|
|
8284
|
-
const json = JSON.stringify(this._matrix);
|
|
8285
|
-
return JSON.parse(json);
|
|
8286
|
-
}
|
|
8287
8131
|
getArrayData() {
|
|
8288
8132
|
let startRow = 0;
|
|
8289
8133
|
let startColumn = 0;
|
|
@@ -8305,7 +8149,7 @@ var ObjectMatrix = class ObjectMatrix {
|
|
|
8305
8149
|
objectMatrix.setValue(rowIndex - startRow, columnIndex - startColumn, value);
|
|
8306
8150
|
});
|
|
8307
8151
|
});
|
|
8308
|
-
return objectMatrix.
|
|
8152
|
+
return objectMatrix.clone();
|
|
8309
8153
|
}
|
|
8310
8154
|
/**
|
|
8311
8155
|
* the function can only be used in all the row and column are positive integer
|
|
@@ -8451,10 +8295,6 @@ function convertCellToRange(cellInfo) {
|
|
|
8451
8295
|
endX
|
|
8452
8296
|
};
|
|
8453
8297
|
}
|
|
8454
|
-
/**
|
|
8455
|
-
* @deprecated use `convertCellToRange` instead
|
|
8456
|
-
*/
|
|
8457
|
-
const makeCellToSelection = convertCellToRange;
|
|
8458
8298
|
function makeCellRangeToRangeData(cellInfo) {
|
|
8459
8299
|
if (!cellInfo) return;
|
|
8460
8300
|
const { actualRow, actualColumn, isMerged, isMergedMainCell, startRow: mergeStartRow, startColumn: mergeStartColumn, endRow: mergeEndRow, endColumn: mergeEndColumn } = cellInfo;
|
|
@@ -9338,7 +9178,10 @@ function mergeLocales(...locales) {
|
|
|
9338
9178
|
|
|
9339
9179
|
//#endregion
|
|
9340
9180
|
//#region src/shared/lru/lru-map.ts
|
|
9341
|
-
let _Symbol$iterator
|
|
9181
|
+
let _Symbol$iterator;
|
|
9182
|
+
let _Symbol$iterator2;
|
|
9183
|
+
let _Symbol$iterator3;
|
|
9184
|
+
let _Symbol$iterator4;
|
|
9342
9185
|
const NEWER = Symbol("newer");
|
|
9343
9186
|
const OLDER = Symbol("older");
|
|
9344
9187
|
_Symbol$iterator = Symbol.iterator;
|
|
@@ -9843,6 +9686,11 @@ let CustomRangeType = /* @__PURE__ */ function(CustomRangeType) {
|
|
|
9843
9686
|
CustomRangeType[CustomRangeType["DELTED"] = 9999] = "DELTED";
|
|
9844
9687
|
return CustomRangeType;
|
|
9845
9688
|
}({});
|
|
9689
|
+
let DocxBreakType = /* @__PURE__ */ function(DocxBreakType) {
|
|
9690
|
+
DocxBreakType["COLUMN"] = "column";
|
|
9691
|
+
DocxBreakType["TEXT_WRAPPING"] = "textWrapping";
|
|
9692
|
+
return DocxBreakType;
|
|
9693
|
+
}({});
|
|
9846
9694
|
let CustomDecorationType = /* @__PURE__ */ function(CustomDecorationType) {
|
|
9847
9695
|
CustomDecorationType[CustomDecorationType["COMMENT"] = 0] = "COMMENT";
|
|
9848
9696
|
CustomDecorationType[CustomDecorationType["DELETED"] = 9999] = "DELETED";
|
|
@@ -9875,9 +9723,10 @@ let GridType = /* @__PURE__ */ function(GridType) {
|
|
|
9875
9723
|
let SectionType = /* @__PURE__ */ function(SectionType) {
|
|
9876
9724
|
SectionType[SectionType["SECTION_TYPE_UNSPECIFIED"] = 0] = "SECTION_TYPE_UNSPECIFIED";
|
|
9877
9725
|
SectionType[SectionType["CONTINUOUS"] = 1] = "CONTINUOUS";
|
|
9878
|
-
SectionType[SectionType["
|
|
9879
|
-
SectionType[SectionType["
|
|
9880
|
-
SectionType[SectionType["
|
|
9726
|
+
SectionType[SectionType["NEXT_COLUMN"] = 2] = "NEXT_COLUMN";
|
|
9727
|
+
SectionType[SectionType["NEXT_PAGE"] = 3] = "NEXT_PAGE";
|
|
9728
|
+
SectionType[SectionType["EVEN_PAGE"] = 4] = "EVEN_PAGE";
|
|
9729
|
+
SectionType[SectionType["ODD_PAGE"] = 5] = "ODD_PAGE";
|
|
9881
9730
|
return SectionType;
|
|
9882
9731
|
}({});
|
|
9883
9732
|
/**
|
|
@@ -9922,15 +9771,25 @@ let WrapTextType = /* @__PURE__ */ function(WrapTextType) {
|
|
|
9922
9771
|
return WrapTextType;
|
|
9923
9772
|
}({});
|
|
9924
9773
|
/**
|
|
9925
|
-
*
|
|
9774
|
+
* Controls how a positioned object participates in document text layout.
|
|
9775
|
+
*
|
|
9776
|
+
* `WRAP_NONE` does not by itself determine whether the object is in front of or behind text. Drawing data uses
|
|
9777
|
+
* `behindDoc` for that stacking choice.
|
|
9926
9778
|
*/
|
|
9927
9779
|
let PositionedObjectLayoutType = /* @__PURE__ */ function(PositionedObjectLayoutType) {
|
|
9780
|
+
/** Places the object in the text flow like a character and lets it affect the containing line's metrics. */
|
|
9928
9781
|
PositionedObjectLayoutType[PositionedObjectLayoutType["INLINE"] = 0] = "INLINE";
|
|
9782
|
+
/** Floats the object without reflowing text. The object and text can overlap. */
|
|
9929
9783
|
PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_NONE"] = 1] = "WRAP_NONE";
|
|
9784
|
+
/** Floats the object and wraps text around the custom polygon defined by its wrap path. */
|
|
9930
9785
|
PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_POLYGON"] = 2] = "WRAP_POLYGON";
|
|
9786
|
+
/** Floats the object and wraps text around its rectangular bounds. */
|
|
9931
9787
|
PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_SQUARE"] = 3] = "WRAP_SQUARE";
|
|
9788
|
+
/** Floats the object and allows text to flow through eligible open regions in its wrap contour. */
|
|
9932
9789
|
PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_THROUGH"] = 4] = "WRAP_THROUGH";
|
|
9790
|
+
/** Floats the object and wraps text closely around its contour instead of its rectangular bounds. */
|
|
9933
9791
|
PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_TIGHT"] = 5] = "WRAP_TIGHT";
|
|
9792
|
+
/** Floats the object in a horizontal band, leaving text only above and below it. */
|
|
9934
9793
|
PositionedObjectLayoutType[PositionedObjectLayoutType["WRAP_TOP_AND_BOTTOM"] = 6] = "WRAP_TOP_AND_BOTTOM";
|
|
9935
9794
|
return PositionedObjectLayoutType;
|
|
9936
9795
|
}({});
|
|
@@ -10568,6 +10427,8 @@ const MODERN_DOCUMENT_WIDTH = {
|
|
|
10568
10427
|
["wide"]: PAGE_SIZE["A3"].width
|
|
10569
10428
|
};
|
|
10570
10429
|
const MODERN_DOCUMENT_DEFAULT_MARGIN = 50 / .75;
|
|
10430
|
+
/** Default margin for a paginated Traditional document, in 96-DPI layout pixels. */
|
|
10431
|
+
const TRADITIONAL_DOCUMENT_DEFAULT_MARGIN = 72;
|
|
10571
10432
|
|
|
10572
10433
|
//#endregion
|
|
10573
10434
|
//#region src/sheets/range.ts
|
|
@@ -10756,7 +10617,7 @@ var Range = class Range {
|
|
|
10756
10617
|
*/
|
|
10757
10618
|
getObjectValues(options = {}) {
|
|
10758
10619
|
const { startRow, endRow, startColumn, endColumn } = this._range;
|
|
10759
|
-
const values = this._worksheet.getCellMatrix().getFragment(startRow, endRow, startColumn, endColumn).
|
|
10620
|
+
const values = this._worksheet.getCellMatrix().getFragment(startRow, endRow, startColumn, endColumn).clone();
|
|
10760
10621
|
if (options.isIncludeStyle) {
|
|
10761
10622
|
const style = this._deps.getStyles();
|
|
10762
10623
|
for (let r = 0; r <= endRow - startRow; r++) for (let c = 0; c <= endColumn - startColumn; c++) {
|
|
@@ -11512,52 +11373,6 @@ var Rectangle = class Rectangle {
|
|
|
11512
11373
|
}).length > 0);
|
|
11513
11374
|
}
|
|
11514
11375
|
/**
|
|
11515
|
-
* Gets the intersection range between two ranges
|
|
11516
|
-
* @param src
|
|
11517
|
-
* @param target
|
|
11518
|
-
* @deprecated use `getIntersectRange` instead
|
|
11519
|
-
* @example
|
|
11520
|
-
* ```typescript
|
|
11521
|
-
* const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
|
|
11522
|
-
* const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
|
|
11523
|
-
* const intersection = Rectangle.getIntersects(range1, range2);
|
|
11524
|
-
* // intersection = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
|
|
11525
|
-
* ```
|
|
11526
|
-
*/
|
|
11527
|
-
static getIntersects(src, target) {
|
|
11528
|
-
const currentStartRow = src.startRow;
|
|
11529
|
-
const currentEndRow = src.endRow;
|
|
11530
|
-
const currentStartColumn = src.startColumn;
|
|
11531
|
-
const currentEndColumn = src.endColumn;
|
|
11532
|
-
const incomingStartRow = target.startRow;
|
|
11533
|
-
const incomingEndRow = target.endRow;
|
|
11534
|
-
const incomingStartColumn = target.startColumn;
|
|
11535
|
-
const incomingEndColumn = target.endColumn;
|
|
11536
|
-
let startColumn;
|
|
11537
|
-
let startRow;
|
|
11538
|
-
let endColumn;
|
|
11539
|
-
let endRow;
|
|
11540
|
-
if (incomingStartRow <= currentEndRow) if (incomingStartRow >= currentStartRow) startRow = incomingStartRow;
|
|
11541
|
-
else startRow = currentStartRow;
|
|
11542
|
-
else return null;
|
|
11543
|
-
if (incomingEndRow >= currentStartRow) if (incomingEndRow >= currentEndRow) endRow = currentEndRow;
|
|
11544
|
-
else endRow = incomingEndRow;
|
|
11545
|
-
else return null;
|
|
11546
|
-
if (incomingStartColumn <= currentEndColumn) if (incomingStartColumn > currentStartColumn) startColumn = incomingStartColumn;
|
|
11547
|
-
else startColumn = currentStartColumn;
|
|
11548
|
-
else return null;
|
|
11549
|
-
if (incomingEndColumn >= currentStartColumn) if (incomingEndColumn >= currentEndColumn) endColumn = currentEndColumn;
|
|
11550
|
-
else endColumn = incomingEndColumn;
|
|
11551
|
-
else return null;
|
|
11552
|
-
return {
|
|
11553
|
-
startRow,
|
|
11554
|
-
endRow,
|
|
11555
|
-
startColumn,
|
|
11556
|
-
endColumn,
|
|
11557
|
-
rangeType: 0
|
|
11558
|
-
};
|
|
11559
|
-
}
|
|
11560
|
-
/**
|
|
11561
11376
|
* Checks if one range completely contains another range
|
|
11562
11377
|
* @param src
|
|
11563
11378
|
* @param target
|
|
@@ -13006,7 +12821,8 @@ const blackLuminance = getLuminance(black.r, black.g, black.b);
|
|
|
13006
12821
|
* @returns The inverted color.
|
|
13007
12822
|
*/
|
|
13008
12823
|
function invertNormalizedColorByHSL(color) {
|
|
13009
|
-
const
|
|
12824
|
+
const originalLuminance = getLuminance(color[0], color[1], color[2]);
|
|
12825
|
+
const originalContrast = getContrastRatio(whiteLuminance, originalLuminance);
|
|
13010
12826
|
const hsl = rgbToHsl(color);
|
|
13011
12827
|
let l = 1 - hsl[2];
|
|
13012
12828
|
let newColor, newLuminance, newContrast;
|
|
@@ -13233,16 +13049,24 @@ var RegistryAsMap = class RegistryAsMap {
|
|
|
13233
13049
|
function requestImmediateMacroTask(callback) {
|
|
13234
13050
|
const channel = new MessageChannel();
|
|
13235
13051
|
let cancelled = false;
|
|
13052
|
+
const close = () => {
|
|
13053
|
+
channel.port1.onmessage = null;
|
|
13054
|
+
channel.port1.close();
|
|
13055
|
+
channel.port2.close();
|
|
13056
|
+
};
|
|
13236
13057
|
const handler = () => {
|
|
13237
|
-
if (!cancelled)
|
|
13058
|
+
if (!cancelled) {
|
|
13059
|
+
cancelled = true;
|
|
13060
|
+
close();
|
|
13061
|
+
callback();
|
|
13062
|
+
}
|
|
13238
13063
|
};
|
|
13239
13064
|
channel.port1.onmessage = handler;
|
|
13240
13065
|
channel.port2.postMessage(null);
|
|
13241
13066
|
return () => {
|
|
13067
|
+
if (cancelled) return;
|
|
13242
13068
|
cancelled = true;
|
|
13243
|
-
|
|
13244
|
-
channel.port1.close();
|
|
13245
|
-
channel.port2.close();
|
|
13069
|
+
close();
|
|
13246
13070
|
};
|
|
13247
13071
|
}
|
|
13248
13072
|
|
|
@@ -13481,10 +13305,6 @@ let DataStreamTreeTokenType = /* @__PURE__ */ function(DataStreamTreeTokenType)
|
|
|
13481
13305
|
DataStreamTreeTokenType["SPACE"] = " ";
|
|
13482
13306
|
return DataStreamTreeTokenType;
|
|
13483
13307
|
}({});
|
|
13484
|
-
/** Wrap your stream in a pair of custom range tokens. */
|
|
13485
|
-
function makeCustomRangeStream(stream) {
|
|
13486
|
-
return `${stream}`;
|
|
13487
|
-
}
|
|
13488
13308
|
|
|
13489
13309
|
//#endregion
|
|
13490
13310
|
//#region src/docs/data-model/text-x/build-utils/range-interval.ts
|
|
@@ -15830,7 +15650,7 @@ function composeBody(thisBody, otherBody, coverType = 0) {
|
|
|
15830
15650
|
const { startIndex: thisStart } = thisParagraph;
|
|
15831
15651
|
const { startIndex: otherStart } = otherParagraph;
|
|
15832
15652
|
if (thisStart === otherStart) {
|
|
15833
|
-
paragraphs.push(
|
|
15653
|
+
paragraphs.push((0, lodash_es.merge)(thisParagraph, otherParagraph));
|
|
15834
15654
|
thisIndex++;
|
|
15835
15655
|
otherIndex++;
|
|
15836
15656
|
} else if (thisStart < otherStart) {
|
|
@@ -16273,7 +16093,7 @@ function transformBlockRanges(thisBlockRanges, otherBlockRanges, priority) {
|
|
|
16273
16093
|
if (!otherBlockRanges.length) return [];
|
|
16274
16094
|
return otherBlockRanges.map((otherBlockRange) => {
|
|
16275
16095
|
const thisBlockRange = thisBlockRanges.find((blockRange) => blockRange.blockId === otherBlockRange.blockId);
|
|
16276
|
-
return thisBlockRange && priority ?
|
|
16096
|
+
return thisBlockRange && priority ? (0, lodash_es.merge)(otherBlockRange, thisBlockRange) : otherBlockRange;
|
|
16277
16097
|
});
|
|
16278
16098
|
}
|
|
16279
16099
|
|
|
@@ -16916,16 +16736,37 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
16916
16736
|
//#region src/docs/data-model/paragraph-style.ts
|
|
16917
16737
|
function _definedStyle(style) {
|
|
16918
16738
|
if (style == null) return {};
|
|
16919
|
-
|
|
16739
|
+
const definedStyle = Tools.deepClone(style);
|
|
16740
|
+
Tools.removeNull(definedStyle);
|
|
16741
|
+
return definedStyle;
|
|
16742
|
+
}
|
|
16743
|
+
function _resolveNamedParagraphStyle(styles, styleId) {
|
|
16744
|
+
if (!styles || !styleId) return {};
|
|
16745
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
16746
|
+
const resolve = (currentStyleId) => {
|
|
16747
|
+
if (visiting.has(currentStyleId)) return {};
|
|
16748
|
+
const style = styles[currentStyleId];
|
|
16749
|
+
if (!style || style.type !== 1) return {};
|
|
16750
|
+
visiting.add(currentStyleId);
|
|
16751
|
+
const base = style.basedOn ? resolve(style.basedOn) : {};
|
|
16752
|
+
visiting.delete(currentStyleId);
|
|
16753
|
+
return {
|
|
16754
|
+
...base,
|
|
16755
|
+
..._definedStyle(style.paragraphStyle)
|
|
16756
|
+
};
|
|
16757
|
+
};
|
|
16758
|
+
return resolve(styleId);
|
|
16920
16759
|
}
|
|
16921
16760
|
function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options = {}) {
|
|
16922
|
-
var _options$useLegacyMod;
|
|
16761
|
+
var _options$useLegacyMod, _definedParagraphStyl;
|
|
16762
|
+
const legacyStyle = ((_options$useLegacyMod = options.useLegacyModernDefaults) !== null && _options$useLegacyMod !== void 0 ? _options$useLegacyMod : (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 2) ? {
|
|
16763
|
+
lineSpacing: DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING,
|
|
16764
|
+
spaceAbove: { v: 0 },
|
|
16765
|
+
spaceBelow: { v: 12 }
|
|
16766
|
+
} : {};
|
|
16923
16767
|
const documentDefaults = {
|
|
16924
|
-
...(
|
|
16925
|
-
|
|
16926
|
-
spaceAbove: { v: 0 },
|
|
16927
|
-
spaceBelow: { v: 12 }
|
|
16928
|
-
} : {},
|
|
16768
|
+
...(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 1 ? { widowControl: 1 } : {},
|
|
16769
|
+
...legacyStyle,
|
|
16929
16770
|
..._definedStyle(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.defaultParagraphStyle)
|
|
16930
16771
|
};
|
|
16931
16772
|
if (options.excludeDocumentOuterSpacing) {
|
|
@@ -16933,10 +16774,13 @@ function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options =
|
|
|
16933
16774
|
delete documentDefaults.spaceBelow;
|
|
16934
16775
|
}
|
|
16935
16776
|
const definedParagraphStyle = _definedStyle(paragraphStyle);
|
|
16936
|
-
const
|
|
16777
|
+
const referencedParagraphStyle = _resolveNamedParagraphStyle(options.styles, options.paragraphStyleId);
|
|
16778
|
+
const namedStyleType = (_definedParagraphStyl = definedParagraphStyle.namedStyleType) !== null && _definedParagraphStyl !== void 0 ? _definedParagraphStyl : referencedParagraphStyle.namedStyleType;
|
|
16779
|
+
const namedStyle = namedStyleType == null ? null : NAMED_STYLE_SPACE_MAP[namedStyleType];
|
|
16937
16780
|
return Tools.deepClone({
|
|
16938
16781
|
...documentDefaults,
|
|
16939
16782
|
...namedStyle,
|
|
16783
|
+
...referencedParagraphStyle,
|
|
16940
16784
|
...definedParagraphStyle
|
|
16941
16785
|
});
|
|
16942
16786
|
}
|
|
@@ -17657,10 +17501,10 @@ function buildDrawingInsertBody(body, drawings, insertOffset) {
|
|
|
17657
17501
|
//#endregion
|
|
17658
17502
|
//#region src/docs/data-model/text-x/build-utils/data-stream-change.ts
|
|
17659
17503
|
/**
|
|
17660
|
-
* Finds one contiguous dataStream change. Pure structural insertions
|
|
17661
|
-
* anchored by their
|
|
17504
|
+
* Finds one contiguous dataStream change. Pure structural insertions and deletions
|
|
17505
|
+
* are anchored by their stable ids before falling back to string comparison.
|
|
17662
17506
|
* This prevents an adjacent identical sentinel from being mistaken for an
|
|
17663
|
-
* unchanged prefix and keeps the
|
|
17507
|
+
* unchanged prefix and keeps the structure metadata aligned with the TextX body.
|
|
17664
17508
|
*/
|
|
17665
17509
|
function getSingleDataStreamChange(previousBody, nextBody) {
|
|
17666
17510
|
if (previousBody == null || nextBody == null) return null;
|
|
@@ -17671,6 +17515,9 @@ function getSingleDataStreamChange(previousBody, nextBody) {
|
|
|
17671
17515
|
if (insertedLength > 0) {
|
|
17672
17516
|
const structuralInsertion = findStructuralInsertion(previousBody, nextBody, previousDataStream, nextDataStream, insertedLength);
|
|
17673
17517
|
if (structuralInsertion) return structuralInsertion;
|
|
17518
|
+
} else if (insertedLength < 0) {
|
|
17519
|
+
const structuralDeletion = findStructuralDeletion(previousBody, nextBody, previousDataStream, nextDataStream, -insertedLength);
|
|
17520
|
+
if (structuralDeletion) return structuralDeletion;
|
|
17674
17521
|
}
|
|
17675
17522
|
let start = 0;
|
|
17676
17523
|
while (start < previousDataStream.length && start < nextDataStream.length && previousDataStream[start] === nextDataStream[start]) start++;
|
|
@@ -17686,6 +17533,14 @@ function getSingleDataStreamChange(previousBody, nextBody) {
|
|
|
17686
17533
|
insertLength: nextEnd - start
|
|
17687
17534
|
};
|
|
17688
17535
|
}
|
|
17536
|
+
function findStructuralDeletion(previousBody, nextBody, previousDataStream, nextDataStream, deletedLength) {
|
|
17537
|
+
for (const start of collectNewStructuralStartOffsets(nextBody, previousBody)) if (previousDataStream.slice(0, start) === nextDataStream.slice(0, start) && previousDataStream.slice(start + deletedLength) === nextDataStream.slice(start)) return {
|
|
17538
|
+
start,
|
|
17539
|
+
deleteLength: deletedLength,
|
|
17540
|
+
insertLength: 0
|
|
17541
|
+
};
|
|
17542
|
+
return null;
|
|
17543
|
+
}
|
|
17689
17544
|
function findStructuralInsertion(previousBody, nextBody, previousDataStream, nextDataStream, insertedLength) {
|
|
17690
17545
|
for (const start of collectNewStructuralStartOffsets(previousBody, nextBody)) if (previousDataStream.slice(0, start) === nextDataStream.slice(0, start) && previousDataStream.slice(start) === nextDataStream.slice(start + insertedLength)) return {
|
|
17691
17546
|
start,
|
|
@@ -21036,8 +20891,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT";
|
|
|
21036
20891
|
const FOCUSING_SHEET = "FOCUSING_SHEET";
|
|
21037
20892
|
const FOCUSING_DOC = "FOCUSING_DOC";
|
|
21038
20893
|
const FOCUSING_SLIDE = "FOCUSING_SLIDE";
|
|
21039
|
-
|
|
21040
|
-
const FOCUSING_EDITOR_BUT_HIDDEN = "FOCUSING_EDITOR_BUT_HIDDEN";
|
|
20894
|
+
const FOCUSING_BOARD = "FOCUSING_BOARD";
|
|
21041
20895
|
const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
|
|
21042
20896
|
const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
21043
20897
|
/** The focusing state of the formula editor (Fx bar). */
|
|
@@ -21431,229 +21285,37 @@ function convertTextRotation(textRotation) {
|
|
|
21431
21285
|
}
|
|
21432
21286
|
|
|
21433
21287
|
//#endregion
|
|
21434
|
-
//#region src/sheets/
|
|
21288
|
+
//#region src/sheets/column-manager.ts
|
|
21435
21289
|
/**
|
|
21436
|
-
*
|
|
21437
|
-
* Avoids type checking overhead when we know the structure.
|
|
21290
|
+
* Manage configuration information of all columns, get column width, column length, set column width, etc.
|
|
21438
21291
|
*/
|
|
21439
|
-
|
|
21440
|
-
|
|
21441
|
-
|
|
21442
|
-
|
|
21443
|
-
|
|
21444
|
-
const result = new Array(len);
|
|
21445
|
-
for (let i = 0; i < len; i++) result[i] = cloneValue(value[i]);
|
|
21446
|
-
return result;
|
|
21447
|
-
}
|
|
21448
|
-
const result = {};
|
|
21449
|
-
const keys = Object.keys(value);
|
|
21450
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
21451
|
-
const key = keys[i];
|
|
21452
|
-
result[key] = cloneValue(value[key]);
|
|
21292
|
+
var ColumnManager = class {
|
|
21293
|
+
constructor(_config, data) {
|
|
21294
|
+
this._config = _config;
|
|
21295
|
+
_defineProperty(this, "_columnData", {});
|
|
21296
|
+
this._columnData = data;
|
|
21453
21297
|
}
|
|
21454
|
-
|
|
21455
|
-
|
|
21456
|
-
|
|
21457
|
-
|
|
21458
|
-
|
|
21459
|
-
|
|
21460
|
-
*/
|
|
21461
|
-
function cloneCellData(cell) {
|
|
21462
|
-
if (cell === null || cell === void 0) return cell;
|
|
21463
|
-
const result = {};
|
|
21464
|
-
if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
|
|
21465
|
-
if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
|
|
21466
|
-
else result.s = cloneValue(cell.s);
|
|
21467
|
-
if (cell.v !== void 0) result.v = cell.v;
|
|
21468
|
-
if (cell.t !== void 0) result.t = cell.t;
|
|
21469
|
-
if (cell.f !== void 0) result.f = cell.f;
|
|
21470
|
-
if (cell.ref !== void 0) result.ref = cell.ref;
|
|
21471
|
-
if (cell.xf !== void 0) result.xf = cell.xf;
|
|
21472
|
-
if (cell.si !== void 0) result.si = cell.si;
|
|
21473
|
-
if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
|
|
21474
|
-
return result;
|
|
21475
|
-
}
|
|
21476
|
-
/**
|
|
21477
|
-
* Fast clone for ICellDataWithSpanAndDisplay. Optimized for the known structure.
|
|
21478
|
-
* This extends cloneCellData with additional span and display properties.
|
|
21479
|
-
* @param cell - The cell data with span and display info to clone
|
|
21480
|
-
* @returns A deep clone of the cell data
|
|
21481
|
-
*/
|
|
21482
|
-
function cloneCellDataWithSpanAndDisplay(cell) {
|
|
21483
|
-
if (cell === null || cell === void 0) return cell;
|
|
21484
|
-
const result = {};
|
|
21485
|
-
if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
|
|
21486
|
-
if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
|
|
21487
|
-
else result.s = cloneValue(cell.s);
|
|
21488
|
-
if (cell.v !== void 0) result.v = cell.v;
|
|
21489
|
-
if (cell.t !== void 0) result.t = cell.t;
|
|
21490
|
-
if (cell.f !== void 0) result.f = cell.f;
|
|
21491
|
-
if (cell.ref !== void 0) result.ref = cell.ref;
|
|
21492
|
-
if (cell.xf !== void 0) result.xf = cell.xf;
|
|
21493
|
-
if (cell.si !== void 0) result.si = cell.si;
|
|
21494
|
-
if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
|
|
21495
|
-
if (cell.rowSpan !== void 0) result.rowSpan = cell.rowSpan;
|
|
21496
|
-
if (cell.colSpan !== void 0) result.colSpan = cell.colSpan;
|
|
21497
|
-
if (cell.displayV !== void 0) result.displayV = cell.displayV;
|
|
21498
|
-
return result;
|
|
21499
|
-
}
|
|
21500
|
-
/**
|
|
21501
|
-
* Fast clone for cell data matrix. Optimized for sparse matrix structure.
|
|
21502
|
-
* @param cellData - The cell data matrix to clone
|
|
21503
|
-
* @returns A deep clone of the cell data matrix
|
|
21504
|
-
*/
|
|
21505
|
-
function cloneCellDataMatrix(cellData) {
|
|
21506
|
-
const result = {};
|
|
21507
|
-
const rowKeys = Object.keys(cellData);
|
|
21508
|
-
for (let i = 0, rowLen = rowKeys.length; i < rowLen; i++) {
|
|
21509
|
-
const rowKey = rowKeys[i];
|
|
21510
|
-
const rowNum = Number(rowKey);
|
|
21511
|
-
const rowData = cellData[rowNum];
|
|
21512
|
-
if (rowData === void 0) continue;
|
|
21513
|
-
const clonedRow = {};
|
|
21514
|
-
const colKeys = Object.keys(rowData);
|
|
21515
|
-
for (let j = 0, colLen = colKeys.length; j < colLen; j++) {
|
|
21516
|
-
const colKey = colKeys[j];
|
|
21517
|
-
const colNum = Number(colKey);
|
|
21518
|
-
const cell = rowData[colNum];
|
|
21519
|
-
if (cell !== void 0 && cell !== null) clonedRow[colNum] = cloneCellData(cell);
|
|
21520
|
-
}
|
|
21521
|
-
result[rowNum] = clonedRow;
|
|
21298
|
+
/**
|
|
21299
|
+
* Get width and hidden status of columns in the sheet
|
|
21300
|
+
* @returns {IObjectArrayPrimitiveType<Partial<IColumnData>>} Column data, including width, hidden status, etc.
|
|
21301
|
+
*/
|
|
21302
|
+
getColumnData() {
|
|
21303
|
+
return this._columnData;
|
|
21522
21304
|
}
|
|
21523
|
-
|
|
21524
|
-
}
|
|
21525
|
-
|
|
21526
|
-
|
|
21527
|
-
|
|
21528
|
-
* @returns A deep clone of the row or column data
|
|
21529
|
-
*/
|
|
21530
|
-
function cloneRowColumnData(data) {
|
|
21531
|
-
const result = {};
|
|
21532
|
-
const keys = Object.keys(data);
|
|
21533
|
-
for (let i = 0, len = keys.length; i < len; i++) {
|
|
21534
|
-
const key = keys[i];
|
|
21535
|
-
const idx = Number(key);
|
|
21536
|
-
const item = data[idx];
|
|
21537
|
-
if (item === void 0) continue;
|
|
21538
|
-
const cloned = {};
|
|
21539
|
-
if ("h" in item && item.h !== void 0) cloned.h = item.h;
|
|
21540
|
-
if ("ia" in item && item.ia !== void 0) cloned.ia = item.ia;
|
|
21541
|
-
if ("ah" in item && item.ah !== void 0) cloned.ah = item.ah;
|
|
21542
|
-
if ("hd" in item && item.hd !== void 0) cloned.hd = item.hd;
|
|
21543
|
-
if ("w" in item && item.w !== void 0) cloned.w = item.w;
|
|
21544
|
-
if ("s" in item && item.s !== void 0) if (item.s === null || typeof item.s === "string") cloned.s = item.s;
|
|
21545
|
-
else cloned.s = cloneValue(item.s);
|
|
21546
|
-
if ("custom" in item && item.custom !== void 0) cloned.custom = item.custom === null ? null : cloneValue(item.custom);
|
|
21547
|
-
result[idx] = cloned;
|
|
21305
|
+
getColVisible(colPos) {
|
|
21306
|
+
const { _columnData } = this;
|
|
21307
|
+
const col = _columnData[colPos];
|
|
21308
|
+
if (!col) return true;
|
|
21309
|
+
return col.hd !== 1;
|
|
21548
21310
|
}
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
*
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
const len = ranges.length;
|
|
21558
|
-
const result = new Array(len);
|
|
21559
|
-
for (let i = 0; i < len; i++) {
|
|
21560
|
-
const range = ranges[i];
|
|
21561
|
-
result[i] = {
|
|
21562
|
-
startRow: range.startRow,
|
|
21563
|
-
startColumn: range.startColumn,
|
|
21564
|
-
endRow: range.endRow,
|
|
21565
|
-
endColumn: range.endColumn,
|
|
21566
|
-
rangeType: range.rangeType,
|
|
21567
|
-
startAbsoluteRefType: range.startAbsoluteRefType,
|
|
21568
|
-
endAbsoluteRefType: range.endAbsoluteRefType
|
|
21569
|
-
};
|
|
21570
|
-
}
|
|
21571
|
-
return result;
|
|
21572
|
-
}
|
|
21573
|
-
/**
|
|
21574
|
-
* Optimized deep clone specifically for IWorksheetData.
|
|
21575
|
-
* This is significantly faster than generic deepClone because:
|
|
21576
|
-
* 1. No recursive type checking - we know the structure
|
|
21577
|
-
* 2. Direct property access instead of Object.keys iteration for known properties
|
|
21578
|
-
* 3. Specialized handlers for cellData matrix (the largest data)
|
|
21579
|
-
* 4. Primitive values copied directly without cloning
|
|
21580
|
-
*
|
|
21581
|
-
* @param worksheet - The worksheet data to clone
|
|
21582
|
-
* @returns A deep clone of the worksheet data
|
|
21583
|
-
*/
|
|
21584
|
-
function cloneWorksheetData(worksheet) {
|
|
21585
|
-
const result = {
|
|
21586
|
-
id: worksheet.id,
|
|
21587
|
-
name: worksheet.name,
|
|
21588
|
-
tabColor: worksheet.tabColor,
|
|
21589
|
-
hidden: worksheet.hidden,
|
|
21590
|
-
rowCount: worksheet.rowCount,
|
|
21591
|
-
columnCount: worksheet.columnCount,
|
|
21592
|
-
zoomRatio: worksheet.zoomRatio,
|
|
21593
|
-
scrollTop: worksheet.scrollTop,
|
|
21594
|
-
scrollLeft: worksheet.scrollLeft,
|
|
21595
|
-
defaultColumnWidth: worksheet.defaultColumnWidth,
|
|
21596
|
-
defaultRowHeight: worksheet.defaultRowHeight,
|
|
21597
|
-
showGridlines: worksheet.showGridlines,
|
|
21598
|
-
rightToLeft: worksheet.rightToLeft,
|
|
21599
|
-
freeze: {
|
|
21600
|
-
xSplit: worksheet.freeze.xSplit,
|
|
21601
|
-
ySplit: worksheet.freeze.ySplit,
|
|
21602
|
-
startRow: worksheet.freeze.startRow,
|
|
21603
|
-
startColumn: worksheet.freeze.startColumn
|
|
21604
|
-
},
|
|
21605
|
-
rowHeader: {
|
|
21606
|
-
width: worksheet.rowHeader.width,
|
|
21607
|
-
hidden: worksheet.rowHeader.hidden
|
|
21608
|
-
},
|
|
21609
|
-
columnHeader: {
|
|
21610
|
-
height: worksheet.columnHeader.height,
|
|
21611
|
-
hidden: worksheet.columnHeader.hidden
|
|
21612
|
-
},
|
|
21613
|
-
mergeData: cloneMergeData(worksheet.mergeData),
|
|
21614
|
-
cellData: cloneCellDataMatrix(worksheet.cellData),
|
|
21615
|
-
rowData: cloneRowColumnData(worksheet.rowData),
|
|
21616
|
-
columnData: cloneRowColumnData(worksheet.columnData)
|
|
21617
|
-
};
|
|
21618
|
-
if (worksheet.gridlinesColor !== void 0) result.gridlinesColor = worksheet.gridlinesColor;
|
|
21619
|
-
if (worksheet.defaultStyle !== void 0) if (worksheet.defaultStyle === null || typeof worksheet.defaultStyle === "string") result.defaultStyle = worksheet.defaultStyle;
|
|
21620
|
-
else result.defaultStyle = cloneValue(worksheet.defaultStyle);
|
|
21621
|
-
if (worksheet.custom !== void 0) result.custom = worksheet.custom === null ? null : cloneValue(worksheet.custom);
|
|
21622
|
-
return result;
|
|
21623
|
-
}
|
|
21624
|
-
|
|
21625
|
-
//#endregion
|
|
21626
|
-
//#region src/sheets/column-manager.ts
|
|
21627
|
-
/**
|
|
21628
|
-
* Manage configuration information of all columns, get column width, column length, set column width, etc.
|
|
21629
|
-
*/
|
|
21630
|
-
var ColumnManager = class {
|
|
21631
|
-
constructor(_config, data) {
|
|
21632
|
-
this._config = _config;
|
|
21633
|
-
_defineProperty(this, "_columnData", {});
|
|
21634
|
-
this._columnData = data;
|
|
21635
|
-
}
|
|
21636
|
-
/**
|
|
21637
|
-
* Get width and hidden status of columns in the sheet
|
|
21638
|
-
* @returns {IObjectArrayPrimitiveType<Partial<IColumnData>>} Column data, including width, hidden status, etc.
|
|
21639
|
-
*/
|
|
21640
|
-
getColumnData() {
|
|
21641
|
-
return this._columnData;
|
|
21642
|
-
}
|
|
21643
|
-
getColVisible(colPos) {
|
|
21644
|
-
const { _columnData } = this;
|
|
21645
|
-
const col = _columnData[colPos];
|
|
21646
|
-
if (!col) return true;
|
|
21647
|
-
return col.hd !== 1;
|
|
21648
|
-
}
|
|
21649
|
-
/**
|
|
21650
|
-
* Get the column style
|
|
21651
|
-
* @param {number} col Column index
|
|
21652
|
-
* @returns {string | Nullable<IStyleData>} Style data, may be undefined
|
|
21653
|
-
*/
|
|
21654
|
-
getColumnStyle(col) {
|
|
21655
|
-
var _this$_columnData$col;
|
|
21656
|
-
return (_this$_columnData$col = this._columnData[col]) === null || _this$_columnData$col === void 0 ? void 0 : _this$_columnData$col.s;
|
|
21311
|
+
/**
|
|
21312
|
+
* Get the column style
|
|
21313
|
+
* @param {number} col Column index
|
|
21314
|
+
* @returns {string | Nullable<IStyleData>} Style data, may be undefined
|
|
21315
|
+
*/
|
|
21316
|
+
getColumnStyle(col) {
|
|
21317
|
+
var _this$_columnData$col;
|
|
21318
|
+
return (_this$_columnData$col = this._columnData[col]) === null || _this$_columnData$col === void 0 ? void 0 : _this$_columnData$col.s;
|
|
21657
21319
|
}
|
|
21658
21320
|
/**
|
|
21659
21321
|
* Set the set column default style
|
|
@@ -22349,7 +22011,7 @@ const DEFAULT_CELL_DOCUMENT_MODEL_OPTION = {
|
|
|
22349
22011
|
/**
|
|
22350
22012
|
* The model of a Worksheet.
|
|
22351
22013
|
*/
|
|
22352
|
-
var Worksheet = class
|
|
22014
|
+
var Worksheet = class {
|
|
22353
22015
|
constructor(unitId, snapshot, _styles) {
|
|
22354
22016
|
var _this$_snapshot$id;
|
|
22355
22017
|
this.unitId = unitId;
|
|
@@ -22618,16 +22280,6 @@ var Worksheet = class Worksheet {
|
|
|
22618
22280
|
return this._snapshot.name;
|
|
22619
22281
|
}
|
|
22620
22282
|
/**
|
|
22621
|
-
* Returns WorkSheet Clone Object
|
|
22622
|
-
* @returns WorkSheet Clone Object
|
|
22623
|
-
* @deprecated
|
|
22624
|
-
*/
|
|
22625
|
-
clone() {
|
|
22626
|
-
const { _snapshot: _config } = this;
|
|
22627
|
-
const copy = cloneWorksheetData(_config);
|
|
22628
|
-
return new Worksheet(this.unitId, copy, this._styles);
|
|
22629
|
-
}
|
|
22630
|
-
/**
|
|
22631
22283
|
* Get the merged cell list of the sheet.
|
|
22632
22284
|
* @returns {IRange[]} merged cell list
|
|
22633
22285
|
*/
|
|
@@ -23414,10 +23066,6 @@ let Workbook = class Workbook extends UnitModel {
|
|
|
23414
23066
|
getSnapshot() {
|
|
23415
23067
|
return this._snapshot;
|
|
23416
23068
|
}
|
|
23417
|
-
/** @deprecated use use name property instead */
|
|
23418
|
-
getName() {
|
|
23419
|
-
return this._snapshot.name;
|
|
23420
|
-
}
|
|
23421
23069
|
setName(name) {
|
|
23422
23070
|
this._name$.next(name);
|
|
23423
23071
|
this._snapshot.name = name;
|
|
@@ -23765,22 +23413,10 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23765
23413
|
var _this$_unitCreateOpti;
|
|
23766
23414
|
return (_this$_unitCreateOpti = this._unitCreateOptions.get(unitId)) !== null && _this$_unitCreateOpti !== void 0 ? _this$_unitCreateOpti : null;
|
|
23767
23415
|
}
|
|
23768
|
-
getUniverSheetInstance(unitId) {
|
|
23769
|
-
return this.getUnit(unitId, _univerjs_protocol.UniverType.UNIVER_SHEET);
|
|
23770
|
-
}
|
|
23771
23416
|
getAllUnitsForType(type) {
|
|
23772
23417
|
var _this$_unitsByType$ge;
|
|
23773
23418
|
return (_this$_unitsByType$ge = this._unitsByType.get(type)) !== null && _this$_unitsByType$ge !== void 0 ? _this$_unitsByType$ge : [];
|
|
23774
23419
|
}
|
|
23775
|
-
changeDoc(unitId, doc) {
|
|
23776
|
-
const allDocs = this.getAllUnitsForType(_univerjs_protocol.UniverType.UNIVER_DOC);
|
|
23777
|
-
const oldDoc = allDocs.find((doc) => doc.getUnitId() === unitId);
|
|
23778
|
-
if (oldDoc != null) {
|
|
23779
|
-
const index = allDocs.indexOf(oldDoc);
|
|
23780
|
-
allDocs.splice(index, 1);
|
|
23781
|
-
}
|
|
23782
|
-
this.__addUnit(doc);
|
|
23783
|
-
}
|
|
23784
23420
|
get focused() {
|
|
23785
23421
|
var _this$_getUnitById2;
|
|
23786
23422
|
const id = this._focused$.getValue();
|
|
@@ -23788,7 +23424,7 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23788
23424
|
return (_this$_getUnitById2 = this._getUnitById(id)) === null || _this$_getUnitById2 === void 0 ? void 0 : _this$_getUnitById2[0];
|
|
23789
23425
|
}
|
|
23790
23426
|
focusUnit(id) {
|
|
23791
|
-
var _this$focused;
|
|
23427
|
+
var _this$focused, _this$focused2;
|
|
23792
23428
|
if (this._focused$.getValue() === id) return;
|
|
23793
23429
|
this._focused$.next(id);
|
|
23794
23430
|
if (this.focused instanceof Workbook) {
|
|
@@ -23796,24 +23432,35 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23796
23432
|
this._contextService.setContextValue(FOCUSING_DOC, false);
|
|
23797
23433
|
this._contextService.setContextValue(FOCUSING_SHEET, true);
|
|
23798
23434
|
this._contextService.setContextValue(FOCUSING_SLIDE, false);
|
|
23435
|
+
this._contextService.setContextValue(FOCUSING_BOARD, false);
|
|
23799
23436
|
this.setCurrentUnitForType(id);
|
|
23800
23437
|
} else if (this.focused instanceof DocumentDataModel) {
|
|
23801
23438
|
this._contextService.setContextValue(FOCUSING_UNIT, true);
|
|
23802
23439
|
this._contextService.setContextValue(FOCUSING_DOC, true);
|
|
23803
23440
|
this._contextService.setContextValue(FOCUSING_SHEET, false);
|
|
23804
23441
|
this._contextService.setContextValue(FOCUSING_SLIDE, false);
|
|
23442
|
+
this._contextService.setContextValue(FOCUSING_BOARD, false);
|
|
23805
23443
|
this.setCurrentUnitForType(id);
|
|
23806
23444
|
} else if (((_this$focused = this.focused) === null || _this$focused === void 0 ? void 0 : _this$focused.type) === _univerjs_protocol.UniverType.UNIVER_SLIDE) {
|
|
23807
23445
|
this._contextService.setContextValue(FOCUSING_UNIT, true);
|
|
23808
23446
|
this._contextService.setContextValue(FOCUSING_DOC, false);
|
|
23809
23447
|
this._contextService.setContextValue(FOCUSING_SHEET, false);
|
|
23810
23448
|
this._contextService.setContextValue(FOCUSING_SLIDE, true);
|
|
23449
|
+
this._contextService.setContextValue(FOCUSING_BOARD, false);
|
|
23450
|
+
this.setCurrentUnitForType(id);
|
|
23451
|
+
} else if (((_this$focused2 = this.focused) === null || _this$focused2 === void 0 ? void 0 : _this$focused2.type) === _univerjs_protocol.UniverType.UNIVER_BOARD) {
|
|
23452
|
+
this._contextService.setContextValue(FOCUSING_UNIT, true);
|
|
23453
|
+
this._contextService.setContextValue(FOCUSING_DOC, false);
|
|
23454
|
+
this._contextService.setContextValue(FOCUSING_SHEET, false);
|
|
23455
|
+
this._contextService.setContextValue(FOCUSING_SLIDE, false);
|
|
23456
|
+
this._contextService.setContextValue(FOCUSING_BOARD, true);
|
|
23811
23457
|
this.setCurrentUnitForType(id);
|
|
23812
23458
|
} else {
|
|
23813
23459
|
this._contextService.setContextValue(FOCUSING_UNIT, false);
|
|
23814
23460
|
this._contextService.setContextValue(FOCUSING_DOC, false);
|
|
23815
23461
|
this._contextService.setContextValue(FOCUSING_SHEET, false);
|
|
23816
23462
|
this._contextService.setContextValue(FOCUSING_SLIDE, false);
|
|
23463
|
+
this._contextService.setContextValue(FOCUSING_BOARD, false);
|
|
23817
23464
|
}
|
|
23818
23465
|
}
|
|
23819
23466
|
getFocusedUnit() {
|
|
@@ -23850,8 +23497,8 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23850
23497
|
}
|
|
23851
23498
|
}
|
|
23852
23499
|
_tryResetFocusOnRemoval(unitId) {
|
|
23853
|
-
var _this$
|
|
23854
|
-
if (((_this$
|
|
23500
|
+
var _this$focused3;
|
|
23501
|
+
if (((_this$focused3 = this.focused) === null || _this$focused3 === void 0 ? void 0 : _this$focused3.getUnitId()) === unitId) this._focused$.next(null);
|
|
23855
23502
|
}
|
|
23856
23503
|
_getUnitById(unitId) {
|
|
23857
23504
|
for (const [type, units] of this._unitsByType) {
|
|
@@ -24447,6 +24094,32 @@ PluginService = __decorate([
|
|
|
24447
24094
|
__decorateParam(2, ILogService)
|
|
24448
24095
|
], PluginService);
|
|
24449
24096
|
|
|
24097
|
+
//#endregion
|
|
24098
|
+
//#region src/services/region/region.service.ts
|
|
24099
|
+
let RegionService = class RegionService extends Disposable {
|
|
24100
|
+
constructor(_localeService) {
|
|
24101
|
+
super();
|
|
24102
|
+
this._localeService = _localeService;
|
|
24103
|
+
_defineProperty(this, "_currentRegion$", void 0);
|
|
24104
|
+
_defineProperty(this, "currentRegion$", void 0);
|
|
24105
|
+
_defineProperty(this, "_hasExplicitRegion", false);
|
|
24106
|
+
this._currentRegion$ = new rxjs.BehaviorSubject(this._localeService.getCurrentLocale());
|
|
24107
|
+
this.currentRegion$ = this._currentRegion$.asObservable();
|
|
24108
|
+
this.disposeWithMe(this._localeService.currentLocale$.subscribe((locale) => {
|
|
24109
|
+
if (!this._hasExplicitRegion && locale !== this._currentRegion$.value) this._currentRegion$.next(locale);
|
|
24110
|
+
}));
|
|
24111
|
+
this.disposeWithMe(toDisposable(() => this._currentRegion$.complete()));
|
|
24112
|
+
}
|
|
24113
|
+
setRegion(region) {
|
|
24114
|
+
this._hasExplicitRegion = true;
|
|
24115
|
+
this._currentRegion$.next(region);
|
|
24116
|
+
}
|
|
24117
|
+
getCurrentRegion() {
|
|
24118
|
+
return this._currentRegion$.value;
|
|
24119
|
+
}
|
|
24120
|
+
};
|
|
24121
|
+
RegionService = __decorate([__decorateParam(0, (0, _wendellhu_redi.Inject)(LocaleService))], RegionService);
|
|
24122
|
+
|
|
24450
24123
|
//#endregion
|
|
24451
24124
|
//#region src/services/resource-loader/type.ts
|
|
24452
24125
|
const IResourceLoaderService = (0, _wendellhu_redi.createIdentifier)("resource-loader-service");
|
|
@@ -25170,6 +24843,198 @@ function delayAnimationFrame(frames = 1) {
|
|
|
25170
24843
|
});
|
|
25171
24844
|
}
|
|
25172
24845
|
|
|
24846
|
+
//#endregion
|
|
24847
|
+
//#region src/sheets/clone.ts
|
|
24848
|
+
/**
|
|
24849
|
+
* Fast clone for primitive values and simple objects.
|
|
24850
|
+
* Avoids type checking overhead when we know the structure.
|
|
24851
|
+
*/
|
|
24852
|
+
function cloneValue(value) {
|
|
24853
|
+
if (value === null || value === void 0) return value;
|
|
24854
|
+
if (typeof value !== "object") return value;
|
|
24855
|
+
if (Array.isArray(value)) {
|
|
24856
|
+
const len = value.length;
|
|
24857
|
+
const result = new Array(len);
|
|
24858
|
+
for (let i = 0; i < len; i++) result[i] = cloneValue(value[i]);
|
|
24859
|
+
return result;
|
|
24860
|
+
}
|
|
24861
|
+
const result = {};
|
|
24862
|
+
const keys = Object.keys(value);
|
|
24863
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
24864
|
+
const key = keys[i];
|
|
24865
|
+
result[key] = cloneValue(value[key]);
|
|
24866
|
+
}
|
|
24867
|
+
return result;
|
|
24868
|
+
}
|
|
24869
|
+
/**
|
|
24870
|
+
* Fast clone for ICellData. Optimized for the known structure.
|
|
24871
|
+
* @param cell - The cell data to clone
|
|
24872
|
+
* @returns A deep clone of the cell data
|
|
24873
|
+
*/
|
|
24874
|
+
function cloneCellData(cell) {
|
|
24875
|
+
if (cell === null || cell === void 0) return cell;
|
|
24876
|
+
const result = {};
|
|
24877
|
+
if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
|
|
24878
|
+
if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
|
|
24879
|
+
else result.s = cloneValue(cell.s);
|
|
24880
|
+
if (cell.v !== void 0) result.v = cell.v;
|
|
24881
|
+
if (cell.t !== void 0) result.t = cell.t;
|
|
24882
|
+
if (cell.f !== void 0) result.f = cell.f;
|
|
24883
|
+
if (cell.ref !== void 0) result.ref = cell.ref;
|
|
24884
|
+
if (cell.xf !== void 0) result.xf = cell.xf;
|
|
24885
|
+
if (cell.si !== void 0) result.si = cell.si;
|
|
24886
|
+
if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
|
|
24887
|
+
return result;
|
|
24888
|
+
}
|
|
24889
|
+
/**
|
|
24890
|
+
* Fast clone for ICellDataWithSpanAndDisplay. Optimized for the known structure.
|
|
24891
|
+
* This extends cloneCellData with additional span and display properties.
|
|
24892
|
+
* @param cell - The cell data with span and display info to clone
|
|
24893
|
+
* @returns A deep clone of the cell data
|
|
24894
|
+
*/
|
|
24895
|
+
function cloneCellDataWithSpanAndDisplay(cell) {
|
|
24896
|
+
if (cell === null || cell === void 0) return cell;
|
|
24897
|
+
const result = {};
|
|
24898
|
+
if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
|
|
24899
|
+
if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
|
|
24900
|
+
else result.s = cloneValue(cell.s);
|
|
24901
|
+
if (cell.v !== void 0) result.v = cell.v;
|
|
24902
|
+
if (cell.t !== void 0) result.t = cell.t;
|
|
24903
|
+
if (cell.f !== void 0) result.f = cell.f;
|
|
24904
|
+
if (cell.ref !== void 0) result.ref = cell.ref;
|
|
24905
|
+
if (cell.xf !== void 0) result.xf = cell.xf;
|
|
24906
|
+
if (cell.si !== void 0) result.si = cell.si;
|
|
24907
|
+
if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
|
|
24908
|
+
if (cell.rowSpan !== void 0) result.rowSpan = cell.rowSpan;
|
|
24909
|
+
if (cell.colSpan !== void 0) result.colSpan = cell.colSpan;
|
|
24910
|
+
if (cell.displayV !== void 0) result.displayV = cell.displayV;
|
|
24911
|
+
return result;
|
|
24912
|
+
}
|
|
24913
|
+
/**
|
|
24914
|
+
* Fast clone for cell data matrix. Optimized for sparse matrix structure.
|
|
24915
|
+
* @param cellData - The cell data matrix to clone
|
|
24916
|
+
* @returns A deep clone of the cell data matrix
|
|
24917
|
+
*/
|
|
24918
|
+
function cloneCellDataMatrix(cellData) {
|
|
24919
|
+
const result = {};
|
|
24920
|
+
const rowKeys = Object.keys(cellData);
|
|
24921
|
+
for (let i = 0, rowLen = rowKeys.length; i < rowLen; i++) {
|
|
24922
|
+
const rowKey = rowKeys[i];
|
|
24923
|
+
const rowNum = Number(rowKey);
|
|
24924
|
+
const rowData = cellData[rowNum];
|
|
24925
|
+
if (rowData === void 0) continue;
|
|
24926
|
+
const clonedRow = {};
|
|
24927
|
+
const colKeys = Object.keys(rowData);
|
|
24928
|
+
for (let j = 0, colLen = colKeys.length; j < colLen; j++) {
|
|
24929
|
+
const colKey = colKeys[j];
|
|
24930
|
+
const colNum = Number(colKey);
|
|
24931
|
+
const cell = rowData[colNum];
|
|
24932
|
+
if (cell !== void 0 && cell !== null) clonedRow[colNum] = cloneCellData(cell);
|
|
24933
|
+
}
|
|
24934
|
+
result[rowNum] = clonedRow;
|
|
24935
|
+
}
|
|
24936
|
+
return result;
|
|
24937
|
+
}
|
|
24938
|
+
/**
|
|
24939
|
+
* Fast clone for row/column data arrays (sparse arrays stored as objects).
|
|
24940
|
+
* @param data - The row or column data to clone
|
|
24941
|
+
* @returns A deep clone of the row or column data
|
|
24942
|
+
*/
|
|
24943
|
+
function cloneRowColumnData(data) {
|
|
24944
|
+
const result = {};
|
|
24945
|
+
const keys = Object.keys(data);
|
|
24946
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
24947
|
+
const key = keys[i];
|
|
24948
|
+
const idx = Number(key);
|
|
24949
|
+
const item = data[idx];
|
|
24950
|
+
if (item === void 0) continue;
|
|
24951
|
+
const cloned = {};
|
|
24952
|
+
if ("h" in item && item.h !== void 0) cloned.h = item.h;
|
|
24953
|
+
if ("ia" in item && item.ia !== void 0) cloned.ia = item.ia;
|
|
24954
|
+
if ("ah" in item && item.ah !== void 0) cloned.ah = item.ah;
|
|
24955
|
+
if ("hd" in item && item.hd !== void 0) cloned.hd = item.hd;
|
|
24956
|
+
if ("w" in item && item.w !== void 0) cloned.w = item.w;
|
|
24957
|
+
if ("s" in item && item.s !== void 0) if (item.s === null || typeof item.s === "string") cloned.s = item.s;
|
|
24958
|
+
else cloned.s = cloneValue(item.s);
|
|
24959
|
+
if ("custom" in item && item.custom !== void 0) cloned.custom = item.custom === null ? null : cloneValue(item.custom);
|
|
24960
|
+
result[idx] = cloned;
|
|
24961
|
+
}
|
|
24962
|
+
return result;
|
|
24963
|
+
}
|
|
24964
|
+
/**
|
|
24965
|
+
* Fast clone for IRange array (merge data).
|
|
24966
|
+
* @param ranges - The array of ranges to clone
|
|
24967
|
+
* @returns A shallow clone of the ranges (IRange contains only primitive values)
|
|
24968
|
+
*/
|
|
24969
|
+
function cloneMergeData(ranges) {
|
|
24970
|
+
const len = ranges.length;
|
|
24971
|
+
const result = new Array(len);
|
|
24972
|
+
for (let i = 0; i < len; i++) {
|
|
24973
|
+
const range = ranges[i];
|
|
24974
|
+
result[i] = {
|
|
24975
|
+
startRow: range.startRow,
|
|
24976
|
+
startColumn: range.startColumn,
|
|
24977
|
+
endRow: range.endRow,
|
|
24978
|
+
endColumn: range.endColumn,
|
|
24979
|
+
rangeType: range.rangeType,
|
|
24980
|
+
startAbsoluteRefType: range.startAbsoluteRefType,
|
|
24981
|
+
endAbsoluteRefType: range.endAbsoluteRefType
|
|
24982
|
+
};
|
|
24983
|
+
}
|
|
24984
|
+
return result;
|
|
24985
|
+
}
|
|
24986
|
+
/**
|
|
24987
|
+
* Optimized deep clone specifically for IWorksheetData.
|
|
24988
|
+
* This is significantly faster than generic deepClone because:
|
|
24989
|
+
* 1. No recursive type checking - we know the structure
|
|
24990
|
+
* 2. Direct property access instead of Object.keys iteration for known properties
|
|
24991
|
+
* 3. Specialized handlers for cellData matrix (the largest data)
|
|
24992
|
+
* 4. Primitive values copied directly without cloning
|
|
24993
|
+
*
|
|
24994
|
+
* @param worksheet - The worksheet data to clone
|
|
24995
|
+
* @returns A deep clone of the worksheet data
|
|
24996
|
+
*/
|
|
24997
|
+
function cloneWorksheetData(worksheet) {
|
|
24998
|
+
const result = {
|
|
24999
|
+
id: worksheet.id,
|
|
25000
|
+
name: worksheet.name,
|
|
25001
|
+
tabColor: worksheet.tabColor,
|
|
25002
|
+
hidden: worksheet.hidden,
|
|
25003
|
+
rowCount: worksheet.rowCount,
|
|
25004
|
+
columnCount: worksheet.columnCount,
|
|
25005
|
+
zoomRatio: worksheet.zoomRatio,
|
|
25006
|
+
scrollTop: worksheet.scrollTop,
|
|
25007
|
+
scrollLeft: worksheet.scrollLeft,
|
|
25008
|
+
defaultColumnWidth: worksheet.defaultColumnWidth,
|
|
25009
|
+
defaultRowHeight: worksheet.defaultRowHeight,
|
|
25010
|
+
showGridlines: worksheet.showGridlines,
|
|
25011
|
+
rightToLeft: worksheet.rightToLeft,
|
|
25012
|
+
freeze: {
|
|
25013
|
+
xSplit: worksheet.freeze.xSplit,
|
|
25014
|
+
ySplit: worksheet.freeze.ySplit,
|
|
25015
|
+
startRow: worksheet.freeze.startRow,
|
|
25016
|
+
startColumn: worksheet.freeze.startColumn
|
|
25017
|
+
},
|
|
25018
|
+
rowHeader: {
|
|
25019
|
+
width: worksheet.rowHeader.width,
|
|
25020
|
+
hidden: worksheet.rowHeader.hidden
|
|
25021
|
+
},
|
|
25022
|
+
columnHeader: {
|
|
25023
|
+
height: worksheet.columnHeader.height,
|
|
25024
|
+
hidden: worksheet.columnHeader.hidden
|
|
25025
|
+
},
|
|
25026
|
+
mergeData: cloneMergeData(worksheet.mergeData),
|
|
25027
|
+
cellData: cloneCellDataMatrix(worksheet.cellData),
|
|
25028
|
+
rowData: cloneRowColumnData(worksheet.rowData),
|
|
25029
|
+
columnData: cloneRowColumnData(worksheet.columnData)
|
|
25030
|
+
};
|
|
25031
|
+
if (worksheet.gridlinesColor !== void 0) result.gridlinesColor = worksheet.gridlinesColor;
|
|
25032
|
+
if (worksheet.defaultStyle !== void 0) if (worksheet.defaultStyle === null || typeof worksheet.defaultStyle === "string") result.defaultStyle = worksheet.defaultStyle;
|
|
25033
|
+
else result.defaultStyle = cloneValue(worksheet.defaultStyle);
|
|
25034
|
+
if (worksheet.custom !== void 0) result.custom = worksheet.custom === null ? null : cloneValue(worksheet.custom);
|
|
25035
|
+
return result;
|
|
25036
|
+
}
|
|
25037
|
+
|
|
25173
25038
|
//#endregion
|
|
25174
25039
|
//#region src/skeleton.ts
|
|
25175
25040
|
let Skeleton = class Skeleton extends Disposable {
|
|
@@ -25282,12 +25147,6 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25282
25147
|
}
|
|
25283
25148
|
resetCache() {}
|
|
25284
25149
|
/**
|
|
25285
|
-
* @deprecated should never expose a property that is provided by another module!
|
|
25286
|
-
*/
|
|
25287
|
-
getWorksheetConfig() {
|
|
25288
|
-
return this._worksheetData;
|
|
25289
|
-
}
|
|
25290
|
-
/**
|
|
25291
25150
|
* Get which Workbook and Worksheet this skeleton is attached to.
|
|
25292
25151
|
* @returns [unitId, sheetId]
|
|
25293
25152
|
*/
|
|
@@ -26345,11 +26204,12 @@ var Univer = class {
|
|
|
26345
26204
|
_defineProperty(this, "_injector", void 0);
|
|
26346
26205
|
_defineProperty(this, "_disposingCallbacks", new DisposableCollection());
|
|
26347
26206
|
const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
|
|
26348
|
-
const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
|
|
26207
|
+
const { theme, darkMode, locale, region, locales, direction, logLevel, logCommandExecution } = config;
|
|
26349
26208
|
if (theme) this._injector.get(ThemeService).setTheme(theme);
|
|
26350
26209
|
if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
|
|
26351
26210
|
if (locales) this._injector.get(LocaleService).load(locales);
|
|
26352
26211
|
if (locale) this._injector.get(LocaleService).setLocale(locale);
|
|
26212
|
+
if (region) this._injector.get(RegionService).setRegion(region);
|
|
26353
26213
|
if (direction) this._injector.get(LocaleService).setDirection(direction);
|
|
26354
26214
|
if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
|
|
26355
26215
|
if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
|
|
@@ -26380,6 +26240,9 @@ var Univer = class {
|
|
|
26380
26240
|
setLocale(locale) {
|
|
26381
26241
|
this._injector.get(LocaleService).setLocale(locale);
|
|
26382
26242
|
}
|
|
26243
|
+
setRegion(region) {
|
|
26244
|
+
this._injector.get(RegionService).setRegion(region);
|
|
26245
|
+
}
|
|
26383
26246
|
createUnit(type, data) {
|
|
26384
26247
|
return this._univerInstanceService.createUnit(type, data);
|
|
26385
26248
|
}
|
|
@@ -26425,6 +26288,7 @@ function createUniverInjector(parentInjector, override) {
|
|
|
26425
26288
|
const dependencies = mergeOverrideWithDependencies([
|
|
26426
26289
|
[ErrorService],
|
|
26427
26290
|
[LocaleService],
|
|
26291
|
+
[RegionService],
|
|
26428
26292
|
[ThemeService],
|
|
26429
26293
|
[LifecycleService],
|
|
26430
26294
|
[PluginService],
|
|
@@ -26590,16 +26454,17 @@ exports.DocumentBlockRangeType = DocumentBlockRangeType;
|
|
|
26590
26454
|
exports.DocumentBlockType = DocumentBlockType;
|
|
26591
26455
|
exports.DocumentDataModel = DocumentDataModel;
|
|
26592
26456
|
exports.DocumentFlavor = DocumentFlavor;
|
|
26457
|
+
exports.DocxBreakType = DocxBreakType;
|
|
26593
26458
|
exports.DrawingTypeEnum = DrawingTypeEnum;
|
|
26594
26459
|
exports.EDITOR_ACTIVATED = EDITOR_ACTIVATED;
|
|
26595
26460
|
exports.EXTENSION_NAMES = EXTENSION_NAMES;
|
|
26596
26461
|
exports.ErrorService = ErrorService;
|
|
26597
26462
|
exports.EventState = EventState;
|
|
26598
26463
|
exports.EventSubject = EventSubject;
|
|
26464
|
+
exports.FOCUSING_BOARD = FOCUSING_BOARD;
|
|
26599
26465
|
exports.FOCUSING_COMMENT_EDITOR = FOCUSING_COMMENT_EDITOR;
|
|
26600
26466
|
exports.FOCUSING_COMMON_DRAWINGS = FOCUSING_COMMON_DRAWINGS;
|
|
26601
26467
|
exports.FOCUSING_DOC = FOCUSING_DOC;
|
|
26602
|
-
exports.FOCUSING_EDITOR_BUT_HIDDEN = FOCUSING_EDITOR_BUT_HIDDEN;
|
|
26603
26468
|
exports.FOCUSING_EDITOR_INPUT_FORMULA = FOCUSING_EDITOR_INPUT_FORMULA;
|
|
26604
26469
|
exports.FOCUSING_EDITOR_STANDALONE = FOCUSING_EDITOR_STANDALONE;
|
|
26605
26470
|
exports.FOCUSING_FX_BAR_EDITOR = FOCUSING_FX_BAR_EDITOR;
|
|
@@ -26776,6 +26641,12 @@ Object.defineProperty(exports, 'RediError', {
|
|
|
26776
26641
|
exports.RedoCommand = RedoCommand;
|
|
26777
26642
|
exports.RedoCommandId = RedoCommandId;
|
|
26778
26643
|
exports.RefAlias = RefAlias;
|
|
26644
|
+
Object.defineProperty(exports, 'RegionService', {
|
|
26645
|
+
enumerable: true,
|
|
26646
|
+
get: function () {
|
|
26647
|
+
return RegionService;
|
|
26648
|
+
}
|
|
26649
|
+
});
|
|
26779
26650
|
exports.Registry = Registry;
|
|
26780
26651
|
exports.RegistryAsMap = RegistryAsMap;
|
|
26781
26652
|
exports.RelativeDate = RelativeDate;
|
|
@@ -26826,6 +26697,7 @@ exports.Styles = Styles;
|
|
|
26826
26697
|
exports.TEXT_DECORATION_KEYS = TEXT_DECORATION_KEYS;
|
|
26827
26698
|
exports.TEXT_ROTATION_KEYS = TEXT_ROTATION_KEYS;
|
|
26828
26699
|
exports.THEME_COLORS = THEME_COLORS;
|
|
26700
|
+
exports.TRADITIONAL_DOCUMENT_DEFAULT_MARGIN = TRADITIONAL_DOCUMENT_DEFAULT_MARGIN;
|
|
26829
26701
|
exports.TabStopAlignment = TabStopAlignment;
|
|
26830
26702
|
exports.TableAlignmentType = TableAlignmentType;
|
|
26831
26703
|
exports.TableLayoutType = TableLayoutType;
|
|
@@ -26965,7 +26837,6 @@ exports.getBodySliceForSplitTextXAction = getBodySliceForSplitTextXAction;
|
|
|
26965
26837
|
exports.getBodySliceForTextXAction = getBodySliceForTextXAction;
|
|
26966
26838
|
exports.getBorderStyleType = getBorderStyleType;
|
|
26967
26839
|
exports.getCellCoordByIndexSimple = getCellCoordByIndexSimple;
|
|
26968
|
-
exports.getCellInfoInMergeData = getCellInfoInMergeData;
|
|
26969
26840
|
exports.getCellValueType = getCellValueType;
|
|
26970
26841
|
exports.getCellWithCoordByIndexCore = getCellWithCoordByIndexCore;
|
|
26971
26842
|
exports.getColorStyle = getColorStyle;
|
|
@@ -27082,8 +26953,6 @@ Object.defineProperty(exports, 'isValueDependencyItem', {
|
|
|
27082
26953
|
exports.isWhiteColor = isWhiteColor;
|
|
27083
26954
|
exports.makeArray = makeArray;
|
|
27084
26955
|
exports.makeCellRangeToRangeData = makeCellRangeToRangeData;
|
|
27085
|
-
exports.makeCellToSelection = makeCellToSelection;
|
|
27086
|
-
exports.makeCustomRangeStream = makeCustomRangeStream;
|
|
27087
26956
|
exports.mapObjectMatrix = mapObjectMatrix;
|
|
27088
26957
|
Object.defineProperty(exports, 'merge', {
|
|
27089
26958
|
enumerable: true,
|